CMS 3D CMS Logo

EcalGenEvtSelector.cc
Go to the documentation of this file.
1 #include <iostream>
4 using namespace std;
5 
7  partonId_ = pset.getParameter<vector<int> >("partons");
8  partonStatus_ = pset.getParameter<vector<int> >("partonStatus");
9  partonPt_ = pset.getParameter<vector<double> >("partonPt");
10 
11  particleId_ = pset.getParameter<vector<int> >("particles");
12  particleStatus_ = pset.getParameter<vector<int> >("particleStatus");
13  particlePt_ = pset.getParameter<vector<double> >("particlePt");
14 
15  etaMax_ = pset.getParameter<double>("etaMax");
16 
17  int id = partonId_.size();
18  int st = partonStatus_.size();
19  int pt = partonPt_.size();
20 
21  if (partonId_.size() != partonStatus_.size() || partonId_.size() != partonPt_.size()) {
22  throw edm::Exception(edm::errors::LogicError) << id << st << pt << endl;
23  }
24 
25  id = particleId_.size();
26  st = particleStatus_.size();
27  pt = particlePt_.size();
28 
29  if (particleId_.size() != particleStatus_.size() || particleId_.size() != particlePt_.size()) {
30  throw edm::Exception(edm::errors::LogicError) << id << st << pt << endl;
31  }
32 }
33 
35  HepMC::GenEvent::particle_const_iterator begin = evt->particles_begin();
36  HepMC::GenEvent::particle_const_iterator end = evt->particles_end();
37 
38  bool foundParticle = false;
39  bool foundParton = false;
40 
41  HepMC::GenEvent::particle_const_iterator it = begin;
42  while ((!foundParton || !foundParticle) && it != end) {
43  for (unsigned i = 0; i < partonId_.size(); ++i) {
45  foundParton = true;
46  }
47  for (unsigned i = 0; i < particleId_.size(); ++i) {
49  foundParticle = true;
50  }
51  ++it;
52  }
53 
54  return (foundParton && foundParticle);
55 }
std::vector< int > partonId_
std::vector< double > partonPt_
std::vector< int > particleStatus_
bool selectParticle(HepMC::GenParticle *par, int status, int pdg, double ptMin, double etaMax)
std::vector< int > particleId_
bool filter(HepMC::GenEvent *) override
EcalGenEvtSelector(const edm::ParameterSet &pset)
std::vector< double > particlePt_
std::vector< int > partonStatus_