![]() |
ATLAS Offline Software
|
Persistent representation of a link. More...
#include <HepMcParticleLink.h>
Public Member Functions | |
| ExtendedBarCode () | |
| Default constructor. | |
| ExtendedBarCode (barcode_type uid, index_type eventIndex, PositionFlag isIndexEventPosition=IS_EVENTNUM, UniqueIDFlag isUniqueIDBarcode=IS_ID) | |
| Constructor. | |
| ExtendedBarCode (const ExtendedBarCode &rhs) | |
| Copy constructor. | |
| ExtendedBarCode (ExtendedBarCode &&rhs) noexcept | |
| Move constructor. | |
| ExtendedBarCode & | operator= (const ExtendedBarCode &rhs) |
| Assignment. | |
| ExtendedBarCode & | operator= (ExtendedBarCode &&rhs) noexcept |
| Move Assignment. | |
| barcode_type | uid () const |
| Unique ID of target variable (0 for a null link). | |
| void | uniqueID (barcode_type &id, barcode_type &barcode) const |
| Return the GenParticle id/barcode. | |
| void | eventIndex (index_type &index, index_type &position) const |
| Return the event index/position. | |
| bool | linkIsNull () const |
| return true if neither barcode nor id are valid | |
| EBC_SUPPRESSED_TRUTH | getTruthSuppressionType () const |
| Return whether the truth particle has been suppressed. | |
| void | setTruthSuppressionType (EBC_SUPPRESSED_TRUTH truthSupp) |
| Return whether the truth particle has been suppressed. | |
| char | getTruthSuppressionTypeAsChar () const |
| Return whether the truth particle has been suppressed, as a char ('a'..'b'). | |
| bool | operator== (const ExtendedBarCode &rhs) const |
| Equality test. | |
| bool | operator!= (const ExtendedBarCode &rhs) const |
| Inequality test. | |
| bool | operator< (const ExtendedBarCode &rhs) const |
| Ordering test. | |
| void | print (std::ostream &os) const |
| Dump in textual format to a stream. | |
| void | print (MsgStream &os) const |
| Dump in textual format to a MsgStream. | |
| void | makeIndex (index_type index, index_type position) const |
| Change index from position to number. | |
| void | makeID (barcode_type ID, barcode_type barcode) const |
| Change m_BC from barcode to ID. | |
Static Public Member Functions | |
| static char | truthSuppressionTypeAsChar (EBC_SUPPRESSED_TRUTH suppEnum) |
| Translate truth suppression enum to a char ('a'..'b'). | |
| static EBC_SUPPRESSED_TRUTH | truthSuppressionTypeFromChar (char suppChar) |
| Translate truth suppression char ('a'..'b') to an enum. | |
| static int | compareIndex (const HepMcParticleLink &lhs, const HepMcParticleLink &rhs) |
| Compare the event index part of two links. | |
| static int | compareUniqueID (const HepMcParticleLink &lhs, const HepMcParticleLink &rhs) |
| Compare the unique ID part of two links. | |
Static Public Attributes | |
| static constexpr index_type | UNDEFINED = ~static_cast<index_type>(0) |
| All 1's. Used to represent an undefined index/position. | |
| static constexpr barcode_type | UNDEFINEDBC = ~static_cast<barcode_type>(0) |
Private Member Functions | |
| void | setIndex (index_type idx, PositionFlag positionFlag) |
| Initialize the event index part of the link. | |
| void | setUniqueID (barcode_type uid, UniqueIDFlag barcodeFlag) |
| Initialize the unique identifier part of the link. | |
Private Attributes | |
| std::atomic< barcode_type > | m_BC |
| Unique ID of the target particle. 0 means a null link. | |
| std::atomic< index_type > | m_evtIndex {0} |
| Identifies the target GenEvent within the event collection. | |
| EBC_SUPPRESSED_TRUTH | m_truthSupp {EBC_UNSUPPRESSED} |
| Indicates whether the truth particle has been suppressed. | |
Static Private Attributes | |
| static constexpr index_type | POSITION_MASK = UNDEFINED ^ (UNDEFINED>>1) |
| Flag marking that an index refers to an event position. | |
| static constexpr barcode_type | BARCODE_MASK = UNDEFINEDBC ^ (UNDEFINEDBC>>1) |
| Flag marking that an unique ID refers to a barcode. | |
Persistent representation of a link.
See HepMcParticleLink for details.
Definition at line 93 of file HepMcParticleLink.h.
| HepMcParticleLink::ExtendedBarCode::ExtendedBarCode | ( | ) |
| HepMcParticleLink::ExtendedBarCode::ExtendedBarCode | ( | barcode_type | uid, |
| index_type | eventIndex, | ||
| PositionFlag | isIndexEventPosition = IS_EVENTNUM, | ||
| UniqueIDFlag | isUniqueIDBarcode = IS_ID ) |
Constructor.
| uid | Unique ID of target particle. |
| eventIndex | Identifies the target GenEvent in a McEventCollection, as either the event number if isIndexEventPosition is IS_EVENTNUM, or the position in the container if isIndexEventPosition is IS_POSITION. 0 always means the first event in the collection. |
| isIndexEventPosition | See eventIndex. |
| HepMcParticleLink::ExtendedBarCode::ExtendedBarCode | ( | const ExtendedBarCode & | rhs | ) |
Copy constructor.
(Can't be defaulted due to the atomic member.)
|
noexcept |
Move constructor.
(Can't be defaulted due to the atomic member.)
|
static |
Compare the event index part of two links.
| lhs | First link to compare. |
| rhs | Second link to compare. |
The event index part of the link can be represented as either an event number or the position within the container. If necessary, the links will be normalized so that they both refer to an event number.
|
static |
Compare the unique ID part of two links.
| lhs | First link to compare. |
| rhs | Second link to compare. |
The unique ID part of the link can be represented as either a barcode or the id. If necessary, the links will be normalized so that they both refer to an id.
| void HepMcParticleLink::ExtendedBarCode::eventIndex | ( | index_type & | index, |
| index_type & | position ) const |
Return the event index/position.
The GenEvent within the McEventCollection is identified either by the GenEvent number or by the position within the collection. This method will return this by setting either index or position; the other one is set to UNDEFINED.
|
inline |
Return whether the truth particle has been suppressed.
Definition at line 182 of file HepMcParticleLink.h.
| char HepMcParticleLink::ExtendedBarCode::getTruthSuppressionTypeAsChar | ( | ) | const |
Return whether the truth particle has been suppressed, as a char ('a'..'b').
| bool HepMcParticleLink::ExtendedBarCode::linkIsNull | ( | ) | const |
return true if neither barcode nor id are valid
| void HepMcParticleLink::ExtendedBarCode::makeID | ( | barcode_type | ID, |
| barcode_type | barcode ) const |
Change m_BC from barcode to ID.
| ID | GenParticle::id value to set. |
| barcode | existing barcode value. |
If the link is currently referencing a GenParticle with barcode, update it so that it instead references the GenParticle with id value ID.
This may be called concurrently, as long as all such concurrent calls have the same arguments.
| void HepMcParticleLink::ExtendedBarCode::makeIndex | ( | index_type | index, |
| index_type | position ) const |
Change index from position to number.
| index | Event number to set. |
| position | Existing event position. |
If the link is currently referencing the GenEvent at position, update it so that it instead references the GenEvent with number index.
This may be called concurrently, as long as all such concurrent calls have the same arguments.
| bool HepMcParticleLink::ExtendedBarCode::operator!= | ( | const ExtendedBarCode & | rhs | ) | const |
Inequality test.
Be aware: if one EBC holds the target GenEvent by number and the other by position, then this will always return true, even if they reference the same GenEvent. To avoid this, use HepMcParticleLink::operator=.
| bool HepMcParticleLink::ExtendedBarCode::operator< | ( | const ExtendedBarCode & | rhs | ) | const |
Ordering test.
Be aware: if one EBC holds the target GenEvent by number and the other by position, then this will not work as expected. To avoid this, use HepMcParticleLink::operator=.
| ExtendedBarCode & HepMcParticleLink::ExtendedBarCode::operator= | ( | const ExtendedBarCode & | rhs | ) |
Assignment.
(Can't be defaulted due to the atomic member.)
|
noexcept |
Move Assignment.
(Can't be defaulted due to the atomic member.)
| bool HepMcParticleLink::ExtendedBarCode::operator== | ( | const ExtendedBarCode & | rhs | ) | const |
Equality test.
Be aware: if one EBC holds the target GenEvent by number and the other by position, then this will always return false, even if they reference the same GenEvent. To avoid this, use HepMcParticleLink::operator=.
| void HepMcParticleLink::ExtendedBarCode::print | ( | MsgStream & | os | ) | const |
Dump in textual format to a MsgStream.
Definition at line 119 of file HepMcParticleLink.cxx.
| void HepMcParticleLink::ExtendedBarCode::print | ( | std::ostream & | os | ) | const |
Dump in textual format to a stream.
Definition at line 88 of file HepMcParticleLink.cxx.
|
private |
Initialize the event index part of the link.
| idx | The index or position. |
| positionFlag | If IS_POSITION, idx represents a position in the collection; otherwise, it represents an event number. |
|
inline |
Return whether the truth particle has been suppressed.
Definition at line 188 of file HepMcParticleLink.h.
|
private |
Initialize the unique identifier part of the link.
| uid | The id or barcode. |
| barcodeFlag | If IS_BARCODE, uid represents a GenParticle barcode (deprecated); otherwise, it represents a GenParticle::id(). |
|
static |
Translate truth suppression enum to a char ('a'..'b').
Definition at line 59 of file HepMcParticleLink.cxx.
|
static |
Translate truth suppression char ('a'..'b') to an enum.
Definition at line 71 of file HepMcParticleLink.cxx.
| barcode_type HepMcParticleLink::ExtendedBarCode::uid | ( | ) | const |
Unique ID of target variable (0 for a null link).
| void HepMcParticleLink::ExtendedBarCode::uniqueID | ( | barcode_type & | id, |
| barcode_type & | barcode ) const |
Return the GenParticle id/barcode.
| id[out] | GenParticle::id, or UNDEFINEDBC. |
| barcode[out] | barcode (deprecated), or UNDEFINEDBC. |
The GenParticle within the GenEvent is identified either by the GenParticle::id or the barcode. This method will return this by setting either id or barcode; the other one is set to UNDEFINEDBC.
|
staticconstexprprivate |
Flag marking that an unique ID refers to a barcode.
Definition at line 320 of file HepMcParticleLink.h.
|
mutableprivate |
Unique ID of the target particle. 0 means a null link.
Definition at line 341 of file HepMcParticleLink.h.
|
mutableprivate |
Identifies the target GenEvent within the event collection.
If the high bit is set, then this (with the high bit clear) is a position within the collection; otherwise, it is the target GenEvent number.
Definition at line 347 of file HepMcParticleLink.h.
|
private |
Indicates whether the truth particle has been suppressed.
Definition at line 350 of file HepMcParticleLink.h.
|
staticconstexprprivate |
Flag marking that an index refers to an event position.
Definition at line 317 of file HepMcParticleLink.h.
|
staticconstexpr |
All 1's. Used to represent an undefined index/position.
Definition at line 96 of file HepMcParticleLink.h.
|
staticconstexpr |
Definition at line 97 of file HepMcParticleLink.h.