Project
Loading...
Searching...
No Matches
o2::data::Stack Class Reference

#include <Stack.h>

Inherits FairGenericStack.

Public Types

typedef std::function< bool(const TParticle &p, const std::vector< TParticle > &particles)> TransportFcn
 

Public Member Functions

 Stack (Int_t size=100)
 
 ~Stack () override
 Default destructor.
 
void PushTrack (Int_t toBeDone, Int_t parentID, Int_t pdgCode, Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vx, Double_t vy, Double_t vz, Double_t time, Double_t polx, Double_t poly, Double_t polz, TMCProcess proc, Int_t &ntr, Double_t weight, Int_t is) override
 
void PushTrack (Int_t toBeDone, Int_t parentID, Int_t pdgCode, Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vx, Double_t vy, Double_t vz, Double_t time, Double_t polx, Double_t poly, Double_t polz, TMCProcess proc, Int_t &ntr, Double_t weight, Int_t is, Int_t secondParentId) override
 
void PushTrack (Int_t toBeDone, Int_t parentID, Int_t pdgCode, Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vx, Double_t vy, Double_t vz, Double_t time, Double_t polx, Double_t poly, Double_t polz, TMCProcess proc, Int_t &ntr, Double_t weight, Int_t is, Int_t secondParentId, Int_t daughter1Id, Int_t daughter2Id, TMCProcess proc2)
 
void PushTrack (Int_t toBeDone, TParticle &)
 
TParticle * PopNextTrack (Int_t &iTrack) override
 
TParticle * PopPrimaryForTracking (Int_t iPrim) override
 
void SetCurrentTrack (Int_t iTrack) override
 
Int_t GetNtrack () const override
 
Int_t GetNprimary () const override
 
TParticle * GetCurrentTrack () const override
 
Int_t GetCurrentTrackNumber () const override
 
Int_t GetCurrentParentTrackNumber () const override
 
TMCProcess GetProdProcessOfCurrentTrack () const
 Returns the production process of the current track.
 
void FillTrackArray () override
 Fill the MCTrack output array, applying filter criteria.
 
void UpdateTrackIndex (TRefArray *detArray=nullptr) override
 Update the track index in the MCTracks and data produced by detectors.
 
void FinishPrimary () override
 Finish primary.
 
void Reset () override
 Resets arrays and stack and deletes particles and tracks.
 
void Register () override
 Register the MCTrack array to the Root Manager.
 
virtual void Print (Int_t iVerbose=0) const
 
void Print (Option_t *option=nullptr) const override
 
void ReorderKine (std::vector< MCTrack > &particles, std::vector< int > &reOrderedIndices)
 
void StoreSecondaries (Bool_t choice=kTRUE)
 Modifiers.
 
void pruneKinematics (bool choice=true)
 
void setMinHits (Int_t min)
 
void SetEnergyCut (Double_t eMin)
 
void StoreMothers (Bool_t choice=kTRUE)
 
void addHit (int iDet)
 
TClonesArray * GetListOfParticles () override
 
std::vector< MCTrack > const *const getMCTracks () const
 
FairGenericStackCloneStack () const override
 Clone for worker (used in MT mode only)
 
void addTrackReference (const o2::TrackReference &p)
 
const std::vector< TParticle > & getPrimaries () const
 
void initFromPrimaries (std::vector< TParticle > &primaries)
 
void setExternalMode (bool m)
 
int getMotherTrackId (int) const
 Allow to query the direct mother track ID of an arbitrary trackID managed by stack.
 
bool isTrackDaughterOf (int, int) const
 
bool isCurrentTrackDaughterOf (int parentid) const
 
int getCurrentPrimaryIndex () const
 
void fillParentIDs (std::vector< int > &ids) const
 
void setMCEventStats (o2::dataformats::MCEventStats *header)
 
void updateEventStats ()
 update values in the current event header
 
bool currentTrackLeftHit () const
 returns if current track left a hit
 
