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_, Exception, edm::ParameterSet::getParameter(), hadronEtaMax_, hadronEtaMin_, hadronId_, hadronPMin_, hadronPtMax_, hadronPtMin_, hadronStatus_, edm::errors::LogicError, and ptmin.

7 {
8 
9  hadronId_ = pset.getParameter<vector<int> >("hadrons");
10  hadronStatus_ = pset.getParameter<vector<int> >("hadronStatus");
11  hadronEtaMax_ = pset.getParameter<vector<double> >("hadronEtaMax");
12  hadronEtaMin_ = pset.getParameter<vector<double> >("hadronEtaMin");
13  hadronPMin_ = pset.getParameter<vector<double> >("hadronPMin");
14  hadronPtMax_ = pset.getParameter<vector<double> >("hadronPtMax");
15  hadronPtMin_ = pset.getParameter<vector<double> >("hadronPtMin");
16 
17  decayId_ = pset.getParameter<int>("decays");
18  decayStatus_ = pset.getParameter<int>("decayStatus");
19  decayEtaMax_ = pset.getParameter<double>("decayEtaMax");
20  decayEtaMin_ = pset.getParameter<double>("decayEtaMin");
21  decayPMin_ = pset.getParameter<double>("decayPMin");
22  decayPtMax_ = pset.getParameter<double>("decayPtMax");
23  decayPtMin_ = pset.getParameter<double>("decayPtMin");
24  decayNtrig_ = pset.getParameter<int>("decayNtrig");
25 
26 
27  int id = hadronId_.size();
28  int st = hadronStatus_.size();
29  int etamax = hadronEtaMax_.size();
30  int etamin = hadronEtaMin_.size();
31  int pmin = hadronPMin_.size();
32  int ptmax = hadronPtMax_.size();
33  int ptmin = hadronPtMin_.size();
34 
35  if( id!=st || id!=etamax || id!=etamin || id!=ptmax || id!=ptmin || id!=pmin)
36  {
37  throw edm::Exception(edm::errors::LogicError)<<"Hadron selection parameters: "<<id<<st<<etamax<<etamin<<pmin<<ptmax<<ptmin<<endl;
38  }
39 
40 
41 }
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:90
HadronDecayGenEvtSelector::~HadronDecayGenEvtSelector ( )
inlineoverride

Definition at line 11 of file HadronDecayGenEvtSelector.h.

References filter().

11 {;}

Member Function Documentation

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

Reimplemented from BaseHiGenEvtSelector.

Definition at line 45 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().

46 {
47  // loop over HepMC event, and search for products of interest
48 
49  HepMC::GenEvent::particle_const_iterator begin = evt->particles_begin();
50  HepMC::GenEvent::particle_const_iterator end = evt->particles_end();
51 
52  bool foundHadron = false;
53  bool foundDecay = false;
54 
55  int foundtrig = 0;
56  HepMC::GenEvent::particle_const_iterator it = begin;
57  while( (!foundHadron || !foundDecay) && it != end )
58  {
59  for(unsigned i = 0; i < hadronId_.size(); ++i)
60  {
61  if( selectParticle(*it,
64  hadronPMin_[i],
65  hadronPtMax_[i],hadronPtMin_[i]) ) foundHadron = true;
66  }
67 
68  if( selectParticle(*it,
71  decayPMin_,
72  decayPtMax_,decayPtMin_) ) foundtrig++;
73  if(decayNtrig_ == foundtrig) foundDecay = true;
74 
75  ++it;
76  }
77 
78  return (foundHadron && foundDecay);
79 }
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 14 of file HadronDecayGenEvtSelector.h.

References funct::abs(), and ptMin.

Referenced by filter().

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

Member Data Documentation

double HadronDecayGenEvtSelector::decayEtaMax_
private

Definition at line 34 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

double HadronDecayGenEvtSelector::decayEtaMin_
private

Definition at line 35 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

int HadronDecayGenEvtSelector::decayId_
private

Definition at line 32 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

int HadronDecayGenEvtSelector::decayNtrig_
private

Definition at line 39 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

double HadronDecayGenEvtSelector::decayPMin_
private

Definition at line 36 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

double HadronDecayGenEvtSelector::decayPtMax_
private

Definition at line 37 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

double HadronDecayGenEvtSelector::decayPtMin_
private

Definition at line 38 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

int HadronDecayGenEvtSelector::decayStatus_
private

Definition at line 33 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

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

Definition at line 26 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

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

Definition at line 27 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

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

Definition at line 24 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

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

Definition at line 28 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

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

Definition at line 29 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

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

Definition at line 30 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

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

Definition at line 25 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().