CMS 3D CMS Logo

L1TMuonOverlapParamsESProducer.cc
Go to the documentation of this file.
1 #include "sstream"
2 
3 // user include files
8 
11 
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 
27  if (!theConfig.exists("patternsXMLFiles"))
28  return;
29  std::vector<std::string> fileNames;
30  for (const auto& it : theConfig.getParameter<std::vector<edm::ParameterSet> >("patternsXMLFiles")) {
31  fileNames.push_back(it.getParameter<edm::FileInPath>("patternsXMLFile").fullPath());
32  }
33 
34  XMLConfigReader myReader;
35  myReader.setConfigFile(fName);
36  readConnectionsXML(myReader);
37 
38  for (const auto& it : fileNames) {
39  myReader.setPatternsFile(it);
40  readPatternsXML(myReader);
41  }
42 
43  unsigned int patternsVersion = myReader.getPatternsVersion();
44  unsigned int fwVersion = params.fwVersion();
45 
47 }
54  aReader.readConfig(&params);
55 
56  return true;
57 }
61  l1t::LUT chargeLUT;
64  l1t::LUT meanDistPhiLUT;
65  l1t::LUT pdfLUT;
66 
67  std::vector<l1t::LUT*> luts = {&chargeLUT, &etaLUT, &ptLUT, &meanDistPhiLUT, &pdfLUT};
68  std::vector<std::string> types = {"iCharge", "iEta", "iPt", "meanDistPhi", "pdf"};
69  aReader.readLUTs(luts, params, types);
70 
71  params.setChargeLUT(chargeLUT);
74  params.setMeanDistPhiLUT(meanDistPhiLUT);
75  params.setPdfLUT(pdfLUT);
76 
77  return true;
78 }
82  const L1TMuonOverlapParamsRcd& iRecord) {
83  return std::make_unique<L1TMuonOverlapParams>(params);
84 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void setMeanDistPhiLUT(const l1t::LUT &lut)
std::string fullPath() const
Definition: FileInPath.cc:161
void setEtaLUT(const l1t::LUT &lut)
unsigned int getPatternsVersion() const
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 &)
bool readPatternsXML(XMLConfigReader &aReader)
void setPtLUT(const l1t::LUT &lut)
bool readConnectionsXML(const XMLConfigReader &aReader)
Read Connections from single XML file.
unsigned fwVersion() const
void readConfig(const std::string fName)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
std::unique_ptr< L1TMuonOverlapParams > ReturnType
void setPatternsFile(const std::string &fName)
void setConfigFile(const std::string &fName)
Definition: LUT.h:29
L1TMuonOverlapParamsESProducer(const edm::ParameterSet &)
const ap_uint< BITSPT > ptLUT[1858]
Definition: Constants.h:18
void setFwVersion(unsigned fwVersion)
void setPdfLUT(const l1t::LUT &lut)
const uint etaLUT[4082]
Definition: Constants.h:121