CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1TMuonOverlapPhase1ParamsESProducer.cc
Go to the documentation of this file.
5 
11 
12 #include <sstream>
13 
17  //the following line is needed to tell the framework what
18  // data is being produced
20 
21  if (!theConfig.exists("configXMLFile"))
22  return;
23  std::string fName = theConfig.getParameter<edm::FileInPath>("configXMLFile").fullPath();
24 
25  edm::LogVerbatim("OMTFReconstruction") << "L1TMuonOverlapPhase1ParamsESProducer - reading config from file: " << fName
26  << std::endl;
27 
28  if (!theConfig.exists("patternsXMLFiles"))
29  return;
30  std::vector<std::string> fileNames;
31  for (const auto& it : theConfig.getParameter<std::vector<edm::ParameterSet> >("patternsXMLFiles")) {
32  std::string fName = it.getParameter<edm::FileInPath>("patternsXMLFile").fullPath();
33  fileNames.push_back(fName);
34  edm::LogVerbatim("OMTFReconstruction")
35  << "L1TMuonOverlapPhase1ParamsESProducer - reading patterns from file: " << fName << std::endl;
36  }
37 
38  XMLConfigReader myReader;
39  myReader.setConfigFile(fName);
40  readConnectionsXML(myReader);
41 
42  myReader.setPatternsFiles(fileNames);
43  readPatternsXML(myReader);
44 
45  unsigned int patternsVersion = myReader.getPatternsVersion();
46  unsigned int fwVersion = params.fwVersion();
47 
48  params.setFwVersion((fwVersion << 16) + patternsVersion);
49 }
56  aReader.readConfig(&params);
57 
58  return true;
59 }
63  l1t::LUT chargeLUT;
64  l1t::LUT etaLUT;
65  l1t::LUT ptLUT;
66  l1t::LUT meanDistPhiLUT;
67  l1t::LUT selDistPhiShiftLUT;
68  l1t::LUT pdfLUT;
69 
70  std::vector<l1t::LUT*> luts = {&chargeLUT, &etaLUT, &ptLUT, &meanDistPhiLUT, &selDistPhiShiftLUT, &pdfLUT};
71  std::vector<std::string> types = {"iCharge", "iEta", "iPt", "meanDistPhi", "selDistPhiShift", "pdf"};
72 
73  //in the luts we want to have the empty patterns (pt == 0), because it is the way to have the info about the patterns grouping
74  aReader.readLUTs(luts, params, types);
75 
76  params.setChargeLUT(chargeLUT);
77  params.setEtaLUT(etaLUT);
78  params.setPtLUT(ptLUT);
79  params.setMeanDistPhiLUT(meanDistPhiLUT);
80  params.setDistPhiShiftLUT(selDistPhiShiftLUT);
81  params.setPdfLUT(pdfLUT);
82 
83  return true;
84 }
88  const L1TMuonOverlapParamsRcd& iRecord) {
89  using namespace edm::es;
90 
91  return std::make_shared<L1TMuonOverlapParams>(params);
92 }
Log< level::Info, true > LogVerbatim
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
void setMeanDistPhiLUT(const l1t::LUT &lut)
void setPatternsFiles(std::vector< std::string > &fNames)
void setEtaLUT(const l1t::LUT &lut)
unsigned fwVersion() const
bool readConnectionsXML(const XMLConfigReader &aReader)
Read Connections from single XML file.
bool exists(std::string const &parameterName) const
checks if a parameter exists
void setChargeLUT(const l1t::LUT &lut)
ReturnType produceParams(const L1TMuonOverlapParamsRcd &)
void setPtLUT(const l1t::LUT &lut)
void readConfig(const std::string fName)
unsigned int getPatternsVersion() const
void setConfigFile(const std::string &fName)
std::shared_ptr< L1TMuonOverlapParams > ReturnType
Definition: LUT.h:29
void readLUTs(std::vector< l1t::LUT * > luts, const L1TMuonOverlapParams &aConfig, const std::vector< std::string > &types)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
void setFwVersion(unsigned fwVersion)
tuple fileNames
Definition: LaserDQM_cfg.py:34
void setDistPhiShiftLUT(const l1t::LUT &lut)
void setPdfLUT(const l1t::LUT &lut)