#include <RecoTBCalo/EcalTBHodoscopeReconstructor/interface/EcalTBHodoscopeRawInfoDumper.h>
Public Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob (edm::EventSetup const &) |
EcalTBHodoscopeRawInfoDumper (const edm::ParameterSet &ps) | |
virtual void | endJob () |
virtual | ~EcalTBHodoscopeRawInfoDumper () |
Private Attributes | |
TH1F * | h_firedHits_ [4] |
TH1F * | h_numberOfFiredHits_ [4] |
std::string | rawInfoCollection_ |
std::string | rawInfoProducer_ |
std::string | rootfile_ |
Definition at line 18 of file EcalTBHodoscopeRawInfoDumper.h.
EcalTBHodoscopeRawInfoDumper::EcalTBHodoscopeRawInfoDumper | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 13 of file EcalTBHodoscopeRawInfoDumper.cc.
References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), rawInfoCollection_, rawInfoProducer_, and rootfile_.
00014 { 00015 rawInfoCollection_ = ps.getParameter<std::string>("rawInfoCollection"); 00016 rawInfoProducer_ = ps.getParameter<std::string>("rawInfoProducer"); 00017 rootfile_ = ps.getUntrackedParameter<std::string>("rootfile","ecalHodoscopeRawInfoPlots.root"); 00018 }
EcalTBHodoscopeRawInfoDumper::~EcalTBHodoscopeRawInfoDumper | ( | ) | [virtual] |
void EcalTBHodoscopeRawInfoDumper::analyze | ( | const edm::Event & | e, | |
const edm::EventSetup & | es | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 62 of file EcalTBHodoscopeRawInfoDumper.cc.
References edm::Event::getByLabel(), h_firedHits_, h_numberOfFiredHits_, i, edm::Handle< T >::isValid(), j, LogDebug, edm::Handle< T >::product(), rawInfoCollection_, and rawInfoProducer_.
00063 { 00064 // Get input 00065 edm::Handle<EcalTBHodoscopeRawInfo> ecalRawHodoscope; 00066 const EcalTBHodoscopeRawInfo* hodoscopeRawInfo = 0; 00067 //evt.getByLabel( digiProducer_, digiCollection_, pDigis); 00068 e.getByLabel( rawInfoProducer_, ecalRawHodoscope); 00069 if (!ecalRawHodoscope.isValid()) { 00070 edm::LogError("EcalTBHodoscopeRecInfoError") << "Error! can't get the product " << rawInfoCollection_.c_str() ; 00071 } else { 00072 hodoscopeRawInfo = ecalRawHodoscope.product(); 00073 } 00074 00075 if (hodoscopeRawInfo) 00076 for (int i=0; i<4; i++) 00077 { 00078 std::ostringstream str; 00079 str << " Hits " ; 00080 std::vector<int> firedHits; 00081 h_numberOfFiredHits_[i]->Fill((*hodoscopeRawInfo)[i].numberOfFiredHits()); 00082 for (int j=0;j<64;j++) 00083 if ((*hodoscopeRawInfo)[i][j]) 00084 { 00085 h_firedHits_[i]->Fill(j); 00086 firedHits.push_back(j); 00087 str << j << " " ; 00088 } 00089 LogDebug("EcalTBHodoscope") << "Looking plane " << i << " number of hits " << (*hodoscopeRawInfo)[i].numberOfFiredHits() << str.str(); 00090 } 00091 // Create empty output 00092 }
void EcalTBHodoscopeRawInfoDumper::beginJob | ( | edm::EventSetup const & | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 25 of file EcalTBHodoscopeRawInfoDumper.cc.
References h_firedHits_, h_numberOfFiredHits_, and i.
00025 { 00026 //======================================================================== 00027 00028 char histoName[100]; 00029 char histoTitle[100]; 00030 00031 for (int i=0; i<4; i++) 00032 { 00033 sprintf(histoName,"h_numberOfFiredHits_%d",i); 00034 sprintf(histoTitle,"NumberOfFiredHits Plane %d",i); 00035 h_numberOfFiredHits_[i]=new TH1F(histoName,histoTitle,10,0.,10.); 00036 } 00037 00038 for (int i=0; i<4; i++) 00039 { 00040 sprintf(histoName,"h_firedHits_%d",i); 00041 sprintf(histoTitle,"firedHits Plane %d",i); 00042 h_firedHits_[i]=new TH1F(histoName,histoTitle,64,-0.5,63.5); 00043 } 00044 }
Reimplemented from edm::EDAnalyzer.
Definition at line 48 of file EcalTBHodoscopeRawInfoDumper.cc.
References f, h_firedHits_, h_numberOfFiredHits_, i, and rootfile_.
00048 { 00049 //======================================================================== 00050 00051 TFile f(rootfile_.c_str(),"RECREATE"); 00052 00053 for (int i=0; i<4; i++) 00054 h_numberOfFiredHits_[i]->Write(); 00055 00056 for (int i=0; i<4; i++) 00057 h_firedHits_[i]->Write(); 00058 00059 f.Close(); 00060 }
TH1F* EcalTBHodoscopeRawInfoDumper::h_firedHits_[4] [private] |
Definition at line 34 of file EcalTBHodoscopeRawInfoDumper.h.
Referenced by analyze(), beginJob(), and endJob().
TH1F* EcalTBHodoscopeRawInfoDumper::h_numberOfFiredHits_[4] [private] |
Definition at line 33 of file EcalTBHodoscopeRawInfoDumper.h.
Referenced by analyze(), beginJob(), and endJob().
std::string EcalTBHodoscopeRawInfoDumper::rawInfoCollection_ [private] |
Definition at line 31 of file EcalTBHodoscopeRawInfoDumper.h.
Referenced by analyze(), and EcalTBHodoscopeRawInfoDumper().
std::string EcalTBHodoscopeRawInfoDumper::rawInfoProducer_ [private] |
Definition at line 30 of file EcalTBHodoscopeRawInfoDumper.h.
Referenced by analyze(), and EcalTBHodoscopeRawInfoDumper().
std::string EcalTBHodoscopeRawInfoDumper::rootfile_ [private] |
Definition at line 32 of file EcalTBHodoscopeRawInfoDumper.h.
Referenced by EcalTBHodoscopeRawInfoDumper(), and endJob().