HepMcParticleLink Class Reference

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

#include <HepMcParticleLink.h>

List of all members.

Public Types

typedef unsigned int index_type

Public Member Functions

bool isValid () const
const HepMC::GenParticle * cptr () const
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
 
Exceptions:
std::runtime_error when the element is not found

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

Private Attributes

HepMC::GenParticle * m_particle
ExtendedBarCode m_extBarcode

Classes

class  ExtendedBarCode


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

typedef unsigned int HepMcParticleLink::index_type

Definition at line 19 of file HepMcParticleLink.h.


Constructor & Destructor Documentation

HepMcParticleLink::HepMcParticleLink (  )  [inline]

Definition at line 23 of file HepMcParticleLink.h.

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

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

Definition at line 24 of file HepMcParticleLink.h.

00024                                                                    :
00025     m_particle(0), m_extBarcode(barCode, eventIndex) {}
  HepMcParticleLink(const HepMC::GenParticle* p, index_type eventIndex = 0);

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

Definition at line 8 of file HepMcParticleLink.cxx.

00009                                                             :
00010     m_particle(const_cast<HepMC::GenParticle*>(part)), 
00011     m_extBarcode((0 != part) ? part->barcode() : 0, eventIndex) {
00012   assert(part);
00013 }

HepMcParticleLink::HepMcParticleLink ( const HepMcParticleLink rhs  )  [inline]

Definition at line 27 of file HepMcParticleLink.h.

00027                                                   : 
00028     m_particle(rhs.m_particle),
00029     m_extBarcode(rhs.m_extBarcode) {}

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


Member Function Documentation

int HepMcParticleLink::barcode (  )  const [inline]

Definition at line 45 of file HepMcParticleLink.h.

Referenced by cptr().

00045 { return m_extBarcode.barcode(); }

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

Definition at line 15 of file HepMcParticleLink.cxx.

References barcode(), eventIndex(), and m_particle.

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

00015                                                       {
00016   if (!m_particle) {
00017     const McEventCollection* pEvtColl;
00018     if ((StoreGate::instance().retrieve(pEvtColl)).isSuccess()) { //FIXME SLOW
00019       m_particle = pEvtColl->at(eventIndex())->barcode_to_particle(barcode());
00020     }
00021   }
00022   return m_particle;
00023 }

index_type HepMcParticleLink::eventIndex (  )  const [inline]

Definition at line 46 of file HepMcParticleLink.h.

Referenced by cptr().

00046 { return m_extBarcode.eventIndex(); }

bool HepMcParticleLink::isValid (  )  const [inline]

Definition at line 49 of file HepMcParticleLink.h.

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

const HepMC::GenParticle& HepMcParticleLink::operator * ( void   )  const [inline]

Exceptions:
std::runtime_error when the element is not found

Definition at line 37 of file HepMcParticleLink.h.

References cptr().

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

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

Definition at line 39 of file HepMcParticleLink.h.

References cptr().

00039 { return cptr(); }

bool HepMcParticleLink::operator! (  )  const [inline]

Definition at line 40 of file HepMcParticleLink.h.

00040 {return !isValid();}

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

Definition at line 38 of file HepMcParticleLink.h.

References cptr().

00038 { return cptr(); }


Member Data Documentation

ExtendedBarCode HepMcParticleLink::m_extBarcode [private]

Definition at line 72 of file HepMcParticleLink.h.

HepMC::GenParticle* HepMcParticleLink::m_particle [mutable, private]

Definition at line 71 of file HepMcParticleLink.h.

Referenced by cptr().


Generated on Tue Nov 29 23:19:40 2016 for BOSS_7.0.2 by  doxygen 1.4.7