CbmRoot
CbmMCDataArray Class Reference

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

#include <CbmMCDataArray.h>

Public Member Functions

virtual ~CbmMCDataArray ()
 
TObject * Get (const CbmLink *lnk)
 
TObject * Get (const CbmLink &lnk)
 
TObject * Get (Int_t fileNumber, Int_t eventNumber, Int_t index)
 
Int_t Size (Int_t fileNumber, Int_t eventNumber)
 
Int_t Size (const CbmLink &lnk)
 
Int_t Size (const CbmLink *lnk)
 

Private Member Functions

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

Private Attributes

Int_t fLegacy
 
TClonesArray * fLegacyArray
 If true, run in legacy mode. More...
 
TString fBranchName
 Pointer to TClonesArray 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< TClonesArray * > fTArr
 Arrays of chains (one per input source) More...
 
std::vector< Long64_t > fN
 Data arrays from chains (one per input source) More...
 
std::vector< std::map< Int_t, TClonesArray * > > 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 arrays 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 35 of file CbmMCDataArray.h.

Constructor & Destructor Documentation

◆ ~CbmMCDataArray()

virtual CbmMCDataArray::~CbmMCDataArray ( )
inlinevirtual

Destructor

Definition at line 40 of file CbmMCDataArray.h.

◆ CbmMCDataArray() [1/4]

CbmMCDataArray::CbmMCDataArray ( )
inlineprivate

Default constructor. Should be called from CbmMCDataManager.

Definition at line 92 of file CbmMCDataArray.h.

◆ CbmMCDataArray() [2/4]

