CMS 3D CMS Logo

PartonHadronDecayGenEvtSelector.cc
Go to the documentation of this file.
1 #include <iostream>
4 using namespace std;
5 
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 }
53 
54 //____________________________________________________________________________________________
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 }
103 
104 //____________________________________________________________________________________________
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
mps_fire.i
i
Definition: mps_fire.py:428
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
PartonHadronDecayGenEvtSelector::selectParticle
bool selectParticle(HepMC::GenParticle *par, int status, int pdg, double ptMin, double etaMax)
Definition: PartonHadronDecayGenEvtSelector.h:13
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
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
EDMException.h
PartonHadronDecayGenEvtSelector::decayPMin_
double decayPMin_
Definition: PartonHadronDecayGenEvtSelector.h:48
PartonHadronDecayGenEvtSelector::decayEtaMin_
double decayEtaMin_
Definition: PartonHadronDecayGenEvtSelector.h:47
mps_fire.end
end
Definition: mps_fire.py:242
PartonHadronDecayGenEvtSelector::decayNtrig_
int decayNtrig_
Definition: PartonHadronDecayGenEvtSelector.h:51
edm::ParameterSet
Definition: ParameterSet.h:47
BaseHiGenEvtSelector
Definition: BaseHiGenEvtSelector.h:8
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
std
Definition: JetResolutionObject.h:76
PartonHadronDecayGenEvtSelector::hadronEtaMax_
std::vector< double > hadronEtaMax_
Definition: PartonHadronDecayGenEvtSelector.h:38
PartonHadronDecayGenEvtSelector::partonEtaMax_
std::vector< double > partonEtaMax_
Definition: PartonHadronDecayGenEvtSelector.h:33
Exception
Definition: hltDiff.cc:245
muonTiming_cfi.etamax
etamax
Definition: muonTiming_cfi.py:23
PartonHadronDecayGenEvtSelector.h
ptmin
double ptmin
Definition: HydjetWrapper.h:84
PartonHadronDecayGenEvtSelector::hadronPtMin_
std::vector< double > hadronPtMin_
Definition: PartonHadronDecayGenEvtSelector.h:42
PartonHadronDecayGenEvtSelector::filter
bool filter(HepMC::GenEvent *) override
Definition: PartonHadronDecayGenEvtSelector.cc:55
PartonHadronDecayGenEvtSelector::PartonHadronDecayGenEvtSelector
PartonHadronDecayGenEvtSelector(const edm::ParameterSet &pset)
Definition: PartonHadronDecayGenEvtSelector.cc:6
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27