CMS 3D CMS Logo

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

#include <HadronDecayGenEvtSelector.h>

Inheritance diagram for HadronDecayGenEvtSelector:
BaseHiGenEvtSelector

Public Member Functions

bool filter (HepMC::GenEvent *) override
 
 HadronDecayGenEvtSelector (const edm::ParameterSet &pset)
 
bool selectParticle (HepMC::GenParticle *par, int status, int pdg, double etaMax, double etaMin, double pMin, double ptMax, double ptMin)
 
 ~HadronDecayGenEvtSelector () override
 
- 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 decayEtaMax_
 
double decayEtaMin_
 
int decayId_
 
int decayNtrig_
 
double decayPMin_
 
double decayPtMax_
 
double decayPtMin_
 
int decayStatus_
 
std::vector< double > hadronEtaMax_
 
std::vector< double > hadronEtaMin_
 
std::vector< int > hadronId_
 
std::vector< double > hadronPMin_
 
std::vector< double > hadronPtMax_
 
std::vector< double > hadronPtMin_
 
std::vector< int > hadronStatus_
 

Detailed Description

Definition at line 7 of file HadronDecayGenEvtSelector.h.

Constructor & Destructor Documentation

HadronDecayGenEvtSelector::HadronDecayGenEvtSelector ( const edm::ParameterSet pset)

Definition at line 6 of file HadronDecayGenEvtSelector.cc.

References decayEtaMax_, decayEtaMin_, decayId_, decayNtrig_, decayPMin_, decayPtMax_, decayPtMin_, decayStatus_, muonTiming_cfi::etamax, muonTiming_cfi::etamin, Exception, edm::ParameterSet::getParameter(), hadronEtaMax_, hadronEtaMin_, hadronId_, hadronPMin_, hadronPtMax_, hadronPtMin_, hadronStatus_, edm::errors::LogicError, muonTiming_cfi::ptmax, and ptmin.

6  : BaseHiGenEvtSelector(pset) {
7  hadronId_ = pset.getParameter<vector<int> >("hadrons");
8  hadronStatus_ = pset.getParameter<vector<int> >("hadronStatus");
9  hadronEtaMax_ = pset.getParameter<vector<double> >("hadronEtaMax");
10  hadronEtaMin_ = pset.getParameter<vector<double> >("hadronEtaMin");
11  hadronPMin_ = pset.getParameter<vector<double> >("hadronPMin");
12  hadronPtMax_ = pset.getParameter<vector<double> >("hadronPtMax");
13  hadronPtMin_ = pset.getParameter<vector<double> >("hadronPtMin");
14 
15  decayId_ = pset.getParameter<int>("decays");
16  decayStatus_ = pset.getParameter<int>("decayStatus");
17  decayEtaMax_ = pset.getParameter<double>("decayEtaMax");
18  decayEtaMin_ = pset.getParameter<double>("decayEtaMin");
19  decayPMin_ = pset.getParameter<double>("decayPMin");
20  decayPtMax_ = pset.getParameter<double>("decayPtMax");
21  decayPtMin_ = pset.getParameter<double>("decayPtMin");
22  decayNtrig_ = pset.getParameter<int>("decayNtrig");
23 
24  int id = hadronId_.size();
25  int st = hadronStatus_.size();
26  int etamax = hadronEtaMax_.size();
27  int etamin = hadronEtaMin_.size();
28  int pmin = hadronPMin_.size();
29  int ptmax = hadronPtMax_.size();
30  int ptmin = hadronPtMin_.size();
31 
32  if (id != st || id != etamax || id != etamin || id != ptmax || id != ptmin || id != pmin) {
34  << "Hadron selection parameters: " << id << st << etamax << etamin << pmin << ptmax << ptmin << endl;
35  }
36 }
T getParameter(std::string const &) const
std::vector< double > hadronEtaMax_
std::vector< double > hadronEtaMin_
std::vector< double > hadronPtMax_
BaseHiGenEvtSelector(const edm::ParameterSet &)
std::vector< double > hadronPtMin_
double ptmin
Definition: HydjetWrapper.h:84
HadronDecayGenEvtSelector::~HadronDecayGenEvtSelector ( )
inlineoverride

Definition at line 10 of file HadronDecayGenEvtSelector.h.

References filter().

