![]() |
Project
|
Classes | |
struct | TableCursor |
Typedefs | |
using | CollisionCursor = TableCursor< aod::McCollisions >::type |
using | ParticleCursor = TableCursor< aod::StoredMcParticles_001 >::type |
using | XSectionCursor = TableCursor< aod::HepMCXSections >::type |
using | PdfInfoCursor = TableCursor< aod::HepMCPdfInfos >::type |
using | HeavyIonCursor = TableCursor< aod::HepMCHeavyIons >::type |
using | TrackToIndex = std::unordered_map< int, int > |
Enumerations | |
enum | HepMCUpdate { never , always , anyKey , allKeys } |
Functions | |
bool | hasKeys (o2::dataformats::MCEventHeader const &header, const std::vector< std::string > &keys, bool anyNotall=true) |
template<typename T > | |
const T | getEventInfo (o2::dataformats::MCEventHeader const &header, std::string const &key, T const &def) |
short | updateMCCollisions (const CollisionCursor &cursor, int bcId, float time, o2::dataformats::MCEventHeader const &header, short generatorId=0, int sourceId=0, unsigned int mask=0xFFFFFFF0) |
bool | updateHepMCXSection (const XSectionCursor &cursor, int collisionID, short generatorID, o2::dataformats::MCEventHeader const &header, HepMCUpdate when=HepMCUpdate::anyKey) |
bool | updateHepMCPdfInfo (const PdfInfoCursor &cursor, int collisionID, short generatorID, o2::dataformats::MCEventHeader const &header, HepMCUpdate when=HepMCUpdate::anyKey) |
bool | updateHepMCHeavyIon (const HeavyIonCursor &cursor, int collisionID, short generatorID, o2::dataformats::MCEventHeader const &header, HepMCUpdate when=HepMCUpdate::anyKey) |
void | updateParticle (const ParticleCursor &cursor, const TrackToIndex &toStore, int collisionID, o2::MCTrack const &track, std::vector< MCTrack > const &tracks, uint8_t flags=0, uint32_t weightMask=0xFFFFFFF0, uint32_t momentumMask=0xFFFFFFF0, uint32_t positionMask=0xFFFFFFF0) |
uint32_t | updateParticles (const ParticleCursor &cursor, int collisionID, std::vector< MCTrack > const &tracks, TrackToIndex &preselect, uint32_t offset=0, bool filter=false, bool background=false, uint32_t weightMask=0xFFFFFFF0, uint32_t momentumMask=0xFFFFFFF0, uint32_t positionMask=0xFFFFFFF0) |
Utilities to transform simulated data into AO2D tables.
The function templates below are templated on the cursor type over the relevant AOD tables. Such a table can be obtained from the ProcessingContext pc
If the task uses the Produces<Table>
template,
then a cursor is obtained via,
Note that these functions cannot be moved into a compilation unit, because that would require deducing the table cursor type, by f.ex.
but since cursors are really Lambdas and Lambda types are specific to the compilation unit, then the implementation file (compilation unit) of these functions definitions and their use (another compilation unit) would have different types of the the cursers, and thus not be able to link. More information is given at https://stackoverflow.com/questions/50033797.
using o2::aodmchelpers::CollisionCursor = typedef TableCursor<aod::McCollisions>::type |
Cursor over aod::McCollisions
Definition at line 84 of file AODMcProducerHelpers.h.
using o2::aodmchelpers::HeavyIonCursor = typedef TableCursor<aod::HepMCHeavyIons>::type |
Cursor over aod::HepMCHeavyIons
Definition at line 92 of file AODMcProducerHelpers.h.
using o2::aodmchelpers::ParticleCursor = typedef TableCursor<aod::StoredMcParticles_001>::type |
Cursor over aod::McParticles
Definition at line 86 of file AODMcProducerHelpers.h.
using o2::aodmchelpers::PdfInfoCursor = typedef TableCursor<aod::HepMCPdfInfos>::type |
Cursor over aod::HepMCPdfInfos
Definition at line 90 of file AODMcProducerHelpers.h.
using o2::aodmchelpers::TrackToIndex = typedef std::unordered_map<int, int> |
Type of mapping from track number to row index
Definition at line 229 of file AODMcProducerHelpers.h.
using o2::aodmchelpers::XSectionCursor = typedef TableCursor<aod::HepMCXSections>::type |
Cursor over aod::HepMCXSections
Definition at line 88 of file AODMcProducerHelpers.h.
Types of updates on HepMC tables.
Enumerator | |
---|---|
never | |
always | |
anyKey | |
allKeys |
Definition at line 95 of file AODMcProducerHelpers.h.
const T o2::aodmchelpers::getEventInfo | ( | o2::dataformats::MCEventHeader const & | header, |
std::string const & | key, | ||
T const & | def | ||
) |
Get a property from the header, or if not set or not valid, a default value.
header | The MC event header |
key | Key to look for |
def | Value to return if key is not found |
Definition at line 131 of file AODMcProducerHelpers.h.
bool o2::aodmchelpers::hasKeys | ( | o2::dataformats::MCEventHeader const & | header, |
const std::vector< std::string > & | keys, | ||
bool | anyNotall = true |
||
) |
Check if header has keys. If the argument anyNotAll is true, then this member function returns true if any of the keys were found. If anyNotAll is false, then return true only if all keys were found.
header | MC event header |
keys | Keys to look for |
anyNotAll | If true, return true if any key was found. If false, return true only if all keys were found |
Definition at line 25 of file AODMcProducerHelpers.cxx.
bool o2::aodmchelpers::updateHepMCHeavyIon | ( | const HeavyIonCursor & | cursor, |
int | collisionID, | ||
short | generatorID, | ||
o2::dataformats::MCEventHeader const & | header, | ||
HepMCUpdate | when = HepMCUpdate::anyKey |
||
) |
Fill in HepMC heavy-ion table from generator event header.
cursor | Cursor over o2::aod::HepMCXSections table |
collisionID | Identifier of collision (as given updateMCCollision) |
generatorID | Encoded generator ID |
header | Event header from generator |
anyNotAll | If true, then any key present trigger and update. If false, then all keys must be present to update the table. |
Definition at line 147 of file AODMcProducerHelpers.cxx.
bool o2::aodmchelpers::updateHepMCPdfInfo | ( | const PdfInfoCursor & | cursor, |
int | collisionID, | ||
short | generatorID, | ||
o2::dataformats::MCEventHeader const & | header, | ||
HepMCUpdate | when = HepMCUpdate::anyKey |
||
) |
Fill in HepMC parton distribution function table from event generator header
cursor | Cursor over o2::aod::HepMCXSections table |
collisionID | Identifier of collision (as given updateMCCollision) |
generatorID | Encoded generator ID |
header | Event header from generator |
anyNotAll | If true, then any key present trigger and update. If false, then all keys must be present to update the table. |
Definition at line 107 of file AODMcProducerHelpers.cxx.
bool o2::aodmchelpers::updateHepMCXSection | ( | const XSectionCursor & | cursor, |
int | collisionID, | ||
short | generatorID, | ||
o2::dataformats::MCEventHeader const & | header, | ||
HepMCUpdate | when = HepMCUpdate::anyKey |
||
) |
Fill in HepMC cross-section table from event generator header.
cursor | Cursor over o2::aod::HepMCXSections table |
collisionID | Identifier of collision (as given updateMCCollision) |
generatorID | Encoded generator ID |
header | Event header from generator |
anyNotAll | If true, then any key present trigger and update. If false, then all keys must be present to update the table. |
Definition at line 73 of file AODMcProducerHelpers.cxx.
short o2::aodmchelpers::updateMCCollisions | ( | const CollisionCursor & | cursor, |
int | bcId, | ||
float | time, | ||
o2::dataformats::MCEventHeader const & | header, | ||
short | generatorId = 0 , |
||
int | sourceId = 0 , |
||
unsigned int | mask = 0xFFFFFFF0 |
||
) |
Fill in collision information. This is read from the passed MC header and stored in the MCCollision table. The member function returns the encoded generator ID.
cursor | Cursor over o2::aod::McCollisions table |
bcId | Bunch-crossing Identifier |
time | Time of collisions |
header | Event header from generator |
generatorId | Default generator |
sourceId | Identifier of source |
Definition at line 38 of file AODMcProducerHelpers.cxx.
void o2::aodmchelpers::updateParticle | ( | const ParticleCursor & | cursor, |
const TrackToIndex & | toStore, | ||
int | collisionID, | ||
o2::MCTrack const & | track, | ||
std::vector< MCTrack > const & | tracks, | ||
uint8_t | flags = 0 , |
||
uint32_t | weightMask = 0xFFFFFFF0 , |
||
uint32_t | momentumMask = 0xFFFFFFF0 , |
||
uint32_t | positionMask = 0xFFFFFFF0 |
||
) |
Update aod::McParticles table with information from an MC track.
cursor | Cursor over aod::McParticles table |
mapping | Maps track number to index in table |
collisionID | Collision identifier |
track | Track to update table with |
tracks | List of all tracks of current collision |
flags | Base flags of this track |
weightMask | Mask on weight floating point value |
momentumMask | Mask on momentum floating point values |
positionMask | Mask on position floating point values |
Definition at line 204 of file AODMcProducerHelpers.cxx.
uint32_t o2::aodmchelpers::updateParticles | ( | const ParticleCursor & | cursor, |
int | collisionID, | ||
std::vector< MCTrack > const & | tracks, | ||
TrackToIndex & | preselect, | ||
uint32_t | offset = 0 , |
||
bool | filter = false , |
||
bool | background = false , |
||
uint32_t | weightMask = 0xFFFFFFF0 , |
||
uint32_t | momentumMask = 0xFFFFFFF0 , |
||
uint32_t | positionMask = 0xFFFFFFF0 |
||
) |
Update aod::McParticles table with tracks from MC.
To add particles from many events, one will do
Here preselect must be a map from track number to a positive value. Tracks that are mapped as such in preselect are stored in addition to other tracks selected by the function. Note that preselect may be empty.
If filter is false, then all tracks will be stored.
If filter is true, then tracks that are
that track is kept
On return, the preselect will map from track number (index in the tracks container) to the table row index (including offset from previous events in the same time-frame).
cursor | Cursor over aod::McParticles |
int | Collision identifier |
tracks | List of all tracks of current collision |
offset | Index just beyond last table entry |
filter | Filter tracks |
background | True of from background event |
preselect | Mapping of preselected tracks |
weightMask | Mask on weight floating point value |
momentumMask | Mask on momentum floating point values |
positionMask | Mask on position floating point values |
Definition at line 299 of file AODMcProducerHelpers.cxx.