CMS 3D CMS Logo

L1TMuonOverlapPhase1ParamsESProducer.cc
Go to the documentation of this file.
2 
6 
12 
13 #include <sstream>
14 
18  //the following line is needed to tell the framework what
19  // data is being produced
21 
22  if (!theConfig.exists("configXMLFile"))
23  return;
24  std::string fName = theConfig.getParameter<edm::FileInPath>("configXMLFile").fullPath();
25 
26  edm::LogVerbatim("OMTFReconstruction") << "L1TMuonOverlapPhase1ParamsESProducer - reading config from file: " << fName
27  << std::endl;
28 
29  if (!theConfig.exists("patternsXMLFiles"))
30  return;
31  std::vector<std::string> fileNames;
32  for (const auto& it : theConfig.getParameter<std::vector<edm::ParameterSet> >("patternsXMLFiles")) {
33  std::string fName = it.getParameter<edm::FileInPath>("patternsXMLFile").fullPath();
34  fileNames.push_back(fName);
35  edm::LogVerbatim("OMTFReconstruction")
36  << "L1TMuonOverlapPhase1ParamsESProducer - reading patterns from file: " << fName << std::endl;
37  }
38 
39  XMLConfigReader myReader;
40  myReader.setConfigFile(fName);
41  readConnectionsXML(myReader);
42 
43  myReader.setPatternsFiles(fileNames);
44  readPatternsXML(myReader);
45 
46  unsigned int patternsVersion = myReader.getPatternsVersion();
47  unsigned int fwVersion = params.fwVersion();
48 
50 }
57  aReader.readConfig(&params);
58 
59  return true;
60 }
64  l1t::LUT chargeLUT;
67  l1t::LUT meanDistPhiLUT;
68  l1t::LUT selDistPhiShiftLUT;
69  l1t::LUT pdfLUT;
70 
71  std::vector<l1t::LUT*> luts = {&chargeLUT, &etaLUT, &ptLUT, &meanDistPhiLUT, &selDistPhiShiftLUT, &pdfLUT};
72  std::vector<std::string> types = {"iCharge", "iEta", "iPt", "meanDistPhi", "selDistPhiShift", "pdf"};
73 
74  //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
75  aReader.readLUTs(luts, params, types);
76 
77  params.setChargeLUT(chargeLUT);
80  params.setMeanDistPhiLUT(meanDistPhiLUT);
81  params.setDistPhiShiftLUT(selDistPhiShiftLUT);
82  params.setPdfLUT(pdfLUT);
83 
84  return true;
85 }
89  const L1TMuonOverlapParamsRcd& iRecord) {
90  using namespace edm::es;
91 
92  return std::make_shared<L1TMuonOverlapParams>(params);
93 }
Log< level::Info, true > LogVerbatim
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
void setMeanDistPhiLUT(const l1t::LUT &lut)
void setPatternsFiles(std::vector< std::string > &fNames)
void setEtaLUT(const l1t::LUT &lut)
unsigned int getPatternsVersion() 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)
void readLUTs(std::vector< l1t::LUT *> luts, const L1TMuonOverlapParams &aConfig, const std::vector< std::string > &types)
ReturnType produceParams(const L1TMuonOverlapParamsRcd &)
void setPtLUT(const l1t::LUT &lut)
unsigned fwVersion() const
void readConfig(const std::string fName)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
void setConfigFile(const std::string &fName)
std::shared_ptr< L1TMuonOverlapParams > ReturnType
Definition: LUT.h:29
const ap_uint< BITSPT > ptLUT[1858]
Definition: Constants.h:18
void setFwVersion(unsigned fwVersion)
void setDistPhiShiftLUT(const l1t::LUT &lut)
void setPdfLUT(const l1t::LUT &lut)
const uint etaLUT[4082]
Definition: Constants.h:121