CbmRoot
Loading...
Searching...
No Matches
CbmMCDataObject Class Reference

Access to a MC data branch for time-based analysis. More...

#include <CbmMCDataObject.h>

Public Member Functions

virtual ~CbmMCDataObject ()
 
TObject * Get (const CbmLink *lnk)
 
TObject * Get (const CbmLink &lnk)
 
TObject * Get (Int_t fileNumber, Int_t eventNumber)
 

Private Member Functions

 CbmMCDataObject ()
 
 CbmMCDataObject (const char *branchName, const std::vector< std::list< TString > > &fileList)
 
 CbmMCDataObject (const char *branchName)
 
 CbmMCDataObject (const CbmMCDataObject &)
 
void Done ()
 
void FinishEvent ()
 
void AddFriend (Int_t chainNum1, Int_t chainNum2)
 
TObject * LegacyGet (Int_t fileNumber, Int_t eventNumber)
 
CbmMCDataObjectoperator= (const CbmMCDataObject &)
 
 ClassDef (CbmMCDataObject, 1)
 

Private Attributes

Int_t fLegacy
 
TObject * fLegacyObject
 If true, run in legacy mode.
 
TString fBranchName
 Pointer to TObject for legacy mode.
 
Int_t fSize
 Name of the data branch.
 
std::vector< TChain * > fChains
 Number of input file lists (one per source)
 
std::vector< TObject * > fTArr
 Arrays of chains (one per input source)
 
std::vector< Long64_t > fN
 Data objects from chains (one per input source)
 
std::vector< std::map< Int_t, TObject * > > fArrays
 Number of entries in chains.
 

Friends

class CbmMCDataManager
 

Detailed Description

Access to a MC data branch for time-based analysis.

Author
//Dr.Sys mikha.nosp@m.il.p.nosp@m.rokud.nosp@m.in@c.nosp@m.ern.c.nosp@m.h
Date
31 March 2015

This class provides cached access to data for an event-by-event MC data branch, which is used when matching time-based reconstruction data to the input MC data. Data objects from already used events are cached, which allows switching between events without the performance deterioration induced by frequent calls to TTree::GetEntry(). In legacy mode, the data from the current event will be retrieved from FairRootManager.

Definition at line 38 of file CbmMCDataObject.h.

Constructor & Destructor Documentation

◆ ~CbmMCDataObject()

virtual CbmMCDataObject::~CbmMCDataObject ( )
inlinevirtual

Destructor

Definition at line 43 of file CbmMCDataObject.h.

◆ CbmMCDataObject() [1/4]

CbmMCDataObject::CbmMCDataObject ( )
inlineprivate

Default constructor. Should be called from CbmMCDataManager.

Definition at line 69 of file CbmMCDataObject.h.

◆ CbmMCDataObject() [2/4]

CbmMCDataObject::CbmMCDataObject ( const char * branchName,
const std::vector< std::list< TString > > & fileList )
private

Standard constructor. Should be called from CbmMCDataManager.

Parameters
branchNameName of data branch
fileListVector of file list (one for each input source)

Definition at line 21 of file CbmMCDataObject.cxx.

References fArrays, fChains, fN, fSize, fTArr, and size().

◆ CbmMCDataObject() [3/4]

CbmMCDataObject::CbmMCDataObject ( const char * branchName)
private

Constructor in legacy mode. Gets the branch from FairRootManager.

Parameters
branchNameName of data branch

Definition at line 76 of file CbmMCDataObject.cxx.

References fBranchName, and fLegacyObject.

◆ CbmMCDataObject() [4/4]

CbmMCDataObject::CbmMCDataObject ( const CbmMCDataObject & )
private

Copy constructor. Should not be called.

Member Function Documentation

◆ AddFriend()

void CbmMCDataObject::AddFriend ( Int_t chainNum1,
Int_t chainNum2 )
private

Make TChain number chainNum2 friend of TChain number chainNum2

Parameters
chainNum1a number of chain for which AddFriend is called
chainNum2number of chain which became a friend

Definition at line 58 of file CbmMCDataObject.cxx.

References fChains, and fLegacy.

Referenced by CbmMCDataManager::GetObject().

◆ ClassDef()

CbmMCDataObject::ClassDef ( CbmMCDataObject ,
1  )
private

◆ Done()

void CbmMCDataObject::Done ( )
private

