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.

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

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 }
std::vector< int > partonId_
std::vector< double > partonPt_
std::vector< int > particleStatus_
std::vector< int > particleId_
std::vector< double > particlePt_
BaseHiGenEvtSelector(const edm::ParameterSet &)
std::vector< int > partonStatus_

◆ ~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.

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

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 }
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_
std::vector< double > particlePt_
std::vector< int > partonStatus_

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().