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 Attributes
PartonHadronDecayGenEvtSelector Class Reference

#include <PartonHadronDecayGenEvtSelector.h>

Inheritance diagram for PartonHadronDecayGenEvtSelector:
BaseHiGenEvtSelector

Public Member Functions

bool filter (HepMC::GenEvent *)
 
 PartonHadronDecayGenEvtSelector (const edm::ParameterSet &pset)
 
bool selectParticle (HepMC::GenParticle *par, int status, int pdg, double ptMin, double etaMax)
 
bool selectParticle (HepMC::GenParticle *par, int status, int pdg, double etaMax, double etaMin, double pMin, double ptMax, double ptMin)
 
virtual ~PartonHadronDecayGenEvtSelector ()
 
- 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_
 
std::vector< double > partonEtaMax_
 
std::vector< int > partonId_
 
std::vector< double > partonPtMin_
 
std::vector< int > partonStatus_
 

Detailed Description

Definition at line 7 of file PartonHadronDecayGenEvtSelector.h.

Constructor & Destructor Documentation

PartonHadronDecayGenEvtSelector::PartonHadronDecayGenEvtSelector ( const edm::ParameterSet pset)

Definition at line 6 of file PartonHadronDecayGenEvtSelector.cc.

References decayEtaMax_, decayEtaMin_, decayId_, decayNtrig_, decayPMin_, decayPtMax_, decayPtMin_, decayStatus_, Exception, edm::ParameterSet::getParameter(), hadronEtaMax_, hadronEtaMin_, hadronId_, hadronPMin_, hadronPtMax_, hadronPtMin_, hadronStatus_, edm::errors::LogicError, partonEtaMax_, partonId_, partonPtMin_, partonStatus_, 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  partonId_ = pset.getParameter<vector<int> >("partons");
27  partonStatus_ = pset.getParameter<vector<int> >("partonStatus");
28  partonEtaMax_ = pset.getParameter<vector<double> >("partonEtaMax");
29  partonPtMin_ = pset.getParameter<vector<double> >("partonPtMin");
30 
31  int id = hadronId_.size();
32  int st = hadronStatus_.size();
33  int etamax = hadronEtaMax_.size();
34  int etamin = hadronEtaMin_.size();
35  int pmin = hadronPMin_.size();
36  int ptmax = hadronPtMax_.size();
37  int ptmin = hadronPtMin_.size();
38 
39  if( id!=st || id!=etamax || id!=etamin || id!=ptmax || id!=ptmin || id!=pmin)
40  {
41  throw edm::Exception(edm::errors::LogicError)<<"Hadron selection parameters: "<<id<<st<<etamax<<etamin<<pmin<<ptmax<<ptmin<<endl;
42  }
43 
44 
45  id = partonId_.size();
46  st = partonStatus_.size();
47  etamax = partonEtaMax_.size();
48  ptmin = partonPtMin_.size();
49 
50  if( id!=st || id!=etamax || id!=ptmin )
51  {
52  throw edm::Exception(edm::errors::LogicError)<<"Parton selection parameters: "<<id<<st<<etamax<<ptmin<<endl;
53  }
54 
55 }
T getParameter(std::string const &) const
BaseHiGenEvtSelector(const edm::ParameterSet &)
double ptmin
Definition: HydjetWrapper.h:90
virtual PartonHadronDecayGenEvtSelector::~PartonHadronDecayGenEvtSelector ( )
inlinevirtual

Definition at line 11 of file PartonHadronDecayGenEvtSelector.h.

11 {;}

Member Function Documentation

bool PartonHadronDecayGenEvtSelector::filter ( HepMC::GenEvent evt)
virtual

Reimplemented from BaseHiGenEvtSelector.

Definition at line 59 of file PartonHadronDecayGenEvtSelector.cc.

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

60 {
61  // loop over HepMC event, and search for products of interest
62 
63  HepMC::GenEvent::particle_const_iterator begin = evt->particles_begin();
64  HepMC::GenEvent::particle_const_iterator end = evt->particles_end();
65 
66  bool foundHadron = false;
67  bool foundDecay = false;
68  bool foundParton = false;
69 
70  HepMC::GenEvent::particle_const_iterator it = begin;
71  while( !foundParton && it != end )
72  {
73  for(unsigned i = 0; i < partonId_.size(); ++i)
74  {
75  if( selectParticle(*it,
77  partonPtMin_[i],partonEtaMax_[i]) ) foundParton = true;
78  }
79  ++it;
80  }
81 
82  int foundtrig = 0;
83  HepMC::GenEvent::particle_const_iterator it2 = begin;
84 
85  if(foundParton)
86  {
87  while( (!foundHadron || !foundDecay) && it2 != end )
88  {
89 
90  for(unsigned i = 0; i < hadronId_.size(); ++i)
91  {
92  if( selectParticle(*it2,
95  hadronPMin_[i],
96  hadronPtMax_[i],hadronPtMin_[i]) ) foundHadron = true;
97  }
98 
99  if( selectParticle(*it2,
102  decayPMin_,
103  decayPtMax_,decayPtMin_) ) foundtrig++;
104  if(decayNtrig_ == foundtrig) foundDecay = true;
105 
106  ++it2;
107  }
108  }
109 
110  return (foundHadron && foundDecay && foundParton);
111 }
int i
Definition: DBlmapReader.cc:9
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
bool selectParticle(HepMC::GenParticle *par, int status, int pdg, double ptMin, double etaMax)
bool PartonHadronDecayGenEvtSelector::selectParticle ( HepMC::GenParticle *  par,
int  status,
int  pdg,
double  ptMin,
double  etaMax 
)
inline

Definition at line 14 of file PartonHadronDecayGenEvtSelector.h.

References funct::abs().

Referenced by filter().

14  {
15  return (par->status() == status && abs(par->pdg_id()) == pdg && par->momentum().perp() > ptMin && fabs(par->momentum().eta()) < etaMax);
16  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple status
Definition: mps_update.py:57
bool PartonHadronDecayGenEvtSelector::selectParticle ( HepMC::GenParticle *  par,
int  status,
int  pdg,
double  etaMax,
double  etaMin,
double  pMin,
double  ptMax,
double  ptMin 
)
inline

Definition at line 17 of file PartonHadronDecayGenEvtSelector.h.

References funct::abs(), and PtMinSelector_cfg::ptMin.

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

Member Data Documentation

double PartonHadronDecayGenEvtSelector::decayEtaMax_
private

Definition at line 42 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

double PartonHadronDecayGenEvtSelector::decayEtaMin_
private

Definition at line 43 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

int PartonHadronDecayGenEvtSelector::decayId_
private

Definition at line 40 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

int PartonHadronDecayGenEvtSelector::decayNtrig_
private

Definition at line 47 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

double PartonHadronDecayGenEvtSelector::decayPMin_
private

Definition at line 44 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

double PartonHadronDecayGenEvtSelector::decayPtMax_
private

Definition at line 45 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

double PartonHadronDecayGenEvtSelector::decayPtMin_
private

Definition at line 46 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

int PartonHadronDecayGenEvtSelector::decayStatus_
private

Definition at line 41 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 34 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 35 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 32 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 36 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 37 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 38 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 33 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

std::vector<double> PartonHadronDecayGenEvtSelector::partonEtaMax_
private

Definition at line 29 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 27 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

std::vector<double> PartonHadronDecayGenEvtSelector::partonPtMin_
private

Definition at line 30 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 28 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().