CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
L1CaloInputScalesGenerator Class Reference

#include <L1TriggerConfig/L1ScalesProducers/src/L1CaloInputScalesGenerator.cc>

Inheritance diagram for L1CaloInputScalesGenerator:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 L1CaloInputScalesGenerator (const edm::ParameterSet &)
 
 ~L1CaloInputScalesGenerator ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 27 of file L1CaloInputScalesGenerator.h.

Constructor & Destructor Documentation

L1CaloInputScalesGenerator::L1CaloInputScalesGenerator ( const edm::ParameterSet iConfig)
explicit

Definition at line 40 of file L1CaloInputScalesGenerator.cc.

42 {
43  //now do what ever initialization is needed
44 
45 }
L1CaloInputScalesGenerator::~L1CaloInputScalesGenerator ( )

Definition at line 48 of file L1CaloInputScalesGenerator.cc.

49 {
50 
51  // do anything here that needs to be done at desctruction time
52  // (e.g. close files, deallocate resources etc.)
53 
54 }

Member Function Documentation

void L1CaloInputScalesGenerator::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Definition at line 63 of file L1CaloInputScalesGenerator.cc.

References EcalBarrel, EcalEndcap, edm::EventSetup::get(), EcalTPGScale::getTPGInGeV(), CaloTPGTranscoder::hcaletValue(), input, convertSQLitetoXML_cfg::output, and EcalTPGScale::setEventSetup().

64 {
65  using namespace edm;
66 
67 
68  ESHandle<CaloTPGTranscoder> caloTPGTranscoder;
69  iSetup.get<CaloTPGRecord>().get(caloTPGTranscoder);
70 
71  EcalTPGScale* ecalTPGScale = new EcalTPGScale();
72  ecalTPGScale->setEventSetup(iSetup);
73 
74  double output;
75  ofstream scalesFile("L1CaloInputScales_cfi.py");
76 
77 
78  // Write the ecal scales, positive eta
79 
80  scalesFile << "import FWCore.ParameterSet.Config as cms\n" <<endl;
81 
82  scalesFile << "L1CaloInputScalesProducer =cms.ESProducer(\"L1CaloInputScalesProducer\"," << endl;
83  scalesFile << "L1EcalEtThresholdsPositiveEta = cms.vdouble(" << endl;
84 
85 
86  //Python does not support arrays over 255 entries so we neeed ton accomodate it by creating new array after 255 entries
87  int nEntries = 0;
88 
89 
90 
91  // loop over ietas, barrel
92  for (unsigned short absIeta = 1; absIeta <= 28; absIeta++)
93  {
94  EcalSubdetector subdet = ( absIeta <= 17 ) ? EcalBarrel : EcalEndcap ;
95  // 8 bits of input energy
96  for (unsigned short input = 0; input <= 0xFF; input++)
97  {
98  output = ecalTPGScale->getTPGInGeV( (unsigned int) input,
99  EcalTrigTowerDetId(1, subdet,
100  absIeta, 1));
101  scalesFile << setprecision (8) << output;
102  nEntries++;
103 
104  if (absIeta == 28 && input == 0xFF)
105  {
106  scalesFile << "),";
107  }
108  else if(nEntries>254)
109  {
110  scalesFile <<")+cms.vdouble(";
111  nEntries=0;
112  }
113  else
114  {
115  scalesFile << ", ";
116  }
117  }
118  scalesFile << endl;
119  }
120 
121  // Write the ecal scales, negative eta
122 
123  scalesFile << endl << "\tL1EcalEtThresholdsNegativeEta = cms.vdouble(" << endl;
124 
125  nEntries=0;
126  // loop over ietas, barrel first
127  for (unsigned short absIeta = 1; absIeta <= 28; absIeta++)
128  {
129  EcalSubdetector subdet = ( absIeta <= 17 ) ? EcalBarrel : EcalEndcap ;
130  // 8 bits of input energy
131  for (unsigned short input = 0; input <= 0xFF; input++)
132  {
133  // negative eta
134  output = ecalTPGScale->
135  getTPGInGeV( (unsigned int) input, EcalTrigTowerDetId(-1, subdet,
136  absIeta, 2));
137  scalesFile << setprecision (8) << output;
138  nEntries++;
139 
140 
141 
142  if (absIeta == 28 && input == 0xFF)
143  {
144  scalesFile << "),";
145  }
146  else if(nEntries>254)
147  {
148  scalesFile <<")+cms.vdouble(";
149  nEntries=0;
150  }
151  else
152  {
153  scalesFile << ", ";
154  }
155  }
156  scalesFile << endl;
157  }
158 
159  // Write the hcal scales (Positive Eta)
160 
161  scalesFile << endl << "\tL1HcalEtThresholdsPositiveEta = cms.vdouble(" << endl;
162 
163  // loop over ietas
164 
165  nEntries=0;
166  for (unsigned short absIeta = 1; absIeta <= 32; absIeta++)
167  {
168  for (unsigned short input = 0; input <= 0xFF; input++)
169  {
170  output = caloTPGTranscoder->hcaletValue(absIeta, input);
171  scalesFile << setprecision (8) << output ;
172  nEntries++;
173 
174 
175  if (absIeta == 32 && input == 0xFF)
176  {
177  scalesFile << "),";
178  }
179  else if(nEntries>254)
180  {
181  scalesFile <<")+cms.vdouble(";
182  nEntries=0;
183  }
184  else
185  {
186  scalesFile << ", ";
187  }
188  }
189  scalesFile << endl;
190  }
191 
192  // Write the hcal scales (Negative Eta)
193 
194  scalesFile << endl << "\tL1HcalEtThresholdsNegativeEta = cms.vdouble(" << endl;
195 
196  nEntries=0;
197  // loop over ietas
198  for (unsigned short absIeta = 1; absIeta <= 32; absIeta++)
199  {
200  for (unsigned short input = 0; input <= 0xFF; input++)
201  {
202  output = caloTPGTranscoder->hcaletValue(-absIeta, input);
203  scalesFile << setprecision (8) << output ;
204  nEntries++;
205 
206 
207  if (absIeta == 32 && input == 0xFF)
208  {
209  scalesFile << ")";
210  }
211  else if(nEntries>254)
212  {
213  scalesFile <<")+cms.vdouble(";
214  nEntries=0;
215  }
216  else
217  {
218  scalesFile << ", ";
219  }
220  }
221  scalesFile << endl;
222  }
223 
224 
225  scalesFile << ")" << endl;
226 
227  scalesFile.close();
228 }
void setEventSetup(const edm::EventSetup &evtSetup)
Definition: EcalTPGScale.cc:19
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi)
Definition: EcalTPGScale.cc:24
static std::string const input
Definition: EdmProvDump.cc:44
const T & get() const
Definition: EventSetup.h:56
HLT enums.
virtual double hcaletValue(const int &ieta, const int &iphi, const int &version, const int &compressedValue) const =0
EcalSubdetector
void L1CaloInputScalesGenerator::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 233 of file L1CaloInputScalesGenerator.cc.

234 {
235 }
void L1CaloInputScalesGenerator::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 239 of file L1CaloInputScalesGenerator.cc.

239  {
240 }