CMS 3D CMS Logo

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

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
 EcalTBHodoscopeRawInfoDumper (const edm::ParameterSet &ps)
 
void endJob () override
 
 ~EcalTBHodoscopeRawInfoDumper () override
 
- 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
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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 ( )
override

Definition at line 19 of file EcalTBHodoscopeRawInfoDumper.cc.

19  {
20 }

Member Function Documentation

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

Definition at line 61 of file EcalTBHodoscopeRawInfoDumper.cc.

References edm::Event::getByLabel(), h_firedHits_, h_numberOfFiredHits_, mps_fire::i, edm::HandleBase::isValid(), LogDebug, edm::Handle< T >::product(), rawInfoCollection_, rawInfoProducer_, and harvestTrackValidationPlots::str.

62 {
63  // Get input
64  edm::Handle<EcalTBHodoscopeRawInfo> ecalRawHodoscope;
65  const EcalTBHodoscopeRawInfo* hodoscopeRawInfo = nullptr;
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)
bool isValid() const
Definition: HandleBase.h:74
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:464
T const * product() const
Definition: Handle.h:81
void EcalTBHodoscopeRawInfoDumper::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 24 of file EcalTBHodoscopeRawInfoDumper.cc.

References h_firedHits_, h_numberOfFiredHits_, and mps_fire::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 }
void EcalTBHodoscopeRawInfoDumper::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 47 of file EcalTBHodoscopeRawInfoDumper.cc.

References f, h_firedHits_, h_numberOfFiredHits_, mps_fire::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 }
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().