17 #include <TClonesArray.h>
24 , fTimeResolution(100.)
25 , fPointArray(nullptr)
27 , fDataBuffer(nullptr)
28 , fTimeOrderedDigi(kFALSE)
37 LOG(error) <<
"FairTestDetectorTimeDigiTask::Init: RootManager not instantiated!";
41 fPointArray =
static_cast<TClonesArray*
>(ioman->
GetObject(
"FairTestDetectorPoint"));
43 LOG(warn) <<
"FairTestDetectorTimeDigiTask::Init: No Point array!";
63 for (
int ipnt = 0; ipnt < fPointArray->GetEntries(); ipnt++) {
69 Int_t xPad = CalcPad(point->
GetX(), point->
GetXOut());
70 Int_t yPad = CalcPad(point->
GetY(), point->
GetYOut());
71 Int_t zPad = CalcPad(point->
GetZ(), point->
GetZOut());
73 Double_t timestamp = CalcTimeStamp(point->
GetTime());
76 if (fTimeResolution > 0) {
77 digi->SetTimeStampError(fTimeResolution / TMath::Sqrt(fTimeResolution));
79 digi->SetTimeStampError(0);
84 Double_t timeOfFlight = point->
GetTime();
87 fDataBuffer->
FillNewData(digi, timeOfFlight + eventTime, digi->GetTimeStamp() + 10);
91 Int_t FairTestDetectorTimeDigiTask::CalcPad(Double_t posIn, Double_t posOut)
93 Int_t result =
static_cast<Int_t
>(posIn + posOut) / 2;
97 Double_t FairTestDetectorTimeDigiTask::CalcTimeStamp(Double_t timeOfFlight)
100 Double_t detectionTime = gRandom->Gaus(0, fTimeResolution);
102 Double_t result = eventTime + timeOfFlight + detectionTime;
virtual InitStatus Init()
FairWriteoutBuffer * RegisterWriteoutBuffer(TString branchName, FairWriteoutBuffer *buffer)
virtual void FillNewData(FairTimeStamp *data, double startTime, double activeTime)
static FairRootManager * Instance()
ClassImp(FairEventBuilder)
TObject * GetObject(const char *BrName)
~FairTestDetectorTimeDigiTask()
virtual void ActivateBuffering(Bool_t val=kTRUE)
virtual void Exec(Option_t *opt)
FairTestDetectorTimeDigiTask()