CbmMCDataArray::CbmMCDataArray ( 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 19 of file CbmMCDataArray.cxx.

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

◆ CbmMCDataArray() [3/4]

CbmMCDataArray::CbmMCDataArray ( const char *  branchName)
private

Constructor in legacy mode. Gets the branch from FairRootManager.

Parameters
branchNameName of data branch

Definition at line 77 of file CbmMCDataArray.cxx.

References fBranchName, and fLegacyArray.

◆ CbmMCDataArray() [4/4]

CbmMCDataArray::CbmMCDataArray ( const CbmMCDataArray )
private

Copy constructor. Should not be called.

Member Function Documentation

◆ AddFriend()

void CbmMCDataArray::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 56 of file CbmMCDataArray.cxx.

References fChains, and fLegacy.

Referenced by CbmMCDataManager::InitBranch().

◆ ClassDef()

CbmMCDataArray::ClassDef ( CbmMCDataArray  ,
 
)
private

◆ Done()

void CbmMCDataArray::Done ( )
private

Done. Clear all arrays and delete file chain.

Definition at line 169 of file CbmMCDataArray.cxx.

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

◆ FinishEvent()

void CbmMCDataArray::FinishEvent ( )
private

Finish event. Delete all arrays to free memory.

Definition at line 154 of file CbmMCDataArray.cxx.

References fArrays, fLegacy, fSize, and i.

Referenced by Done().

◆ Get() [1/3]

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

Get an object by CbmLink reference

Parameters
linkReference to CbmLink object @value Pointer to linked object

Definition at line 56 of file CbmMCDataArray.h.

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

◆ Get() [2/3]

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

Get an object by CbmLink pointer

Parameters
linkPointer to CbmLink object @value Pointer to linked object

Definition at line 47 of file CbmMCDataArray.h.

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

Referenced by CbmLitMCTrackCreator::AddPoints(), CbmLitMCTrackCreator::AddRingParameters(), CbmEventBuilderQA::CalculateIsReconstructable(), CbmRichRingFinderIdeal::DoFind(), CbmLitTrackingQa::ElectronId(), CbmBinnedTrackerQA::Exec(), CbmKFParticleFinderQA::Exec(), CbmKFParticleFinder::Exec(), CbmKFTrackQA::Exec(), LxTBTrdFinder::Exec(), CbmEventBuilderQA::Exec(), LxTBMLFinder::Exec(), CbmBinnedDebug::Exec(), CbmLitMCTrackCreator::FairMCPointToLitMCPoint(), CbmL1::Fill_vMCTracks(), CbmTofAnaTestbeam::FillHistos(), CbmStsFindTracksQa::FillHitMap(), CbmLitMCTrackCreator::FillStationMaps(), Get(), CbmMuchToTofVectors::GetHits(), CbmTrdToTofVector::GetHits(), CbmMatchRecoToMC::GetMcTrackMotherIdsForRichHit(), CbmRichRecoTbQa::GetNofPrimaryMcTracks(), CbmBinnedTrackerQA::HandleMuch(), CbmBinnedTrackerQA::HandleSts(), CbmBinnedTrackerQA::HandleTof(), CbmBinnedTrackerQA::HandleTrd(), CbmTofHitFinderTBQA::Init(), CbmBinnedTrackerQA::Init(), LxTBTrdFinder::Init(), LxTBFinder::Init(), LxTBMLFinder::Init(), CbmGlobalTrackingQA::Init(), CbmL1::InputPerformance(), CbmRichRecoTbQa::IsCherenkovPhoton(), CbmRichRecoTbQa::IsCherenkovPhotonFromPion(), CbmRichRecoTbQa::IsCherenkovPhotonFromPrimaryElectron(), CbmRichRecoTbQa::IsCherenkovPhotonFromSecondaryElectron(), CbmBinnedTrackerQA::IterateTrdHits(), CbmMatchRecoToMC::MatchStsTracks(), CbmMatchRecoToMC::MatchTracks(), CbmRichUrqmdTest::NofHitsAndPoints(), CbmRichUrqmdTest::NofRings(), CbmLitTrackingQa::PionSuppression(), CbmRichUrqmdTest::PmtXYSource(), CbmStsFindTracksQa::ProcessEvent(), CbmLitTofQa::ProcessGlobalTracks(), CbmLitTrackingQa::ProcessGlobalTracks(), CbmRichGeoTest::ProcessHits(), CbmRichRecoTbQa::ProcessMc(), CbmLitTofQa::ProcessMC(), CbmRichGeoTest::ProcessMc(), CbmLitTrackingQa::ProcessMcTracks(), CbmLitTrackingQa::ProcessMvd(), CbmLitTofQa::ProcessTofHits(), CbmLitTofQa::ProcessTofTracks(), CbmLitFitQa::ProcessTrackMomentumAtVertex(), CbmLitFitQa::ProcessTrackParamsAtVertex(), CbmL1::ReadEvent(), CbmL1::ReadMCPoint(), CbmRecoQa::record(), CbmRichGeoTest::RingParameters(), CbmRichRecoTbQa::RingRecoEfficiency(), CbmMuchFindVectorsGem::SelectHitId(), CbmKFParticleFinderPID::SetMCPID(), CbmMuchFindVectorsGem::SetTrackId(), CbmTrdFindVectors::SetTrackId(), and CbmRichUrqmdTest::Vertex().

◆ Get() [3/3]

TObject * CbmMCDataArray::Get ( Int_t  fileNumber,
Int_t  eventNumber,
Int_t  index 
)

Get an object by file number, event number and index

Parameters
fileNumberInput file number
eventNumberEvent number
indexIndex of desired object in its array @value Pointer to referenced object

Definition at line 112 of file CbmMCDataArray.cxx.

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

◆ LegacyGet()

TObject * CbmMCDataArray::LegacyGet ( Int_t  fileNumber,
Int_t  eventNumber,
Int_t  index 
)
private

Get an object in legacy mode

Parameters
fileNumberInput number
eventNumberEvent number
indexIndex of desired object in its array @value Pointer to referenced object

Definition at line 101 of file CbmMCDataArray.cxx.

References eventNumber, and fLegacyArray.

Referenced by Get().

◆ operator=()

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

◆ Size() [1/3]

Int_t CbmMCDataArray::Size ( const CbmLink lnk)
inline

Get a size of TClonesArray . Slow if TClonesArray not in cache

Parameters
linkReference to CbmLink object, index field is ignored @value Size of corresponding TClonesArray

Definition at line 80 of file CbmMCDataArray.h.

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

Referenced by Size().

◆ Size() [2/3]

Int_t CbmMCDataArray::Size ( const CbmLink lnk)
inline

Get a size of TClonesArray . Slow if TClonesArray not in cache

Parameters
linkPointer to CbmLink object, index field is ignored @value Size of corresponding TClonesArray

Definition at line 86 of file CbmMCDataArray.h.

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

◆ Size() [3/3]

Friends And Related Function Documentation

◆ CbmMCDataManager

friend class CbmMCDataManager
friend

Definition at line 36 of file CbmMCDataArray.h.

Member Data Documentation

◆ fArrays

std::vector<std::map<Int_t, TClonesArray*> > CbmMCDataArray::fArrays
private

Number of entries in chains.

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

Definition at line 155 of file CbmMCDataArray.h.

Referenced by CbmMCDataArray(), FinishEvent(), Get(), and Size().

◆ fBranchName

TString CbmMCDataArray::fBranchName
private

Pointer to TClonesArray for legacy mode.

Definition at line 145 of file CbmMCDataArray.h.

Referenced by CbmMCDataArray().

◆ fChains

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

Number of input file lists (one per source)

Definition at line 147 of file CbmMCDataArray.h.

Referenced by AddFriend(), CbmMCDataArray(), Done(), Get(), and Size().

◆ fLegacy

Int_t CbmMCDataArray::fLegacy
private

Definition at line 143 of file CbmMCDataArray.h.

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

◆ fLegacyArray

TClonesArray* CbmMCDataArray::fLegacyArray
private

If true, run in legacy mode.

Definition at line 144 of file CbmMCDataArray.h.

Referenced by CbmMCDataArray(), LegacyGet(), and Size().

◆ fN

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

Data arrays from chains (one per input source)

Definition at line 150 of file CbmMCDataArray.h.

Referenced by CbmMCDataArray(), Get(), and Size().

◆ fSize

Int_t CbmMCDataArray::fSize
private

Name of the data branch.

Definition at line 146 of file CbmMCDataArray.h.

Referenced by CbmMCDataArray(), Done(), FinishEvent(), Get(), and Size().

◆ fTArr

std::vector<TClonesArray*> CbmMCDataArray::fTArr
private

Arrays of chains (one per input source)

Definition at line 149 of file CbmMCDataArray.h.

Referenced by CbmMCDataArray(), Get(), and Size().


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