Done. Clear all arrays and delete file chain.

Definition at line 148 of file CbmMCDataObject.cxx.

References fChains, FinishEvent(), fLegacy, and fSize.

◆ FinishEvent()

void CbmMCDataObject::FinishEvent ( )
private

Finish event. Delete all arrays to free memory.

Definition at line 132 of file CbmMCDataObject.cxx.

References fArrays, fLegacy, and fSize.

Referenced by Done().

◆ Get() [1/3]

TObject * CbmMCDataObject::Get ( const CbmLink & lnk)
inline

Get an object by CbmLink reference

Parameters
linkReference to CbmLink object @value Pointer to linked object

Definition at line 57 of file CbmMCDataObject.h.

References Get(), CbmLink::GetEntry(), and CbmLink::GetFile().

Referenced by Get().

◆ Get() [2/3]

TObject * CbmMCDataObject::Get ( const CbmLink * lnk)
inline

Get an object by CbmLink pointer

Parameters
linkPointer to CbmLink object @value Pointer to linked object

Definition at line 50 of file CbmMCDataObject.h.

References Get(), CbmLink::GetEntry(), and CbmLink::GetFile().

Referenced by CbmTofAnaTestbeam::FillHistos(), Get(), CbmSimEventHeaderConverter::ProcessData(), and cbm::ca::MCModule::ReadMCTracks().

◆ Get() [3/3]

TObject * CbmMCDataObject::Get ( Int_t fileNumber,
Int_t eventNumber )

Get an object by file number and event number

Parameters
fileNumberInput file number
eventNumberEvent number @value Pointer to referenced object

Definition at line 110 of file CbmMCDataObject.cxx.

References fArrays, fChains, fLegacy, fN, fSize, fTArr, and LegacyGet().

◆ LegacyGet()

TObject * CbmMCDataObject::LegacyGet ( Int_t fileNumber,
Int_t eventNumber )
private

Get an object in legacy mode

Parameters
fileNumberInput number
eventNumberEvent number @value Pointer to referenced object

Definition at line 99 of file CbmMCDataObject.cxx.

References fLegacyObject.

Referenced by Get().

◆ operator=()

CbmMCDataObject & CbmMCDataObject::operator= ( const CbmMCDataObject & )
private

Friends And Related Symbol Documentation

◆ CbmMCDataManager

friend class CbmMCDataManager
friend

Definition at line 39 of file CbmMCDataObject.h.

Member Data Documentation

◆ fArrays

std::vector<std::map<Int_t, TObject*> > CbmMCDataObject::fArrays
private

Number of entries in chains.

Cached data objects. The vector index is the input source number, the map index is the event number.

Definition at line 123 of file CbmMCDataObject.h.

Referenced by CbmMCDataObject(), FinishEvent(), and Get().

◆ fBranchName

TString CbmMCDataObject::fBranchName
private

Pointer to TObject for legacy mode.

Definition at line 114 of file CbmMCDataObject.h.

Referenced by CbmMCDataObject().

◆ fChains

std::vector<TChain*> CbmMCDataObject::fChains
private

Number of input file lists (one per source)

Definition at line 116 of file CbmMCDataObject.h.

Referenced by AddFriend(), CbmMCDataObject(), Done(), and Get().

◆ fLegacy

Int_t CbmMCDataObject::fLegacy
private

Definition at line 112 of file CbmMCDataObject.h.

Referenced by AddFriend(), Done(), FinishEvent(), and Get().

◆ fLegacyObject

TObject* CbmMCDataObject::fLegacyObject
private

If true, run in legacy mode.

Definition at line 113 of file CbmMCDataObject.h.

Referenced by CbmMCDataObject(), and LegacyGet().

◆ fN

std::vector<Long64_t> CbmMCDataObject::fN
private

Data objects from chains (one per input source)

Definition at line 118 of file CbmMCDataObject.h.

Referenced by CbmMCDataObject(), and Get().

◆ fSize

Int_t CbmMCDataObject::fSize
private

Name of the data branch.

Definition at line 115 of file CbmMCDataObject.h.

Referenced by CbmMCDataObject(), Done(), FinishEvent(), and Get().

◆ fTArr

std::vector<TObject*> CbmMCDataObject::fTArr
private

Arrays of chains (one per input source)

Definition at line 117 of file CbmMCDataObject.h.

Referenced by CbmMCDataObject(), and Get().


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