BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
GenAccessIO.cxx
Go to the documentation of this file.
2#include <cmath>
3#include <algorithm>
6#include "HepMC/GenEvent.h"
7#include "HepMC/GenParticle.h"
8
9StatusCode GenAccessIO::getMC(MCparticleCollection& mcParticles) const {
10 const GenIMCselector* selector = new GenAll();
11 StatusCode stat = this->getMC(mcParticles, selector);
12 return stat;
13}
14
15
17 const GenIMCselector* selector) const {
18
19 const McEventCollection* mcCollptr;
20 StatusCode stat = this->getDH(mcCollptr);
21 if(!stat){
22 return StatusCode::FAILURE;
23 }
24
25 // Iterate over all McEvent records
26 McEventCollection::const_iterator itr;
27 for (itr = mcCollptr->begin(); itr!=mcCollptr->end(); ++itr) {
28 // Access the HepMC record which is wrapped within McEvent
29 const HepMC::GenEvent* genEvt = (*itr);
30 if(genEvt == 0) return StatusCode::FAILURE;
31
32 HepMC::GenEvent::particle_const_iterator it= genEvt->particles_begin();
33 HepMC::GenEvent::particle_const_iterator en= genEvt->particles_end();
34 for(; it!=en; ++it){
35 if((*selector)(*it)){mcParticles.push_back(*it);}
36 }
37 }
38
39 return StatusCode::SUCCESS;
40
41}
std::vector< const HepMC::GenParticle * > MCparticleCollection
Definition: GenAccessIO.h:17
StatusCode getMC(MCparticleCollection &) const
Definition: GenAccessIO.cxx:9
StatusCode getDH(const McEventCollection *&) const
Definition: GenAccessIO.h:50
Definition: GenAll.h:15