CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/GeneratorInterface/HiGenCommon/src/MultiCandGenEvtSelector.cc

Go to the documentation of this file.
00001 #include <iostream>
00002 #include "GeneratorInterface/HiGenCommon/interface/MultiCandGenEvtSelector.h"
00003 
00004 MultiCandGenEvtSelector::MultiCandGenEvtSelector(const edm::ParameterSet& iConfig)
00005    : BaseHiGenEvtSelector(iConfig)
00006 {
00007    ptMin_ = iConfig.getParameter<double>("ptMin");
00008    etaMax_ = iConfig.getParameter<double>("etaMax");
00009    pdg_ = iConfig.getParameter<int>("pdg");
00010    st_ = iConfig.getParameter<int>("status");
00011    nTrig_ = iConfig.getParameter<int>("minimumCandidates");
00012 }
00013 
00014 bool MultiCandGenEvtSelector::filter(HepMC::GenEvent * evt){
00015    std::cout<<"Di Muon Fired"<<std::endl;
00016    
00017    int found = 0;
00018    HepMC::GenEvent::particle_const_iterator begin = evt->particles_begin();
00019    HepMC::GenEvent::particle_const_iterator end = evt->particles_end();
00020    for(HepMC::GenEvent::particle_const_iterator it = begin; it != end; ++it){
00021       if(selectParticle(*it, st_, pdg_, ptMin_, etaMax_)) found++;
00022       if(found == nTrig_) return true;      
00023    }
00024    
00025    return false;
00026 }