Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:06

0001 #ifndef L1T_OmtfP1_XMLConfigReader_H
0002 #define L1T_OmtfP1_XMLConfigReader_H
0003 
0004 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OMTFConfiguration.h"
0005 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GoldenPatternBase.h"
0006 
0007 #include "CondFormats/L1TObjects/interface/LUT.h"
0008 
0009 #include <string>
0010 #include <vector>
0011 #include <ostream>
0012 #include <memory>
0013 
0014 #include "xercesc/util/XercesDefs.hpp"
0015 #include "xercesc/dom/DOM.hpp"
0016 
0017 class GoldenPattern;
0018 class OMTFConfiguration;
0019 class L1TMuonOverlapParams;
0020 
0021 namespace XERCES_CPP_NAMESPACE {
0022 
0023   class DOMElement;
0024   class XercesDOMParser;
0025 
0026 }  // namespace XERCES_CPP_NAMESPACE
0027 
0028 class XMLConfigReader {
0029 public:
0030   XMLConfigReader();
0031   ~XMLConfigReader();
0032 
0033   void readConfig(const std::string fName);
0034 
0035   void setConfigFile(const std::string& fName) { configFile = fName; }
0036 
0037   void setPatternsFiles(std::vector<std::string>& fNames) { patternsFiles = fNames; }
0038 
0039   void setEventsFile(const std::string& fName) { eventsFile = fName; }
0040 
0041   /*
0042    * if buildEmptyPatterns == true - the patterns with the thePt = 0 are added to the to the output vector of the goledePatterns
0043    * it is needed in the readLUTs, as only with the empty patterns it is possible to obtain the patterns grouping from the LUTs in the L1TMuonOverlapParams
0044    */
0045   template <class GoldenPatternType>
0046   GoldenPatternVec<GoldenPatternType> readPatterns(const L1TMuonOverlapParams& aConfig,
0047                                                    const std::string& patternsFile,
0048                                                    bool buildEmptyPatterns,
0049                                                    bool resetNumbering = true);
0050 
0051   template <class GoldenPatternType>
0052   GoldenPatternVec<GoldenPatternType> readPatterns(const L1TMuonOverlapParams& aConfig,
0053                                                    const std::vector<std::string>& patternsFiles,
0054                                                    bool buildEmptyPatterns);
0055 
0056   void readLUTs(std::vector<l1t::LUT*> luts,
0057                 const L1TMuonOverlapParams& aConfig,
0058                 const std::vector<std::string>& types);
0059 
0060   void readConfig(L1TMuonOverlapParams* aConfig) const;
0061 
0062   unsigned int getPatternsVersion() const;
0063 
0064   std::vector<std::vector<int> > readEvent(unsigned int iEvent = 0, unsigned int iProcessor = 0, bool readEta = false);
0065 
0066 private:
0067   std::string configFile;                  //XML file with general configuration
0068   std::vector<std::string> patternsFiles;  //XML files with GoldenPatterns
0069   std::string eventsFile;                  //XML file with events
0070 
0071   template <class GoldenPatternType>
0072   std::unique_ptr<GoldenPatternType> buildGP(xercesc::DOMElement* aGPElement,
0073                                              const L1TMuonOverlapParams& aConfig,
0074                                              unsigned int patternGroup,
0075                                              unsigned int index = 0,
0076                                              unsigned int aGPNumber = 999);
0077 
0078   unsigned int iGPNumber = 0;
0079   unsigned int iPatternGroup = 0;
0080 };
0081 
0082 #endif