CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1TCaloParamsESProducer.cc
Go to the documentation of this file.
1 
12 //
13 //
14 
15 
16 
17 
18 // system include files
19 #include <memory>
20 #include "boost/shared_ptr.hpp"
21 #include <iostream>
22 #include <fstream>
23 
24 // user include files
30 
32 
35 
36 using namespace std;
37 
38 //
39 // class declaration
40 //
41 
42 using namespace l1t;
43 
45 public:
48 
49  typedef boost::shared_ptr<CaloParams> ReturnType;
50 
51  ReturnType produce(const L1TCaloParamsRcd&);
52 
53 private:
56 };
57 
58 //
59 // constants, enums and typedefs
60 //
61 
62 //
63 // static data member definitions
64 //
65 
66 //
67 // constructors and destructor
68 //
70 {
71 
72  //the following line is needed to tell the framework what
73  // data is being produced
74  setWhatProduced(this);
75  //setWhatProduced(this, conf.getParameter<std::string>("label"));
76 
77  // towers
78  m_params.setTowerLsbH(conf.getParameter<double>("towerLsbH"));
79  m_params.setTowerLsbE(conf.getParameter<double>("towerLsbE"));
80  m_params.setTowerLsbSum(conf.getParameter<double>("towerLsbSum"));
81  m_params.setTowerNBitsH(conf.getParameter<int>("towerNBitsH"));
82  m_params.setTowerNBitsE(conf.getParameter<int>("towerNBitsE"));
83  m_params.setTowerNBitsSum(conf.getParameter<int>("towerNBitsSum"));
84  m_params.setTowerNBitsRatio(conf.getParameter<int>("towerNBitsRatio"));
85  m_params.setTowerEncoding(conf.getParameter<bool>("towerEncoding"));
86 
87  // regions
88  m_params.setRegionLsb(conf.getParameter<double>("regionLsb"));
89  m_params.setRegionPUSType(conf.getParameter<std::string>("regionPUSType"));
90  m_params.setRegionPUSParams(conf.getParameter<std::vector<double> >("regionPUSParams"));
91 
92  // EG
93  m_params.setEgLsb(conf.getParameter<double>("egLsb"));
94  m_params.setEgSeedThreshold(conf.getParameter<double>("egSeedThreshold"));
95  m_params.setEgNeighbourThreshold(conf.getParameter<double>("egNeighbourThreshold"));
96  m_params.setEgHcalThreshold(conf.getParameter<double>("egHcalThreshold"));
97 
98  edm::FileInPath egTrimmingLUTFile = conf.getParameter<edm::FileInPath>("egTrimmingLUTFile");
99  std::ifstream egTrimmingLUTStream(egTrimmingLUTFile.fullPath());
100  std::shared_ptr<LUT> egTrimmingLUT( new LUT(egTrimmingLUTStream) );
101  m_params.setEgTrimmingLUT(*egTrimmingLUT);
102 
103  m_params.setEgMaxHcalEt(conf.getParameter<double>("egMaxHcalEt"));
104  m_params.setEgMaxPtHOverE(conf.getParameter<double>("egMaxPtHOverE"));
105  m_params.setEgMinPtJetIsolation(conf.getParameter<int>("egMinPtJetIsolation"));
106  m_params.setEgMaxPtJetIsolation(conf.getParameter<int>("egMaxPtJetIsolation"));
107  m_params.setEgMinPtHOverEIsolation(conf.getParameter<int>("egMinPtHOverEIsolation"));
108  m_params.setEgMaxPtHOverEIsolation(conf.getParameter<int>("egMaxPtHOverEIsolation"));
109 
110 
111  edm::FileInPath egMaxHOverELUTFile = conf.getParameter<edm::FileInPath>("egMaxHOverELUTFile");
112  std::ifstream egMaxHOverELUTStream(egMaxHOverELUTFile.fullPath());
113  std::shared_ptr<LUT> egMaxHOverELUT( new LUT(egMaxHOverELUTStream) );
114  m_params.setEgMaxHOverELUT(*egMaxHOverELUT);
115 
116  edm::FileInPath egCompressShapesLUTFile = conf.getParameter<edm::FileInPath>("egCompressShapesLUTFile");
117  std::ifstream egCompressShapesLUTStream(egCompressShapesLUTFile.fullPath());
118  std::shared_ptr<LUT> egCompressShapesLUT( new LUT(egCompressShapesLUTStream) );
119  m_params.setEgCompressShapesLUT(*egCompressShapesLUT);
120 
121  edm::FileInPath egShapeIdLUTFile = conf.getParameter<edm::FileInPath>("egShapeIdLUTFile");
122  std::ifstream egShapeIdLUTStream(egShapeIdLUTFile.fullPath());
123  std::shared_ptr<LUT> egShapeIdLUT( new LUT(egShapeIdLUTStream) );
124  m_params.setEgShapeIdLUT(*egShapeIdLUT);
125 
126  m_params.setEgPUSType(conf.getParameter<std::string>("egPUSType"));
127 
128  edm::FileInPath egIsoLUTFile = conf.getParameter<edm::FileInPath>("egIsoLUTFile");
129  std::ifstream egIsoLUTStream(egIsoLUTFile.fullPath());
130  std::shared_ptr<LUT> egIsoLUT( new LUT(egIsoLUTStream) );
131  m_params.setEgIsolationLUT(*egIsoLUT);
132 
133  //edm::FileInPath egIsoLUTFileBarrel = conf.getParameter<edm::FileInPath>("egIsoLUTFileBarrel");
134  //std::ifstream egIsoLUTBarrelStream(egIsoLUTFileBarrel.fullPath());
135  //std::shared_ptr<LUT> egIsoLUTBarrel( new LUT(egIsoLUTBarrelStream) );
136  //m_params.setEgIsolationLUTBarrel(egIsoLUTBarrel);
137 
138  //edm::FileInPath egIsoLUTFileEndcaps = conf.getParameter<edm::FileInPath>("egIsoLUTFileEndcaps");
139  //std::ifstream egIsoLUTEndcapsStream(egIsoLUTFileEndcaps.fullPath());
140  //std::shared_ptr<LUT> egIsoLUTEndcaps( new LUT(egIsoLUTEndcapsStream) );
141  //m_params.setEgIsolationLUTEndcaps(egIsoLUTEndcaps);
142 
143 
144  m_params.setEgIsoAreaNrTowersEta(conf.getParameter<unsigned int>("egIsoAreaNrTowersEta"));
145  m_params.setEgIsoAreaNrTowersPhi(conf.getParameter<unsigned int>("egIsoAreaNrTowersPhi"));
146  m_params.setEgIsoVetoNrTowersPhi(conf.getParameter<unsigned int>("egIsoVetoNrTowersPhi"));
147  //m_params.setEgIsoPUEstTowerGranularity(conf.getParameter<unsigned int>("egIsoPUEstTowerGranularity"));
148  //m_params.setEgIsoMaxEtaAbsForTowerSum(conf.getParameter<unsigned int>("egIsoMaxEtaAbsForTowerSum"));
149  //m_params.setEgIsoMaxEtaAbsForIsoSum(conf.getParameter<unsigned int>("egIsoMaxEtaAbsForIsoSum"));
150  m_params.setEgPUSParams(conf.getParameter<std::vector<double>>("egPUSParams"));
151 
152  edm::FileInPath egCalibrationLUTFile = conf.getParameter<edm::FileInPath>("egCalibrationLUTFile");
153  std::ifstream egCalibrationLUTStream(egCalibrationLUTFile.fullPath());
154  std::shared_ptr<LUT> egCalibrationLUT( new LUT(egCalibrationLUTStream) );
155  m_params.setEgCalibrationLUT(*egCalibrationLUT);
156 
157  // tau
158  m_params.setTauLsb(conf.getParameter<double>("tauLsb"));
159  m_params.setTauSeedThreshold(conf.getParameter<double>("tauSeedThreshold"));
160  m_params.setTauNeighbourThreshold(conf.getParameter<double>("tauNeighbourThreshold"));
161  m_params.setTauMaxPtTauVeto(conf.getParameter<double>("tauMaxPtTauVeto"));
162  m_params.setTauMinPtJetIsolationB(conf.getParameter<double>("tauMinPtJetIsolationB"));
163  m_params.setTauPUSType(conf.getParameter<std::string>("tauPUSType"));
164  m_params.setTauMaxJetIsolationB(conf.getParameter<double>("tauMaxJetIsolationB"));
165  m_params.setTauMaxJetIsolationA(conf.getParameter<double>("tauMaxJetIsolationA"));
166  m_params.setTauIsoAreaNrTowersEta(conf.getParameter<unsigned int>("tauIsoAreaNrTowersEta"));
167  m_params.setTauIsoAreaNrTowersPhi(conf.getParameter<unsigned int>("tauIsoAreaNrTowersPhi"));
168  m_params.setTauIsoVetoNrTowersPhi(conf.getParameter<unsigned int>("tauIsoVetoNrTowersPhi"));
169 
170  edm::FileInPath tauIsoLUTFile = conf.getParameter<edm::FileInPath>("tauIsoLUTFile");
171  std::ifstream tauIsoLUTStream(tauIsoLUTFile.fullPath());
172  std::shared_ptr<LUT> tauIsoLUT( new LUT(tauIsoLUTStream) );
173  m_params.setTauIsolationLUT(*tauIsoLUT);
174 
175  edm::FileInPath tauCalibrationLUTFile = conf.getParameter<edm::FileInPath>("tauCalibrationLUTFile");
176  std::ifstream tauCalibrationLUTStream(tauCalibrationLUTFile.fullPath());
177  std::shared_ptr<LUT> tauCalibrationLUT( new LUT(tauCalibrationLUTStream) );
178  m_params.setTauCalibrationLUT(*tauCalibrationLUT);
179 
180  edm::FileInPath tauEtToHFRingEtLUTFile = conf.getParameter<edm::FileInPath>("tauEtToHFRingEtLUTFile");
181  std::ifstream tauEtToHFRingEtLUTStream(tauEtToHFRingEtLUTFile.fullPath());
182  std::shared_ptr<LUT> tauEtToHFRingEtLUT( new LUT(tauEtToHFRingEtLUTStream) );
183  m_params.setTauEtToHFRingEtLUT(*tauEtToHFRingEtLUT);
184 
185  m_params.setIsoTauEtaMin(conf.getParameter<int> ("isoTauEtaMin"));
186  m_params.setIsoTauEtaMax(conf.getParameter<int> ("isoTauEtaMax"));
187 
188  m_params.setTauPUSParams(conf.getParameter<std::vector<double>>("tauPUSParams"));
189 
190  // jets
191  m_params.setJetLsb(conf.getParameter<double>("jetLsb"));
192  m_params.setJetSeedThreshold(conf.getParameter<double>("jetSeedThreshold"));
193  m_params.setJetNeighbourThreshold(conf.getParameter<double>("jetNeighbourThreshold"));
194  m_params.setJetPUSType(conf.getParameter<std::string>("jetPUSType"));
195  m_params.setJetCalibrationType(conf.getParameter<std::string>("jetCalibrationType"));
196  m_params.setJetCalibrationParams(conf.getParameter<std::vector<double> >("jetCalibrationParams"));
197  edm::FileInPath jetCalibrationLUTFile = conf.getParameter<edm::FileInPath>("jetCalibrationLUTFile");
198  std::ifstream jetCalibrationLUTStream(jetCalibrationLUTFile.fullPath());
199  std::shared_ptr<LUT> jetCalibrationLUT( new LUT(jetCalibrationLUTStream) );
200  m_params.setJetCalibrationLUT(*jetCalibrationLUT);
201 
202  // sums
203  m_params.setEtSumLsb(conf.getParameter<double>("etSumLsb"));
204 
205  std::vector<int> etSumEtaMin = conf.getParameter<std::vector<int> >("etSumEtaMin");
206  std::vector<int> etSumEtaMax = conf.getParameter<std::vector<int> >("etSumEtaMax");
207  std::vector<double> etSumEtThreshold = conf.getParameter<std::vector<double> >("etSumEtThreshold");
208 
209  if ((etSumEtaMin.size() == etSumEtaMax.size()) && (etSumEtaMin.size() == etSumEtThreshold.size())) {
210  for (unsigned i=0; i<etSumEtaMin.size(); ++i) {
211  m_params.setEtSumEtaMin(i, etSumEtaMin.at(i));
212  m_params.setEtSumEtaMax(i, etSumEtaMax.at(i));
213  m_params.setEtSumEtThreshold(i, etSumEtThreshold.at(i));
214  }
215  }
216  else {
217  edm::LogError("l1t|calo") << "Inconsistent number of EtSum parameters" << std::endl;
218  }
219 
220  // HI centrality trigger
221  edm::FileInPath centralityLUTFile = conf.getParameter<edm::FileInPath>("centralityLUTFile");
222  std::ifstream centralityLUTStream(centralityLUTFile.fullPath());
223  std::shared_ptr<LUT> centralityLUT( new LUT(centralityLUTStream) );
224  m_params.setCentralityLUT(*centralityLUT);
225 
226  // HI Q2 trigger
227  edm::FileInPath q2LUTFile = conf.getParameter<edm::FileInPath>("q2LUTFile");
228  std::ifstream q2LUTStream(q2LUTFile.fullPath());
229  std::shared_ptr<LUT> q2LUT( new LUT(q2LUTStream) );
230  m_params.setQ2LUT(*q2LUT);
231 
232 
233 }
234 
235 
237 {
238 
239  // do anything here that needs to be done at desctruction time
240  // (e.g. close files, deallocate resources etc.)
241 
242 }
243 
244 
245 //
246 // member functions
247 //
248 
249 // ------------ method called to produce the data ------------
252 {
253  using namespace edm::es;
254  boost::shared_ptr<CaloParams> pCaloParams ;
255 
256  pCaloParams = boost::shared_ptr< CaloParams >(new CaloParams(m_params));
257  return pCaloParams;
258 }
259 
260 
261 
262 //define this as a plug-in
T getParameter(std::string const &) const
boost::shared_ptr< CaloParams > ReturnType
int i
Definition: DBlmapReader.cc:9
L1TCaloParamsESProducer(const edm::ParameterSet &)
ReturnType produce(const L1TCaloParamsRcd &)
tuple conf
Definition: dbtoconf.py:185
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
std::string fullPath() const
Definition: FileInPath.cc:165
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:32