680 if (istat == 1 && imod > 3)
682 if (istat == 2 && imod > 1)
685 if (
fDebug && istat == 1 && DigitsArrayX_[istat][imod][istr] > 0.)
687 if (
fDebug && istat == 2 && DigitsArrayX_[istat][imod][istr] > 0.)
689 if (
fDebug && istat == 3 && DigitsArrayX_[istat][imod][istr] > 0.)
692 if (
fDebug && istat == 1 && DigitsArrayXp_[istat][imod][istr] > 0.)
694 if (
fDebug && istat == 2 && DigitsArrayXp_[istat][imod][istr] > 0.)
696 if (
fDebug && istat == 3 && DigitsArrayXp_[istat][imod][istr] > 0.)
699 if (DigitsArrayX_[istat][imod][istr] == 0. && DigitsArrayX_[istat][imod][istr - 1] >
Cut_AmplX
700 && DigitsArrayX_[istat][imod][istr + 1] >
Cut_AmplX)
701 DigitsArrayX_[istat][imod][istr] =
702 0.5 * (DigitsArrayX_[istat][imod][istr - 1] + DigitsArrayX_[istat][imod][istr + 1]);
704 if (istat == 1 && imod == 0) {
706 if (DigitsArrayX_[istat][imod][404] >
Cut_AmplX)
707 DigitsArrayX_[istat][imod][405] = 0.5 * DigitsArrayX_[istat][imod][404];
708 if (DigitsArrayX_[istat][imod][413] >
Cut_AmplX)
709 DigitsArrayX_[istat][imod][412] = 0.5 * DigitsArrayX_[istat][imod][413];
712 if (DigitsArrayXp_[istat][imod][istr] == 0. && DigitsArrayXp_[istat][imod][istr - 1] > 120.
713 && DigitsArrayXp_[istat][imod][istr + 1] > 120.)
714 DigitsArrayXp_[istat][imod][istr] =
715 0.5 * (DigitsArrayXp_[istat][imod][istr - 1] + DigitsArrayXp_[istat][imod][istr + 1]);
720 Int_t NfirstX, NlastX, NfirstXp, NlastXp, ClusterSizeX, ClusterSizeXp;
739 if (NfirstX < 0 && DigitsArrayX_[istat][imod][istr] == 0.)
741 if (NfirstX < 0 && DigitsArrayX_[istat][imod][istr] > 0.)
743 if (NfirstX >= 0 && DigitsArrayX_[istat][imod][istr + 1] == 0.)
746 if (NfirstX >= 0 && NlastX > 0) {
748 Int_t max_ampl_strip = -1, num_max_ampl_strip = -1,
751 num_centr_strip = -1;
753 ClusterSizeX = NlastX - NfirstX + 1;
756 Int_t Counter_overflow = 0;
758 for (
Int_t is = NfirstX; is < NlastX + 1; is++) {
759 Ampl_strX[is - NfirstX] = DigitsArrayX_[istat][imod][is];
764 if (DigitsArrayX_[istat][imod][is] > max_ampl_strip) {
765 max_ampl_strip = DigitsArrayX_[istat][imod][is];
766 num_max_ampl_strip = is;
773 for (
Int_t is = NfirstX; is < NlastX + 1; is++) {
774 if (max_ampl_strip > 0) {
777 Int_t dif_strip = is - num_max_ampl_strip;
779 num_centr_strip = is;
787 if (num_centr_strip > 0 && DigitsArrayX_[istat][imod][num_centr_strip] <
Cut_AmplStripX) {
802 XClust_[istat][imod][NclustX_[istat][imod]] = NfirstX + CoG;
803 XClust_width_[istat][imod][NclustX_[istat][imod]] = ClusterSizeX;
804 sumQx_[istat][imod][NclustX_[istat][imod]] = SumAmpl;
809 NclustX_[istat][imod]++;
819 if (NclustX_[istat][imod] == 0)
833 if (NfirstXp < 0 && DigitsArrayXp_[istat][imod][istr] == 0.)
835 if (NfirstXp < 0 && DigitsArrayXp_[istat][imod][istr] > 0.)
837 if (NfirstXp >= 0 && DigitsArrayXp_[istat][imod][istr + 1] == 0.)
840 if (NfirstXp >= 0 && NlastXp > 0) {
842 Int_t max_ampl_strip = -1, num_max_ampl_strip = -1,
845 num_centr_strip = -1;
847 ClusterSizeXp = NlastXp - NfirstXp + 1;
850 Int_t Counter_overflow = 0;
852 for (
Int_t is = NfirstXp; is < NlastXp + 1; is++) {
853 Ampl_strXp[is - NfirstXp] = DigitsArrayXp_[istat][imod][is];
858 if (DigitsArrayXp_[istat][imod][is] > max_ampl_strip) {
859 max_ampl_strip = DigitsArrayXp_[istat][imod][is];
860 num_max_ampl_strip = is;
867 for (
Int_t is = NfirstX; is < NlastX + 1; is++) {
868 if (max_ampl_strip > 0) {
870 Int_t dif_strip = is - num_max_ampl_strip;
872 num_centr_strip = is;
882 if (num_centr_strip > 0 && DigitsArrayXp_[istat][imod][num_centr_strip] <
Cut_AmplStripXp) {
902 XpClust_[istat][imod][NclustXp_[istat][imod]] = NfirstXp + CoG;
903 XpClust_width_[istat][imod][NclustXp_[istat][imod]] = ClusterSizeXp;
904 sumQxp_[istat][imod][NclustXp_[istat][imod]] = SumAmplXp;
905 NclustXp_[istat][imod]++;
945 vector<MC_points>&
vec,
953 if (ist == 1 && imod > 3)
955 if (ist == 2 && imod > 1)
959 for (
Int_t cl = 0; cl < NclustX_[ist][imod]; cl++) {
960 XCoord_[ist][imod][cl] =
deltaX * XClust_[ist][imod][cl];
962 SigmaX_[ist][imod][cl] = (XClust_width_[ist][imod][cl] *
deltaX) / (2. *
sq12);
972 for (
Int_t cl = 0; cl < NclustXp_[ist][imod]; cl++) {
973 XpCoord_[ist][imod][cl] =
deltaXp * XpClust_[ist][imod][cl];
975 SigmaXp_[ist][imod][cl] =
976 (XpClust_width_[ist][imod][cl] *
deltaXp) / (2. *
sq12);
1012 GetXYspatial(NclustX_, NclustXp_, XCoord_, XpCoord_, XspCoord_, XpspCoord_, YspCoord_, NhitsXYmod_, SigmaX_,
1013 SigmaXp_, SigmspX_, SigmspXp_, SigmspY_, XClust_, XClust_width_, sumQx_, XpClust_, XpClust_width_,
1014 sumQxp_, XspClust_, XspClust_width_, sumQxsp_, XpspClust_, XpspClust_width_, sumQxpsp_);
1064 cout <<
" Sim: " << endl;
1079 sigxp_MC = -sigxp_MC;
1086 if (z_MC < -434. && z_MC > -436.) {
1100 XCoord_[st_mc][imod][
NclustX[st_mc][imod]] = x_MC;
1101 XpCoord_[st_mc][imod][
NclustXp[st_mc][imod]] = xp_MC;
1102 SigmaX_[st_mc][imod][
NclustXp[st_mc][imod]] = sigx_MC;
1103 SigmaXp_[st_mc][imod][
NclustXp[st_mc][imod]] = sigxp_MC;
1104 NclustX_[st_mc][imod]++;
1105 NclustXp_[st_mc][imod]++;
1107 XspCoord_[st_mc][imod][
NhitsXYmod[st_mc][imod]] = x_MC;
1109 XpspCoord_[st_mc][imod][
NhitsXYmod[st_mc][imod]] = xp_MC;
1110 YspCoord_[st_mc][imod][
NhitsXYmod[st_mc][imod]] = (xp_MC - x_MC) /
tg2_5;
1112 SigmspX_[st_mc][imod][
NhitsXYmod[st_mc][imod]] = sigx_MC;
1113 SigmspXp_[st_mc][imod][
NhitsXYmod[st_mc][imod]] = sigxp_MC;
1116 cout <<
" Id " << Id <<
" x " << x_MC <<
" xp " << xp_MC <<
" y "
1117 << YspCoord_[st_mc][imod][
NhitsXYmod[st_mc][imod]] <<
" z_MC " << z_MC <<
" st_mc " << st_mc
1118 <<
" pdg " << hit->
GetType() << endl;
1120 NhitsXYmod_[st_mc][imod]++;
1125 cout <<
"True MC BmnSiliconHitClean" << endl;
1127 int Nmc_tracks = -1;
1131 int mcTracksArray[
kMaxMC];
1139 mcTracksArray[Id] = -1;
1158 if (tr_before != trackId_MC) {
1160 mcTracksArray[Nmc_tracks] = trackId_MC;
1162 tr_before = trackId_MC;
1166 Np_in_3st[Nmc_tracks]++;
1168 if (z_MC < -434. && z_MC > -436.)
1173 cout <<
" pdgId " << trackId_MC <<
" pdgCode " << pdgCode <<
" x " << x_MC <<
" y " << y_MC <<
" z "
1174 << z_MC <<
" st_mc " << st_mc << endl;
1176 Xmc[Nmc_tracks][st_mc] = x_MC;
1177 Ymc[Nmc_tracks][st_mc] = y_MC;
1178 Zmc[Nmc_tracks][st_mc] = z_MC;
1179 mcPdgCode[Nmc_tracks] = pdgCode;
1180 Nst_mc[Nmc_tracks]++;
1186 if (Nst_mc[Id] > 0) {
1188 tmpTr.
x[
i] = Xmc[Id][
i];
1189 tmpTr.
y[
i] = Ymc[Id][
i];
1190 tmpTr.
z[
i] = Zmc[Id][
i];
1192 tmpTr.
Id = mcTracksArray[Id];
1193 tmpTr.
Np = Nst_mc[Id];
1194 tmpTr.
Pdg = mcPdgCode[Id];
1195 if (Nst_mc[Id] >= 2 && Np_in_3st[Id] > 0)
1196 vec.push_back(tmpTr);
1201 cout <<
" vec_points.size() " <<
vec.size() << endl;
1203 for (
size_t itr = 0; itr <
vec.size(); itr++) {
1205 if (
vec.at(itr).x[3] < -900.)
1206 vec.at(itr).wo3st = 1;
1207 if (
vec.at(itr).x[1] > -900.) {
1208 vec.at(itr).param[0] = (
vec.at(itr).x[1] -
vec.at(itr).x[3]) / (
vec.at(itr).z[1] -
vec.at(itr).z[3]);
1209 vec.at(itr).param[1] = (
vec.at(itr).x[1] +
vec.at(itr).x[3]) * 0.5;
1210 vec.at(itr).param[2] = (
vec.at(itr).y[1] -
vec.at(itr).y[3]) / (
vec.at(itr).z[1] -
vec.at(itr).z[3]);
1211 vec.at(itr).param[3] = (
vec.at(itr).y[1] +
vec.at(itr).y[3]) * 0.5;
1213 vec.at(itr).param[0] = (
vec.at(itr).x[2] -
vec.at(itr).x[3]) / (
vec.at(itr).z[2] -
vec.at(itr).z[3]);
1214 vec.at(itr).param[1] = (
vec.at(itr).x[2] +
vec.at(itr).x[3]) * 0.5;
1215 vec.at(itr).param[2] = (
vec.at(itr).y[2] -
vec.at(itr).y[3]) / (
vec.at(itr).z[2] -
vec.at(itr).z[3]);
1216 vec.at(itr).param[3] = (
vec.at(itr).y[2] +
vec.at(itr).y[3]) * 0.5;
1219 cout <<
" mcId " <<
vec.at(itr).Id <<
" Pdg " <<
vec.at(itr).Pdg <<
" Ax " <<
vec.at(itr).param[0]
1220 <<
" bx " <<
vec.at(itr).param[1] <<
" Ay " <<
vec.at(itr).param[2] <<
" by "
1221 <<
vec.at(itr).param[3] <<
" Np " <<
vec.at(itr).Np << endl;
1256 if (ist == 1 && imod > 3)
1258 if (ist == 2 && imod > 1)
1269 if (ist == 1 && imod > 3)
1271 if (ist == 2 && imod > 1)
1273 for (
Int_t cl = 0; cl < NhitsXYmod_[ist][imod]; cl++) {
1275 if ((ist == 2 || ist == 3)) {
1276 if (YspCoord_[ist][imod][cl] > 0. && YspCoord_[ist][imod][cl] <= 0.1151)
1278 if (YspCoord_[ist][imod][cl] < 0. && YspCoord_[ist][imod][cl] >= -0.1151)
1280 if (YspCoord_[ist][imod][cl] > 0.)
1281 YspCoord_[ist][imod][cl] += 0.1151;
1284 if ((ist == 1 && (imod == 1 || imod == 3)) || (ist == 2 && imod == 1)
1285 || (ist == 3 && (imod == 2 || imod == 3 || imod == 6 || imod == 7))
1289 XspCoord_[ist][imod][cl] = -XspCoord_[ist][imod][cl];
1290 XpspCoord_[ist][imod][cl] = -XpspCoord_[ist][imod][cl];
1298 if ((ist == 1 && (imod == 2 || imod == 3)) || (ist == 3 && imod > 3)) {
1299 YspCoord_[ist][imod][cl] = -YspCoord_[ist][imod][cl];
1307 XspCoord_[ist][imod][cl] +=
shiftX[ist][imod];
1308 YspCoord_[ist][imod][cl] +=
shiftY[ist][imod];
1311 XspCoord_[ist][imod][cl] = -XspCoord_[ist][imod][cl];
1318 XpspCoord_[ist][imod][cl] = -XpspCoord_[ist][imod][cl];
1337 if (ist == 1 && imod > 3)
1339 if (ist == 2 && imod > 1)
1342 for (
Int_t cl = 0; cl < NclustX_[ist][imod]; cl++) {
1343 if ((ist == 1 && (imod == 1 || imod == 3)) || (ist == 2 && imod == 1)
1344 || (ist == 3 && (imod == 2 || imod == 3 || imod == 6 || imod == 7)))
1346 XCoord_[ist][imod][cl] = -XCoord_[ist][imod][cl];
1348 XCoord_[ist][imod][cl] +=
shiftX[ist][imod];
1351 XCoord_[ist][imod][cl] = -XCoord_[ist][imod][cl];
1355 for (
Int_t cl = 0; cl < NclustXp_[ist][imod]; cl++) {
1357 if ((ist == 1 && (imod == 1 || imod == 3)) || (ist == 2 && imod == 1)
1358 || (ist == 3 && (imod == 2 || imod == 3 || imod == 6 || imod == 7)))
1360 XpCoord_[ist][imod][cl] = -XpCoord_[ist][imod][cl];
1369 XpCoord_[ist][imod][cl] = -XpCoord_[ist][imod][cl];
1384 for (
Int_t cl = 0; cl < NhitsXYmod_[ist][imod]; cl++) {
1388 XspCoord_[ist][imod][cl] = -XspCoord_[ist][imod][cl];
1389 XpspCoord_[ist][imod][cl] = -XpspCoord_[ist][imod][cl];
1396 YspCoord_[ist][imod][cl] = -YspCoord_[ist][imod][cl];
1402 XspCoord_[ist][imod][cl] +=
shiftX[ist][imod];
1403 YspCoord_[ist][imod][cl] +=
shiftY[ist][imod];
1408 if (ist == 1 || ist == 3) {
1409 Xtmp = XspCoord_[ist][imod][cl];
1410 XspCoord_[ist][imod][cl] = YspCoord_[ist][imod][cl];
1411 YspCoord_[ist][imod][cl] = Xtmp;
1413 if (ist == 2 || ist == 4) {
1414 XspCoord_[ist][imod][cl] = -XspCoord_[ist][imod][cl];
1415 YspCoord_[ist][imod][cl] = -YspCoord_[ist][imod][cl];
1435 for (
Int_t cl = 0; cl < NclustX_[ist][imod]; cl++) {
1437 XCoord_[ist][imod][cl] = -XCoord_[ist][imod][cl];
1439 XCoord_[ist][imod][cl] +=
shiftX[ist][imod];
1441 if (ist == 2 || ist == 4) {
1442 XCoord_[ist][imod][cl] = -XCoord_[ist][imod][cl];
1447 for (
Int_t cl = 0; cl < NclustXp_[ist][imod]; cl++) {
1450 XpCoord_[ist][imod][cl] = -XpCoord_[ist][imod][cl];
1456 if (ist == 2 || ist == 4) {
1457 XpCoord_[ist][imod][cl] = -XpCoord_[ist][imod][cl];
1469 cout <<
" --after shift-- " << endl;
1473 cout <<
" XCoord_[" << ist <<
"] ";
1475 for (
Int_t cl = 0; cl < NclustX_[ist][imod]; cl++) {
1477 cout << XCoord_[ist][imod][cl] <<
" ";
1487 cout <<
" XpCoord_[" << ist <<
"] ";
1489 for (
Int_t cl = 0; cl < NclustXp_[ist][imod]; cl++) {
1491 cout << XpCoord_[ist][imod][cl] <<
" ";
1498 cout <<
" --spatial-- " << endl;
1502 cout <<
" Xspatial[" << ist <<
"] ";
1504 if (ist == 1 && imod > 3)
1506 if (ist == 2 && imod > 1)
1509 for (
Int_t cl = 0; cl < NhitsXYmod_[ist][imod]; cl++) {
1511 cout << XspCoord_[ist][imod][cl] <<
" ";
1522 cout <<
" Xpspatial[" << ist <<
"] ";
1524 if (ist == 1 && imod > 3)
1526 if (ist == 2 && imod > 1)
1529 for (
Int_t cl = 0; cl < NhitsXYmod_[ist][imod]; cl++) {
1531 cout << XpspCoord_[ist][imod][cl] <<
" ";
1542 cout <<
" Yspatial[" << ist <<
"] ";
1544 if (ist == 1 && imod > 3)
1546 if (ist == 2 && imod > 1)
1548 for (
Int_t cl = 0; cl < NhitsXYmod_[ist][imod]; cl++) {
1550 cout << YspCoord_[ist][imod][cl] <<
" ";
1561 if (ist == 1 && imod > 3)
1563 if (ist == 2 && imod > 1)
1565 for (
Int_t cl = 0; cl < NhitsXYmod_[ist][imod]; cl++) {
1567 hY_XSisp1bef->Fill(XspCoord_[ist][imod][cl], YspCoord_[ist][imod][cl]);
1569 hY_XSisp2bef->Fill(XspCoord_[ist][imod][cl], YspCoord_[ist][imod][cl]);
1704 cout <<
" RecordingTracks size:" << vec_tracks_.size() << endl;
1706 cout <<
" CleanTr size: " << CleanTr_.size() << endl;
1709 ZposC[1] = 213.999 + 0.03 - 6.9;
1710 ZposC[2] = 213.999 + 0.03 - 6.9;
1711 ZposC[3] = 327.130 + 0.03;
1716 for (
size_t itr = 0; itr < vec_tracks_.size(); ++itr) {
1718 Double_t X1_cand = vec_tracks_.at(itr).param[0] * (ZposC[1] -
Zcentr) + vec_tracks_.at(itr).param[1];
1719 Double_t Y1_cand = vec_tracks_.at(itr).param[2] * (ZposC[1] -
Zcentr) + vec_tracks_.at(itr).param[3];
1721 Double_t X3_cand = vec_tracks_.at(itr).param[0] * (ZposC[3] -
Zcentr) + vec_tracks_.at(itr).param[1];
1722 Double_t Y3_cand = vec_tracks_.at(itr).param[2] * (ZposC[3] -
Zcentr) + vec_tracks_.at(itr).param[3];
1726 for (
size_t InIter = 0; InIter < CleanTr_.size(); ++InIter) {
1728 Double_t X1_tr = CleanTr_.at(InIter).param[0] * (ZposC[1] -
Zcentr) + CleanTr_.at(InIter).param[1];
1729 Double_t Y1_tr = CleanTr_.at(InIter).param[2] * (ZposC[1] -
Zcentr) + CleanTr_.at(InIter).param[3];
1731 Double_t X3_tr = CleanTr_.at(InIter).param[0] * (ZposC[3] -
Zcentr) + CleanTr_.at(InIter).param[1];
1732 Double_t Y3_tr = CleanTr_.at(InIter).param[2] * (ZposC[3] -
Zcentr) + CleanTr_.at(InIter).param[3];
1734 if (X1_cand < X1_tr && X3_cand > X3_tr) {
1738 if (Y1_cand < Y1_tr && Y3_cand > Y3_tr) {
1742 if (X1_cand > X1_tr && X3_cand < X3_tr) {
1746 if (Y1_cand > Y1_tr && Y3_cand < Y3_tr) {
1754 cout <<
" itr " << itr <<
" CleanTr size: " << CleanTr_.size() << endl;
1755 CleanTr_.push_back(vec_tracks_.at(itr));
1758 cout <<
" itr " << itr <<
" Chi2 " << vec_tracks_.at(itr).Chi2 <<
" Nhits " << vec_tracks_.at(itr).Nhits
1759 <<
" Xv " << vec_tracks_.at(itr).Xv <<
" Yv " << vec_tracks_.at(itr).Yv << endl;
1762 cout <<
" st " << st <<
" Z " << vec_tracks_.at(itr).CoordZ[st] << endl;
1763 cout <<
" CleanTr.CoordX[" << st <<
"] " << vec_tracks_.at(itr).CoordX[st] <<
" strip "
1764 << vec_tracks_.at(itr).StripNumX[st] <<
" Clsize " << vec_tracks_.at(itr).ClSizeX[st] <<
" Q "
1765 << vec_tracks_.at(itr).SumQX[st] << endl;
1766 cout <<
" CleanTr.CoordXp[" << st <<
"] " << vec_tracks_.at(itr).CoordXp[st] <<
" strip "
1767 << vec_tracks_.at(itr).StripNumXp[st] <<
" Clsize " << vec_tracks_.at(itr).ClSizeXp[st]
1768 <<
" Q " << vec_tracks_.at(itr).SumQXp[st] << endl;
1776 cout <<
" now CleanTr.size() " << CleanTr_.size() << endl;
1779 vec_tracks_.clear();
1788 cout <<
" RecordingTracks size:" << vec_tracks_.size() << endl;
1791 ZposC[1] = 213.999 + 0.03 - 6.9;
1792 ZposC[2] = 213.999 + 0.03 - 6.9;
1793 ZposC[3] = 327.130 + 0.03;
1796 cout <<
" after case 3 write cand: " << vec_tracks_.size() << endl;
1800 for (
size_t itr = 0; itr < vec_tracks_.size(); ++itr) {
1802 Double_t X1_cand = vec_tracks_.at(itr).param[0] * (ZposC[1] -
Zcentr) + vec_tracks_.at(itr).param[1];
1803 Double_t Y1_cand = vec_tracks_.at(itr).param[2] * (ZposC[1] -
Zcentr) + vec_tracks_.at(itr).param[3];
1805 Double_t X3_cand = vec_tracks_.at(itr).param[0] * (ZposC[3] -
Zcentr) + vec_tracks_.at(itr).param[1];
1806 Double_t Y3_cand = vec_tracks_.at(itr).param[2] * (ZposC[3] -
Zcentr) + vec_tracks_.at(itr).param[3];
1811 Bool_t Cross_6p = 0, rej_cand = 0;
1813 for (
size_t InIter = 0; InIter < CleanTr_.size(); ++InIter) {
1815 Double_t X1_tr = CleanTr_.at(InIter).param[0] * (ZposC[1] -
Zcentr) + CleanTr_.at(InIter).param[1];
1816 Double_t Y1_tr = CleanTr_.at(InIter).param[2] * (ZposC[1] -
Zcentr) + CleanTr_.at(InIter).param[3];
1818 Double_t X3_tr = CleanTr_.at(InIter).param[0] * (ZposC[3] -
Zcentr) + CleanTr_.at(InIter).param[1];
1819 Double_t Y3_tr = CleanTr_.at(InIter).param[2] * (ZposC[3] -
Zcentr) + CleanTr_.at(InIter).param[3];
1824 if (X1_cand < X1_tr && X3_cand > X3_tr) {
1827 if (Y1_cand < Y1_tr && (Y3_cand - sigma_y) > Y3_tr) {
1831 if (X1_cand > X1_tr && X3_cand < X3_tr) {
1834 if (Y1_cand > Y1_tr && (Y3_cand + sigma_y) < Y3_tr) {
1839 if (CleanTr_.at(InIter).Nhits > vec_tracks_.at(itr).Nhits) {
1844 if (!rej_cand && CleanTr_.at(InIter).Nhits < vec_tracks_.at(itr).Nhits) {
1847 CleanTr_.erase(CleanTr_.begin() + InIter);
1850 if (!rej_cand && Cross_6p) {
1851 if (CleanTr_.at(InIter).Nhits == vec_tracks_.at(itr).Nhits && CleanTr_.at(InIter).Nhits == 4) {
1857 if (CleanTr_.at(InIter).Nhits == vec_tracks_.at(itr).Nhits && CleanTr_.at(InIter).Nhits > 4) {
1858 if (CleanTr_.at(InIter).Chi2 < vec_tracks_.at(itr).Chi2)
1860 if (CleanTr_.at(InIter).Chi2 > vec_tracks_.at(itr).Chi2) {
1861 CleanTr_.erase(CleanTr_.begin() + InIter);
1873 if (!Cross_6p && !rej_cand) {
1875 cout <<
" write good itr " << itr << endl;
1876 CleanTr_.push_back(vec_tracks_.at(itr));
1878 cout <<
" push good itr " << itr << endl;
1881 cout <<
" itr " << itr <<
" Chi2 " << vec_tracks_.at(itr).Chi2 <<
" Nhits " << vec_tracks_.at(itr).Nhits
1882 <<
" Xv " << vec_tracks_.at(itr).Xv <<
" Yv " << vec_tracks_.at(itr).Xv << endl;
1885 cout <<
" st " << st <<
" Z " << CleanTr_.at(itr).CoordZ[st] << endl;
1887 cout <<
" CleanTr.CoordX[" << st <<
"] " << vec_tracks_.at(itr).CoordX[st] <<
" strip "
1888 << vec_tracks_.at(itr).StripNumX[st] <<
" Clsize " << vec_tracks_.at(itr).ClSizeX[st] <<
" Q "
1889 << vec_tracks_.at(itr).SumQX[st] << endl;
1891 cout <<
" CleanTr.CoordXp[" << st <<
"] " << vec_tracks_.at(itr).CoordXp[st] <<
" strip "
1892 << vec_tracks_.at(itr).StripNumXp[st] <<
" Clsize " << vec_tracks_.at(itr).ClSizeXp[st]
1893 <<
" Q " << vec_tracks_.at(itr).SumQXp[st] << endl;
1901 cout <<
" now CleanTr_.size() " << CleanTr_.size() << endl;
1904 vec_tracks_.clear();
1917 vector<tracksX>& out_tracks,
1926 Int_t NpX_in_line = 0;
1938 Double_t bx_candidate = 999., by_candidate = 999.;
1939 Int_t iClustXMod_candidate = -1, iModX_candidate = -1;
1940 Double_t dxV_thr = .2, dyV_thr = .4;
1946 cout <<
" case1: Spatial track " << endl;
1949 if (
fDebug && NhitsXYmod_[1][imod1] > 0)
1950 cout <<
" NhitsXYmod_[1][" << imod1 <<
"] " << NhitsXYmod_[1][imod1] << endl;
1951 for (
Int_t cl1 = 0; cl1 < NhitsXYmod_[1][imod1]; cl1++) {
1955 if (
fDebug && NhitsXYmod_[2][imod2])
1956 cout <<
" NhitsXYmod_[2][" << imod2 <<
"] " << NhitsXYmod_[2][imod2] << endl;
1957 for (
Int_t cl2 = 0; cl2 < NhitsXYmod_[2][imod2]; cl2++) {
1980 if (dminx1_x2 >
fabs(XspCoord_[1][imod1][cl1] - XspCoord_[2][imod2][cl2])) {
1981 dminx1_x2 =
fabs(XspCoord_[1][imod1][cl1] - XspCoord_[2][imod2][cl2]);
1989 if (NpX_in_line < 2)
1992 Bool_t was_candidate = 0;
1993 bx_candidate = 999., by_candidate = 999.;
1998 if (
fDebug && NhitsXYmod_[3][imod3] > 0)
1999 cout <<
" NhitsXYmod_[3][" << imod3 <<
"] " << NhitsXYmod_[3][imod3] << endl;
2000 for (
Int_t cl3 = 0; cl3 < NhitsXYmod_[3][imod3]; cl3++) {
2022 Double_t ax = (XspCoord_[3][imod3][cl3] - XspCoord_[1][imod1][cl1])
2027 Double_t ay = (YspCoord_[3][imod3][cl3] - YspCoord_[1][imod1][cl1])
2033 cout <<
" X1 " << XspCoord_[1][imod1][cl1] <<
" X2 " << XspCoord_[2][imod2][cl2]
2034 <<
" X3 " << XspCoord_[3][imod3][cl3] <<
" was_candidate " << was_candidate
2035 <<
" ax " << ax <<
" ay " << ay <<
" Z1 " <<
Zstation[1][imod1] <<
" Z3 "
2043 cout <<
" bx_target_region " << bx_target_region <<
" half_target_regionX "
2048 cout <<
" by_target_region " << by_target_region <<
" half_target_regionY "
2053 if (was_candidate == 0) {
2054 bx_candidate = bx_target_region;
2055 by_candidate = by_target_region;
2056 iModX_candidate = imod3;
2057 iClustXMod_candidate = cl3;
2060 cout <<
" write candidate: bx_target_region " << bx_target_region
2061 <<
" bx_candidate " << bx_candidate <<
" by_target_region " << by_target_region
2062 <<
" by_candidate " << by_candidate << endl;
2066 if (iModX_candidate == imod3 && iClustXMod_candidate == cl3) {
2068 cout <<
" 1" << endl;
2073 cout <<
" 2" << endl;
2079 cout <<
" 3" << endl;
2091 cout <<
" 4" << endl;
2095 bx_candidate = bx_target_region;
2096 by_candidate = by_target_region;
2097 iModX_candidate = imod3;
2098 iClustXMod_candidate = cl3;
2100 cout <<
" re - write " << endl;
2106 if (bx_candidate > 900.)
2109 if (tmpTr.
CoordX[3] == XspCoord_[3][iModX_candidate][iClustXMod_candidate])
2111 if (tmpTr.
CoordXp[3] == XpspCoord_[3][iModX_candidate][iClustXMod_candidate])
2116 if (iModX_candidate > -1) {
2117 iModX[3] = iModX_candidate;
2156 Int_t TotalNumberOfHits = 0;
2168 TotalNumberOfHits = 6;
2169 ChiSquareNdf =
ChiSquare / (TotalNumberOfHits - 4);
2172 cout <<
" before cut ChiSquareNDF " << ChiSquareNdf <<
" Chi2_Globcut " <<
Chi2_Globcut
2173 <<
" TotalNumberOfHits " << TotalNumberOfHits << endl;
2185 if (TotalNumberOfHits == 6) {
2187 for (
size_t itr = 0; itr < out_tracks.size(); ++itr) {
2196 if (out_tracks.at(itr).Chi2 > ChiSquareNdf)
2197 out_tracks.erase(out_tracks.begin() + itr);
2199 ChiSquareNdf = 999.;
2206 tmpTr.
Chi2 = ChiSquareNdf;
2207 tmpTr.
Nhits = TotalNumberOfHits;
2208 tmpTr.
Xv = bx_candidate;
2209 tmpTr.
Yv = by_candidate;
2216 cout <<
" Xv_candidate " << bx_candidate <<
" Yv_candidate " << by_candidate << endl;
2238 cout <<
" st " << st <<
" Z " << tmpTr.
CoordZ[st] << endl;
2240 cout <<
" CoordX[" << st <<
"] " << tmpTr.
CoordX[st] <<
" strip "
2242 << tmpTr.
SumQX[st] << endl;
2244 cout <<
" CoordXp[" << st <<
"] " << tmpTr.
CoordXp[st] <<
" strip "
2246 << tmpTr.
SumQXp[st] << endl;
2249 out_tracks.push_back(tmpTr);
2252 cout <<
" ax " << tmpTr.
param[0] <<
" bx " << tmpTr.
param[1] <<
" ay " << tmpTr.
param[2]
2253 <<
" by " << tmpTr.
param[3] <<
" Chi2 " << tmpTr.
Chi2 << endl;
2255 cout <<
" write " << out_tracks.size() << endl;
2445 vector<tracksX>& CleanTr_,
2446 Int_t** NhitsXYmod_,
2454 cout <<
" CheckLeftover" << endl;
2462 if (
fDebug && CleanTr_.size() > 0)
2463 cout <<
"track was but: " << endl;
2465 for (
size_t InIter = 0; InIter < CleanTr_.size(); ++InIter) {
2467 if (CleanTr_.at(InIter).Nhits < 5 || CleanTr_.at(InIter).Nhits == 6)
2471 cout <<
" itr " << InIter <<
" if Nhits = 5: " << CleanTr_.at(InIter).Nhits << endl;
2476 if (CleanTr_.at(InIter).CoordX[st] < -900.) {
2479 cout <<
"no X[" << st <<
"]: " << CleanTr_.at(InIter).CoordX[st] << endl;
2481 cout <<
" was sp points? " << endl;
2483 if (st == 1 && imod > 3)
2485 if (st == 2 && imod > 1)
2489 cout <<
" Nspatial[" << st <<
"]= " << NhitsXYmod_[st][imod] << endl;
2491 if (NhitsXYmod_[st][imod] > 0)
2494 for (
Int_t cl = 0; cl < NhitsXYmod_[st][imod]; cl++) {
2496 cout <<
"st[" << st <<
"] " <<
" X " << XspCoord_[st][imod][cl] << endl;
2501 CleanTr_.at(InIter).param[0] * CleanTr_.at(InIter).CoordZ[st] + CleanTr_.at(InIter).param[1];
2503 CleanTr_.at(InIter).param[2] * CleanTr_.at(InIter).CoordZ[st] + CleanTr_.at(InIter).param[3];
2506 if (woSp[st] == 0) {
2508 cout <<
" woSp[" << st <<
"] " << woSp[st] <<
"-> FitX " << FitX <<
" FitY " << FitY << endl;
2509 XspCoord_[st][1][NhitsXYmod_[st][1]] = FitX;
2510 YspCoord_[st][1][NhitsXYmod_[st][1]] = FitY;
2511 SigmspX_[st][1][NhitsXYmod_[st][1]] = 0.0060;
2512 SigmspY_[st][1][NhitsXYmod_[st][1]] = 0.2;
2513 NhitsXYmod_[st][1]++;
2518 if (CleanTr_.at(InIter).CoordY[st] < -900.) {
2520 cout <<
"no Y[" << st <<
"] " << CleanTr_.at(InIter).CoordY[st] << endl;
2522 if (st == 1 && imod > 3)
2524 if (st == 2 && imod > 1)
2528 cout <<
" Nspatial = " << NhitsXYmod_[st][imod] << endl;
2530 if (NhitsXYmod_[st][imod] > 0)
2533 for (
Int_t cl = 0; cl < NhitsXYmod_[st][imod]; cl++) {
2535 cout <<
"st[" << st <<
"] " <<
" Y " << YspCoord_[st][imod][cl] << endl;
2539 CleanTr_.at(InIter).param[0] * CleanTr_.at(InIter).CoordZ[st] + CleanTr_.at(InIter).param[1];
2541 CleanTr_.at(InIter).param[2] * CleanTr_.at(InIter).CoordZ[st] + CleanTr_.at(InIter).param[3];
2543 if (woSp[st] == 0) {
2545 cout <<
" woSp[" << st <<
"] " << woSp[st] <<
"-> FitX " << FitX <<
" FitY " << FitY << endl;
2546 XspCoord_[st][1][NhitsXYmod_[st][1]] = FitX;
2547 YspCoord_[st][1][NhitsXYmod_[st][1]] = FitY;
2548 SigmspX_[st][1][NhitsXYmod_[st][1]] = 0.0060;
2549 SigmspY_[st][1][NhitsXYmod_[st][1]] = 0.2;
2550 NhitsXYmod_[st][1]++;
2562 cout <<
" pointsXsp[" << ist <<
"] ";
2564 for (
Int_t cl = 0; cl < Nspatial[ist][imod]; cl++) {
2566 cout << pointsXsp[ist][imod][cl] <<
" ";
2577 cout <<
" pointsXpsp[" << ist <<
"] ";
2579 for (
Int_t cl = 0; cl < Nspatial[ist][imod]; cl++) {
2581 cout << pointsXpsp[ist][imod][cl] <<
" ";
2591 cout <<
" pointsX[" << ist <<
"] ";
2593 for (
Int_t cl = 0; cl < NpointsX[ist][imod]; cl++) {
2595 cout << pointsX[ist][imod][cl] <<
" ";
2603 cout <<
" pointsXp[" << ist <<
"] ";
2605 for (
Int_t cl = 0; cl < NpointsXp[ist][imod]; cl++) {
2607 cout << pointsXp[ist][imod][cl] <<
" ";
2617 if (ist == 1 && imod > 3)
2619 if (ist == 2 && imod > 1)
2623 if (NhitsXYmod_[ist][imod] > 0)
2630 cout <<
" woSp[" << ist <<
"] " << woSp[ist] << endl;
2632 for (
Int_t cl = 0; cl < NpointsX[ist][imod]; cl++) {
2635 if (is == 1 && im > 3)
2637 if (is == 2 && im > 1)
2640 for (
Int_t clp = 0; clp < NpointsXp[is][im]; clp++) {
2641 if (ist == 1 && is == 2) {
2643 cout <<
" X[" << ist <<
"] " << pointsX[ist][imod][cl] <<
" Xp[" << is <<
"] "
2644 << pointsXp[is][im][clp] <<
" XXp "
2645 << pointsX[ist][imod][cl] - pointsXp[is][im][clp] << endl;
2646 if (
fDebug &&
fabs(pointsX[ist][imod][cl] - pointsXp[is][im][clp]) > 0.)
2648 if (
fDebug &&
fabs(pointsX[ist][imod][cl] - pointsXp[is][im][clp]) > 0.
2649 &&
fabs(pointsX[ist][imod][cl] - pointsXp[is][im][clp]) < 0.2)
2653 XspCoord_[ist][imod][NhitsXYmod_[ist][imod]] = pointsX[ist][imod][cl];
2654 YspCoord_[ist][imod][NhitsXYmod_[ist][imod]] =
2655 (pointsX[ist][imod][cl] - pointsXp[is][im][clp]) /
tg2_5;
2656 SigmspX_[ist][imod][NhitsXYmod_[ist][imod]] = pointsXsig[ist][imod][cl];
2657 SigmspY_[ist][imod][NhitsXYmod_[ist][imod]] = 0.2;
2659 cout <<
" Ysp " << (pointsX[ist][imod][cl] - pointsXp[is][im][clp]) /
tg2_5
2661 NhitsXYmod_[ist][imod]++;
2675 if (ist == 1 && imod > 3)
2677 if (ist == 2 && imod > 1)
2682 if (NhitsXYmod_[ist][imod] > 0)
2689 cout <<
" woSp[" << ist <<
"] " << woSp[ist] << endl;
2691 for (
Int_t cl = 0; cl < NpointsXp[ist][imod]; cl++) {
2694 if (is == 1 && im > 3)
2696 if (is == 2 && im > 1)
2699 for (
Int_t clp = 0; clp < NpointsX[is][im]; clp++) {
2700 if (ist == 1 && is == 2) {
2702 cout <<
" Xp[" << ist <<
"] " << pointsXp[ist][imod][cl] <<
" X[" << is <<
"] "
2703 << pointsX[is][im][clp] <<
" XXp "
2704 << pointsXp[ist][imod][cl] - pointsX[is][im][clp] << endl;
2705 if (
fDebug &&
fabs(pointsXp[ist][imod][cl] - pointsX[is][im][clp]) > 0.)
2707 if (
fDebug &&
fabs(pointsXp[ist][imod][cl] - pointsX[is][im][clp]) > 0.
2708 &&
fabs(pointsXp[ist][imod][cl] - pointsX[is][im][clp]) < 0.3)
2712 XspCoord_[ist][imod][NhitsXYmod_[ist][imod]] = pointsX[is][im][clp];
2713 YspCoord_[ist][imod][NhitsXYmod_[ist][imod]] =
2714 (pointsX[is][im][clp] - pointsXp[ist][imod][cl]) /
tg2_5;
2715 SigmspX_[ist][imod][NhitsXYmod_[ist][imod]] = pointsXsig[is][im][clp];
2716 SigmspY_[ist][imod][NhitsXYmod_[ist][imod]] = 0.2;
2718 cout <<
" Ysp " << (pointsX[is][im][clp] - pointsXp[ist][imod][cl]) /
tg2_5
2720 NhitsXYmod_[ist][imod]++;
2732 if (is == 1 && im > 3)
2734 if (is == 2 && im > 1)
2737 for (
Int_t icl = 0; icl < NhitsXYmod_[is][im]; icl++) {
2745 if (ist == 1 && imod > 3)
2747 if (ist == 2 && imod > 1)
2749 for (
Int_t cl = 0; cl < NhitsXYmod_[ist][imod]; cl++) {
2751 hY_XSisp1->Fill(XspCoord_[ist][imod][cl], YspCoord_[ist][imod][cl]);
2753 hY_XSisp2->Fill(XspCoord_[ist][imod][cl], YspCoord_[ist][imod][cl]);
2764 cout <<
"-----end of track finding ------ Ntr " << CleanTr_.size() << endl;
2765 Double_t ver_averx = 0., ver_avery = 0., sum_xv = 0., sum_yv = 0.;
2767 for (
size_t InIter = 0; InIter < CleanTr_.size(); ++InIter) {
2769 hNpoint->Fill(CleanTr_.at(InIter).Nhits);
2770 hAxglob->Fill(CleanTr_.at(InIter).param[0]);
2771 hBxglob->Fill(CleanTr_.at(InIter).param[1]);
2772 hAyglob->Fill(CleanTr_.at(InIter).param[2]);
2773 hByglob->Fill(CleanTr_.at(InIter).param[3]);
2781 hvertexXY->Fill(CleanTr_.at(InIter).Xv, CleanTr_.at(InIter).Yv);
2783 sum_xv += CleanTr_.at(InIter).Xv;
2784 sum_yv += CleanTr_.at(InIter).Yv;
2789 Double_t X1 = CleanTr_.at(InIter).param[0] * (Z1 -
Zcentr) + CleanTr_.at(InIter).param[1];
2790 Double_t Y1 = CleanTr_.at(InIter).param[2] * (Z1 -
Zcentr) + CleanTr_.at(InIter).param[3];
2792 Double_t X2 = CleanTr_.at(InIter).param[0] * (Z2 -
Zcentr) + CleanTr_.at(InIter).param[1];
2793 Double_t Y2 = CleanTr_.at(InIter).param[2] * (Z2 -
Zcentr) + CleanTr_.at(InIter).param[3];
2803 cout <<
" ---iTr " << InIter <<
" Nhits " << CleanTr_.at(InIter).Nhits <<
" ax " << CleanTr_.at(InIter).param[0]
2804 <<
" bx " << CleanTr_.at(InIter).param[1] <<
" ay " << CleanTr_.at(InIter).param[2] <<
" by "
2805 << CleanTr_.at(InIter).param[3] <<
" Chi2 " << CleanTr_.at(InIter).Chi2 << endl;
2806 cout <<
" Xv " << CleanTr_.at(InIter).Xv <<
" Yv " << CleanTr_.at(InIter).Yv << endl;
2807 cout <<
" --X--" << endl;
2808 Double_t X1_0 = 999., X1_1 = 999., X1_2 = 999., X1_3 = 999., X2_0 = 999., X2_1 = 999., X3_1 = 999., X3_2 = 999.;
2811 if (CleanTr_.at(InIter).CoordX[st] < -900.)
2813 Double_t Hit = CleanTr_.at(InIter).CoordX[st];
2814 Double_t Fit = CleanTr_.at(InIter).param[0] * CleanTr_.at(InIter).CoordZ[st] + CleanTr_.at(InIter).param[1];
2815 cout <<
" st " << st <<
" mod " << CleanTr_.at(InIter).ModNum[st] <<
" Xhit " << Hit <<
" Xfit " << Fit
2816 <<
" dX " << Hit - Fit <<
" Z " << CleanTr_.at(InIter).CoordZ[st] <<
" strip "
2817 << CleanTr_.at(InIter).StripNumX[st] <<
" Clsize " << CleanTr_.at(InIter).ClSizeX[st] <<
" Q "
2818 << CleanTr_.at(InIter).SumQX[st] << endl;
2821 hX_st_1->Fill(CleanTr_.at(InIter).CoordX[st]);
2824 if (CleanTr_.at(InIter).ModNum[st] == 0) {
2825 X1_0 = CleanTr_.at(InIter).CoordX[1];
2826 hdXvsXst1_0->Fill(CleanTr_.at(InIter).CoordX[1], CleanTr_.at(InIter).CoordX[1] - Fit);
2828 if (CleanTr_.at(InIter).ModNum[st] == 1) {
2829 X1_1 = CleanTr_.at(InIter).CoordX[1];
2830 hdXvsXst1_1->Fill(CleanTr_.at(InIter).CoordX[1], CleanTr_.at(InIter).CoordX[1] - Fit);
2832 if (CleanTr_.at(InIter).ModNum[st] == 2) {
2833 X1_2 = CleanTr_.at(InIter).CoordX[1];
2834 hdXvsXst1_2->Fill(CleanTr_.at(InIter).CoordX[1], CleanTr_.at(InIter).CoordX[1] - Fit);
2836 if (CleanTr_.at(InIter).ModNum[st] == 3) {
2837 X1_3 = CleanTr_.at(InIter).CoordX[1];
2838 hdXvsXst1_3->Fill(CleanTr_.at(InIter).CoordX[1], CleanTr_.at(InIter).CoordX[1] - Fit);
2842 hX_st_2->Fill(CleanTr_.at(InIter).CoordX[st]);
2845 if (CleanTr_.at(InIter).ModNum[2] == 0) {
2846 X2_0 = CleanTr_.at(InIter).CoordX[2];
2847 hdXvsXst2_0->Fill(CleanTr_.at(InIter).CoordX[2], CleanTr_.at(InIter).CoordX[2] - Fit);
2849 if (CleanTr_.at(InIter).ModNum[2] == 1) {
2850 X2_1 = CleanTr_.at(InIter).CoordX[2];
2851 hdXvsXst2_1->Fill(CleanTr_.at(InIter).CoordX[2], CleanTr_.at(InIter).CoordX[2] - Fit);
2855 hX_st_3->Fill(CleanTr_.at(InIter).CoordX[st]);
2858 if (CleanTr_.at(InIter).ModNum[3] == 1) {
2859 X3_1 = CleanTr_.at(InIter).CoordX[3];
2860 hdXvsXst3_1->Fill(CleanTr_.at(InIter).CoordX[3], CleanTr_.at(InIter).CoordX[3] - Fit);
2861 hdXXp3_mod1->Fill(CleanTr_.at(InIter).CoordX[st] - CleanTr_.at(InIter).CoordXp[st]);
2863 if (CleanTr_.at(InIter).ModNum[3] == 2) {
2864 X3_2 = CleanTr_.at(InIter).CoordX[3];
2865 hdXvsXst3_2->Fill(CleanTr_.at(InIter).CoordX[3], CleanTr_.at(InIter).CoordX[3] - Fit);
2866 hdXXp3_mod2->Fill(CleanTr_.at(InIter).CoordX[st] - CleanTr_.at(InIter).CoordXp[st]);
2870 if (X1_0 < 900. && X2_0 < 900.)
2872 if (X1_0 < 900. && X2_1 < 900.)
2874 if (X1_1 < 900. && X2_0 < 900.)
2876 if (X1_1 < 900. && X2_1 < 900.)
2878 if (X1_2 < 900. && X2_0 < 900.)
2880 if (X1_2 < 900. && X2_1 < 900.)
2882 if (X1_3 < 900. && X2_0 < 900.)
2884 if (X1_3 < 900. && X2_1 < 900.)
2886 if (X2_0 < 900. && X3_1 < 900.)
2888 if (X2_0 < 900. && X3_2 < 900.)
2890 if (X2_1 < 900. && X3_1 < 900.)
2892 if (X2_1 < 900. && X3_2 < 900.)
2895 if (CleanTr_.at(InIter).Nhits == 6) {
2896 Double_t Ax = (CleanTr_.at(InIter).CoordX[1] - CleanTr_.at(InIter).CoordX[3])
2897 / (CleanTr_.at(InIter).CoordZ[1] - CleanTr_.at(InIter).CoordZ[3]);
2900 - (Ax * (CleanTr_.at(InIter).CoordZ[2] - CleanTr_.at(InIter).CoordZ[1])
2901 + CleanTr_.at(InIter).CoordX[1]));
2904 - (Ax * (CleanTr_.at(InIter).CoordZ[2] - CleanTr_.at(InIter).CoordZ[1])
2905 + CleanTr_.at(InIter).CoordX[1]));
2907 hdX_st1_st2->Fill(CleanTr_.at(InIter).CoordX[1] - CleanTr_.at(InIter).CoordX[2]);
2908 hdX_st2_st3->Fill(CleanTr_.at(InIter).CoordX[2] - CleanTr_.at(InIter).CoordX[3]);
2909 hdX_st1_st3->Fill(CleanTr_.at(InIter).CoordX[1] - CleanTr_.at(InIter).CoordX[3]);
2912 cout <<
" --Xp--" << endl;
2913 Double_t Xp2_0 = 999., Xp2_1 = 999.;
2915 if (CleanTr_.at(InIter).CoordXp[st] < -900.)
2917 Double_t Hit = CleanTr_.at(InIter).CoordXp[st];
2919 (CleanTr_.at(InIter).param[0] * CleanTr_.at(InIter).CoordZ[st] + CleanTr_.at(InIter).param[1])
2920 + (CleanTr_.at(InIter).param[2] * CleanTr_.at(InIter).CoordZ[st] + CleanTr_.at(InIter).param[3])
2921 *
Angle(st, CleanTr_.at(InIter).ModNum[st]) *
tg2_5;
2924 cout <<
" st " << st <<
" Xphit " << Hit <<
" Xpfit " << Fit <<
" dXp " << Hit - Fit <<
" Z "
2925 << CleanTr_.at(InIter).CoordZ[st] <<
" strip " << CleanTr_.at(InIter).StripNumXp[st] <<
" Clsize "
2926 << CleanTr_.at(InIter).ClSizeXp[st] <<
" Q " << CleanTr_.at(InIter).SumQXp[st] << endl;
2929 if (CleanTr_.at(InIter).ModNum[2] == 0) {
2930 Xp2_0 = CleanTr_.at(InIter).CoordXp[2];
2932 if (CleanTr_.at(InIter).ModNum[2] == 1) {
2933 Xp2_1 = CleanTr_.at(InIter).CoordXp[2];
2938 if (CleanTr_.at(InIter).ModNum[3] == 1) {
2941 if (CleanTr_.at(InIter).ModNum[3] == 2) {
2946 if (CleanTr_.at(InIter).Nhits == 6) {
2947 Double_t Axp = (CleanTr_.at(InIter).CoordXp[1] - CleanTr_.at(InIter).CoordXp[3])
2948 / (CleanTr_.at(InIter).CoordZ[1] - CleanTr_.at(InIter).CoordZ[3]);
2951 - (Axp * (CleanTr_.at(InIter).CoordZ[2] - CleanTr_.at(InIter).CoordZ[1])
2952 + CleanTr_.at(InIter).CoordXp[1]));
2955 - (Axp * (CleanTr_.at(InIter).CoordZ[2] - CleanTr_.at(InIter).CoordZ[1])
2956 + CleanTr_.at(InIter).CoordXp[1]));
2960 cout <<
" --Y--" << endl;
2961 Double_t Y1_0 = 999., Y1_1 = 999., Y1_2 = 999., Y1_3 = 999., Y2_0 = 999., Y2_1 = 999., Y3_1 = 999., Y3_2 = 999.;
2964 if (CleanTr_.at(InIter).CoordY[st] < -900.)
2966 Double_t Hit = CleanTr_.at(InIter).CoordY[st];
2967 Double_t Fit = CleanTr_.at(InIter).param[2] * CleanTr_.at(InIter).CoordZ[st] + CleanTr_.at(InIter).param[3];
2968 cout <<
" st " << st <<
" Yhit " << Hit <<
" Yfit " << Fit <<
" dY " << Hit - Fit <<
" Z "
2969 << CleanTr_.at(InIter).CoordZ[st] << endl;
2972 hY_st_1->Fill(CleanTr_.at(InIter).CoordY[st]);
2977 hY_st_2->Fill(CleanTr_.at(InIter).CoordY[st]);
2982 hY_st_3->Fill(CleanTr_.at(InIter).CoordY[st]);
2983 hdYvsYst_3->Fill(CleanTr_.at(InIter).CoordY[3], CleanTr_.at(InIter).CoordY[3] - Fit);
2984 hdY_st_3->Fill(CleanTr_.at(InIter).CoordY[3] - Fit);
2985 if (
fabs(Hit - Fit) > 0.1)
2986 cout <<
" > 0.1 " << endl;
2990 if (CleanTr_.at(InIter).ModNum[1] == 0) {
2992 Y1_0 = CleanTr_.at(InIter).CoordY[st];
2994 if (CleanTr_.at(InIter).ModNum[1] == 1) {
2996 Y1_1 = CleanTr_.at(InIter).CoordY[st];
2998 if (CleanTr_.at(InIter).ModNum[1] == 2) {
3000 Y1_2 = CleanTr_.at(InIter).CoordY[st];
3002 if (CleanTr_.at(InIter).ModNum[1] == 3) {
3004 Y1_3 = CleanTr_.at(InIter).CoordY[st];
3008 if (CleanTr_.at(InIter).ModNum[2] == 0) {
3010 Y2_0 = CleanTr_.at(InIter).CoordY[st];
3012 if (CleanTr_.at(InIter).ModNum[2] == 1) {
3014 Y2_1 = CleanTr_.at(InIter).CoordY[st];
3018 if (CleanTr_.at(InIter).ModNum[3] == 1) {
3020 Y3_1 = CleanTr_.at(InIter).CoordY[st];
3022 if (CleanTr_.at(InIter).ModNum[3] == 2) {
3024 Y3_2 = CleanTr_.at(InIter).CoordY[st];
3029 double Ay_pr = -999.;
3030 double Y_pr = -999.;
3031 if (CleanTr_.at(InIter).CoordY[1] > -900. && CleanTr_.at(InIter).CoordY[3] > -900.) {
3032 Ay_pr = (CleanTr_.at(InIter).CoordY[1] - CleanTr_.at(InIter).Yv)
3035 Ay_pr * (CleanTr_.at(InIter).CoordZ[3] - CleanTr_.at(InIter).CoordZ[1]) + CleanTr_.at(InIter).CoordY[1];
3037 if (CleanTr_.at(InIter).CoordY[2] > -900. && CleanTr_.at(InIter).CoordY[3] > -900.) {
3038 Ay_pr = (CleanTr_.at(InIter).CoordY[2] - CleanTr_.at(InIter).Yv)
3041 Ay_pr * (CleanTr_.at(InIter).CoordZ[3] - CleanTr_.at(InIter).CoordZ[2]) + CleanTr_.at(InIter).CoordY[2];
3043 cout <<
" Y3 predicted " << Y_pr <<
" Y " << CleanTr_.at(InIter).CoordY[3] << endl;
3045 hdY_st1_st2->Fill(CleanTr_.at(InIter).CoordY[1] - CleanTr_.at(InIter).CoordY[2]);
3046 hdY_st2_st3->Fill(CleanTr_.at(InIter).CoordY[2] - CleanTr_.at(InIter).CoordY[3]);
3047 hdY_st1_st3->Fill(CleanTr_.at(InIter).CoordY[1] - CleanTr_.at(InIter).CoordY[3]);
3049 if (Y1_0 < 900. && Y2_0 < 900.)
3051 if (Y1_0 < 900. && Y2_1 < 900.)
3053 if (Y1_1 < 900. && Y2_0 < 900.)
3055 if (Y1_1 < 900. && Y2_1 < 900.)
3057 if (Y1_2 < 900. && Y2_0 < 900.)
3059 if (Y1_2 < 900. && Y2_1 < 900.)
3061 if (Y1_3 < 900. && Y2_0 < 900.)
3063 if (Y1_3 < 900. && Y2_1 < 900.)
3065 if (Y2_0 < 900. && Y3_1 < 900.)
3067 if (Y2_0 < 900. && Y3_2 < 900.)
3069 if (Y2_1 < 900. && Y3_1 < 900.)
3071 if (Y2_1 < 900. && Y3_2 < 900.)
3074 if (CleanTr_.at(InIter).Nhits == 6) {
3075 Double_t Ax = (CleanTr_.at(InIter).CoordY[1] - CleanTr_.at(InIter).CoordY[3])
3076 / (CleanTr_.at(InIter).CoordZ[1] - CleanTr_.at(InIter).CoordZ[3]);
3077 Double_t Ax23 = (CleanTr_.at(InIter).CoordY[2] - CleanTr_.at(InIter).CoordY[3])
3078 / (CleanTr_.at(InIter).CoordZ[2] - CleanTr_.at(InIter).CoordZ[3]);
3082 - (Ax23 * (CleanTr_.at(InIter).CoordZ[1] - CleanTr_.at(InIter).CoordZ[2])
3083 + CleanTr_.at(InIter).CoordY[2]));
3086 - (Ax23 * (CleanTr_.at(InIter).CoordZ[1] - CleanTr_.at(InIter).CoordZ[2])
3087 + CleanTr_.at(InIter).CoordY[2]));
3090 - (Ax23 * (CleanTr_.at(InIter).CoordZ[1] - CleanTr_.at(InIter).CoordZ[2])
3091 + CleanTr_.at(InIter).CoordY[2]));
3094 - (Ax23 * (CleanTr_.at(InIter).CoordZ[1] - CleanTr_.at(InIter).CoordZ[2])
3095 + CleanTr_.at(InIter).CoordY[2]));
3099 - (Ax * (CleanTr_.at(InIter).CoordZ[2] - CleanTr_.at(InIter).CoordZ[1])
3100 + CleanTr_.at(InIter).CoordY[1]));
3103 - (Ax * (CleanTr_.at(InIter).CoordZ[2] - CleanTr_.at(InIter).CoordZ[1])
3104 + CleanTr_.at(InIter).CoordY[1]));
3108 if (CleanTr_.at(InIter).CoordX[1] > -900. || CleanTr_.at(InIter).CoordXp[1] > -900.)
3110 CleanTr_.at(InIter).param[0] * (CleanTr_.at(InIter).CoordZ[1] - z_cnt) + CleanTr_.at(InIter).param[1],
3111 CleanTr_.at(InIter).param[2] * (CleanTr_.at(InIter).CoordZ[1] - z_cnt) + CleanTr_.at(InIter).param[3]);
3112 if (CleanTr_.at(InIter).CoordX[2] > -900. || CleanTr_.at(InIter).CoordXp[2] > -900.)
3114 CleanTr_.at(InIter).param[0] * (CleanTr_.at(InIter).CoordZ[2] - z_cnt) + CleanTr_.at(InIter).param[1],
3115 CleanTr_.at(InIter).param[2] * (CleanTr_.at(InIter).CoordZ[2] - z_cnt) + CleanTr_.at(InIter).param[3]);
3117 CleanTr_.at(InIter).param[0] * (CleanTr_.at(InIter).CoordZ[3] - z_cnt) + CleanTr_.at(InIter).param[1],
3118 CleanTr_.at(InIter).param[2] * (CleanTr_.at(InIter).CoordZ[3] - z_cnt) + CleanTr_.at(InIter).param[3]);
3123 if (CleanTr_.at(InIter).CoordX[st] < -900.)
3124 D_eff->Fill(2 * st - 1);
3125 if (CleanTr_.at(InIter).CoordXp[st] < -900.)
3126 D_eff->Fill(2 * st);
3129 D_eff->Fill(2 * st - 1);
3130 D_eff->Fill(2 * st);
3131 if (CleanTr_.at(InIter).CoordX[st] > -900.)
3132 N_eff->Fill(2 * st - 1);
3133 if (CleanTr_.at(InIter).CoordXp[st] > -900.)
3134 N_eff->Fill(2 * st);
3140 if (CleanTr_.size() > 0) {
3141 ver_averx = sum_xv / CleanTr_.size();
3142 ver_avery = sum_yv / CleanTr_.size();
3145 cout <<
"-----end find tracks ------ Ntr " << CleanTr_.size() << endl;
3151 Int_t** Nleftoversp_,
3158 Int_t** NleftoverX_,
3159 Int_t** NleftoverXp_,
3164 vector<tracksX>& vec_tracks_,
3180 cout <<
" case2:" << Fi_St <<
"time " << endl;
3184 Double_t xv_candidate = 999., yv_candidate = 999., ax_candidate = 999., ay_candidate = 999.;
3185 Int_t iClustXMod_candidate = -1, iModX_candidate = -1;
3186 Double_t dxV_thr = .2, dyV_thr = .4;
3188 Int_t TotalNumberOfHits = 0;
3203 for (
Int_t imod1 = 0; imod1 < Nmod_Fi; imod1++) {
3204 for (
Int_t cl1 = 0; cl1 < Nleftoversp_[Fi_St][imod1]; cl1++) {
3206 Double_t ax_target_region = -999., bx_target_region = -999., ay_target_region = -999.,
3207 by_target_region = -999.;
3208 Bool_t was_candidate = 0;
3209 ax_candidate = 999., ay_candidate = 999., xv_candidate = 999., yv_candidate = 999.;
3216 for (
Int_t cl3 = 0; cl3 < Nleftoversp_[3][imod3]; cl3++) {
3223 ax_target_region = (leftoverXsp_[3][imod3][cl3] - leftoverXsp_[Fi_St][imod1][cl1])
3228 ay_target_region = (leftoverYsp_[3][imod3][cl3] - leftoverYsp_[Fi_St][imod1][cl1])
3234 cout <<
" bx_target_region " << bx_target_region <<
" by_target_region " << by_target_region
3242 if (was_candidate == 0) {
3244 xv_candidate = bx_target_region;
3245 yv_candidate = by_target_region;
3246 ax_candidate = ax_target_region;
3247 ay_candidate = ay_target_region;
3248 iModX_candidate = imod3;
3249 iClustXMod_candidate = cl3;
3253 if (
fabs(bx_target_region) > (
fabs(xv_candidate) + dxV_thr))
3255 if (
fabs(by_target_region) > (
fabs(yv_candidate) + dyV_thr))
3257 if ((
fabs(bx_target_region) + 0.5 *
fabs(by_target_region))
3258 > (
fabs(xv_candidate) + 0.25 *
fabs(yv_candidate)))
3261 xv_candidate = bx_target_region;
3262 yv_candidate = by_target_region;
3263 ax_candidate = ax_target_region;
3264 ay_candidate = ay_target_region;
3266 iModX_candidate = imod3;
3267 iClustXMod_candidate = cl3;
3277 cout <<
" aft.st3 cycle: xv_candidate " << xv_candidate <<
" by_cand " << yv_candidate
3278 <<
" was_candidate " << was_candidate << endl;
3279 if (xv_candidate > 900.)
3293 if (iModX_candidate > -1) {
3294 iModX[Fi_St] = imod1;
3295 iModX[3] = iModX_candidate;
3313 cout <<
" try to search 5th p. Sec_St " << Sec_St <<
" Nmod_Sec " << Nmod_Sec << endl;
3314 for (
Int_t imod2 = 0; imod2 < Nmod_Sec; imod2++) {
3322 for (
Int_t clx2 = 0; clx2 < NleftoverX_[Sec_St][imod2]; clx2++) {
3333 cout <<
"search 5p in X. tmp x1 " << leftoverXsp_[Fi_St][imod1][cl1] <<
" x2 "
3334 << leftoverX_[Sec_St][imod2][clx2] <<
" hrd " <<
half_roadX1_X2 << endl;
3335 if (
fabs(leftoverXsp_[Fi_St][imod1][cl1] - leftoverX_[Sec_St][imod2][clx2]) >
half_roadX1_X2)
3338 cout <<
"found 5th p in X" << Sec_St <<
" " << leftoverX_[Sec_St][imod2][clx2] << endl;
3342 if (clx2 < (NleftoverX_[Sec_St][imod2] - 1)) {
3343 if (
fabs(leftoverXsp_[Fi_St][imod1][cl1] - leftoverX_[Sec_St][imod2][clx2])
3344 >
fabs(leftoverXsp_[Fi_St][imod1][cl1] - leftoverX_[Sec_St][imod2][clx2 + 1]))
3348 iModX[Sec_St] = imod2;
3356 TotalNumberOfHits = 0;
3360 for (
Int_t coeff = 0; coeff < 4; ++coeff) {
3367 TotalNumberOfHits = Npoint;
3369 ChiSquareNdf =
ChiSquare / (TotalNumberOfHits - 4);
3374 cout <<
" before cut ChiSquareNDF " << ChiSquareNdf <<
" TotalNumberOfHits "
3375 << TotalNumberOfHits << endl;
3393 cout <<
" case2: x5_exist " << endl;
3407 for (
Int_t clxp2 = 0; clxp2 < NleftoverXp_[Sec_St][imod2]; clxp2++) {
3425 cout <<
" sign1 " << sign1 <<
" sign2 " << sign2 << endl;
3427 if ((sign1 == sign2)
3428 && (
fabs(leftoverXpsp_[Fi_St][imod1][cl1] - leftoverXp_[Sec_St][imod2][clxp2])
3431 if ((sign1 != sign2)
3432 && (
fabs(leftoverXpsp_[Fi_St][imod1][cl1] - leftoverXp_[Sec_St][imod2][clxp2])
3436 cout <<
" --Xp1 " << leftoverXpsp_[Fi_St][imod1][cl1] <<
" Xp2 "
3437 << leftoverXp_[Sec_St][imod2][clxp2] <<
" dXp "
3438 << leftoverXpsp_[Fi_St][imod1][cl1] - leftoverXp_[Sec_St][imod2][clxp2] << endl;
3442 iModX[Sec_St] = imod2;
3446 Xpforglfit[Sec_St][imod2] = leftoverXp_[Sec_St][
iModX[Sec_St]][clxp2];
3450 TotalNumberOfHits = 0;
3454 for (
Int_t coeff = 0; coeff < 4; ++coeff) {
3461 TotalNumberOfHits = Npoint;
3463 ChiSquareNdf =
ChiSquare / (TotalNumberOfHits - 4);
3468 cout <<
" before cut ChiSquareNDF " << ChiSquareNdf <<
" TotalNumberOfHits "
3469 << TotalNumberOfHits << endl;
3487 cout <<
" case2: xp5_exist " << xp5_exist << endl;
3501 cout <<
" case2: end search ------------" << endl;
3503 cout <<
" Npoint " << Npoint <<
" ChiSquareNdf " << ChiSquareNdf <<
" x5_exist " << x5_exist
3504 <<
" xp5_exist " << xp5_exist << endl;
3506 TotalNumberOfHits = Npoint;
3511 for (
Int_t coeff = 0; coeff < 4; ++coeff) {
3512 line_cand[coeff] = 0.;
3518 Xp_cand[st] = -999.;
3520 SigX_cand[st] = -999.;
3521 SigXp_cand[st] = -999.;
3522 SigY_cand[st] = -999.;
3525 if (TotalNumberOfHits > 4 && ChiSquareNdf < Chi2_cand && ChiSquareNdf <
Chi2_Globcut) {
3527 Chi2_cand = ChiSquareNdf;
3528 line_cand[0] =
line[0];
3529 line_cand[1] =
line[1];
3530 line_cand[2] =
line[2];
3531 line_cand[3] =
line[3];
3534 cout <<
" case2 5p cand Chi2Ndf " << Chi2_cand << endl;
3540 Mod_cand[st] =
iModX[st];
3549 cout <<
" X_cand[" << st <<
"] " << X_cand[st] <<
" Xp_cand[" << st <<
"] " << Xp_cand[st]
3550 <<
" iModX " <<
iModX[st] << endl;
3554 if (TotalNumberOfHits == 4) {
3556 cout <<
"TotalNumberOfHits == 4" << endl;
3560 line_cand[0] = ax_candidate;
3562 line_cand[2] = ay_candidate;
3566 cout <<
" case2 4p cand Xv " << xv_candidate <<
" Yv " << yv_candidate << endl;
3568 cout <<
" ax " << line_cand[0] <<
" bx " << line_cand[1] <<
" ay " << line_cand[2] <<
" by "
3569 << line_cand[3] << endl;
3575 Mod_cand[st] =
iModX[st];
3584 cout <<
" X_cand[" << st <<
"] " << X_cand[st] <<
" Xp_cand[" << st <<
"] " << Xp_cand[st]
3585 <<
" iModX " <<
iModX[st] << endl;
3591 if (TotalNumberOfHits >= 4 && Chi2_cand <
Chi2_Globcut) {
3594 cout <<
"case2: before writing: " << endl;
3596 cout <<
" st " << st <<
" X_cand " << X_cand[st] <<
" Xp_cand " << Xp_cand[st]
3605 ChiSquareNdf = 999.;
3609 for (
size_t itr = 0; itr < vec_tracks_.size(); ++itr) {
3613 cout <<
" itr " << itr <<
" st " << st <<
" X_tr " << vec_tracks_.at(itr).CoordX[st]
3614 <<
" Xp_tr " << vec_tracks_.at(itr).CoordXp[st] << endl;
3617 if (((vec_tracks_.at(itr).CoordX[1] == X_cand[1] && X_cand[1] > -900.)
3618 || (vec_tracks_.at(itr).CoordXp[1] == Xp_cand[1] && Xp_cand[1] > -900.))
3619 || ((vec_tracks_.at(itr).CoordX[2] == X_cand[2] && X_cand[2] > -900.)
3620 || (vec_tracks_.at(itr).CoordXp[2] == Xp_cand[2] && Xp_cand[2] > -900.))
3621 || ((vec_tracks_.at(itr).CoordX[3] == X_cand[3] && X_cand[3] > -900.)
3622 || (vec_tracks_.at(itr).CoordXp[3] == Xp_cand[3] && Xp_cand[3] > -900.))
3627 cout <<
" TotalNumberOfHits " << TotalNumberOfHits <<
" Nhits[" << itr <<
"] "
3628 << vec_tracks_.at(itr).Nhits << endl;
3629 if (vec_tracks_.at(itr).Nhits < TotalNumberOfHits) {
3630 vec_tracks_.erase(vec_tracks_.begin() + itr);
3633 if (vec_tracks_.at(itr).Nhits > TotalNumberOfHits) {
3635 cout <<
" Nhits > TotalNumberOfHits . Reject cand " << endl;
3640 if (vec_tracks_.at(itr).Nhits == TotalNumberOfHits && TotalNumberOfHits == 4) {
3642 cout <<
" Nhits " << vec_tracks_.at(itr).Nhits <<
" X1 "
3643 << vec_tracks_.at(itr).CoordX[1] <<
" X2 " << vec_tracks_.at(itr).CoordX[2]
3646 if ((
fabs(vec_tracks_.at(itr).Xv) + 0.25 *
fabs(vec_tracks_.at(itr).Yv))
3647 > (
fabs(xv_candidate) + 0.25 *
fabs(yv_candidate)))
3649 vec_tracks_.erase(vec_tracks_.begin() + itr);
3653 cout <<
" Nhits == TotalNumberOfHits == 4 . Reject cand " << endl;
3659 if (vec_tracks_.at(itr).Nhits == TotalNumberOfHits && TotalNumberOfHits == 5) {
3660 if (vec_tracks_.at(itr).Chi2 > Chi2_cand) {
3661 vec_tracks_.erase(vec_tracks_.begin() + itr);
3665 cout <<
" Nhits == TotalNumberOfHits == 5 . Reject cand ??? " << endl;
3670 if (vec_tracks_.at(itr).Nhits > TotalNumberOfHits) {
3672 cout <<
" Nhits=5 > TotalNumberOfHits=4 . Reject cand ??? " << endl;
3679 cout <<
" Chi2_cand " << Chi2_cand << endl;
3683 tmpTr.
Chi2 = Chi2_cand;
3684 tmpTr.
Nhits = TotalNumberOfHits;
3685 tmpTr.
Xv = xv_candidate;
3686 tmpTr.
Yv = yv_candidate;
3687 tmpTr.
param[0] = line_cand[0];
3688 tmpTr.
param[1] = line_cand[1];
3689 tmpTr.
param[2] = line_cand[2];
3690 tmpTr.
param[3] = line_cand[3];
3693 cout <<
" Xv_candidate " << xv_candidate <<
" Yv_candidate " << yv_candidate <<
" ChiNdf "
3694 << Chi2_cand << endl;
3696 if (Mod_cand[st] < 0)
3700 tmpTr.
CoordX[st] = X_cand[st];
3701 tmpTr.
CoordXp[st] = Xp_cand[st];
3702 tmpTr.
SigmaX[st] = SigX_cand[st];
3703 tmpTr.
SigmaXp[st] = SigXp_cand[st];
3705 tmpTr.
CoordY[st] = Y_cand[st];
3706 tmpTr.
SigmaY[st] = SigY_cand[st];
3725 cout <<
" st " << st <<
" Z " << tmpTr.
CoordZ[st] << endl;
3727 cout <<
" tmpTr.CoordX[" << st <<
"] " << tmpTr.
CoordX[st] <<
" strip " << tmpTr.
StripNumX[st]
3728 <<
" Clsize " << tmpTr.
ClSizeX[st] <<
" Q " << tmpTr.
SumQX[st] << endl;
3730 cout <<
" tmpTr.CoordXp[" << st <<
"] " << tmpTr.
CoordXp[st] <<
" strip "
3735 vec_tracks_.push_back(tmpTr);
3737 cout <<
" tmpTr.Xv " << tmpTr.
Xv <<
" tmpTr.Yv " << tmpTr.
Yv << endl;
3753 Int_t** NleftoverX_,
3754 Int_t** NleftoverXp_,
3759 vector<tracksX>& vec_tracks_,
3776 cout <<
" case3 " << endl;
3785 for (
Int_t cl1 = 0; cl1 < Nleftoversp_[1][imod1]; cl1++) {
3788 for (
Int_t cl2 = 0; cl2 < Nleftoversp_[2][imod2]; cl2++) {
3790 Bool_t was_candidate = 0;
3791 Int_t iClustXMod_candidate = -1, iModX_candidate = -1;
3792 Double_t ax12_from_target = 999., x_ex3 = 999., ay12_from_target = 999., y_ex3 = 999.;
3794 Double_t bx_candidate = 999., by_candidate = 999.;
3801 if (
fabs(leftoverXsp_[1][imod1][cl1] - leftoverXsp_[2][imod2][cl2]) >
half_roadX1_X2)
3807 if (
fabs(leftoverYsp_[1][imod1][cl1] - leftoverYsp_[2][imod2][cl2]) >
half_roadY1_Y2)
3820 Double_t y1_2 = 0.5 * (leftoverYsp_[1][imod1][cl1] + leftoverYsp_[2][imod2][cl2]);
3825 cout <<
" ax12_from_target " << ax12_from_target <<
" Xv_av " <<
Xv_av <<
" Yv_av " <<
Yv_av
3851 for (
Int_t clx3 = 0; clx3 < NleftoverX_[3][imod3]; clx3++) {
3857 cout <<
" X1 " << leftoverXsp_[1][imod1][cl1] <<
" X2 " << leftoverXsp_[2][imod2][cl2]
3858 <<
" x_ex3 " << x_ex3 << endl;
3860 cout <<
" Y1 " << leftoverYsp_[1][imod1][cl1] <<
" Y2 " << leftoverYsp_[2][imod2][cl2]
3861 <<
" y_ex3 " << y_ex3 << endl;
3863 if (
fabs(x_ex3 - leftoverX_[3][imod3][clx3]) > hrd_case3)
3866 if (!was_candidate) {
3868 iModX_candidate = imod3;
3869 iClustXMod_candidate = clx3;
3873 ay1_2_cand = ay12_from_target;
3875 cout <<
" write candidate3 x3 = " << leftoverX_[3][imod3][clx3] << endl;
3877 if ((x_ex3 - leftoverX_[3][imod3][clx3])
3878 < (x_ex3 - leftoverX_[3][iModX_candidate][iClustXMod_candidate]))
3880 iModX_candidate = imod3;
3881 iClustXMod_candidate = clx3;
3883 ay1_2_cand = ay12_from_target;
3885 cout <<
" re-write cand3 x3 = " << leftoverX_[3][imod3][clx3] << endl;
3895 if (was_candidate) {
3896 iModX[3] = iModX_candidate;
3898 Xforglfit[3][iModX_candidate] = leftoverX_[3][iModX_candidate][iClustXMod_candidate];
3907 for (
Int_t coeff = 0; coeff < 4; ++coeff) {
3914 TotalNumberOfHits = Npoint;
3916 ChiSquareNdf =
ChiSquare / (TotalNumberOfHits - 4);
3921 cout <<
" case3 x: before cut ChiSquareNDF " << ChiSquareNdf <<
" TotalNumberOfHits "
3922 << TotalNumberOfHits <<
" fitted line par " <<
line[0] <<
" " <<
line[1] <<
" "
3923 <<
line[2] <<
" " <<
line[3] << endl;
3931 line[2] = ay1_2_cand;
3934 cout <<
" replace to Yv-Y12 line par " <<
line[2] <<
" " <<
line[3] << endl;
3944 iClustXMod_candidate = -1;
3948 cout <<
"---x.----" << endl;
3950 cout <<
"case3: end 3x st: iModX[1] " <<
iModX[1] <<
" iCl " <<
iClustXMod[1] <<
" iModX[2] "
3959 for (
Int_t clxp3 = 0; clxp3 < NleftoverXp_[3][imod3]; clxp3++) {
3972 cout <<
" X1 " << leftoverXsp_[1][imod1][cl1] <<
" X2 "
3973 << leftoverXsp_[2][imod2][cl2] <<
" x_ex3 " << x_ex3 << endl;
3975 cout <<
" Y1 " << leftoverYsp_[1][imod1][cl1] <<
" Y2 "
3976 << leftoverYsp_[2][imod2][cl2] <<
" y_ex3 " << y_ex3 << endl;
3980 if (
fabs(xp_ex3 - leftoverXp_[3][imod3][clxp3]) > hrd_case3)
3983 if (!was_candidate) {
3984 iModX_candidate = imod3;
3985 iClustXMod_candidate = clxp3;
3988 cout <<
" write candidate3 xp3 = " << leftoverXp_[3][imod3][clxp3] <<
" xp_ex3 "
3991 if (
fabs(xp_ex3 - leftoverXp_[3][imod3][clxp3])
3992 <
fabs(xp_ex3 - leftoverXp_[3][iModX_candidate][iClustXMod_candidate]))
3995 iModX_candidate = imod3;
3996 iClustXMod_candidate = clxp3;
3998 cout <<
" re-write cand3 xp3 = " << leftoverXp_[3][imod3][clxp3]
3999 <<
" xp_ex3 " << xp_ex3 << endl;
4009 if (was_candidate) {
4010 iModX[3] = iModX_candidate;
4014 Xpforglfit[3][iModX_candidate] = leftoverXp_[3][iModX_candidate][iClustXMod_candidate];
4021 TotalNumberOfHits = 0;
4022 ChiSquareNdf = 999.;
4025 for (
Int_t coeff = 0; coeff < 4; ++coeff) {
4032 TotalNumberOfHits = Npoint;
4034 ChiSquareNdf =
ChiSquare / (TotalNumberOfHits - 4);
4039 cout <<
" case3 xp: before cut ChiSquareNDF " << ChiSquareNdf <<
" TotalNumberOfHits "
4040 << TotalNumberOfHits <<
" fitted line par " <<
line[0] <<
" " <<
line[1] <<
" "
4041 <<
line[2] <<
" " <<
line[3] << endl;
4045 cout <<
" ChiSquareNdf " << ChiSquareNdf << endl;
4049 cout <<
" ChiSquareNdf " << ChiSquareNdf << endl;
4054 line[2] = ay12_from_target;
4057 cout <<
" xp replace to Yv-Y12 line par " <<
line[2] <<
" " <<
line[3]
4063 cout <<
"xp5_exist" << endl;
4078 cout <<
"---xp.----" << endl;
4080 cout <<
" was_candidate " << was_candidate << endl;
4082 cout <<
"case3: end 3xp st: iModX[1] " <<
iModX[1] <<
" iCl " <<
iClustXMod[1] <<
" iModX[2] "
4085 cout <<
" TotalNumberOfHits " << TotalNumberOfHits <<
" ChiSquareNdf " << ChiSquareNdf << endl;
4092 for (
Int_t coeff = 0; coeff < 4; ++coeff) {
4093 line_cand[coeff] = 0.;
4100 Xp_cand[st] = -999.;
4102 SigX_cand[st] = -999.;
4103 SigXp_cand[st] = -999.;
4104 SigY_cand[st] = -999.;
4108 cout <<
" TotalNumberOfHits " << TotalNumberOfHits <<
" ChiSquareNdf " << ChiSquareNdf
4111 if (TotalNumberOfHits > 4) {
4116 ChiSquareNdf = 999.;
4121 if (TotalNumberOfHits > 4 && ChiSquareNdf < Chi2_cand && ChiSquareNdf <
Chi2_Globcut
4125 cout <<
" TotalNumberOfHits " << TotalNumberOfHits <<
" ChiSquareNdf " << ChiSquareNdf
4127 Chi2_cand = ChiSquareNdf;
4128 line_cand[0] =
line[0];
4129 line_cand[1] =
line[1];
4130 line_cand[2] =
line[2];
4131 line_cand[3] =
line[3];
4137 Mod_cand[st] =
iModX[st];
4147 cout <<
" X_cand[" << st <<
"] " << X_cand[st] <<
" Xp_cand[" << st <<
"] "
4149 <<
" ClSizeXp " << XpspClust_width_[st][Mod_cand[st]][
iClustXMod[st]] << endl;
4153 if (TotalNumberOfHits > 4 && Chi2_cand <
Chi2_Globcut && was_candidate)
4156 for (
size_t itr = 0; itr < vec_tracks_.size(); ++itr) {
4158 if (((vec_tracks_.at(itr).CoordX[1] == X_cand[1] && X_cand[1] > -900.)
4159 || (vec_tracks_.at(itr).CoordXp[1] == Xp_cand[1] && Xp_cand[1] > -900.))
4160 || ((vec_tracks_.at(itr).CoordX[2] == X_cand[2] && X_cand[2] > -900.)
4161 || (vec_tracks_.at(itr).CoordXp[2] == Xp_cand[2] && Xp_cand[2] > -900.))
4162 || ((vec_tracks_.at(itr).CoordX[3] == X_cand[3] && X_cand[3] > -900.)
4163 || (vec_tracks_.at(itr).CoordXp[3] == Xp_cand[3] && Xp_cand[3] > -900.))
4167 if (vec_tracks_.at(itr).Chi2 > Chi2_cand) {
4168 vec_tracks_.erase(vec_tracks_.begin() + itr);
4180 tmpTr.
Chi2 = Chi2_cand;
4181 tmpTr.
Nhits = TotalNumberOfHits;
4184 tmpTr.
Xv = bx_candidate;
4185 tmpTr.
Yv = by_candidate;
4186 tmpTr.
param[0] = line_cand[0];
4187 tmpTr.
param[1] = line_cand[1];
4188 tmpTr.
param[2] = line_cand[2];
4189 tmpTr.
param[3] = line_cand[3];
4192 cout <<
" Xv_candidate " << bx_candidate <<
" Yv_candidate " << by_candidate
4193 <<
" ChiSquareNdf " << ChiSquareNdf << endl;
4195 if (Mod_cand[st] < 0)
4199 tmpTr.
CoordX[st] = X_cand[st];
4200 tmpTr.
CoordXp[st] = Xp_cand[st];
4201 tmpTr.
SigmaX[st] = SigX_cand[st];
4202 tmpTr.
SigmaXp[st] = SigXp_cand[st];
4204 tmpTr.
CoordY[st] = Y_cand[st];
4205 tmpTr.
SigmaY[st] = SigY_cand[st];
4208 tmpTr.
StripNumX[st] = XspClust_[st][Mod_cand[st]][iCl_cand[st]];
4209 tmpTr.
StripNumXp[st] = XpspClust_[st][Mod_cand[st]][iCl_cand[st]];
4210 tmpTr.
ClSizeX[st] = XspClust_width_[st][Mod_cand[st]][iCl_cand[st]];
4211 tmpTr.
ClSizeXp[st] = XpspClust_width_[st][Mod_cand[st]][iCl_cand[st]];
4212 tmpTr.
SumQX[st] = sumQxsp_[st][Mod_cand[st]][iCl_cand[st]];
4213 tmpTr.
SumQXp[st] = sumQxpsp_[st][Mod_cand[st]][iCl_cand[st]];
4215 tmpTr.
StripNumX[st] = XClust_[st][
iModX[st]][iClustXMod_candidate];
4217 tmpTr.
ClSizeX[st] = XClust_width_[st][
iModX[st]][iClustXMod_candidate];
4218 tmpTr.
ClSizeXp[st] = XpClust_width_[st][
iModX[st]][iClustXMod_candidate];
4219 tmpTr.
SumQX[st] = sumQx_[st][
iModX[st]][iClustXMod_candidate];
4220 tmpTr.
SumQXp[st] = sumQxp_[st][
iModX[st]][iClustXMod_candidate];
4224 cout <<
" st " << st <<
" Z " << tmpTr.
CoordZ[st] << endl;
4226 cout <<
" tmpTr.CoordX[" << st <<
"] " << tmpTr.
CoordX[st] <<
" strip "
4228 << tmpTr.
SumQX[st] << endl;
4230 cout <<
" tmpTr.CoordXp[" << st <<
"] " << tmpTr.
CoordXp[st] <<
" strip "
4232 << tmpTr.
SumQXp[st] << endl;
4235 vec_tracks_.push_back(tmpTr);
4245 cout <<
" after second case 3 write cand: " << vec_tracks_.size() << endl;
4251 Int_t** Nleftoversp_,
4258 Int_t** NleftoverX_,
4259 Int_t** NleftoverXp_,
4264 vector<tracksX>& vec_tracks_,
4293 SigY_cand[
fNstations], Chi2_cand = 999., line_cand[4];
4295 for (
Int_t coeff = 0; coeff < 4; ++coeff) {
4296 line_cand[coeff] = 0.;
4303 Xp_cand[st] = -999.;
4305 SigX_cand[st] = -999.;
4306 SigXp_cand[st] = -999.;
4307 SigY_cand[st] = -999.;
4310 Double_t bx_candidate = 999., by_candidate = 999.;
4314 for (
Int_t cl3 = 0; cl3 < Nleftoversp_[3][imod3]; cl3++) {
4316 Double_t Xv_min = 2.5, Yv_min = 2.5;
4319 for (
Int_t imod1 = 0; imod1 < Nmod_Fi; imod1++) {
4322 Double_t ax_target_region = -999., ay_target_region = -999.;
4325 for (
Int_t imod2 = 0; imod2 < Nmod_Sec; imod2++) {
4326 for (
Int_t cl2 = 0; cl2 < NleftoverXp_[Sec_St][imod2]; cl2++) {
4328 if (
fabs(leftoverX_[Fi_St][imod1][cl1] - leftoverXp_[Sec_St][imod2][cl2]) >
half_roadX1_Xp2)
4333 leftoverXp_[Sec_St][imod2][cl2]);
4336 cout <<
" Fi_St " << Fi_St <<
" X " << leftoverX_[Fi_St][imod1][cl1] <<
" Xp "
4337 << leftoverXp_[Sec_St][imod2][cl2] <<
" new Y " << Y_1_2 << endl;
4339 ax_target_region = (leftoverX_[Fi_St][imod1][cl1] - leftoverXsp_[3][imod3][cl3])
4341 ay_target_region = (Y_1_2 - leftoverYsp_[3][imod3][cl3]) / (z1_2 -
Zstation[3][imod3]);
4344 ax_target_region * (-z1_2 +
Z0_SRC_target) + leftoverX_[Fi_St][imod1][cl1];
4352 if ((
fabs(Xv_min) + 0.25 *
fabs(Yv_min)) < (
fabs(Xv_cand) + 0.25 *
fabs(Yv_cand)))
4356 cout <<
" Xv_cand " << Xv_cand <<
" Yv_cand " << Yv_cand << endl;
4361 bx_candidate = Xv_cand;
4362 by_candidate = Yv_cand;
4364 line_cand[0] = ax_target_region;
4366 line_cand[2] = ay_target_region;
4369 Mod_cand[Fi_St] = imod1;
4370 iCl_cand[Fi_St] = cl1;
4371 X_cand[Fi_St] = leftoverX_[Fi_St][imod1][cl1];
4372 Xp_cand[Fi_St] = -999.;
4373 Y_cand[Fi_St] = -999.;
4374 SigX_cand[Fi_St] = 1.;
4375 SigXp_cand[Fi_St] = 1.;
4376 SigY_cand[Fi_St] = 1.;
4378 Mod_cand[Sec_St] = imod2;
4379 iCl_cand[Sec_St] = cl2;
4380 X_cand[Sec_St] = -999.;
4381 Xp_cand[Sec_St] = leftoverXp_[Sec_St][imod2][cl2];
4382 Y_cand[Sec_St] = -999.;
4383 SigX_cand[Sec_St] = 1.;
4384 SigXp_cand[Sec_St] = 1.;
4385 SigY_cand[Sec_St] = 1.;
4387 Mod_cand[3] = imod3;
4389 X_cand[3] = leftoverXsp_[3][imod3][cl3];
4390 Xp_cand[3] = leftoverXpsp_[3][imod3][cl3];
4391 Y_cand[3] = leftoverYsp_[3][imod3][cl3];
4392 SigX_cand[3] = leftoverXsigsp_[3][imod3][cl3];
4393 SigXp_cand[3] = leftoverXpsigsp_[3][imod3][cl3];
4394 SigY_cand[3] = leftoverYsigsp_[3][imod3][cl3];
4400 for (
size_t itr = 0; itr <
vec_tracks.size(); ++itr) {
4402 if (((
vec_tracks.at(itr).CoordX[1] == X_cand[1] && X_cand[1] > -900.)
4403 || (
vec_tracks.at(itr).CoordXp[1] == Xp_cand[1] && Xp_cand[1] > -900.))
4404 || ((
vec_tracks.at(itr).CoordX[2] == X_cand[2] && X_cand[2] > -900.)
4405 || (
vec_tracks.at(itr).CoordXp[2] == Xp_cand[2] && Xp_cand[2] > -900.))
4406 || ((
vec_tracks.at(itr).CoordX[3] == X_cand[3] && X_cand[3] > -900.)
4407 || (
vec_tracks.at(itr).CoordXp[3] == Xp_cand[3] && Xp_cand[3] > -900.)))
4410 > (
fabs(bx_candidate) + 0.25 *
fabs(by_candidate)))
4424 tmpTr.
Chi2 = Chi2_cand;
4426 tmpTr.
Xv = bx_candidate;
4427 tmpTr.
Yv = by_candidate;
4428 tmpTr.
param[0] = line_cand[0];
4429 tmpTr.
param[1] = line_cand[1];
4430 tmpTr.
param[2] = line_cand[2];
4431 tmpTr.
param[3] = line_cand[3];
4436 cout <<
" Xv_candidate " << bx_candidate <<
" Yv_candidate " << by_candidate <<
" Nhits "
4437 << tmpTr.
Nhits << endl;
4439 if (Mod_cand[st] < 0)
4443 tmpTr.
CoordX[st] = X_cand[st];
4444 tmpTr.
CoordXp[st] = Xp_cand[st];
4445 tmpTr.
SigmaX[st] = SigX_cand[st];
4446 tmpTr.
SigmaXp[st] = SigXp_cand[st];
4448 tmpTr.
CoordY[st] = Y_cand[st];
4449 tmpTr.
SigmaY[st] = SigY_cand[st];
4452 tmpTr.
StripNumX[st] = XClust_[st][Mod_cand[st]][iCl_cand[st]];
4453 tmpTr.
StripNumXp[st] = XpClust_[st][Mod_cand[st]][iCl_cand[st]];
4454 tmpTr.
ClSizeX[st] = XClust_width_[st][Mod_cand[st]][iCl_cand[st]];
4455 tmpTr.
ClSizeXp[st] = XpClust_width_[st][Mod_cand[st]][iCl_cand[st]];
4456 tmpTr.
SumQX[st] = sumQx_[st][Mod_cand[st]][iCl_cand[st]];
4457 tmpTr.
SumQXp[st] = sumQxp_[st][Mod_cand[st]][iCl_cand[st]];
4459 tmpTr.
StripNumX[st] = XspClust_[st][Mod_cand[st]][iCl_cand[st]];
4460 tmpTr.
StripNumXp[st] = XpspClust_[st][Mod_cand[st]][iCl_cand[st]];
4461 tmpTr.
ClSizeX[st] = XspClust_width_[st][Mod_cand[st]][iCl_cand[st]];
4462 tmpTr.
ClSizeXp[st] = XpspClust_width_[st][Mod_cand[st]][iCl_cand[st]];
4463 tmpTr.
SumQX[st] = sumQxsp_[st][Mod_cand[st]][iCl_cand[st]];
4464 tmpTr.
SumQXp[st] = sumQxpsp_[st][Mod_cand[st]][iCl_cand[st]];
4468 cout <<
" st " << st <<
" Z " << tmpTr.
CoordZ[st] << endl;
4470 cout <<
" tmpTr.CoordX[" << st <<
"] " << tmpTr.
CoordX[st] <<
" strip " << tmpTr.
StripNumX[st]
4471 <<
" Clsize " << tmpTr.
ClSizeX[st] <<
" Q " << tmpTr.
SumQX[st] << endl;
4473 cout <<
" tmpTr.CoordXp[" << st <<
"] " << tmpTr.
CoordXp[st] <<
" strip " << tmpTr.
StripNumXp[st]
4474 <<
" Clsize " << tmpTr.
ClSizeXp[st] <<
" Q " << tmpTr.
SumQXp[st] << endl;
4480 cout <<
" tmpTr.Xv " << tmpTr.
Xv <<
" tmpTr.Yv " << tmpTr.
Yv << endl;
4876 hNpoint =
new TH1D(
"Npoint",
"Npoints: X+ X'; Npoints; Events", 7, 1, 8);
4880 hNtracks =
new TH1D(
"Ntracks",
"Ntracks; Ntracks; Events", 10, 0, 10);
4882 hAxglob =
new TH1D(
"Axglob",
"AngleX; tgX[rad]; Events", 200, -.1, .1);
4884 hBxglob =
new TH1D(
"Bxglob",
"Bx; [cm]; Events", 200, -10, 10);
4886 hAyglob =
new TH1D(
"Ayglob",
"AngleY; tgY[rad]; Events", 200, -.1, .1);
4888 hByglob =
new TH1D(
"Byglob",
"By; [cm]; Events", 200, -10, 10);
4890 hvertexXY =
new TH2D(
"vertexXY",
"vertexXY", 100, -5, 5, 100, -10, 5);
4894 hprofile_beam_z1 =
new TH2D(
"profile_beam_z1",
"beam_profile_Siz1; [cm];[cm]", 100, -10, 10, 100, -15, 5);
4896 hprofile_beam_z2 =
new TH2D(
"profile_beam_z2",
"beam_profile_Siz2; [cm];[cm]", 100, -10, 10, 100, -15, 5);
4898 hprofile_beam_z3 =
new TH2D(
"profile_beam_z3",
"beam_profile_Siz3; [cm];[cm]", 100, -15, 15, 100, -20, 5);
4900 hAx_first_tr =
new TH1D(
"Ax_first_tr",
"Ax_first_tr; AngleX[mrad]; Events", 200, -.1, .1);
4902 hAx_more_first_tr =
new TH1D(
"Ax_more_first_tr",
"Ax_more_first_tr; AngleX[mrad]; Events", 200, -.1, .1);
4904 hYXSi1_run8 =
new TH2D(
"hYXSi1_run8",
"YXSi1_run8", 100, -15, 15, 100, -15, 15);
4906 hYXSi2_run8 =
new TH2D(
"hYXSi2_run8",
"YXSi2_run8", 100, -15, 15, 100, -15, 15);
4908 hXSi1_run8 =
new TH1D(
"XSi1_run8",
"XSi1; [cm]; Events", 200, -10, 10);
4910 hYSi1_run8 =
new TH1D(
"YSi1_run8",
"YSi1; [cm]; Events", 200, -10, 10);
4912 hXSi2_run8 =
new TH1D(
"XSi2_run8",
"XSi2; [cm]; Events", 200, -10, 10);
4914 hYSi2_run8 =
new TH1D(
"YSi2_run8",
"YSi2; [cm]; Events", 200, -10, 10);
4931 hX_st_1 =
new TH1D(
"X_st_1",
"X_st_1", 100, -6, 6);
4933 hX_st_2 =
new TH1D(
"X_st_2",
"X_st_2", 100, -6, 6);
4935 hX_st_3 =
new TH1D(
"X_st_3",
"X_st_3", 100, -6, 6);
4938 hdX_st_1 =
new TH1D(
"dX_st_1",
"dX_st_1", 100, -0.02, 0.02);
4940 hdX_st_2 =
new TH1D(
"dX_st_2",
"dX_st_2", 100, -0.02, 0.02);
4942 hdX_st_3 =
new TH1D(
"dX_st_3",
"dX_st_3", 100, -0.002, 0.002);
4945 hdXp_st_1 =
new TH1D(
"dXp_st_1",
"dXp_st_1", 100, -0.02, 0.02);
4947 hdXp_st_2 =
new TH1D(
"dXp_st_2",
"dXp_st_2", 100, -0.02, 0.02);
4949 hdXp_st_3 =
new TH1D(
"dXp_st_3",
"dXp_st_3", 100, -0.02, 0.02);
4952 hdXvsXst_1 =
new TH2D(
"dXvsXst_1",
"dXvsXst_1;XSi[cm];hit-fit[cm]", 100, -6, 6, 100, -0.03, 0.03);
4954 hdXvsXst_2 =
new TH2D(
"dXvsXst_2",
"dXvsXst_2;XSi[cm];hit-fit[cm]", 100, -6, 6, 100, -0.03, 0.03);
4956 hdXvsXst_3 =
new TH2D(
"dXvsXst_3",
"dXvsXst_3;XSi[cm];hit-fit[cm]", 100, -6, 6, 100, -0.0005, 0.0005);
4959 hX13_X2_m0 =
new TH1D(
"X13_X2_m0",
"X2_X13_m0", 200, -0.05, 0.05);
4961 hX13_X2_m1 =
new TH1D(
"X13_X2_m1",
"X2_X13_m1", 200, -0.05, 0.05);
4983 hY_st_1 =
new TH1D(
"Y_st_1",
"Y_st_1", 100, -6, 6);
4985 hY_st_2 =
new TH1D(
"Y_st_2",
"Y_st_2", 100, -6, 6);
4987 hY_st_3 =
new TH1D(
"Y_st_3",
"Y_st_3", 100, -6, 6);
4990 hdY_st_1 =
new TH1D(
"dY_st_1",
"dY_st_1", 100, -0.6, 0.6);
4992 hdY_st_2 =
new TH1D(
"dY_st_2",
"dY_st_2", 100, -0.6, 0.6);
4994 hdY_st_3 =
new TH1D(
"dY_st_3",
"dY_st_3", 100, -0.6, 0.6);
4997 hdYvsYst_1 =
new TH2D(
"dYvsYst_1",
"dYvsYst_1;YSi[cm];hit-fit[cm]", 100, -6, 6, 100, -0.6, 0.6);
4999 hdYvsYst_2 =
new TH2D(
"dYvsYst_2",
"dYvsYst_2;YSi[cm];hit-fit[cm]", 100, -6, 6, 100, -0.6, 0.6);
5001 hdYvsYst_3 =
new TH2D(
"dYvsYst_3",
"dYvsYst_3;YSi[cm];hit-fit[cm]", 100, -6, 6, 100, -0.4, 0.4);
5029 hdXp3_mod1 =
new TH1D(
"hdXp3_mod1",
"hdXp3_mod1", 100, -0.02, 0.02);
5031 hdXp3_mod2 =
new TH1D(
"hdXp3_mod2",
"hdXp3_mod2", 100, -0.02, 0.02);
5042 hdXvsXst1_0 =
new TH2D(
"dXvsXst1_0",
"dXvsXst1_0", 100, -6, 6, 100, -0.05, 0.05);
5044 hdXvsXst1_1 =
new TH2D(
"dXvsXst1_1",
"dXvsXst1_1", 100, -6, 6, 100, -0.05, 0.05);
5046 hdXvsXst1_2 =
new TH2D(
"dXvsXst1_2",
"dXvsXst1_2", 100, -6, 6, 100, -0.05, 0.05);
5048 hdXvsXst1_3 =
new TH2D(
"dXvsXst1_3",
"dXvsXst1_3", 100, -6, 6, 100, -0.05, 0.05);
5050 hdXvsXst2_0 =
new TH2D(
"dXvsXst2_0",
"dXvsXst2_0", 100, -6, 6, 100, -0.05, 0.05);
5052 hdXvsXst2_1 =
new TH2D(
"dXvsXst2_1",
"dXvsXst2_1", 100, -6, 6, 100, -0.05, 0.05);
5054 hdXvsXst3_1 =
new TH2D(
"dXvsXst3_1",
"dXvsXst3_1", 100, -6, 6, 100, -0.001, 0.001);
5056 hdXvsXst3_2 =
new TH2D(
"dXvsXst3_2",
"dXvsXst3_2", 100, -6, 6, 100, -0.001, 0.001);
5059 hdYvsYst1_mod0 =
new TH2D(
"dYvsYst1_mod0",
"dYvsYst1_mod0", 100, -6, 6, 100, -0.6, 0.6);
5061 hdYvsYst1_mod1 =
new TH2D(
"dYvsYst1_mod1",
"dYvsYst1_mod1", 100, -6, 6, 100, -0.6, 0.6);
5063 hdYvsYst1_mod2 =
new TH2D(
"dYvsYst1_mod2",
"dYvsYst1_mod2", 100, -6, 6, 100, -0.6, 0.6);
5065 hdYvsYst1_mod3 =
new TH2D(
"dYvsYst1_mod3",
"dYvsYst1_mod3", 100, -6, 6, 100, -0.6, 0.6);
5067 hdYvsYst2_mod0 =
new TH2D(
"dYvsYst2_mod0",
"dYvsYst2_mod0", 100, -6, 6, 100, -0.6, 0.6);
5069 hdYvsYst2_mod1 =
new TH2D(
"dYvsYst2_mod1",
"dYvsYst2_mod1", 100, -6, 6, 100, -0.6, 0.6);
5071 hdYvsYst3_mod1 =
new TH2D(
"dYvsYst3_mod1",
"dYvsYst3_mod1", 100, -6, 6, 100, -0.2, 0.2);
5073 hdYvsYst3_mod2 =
new TH2D(
"dYvsYst3_mod2",
"dYvsYst3_mod2", 100, -6, 6, 100, -0.2, 0.2);
5101 hY_XSisp1 =
new TH2D(
"hY_XSisp1",
"hY_XSisp1", 100, -10, 10, 100, -10, 10);
5103 hY_XSisp2 =
new TH2D(
"hY_XSisp2",
"hY_XSisp2", 100, -10, 10, 100, -10, 10);
5105 hY_XSisp3 =
new TH2D(
"hY_XSisp3",
"hY_XSisp3", 100, -10, 10, 100, -20, 0);
5108 hY_XSisp1bef =
new TH2D(
"hY_XSisp1bef",
"hY_XSisp1bef", 100, -10, 10, 100, -10, 10);
5110 hY_XSisp2bef =
new TH2D(
"hY_XSisp2bef",
"hY_XSisp2bef", 100, -10, 10, 100, -10, 10);
5113 N_eff =
new TH1D(
"N_eff",
"N_eff", 6, 1, 7);
5115 D_eff =
new TH1D(
"D_eff",
"D_eff", 6, 1, 7);
5117 E_eff =
new TH1D(
"E_eff",
"Hit Efficiency per Layer on Track", 6, 1, 7);
5121 hdAx_MC_tr =
new TH1D(
"dAx_MC_tr",
"dAx_MC_tr;[rad]", 200, -.001, .001);
5123 hdAy_MC_tr =
new TH1D(
"dAy_MC_tr",
"dAy_MC_tr;[rad]", 200, -.01, .01);
5125 hdX_MC_tr =
new TH1D(
"dX_MC_tr",
"dX_MC_tr;[cm]", 200, -2, 2);
5127 hdY_MC_tr =
new TH1D(
"dY_MC_tr",
"dY_MC_tr;[cm]", 200, -2, 2);
5130 hAxsi_mctrue =
new TH1D(
"Axsi_mctrue",
"Ax_mctrueX; tgX[rad]; Events", 200, -.1, .1);
5132 hBxsi_mctrue =
new TH1D(
"Bxsi_mctrue",
"Bx_mctrue; [cm]; Events", 200, -10, 10);
5134 hAysi_mctrue =
new TH1D(
"Aysi_mctrue",
"Ay_mctrue; tgY[rad]; Events", 200, -.1, .1);
5136 hBysi_mctrue =
new TH1D(
"Bysi_mctrue",
"By_mctrue; [cm]; Events", 200, -10, 10);
5139 hSi_st1mc =
new TH2D(
"Si_st1mc",
"beam_profileSi_st1mc smeared; [cm];[cm]", 100, -10, 10, 100, -15, 5);
5141 hSi_st2mc =
new TH2D(
"Si_st2mc",
"beam_profileSi_st2mc smeared; [cm];[cm]", 100, -10, 10, 100, -15, 5);
5143 hSi_st3mc =
new TH2D(
"Si_st3mc",
"beam_profileSi_st3mc smeared; [cm];[cm]", 100, -15, 15, 100, -25, 5);
5169 hNtrsi_mc =
new TH1D(
"Ntrsi_mc",
";N of Si-tr mc", 10, 0, 10);
5180 h =
new TH1D(
Form(
"hoccupancyX1_mod%d", imod),
Form(
"hoccupancyX1_mod%d", imod),
fNstrips + 1, 0.,
5188 h =
new TH1D(
Form(
"hoccupancyX2_mod%d", imod),
Form(
"hoccupancyX2_mod%d", imod),
fNstrips + 1, 0.,
5194 h =
new TH1D(
Form(
"hoccupancyX3_mod%d", imod),
Form(
"hoccupancyX3_mod%d", imod),
fNstrips + 1, 0.,
5203 h =
new TH1D(
Form(
"hoccupancyXp1_mod%d", imod),
Form(
"hoccupancyXp1_mod%d", imod),
fNstrips + 1, 0.,
5211 h =
new TH1D(
Form(
"hoccupancyXp2_mod%d", imod),
Form(
"hoccupancyXp2_mod%d", imod),
fNstrips + 1, 0.,
5217 h =
new TH1D(
Form(
"hoccupancyXp3_mod%d", imod),
Form(
"hoccupancyXp3_mod%d", imod),
fNstrips + 1, 0.,
5389 cout <<
"BmnSiliconTrackFinder::Init()" << endl;
5390 FairRootManager* ioman = FairRootManager::Instance();
5394 cout <<
" expData " << endl;
5398 cout <<
"fBmnSiDigitsArray::Init(): branch " <<
" not found! Task will be deactivated" << endl;
5404 cout <<
" !expData BmnSiliconTrackFinder::Init()" << endl;
5410 <<
" not found! Task will be deactivated" << endl;
5419 <<
" not found! Task will be deactivated" << endl;
5452 shiftX[1][0] = -6.4 + 0.1148 + 0.0026;
5453 shiftX[2][0] = -5.9 + .1148 + 0.0075;
5454 shiftX[3][0] = -12.15 + 0.1148;
5455 shiftX[3][4] = -12.15 + 0.1148;
5456 shiftX[1][1] = 5.9 - 0.1148 + 0.0085;
5457 shiftX[2][1] = 6.4 - .1148 + 0.009;
5458 shiftX[3][1] = -6.15 + 0.1148;
5459 shiftX[3][5] = -6.15 + 0.1148;
5460 shiftX[1][2] = -5.9 + 0.1148 + 0.011;
5461 shiftX[3][2] = 6.15 - 0.1148;
5462 shiftX[3][6] = 6.15 - 0.1148;
5463 shiftX[1][3] = 6.4 - 0.1148 + 0.019;
5464 shiftX[3][3] = 12.15 - 0.1148;
5465 shiftX[3][7] = 12.15 - 0.1148;
5468 shiftY[1][0] = -0.4 - 0.08;
5469 shiftY[2][0] = -6.22 - 0.02;
5472 shiftY[1][1] = 0.1 - 0.06;
5474 shiftY[3][1] = -0.15 - 0.25;
5476 shiftY[1][2] = -0.2 - 0.05;
5477 shiftY[3][2] = -0.15 - 0.4;
5479 shiftY[1][3] = 0.4 - 0.16;
5483 Zstation[1][0] = 1.44 + 0.5 * 0.003;
5484 Zstation[2][0] = 4.71 + 0.5 * 0.003;
5485 Zstation[3][0] = 3.51 + 0.5 * 0.003;
5486 Zstation[3][4] = 2.25 + 0.5 * 0.003;
5487 Zstation[1][1] = 2.17 + 0.5 * 0.003;
5488 Zstation[2][1] = 5.44 + 0.5 * 0.003;
5489 Zstation[3][1] = 1.98 + 0.5 * 0.003 - .08;
5490 Zstation[3][5] = 3.78 + 0.5 * 0.003;
5491 Zstation[1][2] = 1.44 + 0.5 * 0.003;
5492 Zstation[3][2] = 3.29 + 0.5 * 0.003 + .08;
5493 Zstation[3][6] = 2.47 + 0.5 * 0.003;
5494 Zstation[1][3] = 2.17 + 0.5 * 0.003;
5495 Zstation[3][3] = 1.76 + 0.5 * 0.003;
5496 Zstation[3][7] = 4.00 + 0.5 * 0.003;
5519 shiftX[1][0] = -6.150 + 0.1148;
5520 shiftX[2][0] = -6.130 + 0.1148;
5521 shiftX[3][0] = -6.160 + 0.1148;
5522 shiftX[4][0] = -6.158 + 0.1148;
5523 shiftX[1][1] = 6.470 - 0.1148;
5524 shiftX[2][1] = 6.170 - 0.1148;
5525 shiftX[3][1] = 6.122 - 0.1148;
5526 shiftX[4][1] = 6.129 - 0.1148;
5597 shiftX[1][0] = -6.4 + 0.1148;
5598 shiftX[2][0] = -5.9 + .1148;
5599 shiftX[3][0] = -12.15 + 0.1148;
5600 shiftX[3][4] = -12.15 + 0.1148;
5601 shiftX[1][1] = 5.9 - 0.1148;
5602 shiftX[2][1] = 6.4 - .1148;
5603 shiftX[3][1] = -6.15 + 0.1148;
5604 shiftX[3][5] = -6.15 + 0.1148;
5605 shiftX[1][2] = -5.9 + 0.1148;
5606 shiftX[3][2] = 6.15 - 0.1148;
5607 shiftX[3][6] = 6.15 - 0.1148;
5608 shiftX[1][3] = 6.4 - 0.1148;
5609 shiftX[3][3] = 12.15 - 0.1148;
5610 shiftX[3][7] = 12.15 - 0.1148;
5642 Zstation[1][0] = 1.44 + 0.5 * 0.003;
5643 Zstation[2][0] = 4.71 + 0.5 * 0.003;
5644 Zstation[3][0] = 3.51 + 0.5 * 0.003;
5645 Zstation[3][4] = 2.25 + 0.5 * 0.003;
5646 Zstation[1][1] = 2.17 + 0.5 * 0.003;
5647 Zstation[2][1] = 5.44 + 0.5 * 0.003;
5648 Zstation[3][1] = 1.98 + 0.5 * 0.003 - .08;
5649 Zstation[3][5] = 3.78 + 0.5 * 0.003;
5650 Zstation[1][2] = 1.44 + 0.5 * 0.003;
5651 Zstation[3][2] = 3.29 + 0.5 * 0.003 + .08;
5652 Zstation[3][6] = 2.47 + 0.5 * 0.003;
5653 Zstation[1][3] = 2.17 + 0.5 * 0.003;
5654 Zstation[3][3] = 1.76 + 0.5 * 0.003;
5655 Zstation[3][7] = 4.00 + 0.5 * 0.003;
5660 for (
int im = 0; im <
fNmodules; im++) {
5676 if (ist == 1 && imod > 3)
5678 if (ist == 2 && imod > 1)