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 Member Functions | Private Attributes
HcalTB06Analysis Class Reference

#include <HcalTB06Analysis.h>

Inheritance diagram for HcalTB06Analysis:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
virtual void beginJob () override
 
virtual void endJob () override
 
 HcalTB06Analysis (const edm::ParameterSet &p)
 
virtual ~HcalTB06Analysis ()
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 Member Functions

 HcalTB06Analysis (const HcalTB06Analysis &)=delete
 
const HcalTB06Analysisoperator= (const HcalTB06Analysis &)=delete
 

Private Attributes

int count
 
bool m_ECAL
 
edm::InputTag m_EcalTag
 
double m_ener
 
double m_eta
 
double m_factEcal
 
double m_factHcal
 
edm::InputTag m_HcalTag
 
HcalTB06Histom_histo
 
std::vector< int > m_PDG
 
double m_phi
 
double m_widthEcal
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 25 of file HcalTB06Analysis.h.

Constructor & Destructor Documentation

HcalTB06Analysis::HcalTB06Analysis ( const edm::ParameterSet p)
explicit

Definition at line 43 of file HcalTB06Analysis.cc.

References edm::ParameterSet::getParameter(), m_ECAL, m_EcalTag, m_ener, m_eta, m_factEcal, m_factHcal, m_HcalTag, m_histo, m_PDG, m_phi, and m_widthEcal.

44  : count(0), m_EcalTag(edm::InputTag("g4SimHits","EcalHitsEB")),
45  m_HcalTag(edm::InputTag("g4SimHits","HcalHits"))
46 {
47  m_ECAL = p.getParameter<bool>("ECAL");
48  if(m_ECAL) {
49  consumes<edm::PCaloHitContainer>(m_EcalTag);
50  }
51  consumes<edm::PCaloHitContainer>(m_HcalTag);
52  m_eta = p.getParameter<double>("MinEta");
53  m_phi = p.getParameter<double>("MinPhi");
54  m_ener= p.getParameter<double>("MinE");
55  m_PDG = p.getParameter<std::vector<int> >("PartID");
56 
57  edm::ParameterSet ptb = p.getParameter<edm::ParameterSet>("TestBeamAnalysis");
58  m_widthEcal = ptb.getParameter<double>("EcalWidth");
59  m_factEcal = ptb.getParameter<double>("EcalFactor");
60  m_factHcal = ptb.getParameter<double>("HcalFactor");
61 
62  edm::LogInfo("HcalTB06Analysis")
63  << "Beam parameters: E(GeV)= " << m_ener
64  << " pdgID= " << m_PDG[0]
65  << " eta= " << m_eta
66  << " phi= " << m_phi
67  << "\n EcalFactor= " << m_factEcal
68  << " EcalWidth= " << m_widthEcal << " GeV"
69  << "\n HcalFactor= " << m_factHcal;
70  m_histo = new HcalTB06Histo(ptb);
71 }
T getParameter(std::string const &) const
HcalTB06Histo * m_histo
std::vector< int > m_PDG
edm::InputTag m_EcalTag
edm::InputTag m_HcalTag
HcalTB06Analysis::~HcalTB06Analysis ( )
virtual

Definition at line 73 of file HcalTB06Analysis.cc.

References m_histo.

74 {
75  delete m_histo;
76 }
HcalTB06Histo * m_histo
HcalTB06Analysis::HcalTB06Analysis ( const HcalTB06Analysis )
privatedelete

Member Function Documentation

void HcalTB06Analysis::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 89 of file HcalTB06Analysis.cc.

References count, HcalTB06Histo::fillEdep(), HcalTB06Histo::fillPrimary(), edm::Event::getByLabel(), i, LogDebug, m_ECAL, m_EcalTag, m_ener, m_eta, m_factEcal, m_factHcal, m_HcalTag, m_histo, m_phi, m_widthEcal, Vispa.Plugins.EdmBrowser.EdmDataAccessor::ne(), and edm::Handle< T >::product().

