CMS 3D CMS Logo

Public Member Functions | Private Attributes

HadronDecayGenEvtSelector Class Reference

#include <HadronDecayGenEvtSelector.h>

Inheritance diagram for HadronDecayGenEvtSelector:
BaseHiGenEvtSelector

List of all members.

Public Member Functions

bool filter (HepMC::GenEvent *)
 HadronDecayGenEvtSelector (const edm::ParameterSet &pset)
bool selectParticle (HepMC::GenParticle *par, int status, int pdg, double etaMax, double etaMin, double pMin, double ptMax, double ptMin)
virtual ~HadronDecayGenEvtSelector ()

Private Attributes

double decayEtaMax_
double decayEtaMin_
int decayId_
int decayNtrig_
double decayPMin_
double decayPtMax_
double decayPtMin_
int decayStatus_
std::vector< double > hadronEtaMax_
std::vector< double > hadronEtaMin_
std::vector< int > hadronId_
std::vector< double > hadronPMin_
std::vector< double > hadronPtMax_
std::vector< double > hadronPtMin_
std::vector< int > hadronStatus_

Detailed Description

Definition at line 7 of file HadronDecayGenEvtSelector.h.


Constructor & Destructor Documentation

HadronDecayGenEvtSelector::HadronDecayGenEvtSelector ( const edm::ParameterSet pset)

Definition at line 6 of file HadronDecayGenEvtSelector.cc.

References decayEtaMax_, decayEtaMin_, decayId_, decayNtrig_, decayPMin_, decayPtMax_, decayPtMin_, decayStatus_, Exception, edm::ParameterSet::getParameter(), hadronEtaMax_, hadronEtaMin_, hadronId_, hadronPMin_, hadronPtMax_, hadronPtMin_, hadronStatus_, edm::errors::LogicError, and ptmin.

                                                                                : BaseHiGenEvtSelector(pset)
{

  hadronId_        = pset.getParameter<vector<int> >("hadrons");
  hadronStatus_    = pset.getParameter<vector<int> >("hadronStatus");
  hadronEtaMax_    = pset.getParameter<vector<double> >("hadronEtaMax");
  hadronEtaMin_    = pset.getParameter<vector<double> >("hadronEtaMin");
  hadronPMin_      = pset.getParameter<vector<double> >("hadronPMin");
  hadronPtMax_     = pset.getParameter<vector<double> >("hadronPtMax");
  hadronPtMin_     = pset.getParameter<vector<double> >("hadronPtMin");
  
  decayId_        = pset.getParameter<int>("decays");
  decayStatus_    = pset.getParameter<int>("decayStatus");
  decayEtaMax_    = pset.getParameter<double>("decayEtaMax");
  decayEtaMin_    = pset.getParameter<double>("decayEtaMin");
  decayPMin_      = pset.getParameter<double>("decayPMin");
  decayPtMax_     = pset.getParameter<double>("decayPtMax");
  decayPtMin_     = pset.getParameter<double>("decayPtMin");
  decayNtrig_     = pset.getParameter<int>("decayNtrig");

     
  int id     = hadronId_.size();
  int st     = hadronStatus_.size();
  int etamax = hadronEtaMax_.size();
  int etamin = hadronEtaMin_.size();
  int pmin   = hadronPMin_.size();
  int ptmax  = hadronPtMax_.size();
  int ptmin  = hadronPtMin_.size();
  
  if( id!=st || id!=etamax || id!=etamin || id!=ptmax || id!=ptmin || id!=pmin)
    {
      throw edm::Exception(edm::errors::LogicError)<<"Hadron selection parameters: "<<id<<st<<etamax<<etamin<<pmin<<ptmax<<ptmin<<endl;
    }
  

}
virtual HadronDecayGenEvtSelector::~HadronDecayGenEvtSelector ( ) [inline, virtual]

Definition at line 11 of file HadronDecayGenEvtSelector.h.

{;}

Member Function Documentation

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

Reimplemented from BaseHiGenEvtSelector.

Definition at line 45 of file HadronDecayGenEvtSelector.cc.

References begin, decayEtaMax_, decayEtaMin_, decayId_, decayNtrig_, decayPMin_, decayPtMax_, decayPtMin_, decayStatus_, end, hadronEtaMax_, hadronEtaMin_, hadronId_, hadronPMin_, hadronPtMax_, hadronPtMin_, hadronStatus_, i, and selectParticle().

{
  // loop over HepMC event, and search for  products of interest

  HepMC::GenEvent::particle_const_iterator begin = evt->particles_begin();
  HepMC::GenEvent::particle_const_iterator end   = evt->particles_end();
  
  bool foundHadron   = false;
  bool foundDecay    = false;
  
  int foundtrig = 0;
  HepMC::GenEvent::particle_const_iterator it = begin;
  while( (!foundHadron || !foundDecay) && it != end )
    {
      for(unsigned i = 0; i < hadronId_.size(); ++i)
        {
          if( selectParticle(*it, 
                             hadronStatus_[i], hadronId_[i], 
                             hadronEtaMax_[i],hadronEtaMin_[i], 
                             hadronPMin_[i],
                             hadronPtMax_[i],hadronPtMin_[i]) ) foundHadron = true;
        }
     
      if( selectParticle(*it, 
                         decayStatus_, decayId_, 
                         decayEtaMax_,decayEtaMin_, 
                         decayPMin_,
                         decayPtMax_,decayPtMin_) ) foundtrig++;
      if(decayNtrig_ == foundtrig) foundDecay = true;
      
    ++it;
    }
  
  return (foundHadron && foundDecay);
}
bool HadronDecayGenEvtSelector::selectParticle ( HepMC::GenParticle *  par,
int  status,
int  pdg,
double  etaMax,
double  etaMin,
double  pMin,
double  ptMax,
double  ptMin 
) [inline]

Definition at line 14 of file HadronDecayGenEvtSelector.h.

References abs, and PtMinSelector_cfg::ptMin.

Referenced by filter().

                                                                                                                                          {
    return (par->status() == status &&
            abs(par->pdg_id()) == pdg &&
            par->momentum().eta() < etaMax && par->momentum().eta() > etaMin &&
            par->momentum().rho() > pMin &&
            par->momentum().perp() < ptMax && par->momentum().perp() > ptMin);
  }

Member Data Documentation

Definition at line 34 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

Definition at line 35 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

Definition at line 32 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

Definition at line 39 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

Definition at line 36 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

Definition at line 37 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

Definition at line 38 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

Definition at line 33 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

std::vector<double> HadronDecayGenEvtSelector::hadronEtaMax_ [private]

Definition at line 26 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

std::vector<double> HadronDecayGenEvtSelector::hadronEtaMin_ [private]

Definition at line 27 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

std::vector<int> HadronDecayGenEvtSelector::hadronId_ [private]

Definition at line 24 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

std::vector<double> HadronDecayGenEvtSelector::hadronPMin_ [private]

Definition at line 28 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

std::vector<double> HadronDecayGenEvtSelector::hadronPtMax_ [private]

Definition at line 29 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

std::vector<double> HadronDecayGenEvtSelector::hadronPtMin_ [private]

Definition at line 30 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().

std::vector<int> HadronDecayGenEvtSelector::hadronStatus_ [private]

Definition at line 25 of file HadronDecayGenEvtSelector.h.

Referenced by filter(), and HadronDecayGenEvtSelector().