test
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 
36 
37 using namespace std;
38 
39 //
40 // class declaration
41 //
42 
43 using namespace l1t;
44 
46 public:
49 
50  typedef boost::shared_ptr<CaloParams> ReturnType;
51 
52  ReturnType produce(const L1TCaloParamsRcd&);
53 
54 private:
57 };
58 
59 //
60 // constants, enums and typedefs
61 //
62 
63 //
64 // static data member definitions
65 //
66 
67 //
68 // constructors and destructor
69 //
71 {
72 
73  //the following line is needed to tell the framework what
74  // data is being produced
75  setWhatProduced(this);
76  //setWhatProduced(this, conf.getParameter<std::string>("label"));
77 
78  CaloParamsHelper m_params_helper;
79 
80  // towers
81  m_params_helper.setTowerLsbH(conf.getParameter<double>("towerLsbH"));
82  m_params_helper.setTowerLsbE(conf.getParameter<double>("towerLsbE"));
83  m_params_helper.setTowerLsbSum(conf.getParameter<double>("towerLsbSum"));
84  m_params_helper.setTowerNBitsH(conf.getParameter<int>("towerNBitsH"));
85  m_params_helper.setTowerNBitsE(conf.getParameter<int>("towerNBitsE"));
86  m_params_helper.setTowerNBitsSum(conf.getParameter<int>("towerNBitsSum"));
87  m_params_helper.setTowerNBitsRatio(conf.getParameter<int>("towerNBitsRatio"));
88  m_params_helper.setTowerEncoding(conf.getParameter<bool>("towerEncoding"));
89 
90  // regions
91  m_params_helper.setRegionLsb(conf.getParameter<double>("regionLsb"));
92  m_params_helper.setRegionPUSType(conf.getParameter<std::string>("regionPUSType"));
93  m_params_helper.setRegionPUSParams(conf.getParameter<std::vector<double> >("regionPUSParams"));
94 
95  // EG
96  m_params_helper.setEgEtaCut(conf.getParameter<int>("egEtaCut"));
97 
98  m_params_helper.setEgLsb(conf.getParameter<double>("egLsb"));
99  m_params_helper.setEgSeedThreshold(conf.getParameter<double>("egSeedThreshold"));
100  m_params_helper.setEgNeighbourThreshold(conf.getParameter<double>("egNeighbourThreshold"));
101  m_params_helper.setEgHcalThreshold(conf.getParameter<double>("egHcalThreshold"));
102 
103  edm::FileInPath egTrimmingLUTFile = conf.getParameter<edm::FileInPath>("egTrimmingLUTFile");
104  std::ifstream egTrimmingLUTStream(egTrimmingLUTFile.fullPath());
105  std::shared_ptr<LUT> egTrimmingLUT( new LUT(egTrimmingLUTStream) );
106  m_params_helper.setEgTrimmingLUT(*egTrimmingLUT);
107 
108  m_params_helper.setEgMaxHcalEt(conf.getParameter<double>("egMaxHcalEt"));
109  m_params_helper.setEgMaxPtHOverE(conf.getParameter<double>("egMaxPtHOverE"));
110  m_params_helper.setEgMinPtJetIsolation(conf.getParameter<int>("egMinPtJetIsolation"));
111  m_params_helper.setEgMaxPtJetIsolation(conf.getParameter<int>("egMaxPtJetIsolation"));
112  m_params_helper.setEgMinPtHOverEIsolation(conf.getParameter<int>("egMinPtHOverEIsolation"));
113  m_params_helper.setEgMaxPtHOverEIsolation(conf.getParameter<int>("egMaxPtHOverEIsolation"));
114 
115 
116  edm::FileInPath egMaxHOverELUTFile = conf.getParameter<edm::FileInPath>("egMaxHOverELUTFile");
117  std::ifstream egMaxHOverELUTStream(egMaxHOverELUTFile.fullPath());
118  std::shared_ptr<LUT> egMaxHOverELUT( new LUT(egMaxHOverELUTStream) );
119  m_params_helper.setEgMaxHOverELUT(*egMaxHOverELUT);
120 
121  edm::FileInPath egCompressShapesLUTFile = conf.getParameter<edm::FileInPath>("egCompressShapesLUTFile");
122  std::ifstream egCompressShapesLUTStream(egCompressShapesLUTFile.fullPath());
123  std::shared_ptr<LUT> egCompressShapesLUT( new LUT(egCompressShapesLUTStream) );
124  m_params_helper.setEgCompressShapesLUT(*egCompressShapesLUT);
125 
126  m_params_helper.setEgShapeIdType(conf.getParameter<std::string>("egShapeIdType"));
127  m_params_helper.setEgShapeIdVersion(conf.getParameter<unsigned>("egShapeIdVersion"));
128  edm::FileInPath egShapeIdLUTFile = conf.getParameter<edm::FileInPath>("egShapeIdLUTFile");
129  std::ifstream egShapeIdLUTStream(egShapeIdLUTFile.fullPath());
130  std::shared_ptr<LUT> egShapeIdLUT( new LUT(egShapeIdLUTStream) );
131  m_params_helper.setEgShapeIdLUT(*egShapeIdLUT);
132 
133  m_params_helper.setEgPUSType(conf.getParameter<std::string>("egPUSType"));
134 
135  m_params_helper.setEgIsolationType(conf.getParameter<std::string>("egIsolationType"));
136  edm::FileInPath egIsoLUTFile = conf.getParameter<edm::FileInPath>("egIsoLUTFile");
137  std::ifstream egIsoLUTStream(egIsoLUTFile.fullPath());
138  std::shared_ptr<LUT> egIsoLUT( new LUT(egIsoLUTStream) );
139  m_params_helper.setEgIsolationLUT(*egIsoLUT);
140 
141  //edm::FileInPath egIsoLUTFileBarrel = conf.getParameter<edm::FileInPath>("egIsoLUTFileBarrel");
142  //std::ifstream egIsoLUTBarrelStream(egIsoLUTFileBarrel.fullPath());
143  //std::shared_ptr<LUT> egIsoLUTBarrel( new LUT(egIsoLUTBarrelStream) );
144  //m_params_helper.setEgIsolationLUTBarrel(egIsoLUTBarrel);
145 
146  //edm::FileInPath egIsoLUTFileEndcaps = conf.getParameter<edm::FileInPath>("egIsoLUTFileEndcaps");
147  //std::ifstream egIsoLUTEndcapsStream(egIsoLUTFileEndcaps.fullPath());
148  //std::shared_ptr<LUT> egIsoLUTEndcaps( new LUT(egIsoLUTEndcapsStream) );
149  //m_params_helper.setEgIsolationLUTEndcaps(egIsoLUTEndcaps);
150 
151 
152  m_params_helper.setEgIsoAreaNrTowersEta(conf.getParameter<unsigned int>("egIsoAreaNrTowersEta"));
153  m_params_helper.setEgIsoAreaNrTowersPhi(conf.getParameter<unsigned int>("egIsoAreaNrTowersPhi"));
154  m_params_helper.setEgIsoVetoNrTowersPhi(conf.getParameter<unsigned int>("egIsoVetoNrTowersPhi"));
155  //m_params_helper.setEgIsoPUEstTowerGranularity(conf.getParameter<unsigned int>("egIsoPUEstTowerGranularity"));
156  //m_params_helper.setEgIsoMaxEtaAbsForTowerSum(conf.getParameter<unsigned int>("egIsoMaxEtaAbsForTowerSum"));
157  //m_params_helper.setEgIsoMaxEtaAbsForIsoSum(conf.getParameter<unsigned int>("egIsoMaxEtaAbsForIsoSum"));
158  m_params_helper.setEgPUSParams(conf.getParameter<std::vector<double>>("egPUSParams"));
159 
160  m_params_helper.setEgCalibrationType(conf.getParameter<std::string>("egCalibrationType"));
161  m_params_helper.setEgCalibrationVersion(conf.getParameter<unsigned>("egCalibrationVersion"));
162  edm::FileInPath egCalibrationLUTFile = conf.getParameter<edm::FileInPath>("egCalibrationLUTFile");
163  std::ifstream egCalibrationLUTStream(egCalibrationLUTFile.fullPath());
164  std::shared_ptr<LUT> egCalibrationLUT( new LUT(egCalibrationLUTStream) );
165  m_params_helper.setEgCalibrationLUT(*egCalibrationLUT);
166 
167  // tau
168  m_params_helper.setTauRegionMask(conf.getParameter<int>("tauRegionMask"));
169  m_params_helper.setTauLsb(conf.getParameter<double>("tauLsb"));
170  m_params_helper.setTauSeedThreshold(conf.getParameter<double>("tauSeedThreshold"));
171  m_params_helper.setTauNeighbourThreshold(conf.getParameter<double>("tauNeighbourThreshold"));
172  m_params_helper.setTauMaxPtTauVeto(conf.getParameter<double>("tauMaxPtTauVeto"));
173  m_params_helper.setTauMinPtJetIsolationB(conf.getParameter<double>("tauMinPtJetIsolationB"));
174  m_params_helper.setTauPUSType(conf.getParameter<std::string>("tauPUSType"));
175  m_params_helper.setTauMaxJetIsolationB(conf.getParameter<double>("tauMaxJetIsolationB"));
176  m_params_helper.setTauMaxJetIsolationA(conf.getParameter<double>("tauMaxJetIsolationA"));
177  m_params_helper.setTauIsoAreaNrTowersEta(conf.getParameter<unsigned int>("tauIsoAreaNrTowersEta"));
178  m_params_helper.setTauIsoAreaNrTowersPhi(conf.getParameter<unsigned int>("tauIsoAreaNrTowersPhi"));
179  m_params_helper.setTauIsoVetoNrTowersPhi(conf.getParameter<unsigned int>("tauIsoVetoNrTowersPhi"));
180 
181  edm::FileInPath tauIsoLUTFile = conf.getParameter<edm::FileInPath>("tauIsoLUTFile");
182  std::ifstream tauIsoLUTStream(tauIsoLUTFile.fullPath());
183  std::shared_ptr<LUT> tauIsoLUT( new LUT(tauIsoLUTStream) );
184  m_params_helper.setTauIsolationLUT(*tauIsoLUT);
185 
186  edm::FileInPath tauCalibrationLUTFile = conf.getParameter<edm::FileInPath>("tauCalibrationLUTFile");
187  std::ifstream tauCalibrationLUTStream(tauCalibrationLUTFile.fullPath());
188  std::shared_ptr<LUT> tauCalibrationLUT( new LUT(tauCalibrationLUTStream) );
189  m_params_helper.setTauCalibrationLUT(*tauCalibrationLUT);
190 
191  edm::FileInPath tauCompressLUTFile = conf.getParameter<edm::FileInPath>("tauCompressLUTFile");
192  std::ifstream tauCompressLUTStream(tauCompressLUTFile.fullPath());
193  std::shared_ptr<LUT> tauCompressLUT( new LUT(tauCompressLUTStream) );
194  m_params_helper.setTauCompressLUT(*tauCompressLUT);
195 
196  edm::FileInPath tauEtToHFRingEtLUTFile = conf.getParameter<edm::FileInPath>("tauEtToHFRingEtLUTFile");
197  std::ifstream tauEtToHFRingEtLUTStream(tauEtToHFRingEtLUTFile.fullPath());
198  std::shared_ptr<LUT> tauEtToHFRingEtLUT( new LUT(tauEtToHFRingEtLUTStream) );
199  m_params_helper.setTauEtToHFRingEtLUT(*tauEtToHFRingEtLUT);
200 
201  m_params_helper.setIsoTauEtaMin(conf.getParameter<int> ("isoTauEtaMin"));
202  m_params_helper.setIsoTauEtaMax(conf.getParameter<int> ("isoTauEtaMax"));
203 
204  m_params_helper.setTauPUSParams(conf.getParameter<std::vector<double>>("tauPUSParams"));
205 
206  // jets
207  m_params_helper.setJetLsb(conf.getParameter<double>("jetLsb"));
208  m_params_helper.setJetSeedThreshold(conf.getParameter<double>("jetSeedThreshold"));
209  m_params_helper.setJetNeighbourThreshold(conf.getParameter<double>("jetNeighbourThreshold"));
210  m_params_helper.setJetRegionMask(conf.getParameter<int>("jetRegionMask"));
211  m_params_helper.setJetPUSType(conf.getParameter<std::string>("jetPUSType"));
212  m_params_helper.setJetCalibrationType(conf.getParameter<std::string>("jetCalibrationType"));
213  m_params_helper.setJetCalibrationParams(conf.getParameter<std::vector<double> >("jetCalibrationParams"));
214  edm::FileInPath jetCalibrationLUTFile = conf.getParameter<edm::FileInPath>("jetCalibrationLUTFile");
215  std::ifstream jetCalibrationLUTStream(jetCalibrationLUTFile.fullPath());
216  std::shared_ptr<LUT> jetCalibrationLUT( new LUT(jetCalibrationLUTStream) );
217  m_params_helper.setJetCalibrationLUT(*jetCalibrationLUT);
218  edm::FileInPath jetCompressEtaLUTFile = conf.getParameter<edm::FileInPath>("jetCompressEtaLUTFile");
219  std::ifstream jetCompressEtaLUTStream(jetCompressEtaLUTFile.fullPath());
220  std::shared_ptr<LUT> jetCompressEtaLUT( new LUT(jetCompressEtaLUTStream) );
221  m_params_helper.setJetCompressEtaLUT(*jetCompressEtaLUT);
222  edm::FileInPath jetCompressPtLUTFile = conf.getParameter<edm::FileInPath>("jetCompressPtLUTFile");
223  std::ifstream jetCompressPtLUTStream(jetCompressPtLUTFile.fullPath());
224  std::shared_ptr<LUT> jetCompressPtLUT( new LUT(jetCompressPtLUTStream) );
225  m_params_helper.setJetCompressPtLUT(*jetCompressPtLUT);
226 
227  // sums
228  m_params_helper.setEtSumLsb(conf.getParameter<double>("etSumLsb"));
229 
230  std::vector<int> etSumEtaMin = conf.getParameter<std::vector<int> >("etSumEtaMin");
231  std::vector<int> etSumEtaMax = conf.getParameter<std::vector<int> >("etSumEtaMax");
232  std::vector<double> etSumEtThreshold = conf.getParameter<std::vector<double> >("etSumEtThreshold");
233 
234  if ((etSumEtaMin.size() == etSumEtaMax.size()) && (etSumEtaMin.size() == etSumEtThreshold.size())) {
235  for (unsigned i=0; i<etSumEtaMin.size(); ++i) {
236  m_params_helper.setEtSumEtaMin(i, etSumEtaMin.at(i));
237  m_params_helper.setEtSumEtaMax(i, etSumEtaMax.at(i));
238  m_params_helper.setEtSumEtThreshold(i, etSumEtThreshold.at(i));
239  }
240  }
241  else {
242  edm::LogError("l1t|calo") << "Inconsistent number of EtSum parameters" << std::endl;
243  }
244 
245  edm::FileInPath etSumXPUSLUTFile = conf.getParameter<edm::FileInPath>("etSumXPUSLUTFile");
246  std::ifstream etSumXPUSLUTStream(etSumXPUSLUTFile.fullPath());
247  std::shared_ptr<LUT> etSumXPUSLUT( new LUT(etSumXPUSLUTStream) );
248  m_params_helper.setEtSumXPUSLUT(*etSumXPUSLUT);
249 
250  edm::FileInPath etSumYPUSLUTFile = conf.getParameter<edm::FileInPath>("etSumYPUSLUTFile");
251  std::ifstream etSumYPUSLUTStream(etSumYPUSLUTFile.fullPath());
252  std::shared_ptr<LUT> etSumYPUSLUT( new LUT(etSumYPUSLUTStream) );
253  m_params_helper.setEtSumYPUSLUT(*etSumYPUSLUT);
254 
255  edm::FileInPath etSumEttPUSLUTFile = conf.getParameter<edm::FileInPath>("etSumEttPUSLUTFile");
256  std::ifstream etSumEttPUSLUTStream(etSumEttPUSLUTFile.fullPath());
257  std::shared_ptr<LUT> etSumEttPUSLUT( new LUT(etSumEttPUSLUTStream) );
258  m_params_helper.setEtSumEttPUSLUT(*etSumEttPUSLUT);
259 
260  edm::FileInPath etSumEcalSumPUSLUTFile = conf.getParameter<edm::FileInPath>("etSumEcalSumPUSLUTFile");
261  std::ifstream etSumEcalSumPUSLUTStream(etSumEcalSumPUSLUTFile.fullPath());
262  std::shared_ptr<LUT> etSumEcalSumPUSLUT( new LUT(etSumEcalSumPUSLUTStream) );
263  m_params_helper.setEtSumEcalSumPUSLUT(*etSumEcalSumPUSLUT);
264 
265  // HI centrality trigger
266  edm::FileInPath centralityLUTFile = conf.getParameter<edm::FileInPath>("centralityLUTFile");
267  std::ifstream centralityLUTStream(centralityLUTFile.fullPath());
268  std::shared_ptr<LUT> centralityLUT( new LUT(centralityLUTStream) );
269  m_params_helper.setCentralityLUT(*centralityLUT);
270  m_params_helper.setCentralityRegionMask(conf.getParameter<int>("centralityRegionMask"));
271  std::vector<int> minbiasThresholds = conf.getParameter<std::vector<int> >("minimumBiasThresholds");
272  if(minbiasThresholds.size() == 4) {
273  m_params_helper.setMinimumBiasThresholds(minbiasThresholds);
274  } else {
275  edm::LogError("l1t|calo") << "Incorrect number of minimum bias thresholds set.";
276  }
277 
278  // HI Q2 trigger
279  edm::FileInPath q2LUTFile = conf.getParameter<edm::FileInPath>("q2LUTFile");
280  std::ifstream q2LUTStream(q2LUTFile.fullPath());
281  std::shared_ptr<LUT> q2LUT( new LUT(q2LUTStream) );
282  m_params_helper.setQ2LUT(*q2LUT);
283 
284  // Layer 1 LUT specification
285  m_params_helper.setLayer1ECalScaleFactors(conf.getParameter<std::vector<double>>("layer1ECalScaleFactors"));
286  m_params_helper.setLayer1HCalScaleFactors(conf.getParameter<std::vector<double>>("layer1HCalScaleFactors"));
287  m_params_helper.setLayer1HFScaleFactors (conf.getParameter<std::vector<double>>("layer1HFScaleFactors"));
288 
289  m_params_helper.setLayer1ECalScaleETBins(conf.getParameter<std::vector<int>>("layer1ECalScaleETBins"));
290  m_params_helper.setLayer1HCalScaleETBins(conf.getParameter<std::vector<int>>("layer1HCalScaleETBins"));
291  m_params_helper.setLayer1HFScaleETBins (conf.getParameter<std::vector<int>>("layer1HFScaleETBins"));
292 
293  m_params = (CaloParams)m_params_helper;
294 }
295 
296 
298 {
299 
300  // do anything here that needs to be done at desctruction time
301  // (e.g. close files, deallocate resources etc.)
302 
303 }
304 
305 
306 //
307 // member functions
308 //
309 
310 // ------------ method called to produce the data ------------
313 {
314  using namespace edm::es;
315  boost::shared_ptr<CaloParams> pCaloParams ;
316 
317  pCaloParams = boost::shared_ptr< CaloParams >(new CaloParams(m_params));
318  return pCaloParams;
319 }
320 
321 
322 
323 //define this as a plug-in
void setEtSumEtaMax(unsigned isum, int eta)
T getParameter(std::string const &) const
boost::shared_ptr< CaloParams > ReturnType
int i
Definition: DBlmapReader.cc:9
void setTauMaxJetIsolationA(double cutValue)
void setEgCalibrationVersion(unsigned version)
void setCentralityLUT(const l1t::LUT &lut)
void setLayer1HCalScaleETBins(const std::vector< int > params)
void setIsoTauEtaMax(int value)
void setTauMinPtJetIsolationB(double limit)
void setRegionPUSType(std::string type)
void setEgNeighbourThreshold(double thresh)
void setEgMinPtHOverEIsolation(int cutValue)
void setEgLsb(double lsb)
void setJetCalibrationParams(std::vector< double > params)
void setTauEtToHFRingEtLUT(const l1t::LUT &lut)
void setTauCalibrationLUT(const l1t::LUT &lut)
void setTauLsb(double lsb)
void setTauIsolationLUT(const l1t::LUT &lut)
void setJetCalibrationLUT(const l1t::LUT &lut)
void setTauNeighbourThreshold(double thresh)
void setEgMaxPtJetIsolation(int cutValue)
void setEgHcalThreshold(double thresh)
void setTauIsoAreaNrTowersPhi(unsigned iTauIsoAreaNrTowersPhi)
void setEtSumXPUSLUT(const l1t::LUT &lut)
void setCentralityRegionMask(int mask)
L1TCaloParamsESProducer(const edm::ParameterSet &)
void setJetCompressEtaLUT(const l1t::LUT &lut)
void setTauIsoAreaNrTowersEta(unsigned iTauIsoAreaNrTowersEta)
void setEgCalibrationLUT(const l1t::LUT &lut)
void setEgShapeIdLUT(const l1t::LUT &lut)
void setEtSumEttPUSLUT(const l1t::LUT &lut)
void setJetCompressPtLUT(const l1t::LUT &lut)
ReturnType produce(const L1TCaloParamsRcd &)
void setEtSumEtaMin(unsigned isum, int eta)
void setTauMaxPtTauVeto(double limit)
void setRegionLsb(double lsb)
void setJetCalibrationType(std::string type)
void setTowerLsbH(double lsb)
void setEgMinPtJetIsolation(int cutValue)
void setTauCompressLUT(const l1t::LUT &lut)
void setLayer1HFScaleETBins(const std::vector< int > params)
void setEtSumEtThreshold(unsigned isum, double thresh)
void setTauPUSType(std::string type)
void setEgPUSType(std::string type)
void setLayer1ECalScaleETBins(const std::vector< int > params)
void setTauSeedThreshold(double thresh)
void setTowerEncoding(bool doit)
void setTauMaxJetIsolationB(double limit)
void setEgIsoAreaNrTowersPhi(unsigned iEgIsoAreaNrTowersPhi)
void setTowerNBitsSum(int n)
void setJetNeighbourThreshold(double thresh)
void setEgShapeIdVersion(unsigned version)
void setTauRegionMask(int mask)
void setJetRegionMask(int mask)
void setEgEtaCut(int mask)
void setEgMaxHcalEt(double cut)
void setJetLsb(double lsb)
void setTauPUSParams(const std::vector< double > &params)
void setQ2LUT(const l1t::LUT &lut)
void setLayer1HCalScaleFactors(const std::vector< double > params)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
void setEgMaxHOverELUT(const l1t::LUT &lut)
void setLayer1HFScaleFactors(const std::vector< double > params)
void setMinimumBiasThresholds(std::vector< int > thresholds)
void setJetSeedThreshold(double thresh)
void setEgMaxPtHOverE(double thresh)
void setEgTrimmingLUT(const l1t::LUT &lut)
void setRegionPUSParams(const std::vector< double > &params)
void setEgIsolationLUT(const l1t::LUT &lut)
void setEgMaxPtHOverEIsolation(int cutValue)
void setEgSeedThreshold(double thresh)
void setTauIsoVetoNrTowersPhi(unsigned iTauIsoVetoNrTowersPhi)
void setLayer1ECalScaleFactors(const std::vector< double > params)
void setJetPUSType(std::string type)
void setEgIsoVetoNrTowersPhi(unsigned iEgIsoVetoNrTowersPhi)
void setEtSumLsb(double lsb)
void setEtSumYPUSLUT(const l1t::LUT &lut)
void setEgIsoAreaNrTowersEta(unsigned iEgIsoAreaNrTowersEta)
std::string fullPath() const
Definition: FileInPath.cc:184
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:32
void setEgShapeIdType(std::string type)
void setIsoTauEtaMin(int value)
void setTowerLsbSum(double lsb)
void setEgPUSParams(const std::vector< double > &params)
void setTowerLsbE(double lsb)
void setEgCalibrationType(std::string type)
void setEtSumEcalSumPUSLUT(const l1t::LUT &lut)
void setEgCompressShapesLUT(const l1t::LUT &lut)
void setTowerNBitsRatio(int n)
void setEgIsolationType(std::string type)