|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef GENERATOROBJECTS_HEPMCPARTICLELINK_H
6 #define GENERATOROBJECTS_HEPMCPARTICLELINK_H
19 #include "GaudiKernel/MsgStream.h"
20 #include "GaudiKernel/EventContext.h"
276 void print(std::ostream&
os)
const;
282 void print(MsgStream&
os)
const;
341 mutable std::atomic<barcode_type>
m_BC;
401 const EventContext& ctx);
435 const EventContext& ctx);
#define ATH_NO_UNIQUE_ADDRESS
HepMC::ConstGenParticlePtr scptr() const
Dereference/smart pointer.
bool linkIsNull() const
return true if neither barcode nor id are valid
bool operator==(const HepMcParticleLink &rhs) const
Equality comparison.
HepMcParticleLink(const HepMcParticleLink &rhs)=default
Copy constructor.
bool operator<(const ExtendedBarCode &rhs) const
Ordering test.
void makeIndex(index_type index, index_type position) const
Change index from position to number.
void uniqueID(barcode_type &id, barcode_type &barcode) const
Return the GenParticle id/barcode.
std::atomic< barcode_type > m_BC
Unique ID of the target particle. 0 means a null link.
constexpr static index_type UNDEFINED
All 1's. Used to represent an undefined index/position.
std::vector< Identifier > ID
void setTruthSuppressionType(EBC_SUPPRESSED_TRUTH truthSupp)
Return whether the truth particle has been suppressed.
static SG::DataProxy * find_proxy(const IProxyDict *sg)
Find the proxy for the target event collection.
barcode_type compress() const
Hash the 32 bit barcode and 16 bit eventindex into a 32bit int.
static int compareUniqueID(const HepMcParticleLink &lhs, const HepMcParticleLink &rhs)
Compare the unique ID part of two links.
std::atomic< index_type > m_evtIndex
Identifies the target GenEvent within the event collection.
HepMcParticleLink(IProxyDict *sg=nullptr)
Default constructor.
ExtendedBarCode m_extBarcode
Persistent part: barcode and location of target GenEvent.
void print(std::ostream &os) const
Dump in textual format to a stream.
EBC_SUPPRESSED_TRUTH m_truthSupp
Indicates whether the truth particle has been suppressed.
static IProxyDict * store()
Fetch the current store.
bool operator!=(const ExtendedBarCode &rhs) const
Inequality test.
friend std::ostream & operator<<(std::ostream &, const HepMcParticleLink &)
Output operator.
int barcode() const
Return the barcode of the target particle.
static int getEventNumberAtPosition(index_type position, const IProxyDict *sg)
Return the event number of the GenEvent at the specified position in the McEventCollection.
bool linkIsNull() const
return true if neither barcode nor id are valid
HepMcParticleLink & operator=(const HepMcParticleLink &rhs)=default
Assignment.
int id() const
Return the id of the target particle.
void setTruthSuppressionType(EBC_SUPPRESSED_TRUTH truthSupp)
Return whether the truth particle has been suppressed.
static int compareIndex(const HepMcParticleLink &lhs, const HepMcParticleLink &rhs)
Compare the event index part of two links.
ExtendedBarCode(const ExtendedBarCode &rhs)
Copy constructor.
static const McEventCollection * retrieveMcEventCollection(const IProxyDict *sg)
Look up the event collection we're targeting.
static char truthSuppressionTypeAsChar(EBC_SUPPRESSED_TRUTH suppEnum)
Translate truth suppression enum to a char ('a'..'b').
bool operator==(const ExtendedBarCode &rhs) const
Equality test.
bool operator!() const
Validity check.
HepMC::ConstGenParticlePtr cptr() const
Dereference.
constexpr static index_type POSITION_MASK
Flag marking that an index refers to an event position.
void setIndex(index_type idx, PositionFlag positionFlag)
Initialize the event index part of the link.
ATH_NO_UNIQUE_ADDRESS CxxUtils::CachedValue< HepMC::ConstGenParticlePtr > m_ptr
Transient part. Pointer to the particle.
a link optimized in size for a GenParticle in a McEventCollection
static std::string getLastEventCollectionName()
Return the most recent SG key used for a particular collection type.
ExtendedBarCode()
Default constructor.
const HepMC::GenParticle & operator*() const
Dereference.
bool operator==(HepMC::ConstGenParticlePtr a, const HepMcParticleLink &b)
Comparison with ConstGenParticlePtr.
void setExtendedBarCode(const ExtendedBarCode &extBarcode)
Alter the persistent part of the link.
HepMcParticleLink(barcode_type uid, uint32_t eventIndex, PositionFlag positionFlag, UniqueIDFlag uniqueIDFlag, IProxyDict *sg=SG::CurrentEventStore::store())
Constructor.
ExtendedBarCode(ExtendedBarCode &&rhs) noexcept
Move constructor.
Persistent representation of a link.
char getTruthSuppressionTypeAsChar() const
Return whether the truth particle has been suppressed, as a char ('a'..'b').
ExtendedBarCode & operator=(const ExtendedBarCode &rhs)
Assignment.
Wrapper for C++20 no_unique_address attribute.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
bool isValid() const
Validity check.
std::ostream & operator<<(std::ostream &os, const HepMcParticleLink &link)
Output operator.
HepMcParticleLink(HepMcParticleLink &&rhs) noexcept=default
Move constructor.
void makeID(barcode_type ID, barcode_type barcode) const
Change m_BC from barcode to ID.
index_type eventIndex() const
Return the event number of the referenced GenEvent.
const GenParticle * ConstGenParticlePtr
HepMcParticleLink(const HepMC::ConstGenParticlePtr &part, uint32_t eventIndex, PositionFlag positionFlag, const EventContext &ctx)
Constructor.
constexpr static barcode_type BARCODE_MASK
Flag marking that an unique ID refers to a barcode.
ExtendedBarCode(barcode_type uid, index_type eventIndex, PositionFlag isIndexEventPosition=IS_EVENTNUM, UniqueIDFlag isUniqueIDBarcode=IS_ID)
Constructor.
Cached value with atomic update.
HepMC::ConstGenParticlePtr operator->() const
Dereference.
bool operator<(const HepMcParticleLink &rhs) const
Ordering comparison.
bool operator!=(const HepMcParticleLink &rhs) const
Inequality comparison.
void setUniqueID(barcode_type uid, UniqueIDFlag barcodeFlag)
Initialize the unique identifier part of the link.
static std::vector< index_type > getEventPositionInCollection(index_type index, const IProxyDict *sg)
Return a vector of the positions in the McEventCollection of the GenEvent(s) with a given event numbe...
static HepMcParticleLink getRedirectedLink(const HepMcParticleLink &particleLink, uint32_t eventIndex, const EventContext &ctx)
Return a HepMcParticleLink pointing at the same particle, but in a different GenEvent.
EBC_SUPPRESSED_TRUTH getTruthSuppressionType() const
Return whether the truth particle has been suppressed.
IProxyDict * m_store
Pointer to the store containing the event.
EBC_SUPPRESSED_TRUTH getTruthSuppressionType() const
Return whether the truth particle has been suppressed, as an enum.
constexpr static barcode_type UNDEFINEDBC
HepMcParticleLink(const EventContext &ctx)
Default constructor.
char getTruthSuppressionTypeAsChar() const
Return whether the truth particle has been suppressed, as a char ('a'..'b').
barcode_type uid() const
Unique ID of target variable (0 for a null link).
HepMcParticleLink & operator=(HepMcParticleLink &&rhs)=default
Move Assignment.
static EBC_SUPPRESSED_TRUTH truthSuppressionTypeFromChar(char suppChar)
Translate truth suppression char ('a'..'b') to an enum.
setBGCode setTAP setLVL2ErrorBits bool
void eventIndex(index_type &index, index_type &position) const
Return the event index/position.
HepMcParticleLink(barcode_type uid, uint32_t eventIndex, PositionFlag positionFlag, UniqueIDFlag uniqueIDFlag, const EventContext &ctx)
Constructor.