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 () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (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::L1CaloInputScaleTester ( const edm::ParameterSet iConfig)
explicit

Definition at line 40 of file L1CaloInputScaleTester.cc.

42 {
43  //now do what ever initialization is needed
44 }

◆ ~L1CaloInputScaleTester()

L1CaloInputScaleTester::~L1CaloInputScaleTester ( )
override

Definition at line 46 of file L1CaloInputScaleTester.cc.

46  {
47  // do anything here that needs to be done at destruction time
48  // (e.g. close files, deallocate resources etc.)
49 }

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 56 of file L1CaloInputScaleTester.cc.

56  {
57  using namespace edm;
58 
59 #ifdef THIS_IS_AN_EVENT_EXAMPLE
61  iEvent.getByLabel("example", pIn);
62 #endif
63 
64 #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
65  ESHandle<SetupData> pSetup;
66  iSetup.get<SetupRecord>().get(pSetup);
67 #endif
68 
69  ESHandle<L1CaloEcalScale> caloEcalScale;
70  ESHandle<L1CaloHcalScale> caloHcalScale;
71  ESHandle<CaloTPGTranscoder> caloTPGTranscoder;
72  iSetup.get<L1CaloEcalScaleRcd>().get(caloEcalScale);
73  iSetup.get<L1CaloHcalScaleRcd>().get(caloHcalScale);
74  iSetup.get<CaloTPGRecord>().get(caloTPGTranscoder);
75 
76  EcalTPGScale* ecalTPGScale = new EcalTPGScale();
77  ecalTPGScale->setEventSetup(iSetup);
78 
79  bool ecalIsConsistent = true;
80  bool hcalIsConsistent = true;
81 
82  double ecal1;
83  double ecal2;
84  double hcal1;
85  double hcal2;
86  double hcal3;
87  double hcal4;
88 
89  // compare the ecal scales
90 
91  // 8 bits of input energy
92  for (unsigned short input = 0; input <= 0xFF; input++) {
93  // loop over ietas, barrel first
94  for (unsigned short absIeta = 1; absIeta <= 17; absIeta++) {
95  // positive eta
96  ecal1 = ecalTPGScale->getTPGInGeV((unsigned int)input, EcalTrigTowerDetId(1, EcalBarrel, absIeta, 1));
97  ecal2 = caloEcalScale->et(input, absIeta, 1);
98 
99  if (!(ecal1 == ecal2)) {
100  ecalIsConsistent = false;
101  /*LogWarning("InconsistentData")
102  << "ECAL scales not consistent! (pos eta barrel)"
103  << "old ECAL is " << setprecision (8) << ecal1
104  << " new ECAL is " << setprecision (8) << ecal2
105  << " difference is " << (ecal1 - ecal2) ; */
106  }
107 
108  // negative eta
109  ecal1 = ecalTPGScale->getTPGInGeV((unsigned int)input, EcalTrigTowerDetId(-1, EcalBarrel, absIeta, 2));
110  ecal2 = caloEcalScale->et(input, absIeta, -1);
111 
112  if (!(ecal1 == ecal2)) {
113  ecalIsConsistent = false;
114  /*LogWarning("InconsistentData")
115  << "ECAL scales not consistent! (neg eta barrel)"
116  << "old ECAL is " << setprecision (8) << ecal1
117  << " new ECAL is " << setprecision (8) << ecal2
118  << " difference is " << (ecal1 - ecal2) ; */
119  }
120  }
121  // now loop over endcap ietas
122  for (unsigned short absIeta = 18; absIeta <= 28; absIeta++) {
123  // positive eta
124  ecal1 = ecalTPGScale->getTPGInGeV((unsigned int)input, EcalTrigTowerDetId(1, EcalEndcap, absIeta, 1));
125  ecal2 = caloEcalScale->et(input, absIeta, 1);
126 
127  if (!(ecal1 == ecal2)) {
128  ecalIsConsistent = false;
129  /*LogWarning("InconsistentData")
130  << "ECAL scales not consistent! (pos eta endcap)"
131  << "old ECAL is " << setprecision (8) << ecal1
132  << " new ECAL is " << setprecision (8) << ecal2
133  << " difference is " << (ecal1 - ecal2) ; */
134  }
135 
136  // negative eta
137  ecal1 = ecalTPGScale->getTPGInGeV((unsigned int)input, EcalTrigTowerDetId(-1, EcalEndcap, absIeta, 2));
138  ecal2 = caloEcalScale->et(input, absIeta, -1);
139 
140  if (!(ecal1 == ecal2)) {
141  ecalIsConsistent = false;
142  /*LogWarning("InconsistentData")
143  << "ECAL scales not consistent! (neg eta endcap)"
144  << "old ECAL is " << setprecision (8) << ecal1
145  << " new ECAL is " << setprecision (8) << ecal2
146  << " difference is " << (ecal1 - ecal2) ; */
147  }
148  }
149  }
150 
151  if (!ecalIsConsistent) {
152  // do something
153  //cout << "WARNING: ECAL scales not consistent!" << endl;
154  LogWarning("InconsistentData") << "ECAL scales not consistent!";
155  } else {
156  // do something else
157  //cout << "ECAL scales okay" << endl;
158  }
159 
160  // compare the hcal scales
161 
162  for (unsigned short input = 0; input <= 0xFF; input++) {
163  // loop over ietas
164  for (unsigned short absIeta = 1; absIeta <= 32; absIeta++) {
165  hcal1 = caloTPGTranscoder->hcaletValue(absIeta, input); // no eta-
166  hcal2 = caloHcalScale->et(input, absIeta, 1); // sign in transcoder
167  hcal3 = caloTPGTranscoder->hcaletValue(-absIeta, input); // no eta-
168  hcal4 = caloHcalScale->et(input, absIeta, -1); // sign in transcoder
169 
170  if ((!(hcal1 == hcal2)) || (!(hcal3 == hcal4))) {
171  hcalIsConsistent = false;
172  /*LogWarning("InconsistentData")
173  << "HCAL scales not consistent!"
174  << "old HCAL is " << hcal1
175  << " new HCAL is " << hcal2 ; */
176  }
177  }
178  }
179  if (!hcalIsConsistent) {
180  // do something
181  //cout << "WARNING: HCAL scales not consistent!" << endl;
182  LogWarning("InconsistentData") << "HCAL scales not consistent!";
183  } else {
184  // do something else
185  //cout << "HCAL scales okay" << endl;
186  }
187 }

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

◆ beginJob()

void L1CaloInputScaleTester::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 190 of file L1CaloInputScaleTester.cc.

190 {}

◆ endJob()

void L1CaloInputScaleTester::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 193 of file L1CaloInputScaleTester.cc.

193 {}
EcalTPGScale::getTPGInGeV
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi)
Definition: EcalTPGScale.cc:18
input
static const std::string input
Definition: EdmProvDump.cc:48
EcalTPGScale
Definition: EcalTPGScale.h:8
L1CaloEcalScaleRcd
Definition: L1CaloEcalScaleRcd.h:12
edm
HLT enums.
Definition: AlignableModifier.h:19
L1CaloHcalScale::et
double et(unsigned short rank, unsigned short eta, short etaSign) const
convert from rank to physically meaningful quantity
Definition: L1CaloHcalScale.cc:64
L1CaloEcalScale::et
double et(unsigned short rank, unsigned short eta, short etaSign) const
convert from rank to physically meaningful quantity
Definition: L1CaloEcalScale.cc:64
EcalTPGScale::setEventSetup
void setEventSetup(const edm::EventSetup &evtSetup)
Definition: EcalTPGScale.cc:16
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
edm::Handle
Definition: AssociativeIterator.h:50
EcalBarrel
Definition: EcalSubdetector.h:10
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
edm::ESHandle
Definition: DTSurvey.h:22
EcalEndcap
Definition: EcalSubdetector.h:10
edm::LogWarning
Definition: MessageLogger.h:141
CaloTPGRecord
Definition: CaloTPGRecord.h:26
iEvent
int iEvent
Definition: GenABIO.cc:224
get
#define get
CaloTPGTranscoder::hcaletValue
virtual double hcaletValue(const int &ieta, const int &iphi, const int &version, const int &compressedValue) const =0
L1CaloHcalScaleRcd
Definition: L1CaloHcalScaleRcd.h:13