CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EcalGenEvtSelector Class Reference

#include <EcalGenEvtSelector.h>

Inheritance diagram for EcalGenEvtSelector:
BaseHiGenEvtSelector

Public Member Functions

 EcalGenEvtSelector (const edm::ParameterSet &pset)
 
bool filter (HepMC::GenEvent *) override
 
 ~EcalGenEvtSelector () 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 etaMax_
 
std::vector< int > particleId_
 
std::vector< double > particlePt_
 
std::vector< int > particleStatus_
 
std::vector< int > partonId_
 
std::vector< double > partonPt_
 
std::vector< int > partonStatus_
 

Detailed Description

Definition at line 7 of file EcalGenEvtSelector.h.

Constructor & Destructor Documentation

◆ EcalGenEvtSelector()

EcalGenEvtSelector::EcalGenEvtSelector ( const edm::ParameterSet pset)

Definition at line 6 of file EcalGenEvtSelector.cc.

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 }

References etaMax_, Exception, edm::errors::LogicError, particleId_, particlePt_, particleStatus_, partonId_, partonPt_, partonStatus_, muonDTDigis_cfi::pset, and DiDispStaMuonMonitor_cfi::pt.

◆ ~EcalGenEvtSelector()

EcalGenEvtSelector::~EcalGenEvtSelector ( )
inlineoverride

Definition at line 10 of file EcalGenEvtSelector.h.

10 { ; }

Member Function Documentation

◆ filter()

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

Reimplemented from BaseHiGenEvtSelector.

Definition at line 34 of file EcalGenEvtSelector.cc.

34  {
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 }

References begin, end, etaMax_, mps_fire::i, particleId_, particlePt_, particleStatus_, partonId_, partonPt_, partonStatus_, and BaseHiGenEvtSelector::selectParticle().

Member Data Documentation

◆ etaMax_

double EcalGenEvtSelector::etaMax_
private

Definition at line 23 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

◆ particleId_

std::vector<int> EcalGenEvtSelector::particleId_
private

Definition at line 19 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

◆ particlePt_

std::vector<double> EcalGenEvtSelector::particlePt_
private

Definition at line 21 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

◆ particleStatus_

std::vector<int> EcalGenEvtSelector::particleStatus_
private

Definition at line 20 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

◆ partonId_

std::vector<int> EcalGenEvtSelector::partonId_
private

Definition at line 15 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

◆ partonPt_

std::vector<double> EcalGenEvtSelector::partonPt_
private

Definition at line 17 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

◆ partonStatus_

std::vector<int> EcalGenEvtSelector::partonStatus_
private

Definition at line 16 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

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
BaseHiGenEvtSelector::BaseHiGenEvtSelector
BaseHiGenEvtSelector(const edm::ParameterSet &)
Definition: BaseHiGenEvtSelector.h:10
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
EcalGenEvtSelector::partonStatus_
std::vector< int > partonStatus_
Definition: EcalGenEvtSelector.h:16
Exception
Definition: hltDiff.cc:246
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