CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/L1TriggerConfig/L1ScalesProducers/src/L1ScalesTester.cc

Go to the documentation of this file.
00001 #include "L1TriggerConfig/L1ScalesProducers/interface/L1ScalesTester.h"
00002 
00003 #include "FWCore/Framework/interface/EventSetup.h"
00004 #include "FWCore/Framework/interface/ESHandle.h"
00005 
00006 #include "CondFormats/L1TObjects/interface/L1CaloEtScale.h"
00007 #include "CondFormats/DataRecord/interface/L1EmEtScaleRcd.h"
00008 #include "CondFormats/DataRecord/interface/L1JetEtScaleRcd.h"
00009 #include "CondFormats/L1TObjects/interface/L1CaloEcalScale.h"
00010 #include "CondFormats/L1TObjects/interface/L1CaloHcalScale.h"
00011 #include "CondFormats/DataRecord/interface/L1CaloEcalScaleRcd.h"
00012 #include "CondFormats/DataRecord/interface/L1CaloHcalScaleRcd.h"
00013 
00014 
00015 using std::cout;
00016 using std::endl;
00017 
00018 L1ScalesTester::L1ScalesTester(const edm::ParameterSet& ps) {
00019   cout << "Constructing a L1ScalesTester" << endl;
00020 }
00021 
00022 L1ScalesTester::~L1ScalesTester() {
00023 
00024 }
00025 
00026 void L1ScalesTester::analyze(const edm::Event& e, const edm::EventSetup& es) {
00027    using namespace edm;
00028 
00029    ESHandle< L1CaloEtScale > emScale ;
00030    es.get< L1EmEtScaleRcd >().get( emScale ) ;
00031 
00032    cout << "L1EmEtScaleRcd :" << endl;
00033    emScale->print(cout);
00034    cout << endl;
00035 
00036    ESHandle< L1CaloEcalScale > ecalScale;
00037    es.get< L1CaloEcalScaleRcd >().get(ecalScale);
00038 
00039    ESHandle< L1CaloHcalScale > hcalScale;
00040    es.get< L1CaloHcalScaleRcd >().get(hcalScale);
00041    
00042    cout << " L1ColoEcalScale  :" << endl;
00043    ecalScale->print(cout);
00044    cout << endl;
00045 
00046  cout << " L1ColoHcalScale  :" << endl;
00047    hcalScale->print(cout);
00048    cout << endl;
00049    
00050    ESHandle< L1CaloEtScale > jetScale ;
00051    es.get< L1JetEtScaleRcd >().get( jetScale ) ;
00052 
00053    cout << "L1JetEtScaleRcd :" << endl;
00054    jetScale->print(cout);
00055    cout << endl;
00056    
00057    // test EM lin-rank conversion
00058    cout << "Testing EM linear-to-rank conversion" << endl;
00059    for (unsigned short i=0; i<32; i++) {
00060      unsigned rank = emScale->rank(i);
00061      cout << "EM linear : " << i << ", Et : " << i*emScale->linearLsb() << " GeV, rank : " << rank << endl;
00062    }
00063    cout << endl;
00064    
00065    // test jet lin-rank conversion
00066    cout << "Testing jet linear-to-rank conversion" << endl;
00067    for (unsigned short i=0; i<32; i++) {
00068      unsigned rank = jetScale->rank(i);
00069      cout << "jet linear : " << i << ", Et : " << i*jetScale->linearLsb() << " GeV, rank : " << rank << endl;
00070    }
00071    cout << endl;
00072    
00073    // test EM rank-et conversion
00074    cout << "Testing EM rank-to-Et conversion" << endl;
00075    for (unsigned i=0; i<32; i++) {
00076      double et = emScale->et(i);
00077      cout << "EM rank : " << i << " Et : " << et << " GeV" << endl;
00078    }
00079    cout << endl;
00080    
00081    // test jet rank-et conversion
00082    cout << "Testing jet rank-to-Et conversion" << endl;
00083    for (unsigned i=0; i<32; i++) {
00084      double et = jetScale->et(i);
00085      cout << "jet rank : " << i << " Et : " << et << " GeV" << endl;
00086    }
00087    cout << endl;
00088 
00089 
00090 }