/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Generator/GenAnalysisTools/TruthHelper/TruthHelper-00-00-01/src/GenAccessIO.cxx

Go to the documentation of this file.
00001 #include "TruthHelper/GenAccessIO.h"
00002 #include <cmath> 
00003 #include <algorithm>
00004 #include "TruthHelper/GenIMCselector.h"
00005 #include "TruthHelper/GenAll.h"
00006 #include "HepMC/GenEvent.h"
00007 #include "HepMC/GenParticle.h"
00008 
00009 StatusCode GenAccessIO::getMC(MCparticleCollection& mcParticles) const {
00010   const GenIMCselector* selector = new GenAll();
00011   StatusCode stat = this->getMC(mcParticles, selector);
00012   return stat;
00013 }
00014 
00015 
00016 StatusCode GenAccessIO::getMC(MCparticleCollection& mcParticles, 
00017                               const GenIMCselector* selector) const {
00018     
00019   const McEventCollection* mcCollptr;
00020   StatusCode stat = this->getDH(mcCollptr);
00021   if(!stat){
00022     return StatusCode::FAILURE;
00023   }
00024 
00025   // Iterate over all McEvent records
00026   McEventCollection::const_iterator itr;
00027   for (itr = mcCollptr->begin(); itr!=mcCollptr->end(); ++itr) {
00028     // Access the HepMC record which is wrapped within McEvent
00029     const HepMC::GenEvent* genEvt = (*itr);
00030     if(genEvt == 0) return StatusCode::FAILURE;
00031       
00032     HepMC::GenEvent::particle_const_iterator it= genEvt->particles_begin();
00033     HepMC::GenEvent::particle_const_iterator en= genEvt->particles_end();
00034     for(; it!=en; ++it){
00035       if((*selector)(*it)){mcParticles.push_back(*it);}
00036     }
00037   }
00038     
00039   return StatusCode::SUCCESS;
00040     
00041 }

Generated on Tue Nov 29 23:12:39 2016 for BOSS_7.0.2 by  doxygen 1.4.7