CMS 3D CMS Logo

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

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

Inheritance diagram for L1CaloInputScaleTester:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 L1CaloInputScaleTester (const edm::ParameterSet &)
 
 ~L1CaloInputScaleTester ()
 
- 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 & itemsToGetFromEvent () 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 L1CaloInputScaleTester.h.

Constructor & Destructor Documentation

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

Definition at line 41 of file L1CaloInputScaleTester.cc.

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

Definition at line 49 of file L1CaloInputScaleTester.cc.

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

Member Function Documentation

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

Definition at line 64 of file L1CaloInputScaleTester.cc.

References EcalBarrel, EcalEndcap, L1CaloHcalScale::et(), L1CaloEcalScale::et(), edm::EventSetup::get(), edm::Event::getByLabel(), EcalTPGScale::getTPGInGeV(), CaloTPGTranscoder::hcaletValue(), input, and EcalTPGScale::setEventSetup().

65 {
66  using namespace edm;
67 
68 #ifdef THIS_IS_AN_EVENT_EXAMPLE
70  iEvent.getByLabel("example",pIn);
71 #endif
72 
73 #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
74  ESHandle<SetupData> pSetup;
75  iSetup.get<SetupRecord>().get(pSetup);
76 #endif
77 
78  ESHandle<L1CaloEcalScale> caloEcalScale;
79  ESHandle<L1CaloHcalScale> caloHcalScale;
80  ESHandle<CaloTPGTranscoder> caloTPGTranscoder;
81  iSetup.get<L1CaloEcalScaleRcd>().get(caloEcalScale);
82  iSetup.get<L1CaloHcalScaleRcd>().get(caloHcalScale);
83  iSetup.get<CaloTPGRecord>().get(caloTPGTranscoder);
84 
85  EcalTPGScale* ecalTPGScale = new EcalTPGScale();
86  ecalTPGScale->setEventSetup(iSetup);
87 
88  bool ecalIsConsistent = true;
89  bool hcalIsConsistent = true;
90 
91  double ecal1;
92  double ecal2;
93  double hcal1;
94  double hcal2;
95  double hcal3;
96  double hcal4;
97 
98 
99  // compare the ecal scales
100 
101  // 8 bits of input energy
102  for (unsigned short input = 0; input <= 0xFF; input++)
103  {
104  // loop over ietas, barrel first
105  for (unsigned short absIeta = 1; absIeta <= 17; absIeta++)
106  {
107 
108  // positive eta
109  ecal1 = ecalTPGScale->getTPGInGeV( (unsigned int) input,
111  absIeta, 1));
112  ecal2 = caloEcalScale->et(input, absIeta, 1);
113 
114  if ( !(ecal1 == ecal2) )
115  {
116  ecalIsConsistent = false;
117  /*LogWarning("InconsistentData")
118  << "ECAL scales not consistent! (pos eta barrel)"
119  << "old ECAL is " << setprecision (8) << ecal1
120  << " new ECAL is " << setprecision (8) << ecal2
121  << " difference is " << (ecal1 - ecal2) ; */
122  }
123 
124  // negative eta
125  ecal1 = ecalTPGScale->
126  getTPGInGeV( (unsigned int) input, EcalTrigTowerDetId(-1, EcalBarrel,
127  absIeta, 2));
128  ecal2 = caloEcalScale->et(input, absIeta, -1);
129 
130  if ( !(ecal1 == ecal2) )
131  {
132  ecalIsConsistent = false;
133  /*LogWarning("InconsistentData")
134  << "ECAL scales not consistent! (neg eta barrel)"
135  << "old ECAL is " << setprecision (8) << ecal1
136  << " new ECAL is " << setprecision (8) << ecal2
137  << " difference is " << (ecal1 - ecal2) ; */
138  }
139  }
140  // now loop over endcap ietas
141  for (unsigned short absIeta = 18; absIeta <= 28; absIeta++)
142  {
143 
144  // positive eta
145  ecal1 = ecalTPGScale->
146  getTPGInGeV( (unsigned int) input, EcalTrigTowerDetId(1, EcalEndcap,
147  absIeta, 1));
148  ecal2 = caloEcalScale->et(input, absIeta, 1);
149 
150  if ( !(ecal1 == ecal2) )
151  {
152  ecalIsConsistent = false;
153  /*LogWarning("InconsistentData")
154  << "ECAL scales not consistent! (pos eta endcap)"
155  << "old ECAL is " << setprecision (8) << ecal1
156  << " new ECAL is " << setprecision (8) << ecal2
157  << " difference is " << (ecal1 - ecal2) ; */
158  }
159 
160  // negative eta
161  ecal1 = ecalTPGScale->
162  getTPGInGeV( (unsigned int) input, EcalTrigTowerDetId(-1, EcalEndcap,
163  absIeta, 2));
164  ecal2 = caloEcalScale->et(input, absIeta, -1);
165 
166  if ( !(ecal1 == ecal2) )
167  {
168  ecalIsConsistent = false;
169  /*LogWarning("InconsistentData")
170  << "ECAL scales not consistent! (neg eta endcap)"
171  << "old ECAL is " << setprecision (8) << ecal1
172  << " new ECAL is " << setprecision (8) << ecal2
173  << " difference is " << (ecal1 - ecal2) ; */
174  }
175  }
176  }
177 
178  if (!ecalIsConsistent)
179  {
180  // do something
181  //cout << "WARNING: ECAL scales not consistent!" << endl;
182  LogWarning("InconsistentData") << "ECAL scales not consistent!";
183  }
184  else
185  {
186  // do something else
187  //cout << "ECAL scales okay" << endl;
188  }
189 
190  // compare the hcal scales
191 
192  for (unsigned short input = 0; input <= 0xFF; input++)
193  {
194  // loop over ietas
195  for (unsigned short absIeta = 1; absIeta <= 32; absIeta++)
196  {
197  hcal1 = caloTPGTranscoder->hcaletValue(absIeta, input); // no eta-
198  hcal2 = caloHcalScale->et(input, absIeta, 1); // sign in transcoder
199  hcal3 = caloTPGTranscoder->hcaletValue(-absIeta, input); // no eta-
200  hcal4 = caloHcalScale->et(input, absIeta,-1); // sign in transcoder
201 
202 
203 
204  if ( (!(hcal1 == hcal2))||(!(hcal3==hcal4)))
205  {
206  hcalIsConsistent = false;
207  /*LogWarning("InconsistentData")
208  << "HCAL scales not consistent!"
209  << "old HCAL is " << hcal1
210  << " new HCAL is " << hcal2 ; */
211  }
212  }
213  }
214  if (!hcalIsConsistent)
215  {
216  // do something
217  //cout << "WARNING: HCAL scales not consistent!" << endl;
218  LogWarning("InconsistentData") << "HCAL scales not consistent!";
219  }
220  else
221  {
222  // do something else
223  //cout << "HCAL scales okay" << endl;
224  }
225 }
void setEventSetup(const edm::EventSetup &evtSetup)
Definition: EcalTPGScale.cc:19
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi)
Definition: EcalTPGScale.cc:24
double et(unsigned short rank, unsigned short eta, short etaSign) const
convert from rank to physically meaningful quantity
static std::string const input
Definition: EdmProvDump.cc:44
double et(unsigned short rank, unsigned short eta, short etaSign) const
convert from rank to physically meaningful quantity
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
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
void L1CaloInputScaleTester::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 230 of file L1CaloInputScaleTester.cc.

231 {
232 }
void L1CaloInputScaleTester::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 236 of file L1CaloInputScaleTester.cc.

236  {
237 }