90 {
91  ++count;
92 
93  //Beam Information
95 
98 
99  const std::vector<PCaloHit>* EcalHits = nullptr;
100  if(m_ECAL) {
101  evt.getByLabel(m_EcalTag, Ecal);
102  EcalHits = Ecal.product();
103  }
104  evt.getByLabel(m_HcalTag, Hcal);
105  const std::vector<PCaloHit>* HcalHits = Hcal.product();
106 
107  // Total Energy
108  double eecals = 0.;
109  double ehcals = 0.;
110 
111  unsigned int ne = 0;
112  unsigned int nh = 0;
113 
114  if(EcalHits) {
115  ne = EcalHits->size();
116  for (unsigned int i=0; i<ne; ++i) {
117  eecals += (*EcalHits)[i].energy();
118  }
119  if(m_widthEcal > 0.0) {
120  eecals += G4RandGauss::shoot(0.0,m_widthEcal);
121  }
122  eecals *= m_factEcal;
123  }
124  if(HcalHits) {
125  nh = HcalHits->size();
126  for (unsigned int i=0; i<nh; ++i) {
127  ehcals += (*HcalHits)[i].energy();
128  }
129  ehcals *= m_factHcal;
130  }
131  double etots = eecals + ehcals;
132  LogDebug("HcalTBSim") << "HcalTB06Analysis:: Etot(MeV)= " << etots
133  << " E(Ecal)= " << eecals
134  << " E(Hcal)= " << ehcals
135  << " Nhits(ECAL)= " << ne
136  << " Nhits(HCAL)= " << nh;
137  m_histo->fillEdep(etots, eecals, ehcals);
138 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
void fillEdep(double etots, double eecals, double ehcals)
HcalTB06Histo * m_histo
T const * product() const
Definition: Handle.h:81
edm::InputTag m_EcalTag
void fillPrimary(double energy, double eta, double phi)
edm::InputTag m_HcalTag
void HcalTB06Analysis::beginJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 78 of file HcalTB06Analysis.cc.

79 {
80  edm::LogInfo("HcalTB06Analysis") <<" =====> Begin of Run";
81 }
void HcalTB06Analysis::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 83 of file HcalTB06Analysis.cc.

References count.

84 {
85  edm::LogInfo("HcalTB06Analysis")
86  << " =====> End of Run; Total number of events: " << count;
87 }
const HcalTB06Analysis& HcalTB06Analysis::operator= ( const HcalTB06Analysis )
privatedelete

Member Data Documentation

int HcalTB06Analysis::count
private

Definition at line 41 of file HcalTB06Analysis.h.

Referenced by analyze(), and endJob().

bool HcalTB06Analysis::m_ECAL
private

Definition at line 44 of file HcalTB06Analysis.h.

Referenced by analyze(), and HcalTB06Analysis().

edm::InputTag HcalTB06Analysis::m_EcalTag
private

Definition at line 42 of file HcalTB06Analysis.h.

Referenced by analyze(), and HcalTB06Analysis().

double HcalTB06Analysis::m_ener
private

Definition at line 48 of file HcalTB06Analysis.h.

Referenced by analyze(), and HcalTB06Analysis().

double HcalTB06Analysis::m_eta
private

Definition at line 46 of file HcalTB06Analysis.h.

Referenced by analyze(), and HcalTB06Analysis().

double HcalTB06Analysis::m_factEcal
private

Definition at line 50 of file HcalTB06Analysis.h.

Referenced by analyze(), and HcalTB06Analysis().

double HcalTB06Analysis::m_factHcal
private

Definition at line 51 of file HcalTB06Analysis.h.

Referenced by analyze(), and HcalTB06Analysis().

edm::InputTag HcalTB06Analysis::m_HcalTag
private

Definition at line 43 of file HcalTB06Analysis.h.

Referenced by analyze(), and HcalTB06Analysis().

HcalTB06Histo* HcalTB06Analysis::m_histo
private

Definition at line 54 of file HcalTB06Analysis.h.

Referenced by analyze(), HcalTB06Analysis(), and ~HcalTB06Analysis().

std::vector<int> HcalTB06Analysis::m_PDG
private

Definition at line 52 of file HcalTB06Analysis.h.

Referenced by HcalTB06Analysis().

double HcalTB06Analysis::m_phi
private

Definition at line 47 of file HcalTB06Analysis.h.

Referenced by analyze(), and HcalTB06Analysis().

double HcalTB06Analysis::m_widthEcal
private

Definition at line 49 of file HcalTB06Analysis.h.

Referenced by analyze(), and HcalTB06Analysis().