FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairTimebasedMCHitSource.h
Go to the documentation of this file.
1 /*
2  * FairTimebasedMCHitSource.h
3  *
4  * \brief Combines event based FairHits (with relative times) with absolute event times.
5  *
6  * \date 07.12.2020
7  * \author Tobias Stockmanns <t.stockmanns@fz-juelich.de>
8  */
9 
10 #ifndef EVENTDISPLAY_FAIRTIMEBASEDMCHITSOURCE_H_
11 #define EVENTDISPLAY_FAIRTIMEBASEDMCHITSOURCE_H_
12 
13 #include "FairDataSourceI.h"
14 #include "FairMCPoint.h"
16 
17 #include <TBranch.h>
18 
20 {
21  public:
23  FairTimebasedMCHitSource(TString branchName, double holdTime = 10.0)
24  : FairDataSourceI(branchName)
25  , fDataHandler(holdTime){};
26  virtual ~FairTimebasedMCHitSource();
27 
28  virtual InitStatus Init();
33  virtual void RetrieveData(double time);
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->GetTimeStamp() + 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(FairTimebasedMCHitSource, 1);
49 };
50 
51 #endif /* EVENTDISPLAY_FAIRTCASOURCE_H_ */
std::vector< std::pair< T *, double > > & GetData()
virtual double GetTime(int index)
InitStatus
Definition: FairTask.h:33
virtual TObject * GetData(int index)
Abstract interface class to handle different input data for event and timebased data.
virtual void RetrieveData(double time)
FairTimebasedMCHitSource(TString branchName, double holdTime=10.0)