Persistent representation of a link.
More...
#include <HepMcParticleLink.h>
Persistent representation of a link.
See HepMcParticleLink
for details.
Definition at line 93 of file HepMcParticleLink.h.
◆ ExtendedBarCode() [1/4]
HepMcParticleLink::ExtendedBarCode::ExtendedBarCode |
( |
| ) |
|
Default constructor.
Makes a null link (unique ID 0).
◆ ExtendedBarCode() [2/4]
Constructor.
- Parameters
-
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 . |
◆ ExtendedBarCode() [3/4]
Copy constructor.
(Can't be defaulted due to the atomic member.)
◆ ExtendedBarCode() [4/4]
HepMcParticleLink::ExtendedBarCode::ExtendedBarCode |
( |
ExtendedBarCode && |
rhs | ) |
|
|
noexcept |
Move constructor.
(Can't be defaulted due to the atomic member.)
◆ compareIndex()
Compare the event index part of two links.
- Parameters
-
lhs | First link to compare. |
rhs | Second link to compare. |
- Returns
- -1, 0, or 1, depending on the result of the comparison.
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.
◆ compareUniqueID()
Compare the unique ID part of two links.
- Parameters
-
lhs | First link to compare. |
rhs | Second link to compare. |
- Returns
- -1, 0, or 1, depending on the result of the comparison.
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.
◆ eventIndex()
void HepMcParticleLink::ExtendedBarCode::eventIndex |
( |
index_type & |
index, |
|
|
index_type & |
position |
|
) |
| const |
Return the event index/position.
- Parameters
-
index[out] | Event index (number), or UNDEFINED . |
position[out] | Event position, or UNDEFINED . |
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
.
◆ getTruthSuppressionType()
◆ getTruthSuppressionTypeAsChar()
char HepMcParticleLink::ExtendedBarCode::getTruthSuppressionTypeAsChar |
( |
| ) |
const |
Return whether the truth particle has been suppressed, as a char ('a'..'b').
◆ linkIsNull()
bool HepMcParticleLink::ExtendedBarCode::linkIsNull |
( |
| ) |
const |
return true if neither barcode nor id are valid
◆ makeID()
Change m_BC from barcode to ID.
- Parameters
-
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.
◆ makeIndex()
Change index from position to number.
- Parameters
-
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.
◆ operator!=()
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=.
◆ operator<()
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=.
◆ operator=() [1/2]
Assignment.
(Can't be defaulted due to the atomic member.)
◆ operator=() [2/2]
Move Assignment.
(Can't be defaulted due to the atomic member.)
◆ operator==()
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=.
◆ print() [1/2]
void HepMcParticleLink::ExtendedBarCode::print |
( |
MsgStream & |
os | ) |
const |
◆ print() [2/2]
void HepMcParticleLink::ExtendedBarCode::print |
( |
std::ostream & |
os | ) |
const |
Dump in textual format to a stream.
Definition at line 88 of file HepMcParticleLink.cxx.
90 os <<
"Event index " ;
94 os << position <<
" (position in collection) ";
97 os << event_number <<
" (event number) ";
99 os <<
", Unique ID " ;
101 uniqueID (particle_id, particle_barcode);
102 if (particle_barcode == 0 && particle_id == 0) {
103 os <<
" 0 (id/barcode) ";
106 os << particle_barcode <<
" (barcode) ";
109 os << particle_id <<
" (id) ";
111 os <<
", McEventCollection "
◆ setIndex()
Initialize the event index part of the link.
- Parameters
-
idx | The index or position. |
positionFlag | If IS_POSITION, idx represents a position in the collection; otherwise, it represents an event number. |
◆ setTruthSuppressionType()
◆ setUniqueID()
Initialize the unique identifier part of the link.
- Parameters
-
uid | The id or barcode. |
barcodeFlag | If IS_BARCODE, uid represents a GenParticle barcode (deprecated); otherwise, it represents a GenParticle::id(). |
◆ truthSuppressionTypeAsChar()
char HepMcParticleLink::ExtendedBarCode::truthSuppressionTypeAsChar |
( |
EBC_SUPPRESSED_TRUTH |
suppEnum | ) |
|
|
static |
◆ truthSuppressionTypeFromChar()
EBC_SUPPRESSED_TRUTH HepMcParticleLink::ExtendedBarCode::truthSuppressionTypeFromChar |
( |
char |
suppChar | ) |
|
|
static |
Translate truth suppression char ('a'..'b') to an enum.
Definition at line 71 of file HepMcParticleLink.cxx.
79 log << MSG::ERROR <<
" Wrong truth Suppression Char (" << std::string(&suppChar,1) <<
") set in HepMcParticleLink ExtendedBarCode object !!!" <<
endmsg;
◆ uid()
barcode_type HepMcParticleLink::ExtendedBarCode::uid |
( |
| ) |
const |
Unique ID of target variable (0 for a null link).
◆ uniqueID()
Return the GenParticle id/barcode.
- Parameters
-
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
.
◆ BARCODE_MASK
◆ m_BC
std::atomic<barcode_type> HepMcParticleLink::ExtendedBarCode::m_BC |
|
mutableprivate |
◆ m_evtIndex
std::atomic<index_type> HepMcParticleLink::ExtendedBarCode::m_evtIndex {0} |
|
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.
◆ m_truthSupp
◆ POSITION_MASK
◆ UNDEFINED
constexpr static index_type HepMcParticleLink::ExtendedBarCode::UNDEFINED = ~static_cast<index_type>(0) |
|
staticconstexpr |
All 1's. Used to represent an undefined index/position.
Definition at line 96 of file HepMcParticleLink.h.
◆ UNDEFINEDBC
The documentation for this class was generated from the following files:
void uniqueID(barcode_type &id, barcode_type &barcode) const
Return the GenParticle id/barcode.
constexpr static index_type UNDEFINED
All 1's. Used to represent an undefined index/position.
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 std::string getLastEventCollectionName()
Return the most recent SG key used for a particular collection type.
constexpr static barcode_type UNDEFINEDBC
void eventIndex(index_type &index, index_type &position) const
Return the event index/position.