FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairTimebasedMCHitSource.cxx
Go to the documentation of this file.
1 /*
2  * FairTimebasedMCHitSource.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>
11 
13 
15 {
16  // TODO Auto-generated constructor stub
17 }
18 
20 {
21  // TODO Auto-generated destructor stub
22 }
23 
25 {
26  fEventTime = FairRootManager::Instance()->InitObjectAs<std::vector<double> const*>("EventTimes");
27  fBranch = FairRootManager::Instance()->GetInTree()->GetBranch(fBranchName);
28 
30  LOG(error) << "Branch EventTimes not present";
31  return kERROR;
32  }
33  if (fBranch == nullptr) {
34  LOG(error) << "Branch " << fBranchName << " not present";
35  return kERROR;
36  }
37 
39  return kSUCCESS;
40 }
41 
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 InitStatus Init()
static FairGetEventTime & Instance()
InitStatus
Definition: FairTask.h:33
TClonesArray * fCArray
virtual void RetrieveData(double time)
T InitObjectAs(const char *BrName)
static FairRootManager * Instance()
void FillTClonesArray(TClonesArray *inputArray, int evtIndex, double t0Event, double t0Current)
ClassImp(FairEventBuilder)
std::pair< int, double > GetEvent(double simTime) const
virtual void RetrieveData(double time)