CMS 3D CMS Logo

L1ScalesTester.cc
Go to the documentation of this file.
2 
5 
6 #include <iostream>
7 
8 using std::cout;
9 using std::endl;
10 
12  : emScaleToken_(esConsumes()),
13  ecalScaleToken_(esConsumes()),
14  hcalScaleToken_(esConsumes()),
15  jetScaleToken_(esConsumes()) {
16  cout << "Constructing a L1ScalesTester" << endl;
17 }
18 
20  using namespace edm;
21 
22  L1CaloEtScale const& emScale = es.getData(emScaleToken_);
23 
24  cout << "L1EmEtScaleRcd :" << endl;
25  emScale.print(cout);
26  cout << endl;
27 
28  L1CaloEcalScale const& ecalScale = es.getData(ecalScaleToken_);
29 
30  L1CaloHcalScale const& hcalScale = es.getData(hcalScaleToken_);
31 
32  cout << " L1ColoEcalScale :" << endl;
33  ecalScale.print(cout);
34  cout << endl;
35 
36  cout << " L1ColoHcalScale :" << endl;
37  hcalScale.print(cout);
38  cout << endl;
39 
41 
42  cout << "L1JetEtScaleRcd :" << endl;
43  jetScale.print(cout);
44  cout << endl;
45 
46  // test EM lin-rank conversion
47  cout << "Testing EM linear-to-rank conversion" << endl;
48  for (unsigned short i = 0; i < 32; i++) {
49  unsigned rank = emScale.rank(i);
50  cout << "EM linear : " << i << ", Et : " << i * emScale.linearLsb() << " GeV, rank : " << rank << endl;
51  }
52  cout << endl;
53 
54  // test jet lin-rank conversion
55  cout << "Testing jet linear-to-rank conversion" << endl;
56  for (unsigned short i = 0; i < 32; i++) {
57  unsigned rank = jetScale.rank(i);
58  cout << "jet linear : " << i << ", Et : " << i * jetScale.linearLsb() << " GeV, rank : " << rank << endl;
59  }
60  cout << endl;
61 
62  // test EM rank-et conversion
63  cout << "Testing EM rank-to-Et conversion" << endl;
64  for (unsigned i = 0; i < 32; i++) {
65  double et = emScale.et(i);
66  cout << "EM rank : " << i << " Et : " << et << " GeV" << endl;
67  }
68  cout << endl;
69 
70  // test jet rank-et conversion
71  cout << "Testing jet rank-to-Et conversion" << endl;
72  for (unsigned i = 0; i < 32; i++) {
73  double et = jetScale.et(i);
74  cout << "jet rank : " << i << " Et : " << et << " GeV" << endl;
75  }
76  cout << endl;
77 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
const edm::ESGetToken< L1CaloEtScale, L1JetEtScaleRcd > jetScaleToken_
const edm::ESGetToken< L1CaloEcalScale, L1CaloEcalScaleRcd > ecalScaleToken_
double et(const uint16_t rank) const
convert from rank to physically meaningful quantity
double linearLsb() const
get LSB of linear input scale
Definition: L1CaloEtScale.h:54
bool getData(T &iHolder) const
Definition: EventSetup.h:122
L1ScalesTester(const edm::ParameterSet &)
void analyze(const edm::Event &, const edm::EventSetup &) override
const edm::ESGetToken< L1CaloHcalScale, L1CaloHcalScaleRcd > hcalScaleToken_
const edm::ESGetToken< L1CaloEtScale, L1EmEtScaleRcd > emScaleToken_
void print(std::ostream &s) const
uint16_t rank(const uint16_t linear) const
convert from linear Et scale to rank scale
HLT enums.
void print(std::ostream &s) const
void print(std::ostream &s) const