17#include "FairRootManager.h"
18#include "FairRunAna.h"
65 for (
int j = 0; j < 4; ++j)
85 FairRootManager* ioman = FairRootManager::Instance();
87 cout <<
"-E- BmnStsVectorFinder::Init: "
88 <<
"RootManager not instantiated!" << endl;
102 for (
int j = 0; j < 4; ++j) {
105 cout <<
"-W- BmnStsVectorFinder::Init: "
106 <<
"No BmnCluster array!" << j << endl;
169 static Int_t nHitsMin[20] = {7, 5, 4, 4};
172 static Double_t dTanX[20] = {0.002, 0.003, 0.002, 0.008};
173 static Double_t dTanXTMVA[20] = {0.003, 0.0045, 0.003, 0.012};
174 static Double_t dTanXB0[20] = {0.001, 0.002, 0.002, 0.002};
176 static Double_t dTanY[20] = {0.01, 0.02, 0.02, 0.03};
177 static Double_t dTanYTMVA[20] = {0.015, 0.03, 0.03, 0.045};
178 static Double_t dTanYB0[20] = {0.01, 0.02, 0.02, 0.02};
179 static Double_t dTanY3[20] = {0.01, 0.02, 0.02, 0.03};
180 static Double_t dTanY3TMVA[20] = {0.015, 0.03, 0.03, 0.045};
181 static Double_t dTanY3B0[20] = {0.01, 0.02, 0.02, 0.02};
182 static Double_t dTanXzero[20] = {0.01, 0.02, 0.02, 0.02};
185 static Double_t ptCut[20] = {1.0, 0.3, 0.7, 0.1};
186 static Double_t ptCutB0[20] = {1., 1., 1., 1.};
189 12.0, 12.0, 12.0, 7.5, 5.5,
190 4.5, 3.6, 3.0, 3.0, 3.0};
193 static Double_t phiXZ[20] = {0.76, 0.69, 0.69, 0.95, 0.74, 0.60, 0.51, 0.44, 0.39, 0.35};
197 static Double_t phiXZ4[20] = {0.60, 0.63, 0.61, 0.62, 0.95, 0.74,
198 0.60, 0.51, 0.44, 0.39, 0.35};
199 static Double_t tanXmax[20] = {0.95, 0.83, 0.83, 1.40, 0.91,
200 0.68, 0.56, 0.47, 0.41, 0.37};
203 static Double_t tanXmax4[20] = {0.68, 0.73, 0.69, 0.71, 1.40, 0.91,
204 0.68, 0.56, 0.47, 0.41, 0.37};
205 static Double_t zMean[20] = {18.5, 27.2, 35.8, 60.9, 91.7,
206 123.4, 154.0, 185.8, 216.5, 248.0};
210 static Double_t zMean4[20] = {17.6, 26.4, 35.1, 43.7, 63.6, 94.2,
211 126.5, 156.8, 189.0, 219.2, 251.4};
214 FairField* magField = FairRunAna::Instance()->GetField();
236 for (
int j = 0; j < 20; ++j)
248 for (
Int_t j = 0; j < 20; ++j) {
257 for (
int j = 0; j < 20; ++j)
289 Fatal(
"Exec",
"No StsHit array");
295 for (
Int_t j = 0; j < 19; ++j) {
310 const Int_t nPass = 4;
312 for (
Int_t j = 0; j < nPass; ++j)
323 for (
Int_t ihit = 0; ihit < nHits0; ++ihit) {
325 if (hit->GetZ() > 400.0)
329 fClusMaps[0].insert(pair<Int_t, Int_t>(iclusF, ihit));
330 fClusMaps[1].insert(pair<Int_t, Int_t>(iclusB, ihit));
335 set<Int_t> idset =
GetHitId(hit, idmaxP);
336 for (set<Int_t>::iterator sit = idset.begin(); sit != idset.end(); ++sit)
337 fHit2id.insert(pair<Int_t, Int_t>(ihit, *sit));
345 for (
Int_t ipass = 0; ipass < nPass; ++ipass) {
355 cout <<
"-I- BmnStsVectorFinder: start - " << nHits0 <<
", end - " << nHits0 - nHitsOut << endl;
376 cout <<
"\n ***** Pass " << ipass <<
": Number of found tracks = " <<
fVectorArray->GetEntriesFast() - ntr0
383 cout <<
"discarded " <<
discarded <<
" track candidates" << endl;
408 unordered_multimap<Int_t, Int_t>::iterator mit;
409 pair<unordered_multimap<Int_t, Int_t>::iterator, unordered_multimap<Int_t, Int_t>::iterator> ret;
411 for (
Int_t itra = 0; itra < nTracks; ++itra) {
420 for (
Int_t ihit = 0; ihit < nHitsTr; ++ihit) {
432 for (mit = ret.first; mit != ret.second; ++mit) {
434 if (hit1->GetUniqueID() == 0)
436 hit1->SetUniqueID(1);
442 for (mit = ret.first; mit != ret.second; ++mit) {
444 if (hit1->GetUniqueID() == 0)
446 hit1->SetUniqueID(1);
451 if (hit->GetUniqueID() == 0)
460 ret =
fMap2[ista].equal_range(indx);
461 fMap2[ista].erase(ret.first, ret.second);
463 ret =
fMap3[ista].equal_range(indx);
464 for (mit = ret.first; mit != ret.second; ++mit) {
469 fMap3[ista].erase(ret.first, ret.second);
496 map<Int_t, Double_t> indF, indB;
502 for (
Int_t j = 0; j < nDigis; ++j) {
504 for (
Int_t j1 = 0; j1 < 3; ++j1) {
510 indF[p->GetTrackID()] = mom3.
Mag();
516 for (
Int_t j = 0; j < nDigis; ++j) {
518 for (
Int_t j1 = 0; j1 < 3; ++j1) {
524 indB[p->GetTrackID()] = 1.0;
530 for (map<Int_t, Double_t>::iterator mit = indF.begin(); mit != indF.end(); ++mit) {
531 Int_t id = (indB.count(mit->first) == 0) ? -mit->first : mit->first;
533 if (
id >= 0 && mit->second > pmax) {
540 if (hit->GetRefIndex() >= 0) {
542 idmaxP = p->GetTrackID();
546 for (map<Int_t, Double_t>::iterator mit = indB.begin(); mit != indB.end(); ++mit) {
547 if (ids.count(mit->first) > 0)
549 ids.insert(-mit->first);
574 ids.insert(p->GetTrackID());
576 idmaxP = *ids.begin();
605 cout <<
"nHits " << nHits << endl;
608 for (
Int_t ih = 0; ih < nHits; ++ih) {
610 if (hit->GetUniqueID())
612 if (hit->GetZ() > 400.0)
633 set<Int_t> ids =
GetHitId(hit, idmaxP);
639 set<Int_t> ids =
GetHitId(hit, idmaxP);
660 fmapX[ista].insert(pair<Double_t, Int_t>(pos[0], ih));
661 fmapY[ista].insert(pair<Double_t, Int_t>(pos[1], ih));
672 cout <<
"fNskips fPass " <<
fNskips[
fPass] <<
" " <<
fPass <<
" stastop " << stastop <<
" fNsta-1 " <<
fNsta - 1
675 for (
Int_t ista =
fNsta - 1; ista >= stastop; --ista) {
677 cout <<
"xmapsize " <<
fmapX[ista].size() << endl;
678 for (multimap<Double_t, Int_t>::iterator mit =
fmapX[ista].begin(); mit !=
fmapX[ista].end(); ++mit) {
683 aaa.
stahit[ista] = mit->second;
684 aaa.
code =
"-" + to_string(aaa.
stahit[ista]) +
"-";
687 set<Int_t> ids =
GetHitId(mit->second, idmaxP);
695 cout <<
" Vector stat: " << ista <<
" " << ncand;
697 pair<unordered_multimap<Int_t, Int_t>::iterator, unordered_multimap<Int_t, Int_t>::iterator>
700 for (
Int_t j = 0; j < ncand; ++j) {
703 cout <<
" (" << ih <<
"*";
705 for (unordered_multimap<Int_t, Int_t>::iterator mit = ret.first; mit != ret.second; ++mit)
707 if (mit != ret.first)
751 for (
Int_t ista = 0; ista <
fNsta - 1; ++ista) {
757 for (
int istanext = ista + 1; istanext < ista + 3; ++istanext) {
759 if (istanext >
fNsta - 1)
766 int nskips = istanext - (ista + 1);
768 for (
Int_t itra = 0; itra < nTra; ++itra) {
783 multimap<Double_t, candvec> mapDoublets;
786 multimap<Double_t, Int_t>::iterator mityb =
fmapTy[istanext].lower_bound(ty - dty);
787 multimap<Double_t, Int_t>::iterator mitye =
fmapTy[istanext].upper_bound(ty + dty);
788 multimap<Double_t, Int_t>::iterator mitxb =
fmapPhx[istanext].lower_bound(phx - dphx);
789 multimap<Double_t, Int_t>::iterator mitxe =
fmapPhx[istanext].upper_bound(phx + dphx);
791 set<Int_t> setTx, setTy, intersect;
792 for (multimap<Double_t, Int_t>::iterator mit = mitxb; mit != mitxe; ++mit)
793 if (
fmapHits[mit->second].used == 0)
794 setTx.insert(mit->second);
795 for (multimap<Double_t, Int_t>::iterator mit = mityb; mit != mitye; ++mit)
796 if (
fmapHits[mit->second].used == 0)
797 setTy.insert(mit->second);
798 set_intersection(setTx.begin(), setTx.end(), setTy.begin(), setTy.end(),
799 std::inserter(intersect, intersect.begin()));
806 for (set<Int_t>::iterator sit = intersect.begin(); sit != intersect.end(); ++sit) {
808 if (hit->GetUniqueID())
816 set<Int_t> ids =
GetHitId(*sit, idmaxP);
823 aaa1.
stahit[istanext] = *sit;
832 Curv3(aaa1, aaa1, aaa1, 0);
845 string code = to_string(ih) +
"-" + to_string(*sit);
860 mapDoublets.insert(pair<Double_t, candvec>(-tmvaOut, aaa1));
866 for (
auto ait = mapDoublets.begin(); ait != mapDoublets.end(); ++ait) {
868 fMap2[ista].insert(pair<int, int>(ih,
fCandVec2[ista].size() - 1));
880 cout <<
" Doublet stat: " << ista <<
" " << ncand << endl;
890 varx = (dx / dz - tx) / distxz;
905 pair<unordered_multimap<Int_t, int>::iterator, unordered_multimap<Int_t, int>::iterator> ret;
906 unordered_multimap<Int_t, int>::iterator mit, mit1;
910 for (
Int_t ista = 0; ista <
fNsta - 2; ++ista) {
918 for (mit =
fMap2[ista].begin(); mit !=
fMap2[ista].end(); ++mit) {
928 ret =
fMap2[istanext].equal_range(aaa.
stahit.rbegin()->second);
929 multimap<Double_t, candvec> mapDoublets;
930 int nbr = 0, newtr = 0, newtr3 = 0;
933 for (mit1 = ret.first; mit1 != ret.second; ++mit1) {
957 string code = to_string(aaa.
stahit.begin()->second) +
"-" + to_string(aaa.
stahit.rbegin()->second)
958 +
"-" + to_string(aaa2.
stahit.rbegin()->second);
982 map<Int_t, Int_t>& hitMap = aaa1.
stahit;
991 for (map<Int_t, Int_t>::iterator mit2 = hitMap.begin(); mit2 != hitMap.end(); ++mit2) {
992 hits[indx++] = mit2->second;
1017 float chi2 =
LinearFit(aaa, aaa2, &track, newtr, ty) / hit->GetDy() / hit->GetDy();
1058 }
else if (chi2 > c2max && nbr >=
fNbranches)
1064 mapDoublets.insert(pair<Double_t, candvec>(qual, aaa1));
1066 nbr = mapDoublets.size();
1069 multimap<Double_t, candvec>::iterator mit0 = mapDoublets.end();
1071 mapDoublets.erase(mit0);
1073 c2max = mapDoublets.rbegin()->first;
1078 for (multimap<Double_t, candvec>::iterator it = mapDoublets.begin(); it != mapDoublets.end(); ++it) {
1083 fMap3[ista].insert(pair<Int_t, int>(mit->first,
fCandVec3[ista].size() - 1));
1084 map<Int_t, Int_t>& hitMap = it->second.stahit;
1086 for (map<Int_t, Int_t>::iterator mitr = hitMap.begin(); mitr != hitMap.end(); ++mitr)
1087 code += (to_string(mitr->second) +
"-");
1095 cout <<
" Triplet stat: " << ista <<
" " << ncand <<
" " <<
discarded << endl;
1112 for (
Int_t ista = 0; ista < istaEnd; ++ista) {
1116 std::unordered_multimap<Int_t, int>* candMap = &
fMap3[ista];
1117 vector<candvec>* candVec = &
fCandVec3[ista];
1118 Int_t nTra = candMap->size();
1125 for (unordered_multimap<Int_t, int>::iterator mit = candMap->begin(); mit != candMap->end(); ++mit) {
1126 candvec& cand = (*candVec)[mit->second];
1129 map<int, int>::iterator it = cand.
stahit.begin();
1130 int ista0 = it->first;
1132 int ista1 = it->first;
1133 if (ista1 - ista0 > 1)
1150 Int_t nTra = 0, ista = cand.
stahit.rbegin()->first;
1154 if (ista == fNsta-2) {
1155 cand.stahit.erase(cand.stahit.rbegin()->first);
1156 ista = cand.stahit.rbegin()->first;
1165 std::unordered_multimap<Int_t, int>* pCandMap =
1169 unordered_multimap<Int_t, int>& candMap = *pCandMap;
1170 vector<candvec>& candVec = *pCandVec;
1172 if (ista <
fNsta - 1) {
1180 nTra = candMap.count(cand.
stahit.rbegin()->second);
1191 for (map<int, int>::iterator it = cand.
stahit.begin(); it != cand.
stahit.end(); ++it)
1192 code += (to_string(it->second) +
"-");
1211 unordered_multimap<Int_t, int>::iterator mit;
1212 pair<unordered_multimap<Int_t, int>::iterator, unordered_multimap<Int_t, int>::iterator> ret;
1213 ret = candMap.equal_range(cand.
stahit.rbegin()->second);
1224 for (mit = ret.first; mit != ret.second; ++mit) {
1226 candvec aaa = candVec[mit->second];
1236 map<Int_t, Int_t>::iterator mitr = aaa.
stahit.begin();
1238 if (code.size() == 1) {
1239 map<Int_t, Int_t>::reverse_iterator mit1 = cand.
stahit.rbegin();
1241 istaMid = mit1->first;
1242 code += (to_string(mit1->second) +
"-");
1244 code += (to_string(mit1->second) +
"-");
1245 code += (to_string(mitr->second) +
"-");
1248 int pos = code.rfind(
"-", code.size() - 2);
1249 code.erase(code.begin() + pos + 1, code.end());
1250 code += (to_string(mitr->second) +
"-");
1269 if (ok && cand.
stahit.size() > 2) {
1284 if (aaa.
stahit.size() == 3) {
1304 string codeVec(
"-");
1305 for (map<int, int>::iterator it = cand.
stahit.begin(); it != cand.
stahit.end(); ++it)
1306 codeVec += (to_string(it->second) +
"-");
1309 if (cand.
stahit.size() >= 4) {
1311 if (cand.
stahit.rbegin()->first == ista)
1315 if (chi2 > c2ndfMax)
1326 if (cand.
stahit.size() < 3)
1330 for (mitr = aaa.
stahit.begin(); mitr != aaa.
stahit.end(); ++mitr)
1331 candext.
stahit[mitr->first] = mitr->second;
1339 if (candext.
stahit.size() >= 4) {
1342 if (chi2ndf > c2ndfMax)
1362 const Int_t gkChi2Cut = 5.0;
1397 if (track.
GetChi2() / ndf > gkChi2Cut) {
1405 fTracks.insert(pair<Double_t, CbmStsTrack>(-qual, track));
1437 fitter.SetKFHits(kftr, &track);
1454 h = kftr.
GetHit(nhits - 1);
1455 err = err || h->
Filter(kftr, downstream, qp0);
1460 track.
SetNDF(2 * nhits - 5);
1489 map<Int_t, Int_t>& hitMap = cand.
stahit;
1492 hits.
Set(hitMap.size());
1497 for (map<Int_t, Int_t>::iterator mit2 = hitMap.begin(); mit2 != hitMap.end(); ++mit2) {
1498 hits[indx++] = mit2->second;
1520 hitcode += (to_string(mit2->second) +
"-");
1525 cand.
code = hitcode;
1558 printf(
"Work time of BmnStsVectorFinder: %4.2f sec.\n",
workTime);
1571 Double_t denom = (x[0] - x[1]) * (x[0] - x[2]) * (x[1] - x[2]);
1576 Double_t a = x[2] * dy10 + x[1] * dy02 + x[0] * dy21;
1580 Double_t b = -x[0] * x[0] * dy21 - x[2] * x[2] * dy10 - x[1] * x[1] * dy02;
1582 Double_t c = x[1] * x[1] * (x[2] * y[0] - x[0] * y[2]) + x[1] * (x[0] * x[0] * y[2] - x[2] * x[2] * y[0])
1583 + x[0] * x[2] * (x[2] - x[0]) * y[1];
1606 for (
Int_t itra = 0; itra < ntra; ++itra) {
1610 map<Int_t, Int_t>& hitMap = cand.
stahit;
1611 Int_t nhits = hitMap.size();
1618 Int_t indx = 0, iok = 1;
1621 string hitcode(
"-");
1622 for (map<Int_t, Int_t>::iterator mit = hitMap.begin(); mit != hitMap.end(); ++mit)
1623 hitcode += (to_string(mit->second) +
"-");
1636 for (map<Int_t, Int_t>::iterator mit = hitMap.begin(); mit != hitMap.end(); ++mit) {
1637 hits[indx++] = mit->second;
1688 cout <<
" aaaaaaa " << endl;
1690 cout << track.
GetChi2() <<
" " << nhits <<
" " << endl;
1749 int imax = nhits - 1;
1751 if (indok.size() > 3) {
1758 for (set<Int_t>::iterator sit = indok.begin(); sit != indok.end(); ++sit) {
1759 hits[indx++] = hits[*sit];
1761 hitcode += (to_string(hits[*sit]) +
"-");
1768 fCandSet[indok.size()].insert(hitcode);
1770 hits.
Set(indok.size());
1813 xextr = param.GetX() -
fXyzv[0];
1814 yextr = param.GetY() -
fXyzv[1];
1816 TMath::Sqrt(xextr * xextr / 0.035 / 0.035 + yextr * yextr / 0.2 / 0.2);
1821 fTracks.insert(pair<Double_t, CbmStsTrack>(-qual, track));
1823 pair<unordered_multimap<Int_t, Int_t>::iterator, unordered_multimap<Int_t, Int_t>::iterator>
1827 cout <<
" Good track: " << endl;
1831 for (
Int_t j = nhits - 1; j >= 0; --j) {
1832 ret =
fHit2id.equal_range(hits[j]);
1835 for (unordered_multimap<Int_t, Int_t>::iterator mit = ret.first; mit != ret.second; ++mit) {
1836 if (mit == ret.first)
1837 cout << mit->first <<
"*";
1840 cout << mit->second;
1858 multimap<Double_t, CbmStsTrack>::iterator mit =
fTracks.begin(), mit1;
1861 for (; mit !=
fTracks.end(); ++mit) {
1862 if (mit->second.GetFlag())
1867 for (; mit1 !=
fTracks.end(); ++mit1) {
1868 if (mit1->second.GetFlag())
1872 mit1->second.SetFlag(1);
1894 new ((*fVectorArray)[nOut++])
CbmStsTrack(mit->second);
1898 cout <<
" RemoveDoubles: " <<
fTracks.size() <<
" " << nOK << endl;
1910 limCommonPoint =
TMath::Min(limCommonPoint, 1);
1912 Int_t nh1 = hits1.
GetSize(), nh2 = hits2.GetSize(), nHitsCommon = 0, j = nh2 - 1;
1916 for (
Int_t i = nh1 - 1;
i >= 0;
i--) {
1920 for (; j >= 0; j--) {
1928 if (nHitsCommon > limCommonPoint)
1939 if (
i + nHitsCommon <= limCommonPoint)
1944 if (nHitsCommon <= limCommonPoint)
1978 multimap<Double_t, CbmStsTrack>::iterator mit =
fTracks.begin();
1981 for (; mit !=
fTracks.end(); ++mit) {
1982 if (mit->second.GetFlag())
2001 cout <<
" Remove fakes: " << nOK <<
" " << nOut << endl;
2012 map<Int_t, set<Int_t>> mClusTr;
2013 map<Int_t, Double_t> mWeight;
2015 for (
Int_t j = 0; j < ncand; ++j) {
2019 for (
Int_t jh = 0; jh < nhits; ++jh) {
2023 for (
Int_t side = 0; side < 2; ++side) {
2025 if (mClusTr.count(iclus) == 0) {
2027 mClusTr[iclus] = aaa;
2029 mClusTr[iclus].insert(j);
2041 TMath::Sqrt(xextr * xextr / 0.035 / 0.035 + yextr * yextr / 0.2 / 0.2);
2048 multimap<Double_t, pair<Int_t, Int_t>> mapQual;
2049 set<Int_t> set2kill, set2kill1;
2051 for (
Int_t j = 0; j < ncand; ++j) {
2058 for (
Int_t jh = 0; jh < nhits; ++jh) {
2063 for (
Int_t side = 0; side < 2; ++side) {
2065 if (mClusTr[iclus].size() > 1)
2073 mapQual.insert(pair<
Double_t, pair<Int_t, Int_t>>(quality + www, pair<Int_t, Int_t>(j, nover)));
2077 if (nhits <= 5 &&
Double_t(nover) / nhits / 2 > 0.6)
2079 else if (!
fExact && nhits <= 3 && www < 1.e-8)
2080 set2kill1.insert(j);
2083 if (set2kill.size())
2085 if (set2kill.size() || set2kill1.size()) {
2088 for (multimap<
Double_t, pair<Int_t, Int_t>>::iterator mit = mapQual.begin(); mit != mapQual.end(); ++mit) {
2089 Int_t itr = mit->second.first;
2092 if (set2kill.count(itr) == 0 && set2kill1.count(itr) == 0)
2095 for (
Int_t jh = 0; jh < nhits; ++jh) {
2098 if (mClusTr[hit->
GetDigi(0)].count(itr) == 0 || mClusTr[hit->
GetDigi(1)].count(itr) == 0)
2102 cout <<
" !!! No track found: " << itr << endl;
2104 mClusTr[hit->
GetDigi(0)].erase(itr);
2105 mClusTr[hit->
GetDigi(1)].erase(itr);
2117 cout <<
" Exclude fakes: " << ncand <<
" " <<
fVectorArray->GetEntriesFast() << endl;
2268 Double_t pars[19][4] = {{0, 0, 0, 0},
2270 {8.28698e-06, 13.3515, 0, 0},
2271 {0.031189, 4.56933, 0.031189, 4.56933},
2272 {0.395468, 3.77954, 0.190848, 3.41027},
2273 {0.128467, 4.26652, 0.128467, 4.26652},
2274 {0.160979, 4.95095, 0.160979, 4.95095}};
2277 Int_t endsta =
vec.stahit.rbegin()->first;
2280 if (endsta > ista + 2) {
2312 static Double_t y[3], l[3] = {0}, lens[3] = {0}, ys[3], lys[3], l2s[3];
2315 Int_t i0 = (newtr == 0) ? 0 : 2;
2330 l[
i] = lens[
i] = cand2.
lengxz + l[
i - 1];
2332 y[
i] = ys[
i] = hit->GetY();
2337 lys[
i] = l[
i] * y[
i];
2338 l2s[
i] = l[
i] * l[
i];
2340 lens[
i] += lens[
i - 1];
2342 lys[
i] += lys[
i - 1];
2343 l2s[
i] += l2s[
i - 1];
2346 Double_t b = 3 * lys[2] - lens[2] * ys[2];
2347 b /= (3 * l2s[2] - lens[2] * lens[2]);
2348 Double_t a = (ys[2] - b * lens[2]) / 3;
2352 for (
int i = 0;
i < 3; ++
i) {
2370 static TVector3 points3[3], midPoint;
2373 static int first = 99;
2382 map<int, int>::iterator mit = cand3.
stahit.begin();
2385 points3[0] =
fmapHits[mit->second].xyz;
2386 points3[0].
SetY(0.0);
2389 if (cand3.
stahit.size() > 2)
2392 for (; mit != cand3.
stahit.end(); ++mit) {
2394 points3[indx] =
fmapHits[mit->second].xyz;
2396 midPoint = points3[indx];
2397 points3[indx] -= points3[0];
2398 points3[indx++].
SetY(0.0);
2401 TVector3 vec21 = points3[2] - points3[1];
2412 FairField* magField = FairRunAna::Instance()->GetField();
2413 by = magField->GetBy(midPoint[0], midPoint[1], midPoint[2]);
2432 FairTrackParam param;
2435 fitter.Extrapolate(&track, z, ¶m);
2439 cout <<
" Kalman: " << z <<
" " << hit->
GetStationNr() <<
" " << sigx <<
" " << sigy << endl;
2443 multimap<Double_t, Int_t>::iterator mityb =
fmapY[istanext].lower_bound(param.GetY() - sigy);
2444 multimap<Double_t, Int_t>::iterator mitye =
fmapY[istanext].upper_bound(param.GetY() + sigy);
2445 multimap<Double_t, Int_t>::iterator mitxb =
fmapX[istanext].lower_bound(param.GetX() - sigx);
2446 multimap<Double_t, Int_t>::iterator mitxe =
fmapX[istanext].upper_bound(param.GetX() + sigx);
2448 set<Int_t> setX, setY, intersect;
2449 for (multimap<Double_t, Int_t>::iterator mit = mitxb; mit != mitxe; ++mit)
2450 if (
fmapHits[mit->second].used == 0)
2451 setX.insert(mit->second);
2452 for (multimap<Double_t, Int_t>::iterator mit = mityb; mit != mitye; ++mit)
2453 if (
fmapHits[mit->second].used == 0)
2454 setY.insert(mit->second);
2455 set_intersection(setX.begin(), setX.end(), setY.begin(), setY.end(), std::inserter(intersect, intersect.begin()));
2466 for (map<int, int>::iterator it = cand.
stahit.begin(); it != cand.
stahit.end(); ++it)
2467 code += (to_string(it->second) +
"-");
2477 for (map<int, int>::iterator mit = cand.
stahit.begin(); mit != cand.
stahit.end(); ++mit) {
2479 cout << mit->first <<
"(" << hit->GetZ() <<
"):" << mit->second <<
" - ";
2494 std::map<std::string, int> Use;
2520 reader->
AddVariable(
"dtanysc1-dtanysc2", &var[iii++]);
2524 reader->
AddVariable(
"(1/pxz1-1/pxz2)/(abs(1/pxz1)+abs(1/pxz2))*sqrt(lenxz1+lenxz2)", &var[iii++]);
2530 TString dir =
"dataset4diff/weights/";
2531 TString prefix =
"TMVAClassification";
2534 for (std::map<std::string, int>::iterator it = Use.begin(); it != Use.end(); it++) {
2538 reader->
BookMVA(methodName, weightfile);
2550 map<Int_t, Int_t>& hitMap = aaa1.
stahit;
2552 int iii = 0, indx = 0;
2555 for (map<Int_t, Int_t>::iterator mit = hitMap.begin(); mit != hitMap.end(); ++mit) {
2558 var[iii++] = hit->GetX();
2559 var[iii++] = hit->GetY();
2560 var[iii++] = hit->GetZ();
2561 }
else if (indx == 1) {
2562 Double_t dx = hit->GetX() - var[0];
2563 Double_t dy = hit->GetY() - var[1];
2564 Double_t dz = hit->GetZ() - var[2];
2565 var[iii++] = dx / dz;
2566 var[iii++] = dy / dz;
2567 var[iii++] = aaa1.
ty - aaa2.
ty;
2568 var[iii++] = aaa1.
lengxz;
2569 var[iii++] = aaa2.
lengxz;
2570 var[iii++] = aaa1.
momxz;
2590 std::map<std::string, int> Use;
2615 reader->
AddVariable(
"corrq[1]-corrq[0]", &var[iii++]);
2616 reader->
AddVariable(
"corrn[1]-corrn[0]", &var[iii++]);
2621 TString dir =
"dataset4diff/weights2/";
2622 TString prefix =
"TMVAClassification";
2625 for (std::map<std::string, int>::iterator it = Use.begin(); it != Use.end(); it++) {
2629 reader->
BookMVA(methodName, weightfile);
2641 map<Int_t, Int_t>& hitMap = aaa1.
stahit;
2642 CbmStsHit *hit =
nullptr, *hit1 =
nullptr;
2643 int iii = 0, indx = 0;
2646 for (map<Int_t, Int_t>::iterator mit = hitMap.begin(); mit != hitMap.end(); ++mit) {
2649 var[iii++] = hit->GetX();
2650 var[iii++] = hit->GetY();
2651 var[iii++] = hit->GetZ();
2653 }
else if (indx == 1) {
2654 Double_t dx = hit->GetX() - var[0];
2655 Double_t dy = hit->GetY() - var[1];
2656 Double_t dz = hit->GetZ() - var[2];
2657 var[iii++] = dx / dz;
2658 var[iii++] = dy / dz;
2659 var[iii++] = aaa1.
ty;
2660 var[iii++] = aaa1.
lengxz;
2661 var[iii++] = aaa1.
momxz;
2662 var[iii++] = hit->
GetSignalDiv() - hit1->GetSignalDiv();
2663 var[iii++] = hit->GetTimeStamp() - hit1->GetTimeStamp();
void Fatal(const char *location, const char *msgfmt,...)
TGLVector3 Cross(const TGLVector3 &v1, const TGLVector3 &v2)
void PrintHits(candvec &cand)
Double_t Proxim(Double_t ang1, Double_t ang2)
std::set< Int_t > GetHitId(CbmStsHit *hit, Int_t &idmaxP)
std::set< Int_t > GetHitIdBmn(CbmStsHit *hit, Int_t &idmaxP)
std::multimap< Double_t, Int_t > fmapPhx[19]
std::multimap< Double_t, Int_t > fmapTy[19]
std::map< std::string, int > fMap3Out
std::multimap< Double_t, CbmStsTrack > fTracks
virtual void Exec(Option_t *opt)
Virtual method Exec.
Double_t FitTrack(candvec &cand)
std::multimap< Double_t, Int_t > fmapX[19]
TClonesArray * fDigiMatches
TVector3 Parabola(TVector3 &pos0, TVector3 &pos1, TVector3 &pos2)
std::unordered_multimap< int, int > fMap2[19]
TMVA::Reader * fReaderTMVA3
std::unordered_multimap< Int_t, Int_t > fHit2id
virtual void Finish()
Virtual method Finish.
virtual InitStatus Init()
Virtual method Init.
std::set< string > fCandCodes[19]
std::vector< candvec > fCandVec2[19]
std::string MakeCode(candvec &cand)
std::vector< candvec > fSeedVec[19]
std::set< string > fCandSet[19]
Float_t TMVAOutput2(candvec &aaa1)
std::set< int > KalmanWindow(candvec &cand, int hitIndx)
std::unordered_map< Int_t, hitinfo > fmapHits
std::map< std::string, int > * fMap2OutPtr
TClonesArray * fTrackArray
virtual void FinishEvent()
Virtual method FinishEvent.
BmnStsVectorFinder()
Default constructor.
std::vector< candvec > fCandVec[19]
TClonesArray * fStsPoints
std::map< std::string, int > * fMap3OutPtr
TMVA::Reader * fReaderTMVA2
std::multimap< Double_t, Int_t > fmapY[19]
std::vector< candvec > fCandVec3[19]
std::unordered_multimap< Int_t, Int_t > fClusMaps[2]
TClonesArray * fClusArray[4]
Input / output array of CbmStsHits.
~BmnStsVectorFinder()
Destructor.
TClonesArray * fSilPoints
Double_t LinearFit(candvec &cand, candvec &cand2, CbmStsTrack *tr, Int_t newtr, Double_t &ty)
void ExtendTrack(candvec cand)
std::unordered_multimap< int, int > fMap3[19]
void ExtendTracks(Int_t ista)
std::map< std::string, int > fMap2Out
BmnStsKFTrackFitter fitter
Double_t FilterHit(candvec &cand, CbmStsTrack &track)
std::unordered_map< std::string, int > fMapCode3[19]
Int_t ExcludeHits(Int_t minHits, TClonesArray *trArray)
TClonesArray * fVectorArray
void MakeStsTrack(candvec &cand, std::string &hitcode, CbmStsTrack &track)
Bool_t AreTracksDoubles(CbmStsTrack &tr1, CbmStsTrack &tr2)
Float_t TMVAOutput3(candvec &aaa1, candvec &aaa2)
Double_t Curv3(candvec &cand1, candvec &cand2, candvec &cand3, int newtr3)
Bool_t CheckVarx(Double_t dx, Double_t dz, Double_t tx, Double_t distxz, Double_t &varx)
TString fMatBudgetFileName
Double_t DxVsMom(Int_t ista, candvec &aaa)
Abstract base class for hit is being used by the CbmKF Kalman Filter.
virtual Int_t Filter(CbmKFTrackInterface &track, Bool_t downstream, Double_t &QP0)=0
void SetStsTrack(CbmStsTrack &track, bool first=1)
CbmKFHit * GetHit(Int_t i)
Number of hits.
void GetTrackParam(FairTrackParam &track)
Double_t & GetRefChi2()
array[15] of covariance matrix
static CbmKF * Instance()
int GetNStsStations() const
Int_t GetDigi(Int_t inum)
Int_t GetRefIndex(Int_t i=0) const
Accessor to StsPoint indizes.
static CbmStsDigiScheme * Instance(int version=1)
CbmStsStation * GetStationByNr(Int_t stationNr)
Station by index.
virtual Int_t GetStationNr() const
Double_t GetSignalDiv() const
Int_t GetSystemId() const
Accessors.
Int_t GetDigi(Int_t iSide) const
CbmStsSector * GetSector(Int_t iSector)
FairTrackParam * GetParamLast()
void SetParamLast(FairTrackParam &par)
void SetParamFirst(FairTrackParam &par)
void SetChi2(Double_t chi2)
Int_t GetNStsHits() const
Accessors.
Int_t GetStsHitIndex(Int_t iHit) const
FairTrackParam * GetParamFirst()
void Set(Int_t n) override
TObject * Remove(TObject *obj) override
IMethod * BookMVA(const TString &methodTag, const TString &weightfile)
void AddVariable(const TString &expression, Float_t *)
Int_t GetEntriesFast() const
TObject * UncheckedAt(Int_t i) const
void Start(Bool_t reset=kTRUE)
void SetXYZ(Double_t x, Double_t y, Double_t z)
RVec< PromoteType< T > > abs(const RVec< T > &v)
RVec< PromoteType< T > > sqrt(const RVec< T > &v)
Double_t Min(Double_t a, Double_t b)
Double_t Sign(Double_t a, Double_t b)
Double_t ATan2(Double_t y, Double_t x)
Double_t Power(Double_t x, Double_t y)
Double_t Sqrt(Double_t x)
Double_t Max(Double_t a, Double_t b)
Double_t Log10(Double_t x)
std::map< Int_t, Int_t > stahit