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);
40 vector<Double_t> errorVec = {999., 999., 999.};
41 FairRootManager* ioman = FairRootManager::Instance();
42 if (ioman == NULL)
return errorVec;
44 static TClonesArray* globalTracks = NULL;
45 static TClonesArray* richRings = NULL;
46 static TClonesArray* richProjections = NULL;
48 if (globalTracks == NULL || richRings == NULL || richProjections == NULL) {
50 globalTracks = (TClonesArray*) ioman->GetObject(
"GlobalTrack");
51 richRings = (TClonesArray*) ioman->GetObject(
"RichRing");
52 richProjections = (TClonesArray*) ioman->GetObject(
"RichProjection");
57 if (globalTracks == NULL || richRings == NULL || richProjections == NULL) {
58 LOG(error) <<
"CbmRichUtil::GetRingTrackDistance globalTracks, "
59 "richRings, richProjections NOT INITIALIZED"
65 static_cast<const CbmGlobalTrack*
>(globalTracks->At(globalTrackId));
66 if (globalTrack == NULL)
return errorVec;
69 if (stsId < 0)
return errorVec;
71 const FairTrackParam* pTrack =
72 static_cast<const FairTrackParam*
>(richProjections->At(stsId));
73 if (pTrack == NULL)
return errorVec;
75 if (pTrack->GetX() == 0 && pTrack->GetY() == 0)
return errorVec;
78 if (richId < 0)
return errorVec;
81 static_cast<const CbmRichRing*
>(richRings->At(richId));
82 if (richRing == NULL)
return errorVec;
86 Double_t dx = richRing->
GetCenterX() - pTrack->GetX();
87 Double_t dy = richRing->
GetCenterY() - pTrack->GetY();
89 Double_t dist = TMath::Sqrt(dx * dx + dy * dy);
91 vector<Double_t>
v = {dist, dx, dy};