CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/L1TriggerConfig/L1GtConfigProducers/interface/L1GtTriggerMenuXmlParser.h

Go to the documentation of this file.
00001 #ifndef L1GtConfigProducers_L1GtTriggerMenuXmlParser_h
00002 #define L1GtConfigProducers_L1GtTriggerMenuXmlParser_h
00003 
00021 // system include files
00022 #include <string>
00023 #include <vector>
00024 
00025 #include <boost/cstdint.hpp>
00026 
00027 #include <xercesc/sax/HandlerBase.hpp>
00028 #include <xercesc/dom/DOM.hpp>
00029 #include <xercesc/parsers/XercesDOMParser.hpp>
00030 
00031 // user include files
00032 // base class
00033 #include "L1TriggerConfig/L1GtConfigProducers/interface/L1GtXmlParserTags.h"
00034 
00035 #include "CondFormats/L1TObjects/interface/L1GtFwd.h"
00036 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenuFwd.h"
00037 
00038 #include "CondFormats/L1TObjects/interface/L1GtMuonTemplate.h"
00039 #include "CondFormats/L1TObjects/interface/L1GtCaloTemplate.h"
00040 #include "CondFormats/L1TObjects/interface/L1GtEnergySumTemplate.h"
00041 #include "CondFormats/L1TObjects/interface/L1GtJetCountsTemplate.h"
00042 #include "CondFormats/L1TObjects/interface/L1GtCastorTemplate.h"
00043 #include "CondFormats/L1TObjects/interface/L1GtHfBitCountsTemplate.h"
00044 #include "CondFormats/L1TObjects/interface/L1GtHfRingEtSumsTemplate.h"
00045 #include "CondFormats/L1TObjects/interface/L1GtCorrelationTemplate.h"
00046 #include "CondFormats/L1TObjects/interface/L1GtBptxTemplate.h"
00047 #include "CondFormats/L1TObjects/interface/L1GtExternalTemplate.h"
00048 
00049 // forward declarations
00050 class L1GtCondition;
00051 class L1GtAlgorithm;
00052 
00053 // class declaration
00054 class L1GtTriggerMenuXmlParser : public L1GtXmlParserTags
00055 {
00056 
00057 public:
00058 
00061     L1GtTriggerMenuXmlParser();
00062 
00064     virtual ~L1GtTriggerMenuXmlParser();
00065 
00066 public:
00067 
00069     inline const unsigned int gtNumberConditionChips() const {
00070         return m_numberConditionChips;
00071     }
00072 
00073     void setGtNumberConditionChips(const unsigned int&);
00074 
00076     inline const unsigned int gtPinsOnConditionChip() const {
00077         return m_pinsOnConditionChip;
00078     }
00079 
00080     void setGtPinsOnConditionChip(const unsigned int&);
00081 
00084     inline std::vector<int> gtOrderConditionChip() const {
00085         return m_orderConditionChip;
00086     }
00087 
00088     void setGtOrderConditionChip(const std::vector<int>&);
00089 
00091     inline const unsigned int gtNumberPhysTriggers() const {
00092         return m_numberPhysTriggers;
00093     }
00094 
00095     void setGtNumberPhysTriggers(const unsigned int&);
00096 
00098     inline const unsigned int gtNumberTechTriggers() const {
00099         return m_numberTechTriggers;
00100     }
00101 
00102     void setGtNumberTechTriggers(const unsigned int&);
00103 
00105     inline const unsigned int gtNumberL1JetCounts() const {
00106         return m_numberL1JetCounts;
00107     }
00108 
00109     void setGtNumberL1JetCounts(const unsigned int&);
00110 
00111 public:
00112 
00114     inline const std::vector<ConditionMap>& gtConditionMap() const {
00115         return m_conditionMap;
00116     }
00117 
00118     void setGtConditionMap(const std::vector<ConditionMap>&);
00119 
00121     inline const std::string& gtTriggerMenuInterface() const {
00122         return m_triggerMenuInterface;
00123     }
00124 
00125     void setGtTriggerMenuInterface(const std::string&);
00126 
00127     //
00128     inline const std::string& gtTriggerMenuName() const {
00129         return m_triggerMenuName;
00130     }
00131 
00132     void setGtTriggerMenuName(const std::string&);
00133 
00134     //
00135     inline const std::string& gtTriggerMenuImplementation() const {
00136         return m_triggerMenuImplementation;
00137     }
00138 
00139     void setGtTriggerMenuImplementation(const std::string&);
00140 
00142     inline const std::string& gtScaleDbKey() const {
00143         return m_scaleDbKey;
00144     }
00145 
00146     void setGtScaleDbKey(const std::string&);
00147 
00149     inline const std::vector<std::vector<L1GtMuonTemplate> >& vecMuonTemplate() const {
00150         return m_vecMuonTemplate;
00151     }
00152     void setVecMuonTemplate(const std::vector<std::vector<L1GtMuonTemplate> >&);
00153 
00154     //
00155     inline const std::vector<std::vector<L1GtCaloTemplate> >& vecCaloTemplate() const {
00156         return m_vecCaloTemplate;
00157     }
00158 
00159     void setVecCaloTemplate(const std::vector<std::vector<L1GtCaloTemplate> >&);
00160 
00161     //
00162     inline const std::vector<std::vector<L1GtEnergySumTemplate> >& vecEnergySumTemplate() const {
00163 
00164         return m_vecEnergySumTemplate;
00165     }
00166 
00167     void setVecEnergySumTemplate(
00168             const std::vector<std::vector<L1GtEnergySumTemplate> >&);
00169 
00170     //
00171     inline const std::vector<std::vector<L1GtJetCountsTemplate> >& vecJetCountsTemplate() const {
00172 
00173         return m_vecJetCountsTemplate;
00174     }
00175 
00176     void setVecJetCountsTemplate(
00177             const std::vector<std::vector<L1GtJetCountsTemplate> >&);
00178 
00179     //
00180     inline const std::vector<std::vector<L1GtCastorTemplate> >& vecCastorTemplate() const {
00181 
00182         return m_vecCastorTemplate;
00183     }
00184 
00185     void setVecCastorTemplate(
00186             const std::vector<std::vector<L1GtCastorTemplate> >&);
00187 
00188     //
00189     inline const std::vector<std::vector<L1GtHfBitCountsTemplate> >&
00190         vecHfBitCountsTemplate() const {
00191 
00192         return m_vecHfBitCountsTemplate;
00193     }
00194 
00195     void setVecHfBitCountsTemplate(
00196             const std::vector<std::vector<L1GtHfBitCountsTemplate> >&);
00197 
00198     //
00199     inline const std::vector<std::vector<L1GtHfRingEtSumsTemplate> >&
00200         vecHfRingEtSumsTemplate() const {
00201 
00202         return m_vecHfRingEtSumsTemplate;
00203     }
00204 
00205     void setVecHfRingEtSumsTemplate(
00206             const std::vector<std::vector<L1GtHfRingEtSumsTemplate> >&);
00207 
00208     //
00209     inline const std::vector<std::vector<L1GtBptxTemplate> >&
00210         vecBptxTemplate() const {
00211 
00212         return m_vecBptxTemplate;
00213     }
00214 
00215     void setVecBptxTemplate(
00216             const std::vector<std::vector<L1GtBptxTemplate> >&);
00217 
00218     //
00219     inline const std::vector<std::vector<L1GtExternalTemplate> >&
00220         vecExternalTemplate() const {
00221 
00222         return m_vecExternalTemplate;
00223     }
00224 
00225     void setVecExternalTemplate(
00226             const std::vector<std::vector<L1GtExternalTemplate> >&);
00227 
00228     //
00229     inline const std::vector<std::vector<L1GtCorrelationTemplate> >& vecCorrelationTemplate() const {
00230 
00231         return m_vecCorrelationTemplate;
00232     }
00233 
00234     void setVecCorrelationTemplate(
00235             const std::vector<std::vector<L1GtCorrelationTemplate> >&);
00236 
00237     // get / set the vectors containing the conditions for correlation templates
00238     //
00239     inline const std::vector<std::vector<L1GtMuonTemplate> >& corMuonTemplate() const {
00240         return m_corMuonTemplate;
00241     }
00242 
00243     void setCorMuonTemplate(const std::vector<std::vector<L1GtMuonTemplate> >&);
00244 
00245     //
00246     inline const std::vector<std::vector<L1GtCaloTemplate> >& corCaloTemplate() const {
00247         return m_corCaloTemplate;
00248     }
00249 
00250     void setCorCaloTemplate(const std::vector<std::vector<L1GtCaloTemplate> >&);
00251 
00252     //
00253     inline const std::vector<std::vector<L1GtEnergySumTemplate> >& corEnergySumTemplate() const {
00254 
00255         return m_corEnergySumTemplate;
00256     }
00257 
00258     void setCorEnergySumTemplate(
00259             const std::vector<std::vector<L1GtEnergySumTemplate> >&);
00260 
00262     inline const AlgorithmMap& gtAlgorithmMap() const {
00263         return m_algorithmMap;
00264     }
00265 
00266     void setGtAlgorithmMap(const AlgorithmMap&);
00267 
00269     inline const AlgorithmMap& gtAlgorithmAliasMap() const {
00270         return m_algorithmAliasMap;
00271     }
00272 
00273     void setGtAlgorithmAliasMap(const AlgorithmMap&);
00274 
00276     inline const AlgorithmMap& gtTechnicalTriggerMap() const {
00277         return m_technicalTriggerMap;
00278     }
00279 
00280     void setGtTechnicalTriggerMap(const AlgorithmMap&);
00281 
00282 public:
00283 
00285     void parseXmlFile(const std::string& defXmlFile,
00286             const std::string& vmeXmlFile);
00287 
00288 public:
00289 
00291     inline const std::string& gtTriggerMenuInterfaceDate() const {
00292         return m_triggerMenuInterfaceDate;
00293     }
00294 
00295     void setGtTriggerMenuInterfaceDate(const std::string&);
00296 
00297     inline const std::string& gtTriggerMenuInterfaceAuthor() const {
00298         return m_triggerMenuInterfaceAuthor;
00299     }
00300 
00301     void setGtTriggerMenuInterfaceAuthor(const std::string&);
00302 
00303     inline const std::string& gtTriggerMenuInterfaceDescription() const {
00304         return m_triggerMenuInterfaceDescription;
00305     }
00306 
00307     void setGtTriggerMenuInterfaceDescription(const std::string&);
00308 
00309     //
00310 
00311     inline const std::string& gtTriggerMenuDate() const {
00312         return m_triggerMenuDate;
00313     }
00314 
00315     void setGtTriggerMenuDate(const std::string&);
00316 
00317     inline const std::string& gtTriggerMenuAuthor() const {
00318         return m_triggerMenuAuthor;
00319     }
00320 
00321     void setGtTriggerMenuAuthor(const std::string&);
00322 
00323     inline const std::string& gtTriggerMenuDescription() const {
00324         return m_triggerMenuDescription;
00325     }
00326 
00327     void setGtTriggerMenuDescription(const std::string&);
00328 
00329 
00330     inline const std::string& gtAlgorithmImplementation() const {
00331         return m_algorithmImplementation;
00332     }
00333 
00334     void setGtAlgorithmImplementation(const std::string&);
00335 
00336 
00337 private:
00338 
00339     // XML methods
00340 
00342     XERCES_CPP_NAMESPACE::XercesDOMParser* initXML(const std::string& xmlFile);
00343 
00345     XERCES_CPP_NAMESPACE::DOMNode* findXMLChild(
00346             XERCES_CPP_NAMESPACE::DOMNode* startChild,
00347             const std::string& tagName, bool beginOnly = false,
00348             std::string* rest = 0);
00349 
00351     std::string getXMLAttribute(const XERCES_CPP_NAMESPACE::DOMNode* node,
00352             const std::string& name);
00353 
00355     std::string getXMLTextValue(XERCES_CPP_NAMESPACE::DOMNode* node);
00356 
00358     bool hexString2UInt128(const std::string& hexString, boost::uint64_t& dstL,
00359             boost::uint64_t& dstH);
00360 
00362     bool getXMLHexTextValue128(XERCES_CPP_NAMESPACE::DOMNode* node,
00363             boost::uint64_t& dstL, boost::uint64_t& dstH);
00364 
00366     bool getXMLHexTextValue(XERCES_CPP_NAMESPACE::DOMNode* node,
00367             boost::uint64_t& dst);
00368 
00370     bool countConditionChildMaxBits(XERCES_CPP_NAMESPACE::DOMNode* node,
00371             const std::string& childName, unsigned int& dst);
00372 
00374     bool getConditionChildValues(XERCES_CPP_NAMESPACE::DOMNode* node,
00375             const std::string& childName, unsigned int num,
00376             std::vector<boost::uint64_t>& dst);
00377 
00379     void cleanupXML(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
00380 
00381 
00382 private:
00383 
00384     // methods for the VME file
00385 
00387     bool parseVmeXML(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
00388 
00389 private:
00390 
00391     // methods for conditions and algorithms
00392 
00395     void clearMaps();
00396 
00399     bool insertConditionIntoMap(L1GtCondition& cond, const int chipNr);
00400 
00402     bool insertAlgorithmIntoMap(const L1GtAlgorithm& alg);
00403 
00405     bool insertTechTriggerIntoMap(const L1GtAlgorithm& alg);
00406 
00409     L1GtConditionType getTypeFromType(const std::string& type);
00410 
00412     int getNumFromType(const std::string& type);
00413 
00415     int getBitFromNode(XERCES_CPP_NAMESPACE::DOMNode* node);
00416 
00418     int getGEqFlag(XERCES_CPP_NAMESPACE::DOMNode* node,
00419             const std::string& nodeName);
00420 
00422     bool getMuonMipIsoBits(XERCES_CPP_NAMESPACE::DOMNode* node,
00423             unsigned int num, std::vector<bool>& mipDst,
00424             std::vector<bool>& isoEnDst, std::vector<bool>& isoReqDst);
00425 
00427     bool parseMuon(XERCES_CPP_NAMESPACE::DOMNode* node,
00428             const std::string& name, unsigned int chipNr = 0,
00429             const bool corrFlag = false);
00430 
00432     bool parseCalo(XERCES_CPP_NAMESPACE::DOMNode* node,
00433             const std::string& name, unsigned int chipNr = 0,
00434             const bool corrFlag = false);
00435 
00437     bool parseEnergySum(XERCES_CPP_NAMESPACE::DOMNode* node,
00438             const std::string& name, unsigned int chipNr = 0,
00439             const bool corrFlag = false);
00440 
00442     bool parseJetCounts(XERCES_CPP_NAMESPACE::DOMNode* node,
00443             const std::string& name, unsigned int chipNr = 0);
00444 
00446     bool parseCastor(XERCES_CPP_NAMESPACE::DOMNode* node,
00447             const std::string& name, unsigned int chipNr = 0);
00448 
00450     bool parseHfBitCounts(XERCES_CPP_NAMESPACE::DOMNode* node,
00451             const std::string& name, unsigned int chipNr = 0);
00452 
00454     bool parseHfRingEtSums(XERCES_CPP_NAMESPACE::DOMNode* node,
00455             const std::string& name, unsigned int chipNr = 0);
00456 
00458     bool parseBptx(XERCES_CPP_NAMESPACE::DOMNode* node,
00459             const std::string& name, unsigned int chipNr = 0);
00460 
00462     bool parseExternal(XERCES_CPP_NAMESPACE::DOMNode* node,
00463             const std::string& name, unsigned int chipNr = 0);
00464 
00466     bool parseCorrelation(XERCES_CPP_NAMESPACE::DOMNode* node,
00467             const std::string& name, unsigned int chipNr = 0);
00468 
00470     bool parseId(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
00471 
00473     bool workCondition(XERCES_CPP_NAMESPACE::DOMNode* node,
00474             const std::string& name, unsigned int chipNr);
00475 
00477     bool parseConditions(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
00478 
00480     bool workAlgorithm(XERCES_CPP_NAMESPACE::DOMNode* node,
00481             const std::string& name, unsigned int chipNr);
00482 
00484     bool parseAlgorithms(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
00485 
00487     bool workTechTrigger(XERCES_CPP_NAMESPACE::DOMNode* node,
00488             const std::string& name);
00489 
00491     bool parseTechTriggers(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
00492 
00494     bool workXML(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
00495 
00496 private:
00497 
00499     XERCES_CPP_NAMESPACE::ErrorHandler* m_xmlErrHandler;
00500 
00502 
00504     unsigned int m_numberConditionChips;
00505 
00507     unsigned int m_pinsOnConditionChip;
00508 
00511     std::vector<int> m_orderConditionChip;
00512 
00514     unsigned int m_numberPhysTriggers;
00515 
00517     unsigned int m_numberTechTriggers;
00518 
00520     unsigned int m_numberL1JetCounts;
00521 
00522 private:
00523 
00525 
00526     std::string m_triggerMenuInterfaceDate;
00527     std::string m_triggerMenuInterfaceAuthor;
00528     std::string m_triggerMenuInterfaceDescription;
00529 
00530     std::string m_triggerMenuDate;
00531     std::string m_triggerMenuAuthor;
00532     std::string m_triggerMenuDescription;
00533 
00534     std::string m_algorithmImplementation;
00535 
00536 
00537 private:
00538 
00540     std::vector<ConditionMap> m_conditionMap;
00541 
00542 private:
00543 
00545     std::string m_triggerMenuInterface;
00546     std::string m_triggerMenuName;
00547     std::string m_triggerMenuImplementation;
00548 
00550     std::string m_scaleDbKey;
00551 
00554     std::vector<std::vector<L1GtMuonTemplate> > m_vecMuonTemplate;
00555     std::vector<std::vector<L1GtCaloTemplate> > m_vecCaloTemplate;
00556     std::vector<std::vector<L1GtEnergySumTemplate> > m_vecEnergySumTemplate;
00557     std::vector<std::vector<L1GtJetCountsTemplate> > m_vecJetCountsTemplate;
00558     std::vector<std::vector<L1GtCastorTemplate> > m_vecCastorTemplate;
00559     std::vector<std::vector<L1GtHfBitCountsTemplate> > m_vecHfBitCountsTemplate;
00560     std::vector<std::vector<L1GtHfRingEtSumsTemplate> > m_vecHfRingEtSumsTemplate;
00561     std::vector<std::vector<L1GtBptxTemplate> > m_vecBptxTemplate;
00562     std::vector<std::vector<L1GtExternalTemplate> > m_vecExternalTemplate;
00563 
00564     std::vector<std::vector<L1GtCorrelationTemplate> > m_vecCorrelationTemplate;
00565     std::vector<std::vector<L1GtMuonTemplate> > m_corMuonTemplate;
00566     std::vector<std::vector<L1GtCaloTemplate> > m_corCaloTemplate;
00567     std::vector<std::vector<L1GtEnergySumTemplate> > m_corEnergySumTemplate;
00568 
00570     AlgorithmMap m_algorithmMap;
00571 
00573     AlgorithmMap m_algorithmAliasMap;
00574 
00576     AlgorithmMap m_technicalTriggerMap;
00577 
00578 };
00579 
00580 #endif /*L1GtConfigProducers_L1GtTriggerMenuXmlParser_h*/