4#include "BmnFieldMap.h"
5#include "BmnGemStripHit.h"
6#include "BmnKalmanFilter.h"
9#include "BmnSiliconHit.h"
10#include "FairRunAna.h"
11#include "FairTrackParam.h"
87 cout <<
"======================== GEM tracking init started ====================" << endl;
92 FairRootManager* ioman = FairRootManager::Instance();
94 Fatal(
"Init",
"FairRootManager is not instantiated");
112 cout <<
"BmnInnerTrackingRun7::Init(): branch " <<
fGemHitsBranchName <<
" not found! Task will be deactivated"
115 return InitStatus::kERROR;
123 fField = FairRunAna::Instance()->GetField();
125 Fatal(
"Init",
"No Magnetic Field found");
129 TString gPathGemConfig = gPathConfig +
"/parameters/gem/XMLConfigs/";
130 TString confGem =
"GemRunSpring2018.xml";
133 TString gPathSiConfig = gPathConfig +
"/parameters/silicon/XMLConfigs/";
134 TString confSi =
"SiliconRunSpring2018.xml";
154 cout <<
"======================== GEM tracking init finished ===================" << endl;
162 cout <<
"\n======================== GEM tracking exec started ====================" << endl;
164 cout <<
"\n Event number: " <<
fEventNo << endl;
169 clock_t tStart = clock();
183 Double_t a[2][9] = {{1.29, 1.50, 1.33, 1.14, 1.17, 1.14, 1.00, 1.14, 1.14},
184 {1.33, 1.17, 1.00, 1.14, 1.33, 1.33, 1.14, 1.33, 1.33}};
185 Double_t b[2][9] = {{-645, -1500, -1330, -570, -585, -570, -500, -570, -570},
186 {500, 1000, 1000, 500, 500, 500, 500, 500, 500}};
194 if (Sl < a[0][iSt] * Su + b[0][iSt] || Sl > a[1][iSt] * Su + b[1][iSt]) {
203 innerHit.SetDxyz(0.5, 0.5, 0.5);
213 if (Sl < a[0][iSt] * Su + b[0][iSt] || Sl > a[1][iSt] * Su + b[1][iSt]) {
223 innerHit.SetDxyz(0.5, 0.5, 0.5);
257 clock_t tFinish = clock();
259 cout <<
"BmnInnerTrackingRun7: " <<
fGlobTracksArray->GetEntriesFast() <<
" tracks" << endl;
264 cout <<
"\n======================== GEM tracking exec finished ===================" << endl;
270 const Int_t nxRanges = 8;
271 const Int_t nyRanges = 5;
272 Double_t xRangeMin[nxRanges] = {-80, -60, -40, -20, 0, 20, 40, 60};
273 Double_t xRangeMax[nxRanges] = {-60, -40, -20, 0, 20, 40, 60, 80};
274 map<Short_t, vector<Double_t>> xRMS = {
275 {6, {7.0, 5.3, 4.4, 3.5, 3.4, 3.9, 5.1, 5.3}},
276 {7, {6.8, 6.3, 4.8, 3.7, 3.7, 4.5, 5.3, 6.0}},
277 {8, {6.0, 5.9, 5.2, 4.3, 3.4, 4.2, 4.8, 5.1}}};
278 Double_t yRangeMin[nyRanges] = {-10, 0, 10, 20, 30};
279 Double_t yRangeMax[nyRanges] = {0, 10, 20, 30, 40};
280 map<Short_t, vector<Double_t>> yRMS = {
281 {6, {0.8, 0.8, 0.9, 1.0, 0.9}},
282 {7, {0.9, 0.7, 1.0, 1.0, 0.9}},
283 {8, {0.5, 0.6, 0.8, 0.7, 0.7}}};
295 vector<BmnTrack> candidates;
296 vector<BmnTrack> sortedCandidates;
307 for (
BmnHit* hit8 : sortedHits[8]) {
308 for (
BmnHit* hit7 : sortedHits[7]) {
317 for (
iX = 0;
iX < nxRanges; ++
iX)
318 if (x8 > xRangeMin[
iX] && x8 < xRangeMax[
iX])
321 for (
iY = 0;
iY < nyRanges; ++
iY)
322 if (y8 > yRangeMin[
iY] && y8 < yRangeMax[
iY])
324 if ((
iX >= nxRanges) || (
iY >= nyRanges)) {
326 cout <<
"WARNING: x8 or y8 is out of range, the hit is skipped (x = " << x8 <<
", y = " << y8 <<
")"
333 if (
Abs(dxEx - dxTh) > rmsX ||
Abs(dyEx - dyTh) > rmsY)
335 for (
BmnHit* hit6 : sortedHits[6]) {
338 dxEx = x7 - hit6->GetX();
339 dxTh = x7 * X7[1] + X7[0];
340 dyEx = y7 - hit6->GetY();
341 dyTh = y7 * Y7[1] + Y7[0];
344 for (
iX = 0;
iX < nxRanges; ++
iX)
345 if (x7 > xRangeMin[
iX] && x7 < xRangeMax[
iX])
348 for (
iY = 0;
iY < nyRanges; ++
iY)
349 if (y7 > yRangeMin[
iY] && y7 < yRangeMax[
iY])
351 if ((
iX >= nxRanges) || (
iY >= nyRanges)) {
353 cout <<
"WARNING: x7 or y7 is out of range, the hit is skipped (x = " << x7 <<
", y = " << y7
357 rmsX = 2.0 * xRMS[7][
iX];
358 rmsY = 3.0 * yRMS[7][
iY];
360 if (
Abs(dxEx - dxTh) > rmsX ||
Abs(dyEx - dyTh) > rmsY)
362 for (
BmnHit* hit5 : sortedHits[5]) {
365 dxEx = x6 - hit5->GetX();
366 dxTh = x6 * X6[1] + X6[0];
367 dyEx = y6 - hit5->GetY();
368 dyTh = y6 * Y6[1] + Y6[0];
371 for (
iX = 0;
iX < nxRanges; ++
iX)
372 if (x6 > xRangeMin[
iX] && x6 < xRangeMax[
iX])
375 for (
iY = 0;
iY < nyRanges; ++
iY)
376 if (y6 > yRangeMin[
iY] && y6 < yRangeMax[
iY])
378 if ((
iX >= nxRanges) || (
iY >= nyRanges)) {
380 cout <<
"WARNING: x6 or y6 is out of range, the hit is skipped (x = " << x6
381 <<
", y = " << y6 <<
")" << endl;
384 rmsX = 2.0 * xRMS[6][
iX];
385 rmsY = 3.0 * yRMS[6][
iY];
387 if (
Abs(dxEx - dxTh) > rmsX ||
Abs(dyEx - dyTh) > rmsY)
390 cand.
AddHit(hit8->GetRefIndex(), hit8);
391 cand.
AddHit(hit7->GetRefIndex(), hit7);
392 cand.
AddHit(hit6->GetRefIndex(), hit6);
393 cand.
AddHit(hit5->GetRefIndex(), hit5);
395 candidates.push_back(cand);
420 cand.SetNDF(cand.GetNHits() * 2 - 5);
443 vector<BmnTrack>& candidates,
444 vector<BmnHit*>* sortedHits)
448 const Int_t nxRanges = 8;
449 const Int_t nyRanges = 5;
450 Double_t xRangeMin[nxRanges] = {-80, -60, -40, -20, 0, 20, 40, 60};
451 Double_t xRangeMax[nxRanges] = {-60, -40, -20, 0, 20, 40, 60, 80};
453 map<Short_t, vector<Double_t>> xRMS = {
454 {6, {7.0, 5.3, 4.4, 3.5, 3.4, 3.9, 5.1, 5.3}},
455 {7, {6.8, 6.3, 4.8, 3.7, 3.7, 4.5, 5.3, 6.0}},
456 {8, {6.0, 5.9, 5.2, 4.3, 3.4, 4.2, 4.8, 5.1}}};
457 Double_t yRangeMin[nyRanges] = {-10, 0, 10, 20, 30};
458 Double_t yRangeMax[nyRanges] = {0, 10, 20, 30, 40};
459 map<Short_t, vector<Double_t>> yRMS = {
460 {6, {0.8, 0.8, 0.9, 1.0, 0.9}},
461 {7, {0.9, 0.7, 1.0, 1.0, 0.9}},
462 {8, {0.5, 0.6, 0.8, 0.7, 0.7}}};
463 map<Short_t, vector<Double_t>> xMap = {
467 map<Short_t, vector<Double_t>> yMap = {
472 for (
BmnHit* hit2 : sortedHits[st2]) {
473 for (
BmnHit* hit1 : sortedHits[st1]) {
479 Double_t dxTh =
Abs(x2 * xMap[st2][1] + xMap[st2][0]);
481 Double_t dyTh =
Abs(y2 * yMap[st2][1] + yMap[st2][0]);
484 for (
iX = 0;
iX < nxRanges; ++
iX)
485 if (x2 > xRangeMin[
iX] && x2 < xRangeMax[
iX])
488 for (
iY = 0;
iY < nyRanges; ++
iY)
489 if (y2 > yRangeMin[
iY] && y2 < yRangeMax[
iY])
491 if ((
iX >= nxRanges) || (
iY >= nyRanges)) {
493 cout <<
"WARNING: x2 or y2 is out of range, the hit is skipped (x = " << x2 <<
", y = " << y2 <<
")"
500 if (
Abs(dxEx - dxTh) > rmsX ||
Abs(dyEx - dyTh) > rmsY)
502 for (
BmnHit* hit0 : sortedHits[st0]) {
503 dxEx =
Abs(x1 - hit0->GetX());
504 dxTh =
Abs(x1 * xMap[st1][1] + xMap[st1][0]);
505 dyEx =
Abs(y1 - hit0->GetY());
506 dyTh =
Abs(y1 * yMap[st1][1] + yMap[st1][0]);
509 for (
iX = 0;
iX < nxRanges; ++
iX)
510 if (x1 > xRangeMin[
iX] && x1 < xRangeMax[
iX])
513 for (
iY = 0;
iY < nyRanges; ++
iY)
514 if (y1 > yRangeMin[
iY] && y1 < yRangeMax[
iY])
516 if ((
iX >= nxRanges) || (
iY >= nyRanges)) {
518 cout <<
"WARNING: x1 or y1 is out of range, the hit is skipped (x = " << x1 <<
", y = " << y1
522 rmsX = 2.0 * xRMS[st1][
iX];
523 rmsY = 3.0 * yRMS[st1][
iY];
525 if (
Abs(dxEx - dxTh) > rmsX ||
Abs(dyEx - dyTh) > rmsY)
528 cand.
AddHit(hit2->GetRefIndex(), hit2);
529 cand.
AddHit(hit1->GetRefIndex(), hit1);
530 cand.
AddHit(hit0->GetRefIndex(), hit0);
533 candidates.push_back(cand);
548 vector<BmnTrack> candidates;
549 vector<BmnTrack> sortedCandidates;
571 cand.SetNDF(cand.GetNHits() * 2 - 5);
591 if (sortedHits.size() == 0)
599 fKalman->TGeoTrackPropagate(&par, sortedHits.at(0)->GetZ(), 2212,
nullptr,
nullptr);
601 for (
BmnHit* hit : sortedHits) {
604 Double_t d =
Sqrt(
Sq(par.GetX() - hit->GetX()) +
Sq(par.GetY() - hit->GetY()));
614 cand->
AddHit(minHit->GetRefIndex(), minHit);
617 fKalman->Update(&par, minHit, chi2);
633 vector<BmnTrack>& candidates,
634 vector<BmnHit*>* sortedHits)
636 for (
BmnHit* hit1 : sortedHits[st1]) {
639 for (
BmnHit* hit0 : sortedHits[st0]) {
642 if (
Abs(hit1->GetX() - hit0->GetX()) > 40.0 ||
Abs(y1 - y0) > 20.0)
645 cand.
AddHit(hit1->GetRefIndex(), hit1);
646 cand.
AddHit(hit0->GetRefIndex(), hit0);
648 Double_t b = (z1 * y0 - y1 * z0) / (z1 - z0);
651 for (
BmnHit* hit : sortedHits[4]) {
652 Double_t d =
Abs(hit->GetY() - (a * hit->GetZ() + b));
653 if (d < minDist && d < 0.5) {
659 cand.
AddHit(minHit->GetRefIndex(), minHit);
663 for (
BmnHit* hit : sortedHits[3]) {
664 Double_t d =
Abs(hit->GetY() - (a * hit->GetZ() + b));
665 if (d < minDist && d < 0.5) {
671 cand.
AddHit(minHit->GetRefIndex(), minHit);
674 candidates.push_back(cand);
687 vector<BmnTrack> candidates;
688 vector<BmnTrack> sortedCandidates;
689 for (
BmnHit* hit1 : sortedHits[4]) {
692 for (
BmnHit* hit0 : sortedHits[3]) {
695 if (
Abs(hit1->GetX() - hit0->GetX()) > 40.0 ||
Abs(y1 - y0) > 10.0)
698 cand.
AddHit(hit1->GetRefIndex(), hit1);
699 cand.
AddHit(hit0->GetRefIndex(), hit0);
701 Double_t b = (z1 * y0 - y1 * z0) / (z1 - z0);
705 for (
BmnHit* hit : sortedHits[5]) {
706 Double_t d =
Abs(hit->GetY() - (a * hit->GetZ() + b));
713 cand.
AddHit(minHit->GetRefIndex(), minHit);
732 candidates.push_back(cand);
736 for (
BmnHit* hit : sortedHits[6]) {
737 Double_t d =
Abs(hit->GetY() - (a * hit->GetZ() + b));
744 cand.
AddHit(minHit->GetRefIndex(), minHit);
762 candidates.push_back(cand);
766 for (
BmnHit* hit : sortedHits[7]) {
767 Double_t d =
Abs(hit->GetY() - (a * hit->GetZ() + b));
774 cand.
AddHit(minHit->GetRefIndex(), minHit);
791 candidates.push_back(cand);
795 for (
BmnHit* hit : sortedHits[8]) {
796 Double_t d =
Abs(hit->GetY() - (a * hit->GetZ() + b));
803 cand.
AddHit(minHit->GetRefIndex(), minHit);
817 candidates.push_back(cand);
821 for (
BmnHit* hit : sortedHits[2]) {
822 Double_t d =
Abs(hit->GetY() - (a * hit->GetZ() + b));
829 cand.
AddHit(minHit->GetRefIndex(), minHit);
842 candidates.push_back(cand);
846 for (
BmnHit* hit : sortedHits[1]) {
847 Double_t d =
Abs(hit->GetY() - (a * hit->GetZ() + b));
854 cand.
AddHit(minHit->GetRefIndex(), minHit);
866 candidates.push_back(cand);
896 vector<BmnTrack> candidates;
897 vector<BmnTrack> sortedCandidates;
898 for (
BmnHit* hit1 : sortedHits[4]) {
901 for (
BmnHit* hit0 : sortedHits[3]) {
904 if (
Abs(hit1->GetX() - hit0->GetX()) > 40.0 ||
Abs(y1 - y0) > 10.0)
907 cand.
AddHit(hit1->GetRefIndex(), hit1);
908 cand.
AddHit(hit0->GetRefIndex(), hit0);
910 Double_t b = (z1 * y0 - y1 * z0) / (z1 - z0);
913 for (
BmnHit* hit : sortedHits[2]) {
914 Double_t d =
Abs(hit->GetY() - (a * hit->GetZ() + b));
921 cand.
AddHit(minHit->GetRefIndex(), minHit);
925 for (
BmnHit* hit : sortedHits[1]) {
926 Double_t d =
Abs(hit->GetY() - (a * hit->GetZ() + b));
933 cand.
AddHit(minHit->GetRefIndex(), minHit);
936 candidates.push_back(cand);
960 cand.SetNDF(cand.GetNHits() * 2 - 5);
979 multimap<Float_t, Int_t> sortedMap[
n];
981 for (
size_t iTr = 0; iTr < inTracks.size(); ++iTr) {
984 if (inTracks.at(iTr).GetChi2() / inTracks.at(iTr).GetNDF() >
fChiSquareCut)
986 sortedMap[inTracks.at(iTr).GetNHits() -
fNHitsCut].insert(
987 pair<Float_t, Int_t>(inTracks.at(iTr).GetChi2() / inTracks.at(iTr).GetNDF(), iTr));
991 for (
auto it : sortedMap[
i])
992 sortedTracks.push_back(inTracks.at(it.second));
993 sortedMap[
i].clear();
1010 outFile.open(
"QA/timing.txt");
1011 outFile <<
"Track Finder Time: " <<
workTime << endl;
1024 cout <<
"Work time of the GEM tracking: " <<
workTime << endl;
1037 hit->SetRefIndex(iHit);
1042 sortedHits[station].push_back(hit);
1058 cand.
SetChi2((chiX - chiY) > 0. ? chiX : chiY);
1076 FairTrackParam par = *(cand.GetParamFirst());
1079 for (
Int_t iHit = 0; iHit < cand.GetNHits(); ++iHit) {
1082 fKalman->TGeoTrackPropagate(&par, hit->GetZ(), 2212,
nullptr,
nullptr);
1083 fKalman->Update(&par, hit, chi);
1085 cand.SetParamLast(par);
1086 for (
Int_t iHit = cand.GetNHits() - 1; iHit >= 0; iHit--) {
1089 fKalman->TGeoTrackPropagate(&par, hit->GetZ(), 2212,
nullptr,
nullptr);
1090 fKalman->Update(&par, hit, chi);
1093 cand.SetParamFirst(par);
1094 cand.SetChi2(chiTot);
1125 for (
size_t iTr = 0; iTr < sortedTracks.size(); ++iTr) {
1135 globTr.
AddHit(hit->GetRefIndex(), hit);
1136 DetectorId detId = hit->
GetDetId();
1139 else if (detId ==
kGEM)
1205 const UInt_t nHits = tr->
GetNHits();
1211 fField = FairRunAna::Instance()->GetField();
1216 Double_t sumX(0.0), sumY(0.0), sumTx(0.0), sumTy(0.0), sumQP(0.0);
1217 Double_t sumXX(0.0), sumXY(0.0), sumXTx(0.0), sumXTy(0.0), sumXQP(0.0);
1218 Double_t sumYY(0.0), sumYTx(0.0), sumYTy(0.0), sumYQP(0.0);
1219 Double_t sumTxTx(0.0), sumTxTy(0.0), sumTxQP(0.0);
1220 Double_t sumTyTy(0.0), sumTyQP(0.0);
1223 for (UInt_t
i = 0;
i < nHits; ++
i) {
1231 Double_t Txi = -1.0 * (Zi - Zc) / (Xi - Xc);
1250 sumTxTx += Txi * Txi;
1251 sumTxTy += Txi * Tyi;
1252 sumTxQP += Txi * QPi;
1253 sumTyTy += Tyi * Tyi;
1254 sumTyQP += Tyi * QPi;
1255 sumQPQP += QPi * QPi;
1264 Double_t Cov_X_X = sumXX / nHits -
Sq(meanX);
1265 Double_t Cov_X_Y = sumXY / nHits - meanX * meanY;
1266 Double_t Cov_X_Tx = sumXTx / nHits - meanX * meanTx;
1267 Double_t Cov_X_Ty = sumXTy / nHits - meanX * meanTy;
1268 Double_t Cov_X_Qp = sumXQP / nHits - meanX * meanQP;
1269 Double_t Cov_Y_Y = sumYY / nHits -
Sq(meanY);
1270 Double_t Cov_Y_Tx = sumYTx / nHits - meanY * meanTx;
1271 Double_t Cov_Y_Ty = sumYTy / nHits - meanY * meanTy;
1272 Double_t Cov_Y_Qp = sumYQP / nHits - meanY * meanQP;
1273 Double_t Cov_Tx_Tx = sumTxTx / nHits -
Sq(meanTx);
1274 Double_t Cov_Tx_Ty = sumTxTy / nHits - meanTx * meanTy;
1275 Double_t Cov_Tx_Qp = sumTxQP / nHits - meanTx * meanQP;
1276 Double_t Cov_Ty_Ty = sumTyTy / nHits -
Sq(meanTy);
1277 Double_t Cov_Ty_Qp = sumTyQP / nHits - meanTy * meanQP;
1278 Double_t Cov_Qp_Qp = sumQPQP / nHits -
Sq(meanQP);
1281 par.SetCovariance(0, 0, Cov_X_X);
1282 par.SetCovariance(0, 1, Cov_X_Y);
1283 par.SetCovariance(0, 2, Cov_X_Tx);
1284 par.SetCovariance(0, 3, Cov_X_Ty);
1285 par.SetCovariance(0, 4, Cov_X_Qp);
1286 par.SetCovariance(1, 1, Cov_Y_Y);
1287 par.SetCovariance(1, 2, Cov_Y_Tx);
1288 par.SetCovariance(1, 3, Cov_Y_Ty);
1289 par.SetCovariance(1, 4, Cov_Y_Qp);
1290 par.SetCovariance(2, 2, Cov_Tx_Tx);
1291 par.SetCovariance(2, 3, Cov_Tx_Ty);
1292 par.SetCovariance(2, 4, Cov_Tx_Qp);
1293 par.SetCovariance(3, 3, Cov_Ty_Ty);
1294 par.SetCovariance(3, 4, Cov_Ty_Qp);
1295 par.SetCovariance(4, 4, Cov_Qp_Qp);
1310 const UInt_t nHits = tr->
GetNHits();
1314 if (lineParZY.
Z() > 1)
1349 for (
size_t iSegm = 0; iSegm < QpSegm.size(); iSegm++)
1350 QpSum += QpSegm[iSegm];
1352 Double_t QpMean = QpSum / QpSegm.size();
1355 for (
size_t iSegm = 0; iSegm < QpSegm.size(); iSegm++)
1356 sqSigmaSum +=
Sq(QpSegm[iSegm] - QpMean);
1358 return TVector2(QpMean,
Sqrt(sqSigmaSum / QpSegm.size()));
1365 vector<BmnHit*> hits;
1373 vector<Double_t> QpSegmBefore;
1376 for (
Int_t iHit = 0; iHit < kNSegm; iHit++) {
1377 BmnHit* first = hits[iHit];
1378 BmnHit* second = hits[iHit + 1];
1379 BmnHit* third = hits[iHit + 2];
1388 * (
Abs(
fField->GetBy(third->GetX(), third->GetY(), third->GetZ()))
1389 +
Abs(
fField->GetBy(second->GetX(), second->GetY(), second->GetZ()))
1390 +
Abs(
fField->GetBy(first->GetX(), first->GetY(), first->GetZ())))
1399 Double_t Tx_first = h * (fZ - Zc) / (fX - Xc);
1410 QpSegmBefore.push_back(QP);
1415 vector<Double_t> QpSegmAfter;
1420 if (std::isnan(sigma) && fVerbose == 3) {
1421 cout <<
"Bad refit convergence for track segment!!" << endl;
1425 for (
size_t iSegm = 0; iSegm < QpSegmBefore.size(); iSegm++)
1426 if (
Abs(QpSegmBefore[iSegm] - mean) - sigma <= 0.001)
1427 QpSegmAfter.push_back(QpSegmBefore[iSegm]);
1429 if (QpSegmAfter.size() == QpSegmBefore.size()) {
1433 QpSegmBefore.clear();
1434 QpSegmBefore.resize(0);
1436 for (
size_t iSegm = 0; iSegm < QpSegmAfter.size(); iSegm++)
1437 QpSegmBefore.push_back(QpSegmAfter[iSegm]);
1439 QpSegmAfter.clear();
1440 QpSegmAfter.resize(0);
1449 for (
size_t iEle = 0; iEle < QpSegmBefore.size(); iEle++)
1450 QpRefit += QpSegmBefore[iEle];
1452 QpRefit /= QpSegmBefore.size();
1454 vector<Double_t> d =
dist(QpSegmBefore, QpRefit);
1457 for (
size_t i = 0;
i < QpSegmBefore.size();
i++)
1458 sigma += (QpSegmBefore[
i] - QpRefit) * (QpSegmBefore[
i] - QpRefit);
1459 sigma =
Sqrt(sigma / QpSegmBefore.size());
1461 vector<Double_t> w =
W(d, sigma);
1462 sigma =
Sigma(d, w);
1464 const Int_t kNIter = 20;
1465 for (
Int_t iIter = 1; iIter < kNIter; iIter++) {
1466 QpRefit =
Mu(QpSegmBefore, w);
1467 d =
dist(QpSegmBefore, QpRefit);
1469 sigma =
Sigma(d, w);
1481 vector<Double_t> X, Y, Z;
1486 X.push_back(hit->GetX());
1487 Y.push_back(hit->GetY());
1488 Z.push_back(hit->GetZ());
1492 for (
size_t i = 0;
i < X.size() - 1;
i++) {
1496 length +=
Sqrt(dX * dX + dY * dY + dZ * dZ);
1506 const Int_t kNSharedHits = 1;
1508 for (
size_t iTr = 0; iTr < sortedTracks.size(); ++iTr) {
1509 BmnTrack* tr = &(sortedTracks.at(iTr));
1513 Int_t nofSharedHits = 0;
1515 for (
Int_t iHit = 0; iHit < nofHits; iHit++)
1516 if (hitsId.find(tr->
GetHitIndex(iHit)) != hitsId.end()) {
1518 if (nofSharedHits > kNSharedHits) {
1526 for (
Int_t iHit = 0; iHit < nofHits; iHit++)
1536 TH2F* h_HitsZX =
new TH2F(
"h_HitsZX",
"h_HitsZX", 400, 0.0, 200.0, 400, -100.0, 100.0);
1537 TH2F* h_HitsZY =
new TH2F(
"h_HitsZY",
"h_HitsZY", 400, 0.0, 200.0, 400, -10.0, 50.0);
1540 h_HitsZX->
Fill(hit->GetZ(), hit->GetX());
1541 h_HitsZY->
Fill(hit->GetZ(), hit->GetY());
1550 h_HitsZX->
Draw(
"P");
1556 h_HitsZY->
Draw(
"P");
1570 if (glTrack->GetSilTrackIndex() != -1) {
1582 TLine* lineZX =
new TLine(z, x, zPrev, xPrev);
1585 TLine* lineZY =
new TLine(z, y, zPrev, yPrev);
1589 lineZX->
Draw(
"same");
1591 lineZY->
Draw(
"same");
1603 if (glTrack->GetSilTrackIndex() == -1) {
1610 for (
Int_t iHit = startIdx; iHit < gemTr->
GetNHits(); iHit++) {
1615 TLine* lineZX =
new TLine(z, x, zPrev, xPrev);
1618 TLine* lineZY =
new TLine(z, y, zPrev, yPrev);
1622 lineZX->
Draw(
"same");
1624 lineZY->
Draw(
"same");
static Double_t CalculateTrackParTime
static Double_t construct_3of4_time
static Double_t sortTrackTime
static Double_t construct_4of4_time
static Double_t trackUpdateTime
static Double_t construct_2of4_time
static Double_t hitMatchTimeLoop
static Double_t SortHitsTime
static Double_t trackSelectionTime
static Double_t hitMatchTime
TVector3 LineFit(BmnTrack *track, const TClonesArray *arr, TString type)
TVector3 CircleBy3Hit(BmnTrack *track, const TClonesArray *arr)
Double_t Mu(vector< Double_t > qp, vector< Double_t > w)
TVector3 CircleFit(BmnTrack *track, const TClonesArray *arr, Double_t &chi2)
Double_t CalcTx(const BmnHit *h0, const BmnHit *h1, const BmnHit *h2)
vector< Double_t > dist(vector< Double_t > qp, Double_t mu)
Bool_t IsParCorrect(const FairTrackParam *par, const Bool_t isField)
vector< Double_t > W(vector< Double_t > dist, Double_t sig)
void Fatal(const char *location, const char *msgfmt,...)
R__EXTERN TSystem * gSystem
BmnStatus
Define status code.
Bool_t IsFieldOff() const
Whether magnetic field is off.
Double_t GetStripTotalSignalInUpperLayer()
Double_t GetStripTotalSignalInLowerLayer()
Strip layer characteristics of the hit (total signal, cluster size, strip position as the cluster mea...
void SetGemTrackIndex(Int_t iGem)
Modifiers.
Int_t GetGemTrackIndex() const
Accessors.
DetectorId GetDetId() const
void SetUsing(Bool_t use)
void SetDetId(DetectorId det)
void SetStation(Short_t st)
Short_t GetStation() const
BmnStatus FindTracks_3of4_OnLastGEMStations()
TString fGemTracksBranchName
BmnStatus MatchHit(BmnTrack *cand, vector< BmnHit * > sortedHits, Bool_t downstream)
BmnStatus FindCandidateByTwoStations(Short_t st0, Short_t st1, vector< BmnTrack > &candidates, vector< BmnHit * > *sortedHits)
TClonesArray * fSilPointsArray
TClonesArray * fMCTracksArray
TString fSilTracksBranchName
TClonesArray * fGemTracksArray
TClonesArray * fGlobTracksArray
BmnStatus FindCandidateByThreeStations(Short_t st0, Short_t st1, Short_t st2, vector< BmnTrack > &candidates, vector< BmnHit * > *sortedHits)
Double_t CalculateLength(BmnTrack *tr)
TClonesArray * fGemHitsArray
Bool_t fDoHitAsymFiltration
BmnStatus SortHits(vector< BmnHit * > *sortedHits)
TClonesArray * fSilHitsArray
BmnSiliconStationSet * fSilDetector
TString fGlobTracksBranchName
BmnStatus CalculateTrackParams(BmnTrack *tr)
virtual InitStatus Init()
void SetHitsUsing(BmnTrack *tr, Bool_t use)
TClonesArray * fGemPointsArray
TClonesArray * fHitsArray
BmnStatus FindTracks_2of2_OnFirstGEMStationsDownstream()
Short_t fNSiliconStations
BmnGemStripStationSet * fGemDetector
BmnStatus CheckSharedHits(vector< BmnTrack > &sortedTracks)
TString fSilHitsBranchName
BmnStatus SortTracks(vector< BmnTrack > &inTracks, vector< BmnTrack > &sortedTracks)
BmnStatus FindTracks_4of4_OnLastGEMStations()
Double_t CalcQp(BmnTrack *track, Bool_t doSimple)
BmnStatus FindTracks_2of2_OnFirstGEMStationsUpstream()
TVector2 CalcMeanSigma(vector< Double_t >)
BmnKalmanFilter * fKalman
BmnStatus TrackUpdateByKalman(vector< BmnTrack > &cands)
virtual ~BmnInnerTrackingRun7()
BmnStatus TrackUpdateByLine(vector< BmnTrack > &cands)
BmnStatus TrackSelection(vector< BmnTrack > &cands)
TString fGemHitsBranchName
BmnStatus CalcCovMatrix(BmnTrack *tr)
TClonesArray * fSilTracksArray
virtual void Exec(Option_t *opt)
Double_t GetStripTotalSignalInLowerLayer()
Strip layer characteristics of the hit (total signal, cluster size, strip position as the cluster mea...
Double_t GetStripTotalSignalInUpperLayer()
void SetChi2(Double_t chi2)
void SetParamLast(FairTrackParam &par)
FairTrackParam * GetParamFirst()
Int_t GetNHits() const
Accessors.
Int_t GetHitIndex(Int_t iHit) const
void AddHit(Int_t hitIndex, FairHit *Hit)
Associate a FairHit to the track.
void SetParamFirst(FairTrackParam &par)
Modifiers.
FairTrackParam * GetParamLast()
void SetLength(Double_t length)
void SortHits()
Public method SortHits Sorts the hits in downstream direction and writes the hit indices into the mem...
virtual void SetLineWidth(Width_t lwidth)
virtual void SetLineColor(Color_t lcolor)
virtual void SetMarkerColor(Color_t mcolor=1)
virtual void SetMarkerStyle(Style_t mstyle=1)
virtual void SetMarkerSize(Size_t msize=1)
TVirtualPad * cd(Int_t subpadnumber=0) override
void Draw(Option_t *option="") override
virtual Int_t Fill(const char *namex, const char *namey, Double_t w)
virtual void Draw(Option_t *option="")
void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0) override
void SaveAs(const char *filename="", Option_t *option="") const override
*brief user defined string literal for JSON values *sa std::size_t n
constexpr Double_t Sigma()
Double_t Sqrt(Double_t x)