File indexing completed on 2024-04-06 12:22:18
0001 #ifndef L1GtConfigProducers_L1GtTriggerMenuXmlParser_h
0002 #define L1GtConfigProducers_L1GtTriggerMenuXmlParser_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include <string>
0021 #include <vector>
0022
0023 #include <xercesc/sax/HandlerBase.hpp>
0024 #include <xercesc/dom/DOM.hpp>
0025 #include <xercesc/parsers/XercesDOMParser.hpp>
0026
0027
0028
0029 #include "L1TriggerConfig/L1GtConfigProducers/interface/L1GtXmlParserTags.h"
0030
0031 #include "CondFormats/L1TObjects/interface/L1GtFwd.h"
0032 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenuFwd.h"
0033
0034 #include "CondFormats/L1TObjects/interface/L1GtMuonTemplate.h"
0035 #include "CondFormats/L1TObjects/interface/L1GtCaloTemplate.h"
0036 #include "CondFormats/L1TObjects/interface/L1GtEnergySumTemplate.h"
0037 #include "CondFormats/L1TObjects/interface/L1GtJetCountsTemplate.h"
0038 #include "CondFormats/L1TObjects/interface/L1GtCastorTemplate.h"
0039 #include "CondFormats/L1TObjects/interface/L1GtHfBitCountsTemplate.h"
0040 #include "CondFormats/L1TObjects/interface/L1GtHfRingEtSumsTemplate.h"
0041 #include "CondFormats/L1TObjects/interface/L1GtCorrelationTemplate.h"
0042 #include "CondFormats/L1TObjects/interface/L1GtBptxTemplate.h"
0043 #include "CondFormats/L1TObjects/interface/L1GtExternalTemplate.h"
0044 #include <cstdint>
0045
0046
0047 class L1GtCondition;
0048 class L1GtAlgorithm;
0049
0050
0051 class L1GtTriggerMenuXmlParser : public L1GtXmlParserTags {
0052 public:
0053
0054
0055 L1GtTriggerMenuXmlParser();
0056
0057
0058 ~L1GtTriggerMenuXmlParser() override;
0059
0060 public:
0061
0062 inline const unsigned int gtNumberConditionChips() const { return m_numberConditionChips; }
0063
0064 void setGtNumberConditionChips(const unsigned int&);
0065
0066
0067 inline const unsigned int gtPinsOnConditionChip() const { return m_pinsOnConditionChip; }
0068
0069 void setGtPinsOnConditionChip(const unsigned int&);
0070
0071
0072
0073 inline std::vector<int> gtOrderConditionChip() const { return m_orderConditionChip; }
0074
0075 void setGtOrderConditionChip(const std::vector<int>&);
0076
0077
0078 inline const unsigned int gtNumberPhysTriggers() const { return m_numberPhysTriggers; }
0079
0080 void setGtNumberPhysTriggers(const unsigned int&);
0081
0082
0083 inline const unsigned int gtNumberTechTriggers() const { return m_numberTechTriggers; }
0084
0085 void setGtNumberTechTriggers(const unsigned int&);
0086
0087
0088 inline const unsigned int gtNumberL1JetCounts() const { return m_numberL1JetCounts; }
0089
0090 void setGtNumberL1JetCounts(const unsigned int&);
0091
0092 public:
0093
0094 inline const std::vector<ConditionMap>& gtConditionMap() const { return m_conditionMap; }
0095
0096 void setGtConditionMap(const std::vector<ConditionMap>&);
0097
0098
0099 inline const std::string& gtTriggerMenuInterface() const { return m_triggerMenuInterface; }
0100
0101 void setGtTriggerMenuInterface(const std::string&);
0102
0103
0104 inline const std::string& gtTriggerMenuName() const { return m_triggerMenuName; }
0105
0106 void setGtTriggerMenuName(const std::string&);
0107
0108
0109 inline const std::string& gtTriggerMenuImplementation() const { return m_triggerMenuImplementation; }
0110
0111 void setGtTriggerMenuImplementation(const std::string&);
0112
0113
0114 inline const std::string& gtScaleDbKey() const { return m_scaleDbKey; }
0115
0116 void setGtScaleDbKey(const std::string&);
0117
0118
0119 inline const std::vector<std::vector<L1GtMuonTemplate> >& vecMuonTemplate() const { return m_vecMuonTemplate; }
0120 void setVecMuonTemplate(const std::vector<std::vector<L1GtMuonTemplate> >&);
0121
0122
0123 inline const std::vector<std::vector<L1GtCaloTemplate> >& vecCaloTemplate() const { return m_vecCaloTemplate; }
0124
0125 void setVecCaloTemplate(const std::vector<std::vector<L1GtCaloTemplate> >&);
0126
0127
0128 inline const std::vector<std::vector<L1GtEnergySumTemplate> >& vecEnergySumTemplate() const {
0129 return m_vecEnergySumTemplate;
0130 }
0131
0132 void setVecEnergySumTemplate(const std::vector<std::vector<L1GtEnergySumTemplate> >&);
0133
0134
0135 inline const std::vector<std::vector<L1GtJetCountsTemplate> >& vecJetCountsTemplate() const {
0136 return m_vecJetCountsTemplate;
0137 }
0138
0139 void setVecJetCountsTemplate(const std::vector<std::vector<L1GtJetCountsTemplate> >&);
0140
0141
0142 inline const std::vector<std::vector<L1GtCastorTemplate> >& vecCastorTemplate() const { return m_vecCastorTemplate; }
0143
0144 void setVecCastorTemplate(const std::vector<std::vector<L1GtCastorTemplate> >&);
0145
0146
0147 inline const std::vector<std::vector<L1GtHfBitCountsTemplate> >& vecHfBitCountsTemplate() const {
0148 return m_vecHfBitCountsTemplate;
0149 }
0150
0151 void setVecHfBitCountsTemplate(const std::vector<std::vector<L1GtHfBitCountsTemplate> >&);
0152
0153
0154 inline const std::vector<std::vector<L1GtHfRingEtSumsTemplate> >& vecHfRingEtSumsTemplate() const {
0155 return m_vecHfRingEtSumsTemplate;
0156 }
0157
0158 void setVecHfRingEtSumsTemplate(const std::vector<std::vector<L1GtHfRingEtSumsTemplate> >&);
0159
0160
0161 inline const std::vector<std::vector<L1GtBptxTemplate> >& vecBptxTemplate() const { return m_vecBptxTemplate; }
0162
0163 void setVecBptxTemplate(const std::vector<std::vector<L1GtBptxTemplate> >&);
0164
0165
0166 inline const std::vector<std::vector<L1GtExternalTemplate> >& vecExternalTemplate() const {
0167 return m_vecExternalTemplate;
0168 }
0169
0170 void setVecExternalTemplate(const std::vector<std::vector<L1GtExternalTemplate> >&);
0171
0172
0173 inline const std::vector<std::vector<L1GtCorrelationTemplate> >& vecCorrelationTemplate() const {
0174 return m_vecCorrelationTemplate;
0175 }
0176
0177 void setVecCorrelationTemplate(const std::vector<std::vector<L1GtCorrelationTemplate> >&);
0178
0179
0180
0181 inline const std::vector<std::vector<L1GtMuonTemplate> >& corMuonTemplate() const { return m_corMuonTemplate; }
0182
0183 void setCorMuonTemplate(const std::vector<std::vector<L1GtMuonTemplate> >&);
0184
0185
0186 inline const std::vector<std::vector<L1GtCaloTemplate> >& corCaloTemplate() const { return m_corCaloTemplate; }
0187
0188 void setCorCaloTemplate(const std::vector<std::vector<L1GtCaloTemplate> >&);
0189
0190
0191 inline const std::vector<std::vector<L1GtEnergySumTemplate> >& corEnergySumTemplate() const {
0192 return m_corEnergySumTemplate;
0193 }
0194
0195 void setCorEnergySumTemplate(const std::vector<std::vector<L1GtEnergySumTemplate> >&);
0196
0197
0198 inline const AlgorithmMap& gtAlgorithmMap() const { return m_algorithmMap; }
0199
0200 void setGtAlgorithmMap(const AlgorithmMap&);
0201
0202
0203 inline const AlgorithmMap& gtAlgorithmAliasMap() const { return m_algorithmAliasMap; }
0204
0205 void setGtAlgorithmAliasMap(const AlgorithmMap&);
0206
0207
0208 inline const AlgorithmMap& gtTechnicalTriggerMap() const { return m_technicalTriggerMap; }
0209
0210 void setGtTechnicalTriggerMap(const AlgorithmMap&);
0211
0212 public:
0213
0214 void parseXmlFile(const std::string& defXmlFile, const std::string& vmeXmlFile);
0215
0216 public:
0217
0218 inline const std::string& gtTriggerMenuInterfaceDate() const { return m_triggerMenuInterfaceDate; }
0219
0220 void setGtTriggerMenuInterfaceDate(const std::string&);
0221
0222 inline const std::string& gtTriggerMenuInterfaceAuthor() const { return m_triggerMenuInterfaceAuthor; }
0223
0224 void setGtTriggerMenuInterfaceAuthor(const std::string&);
0225
0226 inline const std::string& gtTriggerMenuInterfaceDescription() const { return m_triggerMenuInterfaceDescription; }
0227
0228 void setGtTriggerMenuInterfaceDescription(const std::string&);
0229
0230
0231
0232 inline const std::string& gtTriggerMenuDate() const { return m_triggerMenuDate; }
0233
0234 void setGtTriggerMenuDate(const std::string&);
0235
0236 inline const std::string& gtTriggerMenuAuthor() const { return m_triggerMenuAuthor; }
0237
0238 void setGtTriggerMenuAuthor(const std::string&);
0239
0240 inline const std::string& gtTriggerMenuDescription() const { return m_triggerMenuDescription; }
0241
0242 void setGtTriggerMenuDescription(const std::string&);
0243
0244 inline const std::string& gtAlgorithmImplementation() const { return m_algorithmImplementation; }
0245
0246 void setGtAlgorithmImplementation(const std::string&);
0247
0248 private:
0249
0250
0251
0252 XERCES_CPP_NAMESPACE::XercesDOMParser* initXML(const std::string& xmlFile);
0253
0254
0255 XERCES_CPP_NAMESPACE::DOMNode* findXMLChild(XERCES_CPP_NAMESPACE::DOMNode* startChild,
0256 const std::string& tagName,
0257 bool beginOnly = false,
0258 std::string* rest = nullptr);
0259
0260
0261 std::string getXMLAttribute(const XERCES_CPP_NAMESPACE::DOMNode* node, const std::string& name);
0262
0263
0264 std::string getXMLTextValue(XERCES_CPP_NAMESPACE::DOMNode* node);
0265
0266
0267 bool hexString2UInt128(const std::string& hexString, uint64_t& dstL, uint64_t& dstH);
0268
0269
0270 bool getXMLHexTextValue128(XERCES_CPP_NAMESPACE::DOMNode* node, uint64_t& dstL, uint64_t& dstH);
0271
0272
0273 bool getXMLHexTextValue(XERCES_CPP_NAMESPACE::DOMNode* node, uint64_t& dst);
0274
0275
0276 bool countConditionChildMaxBits(XERCES_CPP_NAMESPACE::DOMNode* node, const std::string& childName, unsigned int& dst);
0277
0278
0279 bool getConditionChildValues(XERCES_CPP_NAMESPACE::DOMNode* node,
0280 const std::string& childName,
0281 unsigned int num,
0282 std::vector<uint64_t>& dst);
0283
0284
0285 void cleanupXML(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
0286
0287 private:
0288
0289
0290
0291 bool parseVmeXML(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
0292
0293 private:
0294
0295
0296
0297
0298 void clearMaps();
0299
0300
0301
0302 bool insertConditionIntoMap(L1GtCondition& cond, const int chipNr);
0303
0304
0305 bool insertAlgorithmIntoMap(const L1GtAlgorithm& alg);
0306
0307
0308 bool insertTechTriggerIntoMap(const L1GtAlgorithm& alg);
0309
0310
0311
0312 L1GtConditionType getTypeFromType(const std::string& type);
0313
0314
0315 int getNumFromType(const std::string& type);
0316
0317
0318 int getBitFromNode(XERCES_CPP_NAMESPACE::DOMNode* node);
0319
0320
0321 int getGEqFlag(XERCES_CPP_NAMESPACE::DOMNode* node, const std::string& nodeName);
0322
0323
0324 bool getMuonMipIsoBits(XERCES_CPP_NAMESPACE::DOMNode* node,
0325 unsigned int num,
0326 std::vector<bool>& mipDst,
0327 std::vector<bool>& isoEnDst,
0328 std::vector<bool>& isoReqDst);
0329
0330
0331 bool parseMuon(XERCES_CPP_NAMESPACE::DOMNode* node,
0332 const std::string& name,
0333 unsigned int chipNr = 0,
0334 const bool corrFlag = false);
0335
0336
0337 bool parseCalo(XERCES_CPP_NAMESPACE::DOMNode* node,
0338 const std::string& name,
0339 unsigned int chipNr = 0,
0340 const bool corrFlag = false);
0341
0342
0343 bool parseEnergySum(XERCES_CPP_NAMESPACE::DOMNode* node,
0344 const std::string& name,
0345 unsigned int chipNr = 0,
0346 const bool corrFlag = false);
0347
0348
0349 bool parseJetCounts(XERCES_CPP_NAMESPACE::DOMNode* node, const std::string& name, unsigned int chipNr = 0);
0350
0351
0352 bool parseCastor(XERCES_CPP_NAMESPACE::DOMNode* node, const std::string& name, unsigned int chipNr = 0);
0353
0354
0355 bool parseHfBitCounts(XERCES_CPP_NAMESPACE::DOMNode* node, const std::string& name, unsigned int chipNr = 0);
0356
0357
0358 bool parseHfRingEtSums(XERCES_CPP_NAMESPACE::DOMNode* node, const std::string& name, unsigned int chipNr = 0);
0359
0360
0361 bool parseBptx(XERCES_CPP_NAMESPACE::DOMNode* node, const std::string& name, unsigned int chipNr = 0);
0362
0363
0364 bool parseExternal(XERCES_CPP_NAMESPACE::DOMNode* node, const std::string& name, unsigned int chipNr = 0);
0365
0366
0367 bool parseCorrelation(XERCES_CPP_NAMESPACE::DOMNode* node, const std::string& name, unsigned int chipNr = 0);
0368
0369
0370 bool parseId(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
0371
0372
0373 bool workCondition(XERCES_CPP_NAMESPACE::DOMNode* node, const std::string& name, unsigned int chipNr);
0374
0375
0376 bool parseConditions(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
0377
0378
0379 bool workAlgorithm(XERCES_CPP_NAMESPACE::DOMNode* node, const std::string& name, unsigned int chipNr);
0380
0381
0382 bool parseAlgorithms(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
0383
0384
0385 bool workTechTrigger(XERCES_CPP_NAMESPACE::DOMNode* node, const std::string& name);
0386
0387
0388 bool parseTechTriggers(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
0389
0390
0391 bool workXML(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
0392
0393 private:
0394
0395 XERCES_CPP_NAMESPACE::ErrorHandler* m_xmlErrHandler;
0396
0397
0398
0399
0400 unsigned int m_numberConditionChips;
0401
0402
0403 unsigned int m_pinsOnConditionChip;
0404
0405
0406
0407 std::vector<int> m_orderConditionChip;
0408
0409
0410 unsigned int m_numberPhysTriggers;
0411
0412
0413 unsigned int m_numberTechTriggers;
0414
0415
0416 unsigned int m_numberL1JetCounts;
0417
0418 private:
0419
0420
0421 std::string m_triggerMenuInterfaceDate;
0422 std::string m_triggerMenuInterfaceAuthor;
0423 std::string m_triggerMenuInterfaceDescription;
0424
0425 std::string m_triggerMenuDate;
0426 std::string m_triggerMenuAuthor;
0427 std::string m_triggerMenuDescription;
0428
0429 std::string m_algorithmImplementation;
0430
0431 private:
0432
0433 std::vector<ConditionMap> m_conditionMap;
0434
0435 private:
0436
0437 std::string m_triggerMenuInterface;
0438 std::string m_triggerMenuName;
0439 std::string m_triggerMenuImplementation;
0440
0441
0442 std::string m_scaleDbKey;
0443
0444
0445
0446 std::vector<std::vector<L1GtMuonTemplate> > m_vecMuonTemplate;
0447 std::vector<std::vector<L1GtCaloTemplate> > m_vecCaloTemplate;
0448 std::vector<std::vector<L1GtEnergySumTemplate> > m_vecEnergySumTemplate;
0449 std::vector<std::vector<L1GtJetCountsTemplate> > m_vecJetCountsTemplate;
0450 std::vector<std::vector<L1GtCastorTemplate> > m_vecCastorTemplate;
0451 std::vector<std::vector<L1GtHfBitCountsTemplate> > m_vecHfBitCountsTemplate;
0452 std::vector<std::vector<L1GtHfRingEtSumsTemplate> > m_vecHfRingEtSumsTemplate;
0453 std::vector<std::vector<L1GtBptxTemplate> > m_vecBptxTemplate;
0454 std::vector<std::vector<L1GtExternalTemplate> > m_vecExternalTemplate;
0455
0456 std::vector<std::vector<L1GtCorrelationTemplate> > m_vecCorrelationTemplate;
0457 std::vector<std::vector<L1GtMuonTemplate> > m_corMuonTemplate;
0458 std::vector<std::vector<L1GtCaloTemplate> > m_corCaloTemplate;
0459 std::vector<std::vector<L1GtEnergySumTemplate> > m_corEnergySumTemplate;
0460
0461
0462 AlgorithmMap m_algorithmMap;
0463
0464
0465 AlgorithmMap m_algorithmAliasMap;
0466
0467
0468 AlgorithmMap m_technicalTriggerMap;
0469 };
0470
0471 #endif