33 #include "FairRootManager.h"
34 #include "FairRunAna.h"
35 #include "FairRuntimeDb.h"
37 #include "TClonesArray.h"
42 #include "TSpectrum2.h"
43 #include "TSpectrum.h"
44 #include "TStopwatch.h"
59 PndTrkCombiLegendreTask::PndTrkCombiLegendreTask() : FairTask(
"secondary track finder", 0), fDisplayOn(kFALSE), fPersistence(kTRUE), fUseMVDPix(kTRUE), fUseMVDStr(kTRUE), fUseSTT(kTRUE), fSecondary(kFALSE), fMvdPix_RealDistLimit(1000), fMvdStr_RealDistLimit(1000), fStt_RealDistLimit(1000), fMvdPix_ConfDistLimit(1000), fMvdStr_ConfDistLimit(1000), fStt_ConfDistLimit(1000), fInitDone(kFALSE) , fUmin(-0.07), fUmax(0.07), fVmin(-0.07), fVmax(0.07), fRmin(-1.5), fRmax(1.5), fThetamin(0), fThetamax(180), fSeeMC(kFALSE), fRecoverIteration(-1)
67 PndTrkCombiLegendreTask::PndTrkCombiLegendreTask(
int verbose) : FairTask(
"secondary track finder", verbose), fDisplayOn(kFALSE), fPersistence(kTRUE), fUseMVDPix(kTRUE), fUseMVDStr(kTRUE), fUseSTT(kTRUE), fSecondary(kFALSE), fMvdPix_RealDistLimit(1000), fMvdStr_RealDistLimit(1000), fStt_RealDistLimit(1000), fMvdPix_ConfDistLimit(1000), fMvdStr_ConfDistLimit(1000), fStt_ConfDistLimit(1000), fInitDone(kFALSE), fUmin(-0.07), fUmax(0.07), fVmin(-0.07), fVmax(0.07), fRmin(-1.5), fRmax(1.5), fThetamin(0), fThetamax(180), fSeeMC(kFALSE), fRecoverIteration(-1) {
104 FairRootManager* ioman = FairRootManager::Instance();
106 cout <<
"-E- PndTrkCombiLegendreTask::Init: "
107 <<
"RootManager not instantiated, return!" << endl;
116 cout <<
"-W- PndTrkCombiLegendreTask::Init: "
117 <<
"No STTHit array, return!" << endl;
124 std::cout <<
"-W- PndTrkCombiLegendreTask::Init: " <<
"No MVD Pixel hitArray, return!" << std::endl;
131 std::cout <<
"-W- PndTrkCombiLegendreTask::Init: " <<
"No MVD Strip hitArray, return!" << std::endl;
152 display =
new TCanvas(
"display",
"display", 0, 0, 800, 800);
173 fTimer =
new TStopwatch();
182 FairRuntimeDb*
rtdb = FairRunAna::Instance()->GetRuntimeDb();
223 if(
fVerbose > 0) cout <<
"*********************** " <<
fEventCounter <<
" ***********************" << endl;
228 cout <<
"number of stt hits " <<
fSttHitArray->GetEntriesFast() << endl;
239 for(
int ipnt = 0; ipnt <
fSttPointArray->GetEntriesFast(); ipnt++) {
241 TMarker *mrk =
new TMarker(pnt->GetX(), pnt->GetY(), 7);
242 mrk->SetMarkerColor(pnt->GetTrackID() + 1);
245 for(
int ipnt = 0; ipnt <
fMvdPointArray->GetEntriesFast(); ipnt++) {
247 TMarker *mrk =
new TMarker(pnt->GetX(), pnt->GetY(), 7);
248 mrk->SetMarkerColor(pnt->GetTrackID() + 1);
254 cout <<
" STARTING" << endl;
272 globalcluster->
AddHit(hit);
283 cout <<
"GLOBAL CLUSTER:";
293 for(
int ihit = 0; ihit < globalcluster->
GetNofHits(); ihit++) {
301 int noftracksinlay[30];
306 cout <<
"\033[1;36m ITERATIONS -----------------------> " << maxnoftracks <<
"\033[0m" << endl;
308 for(
int iter = 0; iter < maxnoftracks; iter++) {
309 cout <<
"\033[1;36m ############### ITER " << iter <<
"/" << maxnoftracks <<
"\033[0m" << endl;
321 double fitm, fitp, xc, yc,
R;
323 for(
int irun = 0; irun < 2; irun++)
326 if(irun == 0) thiscluster = globalcluster;
327 else thiscluster = cluster;
328 cout <<
"\033[1;36m ############### ITER " << iter <<
" IRUN " << irun <<
"\033[0m" << endl;
329 if(thiscluster == NULL)
continue;
335 if(nhits == 0)
continue;
353 cluster = thiscluster;
360 cout <<
"legendre fit " << irun <<
" *** nof hits " << cluster->GetNofHits() << endl;
390 TLine *line =
new TLine(-10.07, fitp + fitm * (-10.07), 10.07, fitp + fitm * (10.07));
398 if(cluster == NULL)
continue;
403 cout <<
"ANALYTICAL FIT " << endl;
404 cout <<
"xc/yc/R " << xc <<
" " << yc <<
" " << R << endl;
405 cout <<
"nof hits " << cluster->GetNofHits() << endl;
409 double xc0 = xc, yc0 = yc, R0 =
R;
414 if(
fabs(xc - xc0) > 5 &&
fabs(yc - yc0) > 5 &&
fabs(R - R0) > 20) {
415 cout <<
"\033[1;31m THIS FINDING IS A FAILURE!\033[0m" << endl;
416 cout <<
"\033[1;31m LETS TRY ANOTHER ONE -------- BONUS ------------ \033[0m" << endl;
427 cout <<
"after analytical fit *** nof hits " << cluster->GetNofHits() << endl;
430 cout <<
"ADD CLUSTER " << tracklist.
GetNofTracks() <<
" TO TRACKLIST " << thiscluster->
GetNofHits() << endl;
437 for(
int ihit = 0; ihit < globalcluster->
GetNofHits(); ihit++) {
441 remainingcluster->
AddHit(hit);
443 globalcluster = remainingcluster;
444 cout <<
"tracklist " << tracklist.
GetNofTracks() <<
", remainning hits " << remainingcluster->
GetNofHits() <<
" of which " << skewed <<
" skewed" << endl;
448 if(remainingcluster->
GetNofHits() - skewed > 15 && iter == maxnoftracks - 1) {
449 cout <<
"\033[1;31m LETS TRY ANOTHER ONE -------- BONUS ------------ \033[0m" << endl;
458 cout <<
"\033[1;35m --------------- SUMMARY -------------- \033[0m" << endl;
459 cout <<
"tracklist " << tracklist.
GetNofTracks() << endl;
462 for(
int itrk = 0; itrk < tracklist.
GetNofTracks(); itrk++) {
496 cout <<
"FINISH" << endl;
526 if(
fVerbose) cout <<
"Refresh stt" << endl;
528 if(
fVerbose) cout <<
"Refresh pixel" << endl;
530 if(
fVerbose) cout <<
"Refresh strip" << endl;
532 if(
fVerbose) cout <<
"Refresh stop" << endl;
564 if(
hxy == NULL)
hxy =
new TH2F(
"hxy",
"xy plane", 100, -43, 43, 100, -43, 43);
566 hxy->SetStats(kFALSE);
570 for(
int itube = 1; itube <
fTubeArray->GetEntriesFast(); itube++) {
574 arc->SetFillStyle(0);
575 arc->SetLineColor(kCyan - 10);
581 mrk->SetMarkerColor(kCyan - 10);
599 if(
huv == NULL)
huv =
new TH2F(
"huv",
"uv plane", 100, x1, x2, 100, y1, y2);
602 huv->GetXaxis()->SetLimits(x1, x2);
603 huv->GetYaxis()->SetLimits(y1, y2);
606 huv->SetStats(kFALSE);
637 for(
int j = 0; j < neighs->GetEntriesFast(); j++) {
640 if(neighs2->GetEntriesFast() > 2) {
643 for(
int k = 0; k < neighs2->GetEntriesFast(); k++) {
650 if(counter > 2)
continue;
676 cout <<
"new neigh hit?" << endl;
694 cout <<
"HIT " << hit->
GetHitID() <<
"(" << hit->
GetTubeID() <<
"/" << tube->
GetLayerID() <<
")" <<
" has " << neighs->GetEntriesFast() <<
" neighborings: ";
695 for(
int i = 0;
i < neighs->GetEntriesFast();
i++) {
710 TArc *arc =
new TArc(u, v, r);
711 arc->SetFillStyle(0);
715 TMarker *mrk =
new TMarker(u, v, marker);
730 for(
int jhit = 0; jhit < cluster->
GetNofHits(); jhit++) {
751 if(ntot == 0)
return NULL;
757 for(
int jhit = 0; jhit < ntot; jhit++) {
772 if(tmphitid == -1)
return NULL;
790 if(
fVerbose > 1) cout <<
"already used V" << endl;
796 if(tmphitid == -1)
return NULL;
798 if(
fVerbose > 1) cout <<
"MVD PIXEL REFERENCE HIT " << refhit->
GetHitID() << endl;
811 if(
fVerbose > 1) cout <<
"already used V" << endl;
817 if(tmphitid == -1)
return NULL;
819 if(
fVerbose > 1) cout <<
"MVD STRIP REFERENCE HIT " << refhit->
GetHitID() << endl;
828 if(refhit != NULL)
return refhit;
839 if(refhit != NULL)
return refhit;
849 if(ntot == 0)
return NULL;
852 cout <<
"THE REF HIT IS ALREADY INSIDE THE CLUSTER SO I KEEP IT" << endl;
860 for(
int jhit = 0; jhit < ntot; jhit++) {
884 if(tmphitid == -1)
return NULL;
885 refhit = cluster->
GetHit(tmphitid);
907 double rc_of_min, rc_of_max;
912 double u = chit->
GetU();
913 double v = chit->
GetV();
923 double u2 = chit2->
GetU();
924 double v2 = chit2->
GetV();
932 rc < rc2 ? rc_of_min = rc : rc_of_min = rc2;
936 rc < rc2 ? rc_of_max = rc2 : rc_of_max = rc;
949 double delta =
fabs(dv - du)/2.;
950 du < dv ? (fUmin -= delta,
fUmax += delta) : (fVmin -= delta,
fVmax += delta);
954 cout <<
"u_min " << fUmin <<
" u_max " << fUmax << endl;
955 cout <<
"v_min " << fVmin <<
" v_max " <<
fVmax << endl;
956 cout <<
"r_min " <<
fRmin <<
" r_max " <<
fRmax << endl;
957 cout <<
"theta_min 0 theta_max 180" << endl;
967 std::vector< std::pair<int, int> > usedcouples;
987 if(neighborings->GetEntriesFast() == 0)
continue;
989 for(
int jhit = 0; jhit < neighborings->GetEntriesFast(); jhit++) {
1004 if(hit2 != chit2->
GetHit())
continue;
1009 if((find(usedcouples.begin(), usedcouples.end(), thiscouple) != usedcouples.end()) ||
1010 (find(usedcouples.begin(), usedcouples.end(), thisrevcouple) != usedcouples.end()))
1038 usedcouples.push_back(thiscouple);
1045 cout <<
"fill peak legendre histo time " <<
fTimer->RealTime() <<
" sec" << endl;
1074 if(cluster->
DoesContain(hit2) == kFALSE)
continue;
1080 cout <<
"fill peak legendre histo " <<
fTimer->RealTime() << endl;
1088 cout <<
"get the max? " << endl;
1097 ycrot0 = 1 / (2 * fitp);
1098 xcrot0 = - fitm * ycrot0;
1099 R =
sqrt(xcrot0 * xcrot0 + ycrot0 * ycrot0);
1128 fitp = 1 / (2 * ycrot0);
1129 fitm = - 2 * fitp * xcrot0;
1134 TObjArray sector[6];
1135 TObjArray *neighborings = NULL;
1156 neighborings =
new TObjArray();
1159 if(ihit == jhit)
continue;
1164 if(tube->
IsNeighboring(tubeID2) == kTRUE) neighborings->Add(hit2);
1195 for(
int jhit = 0; jhit < indiv->GetEntriesFast(); jhit++) {
1197 stthit2->
Draw(kOrange);
1198 stthit->
Draw(kOrange);
1204 cout <<
" STARTING" << endl;
1220 TObjArray *neighborings = NULL;
1223 for(
int iseed = 0; iseed < seeds.GetEntriesFast(); iseed++) {
1228 if(seedhit->
IsUsed() == kTRUE)
continue;
1235 cluster->
AddHit(seedhit);
1249 int nlastadded = 1, addedcounter = 0;
1252 while(nlastadded > 0) {
1271 for(
int iadded = nclusterhits - 1; iadded >= (nclusterhits - nlastadded); iadded--) {
1274 if(neighborings->GetEntriesFast() == 0)
continue;
1278 for(
int ineigh = 0; ineigh < neighborings->GetEntriesFast(); ineigh++)
1286 cluster->
AddHit(neighhit);
1304 nlastadded = addedcounter;
1353 cout <<
"COUNT TRACKS IN SKEW SECTOR" << endl;
1354 int nofhitsinlay[30];
1355 for(
int ilay = 0; ilay < 30; ilay++) nofhitsinlay[ilay] = 0;
1357 for(
int ihit = 0; ihit < cluster->
GetNofHits(); ihit++) {
1367 for(
int ihit = 0; ihit < cluster->
GetNofHits(); ihit++) {
1373 int maxnoftracks = 1;
1378 for(
int ihit = 0; ihit < cluster->
GetNofHits(); ihit++) {
1387 if(nofhitsinlay[layid] <= 1) {
1388 noftracksinlayer[layid] = nofhitsinlay[layid];
1393 if(layid != tmplayid) {
1413 if(
counter1 == nofhitsinlay[layid])
continue;
1415 for(
int jhit = counter; jhit < counter + nofhitsinlay[layid] -
counter1; jhit++) {
1432 if(counter1 == nofhitsinlay[layid] - 1) {
1433 int noftracks = nofhitsinlay[layid] - isneigh;
1434 cout <<
"CLUSTER CONTAINS @ LAYER " << layid <<
" ACTUALLY " << nofhitsinlay[layid] <<
" - " << isneigh <<
" = " << noftracks <<
" TRACKS" << endl;
1435 if(noftracks > maxnoftracks) maxnoftracks = noftracks;
1437 noftracksinlayer[layid] = noftracks;
1442 cout <<
"THIS CLUSTER HAS A TOTAL OF " << maxnoftracks <<
" TRACKS" << endl;
1443 return maxnoftracks;
1452 Double_t delta = 0, trasl[2] = {0., 0.};
1456 cout <<
" REFERENCE HIT " <<
fRefHit <<
" found among " << cluster->
GetNofHits() <<
" hits of cluster " << cluster << endl;
1465 cout <<
"DELTA " << delta <<
" TRASL " << trasl[0] <<
" " << trasl[1] << endl;
1477 while(stopit !=
true) {
1479 if(track != NULL) stopit =
true;
1487 cout <<
"APPLY LEGENDRE ======================= (nofhits " << cluster->
GetNofHits() <<
") " << endl;
1522 cout <<
"\033[1;33m MAXPEAK " << maxpeak <<
" XR, YC, R: " << xc <<
" " << yc <<
" " << R <<
"\033[0m" << endl;
1528 TMarker *maxmrk =
new TMarker(theta_max, r_max, 20);
1529 display->cd(4); maxmrk->Draw(
"SAME");
1533 TLine *line =
new TLine(-10.07, fitq + fitm * (-10.07), 10.07, fitq + fitm * (10.07));
1534 line->SetLineColor(kGreen);
1538 track->
Draw(kGreen);
1543 cout <<
"want to go on?" << endl;
1553 double rmin = R - 1;
1554 double rmax = R + 1;
1558 double dist =
fabs(distance - R);
1578 if((distance <= rmax && distance >= rmin) || (dist < 5 * hit->
GetIsochrone()))
return kTRUE;
1590 int startsecid = 1000, endsecid = -1, startlayid = 1000, endlayid = -1;
1593 int nofhitsinsec[6], lowlayinsec[6], uplayinsec[6];
1594 TVector2 lowinsec[6], upinsec[6];
1595 bool sectorsallow[6];
1597 nofhitsinsec[
isec] = 0;
1598 lowlayinsec[
isec] = 1000;
1599 uplayinsec[
isec] = -1;
1600 sectorsallow[
isec] =
false;
1603 int maxnofhits = -1, maxhitsec = -1;
1606 bool doesitbelong =
DoesBelong(hit, xc, yc, R);
1607 if(doesitbelong == kTRUE) {
1608 thiscluster->
AddHit(hit);
1618 if(ilay < startlayid) startlayid = ilay;
1619 if(isec < startsecid) startsecid =
isec;
1620 if(ilay > endlayid) endlayid = ilay;
1621 if(isec > endsecid) endsecid =
isec;
1622 nofhitsinsec[
isec]++;
1623 if(maxnofhits < nofhitsinsec[isec]) {
1624 maxnofhits = nofhitsinsec[
isec];
1627 if(ilay < lowlayinsec[isec]) {
1628 lowlayinsec[
isec] = ilay;
1631 if(ilay > uplayinsec[isec]) {
1632 uplayinsec[
isec] = ilay;
1639 sectorsallow[maxhitsec] =
true;
1640 for(
int isec = maxhitsec + 1;
isec <= endsecid;
isec++) {
1641 if(nofhitsinsec[
isec] != 0) sectorsallow[
isec] =
true;
1644 for(
int isec = maxhitsec - 1;
isec >= startsecid;
isec--) {
1645 if(nofhitsinsec[
isec] != 0) sectorsallow[
isec] =
true;
1648 if(sectorsallow[0] ==
true && nofhitsinsec[5] > 0) sectorsallow[5] =
true;
1649 if(sectorsallow[5] ==
true && nofhitsinsec[0] > 0) sectorsallow[0] =
true;
1655 double OQ = qpoint.Mod();
1656 TVector2 center(xc, yc);
1657 double OC = center.Mod();
1662 double arrow = OC + R - OQ;
1663 cout <<
"========================> ARROW " << arrow << endl;
1665 bool sectorsallow2[6];
1667 sectorsallow2[
isec] =
false;
1670 int nofsteps = endsecid - startsecid;
1671 if(nofsteps == 5) nofsteps++;
1672 int nofstepsup = endsecid - maxhitsec;
1673 int nofstepsdown = maxhitsec - startsecid;
1674 sectorsallow2[maxhitsec] =
true;
1675 cout <<
"nofsteps " << nofsteps <<
" whose up " << nofstepsup <<
" and down " << nofstepsdown << endl;
1678 cout <<
"preliminary sec " <<
isec <<
" " << sectorsallow[
isec] << endl;
1681 cout <<
"preliminary sec2 " <<
isec <<
" " << sectorsallow2[
isec] << endl;
1684 int ksec = maxhitsec, jsec;
1685 if(
isec < nofstepsup) {
1687 if(ksec > 5) ksec -= 6;
1690 if(ksec == 5) jsec = 0;
1693 ksec -= (
isec - nofstepsup);
1694 if(ksec < 0) ksec += 6;
1697 if(ksec == 0) jsec = 5;
1699 cout <<
"===== ksec " << ksec <<
" jsec " << jsec << endl;
1700 cout <<
"sectorsallow2[0]: " << sectorsallow2[0] << endl;
1711 if(sectorsallow[ksec] ==
true && sectorsallow[jsec] ==
true) {
1712 cout <<
"go on " << endl;
1714 if(upinsec[ksec].Mod() > 39 && upinsec[jsec].Mod() > 39) {
1716 cout <<
"BOTH AT OUTER RADIUS" << endl;
1717 sectorsallow2[ksec] =
true;
1718 sectorsallow2[jsec] =
true;
1720 else cout <<
"WRONG BOTH AT OUTER RADIUS ************* " << upinsec[ksec].Mod() <<
" " << upinsec[jsec].Mod() << endl;
1722 else if(lowinsec[ksec].Mod() < 17 && lowinsec[jsec].Mod() < 17) {
1724 cout <<
"BOTH AT INNER RADIUS" << endl;
1725 sectorsallow2[ksec] =
true;
1726 sectorsallow2[jsec] =
true;
1728 else cout <<
"WRONG BOTH AT INNER RADIUS ************* " << lowinsec[ksec].Mod() <<
" " << lowinsec[jsec].Mod() << endl;
1731 TVector2 lowvec, upvec;
1733 (upinsec[ksec] - lowinsec[jsec]).Mod() < (lowinsec[ksec] - upinsec[jsec]).Mod() ? (lowvec = lowinsec[jsec], upvec = upinsec[ksec], lowlay = lowlayinsec[jsec] , uplay = uplayinsec[ksec]) : (upvec = upinsec[jsec], lowvec = lowinsec[ksec], lowlay = lowlayinsec[ksec], uplay = uplayinsec[jsec]);
1734 if((upvec - lowvec).Mod() < 10) {
1735 cout <<
"ONE HERE / ONE THERE" << endl;
1736 sectorsallow2[ksec] =
true;
1737 sectorsallow2[jsec] =
true;
1740 cout <<
"WRONG ONE HERE / ONE THERE *************** " << (upvec - lowvec).Mod() <<
" " << lowlay <<
" " << uplay << endl;
1747 cout <<
"@step " <<
isec <<
":";
1748 for(
int lsec = 0; lsec < 6; lsec++) cout <<
" " << sectorsallow2[lsec];
1755 sectorsallow[
isec] = sectorsallow2[
isec];
1756 cout <<
"final " << sectorsallow[
isec] << endl;
1760 else cout <<
"========================> NO INTERSECTION " << OQ <<
" " <<
CTOUTRADIUS <<
" " << R << endl;
1767 thiscluster->
Draw(kRed);
1775 cout <<
"START SECTOR " << startsecid <<
" END SECTOR " << endsecid << endl;
1776 cout <<
"START LAYER " << startlayid <<
" END LAYER " << endlayid << endl;
1777 cout <<
"MAX NOF HITS IS " << maxnofhits <<
"/" << thiscluster->
GetNofHits() <<
" IN SEC " << maxhitsec << endl;
1779 if(nofhitsinsec[
isec] > 0) cout <<
"isec " <<
isec <<
" " << nofhitsinsec[
isec] <<
" from lay " << lowlayinsec[
isec] <<
" to lay " << uplayinsec[
isec] <<
" allowed? " << sectorsallow[
isec] << endl;
1785 for(
int ihit = 0; ihit < thiscluster->
GetNofHits(); ihit++) {
1789 if(sectorsallow[isec] ==
true) {
1790 thiscluster2->
AddHit(hit);
1797 return thiscluster2;
1812 int startsecid = 1000, endsecid = -1, startlayid = 1000, endlayid = -1;
1819 for(
int ihit = 0; ihit < cluster->
GetNofHits(); ihit++) {
1821 bool doesitbelong =
DoesBelong(hit, xc, yc, R);
1822 if(doesitbelong == kTRUE) {
1823 thiscluster->
AddHit(hit);
1838 cout <<
"START SECTOR " << startsecid <<
" END SECTOR " << endsecid << endl;
1839 cout <<
"START LAYER " << startlayid <<
" END LAYER " << endlayid << endl;
1843 thiscluster->
Draw(kRed);
1852 bool select_sec_lay =
true;
1853 if((select_sec_lay ==
true && (startlayid != 0 || endlayid != 23)) || select_sec_lay ==
false)
1859 bool doesitbelong =
DoesBelong(hit, xc, yc, R);
1860 if(doesitbelong == kTRUE) {
1862 if(select_sec_lay ==
true) {
1864 if(startsecid != 5 && endsecid != 5 && startsecid != 0 && endsecid != 0)
continue;
1876 cout <<
"want to go to next?" << endl;
1880 thiscluster->
AddHit(hit);
1888 thiscluster->
Draw(kRed);
1912 for(
int ihit = 0; ihit < cluster->
GetNofHits(); ihit++) {
1916 double distancefromtrack =
fabs(distance - R);
1917 if(distancefromtrack < 1) {
1918 thiscluster->
AddHit(hit);
1928 thiscluster->
Draw(kRed);
1949 for(
int ihit = 0; ihit < cluster->
GetNofHits(); ihit++)
1977 cout <<
"previous " << xc <<
" " << yc <<
" " << R << endl;
1979 cout <<
"now " << xc <<
" " << yc <<
" " << R << endl;
1983 cout <<
"wanna see the line?" << endl;
1984 TLine *line =
new TLine(-10.07, fitq + fitm * (-10.07), 10.07, fitq + fitm * (10.07));
1985 line->SetLineColor(2);
2010 for(
int ihit = 0; ihit < cluster->
GetNofHits(); ihit++)
2047 double xreal, yreal, rreal;
2049 TMarker *mrk =
new TMarker(xreal, yreal, 6);
2050 mrk->SetMarkerColor(kRed);
2055 mrk2->SetMarkerColor(kRed);
2069 cout <<
"previous " << xc <<
" " << yc <<
" " << R <<
"/" << fitm <<
" " << fitp << endl;
2071 cout <<
"now " << xc <<
" " << yc <<
" " << R <<
"/" << fitm2 <<
" " << fitp2 << endl;
2075 cout <<
"wanna see the line?" << endl;
2076 TLine *line =
new TLine(-10.07, fitp2 + fitm2 * (-10.07), 10.07, fitp2 + fitm2 * (10.07));
2077 line->SetLineColor(2);
2081 TArc *aline =
new TArc(xc, yc, R);
2082 aline->SetFillStyle(0);
2083 aline->SetLineColor(2);
2084 aline->Draw(
"SAME");
2099 for(
int ihit = 0; ihit < cluster->
GetNofHits(); ihit++)
2124 double sigma = der * erriso;
2127 double chi = (distanceperp - chit->
GetIsochrone())/sigma;
2129 cout <<
"=> " << distanceperp <<
" " << chit->
GetIsochrone() <<
" " << sigma <<
" " << chi <<
" " << chi * chi <<
" " << chi2 <<
" " << sttpnt->GetTrackID() << endl;
2132 cout <<
"final chi2 " << chi2 << endl;
2146 double xi = 0, yi = 0;
2148 fabs(yi1 - (fitm * xi1 + fitp)) <
fabs(yi2 - (fitm * xi2 + fitp)) ? (yi = yi1, xi = xi1) : (yi = yi2, xi = xi2);
2155 TVector2
vec(xc, yc);
2196 yb1 = vec.Y() +
sqrt(R * R - (xb1 - vec.X()) * (xb1 - vec.X()));
2199 yb2 = vec.Y() -
sqrt(R * R - (xb2 - vec.X()) * (xb2 - vec.X()));
2216 xb1 = (-(m*(q - vec.Y()) - vec.X()) +
sqrt((m*(q - vec.Y()) - vec.X())*(m*(q - vec.Y()) - vec.X()) - (m*m + 1)*((q - vec.Y())*(q - vec.Y()) + vec.X()*vec.X() - R *
R))) / (m*m + 1);
2219 xb2 = (-(m*(q - vec.Y()) - vec.X()) -
sqrt((m*(q - vec.Y()) - vec.X())*(m*(q - vec.Y()) - vec.X()) - (m*m + 1)*((q - vec.Y())*(q - vec.Y()) + vec.X()*vec.X() - R *
R))) / (m*m + 1);
2229 if(distb1 > distb2) xyb.Set(xb2, yb2);
2230 else xyb.Set(xb1, yb1);
2233 Double_t dist1 =
sqrt((xyb.Y() - y1)*(xyb.Y() - y1) + (xyb.X() - x1)*(xyb.X() - x1));
2234 Double_t dist2 =
sqrt((xyb.Y() - y2)*(xyb.Y() - y2) + (xyb.X() - x2)*(xyb.X() - x2));
2238 if(dist1 > dist2) xy =
new TVector2(x2, y2);
2239 else xy =
new TVector2(x1, y1);
2241 hit->
SetPosition(TVector3(xy->X(), xy->Y(), 0.0));
2369 int noftracksinlay[30];
2370 for(
int ilay = 0; ilay < 30; ilay++) noftracksinlay[ilay] = 0;
2372 cout <<
" NOF EFFECTIVE TRACKS IN THIS TRACK: " << noftracks << endl;
2374 int noflayerswith0tracks = 0, noflayerswith1track = 0, noflayerswithmoretracks = 0;
2375 int firstlayid = -1, lastlayid = -1;
2376 for(
int ilay = 0; ilay < 30; ilay++) {
2380 if(noftracksinlay[ilay] != 0) {
2381 if(firstlayid == -1) firstlayid = ilay;
2383 if(noftracksinlay[ilay] == 1) noflayerswith1track++;
2384 else noflayerswithmoretracks++;
2387 noflayerswith0tracks = (lastlayid - firstlayid + 1) - noflayerswith1track - noflayerswithmoretracks;
2389 cout <<
"last layer " << lastlayid <<
" first layer " << firstlayid << endl;
2390 cout <<
"#layers in range with 0 tracks " << noflayerswith0tracks <<
"; with 1 track " << noflayerswith1track <<
"; with more tracks " << noflayerswithmoretracks << endl;
2392 int classification = -1;
2396 noflayerswith0tracks < noflayerswith1track ? classification = 1 : classification = 0;
2397 if(classification == 0) noflayerswith0tracks <= noflayerswithmoretracks ? classification = 2 : classification = 0;
2398 else if(classification == 1) noflayerswith1track <= noflayerswithmoretracks ? classification = 2 : classification = 1;
2400 switch(classification) {
2402 cout <<
"\033[1;30m THIS TRACK IS FAKE " << noflayerswith0tracks <<
" " << 100. * noflayerswith0tracks/(lastlayid - firstlayid + 1) <<
"%\033[0m" << endl;
break;
2404 cout <<
"\033[1;30m THIS TRACK IS ONE-WAY " << noflayerswith1track <<
" " << 100. * noflayerswith1track/(lastlayid - firstlayid + 1) <<
"%\033[0m" << endl;
break;
2406 cout <<
"\033[1;30m THIS IS A FULL CIRCLE " << noflayerswithmoretracks <<
" " << 100. * noflayerswithmoretracks/(lastlayid - firstlayid + 1) <<
"%\033[0m" << endl;
break;
2408 cout <<
"\033[1;30m THIS IS NOT CLASSIFIED\033[0m" << endl;
2412 for(
int ihit = 0; ihit < cluster->
GetNofHits(); ihit++) {
2418 if(noftracksinlay[layid] > 2) {
void AnalyticalFit(PndTrkCluster *cluster, double xc, double yc, double R, double &fitm, double &fitq)
void AddNeighboringsToHit(PndTrkHit *hit, TObjArray *hits)
PndTrkClusterList CreateFullClusterization2()
Double_t fStt_ConfDistLimit
void CleanTrack(PndTrkTrack *track)
void FillPeakCouplesHisto(PndTrkCluster *cluster)
void AddTCA(Int_t detID, TClonesArray *array)
void IntersectionFinder(PndTrkHit *hit, double xc, double yc, double R)
PndTrkConformalTransform * conform
void AnalyticalFit2(PndTrkCluster *cluster, double fitm, double fitp, double &fitm2, double &fip2)
void ComputePlaneExtremities(PndTrkCluster *cluster)
TClonesArray * fMvdPointArray
PndTrkHit * FindMvdReferenceHit()
void Draw(Color_t color=kBlack)
friend F32vec4 sqrt(const F32vec4 &a)
PndTrkSttHitList * Instanciate()
PndTrkClusterList CreateFullClusterization()
PndTrkConformalHitList * conformalhitlist
static T Sqrt(const T &x)
Double_t fMvdStr_RealDistLimit
TClonesArray * fMvdStripHitArray
PndTrkCluster GetCluster()
TClonesArray * fTrackCandArray
virtual InitStatus Init()
void DrawGeometry(int cpad=1)
TObjArray GetNeighboringsToHit(PndTrkHit *hit)
void FillPeakNeighCouplesHisto(PndTrkCluster *cluster)
PndTrkTrack * LegendreFitWithRecovering(PndTrkCluster *cluster)
int GetNofHitsInSector(int isec)
void SetSortVariable(Double_t sortvar)
void AddHit(PndTrkHit *hit)
Double_t fStt_RealDistLimit
PndTrkHit * GetHitFromSector(int ihit, int isec)
PndTrkHit * FindSttReferenceHit(int isec=-1)
void SetCluster(PndTrkCluster *cluster)
PndTrkHit * GetHit(int index)
~PndTrkCombiLegendreTask()
Double_t fMvdPix_RealDistLimit
PndTrkNeighboringMap * fHitMap
PndTrkHit * GetHit(int index)
void SetOwnerValue(Bool_t enable=kTRUE)
void AddCluster(PndTrkCluster *cluster)
PndTrkHit * FindReferenceHit()
Int_t FillConformalHitList(PndTrkCluster *cluster)
void SetCenter(double x, double y)
Bool_t IsNeighboring(int tubeID)
char fMvdPixelBranch[200]
PndTrkTrack * GetTrack(Int_t index)
void AddTrack(PndTrkTrack *track)
TClonesArray * fTubeArray
void SetRadius(double radius)
PndTrkSdsHitList * InstanciateStrip()
void FromRealToConformalTrack(double x0, double y0, double R, double &fitm, double &fitp)
void Draw(Color_t color=kBlack)
void FromConformalToRealTrack(double fitm, double fitp, double &x0, double &y0, double &R)
Int_t CountTracksInSkewSector(PndTrkCluster *cluster, int *noftracksinlayer)
TClonesArray * fMvdPixelHitArray
void SetRefHitFlag(Bool_t used)
void SetPosition(TVector3 pos)
char fMvdStripBranch[200]
TClonesArray * FillTubeArray()
std::vector< std::pair< double, double > > fFoundPeaks
TClonesArray * fSttPointArray
Double_t GetIsochroneError() const
TClonesArray * fTrackArray
virtual void Exec(Option_t *opt)
PndTrkSdsHitList * mvdstrhitlist
void Draw(Color_t color=kBlack)
friend F32vec4 fabs(const F32vec4 &a)
void DrawHits(PndTrkHitList *hitlist)
void DrawTube(Color_t color)
static PndGeoHandling * Instance()
PndTrkHit * FindMvdStripReferenceHit()
PndTrkHit * FindMvdPixelReferenceHit()
void DrawConfHit(double x, double y, double r, int marker=2)
PndTrkCombiLegendreTask()
PndTrkSdsHitList * mvdpixhitlist
Bool_t DoesContain(PndTrkHit *hit)
Double_t fMvdPix_ConfDistLimit
TObjArray GetIndivisiblesToHit(PndTrkHit *hit)
Double_t GetXYDistance(PndTrkHit *fromhit)
Bool_t StraightLineFit(Double_t &fitm, Double_t &fitp)
Bool_t DoesBelong(PndTrkHit *hit, double xc, double yc, double R)
PndGeoSttPar * fSttParameters
PndSttMapCreator * fMapper
void ComputeTraAndRot(PndTrkHit *hit, Double_t &delta, Double_t trasl[2])
void DrawGeometryConf(double x1, double x2, double y1, double y2)
TClonesArray * fSttHitArray
PndTrkSttHitList * stthitlist
PndTrkLegendreTransform * legendre
PndTrkCluster * ComputeSkewedXYZ(PndTrkCluster *cluster)
PndTrkCluster * CreateClusterAroundTrack2(PndTrkTrack *track)
Int_t ClusterToConformal(PndTrkCluster *cluster, bool samerefhit)
void DrawNeighboringsToHit(PndTrkHit *hit)
TObjArray GetIndivisibles()
TObjArray GetStandalone()
Double_t fMvdStr_ConfDistLimit
Int_t CountTracksInCluster(PndTrkCluster *cluster, int *noftracksinlayer)
Double_t ComputePerpendicularChi2(PndTrkCluster *cluster, double fitm, double fitp)
PndTrkCluster * CreateClusterAroundTrack3(PndTrkTrack *track)
PndTrkCluster * CreateClusterAroundTrack(PndTrkTrack *track)
PndTrkTrack * LegendreFit(PndTrkCluster *cluster)
void SetPointToFit(double x, double y, double sigma)
PndTrkSdsHitList * InstanciatePixel()
PndTrkCombiLegendreTransform * legendrecombi