CMS 3D CMS Logo

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

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

Inheritance diagram for L1CaloInputScaleTester:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 L1CaloInputScaleTester (const edm::ParameterSet &)
 
 ~L1CaloInputScaleTester () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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
 

Private Attributes

edm::ESGetToken< L1CaloEcalScale, L1CaloEcalScaleRcdecalScaleToken_
 
edm::ESGetToken< L1CaloHcalScale, L1CaloHcalScaleRcdhcalScaleToken_
 
EcalTPGScale::Tokens tokens_
 
edm::ESGetToken< CaloTPGTranscoder, CaloTPGRecordtranscoderToken_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

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

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

Definition at line 35 of file L1CaloInputScaleTester.h.

Constructor & Destructor Documentation

◆ L1CaloInputScaleTester()

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

Definition at line 40 of file L1CaloInputScaleTester.cc.

41  : hcalScaleToken_(esConsumes<L1CaloHcalScale, L1CaloHcalScaleRcd>()),
42  ecalScaleToken_(esConsumes<L1CaloEcalScale, L1CaloEcalScaleRcd>()),
43  transcoderToken_(esConsumes<CaloTPGTranscoder, CaloTPGRecord>()),
45  //now do what ever initialization is needed
46 }
EcalTPGScale::Tokens tokens_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::ESGetToken< CaloTPGTranscoder, CaloTPGRecord > transcoderToken_
edm::ESGetToken< L1CaloEcalScale, L1CaloEcalScaleRcd > ecalScaleToken_
edm::ESGetToken< L1CaloHcalScale, L1CaloHcalScaleRcd > hcalScaleToken_

◆ ~L1CaloInputScaleTester()

L1CaloInputScaleTester::~L1CaloInputScaleTester ( )
override

Definition at line 48 of file L1CaloInputScaleTester.cc.

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

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 58 of file L1CaloInputScaleTester.cc.

References EcalBarrel, EcalEndcap, ecalScaleToken_, L1CaloEcalScale::et(), L1CaloHcalScale::et(), edm::EventSetup::get(), edm::EventSetup::getHandle(), EcalTPGScale::getTPGInGeV(), CaloTPGTranscoder::hcaletValue(), hcalScaleToken_, iEvent, input, tokens_, and transcoderToken_.

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

◆ beginJob()

void L1CaloInputScaleTester::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 188 of file L1CaloInputScaleTester.cc.

188 {}

◆ endJob()

void L1CaloInputScaleTester::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 191 of file L1CaloInputScaleTester.cc.

191 {}

Member Data Documentation

◆ ecalScaleToken_

edm::ESGetToken<L1CaloEcalScale, L1CaloEcalScaleRcd> L1CaloInputScaleTester::ecalScaleToken_
private

Definition at line 47 of file L1CaloInputScaleTester.h.

Referenced by analyze().

◆ hcalScaleToken_

edm::ESGetToken<L1CaloHcalScale, L1CaloHcalScaleRcd> L1CaloInputScaleTester::hcalScaleToken_
private

Definition at line 46 of file L1CaloInputScaleTester.h.

Referenced by analyze().

◆ tokens_

EcalTPGScale::Tokens L1CaloInputScaleTester::tokens_
private

Definition at line 49 of file L1CaloInputScaleTester.h.

Referenced by analyze().

◆ transcoderToken_

edm::ESGetToken<CaloTPGTranscoder, CaloTPGRecord> L1CaloInputScaleTester::transcoderToken_
private

Definition at line 48 of file L1CaloInputScaleTester.h.

Referenced by analyze().