10 { ; }

Member Function Documentation

bool HadronDecayGenEvtSelector::filter ( HepMC::GenEvent evt)
overridevirtual

Reimplemented from BaseHiGenEvtSelector.

Definition at line 39 of file HadronDecayGenEvtSelector.cc.

References begin, decayEtaMax_, decayEtaMin_, decayId_, decayNtrig_, decayPMin_, decayPtMax_, decayPtMin_, decayStatus_, end, hadronEtaMax_, hadronEtaMin_, hadronId_, hadronPMin_, hadronPtMax_, hadronPtMin_, hadronStatus_, mps_fire::i, and selectParticle().

Referenced by ~HadronDecayGenEvtSelector().

39  {
40  // loop over HepMC event, and search for products of interest
41 
42  HepMC::GenEvent::particle_const_iterator begin = evt->particles_begin();
43  HepMC::GenEvent::particle_const_iterator end = evt->particles_end();
44 
45  bool foundHadron = false;
46  bool foundDecay = false;
47 
48  int foundtrig = 0;
49  HepMC::GenEvent::particle_const_iterator it = begin;
50  while ((!foundHadron || !foundDecay) && it != end) {
51  for (unsigned i = 0; i < hadronId_.size(); ++i) {
52  if (selectParticle(*it,
54  hadronId_[i],
55  hadronEtaMax_[i],
56  hadronEtaMin_[i],
57  hadronPMin_[i],
58  hadronPtMax_[i],
59  hadronPtMin_[i]))
60  foundHadron = true;
61  }
62 
64  foundtrig++;
65  if (decayNtrig_ == foundtrig)
66  foundDecay = true;
67 
68  ++it;
69  }
70 
71  return (foundHadron && foundDecay);
72 }
bool selectParticle(HepMC::GenParticle *par, int status, int pdg, double etaMax, double etaMin, double pMin, double ptMax, double ptMin)
std::vector< double > hadronEtaMax_
std::vector< double > hadronEtaMin_
#define end
Definition: vmac.h:39
std::vector< double > hadronPtMax_
std::vector< double > hadronPtMin_
#define begin
Definition: vmac.h:32
bool HadronDecayGenEvtSelector::selectParticle ( HepMC::GenParticle *  par,
int  status,
int  pdg,
double  etaMax,
double  etaMin,
double  pMin,
double  ptMax,
double  ptMin 
)
inline

Definition at line 13 of file HadronDecayGenEvtSelector.h.

References funct::abs(), and ptMin.

Referenced by filter().

20  {
21  return (par->status() == status && abs(par->pdg_id()) == pdg && par->momentum().eta() < etaMax &&
22  par->momentum().eta() > etaMin && par->momentum().rho() > pMin && par->momentum().perp() < ptMax &&
23  par->momentum().perp() > ptMin);
24  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

double HadronDecayGenEvtSelector::decayEtaMax_
private

Definition at line 37 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

double HadronDecayGenEvtSelector::decayEtaMin_
private

Definition at line 38 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

int HadronDecayGenEvtSelector::decayId_
private

Definition at line 35 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

int HadronDecayGenEvtSelector::decayNtrig_
private

Definition at line 42 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

double HadronDecayGenEvtSelector::decayPMin_
private

Definition at line 39 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

double HadronDecayGenEvtSelector::decayPtMax_
private

Definition at line 40 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

double HadronDecayGenEvtSelector::decayPtMin_
private

Definition at line 41 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

int HadronDecayGenEvtSelector::decayStatus_
private

Definition at line 36 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

std::vector<double> HadronDecayGenEvtSelector::hadronEtaMax_
private

Definition at line 29 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

std::vector<double> HadronDecayGenEvtSelector::hadronEtaMin_
private

Definition at line 30 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

std::vector<int> HadronDecayGenEvtSelector::hadronId_
private

Definition at line 27 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

std::vector<double> HadronDecayGenEvtSelector::hadronPMin_
private

Definition at line 31 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

std::vector<double> HadronDecayGenEvtSelector::hadronPtMax_
private

Definition at line 32 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

std::vector<double> HadronDecayGenEvtSelector::hadronPtMin_
private

Definition at line 33 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

std::vector<int> HadronDecayGenEvtSelector::hadronStatus_
private

Definition at line 28 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().