CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 *) override
 
 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)
 
 ~PartonHadronDecayGenEvtSelector () 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_
 
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  : BaseHiGenEvtSelector(pset) {
8  hadronId_ = pset.getParameter<vector<int> >("hadrons");
9  hadronStatus_ = pset.getParameter<vector<int> >("hadronStatus");
10  hadronEtaMax_ = pset.getParameter<vector<double> >("hadronEtaMax");
11  hadronEtaMin_ = pset.getParameter<vector<double> >("hadronEtaMin");
12  hadronPMin_ = pset.getParameter<vector<double> >("hadronPMin");
13  hadronPtMax_ = pset.getParameter<vector<double> >("hadronPtMax");
14  hadronPtMin_ = pset.getParameter<vector<double> >("hadronPtMin");
15 
16  decayId_ = pset.getParameter<int>("decays");
17  decayStatus_ = pset.getParameter<int>("decayStatus");
18  decayEtaMax_ = pset.getParameter<double>("decayEtaMax");
19  decayEtaMin_ = pset.getParameter<double>("decayEtaMin");
20  decayPMin_ = pset.getParameter<double>("decayPMin");
21  decayPtMax_ = pset.getParameter<double>("decayPtMax");
22  decayPtMin_ = pset.getParameter<double>("decayPtMin");
23  decayNtrig_ = pset.getParameter<int>("decayNtrig");
24 
25  partonId_ = pset.getParameter<vector<int> >("partons");
26  partonStatus_ = pset.getParameter<vector<int> >("partonStatus");
27  partonEtaMax_ = pset.getParameter<vector<double> >("partonEtaMax");
28  partonPtMin_ = pset.getParameter<vector<double> >("partonPtMin");
29 
30  int id = hadronId_.size();
31  int st = hadronStatus_.size();
32  int etamax = hadronEtaMax_.size();
33  int etamin = hadronEtaMin_.size();
34  int pmin = hadronPMin_.size();
35  int ptmax = hadronPtMax_.size();
36  int ptmin = hadronPtMin_.size();
37 
38  if (id != st || id != etamax || id != etamin || id != ptmax || id != ptmin || id != pmin) {
40  << "Hadron selection parameters: " << id << st << etamax << etamin << pmin << ptmax << ptmin << endl;
41  }
42 
43  id = partonId_.size();
44  st = partonStatus_.size();
45  etamax = partonEtaMax_.size();
46  ptmin = partonPtMin_.size();
47 
48  if (id != st || id != etamax || id != ptmin) {
50  << "Parton selection parameters: " << id << st << etamax << ptmin << endl;
51  }
52 }
BaseHiGenEvtSelector(const edm::ParameterSet &)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
double ptmin
Definition: HydjetWrapper.h:84
PartonHadronDecayGenEvtSelector::~PartonHadronDecayGenEvtSelector ( )
inlineoverride

Definition at line 10 of file PartonHadronDecayGenEvtSelector.h.

10 { ; }

Member Function Documentation

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

Reimplemented from BaseHiGenEvtSelector.

Definition at line 55 of file PartonHadronDecayGenEvtSelector.cc.

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

55  {
56  // loop over HepMC event, and search for products of interest
57 
58  HepMC::GenEvent::particle_const_iterator begin = evt->particles_begin();
59  HepMC::GenEvent::particle_const_iterator end = evt->particles_end();
60 
61  bool foundHadron = false;
62  bool foundDecay = false;
63  bool foundParton = false;
64 
65  HepMC::GenEvent::particle_const_iterator it = begin;
66  while (!foundParton && it != end) {
67  for (unsigned i = 0; i < partonId_.size(); ++i) {
69  foundParton = true;
70  }
71  ++it;
72  }
73 
74  int foundtrig = 0;
75  HepMC::GenEvent::particle_const_iterator it2 = begin;
76 
77  if (foundParton) {
78  while ((!foundHadron || !foundDecay) && it2 != end) {
79  for (unsigned i = 0; i < hadronId_.size(); ++i) {
80  if (selectParticle(*it2,
82  hadronId_[i],
83  hadronEtaMax_[i],
84  hadronEtaMin_[i],
85  hadronPMin_[i],
86  hadronPtMax_[i],
87  hadronPtMin_[i]))
88  foundHadron = true;
89  }
90 
91  if (selectParticle(
93  foundtrig++;
94  if (decayNtrig_ == foundtrig)
95  foundDecay = true;
96 
97  ++it2;
98  }
99  }
100 
101  return (foundHadron && foundDecay && foundParton);
102 }
string end
Definition: dataset.py:937
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 13 of file PartonHadronDecayGenEvtSelector.h.

References funct::abs().

Referenced by filter().

13  {
14  return (par->status() == status && abs(par->pdg_id()) == pdg && par->momentum().perp() > ptMin &&
15  fabs(par->momentum().eta()) < etaMax);
16  }
constexpr float ptMin
list status
Definition: mps_update.py:107
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple etaMax
Definition: Puppi_cff.py:47
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 ptMin.

24  {
25  return (par->status() == status && abs(par->pdg_id()) == pdg && par->momentum().eta() < etaMax &&
26  par->momentum().eta() > etaMin && par->momentum().rho() > pMin && par->momentum().perp() < ptMax &&
27  par->momentum().perp() > ptMin);
28  }
constexpr float ptMin
list status
Definition: mps_update.py:107
tuple etaMin
Definition: Puppi_cff.py:46
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple etaMax
Definition: Puppi_cff.py:47

Member Data Documentation

double PartonHadronDecayGenEvtSelector::decayEtaMax_
private

Definition at line 46 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

double PartonHadronDecayGenEvtSelector::decayEtaMin_
private

Definition at line 47 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

int PartonHadronDecayGenEvtSelector::decayId_
private

Definition at line 44 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

int PartonHadronDecayGenEvtSelector::decayNtrig_
private

Definition at line 51 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

double PartonHadronDecayGenEvtSelector::decayPMin_
private

Definition at line 48 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

double PartonHadronDecayGenEvtSelector::decayPtMax_
private

Definition at line 49 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

double PartonHadronDecayGenEvtSelector::decayPtMin_
private

Definition at line 50 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

int PartonHadronDecayGenEvtSelector::decayStatus_
private

Definition at line 45 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 38 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 39 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 36 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 40 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 41 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 42 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 37 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 33 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 31 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 34 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

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

Definition at line 32 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().