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

Definition at line 6 of file HadronDecayGenEvtSelector.cc.

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

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, muonDTDigis_cfi::pset, muonTiming_cfi::ptmax, and ptmin.

◆ ~HadronDecayGenEvtSelector()

HadronDecayGenEvtSelector::~HadronDecayGenEvtSelector ( )
inlineoverride

Definition at line 10 of file HadronDecayGenEvtSelector.h.

10 { ; }

Member Function Documentation

◆ filter()

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

Reimplemented from BaseHiGenEvtSelector.

Definition at line 39 of file HadronDecayGenEvtSelector.cc.

39  {
40  // loop over HepMC event, and search for products of interest
41 
42  HepMC::GenEvent::particle_const_iterator begin = evt->particles_begin();
43  HepMC::GenEvent::particle_const_iterator end = evt->particles_end();
44 
45  bool foundHadron = false;
46  bool foundDecay = false;
47 
48  int foundtrig = 0;
49  HepMC::GenEvent::particle_const_iterator it = begin;
50  while ((!foundHadron || !foundDecay) && it != end) {
51  for (unsigned i = 0; i < hadronId_.size(); ++i) {
52  if (selectParticle(*it,
54  hadronId_[i],
57  hadronPMin_[i],
58  hadronPtMax_[i],
59  hadronPtMin_[i]))
60  foundHadron = true;
61  }
62 
64  foundtrig++;
65  if (decayNtrig_ == foundtrig)
66  foundDecay = true;
67 
68  ++it;
69  }
70 
71  return (foundHadron && foundDecay);
72 }

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

◆ selectParticle()

bool HadronDecayGenEvtSelector::selectParticle ( HepMC::GenParticle *  par,
int  status,
int  pdg,
double  etaMax,
double  etaMin,
double  pMin,
double  ptMax,
double  ptMin 
)
inline

Definition at line 13 of file HadronDecayGenEvtSelector.h.

20  {
21  return (par->status() == status && abs(par->pdg_id()) == pdg && par->momentum().eta() < etaMax &&
22  par->momentum().eta() > etaMin && par->momentum().rho() > pMin && par->momentum().perp() < ptMax &&
23  par->momentum().perp() > ptMin);
24  }

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

Referenced by filter().

Member Data Documentation

◆ decayEtaMax_

double HadronDecayGenEvtSelector::decayEtaMax_
private

Definition at line 37 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

◆ decayEtaMin_

double HadronDecayGenEvtSelector::decayEtaMin_
private

Definition at line 38 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

◆ decayId_

int HadronDecayGenEvtSelector::decayId_
private

Definition at line 35 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

◆ decayNtrig_

int HadronDecayGenEvtSelector::decayNtrig_
private

Definition at line 42 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

◆ decayPMin_

double HadronDecayGenEvtSelector::decayPMin_
private

Definition at line 39 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

◆ decayPtMax_

double HadronDecayGenEvtSelector::decayPtMax_
private

Definition at line 40 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

◆ decayPtMin_

double HadronDecayGenEvtSelector::decayPtMin_
private

Definition at line 41 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

◆ decayStatus_

int HadronDecayGenEvtSelector::decayStatus_
private

Definition at line 36 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

◆ hadronEtaMax_

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

Definition at line 29 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

◆ hadronEtaMin_

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

Definition at line 30 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

◆ hadronId_

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

Definition at line 27 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

◆ hadronPMin_

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

Definition at line 31 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

◆ hadronPtMax_

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

Definition at line 32 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

◆ hadronPtMin_

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

Definition at line 33 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

◆ hadronStatus_

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

Definition at line 28 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

HadronDecayGenEvtSelector::hadronPtMin_
std::vector< double > hadronPtMin_
Definition: HadronDecayGenEvtSelector.h:33
ALCARECOTkAlBeamHalo_cff.etaMin
etaMin
GeV.
Definition: ALCARECOTkAlBeamHalo_cff.py:32
mps_fire.i
i
Definition: mps_fire.py:355
HadronDecayGenEvtSelector::decayNtrig_
int decayNtrig_
Definition: HadronDecayGenEvtSelector.h:42
edm::errors::LogicError
Definition: EDMException.h:37
mps_update.status
status
Definition: mps_update.py:69
HadronDecayGenEvtSelector::decayPtMin_
double decayPtMin_
Definition: HadronDecayGenEvtSelector.h:41
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:153
HadronDecayGenEvtSelector::hadronEtaMax_
std::vector< double > hadronEtaMax_
Definition: HadronDecayGenEvtSelector.h:29
HadronDecayGenEvtSelector::hadronPMin_
std::vector< double > hadronPMin_
Definition: HadronDecayGenEvtSelector.h:31
HadronDecayGenEvtSelector::decayStatus_
int decayStatus_
Definition: HadronDecayGenEvtSelector.h:36
muonTiming_cfi.etamin
etamin
Definition: muonTiming_cfi.py:30
end
#define end
Definition: vmac.h:39
HadronDecayGenEvtSelector::decayEtaMax_
double decayEtaMax_
Definition: HadronDecayGenEvtSelector.h:37
HadronDecayGenEvtSelector::selectParticle
bool selectParticle(HepMC::GenParticle *par, int status, int pdg, double etaMax, double etaMin, double pMin, double ptMax, double ptMin)
Definition: HadronDecayGenEvtSelector.h:13
BaseHiGenEvtSelector::BaseHiGenEvtSelector
BaseHiGenEvtSelector(const edm::ParameterSet &)
Definition: BaseHiGenEvtSelector.h:10
AlignmentTrackSelector_cfi.ptMax
ptMax
Definition: AlignmentTrackSelector_cfi.py:12
HadronDecayGenEvtSelector::decayId_
int decayId_
Definition: HadronDecayGenEvtSelector.h:35
HadronDecayGenEvtSelector::hadronEtaMin_
std::vector< double > hadronEtaMin_
Definition: HadronDecayGenEvtSelector.h:30
HadronDecayGenEvtSelector::decayPMin_
double decayPMin_
Definition: HadronDecayGenEvtSelector.h:39
ALCARECOTkAlMinBias_cff.pMin
pMin
GeV.
Definition: ALCARECOTkAlMinBias_cff.py:35
HadronDecayGenEvtSelector::hadronStatus_
std::vector< int > hadronStatus_
Definition: HadronDecayGenEvtSelector.h:28
HadronDecayGenEvtSelector::hadronPtMax_
std::vector< double > hadronPtMax_
Definition: HadronDecayGenEvtSelector.h:32
muonTiming_cfi.ptmax
ptmax
Definition: muonTiming_cfi.py:22
HadronDecayGenEvtSelector::decayPtMax_
double decayPtMax_
Definition: HadronDecayGenEvtSelector.h:40
HadronDecayGenEvtSelector::decayEtaMin_
double decayEtaMin_
Definition: HadronDecayGenEvtSelector.h:38
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
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HadronDecayGenEvtSelector::hadronId_
std::vector< int > hadronId_
Definition: HadronDecayGenEvtSelector.h:27
begin
#define begin
Definition: vmac.h:32
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27