CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HGCalTriggerNtupleGen Class Reference
Inheritance diagram for HGCalTriggerNtupleGen:
HGCalTriggerNtupleBase

Public Member Functions

virtual void fill (const edm::Event &, const edm::EventSetup &) override final
 
 HGCalTriggerNtupleGen (const edm::ParameterSet &)
 
virtual void initialize (TTree &, const edm::ParameterSet &, edm::ConsumesCollector &&) override final
 
- Public Member Functions inherited from HGCalTriggerNtupleBase
 HGCalTriggerNtupleBase (const edm::ParameterSet &conf)
 
virtual ~HGCalTriggerNtupleBase ()
 

Private Member Functions

virtual void clear () override final
 

Private Attributes

std::vector< float > gen_energy_
 
std::vector< float > gen_eta_
 
std::vector< int > gen_id_
 
int gen_n_
 
std::vector< float > gen_phi_
 
std::vector< float > gen_pt_
 
std::vector< int > gen_status_
 
edm::EDGetToken gen_token_
 

Additional Inherited Members

Detailed Description

Definition at line 6 of file HGCalTriggerNtupleGen.cc.

Constructor & Destructor Documentation

HGCalTriggerNtupleGen::HGCalTriggerNtupleGen ( const edm::ParameterSet conf)

Definition at line 34 of file HGCalTriggerNtupleGen.cc.

References initialize().

35 {
36 }
HGCalTriggerNtupleBase(const edm::ParameterSet &conf)

Member Function Documentation

void HGCalTriggerNtupleGen::clear ( void  )
finaloverrideprivatevirtual

Implements HGCalTriggerNtupleBase.

Definition at line 85 of file HGCalTriggerNtupleGen.cc.

References gen_energy_, gen_eta_, gen_id_, gen_n_, gen_phi_, gen_pt_, and gen_status_.

Referenced by fill().

86 {
87  gen_n_ = 0;
88  gen_id_.clear();
89  gen_status_.clear();
90  gen_energy_.clear();
91  gen_pt_.clear();
92  gen_eta_.clear();
93  gen_phi_.clear();
94 }
std::vector< int > gen_id_
std::vector< float > gen_energy_
std::vector< float > gen_eta_
std::vector< int > gen_status_
std::vector< float > gen_phi_
std::vector< float > gen_pt_
void HGCalTriggerNtupleGen::fill ( const edm::Event e,
const edm::EventSetup es 
)
finaloverridevirtual

Implements HGCalTriggerNtupleBase.

Definition at line 56 of file HGCalTriggerNtupleGen.cc.

References clear(), gen_energy_, gen_eta_, gen_id_, gen_n_, gen_phi_, gen_pt_, gen_status_, gen_token_, and edm::Event::getByToken().

Referenced by initialize().

57 {
59  e.getByToken(gen_token_, gen_particles_h);
60  const reco::GenParticleCollection& gen_particles = *gen_particles_h;
61 
62  clear();
63  gen_n_ = gen_particles.size();
64  gen_id_.reserve(gen_n_);
65  gen_status_.reserve(gen_n_);
66  gen_energy_.reserve(gen_n_);
67  gen_pt_.reserve(gen_n_);
68  gen_eta_.reserve(gen_n_);
69  gen_phi_.reserve(gen_n_);
70  for(const auto& particle : gen_particles)
71  {
72  gen_id_.emplace_back(particle.pdgId());
73  gen_status_.emplace_back(particle.status());
74  gen_energy_.emplace_back(particle.energy());
75  gen_pt_.emplace_back(particle.pt());
76  gen_eta_.emplace_back(particle.eta());
77  gen_phi_.emplace_back(particle.phi());
78  }
79 
80 }
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
std::vector< int > gen_id_
std::vector< float > gen_energy_
std::vector< float > gen_eta_
std::vector< int > gen_status_
std::vector< float > gen_phi_
virtual void clear() override final
std::vector< float > gen_pt_
void HGCalTriggerNtupleGen::initialize ( TTree &  tree,
const edm::ParameterSet conf,
edm::ConsumesCollector &&  collector 
)
finaloverridevirtual

Implements HGCalTriggerNtupleBase.

Definition at line 40 of file HGCalTriggerNtupleGen.cc.

References fill(), gen_energy_, gen_eta_, gen_id_, gen_n_, gen_phi_, gen_pt_, gen_status_, gen_token_, and edm::ParameterSet::getParameter().

Referenced by HGCalTriggerNtupleGen().

41 {
42 
43  gen_token_ = collector.consumes<reco::GenParticleCollection>(conf.getParameter<edm::InputTag>("GenParticles"));
44  tree.Branch("gen_n", &gen_n_, "gen_n/I");
45  tree.Branch("gen_id", &gen_id_);
46  tree.Branch("gen_status", &gen_status_);
47  tree.Branch("gen_energy", &gen_energy_);
48  tree.Branch("gen_pt", &gen_pt_);
49  tree.Branch("gen_eta", &gen_eta_);
50  tree.Branch("gen_phi", &gen_phi_);
51 
52 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
std::vector< int > gen_id_
std::vector< float > gen_energy_
std::vector< float > gen_eta_
std::vector< int > gen_status_
std::vector< float > gen_phi_
std::vector< float > gen_pt_
Definition: tree.py:1

Member Data Documentation

std::vector<float> HGCalTriggerNtupleGen::gen_energy_
private

Definition at line 22 of file HGCalTriggerNtupleGen.cc.

Referenced by clear(), fill(), and initialize().

std::vector<float> HGCalTriggerNtupleGen::gen_eta_
private

Definition at line 24 of file HGCalTriggerNtupleGen.cc.

Referenced by clear(), fill(), and initialize().

std::vector<int> HGCalTriggerNtupleGen::gen_id_
private

Definition at line 20 of file HGCalTriggerNtupleGen.cc.

Referenced by clear(), fill(), and initialize().

int HGCalTriggerNtupleGen::gen_n_
private

Definition at line 19 of file HGCalTriggerNtupleGen.cc.

Referenced by clear(), fill(), and initialize().

std::vector<float> HGCalTriggerNtupleGen::gen_phi_
private

Definition at line 25 of file HGCalTriggerNtupleGen.cc.

Referenced by clear(), fill(), and initialize().

std::vector<float> HGCalTriggerNtupleGen::gen_pt_
private

Definition at line 23 of file HGCalTriggerNtupleGen.cc.

Referenced by clear(), fill(), and initialize().

std::vector<int> HGCalTriggerNtupleGen::gen_status_
private

Definition at line 21 of file HGCalTriggerNtupleGen.cc.

Referenced by clear(), fill(), and initialize().

edm::EDGetToken HGCalTriggerNtupleGen::gen_token_
private

Definition at line 18 of file HGCalTriggerNtupleGen.cc.

Referenced by fill(), and initialize().