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 etaMax, double etaMin, double pMin, double ptMax, double ptMin)
 
bool selectParticle (HepMC::GenParticle *par, int status, int pdg, double ptMin, double etaMax)
 
 ~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.

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 }

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

◆ ~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.

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 }

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

◆ selectParticle() [1/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.

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  }

References funct::abs(), ALCARECOTkAlBeamHalo_cff::etaMax, ALCARECOTkAlBeamHalo_cff::etaMin, ALCARECOTkAlMinBias_cff::pMin, AlignmentTrackSelector_cfi::ptMax, ptMin, and mps_update::status.

◆ selectParticle() [2/2]

bool PartonHadronDecayGenEvtSelector::selectParticle ( HepMC::GenParticle *  par,
int  status,
int  pdg,
double  ptMin,
double  etaMax 
)
inline

Definition at line 13 of file PartonHadronDecayGenEvtSelector.h.

13  {
14  return (par->status() == status && abs(par->pdg_id()) == pdg && par->momentum().perp() > ptMin &&
15  fabs(par->momentum().eta()) < etaMax);
16  }

References funct::abs(), ALCARECOTkAlBeamHalo_cff::etaMax, ptMin, and mps_update::status.

Referenced by filter().

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().

PartonHadronDecayGenEvtSelector::hadronStatus_
std::vector< int > hadronStatus_
Definition: PartonHadronDecayGenEvtSelector.h:37
PartonHadronDecayGenEvtSelector::hadronEtaMin_
std::vector< double > hadronEtaMin_
Definition: PartonHadronDecayGenEvtSelector.h:39
PartonHadronDecayGenEvtSelector::hadronId_
std::vector< int > hadronId_
Definition: PartonHadronDecayGenEvtSelector.h:36
ALCARECOTkAlBeamHalo_cff.etaMin
etaMin
GeV.
Definition: ALCARECOTkAlBeamHalo_cff.py:32
mps_fire.i
i
Definition: mps_fire.py:355
PartonHadronDecayGenEvtSelector::partonPtMin_
std::vector< double > partonPtMin_
Definition: PartonHadronDecayGenEvtSelector.h:34
PartonHadronDecayGenEvtSelector::hadronPtMax_
std::vector< double > hadronPtMax_
Definition: PartonHadronDecayGenEvtSelector.h:41
PartonHadronDecayGenEvtSelector::decayEtaMax_
double decayEtaMax_
Definition: PartonHadronDecayGenEvtSelector.h:46
edm::errors::LogicError
Definition: EDMException.h:37
mps_update.status
status
Definition: mps_update.py:69
PartonHadronDecayGenEvtSelector::selectParticle
bool selectParticle(HepMC::GenParticle *par, int status, int pdg, double ptMin, double etaMax)
Definition: PartonHadronDecayGenEvtSelector.h:13
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:153
PartonHadronDecayGenEvtSelector::decayPtMax_
double decayPtMax_
Definition: PartonHadronDecayGenEvtSelector.h:49
PartonHadronDecayGenEvtSelector::hadronPMin_
std::vector< double > hadronPMin_
Definition: PartonHadronDecayGenEvtSelector.h:40
PartonHadronDecayGenEvtSelector::decayId_
int decayId_
Definition: PartonHadronDecayGenEvtSelector.h:44
muonTiming_cfi.etamin
etamin
Definition: muonTiming_cfi.py:30
end
#define end
Definition: vmac.h:39
PartonHadronDecayGenEvtSelector::decayPMin_
double decayPMin_
Definition: PartonHadronDecayGenEvtSelector.h:48
PartonHadronDecayGenEvtSelector::decayEtaMin_
double decayEtaMin_
Definition: PartonHadronDecayGenEvtSelector.h:47
BaseHiGenEvtSelector::BaseHiGenEvtSelector
BaseHiGenEvtSelector(const edm::ParameterSet &)
Definition: BaseHiGenEvtSelector.h:10
AlignmentTrackSelector_cfi.ptMax
ptMax
Definition: AlignmentTrackSelector_cfi.py:12
PartonHadronDecayGenEvtSelector::decayNtrig_
int decayNtrig_
Definition: PartonHadronDecayGenEvtSelector.h:51
ALCARECOTkAlMinBias_cff.pMin
pMin
GeV.
Definition: ALCARECOTkAlMinBias_cff.py:35
PartonHadronDecayGenEvtSelector::partonId_
std::vector< int > partonId_
Definition: PartonHadronDecayGenEvtSelector.h:31
PartonHadronDecayGenEvtSelector::decayPtMin_
double decayPtMin_
Definition: PartonHadronDecayGenEvtSelector.h:50
PartonHadronDecayGenEvtSelector::partonStatus_
std::vector< int > partonStatus_
Definition: PartonHadronDecayGenEvtSelector.h:32
PartonHadronDecayGenEvtSelector::decayStatus_
int decayStatus_
Definition: PartonHadronDecayGenEvtSelector.h:45
muonTiming_cfi.ptmax
ptmax
Definition: muonTiming_cfi.py:22
PartonHadronDecayGenEvtSelector::hadronEtaMax_
std::vector< double > hadronEtaMax_
Definition: PartonHadronDecayGenEvtSelector.h:38
PartonHadronDecayGenEvtSelector::partonEtaMax_
std::vector< double > partonEtaMax_
Definition: PartonHadronDecayGenEvtSelector.h:33
Exception
Definition: hltDiff.cc:246
muonTiming_cfi.etamax
etamax
Definition: muonTiming_cfi.py:23
ALCARECOTkAlBeamHalo_cff.etaMax
etaMax
Definition: ALCARECOTkAlBeamHalo_cff.py:33
ptmin
double ptmin
Definition: HydjetWrapper.h:84
pdg
Definition: pdg_functions.h:28
PartonHadronDecayGenEvtSelector::hadronPtMin_
std::vector< double > hadronPtMin_
Definition: PartonHadronDecayGenEvtSelector.h:42
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
begin
#define begin
Definition: vmac.h:32
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27