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 edm::EDConsumerBase

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 17 of file EcalTBHodoscopeRawInfoDumper.h.

Constructor & Destructor Documentation

EcalTBHodoscopeRawInfoDumper::EcalTBHodoscopeRawInfoDumper ( const edm::ParameterSet ps)
explicit
EcalTBHodoscopeRawInfoDumper::~EcalTBHodoscopeRawInfoDumper ( )
virtual

Definition at line 19 of file EcalTBHodoscopeRawInfoDumper.cc.

19  {
20 }

Member Function Documentation

void EcalTBHodoscopeRawInfoDumper::analyze ( const edm::Event e,
const edm::EventSetup es 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 61 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_.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 24 of file EcalTBHodoscopeRawInfoDumper.cc.

References h_firedHits_, h_numberOfFiredHits_, and i.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 47 of file EcalTBHodoscopeRawInfoDumper.cc.

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

47  {
48 //========================================================================
49 
50  TFile f(rootfile_.c_str(),"RECREATE");
51 
52  for (int i=0; i<4; i++)
53  h_numberOfFiredHits_[i]->Write();
54 
55  for (int i=0; i<4; i++)
56  h_firedHits_[i]->Write();
57 
58  f.Close();
59 }
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().