CMS 3D CMS Logo

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 
00047 // forward declarations
00048 class L1GtCondition;
00049 class L1GtAlgorithm;
00050 
00051 // class declaration
00052 class L1GtTriggerMenuXmlParser : public L1GtXmlParserTags
00053 {
00054 
00055 public:
00056 
00059     L1GtTriggerMenuXmlParser();
00060 
00062     virtual ~L1GtTriggerMenuXmlParser();
00063 
00064 public:
00065 
00067     inline const unsigned int gtNumberConditionChips() const {
00068         return m_numberConditionChips;
00069     }
00070 
00071     void setGtNumberConditionChips(const unsigned int&);
00072 
00074     inline const unsigned int gtPinsOnConditionChip() const {
00075         return m_pinsOnConditionChip;
00076     }
00077 
00078     void setGtPinsOnConditionChip(const unsigned int&);
00079 
00082     inline std::vector<int> gtOrderConditionChip() const {
00083         return m_orderConditionChip;
00084     }
00085 
00086     void setGtOrderConditionChip(const std::vector<int>&);
00087 
00089     inline const unsigned int gtNumberPhysTriggers() const {
00090         return m_numberPhysTriggers;
00091     }
00092 
00093     void setGtNumberPhysTriggers(const unsigned int&);
00094 
00096     inline const unsigned int gtNumberTechTriggers() const {
00097         return m_numberTechTriggers;
00098     }
00099 
00100     void setGtNumberTechTriggers(const unsigned int&);
00101 
00103     inline const unsigned int gtNumberL1JetCounts() const {
00104         return m_numberL1JetCounts;
00105     }
00106 
00107     void setGtNumberL1JetCounts(const unsigned int&);
00108 
00109 public:
00110 
00112     inline const std::vector<ConditionMap>& gtConditionMap() const {
00113         return m_conditionMap;
00114     }
00115 
00116     void setGtConditionMap(const std::vector<ConditionMap>&);
00117 
00119     inline const std::string& gtTriggerMenuName() const {
00120         return m_triggerMenuName;
00121     }
00122 
00123     void setGtTriggerMenuName(const std::string&);
00124 
00126     inline const std::vector<std::vector<L1GtMuonTemplate> >& vecMuonTemplate() const {
00127         return m_vecMuonTemplate;
00128     }
00129 
00130     void setVecMuonTemplate(const std::vector<std::vector<L1GtMuonTemplate> >&);
00131 
00132     //
00133     inline const std::vector<std::vector<L1GtCaloTemplate> >& vecCaloTemplate() const {
00134         return m_vecCaloTemplate;
00135     }
00136 
00137     void setVecCaloTemplate(const std::vector<std::vector<L1GtCaloTemplate> >&);
00138 
00139     //
00140     inline const std::vector<std::vector<L1GtEnergySumTemplate> >& vecEnergySumTemplate() const {
00141 
00142         return m_vecEnergySumTemplate;
00143     }
00144 
00145     void setVecEnergySumTemplate(
00146             const std::vector<std::vector<L1GtEnergySumTemplate> >&);
00147 
00148     //
00149     inline const std::vector<std::vector<L1GtJetCountsTemplate> >& vecJetCountsTemplate() const {
00150 
00151         return m_vecJetCountsTemplate;
00152     }
00153 
00154     void setVecJetCountsTemplate(
00155             const std::vector<std::vector<L1GtJetCountsTemplate> >&);
00156 
00157     //
00158     inline const std::vector<std::vector<L1GtCastorTemplate> >& vecCastorTemplate() const {
00159 
00160         return m_vecCastorTemplate;
00161     }
00162 
00163     void setVecCastorTemplate(
00164             const std::vector<std::vector<L1GtCastorTemplate> >&);
00165 
00166     //
00167     inline const std::vector<std::vector<L1GtHfBitCountsTemplate> >&
00168         vecHfBitCountsTemplate() const {
00169 
00170         return m_vecHfBitCountsTemplate;
00171     }
00172 
00173     void setVecHfBitCountsTemplate(
00174             const std::vector<std::vector<L1GtHfBitCountsTemplate> >&);
00175 
00176     //
00177     inline const std::vector<std::vector<L1GtHfRingEtSumsTemplate> >&
00178         vecHfRingEtSumsTemplate() const {
00179 
00180         return m_vecHfRingEtSumsTemplate;
00181     }
00182 
00183     void setVecHfRingEtSumsTemplate(
00184             const std::vector<std::vector<L1GtHfRingEtSumsTemplate> >&);
00185 
00186     //
00187     inline const std::vector<std::vector<L1GtCorrelationTemplate> >& vecCorrelationTemplate() const {
00188 
00189         return m_vecCorrelationTemplate;
00190     }
00191 
00192     void setVecCorrelationTemplate(
00193             const std::vector<std::vector<L1GtCorrelationTemplate> >&);
00194 
00195     // get / set the vectors containing the conditions for correlation templates
00196     //
00197     inline const std::vector<std::vector<L1GtMuonTemplate> >& corMuonTemplate() const {
00198         return m_corMuonTemplate;
00199     }
00200 
00201     void setCorMuonTemplate(const std::vector<std::vector<L1GtMuonTemplate> >&);
00202 
00203     //
00204     inline const std::vector<std::vector<L1GtCaloTemplate> >& corCaloTemplate() const {
00205         return m_corCaloTemplate;
00206     }
00207 
00208     void setCorCaloTemplate(const std::vector<std::vector<L1GtCaloTemplate> >&);
00209 
00210     //
00211     inline const std::vector<std::vector<L1GtEnergySumTemplate> >& corEnergySumTemplate() const {
00212 
00213         return m_corEnergySumTemplate;
00214     }
00215 
00216     void setCorEnergySumTemplate(
00217             const std::vector<std::vector<L1GtEnergySumTemplate> >&);
00218 
00220     inline const AlgorithmMap& gtAlgorithmMap() const {
00221         return m_algorithmMap;
00222     }
00223 
00224     void setGtAlgorithmMap(const AlgorithmMap&);
00225 
00227     inline const AlgorithmMap& gtTechnicalTriggerMap() const {
00228         return m_technicalTriggerMap;
00229     }
00230 
00231     void setGtTechnicalTriggerMap(const AlgorithmMap&);
00232 
00233 public:
00234 
00236     void parseXmlFile(const std::string& defXmlFile,
00237             const std::string& vmeXmlFile);
00238 
00239 private:
00240 
00241     // XML methods
00242 
00244     XERCES_CPP_NAMESPACE::XercesDOMParser* initXML(const std::string& xmlFile);
00245 
00247     XERCES_CPP_NAMESPACE::DOMNode* findXMLChild(
00248             XERCES_CPP_NAMESPACE::DOMNode* startChild,
00249             const std::string& tagName, bool beginOnly = false,
00250             std::string* rest = 0);
00251 
00253     std::string getXMLAttribute(const XERCES_CPP_NAMESPACE::DOMNode* node,
00254             const std::string& name);
00255 
00257     std::string getXMLTextValue(XERCES_CPP_NAMESPACE::DOMNode* node);
00258 
00260     bool hexString2UInt128(const std::string& hexString, boost::uint64_t& dstL,
00261             boost::uint64_t& dstH);
00262 
00264     bool getXMLHexTextValue128(XERCES_CPP_NAMESPACE::DOMNode* node,
00265             boost::uint64_t& dstL, boost::uint64_t& dstH);
00266 
00268     bool getXMLHexTextValue(XERCES_CPP_NAMESPACE::DOMNode* node,
00269             boost::uint64_t& dst);
00270 
00272     bool countConditionChildMaxBits(XERCES_CPP_NAMESPACE::DOMNode* node,
00273             const std::string& childName, unsigned int& dst);
00274 
00276     bool getConditionChildValues(XERCES_CPP_NAMESPACE::DOMNode* node,
00277             const std::string& childName, unsigned int num,
00278             std::vector<boost::uint64_t>& dst);
00279 
00281     void cleanupXML(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
00282 
00285     boost::uint64_t mirror(const boost::uint64_t oldLUT, int maxBitsLUT,
00286             int maxBitsReal);
00287 
00288 private:
00289 
00290     // methods for the VME file
00291 
00293     bool parseVmeXML(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
00294 
00295 private:
00296 
00297     // methods for conditions and algorithms
00298 
00301     void clearMaps();
00302 
00305     bool insertConditionIntoMap(L1GtCondition& cond, const int chipNr);
00306 
00308     bool insertAlgorithmIntoMap(const L1GtAlgorithm& alg);
00309 
00311     bool insertTechTriggerIntoMap(const L1GtAlgorithm& alg);
00312 
00315     L1GtConditionType getTypeFromType(const std::string& type);
00316 
00318     int getNumFromType(const std::string& type);
00319 
00321     int getBitFromNode(XERCES_CPP_NAMESPACE::DOMNode* node);
00322 
00324     int getGEqFlag(XERCES_CPP_NAMESPACE::DOMNode* node,
00325             const std::string& nodeName);
00326 
00328     bool getMuonMipIsoBits(XERCES_CPP_NAMESPACE::DOMNode* node,
00329             unsigned int num, std::vector<bool>& mipDst,
00330             std::vector<bool>& isoEnDst, std::vector<bool>& isoReqDst);
00331 
00333     bool parseMuon(XERCES_CPP_NAMESPACE::DOMNode* node,
00334             const std::string& name, unsigned int chipNr = 0,
00335             const bool corrFlag = false);
00336 
00338     bool parseCalo(XERCES_CPP_NAMESPACE::DOMNode* node,
00339             const std::string& name, unsigned int chipNr = 0,
00340             const bool corrFlag = false);
00341 
00343     bool parseEnergySum(XERCES_CPP_NAMESPACE::DOMNode* node,
00344             const std::string& name, unsigned int chipNr = 0,
00345             const bool corrFlag = false);
00346 
00348     bool parseJetCounts(XERCES_CPP_NAMESPACE::DOMNode* node,
00349             const std::string& name, unsigned int chipNr = 0);
00350 
00352     bool parseCastor(XERCES_CPP_NAMESPACE::DOMNode* node,
00353             const std::string& name, unsigned int chipNr = 0);
00354 
00356     bool parseHfBitCounts(XERCES_CPP_NAMESPACE::DOMNode* node,
00357             const std::string& name, unsigned int chipNr = 0);
00358 
00360     bool parseHfRingEtSums(XERCES_CPP_NAMESPACE::DOMNode* node,
00361             const std::string& name, unsigned int chipNr = 0);
00362 
00364     bool parseCorrelation(XERCES_CPP_NAMESPACE::DOMNode* node,
00365             const std::string& name, unsigned int chipNr = 0);
00366 
00368     bool workCondition(XERCES_CPP_NAMESPACE::DOMNode* node,
00369             const std::string& name, unsigned int chipNr);
00370 
00372     bool parseConditions(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
00373 
00375     bool workAlgorithm(XERCES_CPP_NAMESPACE::DOMNode* node,
00376             const std::string& name, unsigned int chipNr);
00377 
00379     bool parseAlgorithms(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
00380 
00382     bool workTechTrigger(XERCES_CPP_NAMESPACE::DOMNode* node,
00383             const std::string& name);
00384 
00386     bool parseTechTriggers(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
00387 
00389     bool workXML(XERCES_CPP_NAMESPACE::XercesDOMParser* parser);
00390 
00391 private:
00392 
00394     XERCES_CPP_NAMESPACE::ErrorHandler* m_xmlErrHandler;
00395 
00397 
00399     unsigned int m_numberConditionChips;
00400 
00402     unsigned int m_pinsOnConditionChip;
00403 
00406     std::vector<int> m_orderConditionChip;
00407 
00409     unsigned int m_numberPhysTriggers;
00410 
00412     unsigned int m_numberTechTriggers;
00413 
00415     unsigned int m_numberL1JetCounts;
00416 
00417 private:
00418 
00420     std::vector<ConditionMap> m_conditionMap;
00421 
00422 private:
00423 
00425     std::string m_triggerMenuName;
00426 
00429     std::vector<std::vector<L1GtMuonTemplate> > m_vecMuonTemplate;
00430     std::vector<std::vector<L1GtCaloTemplate> > m_vecCaloTemplate;
00431     std::vector<std::vector<L1GtEnergySumTemplate> > m_vecEnergySumTemplate;
00432     std::vector<std::vector<L1GtJetCountsTemplate> > m_vecJetCountsTemplate;
00433     std::vector<std::vector<L1GtCastorTemplate> > m_vecCastorTemplate;
00434     std::vector<std::vector<L1GtHfBitCountsTemplate> > m_vecHfBitCountsTemplate;
00435     std::vector<std::vector<L1GtHfRingEtSumsTemplate> > m_vecHfRingEtSumsTemplate;
00436 
00437     std::vector<std::vector<L1GtCorrelationTemplate> > m_vecCorrelationTemplate;
00438     std::vector<std::vector<L1GtMuonTemplate> > m_corMuonTemplate;
00439     std::vector<std::vector<L1GtCaloTemplate> > m_corCaloTemplate;
00440     std::vector<std::vector<L1GtEnergySumTemplate> > m_corEnergySumTemplate;
00441 
00443     AlgorithmMap m_algorithmMap;
00444 
00446     AlgorithmMap m_technicalTriggerMap;
00447 
00448 };
00449 
00450 #endif /*L1GtConfigProducers_L1GtTriggerMenuXmlParser_h*/

Generated on Tue Jun 9 17:40:27 2009 for CMSSW by  doxygen 1.5.4