BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
HepMcParticleLink Class Reference

a link optimized in size for a GenParticle in a McEventCollection More...

#include <HepMcParticleLink.h>

Public Types

typedef unsigned int index_type
 

Public Member Functions

structors
 HepMcParticleLink ()
 
 HepMcParticleLink (index_type barCode, index_type eventIndex=0)
 
 HepMcParticleLink (const HepMC::GenParticle *p, index_type eventIndex=0)
 
 HepMcParticleLink (const HepMcParticleLink &rhs)
 
 HepMcParticleLink (const HepMC::GenParticle *part, const HepMC::GenEvent *pevt)
 
pointer interface
const HepMC::GenParticle & operator* () const
 
const HepMC::GenParticle * operator-> () const
 
 operator const HepMC::GenParticle * () const
 
bool operator! () const
 

indexing accessors (e.g. for writing)

int barcode () const
 
index_type eventIndex () const
 
bool isValid () const
 
const HepMC::GenParticle * cptr () const
 

Detailed Description

a link optimized in size for a GenParticle in a McEventCollection

See also
McEventCollection, GenEvent, ElementLink
Author
Paolo Calafiura
Id
HepMcParticleLink.h,v 1.1.1.1 2004/09/28 06:40:36 liwd Exp

Definition at line 17 of file HepMcParticleLink.h.

Member Typedef Documentation

◆ index_type

typedef unsigned int HepMcParticleLink::index_type

Definition at line 19 of file HepMcParticleLink.h.

Constructor & Destructor Documentation

◆ HepMcParticleLink() [1/5]

HepMcParticleLink::HepMcParticleLink ( )
inline

Definition at line 23 of file HepMcParticleLink.h.

23: m_particle(0), m_extBarcode() {}

◆ HepMcParticleLink() [2/5]

HepMcParticleLink::HepMcParticleLink ( index_type  barCode,
index_type  eventIndex = 0 
)
inline

Definition at line 24 of file HepMcParticleLink.h.

24 :
25 m_particle(0), m_extBarcode(barCode, eventIndex) {}

◆ HepMcParticleLink() [3/5]

HepMcParticleLink::HepMcParticleLink ( const HepMC::GenParticle *  p,
index_type  eventIndex = 0 
)

Definition at line 8 of file HepMcParticleLink.cxx.

9 :
10 m_particle(const_cast<HepMC::GenParticle*>(part)),
11 m_extBarcode((0 != part) ? part->barcode() : 0, eventIndex) {
12 assert(part);
13}

◆ HepMcParticleLink() [4/5]

HepMcParticleLink::HepMcParticleLink ( const HepMcParticleLink rhs)
inline

Definition at line 27 of file HepMcParticleLink.h.

27 :
28 m_particle(rhs.m_particle),
29 m_extBarcode(rhs.m_extBarcode) {}

◆ HepMcParticleLink() [5/5]

HepMcParticleLink::HepMcParticleLink ( const HepMC::GenParticle *  part,
const HepMC::GenEvent *  pevt 
)

Member Function Documentation

◆ barcode()

int HepMcParticleLink::barcode ( ) const
inline

Definition at line 45 of file HepMcParticleLink.h.

45{ return m_extBarcode.barcode(); }

Referenced by cptr().

◆ cptr()

const HepMC::GenParticle * HepMcParticleLink::cptr ( ) const

Definition at line 15 of file HepMcParticleLink.cxx.

15 {
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}

Referenced by isValid(), operator const HepMC::GenParticle *(), operator*(), and operator->().

◆ eventIndex()

index_type HepMcParticleLink::eventIndex ( ) const
inline

Definition at line 46 of file HepMcParticleLink.h.

46{ return m_extBarcode.eventIndex(); }

Referenced by cptr().

◆ isValid()

bool HepMcParticleLink::isValid ( ) const
inline

Definition at line 49 of file HepMcParticleLink.h.

49{ return (0 != cptr()); }

Referenced by operator!().

◆ operator const HepMC::GenParticle *()

HepMcParticleLink::operator const HepMC::GenParticle * ( ) const
inline

Definition at line 39 of file HepMcParticleLink.h.

39{ return cptr(); }

◆ operator!()

bool HepMcParticleLink::operator! ( ) const
inline

Definition at line 40 of file HepMcParticleLink.h.

40{return !isValid();}

◆ operator*()

const HepMC::GenParticle & HepMcParticleLink::operator* ( ) const
inline
Exceptions
std::runtime_errorwhen the element is not found

Definition at line 37 of file HepMcParticleLink.h.

37{ return *cptr(); }//FIXME

◆ operator->()

const HepMC::GenParticle * HepMcParticleLink::operator-> ( ) const
inline

Definition at line 38 of file HepMcParticleLink.h.

38{ return cptr(); }

The documentation for this class was generated from the following files: