#include <EcalGenEvtSelectorFrag.h>
Public Member Functions | |
EcalGenEvtSelectorFrag (const edm::ParameterSet &pset) | |
bool | filter (HepMC::GenEvent *) |
virtual | ~EcalGenEvtSelectorFrag () |
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_ |
Definition at line 7 of file EcalGenEvtSelectorFrag.h.
EcalGenEvtSelectorFrag::EcalGenEvtSelectorFrag | ( | const edm::ParameterSet & | pset | ) |
Definition at line 7 of file EcalGenEvtSelectorFrag.cc.
References etaMax_, Exception, edm::ParameterSet::getParameter(), edm::errors::LogicError, particleId_, particlePt_, particleStatus_, partonId_, partonPt_, and partonStatus_.
: BaseHiGenEvtSelector(pset){ partonId_ = pset.getParameter<vector<int> >("partons"); partonStatus_ = pset.getParameter<vector<int> >("partonStatus"); partonPt_ = pset.getParameter<vector<double> >("partonPt"); particleId_ = pset.getParameter<vector<int> >("particles"); particleStatus_ = pset.getParameter<vector<int> >("particleStatus"); particlePt_ = pset.getParameter<vector<double> >("particlePt"); etaMax_ = pset.getParameter<double>("etaMax"); int id = partonId_.size(); int st = partonStatus_.size(); int pt = partonPt_.size(); if(partonId_.size() != partonStatus_.size() || partonId_.size() != partonPt_.size()){ throw edm::Exception(edm::errors::LogicError)<<id<<st<<pt<<endl; } id = particleId_.size(); st = particleStatus_.size(); pt = particlePt_.size(); if(particleId_.size() != particleStatus_.size() || particleId_.size() != particlePt_.size()){ throw edm::Exception(edm::errors::LogicError)<<id<<st<<pt<<endl; } }
virtual EcalGenEvtSelectorFrag::~EcalGenEvtSelectorFrag | ( | ) | [inline, virtual] |
Definition at line 10 of file EcalGenEvtSelectorFrag.h.
{;}
bool EcalGenEvtSelectorFrag::filter | ( | HepMC::GenEvent * | evt | ) | [virtual] |
Reimplemented from BaseHiGenEvtSelector.
Definition at line 38 of file EcalGenEvtSelectorFrag.cc.
References begin, end, etaMax_, funct::false, i, particleId_, particlePt_, particleStatus_, BaseHiGenEvtSelector::selectParticle(), and funct::true.
{ HepMC::GenEvent::particle_const_iterator begin = evt->particles_begin(); HepMC::GenEvent::particle_const_iterator end = evt->particles_end(); bool foundParticle = false; bool foundParton = false; HepMC::GenEvent::particle_const_iterator it = begin; while((!foundParton || !foundParticle) && it != end){ bool isFrag = false; bool isThisPhoton = false; foundParton = true; /*for(unsigned i = 0; i < partonId_.size(); ++i){ if(selectParticle(*it, partonStatus_[i], partonId_[i], partonPt_[i], etaMax_)) foundParton = true; }*/ for(unsigned i = 0; i < particleId_.size(); ++i){ if(selectParticle(*it, particleStatus_[i], particleId_[i], particlePt_[i], etaMax_)) isThisPhoton =true; } // Now you have to requre the partcile is "prompt", meaning its mom is parton if ( !((*it)->production_vertex()) ) { isFrag = false; } else { const HepMC::GenVertex* productionVertex = (*it)->production_vertex(); size_t numberOfMothers = productionVertex->particles_in_size(); if ( numberOfMothers <= 0 ) { isFrag = false ; // cout << "number of mothers = " << numberOfMothers << endl; } else { // cout << "number of mothers = " << numberOfMothers << endl; HepMC::GenVertex::particles_in_const_iterator motherIt = productionVertex->particles_in_const_begin(); for( ; motherIt != productionVertex->particles_in_const_end(); motherIt++) { if ( fabs( (*motherIt)->pdg_id() ) <= 22 ) { isFrag = true; } } } } if ( (isFrag == true) && ( isThisPhoton == true) ) { //cout << "Found fragmentation photon!!" << endl ; foundParticle = true; } ++it; } foundParton = true ; // We don't care of the parton return (foundParton && foundParticle); }
double EcalGenEvtSelectorFrag::etaMax_ [private] |
Definition at line 24 of file EcalGenEvtSelectorFrag.h.
Referenced by EcalGenEvtSelectorFrag(), and filter().
std::vector<int> EcalGenEvtSelectorFrag::particleId_ [private] |
Definition at line 20 of file EcalGenEvtSelectorFrag.h.
Referenced by EcalGenEvtSelectorFrag(), and filter().
std::vector<double> EcalGenEvtSelectorFrag::particlePt_ [private] |
Definition at line 22 of file EcalGenEvtSelectorFrag.h.
Referenced by EcalGenEvtSelectorFrag(), and filter().
std::vector<int> EcalGenEvtSelectorFrag::particleStatus_ [private] |
Definition at line 21 of file EcalGenEvtSelectorFrag.h.
Referenced by EcalGenEvtSelectorFrag(), and filter().
std::vector<int> EcalGenEvtSelectorFrag::partonId_ [private] |
Definition at line 16 of file EcalGenEvtSelectorFrag.h.
Referenced by EcalGenEvtSelectorFrag().
std::vector<double> EcalGenEvtSelectorFrag::partonPt_ [private] |
Definition at line 18 of file EcalGenEvtSelectorFrag.h.
Referenced by EcalGenEvtSelectorFrag().
std::vector<int> EcalGenEvtSelectorFrag::partonStatus_ [private] |
Definition at line 17 of file EcalGenEvtSelectorFrag.h.
Referenced by EcalGenEvtSelectorFrag().