BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
HepMcParticleLink.cxx
Go to the documentation of this file.
3#include "StoreGate/StoreGate.h"
4#include "CLHEP/HepMC/GenParticle.h"
5#include "CLHEP/HepMC/GenEvent.h"
6#include <cassert>
7
8HepMcParticleLink::HepMcParticleLink(const HepMC::GenParticle* part,
9 index_type eventIndex) :
10 m_particle(const_cast<HepMC::GenParticle*>(part)),
11 m_extBarcode((0 != part) ? part->barcode() : 0, eventIndex) {
12 assert(part);
13}
14
15const HepMC::GenParticle* HepMcParticleLink::cptr() const {
16 if (!m_particle) {
17 const McEventCollection* pEvtColl;
18 if ((StoreGate::instance().retrieve(pEvtColl)).isSuccess()) { //FIXME SLOW
19 m_particle = pEvtColl->at(eventIndex())->barcode_to_particle(barcode());
20 }
21 }
22 return m_particle;
23}