FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairTimebasedMCSource.cxx
Go to the documentation of this file.
1 /*
2  * FairTimebasedMCSource.cxx
3  *
4  * \date 07.12.2020
5  * \author Tobias Stockmanns <t.stockmanns@fz-juelich.de>
6  */
7 
8 #include <FairGetEventTime.h>
9 #include <FairRootManager.h>
10 #include <FairTimebasedMCSource.h>
11 
13 
15 {
16  // TODO Auto-generated constructor stub
17 }
18 
20 {
21  // TODO Auto-generated destructor stub
22 }
23 
25 {
26  fBranch = FairRootManager::Instance()->GetInTree()->GetBranch(fBranchName);
27 
29  LOG(error) << "Branch EventTimes not present";
30  return kERROR;
31  }
32  if (fBranch == nullptr) {
33  LOG(error) << "Branch " << fBranchName << " not present";
34  return kERROR;
35  }
36 
38  return kSUCCESS;
39 }
40 
42 {
43 
44  std::pair<int, double> evt = FairGetEventTime::Instance().GetEvent(simTime);
45 
46  if (evt.first < 0) {
47  fCArray->Clear();
48  } else {
49  fBranch->GetEvent(evt.first);
50  fDataHandler.FillTClonesArray(fCArray, evt.first, evt.second, simTime);
51  }
53 }
virtual void RetrieveData(double simTime)
virtual InitStatus Init()
static FairGetEventTime & Instance()
InitStatus
Definition: FairTask.h:33
TClonesArray * fCArray
virtual void RetrieveData(double time)
static FairRootManager * Instance()
void FillTClonesArray(TClonesArray *inputArray, int evtIndex, double t0Event, double t0Current)
ClassImp(FairEventBuilder)
std::pair< int, double > GetEvent(double simTime) const
virtual InitStatus Init()