FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairTimebasedMCSource.h
Go to the documentation of this file.
1 /*
2  * FairTimebasedMCSource.h
3  *
4  * \brief Combines event based FairMCPoints with absolute event times.
5  *
6  * \date 07.12.2020
7  * \author Tobias Stockmanns <t.stockmanns@fz-juelich.de>
8  */
9 
10 #ifndef EVENTDISPLAY_FAIRTIMEBASEDMCSOURCE_H_
11 #define EVENTDISPLAY_FAIRTIMEBASEDMCSOURCE_H_
12 
13 #include "FairDataSourceI.h"
14 #include "FairMCPoint.h"
16 
17 #include <TBranch.h>
18 
20 {
21  public:
23  FairTimebasedMCSource(TString branchName, double holdTime = 10.0)
24  : FairDataSourceI(branchName)
25  , fDataHandler(holdTime){};
26  virtual ~FairTimebasedMCSource();
27 
28  virtual InitStatus Init();
33  virtual void RetrieveData(double simTime);
34  virtual int GetNData() { return fDataHandler.GetData().size(); };
35  virtual TObject* GetData(int index) { return fDataHandler.GetData()[index].first; }
36  virtual double GetTime(int index)
37  {
38  return (fDataHandler.GetData()[index].first->GetTime() + fDataHandler.GetData()[index].second);
39  };
40  virtual void Reset() { fDataHandler.Reset(); };
41  void SetHoldTime(double time) { fDataHandler.SetHoldTime(time); }
42 
43  private:
44  TBranch* fBranch = nullptr;
45  std::vector<double> const* fEventTime = nullptr;
47 
48  ClassDef(FairTimebasedMCSource, 1);
49 };
50 
51 #endif /* EVENTDISPLAY_FAIRTCASOURCE_H_ */
std::vector< std::pair< T *, double > > & GetData()
virtual void RetrieveData(double simTime)
InitStatus
Definition: FairTask.h:33
virtual TObject * GetData(int index)
void SetHoldTime(double time)
FairTimebasedMCSource(TString branchName, double holdTime=10.0)
Abstract interface class to handle different input data for event and timebased data.
virtual InitStatus Init()
virtual double GetTime(int index)