9 #include <FairLogger.h>
35 FairRootManager* ioman = FairRootManager::Instance();
36 if (
nullptr == ioman) LOG(fatal) <<
"No FairRootManager";
41 if (
nullptr == mcManager) LOG(fatal) <<
"No MC data manager";
43 if (
nullptr ==
fMCTracks) LOG(fatal) <<
"No MC tracks";
45 if (
nullptr ==
fStsMCPoints) LOG(fatal) <<
"No STS MC points";
47 if (
nullptr ==
fTofMCPoints) LOG(fatal) <<
"No ToF MC points";
54 LOG(fatal) <<
"No STS digi matches";
58 fStsClusters =
static_cast<TClonesArray*
>(ioman->GetObject(
"StsCluster"));
59 if (
nullptr ==
fStsClusters) LOG(fatal) <<
"No STS clusters";
60 fStsHits =
static_cast<TClonesArray*
>(ioman->GetObject(
"StsHit"));
61 if (
nullptr ==
fStsHits) LOG(fatal) <<
"No STS hits";
62 fStsTracks =
static_cast<TClonesArray*
>(ioman->GetObject(
"StsTrack"));
63 if (
nullptr ==
fStsTracks) LOG(fatal) <<
"No STS tracks";
66 fTofHits =
static_cast<TClonesArray*
>(ioman->GetObject(
"TofHit"));
67 if (
nullptr ==
fTofHits) LOG(fatal) <<
"No ToF hits";
68 fTofHitMatches =
static_cast<TClonesArray*
>(ioman->GetObject(
"TofHitMatch"));
72 fGlobalTracks =
static_cast<TClonesArray*
>(ioman->GetObject(
"GlobalTrack"));
73 if (
nullptr ==
fGlobalTracks) LOG(fatal) <<
"No global tracks";
81 if (nofTracks > 0)
fTracks[
i].resize(nofTracks);
83 vector<TrackData>& evTracks =
fTracks[
i];
85 for (
int j = 0; j < nofTracks; ++j) {
100 track.
parent = &evTracks[motherId];
101 evTracks[motherId].
offsprings.push_back(&track);
112 if (nofStsPoints > 0)
fStsPoints[
i].resize(nofStsPoints);
116 for (
int j = 0; j < nofStsPoints; ++j) {
122 Int_t trackId = stsPoint->GetTrackID();
125 point.
track = &track;
129 point.
t = stsPoint->GetTime();
139 if (nofTofPoints > 0)
fTofPoints[
i].resize(nofTofPoints);
143 for (
int j = 0; j < nofTofPoints; ++j) {
149 Int_t trackId = tofPoint->GetTrackID();
151 point.
track = &track;
152 point.
x = tofPoint->GetX();
153 point.
y = tofPoint->GetY();
154 point.
z = tofPoint->GetZ();
155 point.
t = tofPoint->GetTime();
158 if (track.
z > 0 && !track.
use) {
159 double deltaZ = point.
z - track.
z;
160 track.
tx = (point.
x - track.
x) / deltaZ;
161 track.
ty = (point.
y - track.
y) / deltaZ;
172 bool deepSearch)
const {
173 set<TrackData*> tofMCTracks;
179 for (Int_t j = 0; j < nofTofPoints; ++j) {
181 Int_t evN = pointLnk.
GetEntry() - 1;
182 Int_t pointInd = pointLnk.
GetIndex();
183 tofMCTracks.insert(
fTofPoints[evN][pointInd].track);
187 for (set<TrackData*>::const_iterator
i = tofMCTracks.begin();
188 i != tofMCTracks.end();
193 for (
const TrackData* mcTrack = tofMCTrack; 0 != mcTrack;
194 mcTrack = mcTrack->
parent) {
195 if (mcTrack == stsMCTrack)
return true;
197 }
else if (tofMCTrack == stsMCTrack)
205 if (!mcTrack->
tofPoints.empty())
return true;
207 for (list<TrackData*>::const_iterator
i = mcTrack->
offsprings.begin();
231 Int_t nofHits =
fTofHits->GetEntriesFast();
233 for (
int i = 0;
i < nofHits; ++
i) {
238 for (Int_t k = 0; k < nofPoints; ++k) {
240 Int_t evN = pointLnk.
GetEntry() - 1;
241 Int_t pointInd = pointLnk.
GetIndex();
249 for (
int i = 0;
i < nofGlobalTracks; ++
i) {
254 if (stsTrackInd < 0)
continue;
258 map<TrackData*, int> stsMCTracks;
260 int nofStsMatches = 0;
262 for (
int j = 0; j < nofStsHits; ++j) {
274 for (
int k = 0; k < nofFrontDigis; ++k) {
275 int stsDigiInd = frontCluster->
GetDigi(k);
280 for (
int l = 0; l < nofLinks; ++l) {
285 map<TrackData*, int>::iterator iter =
286 stsMCTracks.find(
fStsPoints[eventId][mcPointId].track);
288 if (iter != stsMCTracks.end())
291 stsMCTracks[
fStsPoints[eventId][mcPointId].track] = 1;
297 for (
int k = 0; k < nofBackDigis; ++k) {
298 int stsDigiInd = backCluster->
GetDigi(k);
303 for (
int l = 0; l < nofLinks; ++l) {
308 map<TrackData*, int>::iterator iter =
309 stsMCTracks.find(
fStsPoints[eventId][mcPointId].track);
311 if (iter != stsMCTracks.end())
314 stsMCTracks[
fStsPoints[eventId][mcPointId].track] = 1;
319 if (stsMCTracks.empty())
continue;
321 map<TrackData*, int>::iterator lastStsTrackIter = stsMCTracks.end();
324 if (lastStsTrackIter->second < 0.7 * nofStsMatches)
continue;
328 if (lastStsTrackIter->first->tofPoints.empty()) {
332 if (tofHitInd >= 0) {
333 if (
CheckMatch(lastStsTrackIter->first, tofHitInd,
true))
349 if (lastStsTrackIter->first->tofPoints.empty()
350 || lastStsTrackIter->first->tofHits.empty())
360 if (
CheckMatch(lastStsTrackIter->first, tofHitInd))
370 cout <<
"The correctly merged reference tracks: " << eff <<
" % ["
375 cout <<
"The incorrectly merged reference tracks: " << eff <<
" % ["
380 cout <<
"The non merged reference tracks: " << eff <<
" % ["
386 cout <<
"The correctly merged semi ToF tracks: " << eff <<
" % ["
391 cout <<
"The incorrectly merged semi ToF tracks: " << eff <<
" % ["
396 cout <<
"The non merged semi ToF tracks: " << eff <<
" % ["
402 cout <<
"The merged non ToF tracks: " << eff <<
" % ["
406 cout <<
"The non merged non ToF tracks: " << eff <<
" % ["