bool currentTrackLeftTrackRef () const
 returns if current track left a TrackReference
 
void setTrackSeedingMode (bool m)
 set track seeding mode (tracks are seeded individually for increased reproducability)
 

Detailed Description

This class handles the particle stack for the transport simulation. For the stack FILO functunality, it uses the STL stack. To store the tracks during transport, a TParticle array is used. At the end of the event, tracks satisfying the filter criteria are copied to a MCTrack array, which is stored in the output.

The filtering criteria for the output tracks are:

  • primary tracks are stored in any case.
  • secondary tracks are stored if they have a minimal number of hits (sum of all detectors) and a minimal energy, or are the

The storage of secondaries can be switched off. The storage of all mothers can be switched off. By default, the minimal number of hits is 1 and the energy cut is 0.

Definition at line 60 of file Stack.h.

Member Typedef Documentation

◆ TransportFcn

typedef std::function<bool(const TParticle& p, const std::vector<TParticle>& particles)> o2::data::Stack::TransportFcn

Definition at line 240 of file Stack.h.

Constructor & Destructor Documentation

◆ Stack()

Stack::Stack ( Int_t  size = 100)

Default constructor

Parameters
sizeEstimated track number

Definition at line 59 of file Stack.cxx.

◆ ~Stack()

Stack::~Stack ( )
override

Default destructor.

Definition at line 142 of file Stack.cxx.

Member Function Documentation

◆ addHit()

void Stack::addHit ( int  iDet)

Increment number of hits for the current track in a given detector

Parameters
iDetDetector unique identifier

Definition at line 638 of file Stack.cxx.

◆ addTrackReference()

void o2::data::Stack::addTrackReference ( const o2::TrackReference p)
inline

Definition at line 332 of file Stack.h.

◆ CloneStack()

FairGenericStack * Stack::CloneStack ( ) const
override

Clone for worker (used in MT mode only)

Definition at line 908 of file Stack.cxx.

◆ currentTrackLeftHit()

bool o2::data::Stack::currentTrackLeftHit ( ) const
inline

returns if current track left a hit

Definition at line 232 of file Stack.h.

◆ currentTrackLeftTrackRef()

bool o2::data::Stack::currentTrackLeftTrackRef ( ) const
inline

returns if current track left a TrackReference

Definition at line 235 of file Stack.h.

◆ fillParentIDs()

void Stack::fillParentIDs ( std::vector< int > &  ids) const

Definition at line 852 of file Stack.cxx.

◆ FillTrackArray()

void Stack::FillTrackArray ( )
override

Fill the MCTrack output array, applying filter criteria.

This interface is not implemented since we are filtering/filling the output array after each primary ... just give a summary message

Definition at line 410 of file Stack.cxx.

◆ FinishPrimary()

void Stack::FinishPrimary ( )
override

Finish primary.

Definition at line 417 of file Stack.cxx.

◆ GetCurrentParentTrackNumber()

Int_t Stack::GetCurrentParentTrackNumber ( ) const
override

Get the track number of the parent of the current track Declared in TVirtualMCStack

Definition at line 665 of file Stack.cxx.

◆ getCurrentPrimaryIndex()

int o2::data::Stack::getCurrentPrimaryIndex ( ) const
inline

Definition at line 343 of file Stack.h.

◆ GetCurrentTrack()

TParticle * o2::data::Stack::GetCurrentTrack ( ) const
inlineoverride

Get the current track's particle Declared in TVirtualMCStack

Definition at line 125 of file Stack.h.

◆ GetCurrentTrackNumber()

Int_t o2::data::Stack::GetCurrentTrackNumber ( ) const
inlineoverride

Get the number of the current track Declared in TVirtualMCStack

Definition at line 133 of file Stack.h.

◆ GetListOfParticles()

TClonesArray * Stack::GetListOfParticles ( )
override

