CbmRoot
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. More...
 
TString fBranchName
 Pointer to TObject for legacy mode. More...
 
Int_t fSize
 Name of the data branch. More...
 
std::vector< TChain * > fChains
 Number of input file lists (one per source) More...
 
std::vector< TObject * > fTArr
 Arrays of chains (one per input source) More...
 
std::vector< Long64_t > fN
 Data objects from chains (one per input source) More...
 
std::vector< std::map< Int_t, TObject * > > fArrays
 Number of entries in chains. More...
 

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 34 of file CbmMCDataObject.h.

Constructor & Destructor Documentation

◆ ~CbmMCDataObject()

virtual CbmMCDataObject::~CbmMCDataObject ( )
inlinevirtual

Destructor

Definition at line 39 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 16 of file CbmMCDataObject.cxx.

References fArrays, fChains, fN, fSize, fTArr, and i.

◆ 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 75 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 54 of file CbmMCDataObject.cxx.

References fChains, and fLegacy.

Referenced by CbmMCDataManager::GetObject().

◆ ClassDef()

CbmMCDataObject::ClassDef ( CbmMCDataObject  ,
 
)
private

◆ Done()

void CbmMCDataObject::Done ( )
private

Done. Clear all arrays and delete file chain.

Definition at line 145 of file CbmMCDataObject.cxx.

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

◆ FinishEvent()

void CbmMCDataObject::FinishEvent ( )
private

Finish event. Delete all arrays to free memory.

Definition at line 130 of file CbmMCDataObject.cxx.

References fArrays, fLegacy, fSize, and i.

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 55 of file CbmMCDataObject.h.

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

◆ 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 46 of file CbmMCDataObject.h.

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

Referenced by CbmTofAnaTestbeam::FillHistos(), and Get().

◆ 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 109 of file CbmMCDataObject.cxx.

References eventNumber, 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 98 of file CbmMCDataObject.cxx.

References eventNumber, and fLegacyObject.

Referenced by Get().

◆ operator=()

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

Friends And Related Function Documentation

◆ CbmMCDataManager

friend class CbmMCDataManager
friend

Definition at line 35 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 131 of file CbmMCDataObject.h.

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

◆ fBranchName

TString CbmMCDataObject::fBranchName
private

Pointer to TObject for legacy mode.

Definition at line 121 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 123 of file CbmMCDataObject.h.

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

◆ fLegacy

Int_t CbmMCDataObject::fLegacy
private

Definition at line 119 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 120 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 126 of file CbmMCDataObject.h.

Referenced by CbmMCDataObject(), and Get().

◆ fSize

Int_t CbmMCDataObject::fSize
private

Name of the data branch.

Definition at line 122 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 125 of file CbmMCDataObject.h.

Referenced by CbmMCDataObject(), and Get().


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