CMS 3D CMS Logo

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::PartonHadronDecayGenEvtSelector ( const edm::ParameterSet pset)

Definition at line 6 of file PartonHadronDecayGenEvtSelector.cc.

References decayEtaMax_, decayEtaMin_, decayId_, decayNtrig_, decayPMin_, decayPtMax_, decayPtMin_, decayStatus_, TrackingDataMCValidation_Standalone_cff::etamax, TrackingDataMCValidation_Standalone_cff::etamin, Exception, hadronEtaMax_, hadronEtaMin_, hadronId_, hadronPMin_, hadronPtMax_, hadronPtMin_, hadronStatus_, edm::errors::LogicError, partonEtaMax_, partonId_, partonPtMin_, partonStatus_, TrackingDataMCValidation_Standalone_cff::pmin, muonDTDigis_cfi::pset, muonTiming_cfi::ptmax, and ptmin.

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 &)
double ptmin
Definition: HydjetWrapper.h:86

◆ ~PartonHadronDecayGenEvtSelector()

PartonHadronDecayGenEvtSelector::~PartonHadronDecayGenEvtSelector ( )
inlineoverride

Definition at line 10 of file PartonHadronDecayGenEvtSelector.h.

10 { ; }

Member Function Documentation

◆ filter()

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

Reimplemented from BaseHiGenEvtSelector.

Definition at line 55 of file PartonHadronDecayGenEvtSelector.cc.

References decayEtaMax_, decayEtaMin_, decayId_, decayNtrig_, decayPMin_, decayPtMax_, decayPtMin_, decayStatus_, mps_fire::end, hadronEtaMax_, hadronEtaMin_, hadronId_, hadronPMin_, hadronPtMax_, hadronPtMin_, hadronStatus_, mps_fire::i, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, 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],
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 }
bool selectParticle(HepMC::GenParticle *par, int status, int pdg, double ptMin, double etaMax)

◆ selectParticle() [1/2]

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(), ALCARECOTkAlBeamHalo_cff::etaMax, ptMin, and mps_update::status.

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
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ selectParticle() [2/2]

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(), ALCARECOTkAlBeamHalo_cff::etaMax, ALCARECOTkAlBeamHalo_cff::etaMin, ALCARECOTkAlMinBias_cff::pMin, AlignmentTrackSelector_cfi::ptMax, ptMin, and mps_update::status.

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
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

◆ decayEtaMax_

double PartonHadronDecayGenEvtSelector::decayEtaMax_
private

Definition at line 46 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

◆ decayEtaMin_

double PartonHadronDecayGenEvtSelector::decayEtaMin_
private

Definition at line 47 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

◆ decayId_

int PartonHadronDecayGenEvtSelector::decayId_
private

Definition at line 44 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

◆ decayNtrig_

int PartonHadronDecayGenEvtSelector::decayNtrig_
private

Definition at line 51 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

◆ decayPMin_

double PartonHadronDecayGenEvtSelector::decayPMin_
private

Definition at line 48 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

◆ decayPtMax_

double PartonHadronDecayGenEvtSelector::decayPtMax_
private

Definition at line 49 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

◆ decayPtMin_

double PartonHadronDecayGenEvtSelector::decayPtMin_
private

Definition at line 50 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

◆ decayStatus_

int PartonHadronDecayGenEvtSelector::decayStatus_
private

Definition at line 45 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

◆ hadronEtaMax_

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

Definition at line 38 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

◆ hadronEtaMin_

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

Definition at line 39 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

◆ hadronId_

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

Definition at line 36 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

◆ hadronPMin_

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

Definition at line 40 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

◆ hadronPtMax_

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

Definition at line 41 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

◆ hadronPtMin_

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

Definition at line 42 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

◆ hadronStatus_

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

Definition at line 37 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

◆ partonEtaMax_

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

Definition at line 33 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

◆ partonId_

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

Definition at line 31 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

◆ partonPtMin_

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

Definition at line 34 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().

◆ partonStatus_

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

Definition at line 32 of file PartonHadronDecayGenEvtSelector.h.

Referenced by filter(), and PartonHadronDecayGenEvtSelector().