Definition at line 825 of file Stack.cxx.

◆ getMCTracks()

std::vector< MCTrack > const *const o2::data::Stack::getMCTracks ( ) const
inline

Definition at line 178 of file Stack.h.

◆ getMotherTrackId()

int o2::data::Stack::getMotherTrackId ( int  trackid) const
inline

Allow to query the direct mother track ID of an arbitrary trackID managed by stack.

Definition at line 345 of file Stack.h.

◆ GetNprimary()

Int_t o2::data::Stack::GetNprimary ( ) const
inlineoverride

Get number of primary tracks Declared in TVirtualMCStack

Definition at line 122 of file Stack.h.

◆ GetNtrack()

Int_t o2::data::Stack::GetNtrack ( ) const
inlineoverride

Get total number of tracks Declared in TVirtualMCStack

Definition at line 119 of file Stack.h.

◆ getPrimaries()

const std::vector< TParticle > & o2::data::Stack::getPrimaries ( ) const
inline

Definition at line 187 of file Stack.h.

◆ GetProdProcessOfCurrentTrack()

TMCProcess o2::data::Stack::GetProdProcessOfCurrentTrack ( ) const
inline

Returns the production process of the current track.

Definition at line 367 of file Stack.h.

◆ initFromPrimaries()

void o2::data::Stack::initFromPrimaries ( std::vector< TParticle > &  primaries)
inline

Definition at line 191 of file Stack.h.

◆ isCurrentTrackDaughterOf()

bool o2::data::Stack::isCurrentTrackDaughterOf ( int  parentid) const
inline

Definition at line 351 of file Stack.h.

◆ isTrackDaughterOf()

bool Stack::isTrackDaughterOf ( int  trackid,
int  parentid 
) const

query if a track is a direct or indirect daughter of a parentID if trackid is same as parentid it returns true

Definition at line 831 of file Stack.cxx.

◆ PopNextTrack()

TParticle * Stack::PopNextTrack ( Int_t &  iTrack)
override

Get next particle for tracking from the stack. Declared in TVirtualMCStack Returns a pointer to the TParticle of the track

Parameters
iTrackindex of popped track (return)

Definition at line 330 of file Stack.cxx.

◆ PopPrimaryForTracking()

TParticle * Stack::PopPrimaryForTracking ( Int_t  iPrim)
override

Get primary particle by index for tracking from stack Declared in TVirtualMCStack Returns a pointer to the TParticle of the track

Parameters
iPrimindex of primary particle

Definition at line 379 of file Stack.cxx.

◆ Print() [1/2]

void Stack::Print ( Int_t  iVerbose = 0) const
virtual

Output to screen

Parameters
iVerbose0=events summary, 1=track info

Definition at line 617 of file Stack.cxx.

◆ Print() [2/2]

void Stack::Print ( Option_t *  option = nullptr) const
override

Output to screen (derived from base class)

Parameters
option0=events summary, non0=track info

Definition at line 629 of file Stack.cxx.

◆ pruneKinematics()

void o2::data::Stack::pruneKinematics ( bool  choice = true)
inline

Definition at line 168 of file Stack.h.

◆ PushTrack() [1/4]

void Stack::PushTrack ( Int_t  toBeDone,
Int_t  parentID,
Int_t  pdgCode,
Double_t  px,
Double_t  py,
Double_t  pz,
Double_t  e,
Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  time,
Double_t  polx,
Double_t  poly,
Double_t  polz,
TMCProcess  proc,
Int_t &  ntr,
Double_t  weight,
Int_t  is 
)
override

Add a TParticle to the stack. Declared in TVirtualMCStack

Parameters
toBeDoneFlag for tracking
parentIDIndex of mother particle
pdgCodeParticle type (PDG encoding)
px,py,pzMomentum components at start vertex [GeV]
eTotal energy at start vertex [GeV]
vx,vy,vzCoordinates of start vertex [cm]
timeStart time of track [s]
polx,poly,polzPolarisation vector
procProduction mechanism (VMC encoding)
ntrTrack number (filled by the stack)
weightParticle weight
isGeneration status code (whatever that means)

