CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
EcalTBHodoscopeRawInfoDumper Class Reference

#include <EcalTBHodoscopeRawInfoDumper.h>

Inheritance diagram for EcalTBHodoscopeRawInfoDumper:
edm::EDAnalyzer

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
 EcalTBHodoscopeRawInfoDumper (const edm::ParameterSet &ps)
 
virtual void endJob ()
 
virtual ~EcalTBHodoscopeRawInfoDumper ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

TH1F * h_firedHits_ [4]
 
TH1F * h_numberOfFiredHits_ [4]
 
std::string rawInfoCollection_
 
std::string rawInfoProducer_
 
std::string rootfile_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 17 of file EcalTBHodoscopeRawInfoDumper.h.

Constructor & Destructor Documentation

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_.

14 {
15  rawInfoCollection_ = ps.getParameter<std::string>("rawInfoCollection");
16  rawInfoProducer_ = ps.getParameter<std::string>("rawInfoProducer");
17  rootfile_ = ps.getUntrackedParameter<std::string>("rootfile","ecalHodoscopeRawInfoPlots.root");
18 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
EcalTBHodoscopeRawInfoDumper::~EcalTBHodoscopeRawInfoDumper ( )
virtual

Definition at line 20 of file EcalTBHodoscopeRawInfoDumper.cc.

20  {
21 }

Member Function Documentation

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::HandleBase::isValid(), j, LogDebug, edm::Handle< T >::product(), rawInfoCollection_, and rawInfoProducer_.

63 {
64  // Get input
65  edm::Handle<EcalTBHodoscopeRawInfo> ecalRawHodoscope;
66  const EcalTBHodoscopeRawInfo* hodoscopeRawInfo = 0;
67  //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
68  e.getByLabel( rawInfoProducer_, ecalRawHodoscope);
69  if (!ecalRawHodoscope.isValid()) {
70  edm::LogError("EcalTBHodoscopeRecInfoError") << "Error! can't get the product " << rawInfoCollection_.c_str() ;
71  } else {
72  hodoscopeRawInfo = ecalRawHodoscope.product();
73  }
74 
75  if (hodoscopeRawInfo)
76  for (int i=0; i<4; i++)
77  {
78  std::ostringstream str;
79  str << " Hits " ;
80  std::vector<int> firedHits;
81  h_numberOfFiredHits_[i]->Fill((*hodoscopeRawInfo)[i].numberOfFiredHits());
82  for (int j=0;j<64;j++)
83  if ((*hodoscopeRawInfo)[i][j])
84  {
85  h_firedHits_[i]->Fill(j);
86  firedHits.push_back(j);
87  str << j << " " ;
88  }
89  LogDebug("EcalTBHodoscope") << "Looking plane " << i << " number of hits " << (*hodoscopeRawInfo)[i].numberOfFiredHits() << str.str();
90  }
91  // Create empty output
92 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
T const * product() const
Definition: Handle.h:74
void EcalTBHodoscopeRawInfoDumper::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 25 of file EcalTBHodoscopeRawInfoDumper.cc.

References h_firedHits_, h_numberOfFiredHits_, and i.

25  {
26 //========================================================================
27 
28  char histoName[100];
29  char histoTitle[100];
30 
31  for (int i=0; i<4; i++)
32  {
33  sprintf(histoName,"h_numberOfFiredHits_%d",i);
34  sprintf(histoTitle,"NumberOfFiredHits Plane %d",i);
35  h_numberOfFiredHits_[i]=new TH1F(histoName,histoTitle,10,0.,10.);
36  }
37 
38  for (int i=0; i<4; i++)
39  {
40  sprintf(histoName,"h_firedHits_%d",i);
41  sprintf(histoTitle,"firedHits Plane %d",i);
42  h_firedHits_[i]=new TH1F(histoName,histoTitle,64,-0.5,63.5);
43  }
44 }
int i
Definition: DBlmapReader.cc:9
void EcalTBHodoscopeRawInfoDumper::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 48 of file EcalTBHodoscopeRawInfoDumper.cc.

References f, h_firedHits_, h_numberOfFiredHits_, i, and rootfile_.

48  {
49 //========================================================================
50 
51  TFile f(rootfile_.c_str(),"RECREATE");
52 
53  for (int i=0; i<4; i++)
54  h_numberOfFiredHits_[i]->Write();
55 
56  for (int i=0; i<4; i++)
57  h_firedHits_[i]->Write();
58 
59  f.Close();
60 }
int i
Definition: DBlmapReader.cc:9
double f[11][100]

Member Data Documentation

TH1F* EcalTBHodoscopeRawInfoDumper::h_firedHits_[4]
private

Definition at line 33 of file EcalTBHodoscopeRawInfoDumper.h.

Referenced by analyze(), beginJob(), and endJob().

TH1F* EcalTBHodoscopeRawInfoDumper::h_numberOfFiredHits_[4]
private

Definition at line 32 of file EcalTBHodoscopeRawInfoDumper.h.

Referenced by analyze(), beginJob(), and endJob().

std::string EcalTBHodoscopeRawInfoDumper::rawInfoCollection_
private

Definition at line 30 of file EcalTBHodoscopeRawInfoDumper.h.

Referenced by analyze(), and EcalTBHodoscopeRawInfoDumper().

std::string EcalTBHodoscopeRawInfoDumper::rawInfoProducer_
private

Definition at line 29 of file EcalTBHodoscopeRawInfoDumper.h.

Referenced by analyze(), and EcalTBHodoscopeRawInfoDumper().

std::string EcalTBHodoscopeRawInfoDumper::rootfile_
private

Definition at line 31 of file EcalTBHodoscopeRawInfoDumper.h.

Referenced by EcalTBHodoscopeRawInfoDumper(), and endJob().