Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:13:44

0001 #include <iostream>
0002 #include "GeneratorInterface/HiGenCommon/interface/MultiCandGenEvtSelector.h"
0003 
0004 MultiCandGenEvtSelector::MultiCandGenEvtSelector(const edm::ParameterSet& iConfig) : BaseHiGenEvtSelector(iConfig) {
0005   ptMin_ = iConfig.getParameter<double>("ptMin");
0006   etaMax_ = iConfig.getParameter<double>("etaMax");
0007   pdg_ = iConfig.getParameter<int>("pdg");
0008   st_ = iConfig.getParameter<int>("status");
0009   nTrig_ = iConfig.getParameter<int>("minimumCandidates");
0010 }
0011 
0012 bool MultiCandGenEvtSelector::filter(HepMC::GenEvent* evt) {
0013   std::cout << "Di Muon Fired" << std::endl;
0014 
0015   int found = 0;
0016   HepMC::GenEvent::particle_const_iterator begin = evt->particles_begin();
0017   HepMC::GenEvent::particle_const_iterator end = evt->particles_end();
0018   for (HepMC::GenEvent::particle_const_iterator it = begin; it != end; ++it) {
0019     if (selectParticle(*it, st_, pdg_, ptMin_, etaMax_))
0020       found++;
0021     if (found == nTrig_)
0022       return true;
0023   }
0024 
0025   return false;
0026 }