Definition at line 176 of file Stack.cxx.

◆ PushTrack() [2/4]

void Stack::PushTrack ( Int_t  toBeDone,
Int_t  parentID,
Int_t  pdgCode,
Double_t  px,
Double_t  py,
Double_t  pz,
Double_t  e,
Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  time,
Double_t  polx,
Double_t  poly,
Double_t  polz,
TMCProcess  proc,
Int_t &  ntr,
Double_t  weight,
Int_t  is,
Int_t  secondParentId 
)
override

Definition at line 183 of file Stack.cxx.

◆ PushTrack() [3/4]

void Stack::PushTrack ( Int_t  toBeDone,
Int_t  parentID,
Int_t  pdgCode,
Double_t  px,
Double_t  py,
Double_t  pz,
Double_t  e,
Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  time,
Double_t  polx,
Double_t  poly,
Double_t  polz,
TMCProcess  proc,
Int_t &  ntr,
Double_t  weight,
Int_t  is,
Int_t  secondParentId,
Int_t  daughter1Id,
Int_t  daughter2Id,
TMCProcess  proc2 
)

Definition at line 190 of file Stack.cxx.

◆ PushTrack() [4/4]

void o2::data::Stack::PushTrack ( Int_t  toBeDone,
TParticle &   
)

◆ Register()

void Stack::Register ( )
override

Register the MCTrack array to the Root Manager.

Definition at line 611 of file Stack.cxx.

◆ ReorderKine()

void Stack::ReorderKine ( std::vector< MCTrack > &  particles,
std::vector< int > &  reOrderedIndices 
)

Definition at line 864 of file Stack.cxx.

◆ Reset()

void Stack::Reset ( )
override

Resets arrays and stack and deletes particles and tracks.

Definition at line 588 of file Stack.cxx.

◆ SetCurrentTrack()

void Stack::SetCurrentTrack ( Int_t  iTrack)
override

Set the current track number Declared in TVirtualMCStack

Parameters
iTracktrack number

Definition at line 296 of file Stack.cxx.

◆ SetEnergyCut()

void o2::data::Stack::SetEnergyCut ( Double_t  eMin)
inline

Definition at line 170 of file Stack.h.

◆ setExternalMode()

void o2::data::Stack::setExternalMode ( bool  m)
inline

Definition at line 205 of file Stack.h.

◆ setMCEventStats()

void o2::data::Stack::setMCEventStats ( o2::dataformats::MCEventStats header)
inline

set MCEventStats (for current event) used by MCApplication to inject here so that stack can set some information

Definition at line 362 of file Stack.h.

◆ setMinHits()

void o2::data::Stack::setMinHits ( Int_t  min)
inline

Definition at line 169 of file Stack.h.

◆ setTrackSeedingMode()

void o2::data::Stack::setTrackSeedingMode ( bool  m)
inline

set track seeding mode (tracks are seeded individually for increased reproducability)

Definition at line 238 of file Stack.h.

◆ StoreMothers()

void o2::data::Stack::StoreMothers ( Bool_t  choice = kTRUE)
inline

Definition at line 171 of file Stack.h.

◆ StoreSecondaries()

void o2::data::Stack::StoreSecondaries ( Bool_t  choice = kTRUE)
inline

Modifiers.

Definition at line 167 of file Stack.h.

◆ updateEventStats()

void Stack::updateEventStats ( )

update values in the current event header

Definition at line 401 of file Stack.cxx.

◆ UpdateTrackIndex()

void Stack::UpdateTrackIndex ( TRefArray *  detArray = nullptr)
override

Update the track index in the MCTracks and data produced by detectors.

Definition at line 528 of file Stack.cxx.


The documentation for this class was generated from the following files: