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 }
mps_fire.i
i
Definition: mps_fire.py:355
edm::errors::LogicError
Definition: EDMException.h:37
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
EcalGenEvtSelector::particleId_
std::vector< int > particleId_
Definition: EcalGenEvtSelector.h:19
end
#define end
Definition: vmac.h:39
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
EDMException.h
BaseHiGenEvtSelector::selectParticle
bool selectParticle(HepMC::GenParticle *par, int status, int pdg, double ptMin, double etaMax)
Definition: BaseHiGenEvtSelector.h:13
EcalGenEvtSelector::partonId_
std::vector< int > partonId_
Definition: EcalGenEvtSelector.h:15
EcalGenEvtSelector::etaMax_
double etaMax_
Definition: EcalGenEvtSelector.h:23
EcalGenEvtSelector::partonPt_
std::vector< double > partonPt_
Definition: EcalGenEvtSelector.h:17
edm::ParameterSet
Definition: ParameterSet.h:36
BaseHiGenEvtSelector
Definition: BaseHiGenEvtSelector.h:8
EcalGenEvtSelector::partonStatus_
std::vector< int > partonStatus_
Definition: EcalGenEvtSelector.h:16
EcalGenEvtSelector.h
std
Definition: JetResolutionObject.h:76
Exception
Definition: hltDiff.cc:246
EcalGenEvtSelector::EcalGenEvtSelector
EcalGenEvtSelector(const edm::ParameterSet &pset)
Definition: EcalGenEvtSelector.cc:6
EcalGenEvtSelector::filter
bool filter(HepMC::GenEvent *) override
Definition: EcalGenEvtSelector.cc:34
EcalGenEvtSelector::particlePt_
std::vector< double > particlePt_
Definition: EcalGenEvtSelector.h:21
begin
#define begin
Definition: vmac.h:32
EcalGenEvtSelector::particleStatus_
std::vector< int > particleStatus_
Definition: EcalGenEvtSelector.h:20
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27