15 #include "FairLogger.h"
20 #define CBM_GLOBALTB_PRINT_PERF
22 #ifdef CBM_GLOBALTB_PRINT_PERF
24 #include <mach/mach_time.h>
26 #ifndef CLOCK_REALTIME
27 #define CLOCK_REALTIME 0
29 #ifndef CLOCK_MONOTONIC
30 #define CLOCK_MONOTONIC 0
32 inline int clock_gettime(
int ,
struct timespec* t) {
33 mach_timebase_info_data_t timebase;
34 mach_timebase_info(&timebase);
36 time = mach_absolute_time();
38 ((double) time * (
double) timebase.numer) / ((
double) timebase.denom);
40 ((double) time * (
double) timebase.numer) / ((
double) timebase.denom * 1e9);
42 t->tv_nsec = nseconds;
48 #endif //CBM_GLOBALTB_PRINT_PERF
72 LOG(fatal) <<
"Could not read the ToF geometry information";
74 FairRootManager* ioman = FairRootManager::Instance();
76 if (0 == ioman) LOG(fatal) <<
"No FairRootManager";
80 if (0 ==
fTimeSlice) LOG(fatal) <<
"No time slice";
82 fTofHits =
static_cast<TClonesArray*
>(ioman->GetObject(
"TofHit"));
84 if (0 ==
fTofHits) LOG(fatal) <<
"No ToF hits";
88 fStsTracks =
static_cast<TClonesArray*
>(ioman->GetObject(
"StsTrack"));
90 if (0 ==
fStsTracks) LOG(fatal) <<
"No STS tracks";
92 fStsHits =
static_cast<TClonesArray*
>(ioman->GetObject(
"StsHit"));
94 if (0 ==
fStsHits) LOG(fatal) <<
"No STS hits";
96 fMvdHits =
static_cast<TClonesArray*
>(ioman->GetObject(
"MvdHit"));
105 if (
nullptr ==
fPrimVertex) { LOG(fatal) <<
"No primary vertex"; }
108 ioman->Register(
"GlobalTrack",
111 IsOutputBranchPersistent(
"GlobalTrack"));
116 #ifdef CBM_GLOBALTB_PRINT_PERF
118 #endif //CBM_GLOBALTB_PRINT_PERF
124 int nofStsTracks =
fStsTracks->GetEntriesFast();
126 for (
int i = 0;
i < nofStsTracks; ++
i) {
133 Double_t trackLength = stsTrackLength;
135 #ifdef CBM_GLOBALTB_PRINT_PERF
137 clock_gettime(CLOCK_REALTIME, &ts);
138 long beginTime = ts.tv_sec * 1000000000 + ts.tv_nsec;
139 #endif //CBM_GLOBALTB_PRINT_PERF
145 globalTrack->
SetLength(stsTrackLength + trackLength);
150 FairTrackParam vtxTrackParam;
151 float chiSqPrimary = 0;
156 #ifdef CBM_GLOBALTB_PRINT_PERF
157 clock_gettime(CLOCK_REALTIME, &ts);
158 long endTime = ts.tv_sec * 1000000000 + ts.tv_nsec;
160 #endif //CBM_GLOBALTB_PRINT_PERF
177 cout <<
"globalNofHitsM: " <<
globalNofHitsM << endl << endl << endl;
178 cout <<
"Full merging duration was: " <<
fullDuration << endl << endl << endl;
186 Double_t
x = paramFirst->GetX();
187 Double_t
y = paramFirst->GetY();
188 Double_t z = paramFirst->GetZ();
189 Double_t p = paramFirst->GetQp() ? TMath::Abs(1 / paramFirst->GetQp()) : 1;
205 length += TMath::Sqrt(TMath::Power(
x - xOld, 2) + TMath::Power(
y - yOld, 2)
206 + TMath::Power(z - zOld, 2));
209 x = paramFirst->GetX();
210 y = paramFirst->GetY();
211 z = paramFirst->GetZ();
213 const FairTrackParam* paramLast = track->
GetParamLast();
216 for (
int i = 1;
i < nofHits; ++
i) {
225 if (
i == nofHits - 1) {
228 nextZ = paramLast->
GetZ();
262 TMath::Sqrt(TMath::Power(
x - xOld, 2) + TMath::Power(
y - yOld, 2)
263 + TMath::Power(z - zOld, 2));