14 #include "FairRootManager.h"
16 #include "TClonesArray.h"
113 FairRootManager*
rootMgr = FairRootManager::Instance();
115 cout <<
"-E- CbmL1TrackMerger::Init : "
116 <<
"FairRootManager is not instantiated!" << endl;
120 L1_DYNAMIC_CAST<TClonesArray*>(
rootMgr->GetObject(
"StsTrackMatch"));
122 cout <<
"-W- CbmL1TrackMerger::Init : "
123 <<
"no STS track match array" << endl;
126 L1_DYNAMIC_CAST<TClonesArray*>(
rootMgr->GetObject(
"TrdTrackMatch"));
128 cout <<
"-W- CbmL1TrackMerger::Init : "
129 <<
"no TRD track match array" << endl;
137 TClonesArray* trdTracks,
138 TClonesArray* glbTracks) {
141 return MergeSimple(stsTracks, trdTracks, glbTracks);
145 cout <<
"-E- CbmL1TrackMerger::DoMerge : "
146 <<
"unknown method " <<
fMethod << endl;
155 TClonesArray* trdTracks,
156 TClonesArray* glbTracks) {
164 map<Int_t, Int_t> mapStsTrackUsed;
168 for (Int_t iTrdTrack = 0; iTrdTrack < trdTracks->GetEntriesFast();
171 trdTrack = L1_DYNAMIC_CAST<CbmTrdTrack*>(trdTracks->At(iTrdTrack));
172 if (NULL == trdTrack)
continue;
182 cout <<
"-I- CbmL1TrackMerger::MergeSimple" << endl
183 <<
" global track : " << nGlb - 1
186 <<
" trd track : " << iTrdTrack << endl;
191 for (Int_t iSts = 0; iSts < stsTracks->GetEntriesFast(); iSts++) {
193 if (mapStsTrackUsed[iSts])
continue;
199 cout <<
"-I- CbmL1TrackMerger::MergeSimple" << endl
200 <<
" global track : " << nGlb - 1
201 <<
" sts track : " << iSts
202 <<
" trd track : " << -1 << endl;
213 TClonesArray* trdTracks,
214 TClonesArray* glbTracks) {
217 if (!stsTracks || !trdTracks || !glbTracks)
return 0;
239 map<Int_t, Bool_t> mapTrdTrackUsed;
242 for (Int_t iStsTrack = 0; iStsTrack < stsTracks->GetEntriesFast();
245 stsTrack = L1_DYNAMIC_CAST<CbmStsTrack*>(stsTracks->At(iStsTrack));
246 if (NULL == stsTrack)
continue;
247 stsTrackM = L1_DYNAMIC_CAST<CbmTrackMatch*>(
fArrayStsTrackM->At(iStsTrack));
248 if (NULL == stsTrackM)
continue;
252 glbTrack = L1_DYNAMIC_CAST<CbmGlobalTrack*>(glbTracks->At(nGlb));
253 if (NULL == glbTrack)
continue;
260 Double_t minChi2XY = 1e16;
261 Int_t indexOfClosest = -1;
262 for (Int_t iTrdTrack = 0; iTrdTrack < trdTracks->GetEntriesFast();
265 if (mapTrdTrackUsed[iTrdTrack])
continue;
267 trdTrack = L1_DYNAMIC_CAST<CbmTrdTrack*>(trdTracks->At(iTrdTrack));
268 if (NULL == trdTrack)
continue;
271 if (NULL == trdTrackM)
continue;
283 / TMath::Sqrt(1 + TMath::Power(kfTrack.
GetTrack()[2], 2)
284 + TMath::Power(kfTrack.
GetTrack()[3], 2)));
294 }
else if (theta < 10) {
296 }
else if (theta < 15) {
298 }
else if (theta < 20) {
300 }
else if (theta < 25) {
302 }
else if (theta < 30) {
304 }
else if (theta < 35) {
306 }
else if (theta < 40) {
311 if (TMath::Abs(dx) > dx_cut)
continue;
322 }
else if (theta < 10) {
324 }
else if (theta < 15) {
326 }
else if (theta < 20) {
328 }
else if (theta < 25) {
330 }
else if (theta < 30) {
332 }
else if (theta < 35) {
337 if (TMath::Abs(dy) > dy_cut)
continue;
348 }
else if (theta < 15) {
350 }
else if (theta < 20) {
352 }
else if (theta < 25) {
354 }
else if (theta < 30) {
356 }
else if (theta < 35) {
362 if (TMath::Abs(dtx) > dtx_cut)
continue;
370 if (TMath::Abs(dty) > dtx_cut)
continue;
374 kfTrack,
const_cast<FairTrackParam*
>(trdTrack->
GetParamFirst()));
376 if (chi2XY < minChi2XY) {
378 indexOfClosest = iTrdTrack;
381 if (indexOfClosest < 0)
continue;
384 mapTrdTrackUsed[indexOfClosest] = kTRUE;
389 for (Int_t iTrdTrack = 0; iTrdTrack < trdTracks->GetEntriesFast();
392 if (mapTrdTrackUsed[iTrdTrack])
continue;
395 glbTrack = L1_DYNAMIC_CAST<CbmGlobalTrack*>(glbTracks->At(nGlb));
396 if (NULL == glbTrack)
continue;
409 FairTrackParam* trackParam) {
411 Double_t dx = kfTrack.
GetTrack()[0] - trackParam->GetX();
412 Double_t dy = kfTrack.
GetTrack()[1] - trackParam->GetY();
413 Double_t c0 = kfTrack.
GetCovMatrix()[0] + trackParam->GetCovariance(0, 0);
414 Double_t c1 = kfTrack.
GetCovMatrix()[1] + trackParam->GetCovariance(0, 1);
415 Double_t c2 = kfTrack.
GetCovMatrix()[2] + trackParam->GetCovariance(1, 1);
416 Double_t chi2 = 0.5 * (dx * dx * c0 - 2 * dx * dy * c1 + dy * dy * c2)
417 / (c0 * c2 - c1 * c1);
427 fh_dx_true =
new TH2F(
"h_dx_true",
"", 200, -10., 10., 9, 0., 45.);
428 fh_dx_false =
new TH2F(
"h_dx_false",
"", 200, -10., 10., 9, 0., 45.);
430 fh_dy_true =
new TH2F(
"h_dy_true",
"", 200, -10., 10., 9, 0., 45.);
431 fh_dy_false =
new TH2F(
"h_dy_false",
"", 200, -10., 10., 9, 0., 45.);
433 fh_dtx_true =
new TH2F(
"h_dtx_true",
"", 200, -0.1, 0.1, 9, 0., 45.);
434 fh_dtx_false =
new TH2F(
"h_dtx_false",
"", 200, -0.1, 0.1, 9, 0., 45.);
436 fh_dty_true =
new TH2F(
"h_dty_true",
"", 200, -0.1, 0.1, 9, 0., 45.);
437 fh_dty_false =
new TH2F(
"h_dty_false",
"", 200, -0.1, 0.1, 9, 0., 45.);