CMS 3D CMS Logo

HadronDecayGenEvtSelector.cc
Go to the documentation of this file.
1 #include <iostream>
4 using namespace std;
5 
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 }
37 
38 //____________________________________________________________________________________________
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 }
73 
74 //____________________________________________________________________________________________
HadronDecayGenEvtSelector::hadronPtMin_
std::vector< double > hadronPtMin_
Definition: HadronDecayGenEvtSelector.h:33
mps_fire.i
i
Definition: mps_fire.py:428
HadronDecayGenEvtSelector::decayNtrig_
int decayNtrig_
Definition: HadronDecayGenEvtSelector.h:42
edm::errors::LogicError
Definition: EDMException.h:37
HadronDecayGenEvtSelector::decayPtMin_
double decayPtMin_
Definition: HadronDecayGenEvtSelector.h:41
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
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
EDMException.h
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
HadronDecayGenEvtSelector::decayId_
int decayId_
Definition: HadronDecayGenEvtSelector.h:35
HadronDecayGenEvtSelector::hadronEtaMin_
std::vector< double > hadronEtaMin_
Definition: HadronDecayGenEvtSelector.h:30
mps_fire.end
end
Definition: mps_fire.py:242
edm::ParameterSet
Definition: ParameterSet.h:47
HadronDecayGenEvtSelector::decayPMin_
double decayPMin_
Definition: HadronDecayGenEvtSelector.h:39
BaseHiGenEvtSelector
Definition: BaseHiGenEvtSelector.h:8
HadronDecayGenEvtSelector::filter
bool filter(HepMC::GenEvent *) override
Definition: HadronDecayGenEvtSelector.cc:39
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
std
Definition: JetResolutionObject.h:76
HadronDecayGenEvtSelector::decayEtaMin_
double decayEtaMin_
Definition: HadronDecayGenEvtSelector.h:38
Exception
Definition: hltDiff.cc:245
muonTiming_cfi.etamax
etamax
Definition: muonTiming_cfi.py:23
ptmin
double ptmin
Definition: HydjetWrapper.h:84
HadronDecayGenEvtSelector.h
trackingParticleMuon_cfi.pmin
pmin
Definition: trackingParticleMuon_cfi.py:10
HadronDecayGenEvtSelector::hadronId_
std::vector< int > hadronId_
Definition: HadronDecayGenEvtSelector.h:27
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
HadronDecayGenEvtSelector::HadronDecayGenEvtSelector
HadronDecayGenEvtSelector(const edm::ParameterSet &pset)
Definition: HadronDecayGenEvtSelector.cc:6