2 #ifndef RICH_CbmRichUtil
3 #define RICH_CbmRichUtil
6 #include "FairLogger.h"
7 #include "FairRootManager.h"
8 #include "FairTrackParam.h"
10 #include "TClonesArray.h"
21 vector<Double_t>
v = GetRingTrackDistanceImpl(globalTrackId);
26 vector<Double_t>
v = GetRingTrackDistanceImpl(globalTrackId);
31 vector<Double_t>
v = GetRingTrackDistanceImpl(globalTrackId);
36 return ((Address >> 16) & 0xFFFF);
46 vector<Double_t> errorVec = {999., 999., 999.};
47 FairRootManager* ioman = FairRootManager::Instance();
48 if (ioman == NULL)
return errorVec;
50 static TClonesArray* globalTracks = NULL;
51 static TClonesArray* richRings = NULL;
52 static TClonesArray* richProjections = NULL;
54 if (globalTracks == NULL || richRings == NULL || richProjections == NULL) {
56 globalTracks = (TClonesArray*) ioman->GetObject(
"GlobalTrack");
57 richRings = (TClonesArray*) ioman->GetObject(
"RichRing");
58 richProjections = (TClonesArray*) ioman->GetObject(
"RichProjection");
63 if (globalTracks == NULL || richRings == NULL || richProjections == NULL) {
64 LOG(error) <<
"CbmRichUtil::GetRingTrackDistance globalTracks, "
65 "richRings, richProjections NOT INITIALIZED"
71 static_cast<const CbmGlobalTrack*
>(globalTracks->At(globalTrackId));
72 if (globalTrack == NULL)
return errorVec;
75 if (stsId < 0)
return errorVec;
77 const FairTrackParam* pTrack =
78 static_cast<const FairTrackParam*
>(richProjections->At(stsId));
79 if (pTrack == NULL)
return errorVec;
81 if (pTrack->GetX() == 0 && pTrack->GetY() == 0)
return errorVec;
84 if (richId < 0)
return errorVec;
87 static_cast<const CbmRichRing*
>(richRings->At(richId));
88 if (richRing == NULL)
return errorVec;
92 Double_t dx = richRing->
GetCenterX() - pTrack->GetX();
93 Double_t dy = richRing->
GetCenterY() - pTrack->GetY();
95 Double_t dist = TMath::Sqrt(dx * dx + dy * dy);
97 vector<Double_t>
v = {dist, dx, dy};