CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EcalGenEvtSelector Class Reference

#include <EcalGenEvtSelector.h>

Inheritance diagram for EcalGenEvtSelector:
BaseHiGenEvtSelector

Public Member Functions

 EcalGenEvtSelector (const edm::ParameterSet &pset)
 
bool filter (HepMC::GenEvent *)
 
virtual ~EcalGenEvtSelector ()
 
- Public Member Functions inherited from BaseHiGenEvtSelector
 BaseHiGenEvtSelector (const edm::ParameterSet &)
 
bool selectParticle (HepMC::GenParticle *par, int status, int pdg, double ptMin, double etaMax)
 
virtual ~BaseHiGenEvtSelector ()
 

Private Attributes

double etaMax_
 
std::vector< int > particleId_
 
std::vector< double > particlePt_
 
std::vector< int > particleStatus_
 
std::vector< int > partonId_
 
std::vector< double > partonPt_
 
std::vector< int > partonStatus_
 

Detailed Description

Definition at line 7 of file EcalGenEvtSelector.h.

Constructor & Destructor Documentation

EcalGenEvtSelector::EcalGenEvtSelector ( const edm::ParameterSet pset)

Definition at line 6 of file EcalGenEvtSelector.cc.

References etaMax_, Exception, edm::ParameterSet::getParameter(), edm::errors::LogicError, particleId_, particlePt_, particleStatus_, partonId_, partonPt_, partonStatus_, and EnergyCorrector::pt.

6  : BaseHiGenEvtSelector(pset){
7 
8  partonId_ = pset.getParameter<vector<int> >("partons");
9  partonStatus_ = pset.getParameter<vector<int> >("partonStatus");
10  partonPt_ = pset.getParameter<vector<double> >("partonPt");
11 
12  particleId_ = pset.getParameter<vector<int> >("particles");
13  particleStatus_ = pset.getParameter<vector<int> >("particleStatus");
14  particlePt_ = pset.getParameter<vector<double> >("particlePt");
15 
16  etaMax_ = pset.getParameter<double>("etaMax");
17 
18  int id = partonId_.size();
19  int st = partonStatus_.size();
20  int pt = partonPt_.size();
21 
22  if(partonId_.size() != partonStatus_.size() || partonId_.size() != partonPt_.size()){
23  throw edm::Exception(edm::errors::LogicError)<<id<<st<<pt<<endl;
24  }
25 
26  id = particleId_.size();
27  st = particleStatus_.size();
28  pt = particlePt_.size();
29 
30  if(particleId_.size() != particleStatus_.size() || particleId_.size() != particlePt_.size()){
31  throw edm::Exception(edm::errors::LogicError)<<id<<st<<pt<<endl;
32 
33  }
34 
35 }
std::vector< int > partonId_
T getParameter(std::string const &) const
std::vector< double > partonPt_
std::vector< int > particleStatus_
std::vector< int > particleId_
std::vector< double > particlePt_
BaseHiGenEvtSelector(const edm::ParameterSet &)
std::vector< int > partonStatus_
virtual EcalGenEvtSelector::~EcalGenEvtSelector ( )
inlinevirtual

Definition at line 10 of file EcalGenEvtSelector.h.

References filter().

10 {;}

Member Function Documentation

bool EcalGenEvtSelector::filter ( HepMC::GenEvent *  evt)
virtual

Reimplemented from BaseHiGenEvtSelector.

Definition at line 37 of file EcalGenEvtSelector.cc.

References begin, end, etaMax_, mps_fire::i, particleId_, particlePt_, particleStatus_, partonId_, partonPt_, partonStatus_, and BaseHiGenEvtSelector::selectParticle().

Referenced by ~EcalGenEvtSelector().

37  {
38  HepMC::GenEvent::particle_const_iterator begin = evt->particles_begin();
39  HepMC::GenEvent::particle_const_iterator end = evt->particles_end();
40 
41  bool foundParticle = false;
42  bool foundParton = false;
43 
44  HepMC::GenEvent::particle_const_iterator it = begin;
45  while((!foundParton || !foundParticle) && it != end){
46  for(unsigned i = 0; i < partonId_.size(); ++i){
47  if(selectParticle(*it, partonStatus_[i], partonId_[i], partonPt_[i], etaMax_)) foundParton = true;
48  }
49  for(unsigned i = 0; i < particleId_.size(); ++i){
50  if(selectParticle(*it, particleStatus_[i], particleId_[i], particlePt_[i], etaMax_)) foundParticle = true;
51  }
52  ++it;
53  }
54 
55  return (foundParton && foundParticle);
56 }
std::vector< int > partonId_
std::vector< double > partonPt_
std::vector< int > particleStatus_
bool selectParticle(HepMC::GenParticle *par, int status, int pdg, double ptMin, double etaMax)
std::vector< int > particleId_
std::vector< double > particlePt_
#define end
Definition: vmac.h:37
std::vector< int > partonStatus_
#define begin
Definition: vmac.h:30

Member Data Documentation

double EcalGenEvtSelector::etaMax_
private

Definition at line 24 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

std::vector<int> EcalGenEvtSelector::particleId_
private

Definition at line 20 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

std::vector<double> EcalGenEvtSelector::particlePt_
private

Definition at line 22 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

std::vector<int> EcalGenEvtSelector::particleStatus_
private

Definition at line 21 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

std::vector<int> EcalGenEvtSelector::partonId_
private

Definition at line 16 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

std::vector<double> EcalGenEvtSelector::partonPt_
private

Definition at line 18 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

std::vector<int> EcalGenEvtSelector::partonStatus_
private

Definition at line 17 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().