32 vector<Double_t> errorVec = {999., 999., 999.};
33 FairRootManager* ioman = FairRootManager::Instance();
34 if (ioman == NULL)
return errorVec;
36 static TClonesArray* globalTracks = NULL;
37 static TClonesArray* richRings = NULL;
38 static TClonesArray* richProjections = NULL;
40 if (globalTracks == NULL || richRings == NULL || richProjections == NULL) {
42 globalTracks = (TClonesArray*) ioman->GetObject(
"GlobalTrack");
43 richRings = (TClonesArray*) ioman->GetObject(
"RichRing");
44 richProjections = (TClonesArray*) ioman->GetObject(
"RichProjection");
50 if (globalTracks == NULL || richRings == NULL || richProjections == NULL) {
51 LOG(error) <<
"CbmRichUtil::GetRingTrackDistance globalTracks, "
52 "richRings, richProjections NOT INITIALIZED"
58 if (globalTrack == NULL)
return errorVec;
61 if (stsId < 0)
return errorVec;
63 const FairTrackParam* pTrack =
static_cast<const FairTrackParam*
>(richProjections->At(stsId));
64 if (pTrack == NULL)
return errorVec;
66 if (pTrack->GetX() == 0 && pTrack->GetY() == 0)
return errorVec;
69 if (richId < 0)
return errorVec;
72 if (richRing == NULL)
return errorVec;
76 Double_t dx = richRing->
GetCenterX() - pTrack->GetX();
77 Double_t dy = richRing->
GetCenterY() - pTrack->GetY();
79 Double_t dist = TMath::Sqrt(dx * dx + dy * dy);
81 vector<Double_t>
v = {dist, dx, dy};
91 vector<double> initVec;
93 for (
int pmtId : pmts) {
95 TVector3 inPos(pmtData->
fX, pmtData->
fY, pmtData->
fZ);
99 initVec.push_back(outPos.X() - 0.5 * pmtData->
fWidth);
100 initVec.push_back(outPos.X() + 0.5 * pmtData->
fWidth);
103 initVec.push_back(outPos.Y() - 0.5 * pmtData->
fHeight);
104 initVec.push_back(outPos.Y() + 0.5 * pmtData->
fHeight);
107 sort(initVec.begin(), initVec.end());
109 vector<double> uniVec;
110 for (
size_t i = 0; i < initVec.size(); i++) {
111 if (i == 0) uniVec.push_back(initVec[i]);
112 if (initVec[i] - uniVec[uniVec.size() - 1] > 0.000001) uniVec.push_back(initVec[i]);
static std::vector< double > GetRingTrackDistanceImpl(int globalTrackId)
Return a vector with total distance and x, y components. [0] - total distance, [1] - x component,...