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") ) return;
23  std::string fName = theConfig.getParameter<edm::FileInPath>("configXMLFile").fullPath();
24 
26  if (!theConfig.exists("patternsXMLFiles") ) return;
27  std::vector<std::string> fileNames;
28  for(auto it: theConfig.getParameter<std::vector<edm::ParameterSet> >("patternsXMLFiles")){
29  fileNames.push_back(it.getParameter<edm::FileInPath>("patternsXMLFile").fullPath());
30  }
31 
32  XMLConfigReader myReader;
33  myReader.setConfigFile(fName);
34  readConnectionsXML(myReader);
35 
36  for(auto it: fileNames){
37  myReader.setPatternsFile(it);
38  readPatternsXML(myReader);
39  }
40 
41  unsigned int patternsVersion = myReader.getPatternsVersion();
42  unsigned int fwVersion = params.fwVersion();
43 
44  params.setFwVersion((fwVersion<<16) + patternsVersion);
45 
46 }
53 
54  aReader.readConfig(&params);
55 
56  return true;
57 }
61 
62  l1t::LUT chargeLUT;
63  l1t::LUT etaLUT;
64  l1t::LUT ptLUT;
65  l1t::LUT meanDistPhiLUT;
66  l1t::LUT pdfLUT;
67 
68  std::vector<l1t::LUT*> luts={ &chargeLUT, &etaLUT, &ptLUT, &meanDistPhiLUT, &pdfLUT};
69  std::vector<std::string> types= {"iCharge", "iEta", "iPt", "meanDistPhi", "pdf"};
70  aReader.readLUTs(luts,params,types);
71 
72  params.setChargeLUT(chargeLUT);
73  params.setEtaLUT(etaLUT);
74  params.setPtLUT(ptLUT);
75  params.setMeanDistPhiLUT(meanDistPhiLUT);
76  params.setPdfLUT(pdfLUT);
77 
78  return true;
79 }
84 {
85  return std::make_unique<L1TMuonOverlapParams>(params);
86 }
91 
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
void setMeanDistPhiLUT(const l1t::LUT &lut)
void setEtaLUT(const l1t::LUT &lut)
unsigned fwVersion() const
bool exists(std::string const &parameterName) const
checks if a parameter exists
void setChargeLUT(const l1t::LUT &lut)
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.
void readConfig(const std::string fName)
std::unique_ptr< L1TMuonOverlapParams > ReturnType
unsigned int getPatternsVersion() const
void setPatternsFile(const std::string &fName)
void setConfigFile(const std::string &fName)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
Definition: LUT.h:29
L1TMuonOverlapParamsESProducer(const edm::ParameterSet &)
void readLUTs(std::vector< l1t::LUT * > luts, const L1TMuonOverlapParams &aConfig, const std::vector< std::string > &types)
std::string fullPath() const
Definition: FileInPath.cc:163
void setFwVersion(unsigned fwVersion)
void setPdfLUT(const l1t::LUT &lut)