![]() |
![]() |
00001 #include "RecoTBCalo/EcalTBTDCReconstructor/interface/EcalTBTDCRawInfoDumper.h" 00002 #include "TBDataFormats/EcalTBObjects/interface/EcalTBTDCRawInfo.h" 00003 #include "DataFormats/Common/interface/EDCollection.h" 00004 #include "DataFormats/Common/interface/Handle.h" 00005 #include "FWCore/Framework/interface/ESHandle.h" 00006 #include "FWCore/Framework/interface/EventSetup.h" 00007 00008 #include <TFile.h> 00009 #include <FWCore/Framework/interface/MakerMacros.h> 00010 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00011 00012 EcalTBTDCRawInfoDumper::EcalTBTDCRawInfoDumper(edm::ParameterSet const& ps) 00013 { 00014 rawInfoCollection_ = ps.getParameter<std::string>("rawInfoCollection"); 00015 rawInfoProducer_ = ps.getParameter<std::string>("rawInfoProducer"); 00016 rootfile_ = ps.getUntrackedParameter<std::string>("rootfile","ecalTDCRawInfoPlots.root"); 00017 } 00018 00019 EcalTBTDCRawInfoDumper::~EcalTBTDCRawInfoDumper() { 00020 } 00021 00022 //======================================================================== 00023 void 00024 EcalTBTDCRawInfoDumper::beginJob() 00025 { 00026 //======================================================================== 00027 h_TDCrawValue_ = new TH1F("h_TDCrawValue","TDC raw value",2048,-0.5,2047.5); 00028 } 00029 00030 //======================================================================== 00031 void 00032 EcalTBTDCRawInfoDumper::endJob() { 00033 //======================================================================== 00034 TFile f(rootfile_.c_str(),"RECREATE"); 00035 h_TDCrawValue_->Write(); 00036 f.Close(); 00037 } 00038 00039 void EcalTBTDCRawInfoDumper::analyze(const edm::Event& e, const edm::EventSetup& es) 00040 { 00041 // Get input 00042 edm::Handle<EcalTBTDCRawInfo> ecalRawTDC; 00043 const EcalTBTDCRawInfo* tdcRawInfo = 0; 00044 //evt.getByLabel( digiProducer_, digiCollection_, pDigis); 00045 e.getByLabel( rawInfoProducer_, ecalRawTDC); 00046 if (!ecalRawTDC.isValid()) { 00047 edm::LogError("EcalTBTDCRecInfoError") << "Error! can't get the product " << rawInfoCollection_.c_str() ; 00048 } else { 00049 tdcRawInfo = ecalRawTDC.product(); 00050 } 00051 00052 00053 if (tdcRawInfo) 00054 { 00055 int tdcd = (*tdcRawInfo)[0].tdcValue(); 00056 h_TDCrawValue_->Fill(tdcd); 00057 } 00058 // Create empty output 00059 } 00060 00061