CMS 3D CMS Logo

Public Member Functions | Private Attributes

EcalGenEvtSelector Class Reference

#include <EcalGenEvtSelector.h>

Inheritance diagram for EcalGenEvtSelector:
BaseHiGenEvtSelector

List of all members.

Public Member Functions

 EcalGenEvtSelector (const edm::ParameterSet &pset)
bool filter (HepMC::GenEvent *)
virtual ~EcalGenEvtSelector ()

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 ( const edm::ParameterSet pset)

Definition at line 6 of file EcalGenEvtSelector.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 EcalGenEvtSelector::~EcalGenEvtSelector ( ) [inline, virtual]

Definition at line 10 of file EcalGenEvtSelector.h.

{;}

Member Function Documentation

bool EcalGenEvtSelector::filter ( HepMC::GenEvent *  evt) [virtual]

Reimplemented from BaseHiGenEvtSelector.

Definition at line 37 of file EcalGenEvtSelector.cc.

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

                                                 {
   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){
      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_)) foundParticle = true;
      }
      ++it;
   }

   return (foundParton && foundParticle);
}

Member Data Documentation

double EcalGenEvtSelector::etaMax_ [private]

Definition at line 24 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

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

Definition at line 20 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

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

Definition at line 22 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

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

Definition at line 21 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

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

Definition at line 16 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

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

Definition at line 18 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().

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

Definition at line 17 of file EcalGenEvtSelector.h.

Referenced by EcalGenEvtSelector(), and filter().