11 #include "FairLogger.h"
12 #include "FairRunAna.h"
13 #include "FairRuntimeDb.h"
18 #include <mach/mach_time.h>
20 #ifndef CLOCK_REALTIME
21 #define CLOCK_REALTIME 0
23 #ifndef CLOCK_MONOTONIC
24 #define CLOCK_MONOTONIC 0
26 inline int clock_gettime(
int ,
struct timespec* t) {
27 mach_timebase_info_data_t timebase;
28 mach_timebase_info(&timebase);
30 time = mach_absolute_time();
32 ((double) time * (
double) timebase.numer) / ((
double) timebase.denom);
34 ((double) time * (
double) timebase.numer) / ((
double) timebase.denom * 1e9);
36 t->tv_nsec = nseconds;
51 : fUseAllDetectors(useAllDetectors)
52 , fIsOnlyPrimary(false)
81 if (0 == geoReader) LOG(fatal) <<
"Couldn't instantiate CbmBinnedGeoReader";
91 FairRootManager* ioman = FairRootManager::Instance();
93 if (0 == ioman) LOG(fatal) <<
"No FairRootManager";
96 ioman->Register(
"GlobalTrack",
99 IsOutputBranchPersistent(
"GlobalTrack"));
101 LOG(info) <<
"Use STS detector: "
105 LOG(info) <<
"Use MuCh detector: "
107 LOG(info) <<
"The number of MuCh stations: "
109 LOG(info) <<
"Use TRD detector: "
112 LOG(info) <<
"Use ToF detector: "
116 fStsTracks =
new TClonesArray(
"CbmStsTrack", 100);
118 "StsTrack",
"STS",
fStsTracks, IsOutputBranchPersistent(
"StsTrack"));
122 fMuchTracks =
new TClonesArray(
"CbmMuchTrack", 100);
124 "MuchTrack",
"Much",
fMuchTracks, IsOutputBranchPersistent(
"MuchTrack"));
128 fTrdTracks =
new TClonesArray(
"CbmTrdTrack", 100);
130 "TrdTrack",
"Trd",
fTrdTracks, IsOutputBranchPersistent(
"TrdTrack"));
143 clock_gettime(CLOCK_REALTIME, &ts);
144 long beginTime = ts.tv_sec * 1000000000 + ts.tv_nsec;
154 int globalTrackNumber = 0;
155 int stsTrackNumber = 0;
156 int muchTrackNumber = 0;
157 int trdTrackNumber = 0;
158 std::list<CbmBinnedTracker::Track*>::const_iterator tracksEnd =
161 for (std::list<CbmBinnedTracker::Track*>::const_iterator trackIter =
163 trackIter != tracksEnd;
173 int stsStationNumber = 0;
174 int muchStationNumber = 0;
175 int trdStationNumber = 0;
176 int tofStationNumber = 0;
177 Double_t cov[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
179 FairTrackParam trackParam;
186 for (
int hitNo = 0; hitNo < recoTrack->
fLength; ++hitNo) {
189 switch (hitHolder->
type) {
192 stsTrack =
new ((*fStsTracks)[stsTrackNumber])
CbmStsTrack();
201 if (0 == muchTrack) {
202 muchTrack =
new ((*fMuchTracks)[muchTrackNumber])
CbmMuchTrack();
212 trdTrack =
new ((*fTrdTracks)[trdTrackNumber])
CbmTrdTrack();
225 LOG(fatal) <<
"This hit type is not accepted. Only sts, much, trd "
226 "and tof hits are accepted.";
230 int lastStationNumber = stsStationNumber + muchStationNumber
231 + trdStationNumber + tofStationNumber - 1;
233 trackParam.SetX(recoTrack->
fParams[0].GetX());
234 trackParam.SetY(recoTrack->
fParams[0].GetY());
236 trackParam.SetTx(recoTrack->
fParams[0].GetTx());
237 trackParam.SetTy(recoTrack->
fParams[0].GetTy());
240 trackParam.SetCovMatrix(cov);
243 trackParam.SetX(recoTrack->
fParams[lastStationNumber].GetX());
244 trackParam.SetY(recoTrack->
fParams[lastStationNumber].GetY());
245 trackParam.SetZ(recoTrack->
fHits[lastStationNumber]->
hit->
GetZ());
246 trackParam.SetTx(recoTrack->
fParams[lastStationNumber].GetTx());
247 trackParam.SetTy(recoTrack->
fParams[lastStationNumber].GetTy());
250 trackParam.SetCovMatrix(cov);
253 globalTrack->
SetNDF((lastStationNumber + 1) * 2);
401 clock_gettime(CLOCK_REALTIME, &ts);
402 long endTime = ts.tv_sec * 1000000000 + ts.tv_nsec;
418 cout <<
"Full reconstruction duration: " <<
fullDuration <<
" nanoseconds"
424 FairRunAna::Instance()->GetRuntimeDb()->getContainer(
"CbmBinnedSettings"));