CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloParamsESProducer.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
29 
31 
34 
35 using namespace std;
36 
37 //
38 // class declaration
39 //
40 
41 namespace l1t {
42 
44 public:
47 
48  typedef boost::shared_ptr<CaloParams> ReturnType;
49 
50  ReturnType produce(const L1TCaloParamsRcd&);
51 
52 private:
55 };
56 
57 //
58 // constants, enums and typedefs
59 //
60 
61 //
62 // static data member definitions
63 //
64 
65 //
66 // constructors and destructor
67 //
68 CaloParamsESProducer::CaloParamsESProducer(const edm::ParameterSet& conf)
69 {
70 
71  //the following line is needed to tell the framework what
72  // data is being produced
73  setWhatProduced(this);
74  //setWhatProduced(this, conf.getParameter<std::string>("label"));
75 
76  // towers
77  m_params.setTowerLsbH(conf.getParameter<double>("towerLsbH"));
78  m_params.setTowerLsbE(conf.getParameter<double>("towerLsbE"));
79  m_params.setTowerLsbSum(conf.getParameter<double>("towerLsbSum"));
80  m_params.setTowerNBitsH(conf.getParameter<int>("towerNBitsH"));
81  m_params.setTowerNBitsE(conf.getParameter<int>("towerNBitsE"));
82  m_params.setTowerNBitsSum(conf.getParameter<int>("towerNBitsSum"));
83  m_params.setTowerNBitsRatio(conf.getParameter<int>("towerNBitsRatio"));
84  m_params.setTowerEncoding(conf.getParameter<bool>("towerEncoding"));
85 
86  // regions
87  m_params.setRegionLsb(conf.getParameter<double>("regionLsb"));
88  m_params.setRegionPUSType(conf.getParameter<std::string>("regionPUSType"));
89  m_params.setRegionPUSParams(conf.getParameter<std::vector<double> >("regionPUSParams"));
90 
91  // EG
92  m_params.setEgLsb(conf.getParameter<double>("egLsb"));
93  m_params.setEgSeedThreshold(conf.getParameter<double>("egSeedThreshold"));
94  m_params.setEgNeighbourThreshold(conf.getParameter<double>("egNeighbourThreshold"));
95  m_params.setEgMaxHcalEt(conf.getParameter<double>("egMaxHcalEt"));
96  m_params.setEgEtToRemoveHECut(conf.getParameter<double>("egEtToRemoveHECut"));
97  m_params.setEgMaxHOverE(conf.getParameter<double>("egMaxHOverE"));
98  m_params.setEgIsoPUSType(conf.getParameter<std::string>("egIsoPUSType"));
99 
100  edm::FileInPath egIsoLUTFile = conf.getParameter<edm::FileInPath>("egIsoLUTFile");
101  std::ifstream egIsoLUTStream(egIsoLUTFile.fullPath());
102  std::shared_ptr<l1t::LUT> egIsoLUT( new l1t::LUT(egIsoLUTStream) );
103  m_params.setEgIsolationLUT(egIsoLUT);
104 
105  m_params.setEgIsoAreaNrTowersEta(conf.getParameter<unsigned int>("egIsoAreaNrTowersEta"));
106  m_params.setEgIsoAreaNrTowersPhi(conf.getParameter<unsigned int>("egIsoAreaNrTowersPhi"));
107  m_params.setEgIsoVetoNrTowersPhi(conf.getParameter<unsigned int>("egIsoVetoNrTowersPhi"));
108  m_params.setEgIsoPUEstTowerGranularity(conf.getParameter<unsigned int>("egIsoPUEstTowerGranularity"));
109  m_params.setEgIsoMaxEtaAbsForTowerSum(conf.getParameter<unsigned int>("egIsoMaxEtaAbsForTowerSum"));
110  m_params.setEgIsoMaxEtaAbsForIsoSum(conf.getParameter<unsigned int>("egIsoMaxEtaAbsForIsoSum"));
111 
112  // tau
113  m_params.setTauLsb(conf.getParameter<double>("tauLsb"));
114  m_params.setTauSeedThreshold(conf.getParameter<double>("tauSeedThreshold"));
115  m_params.setTauNeighbourThreshold(conf.getParameter<double>("tauNeighbourThreshold"));
116  m_params.setTauIsoPUSType(conf.getParameter<std::string>("tauIsoPUSType"));
117 
118  edm::FileInPath tauIsoLUTFile = conf.getParameter<edm::FileInPath>("tauIsoLUTFile");
119  std::ifstream tauIsoLUTStream(tauIsoLUTFile.fullPath());
120  std::shared_ptr<l1t::LUT> tauIsoLUT( new l1t::LUT(tauIsoLUTStream) );
121  m_params.setTauIsolationLUT(tauIsoLUT);
122 
123  // jets
124  m_params.setJetLsb(conf.getParameter<double>("jetLsb"));
125  m_params.setJetSeedThreshold(conf.getParameter<double>("jetSeedThreshold"));
126  m_params.setJetNeighbourThreshold(conf.getParameter<double>("jetNeighbourThreshold"));
127  m_params.setJetPUSType(conf.getParameter<std::string>("jetPUSType"));
128  m_params.setJetCalibrationType(conf.getParameter<std::string>("jetCalibrationType"));
129  m_params.setJetCalibrationParams(conf.getParameter<std::vector<double> >("jetCalibrationParams"));
130 
131  // sums
132  m_params.setEtSumLsb(conf.getParameter<double>("etSumLsb"));
133  m_params.setEtSumEtaMin(0, conf.getParameter<int>("ettEtaMin"));
134  m_params.setEtSumEtaMax(0, conf.getParameter<int>("ettEtaMax"));
135  m_params.setEtSumEtThreshold(0, conf.getParameter<double>("ettEtThreshold"));
136  m_params.setEtSumEtaMin(1, conf.getParameter<int>("httEtaMin"));
137  m_params.setEtSumEtaMax(1, conf.getParameter<int>("httEtaMax"));
138  m_params.setEtSumEtThreshold(1, conf.getParameter<double>("httEtThreshold"));
139  m_params.setEtSumEtaMin(2, conf.getParameter<int>("metEtaMin"));
140  m_params.setEtSumEtaMax(2, conf.getParameter<int>("metEtaMax"));
141  m_params.setEtSumEtThreshold(2, conf.getParameter<double>("metEtThreshold"));
142  m_params.setEtSumEtaMin(3, conf.getParameter<int>("mhtEtaMin"));
143  m_params.setEtSumEtaMax(3, conf.getParameter<int>("mhtEtaMax"));
144  m_params.setEtSumEtThreshold(3, conf.getParameter<double>("mhtEtThreshold"));
145 
146 }
147 
148 
149 CaloParamsESProducer::~CaloParamsESProducer()
150 {
151 
152  // do anything here that needs to be done at desctruction time
153  // (e.g. close files, deallocate resources etc.)
154 
155 }
156 
157 
158 //
159 // member functions
160 //
161 
162 // ------------ method called to produce the data ------------
164 CaloParamsESProducer::produce(const L1TCaloParamsRcd& iRecord)
165 {
166  using namespace edm::es;
167  boost::shared_ptr<CaloParams> pCaloParams ;
168 
169  pCaloParams = boost::shared_ptr< CaloParams >(new CaloParams(m_params));
170  return pCaloParams;
171 }
172 
173 }
174 
175 //define this as a plug-in
T getParameter(std::string const &) const
boost::shared_ptr< CaloParams > ReturnType
tuple conf
Definition: dbtoconf.py:185
Definition: LUT.h:27
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
std::string fullPath() const
Definition: FileInPath.cc:165