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  m_params.setIsoTauEtaMin(conf.getParameter<int> ("isoTauEtaMin"));
181  m_params.setIsoTauEtaMax(conf.getParameter<int> ("isoTauEtaMax"));
182 
183  m_params.setTauPUSParams(conf.getParameter<std::vector<double>>("tauPUSParams"));
184 
185  // jets
186  m_params.setJetLsb(conf.getParameter<double>("jetLsb"));
187  m_params.setJetSeedThreshold(conf.getParameter<double>("jetSeedThreshold"));
188  m_params.setJetNeighbourThreshold(conf.getParameter<double>("jetNeighbourThreshold"));
189  m_params.setJetPUSType(conf.getParameter<std::string>("jetPUSType"));
190  m_params.setJetCalibrationType(conf.getParameter<std::string>("jetCalibrationType"));
191  m_params.setJetCalibrationParams(conf.getParameter<std::vector<double> >("jetCalibrationParams"));
192 
193  // sums
194  m_params.setEtSumLsb(conf.getParameter<double>("etSumLsb"));
195 
196  std::vector<int> etSumEtaMin = conf.getParameter<std::vector<int> >("etSumEtaMin");
197  std::vector<int> etSumEtaMax = conf.getParameter<std::vector<int> >("etSumEtaMax");
198  std::vector<double> etSumEtThreshold = conf.getParameter<std::vector<double> >("etSumEtThreshold");
199 
200  if ((etSumEtaMin.size() == etSumEtaMax.size()) && (etSumEtaMin.size() == etSumEtThreshold.size())) {
201  for (unsigned i=0; i<etSumEtaMin.size(); ++i) {
202  m_params.setEtSumEtaMin(i, etSumEtaMin.at(i));
203  m_params.setEtSumEtaMax(i, etSumEtaMax.at(i));
204  m_params.setEtSumEtThreshold(i, etSumEtThreshold.at(i));
205  }
206  }
207  else {
208  edm::LogError("l1t|calo") << "Inconsistent number of EtSum parameters" << std::endl;
209  }
210 
211  // HI centrality trigger
212  edm::FileInPath centralityLUTFile = conf.getParameter<edm::FileInPath>("centralityLUTFile");
213  std::ifstream centralityLUTStream(centralityLUTFile.fullPath());
214  std::shared_ptr<LUT> centralityLUT( new LUT(centralityLUTStream) );
215  m_params.setCentralityLUT(*centralityLUT);
216 
217  // HI Q2 trigger
218  edm::FileInPath q2LUTFile = conf.getParameter<edm::FileInPath>("q2LUTFile");
219  std::ifstream q2LUTStream(q2LUTFile.fullPath());
220  std::shared_ptr<LUT> q2LUT( new LUT(q2LUTStream) );
221  m_params.setQ2LUT(*q2LUT);
222 
223 
224 }
225 
226 
228 {
229 
230  // do anything here that needs to be done at desctruction time
231  // (e.g. close files, deallocate resources etc.)
232 
233 }
234 
235 
236 //
237 // member functions
238 //
239 
240 // ------------ method called to produce the data ------------
243 {
244  using namespace edm::es;
245  boost::shared_ptr<CaloParams> pCaloParams ;
246 
247  pCaloParams = boost::shared_ptr< CaloParams >(new CaloParams(m_params));
248  return pCaloParams;
249 }
250 
251 
252 
253 //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