FairShip
Loading...
Searching...
No Matches
VectorMCPointSource< PointType > Class Template Reference

#include <VectorMCPointSource.h>

Inheritance diagram for VectorMCPointSource< PointType >:
Collaboration diagram for VectorMCPointSource< PointType >:

Public Member Functions

 VectorMCPointSource ()=default
 
 VectorMCPointSource (TString branchName)
 
InitStatus Init () override
 
int GetNData () override
 
TObject * GetData (int index) override
 
double GetTime (int index) override
 
void Reset () override
 

Private Attributes

const std::vector< PointType > * fVec = nullptr
 

Detailed Description

template<typename PointType>
class VectorMCPointSource< PointType >

Data source adapter that reads std::vector<PointType> branches registered via FairRootManager::RegisterAny().

FairTCASource (the default) only supports TClonesArray branches. Since FairShip migrated to RegisterAny with std::vector storage, this adapter is needed for FairMCPointDraw to find the data.

Definition at line 18 of file VectorMCPointSource.h.

Constructor & Destructor Documentation

◆ VectorMCPointSource() [1/2]

template<typename PointType >
VectorMCPointSource< PointType >::VectorMCPointSource ( )
default

◆ VectorMCPointSource() [2/2]

template<typename PointType >
VectorMCPointSource< PointType >::VectorMCPointSource ( TString  branchName)
inlineexplicit

Definition at line 21 of file VectorMCPointSource.h.

22 : FairDataSourceI(branchName) {}

Member Function Documentation

◆ GetData()

template<typename PointType >
TObject * VectorMCPointSource< PointType >::GetData ( int  index)
inlineoverride

Definition at line 36 of file VectorMCPointSource.h.

36 {
37 return const_cast<PointType*>(&(*fVec)[index]);
38 }

◆ GetNData()

template<typename PointType >
int VectorMCPointSource< PointType >::GetNData ( )
inlineoverride

Definition at line 34 of file VectorMCPointSource.h.

34{ return fVec ? fVec->size() : 0; }
const std::vector< PointType > * fVec

◆ GetTime()

template<typename PointType >
double VectorMCPointSource< PointType >::GetTime ( int  index)
inlineoverride

Definition at line 40 of file VectorMCPointSource.h.

40{ return (*fVec)[index].GetTime(); }

◆ Init()

template<typename PointType >
InitStatus VectorMCPointSource< PointType >::Init ( )
inlineoverride

Definition at line 24 of file VectorMCPointSource.h.

24 {
25 fVec = FairRootManager::Instance()
26 ->InitObjectAs<const std::vector<PointType>*>(
27 GetBranchName().Data());
28 if (!fVec) {
29 return kERROR;
30 }
31 return kSUCCESS;
32 }

◆ Reset()

template<typename PointType >
void VectorMCPointSource< PointType >::Reset ( )
inlineoverride

Definition at line 42 of file VectorMCPointSource.h.

42{}

Member Data Documentation

◆ fVec

template<typename PointType >
const std::vector<PointType>* VectorMCPointSource< PointType >::fVec = nullptr
private

Definition at line 45 of file VectorMCPointSource.h.


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