Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:23

0001 #include "L1TriggerConfig/L1ScalesProducers/interface/L1ScalesTester.h"
0002 
0003 #include "FWCore/Framework/interface/EventSetup.h"
0004 #include "FWCore/Framework/interface/ESHandle.h"
0005 
0006 #include <iostream>
0007 
0008 using std::cout;
0009 using std::endl;
0010 
0011 L1ScalesTester::L1ScalesTester(const edm::ParameterSet& ps)
0012     : emScaleToken_(esConsumes()),
0013       ecalScaleToken_(esConsumes()),
0014       hcalScaleToken_(esConsumes()),
0015       jetScaleToken_(esConsumes()) {
0016   cout << "Constructing a L1ScalesTester" << endl;
0017 }
0018 
0019 void L1ScalesTester::analyze(const edm::Event& e, const edm::EventSetup& es) {
0020   using namespace edm;
0021 
0022   L1CaloEtScale const& emScale = es.getData(emScaleToken_);
0023 
0024   cout << "L1EmEtScaleRcd :" << endl;
0025   emScale.print(cout);
0026   cout << endl;
0027 
0028   L1CaloEcalScale const& ecalScale = es.getData(ecalScaleToken_);
0029 
0030   L1CaloHcalScale const& hcalScale = es.getData(hcalScaleToken_);
0031 
0032   cout << " L1ColoEcalScale  :" << endl;
0033   ecalScale.print(cout);
0034   cout << endl;
0035 
0036   cout << " L1ColoHcalScale  :" << endl;
0037   hcalScale.print(cout);
0038   cout << endl;
0039 
0040   L1CaloEtScale const& jetScale = es.getData(jetScaleToken_);
0041 
0042   cout << "L1JetEtScaleRcd :" << endl;
0043   jetScale.print(cout);
0044   cout << endl;
0045 
0046   // test EM lin-rank conversion
0047   cout << "Testing EM linear-to-rank conversion" << endl;
0048   for (unsigned short i = 0; i < 32; i++) {
0049     unsigned rank = emScale.rank(i);
0050     cout << "EM linear : " << i << ", Et : " << i * emScale.linearLsb() << " GeV, rank : " << rank << endl;
0051   }
0052   cout << endl;
0053 
0054   // test jet lin-rank conversion
0055   cout << "Testing jet linear-to-rank conversion" << endl;
0056   for (unsigned short i = 0; i < 32; i++) {
0057     unsigned rank = jetScale.rank(i);
0058     cout << "jet linear : " << i << ", Et : " << i * jetScale.linearLsb() << " GeV, rank : " << rank << endl;
0059   }
0060   cout << endl;
0061 
0062   // test EM rank-et conversion
0063   cout << "Testing EM rank-to-Et conversion" << endl;
0064   for (unsigned i = 0; i < 32; i++) {
0065     double et = emScale.et(i);
0066     cout << "EM rank : " << i << " Et : " << et << " GeV" << endl;
0067   }
0068   cout << endl;
0069 
0070   // test jet rank-et conversion
0071   cout << "Testing jet rank-to-Et conversion" << endl;
0072   for (unsigned i = 0; i < 32; i++) {
0073     double et = jetScale.et(i);
0074     cout << "jet rank : " << i << " Et : " << et << " GeV" << endl;
0075   }
0076   cout << endl;
0077 }