217 point->Momentum(mom);
219 TParticlePDG* part = TDatabasePDG::Instance()->GetParticle(mcTr->
GetPdgCode());
220 Double_t mnoc = 1.0, mass = 3.7283999;
225 lorv.SetVectM(mom, mass);
226 Double_t beta = lorv.Beta();
227 Double_t gamma = lorv.Gamma();
228 Double_t charge = (part) ? part->Charge() / 3 : 1;
229 mnoc = GetNumberOfClusters(beta, gamma, charge, 1.787, 12.33);
237 Double_t z_distance_from_in_to_out;
241 z_distance_from_in_to_out = ModuleThickness - (z - ZStartModulePosition);
243 z_distance_from_in_to_out = z - ZStartModulePosition;
247 if (z_distance_from_in_to_out <= 0.0) {
249 cerr <<
"WARNING: BmnGemStripModule::AddRealPointFull(): Point (" << x <<
" : " << y <<
" : " << z
250 <<
") has a track with an incorrect length\n";
255 Double_t vector_coeff =
fabs(z_distance_from_in_to_out / pz);
258 Double_t x_vec_from_in_to_out = vector_coeff * px;
259 Double_t y_vec_from_in_to_out = vector_coeff * py;
260 Double_t z_vec_from_in_to_out = vector_coeff * pz;
263 Double_t x_out = x + x_vec_from_in_to_out;
264 Double_t y_out = y + y_vec_from_in_to_out;
269 if (x_out < XMinModule || x_out > XMaxModule) {
270 if (x_out < XMinModule)
272 if (x_out > XMaxModule)
275 x_vec_from_in_to_out = x_out - x;
276 vector_coeff = x_vec_from_in_to_out / px;
278 y_vec_from_in_to_out = vector_coeff * py;
279 z_vec_from_in_to_out = vector_coeff * pz;
281 y_out = y + y_vec_from_in_to_out;
285 if (y_out < YMinModule || y_out > YMaxModule) {
286 if (y_out < YMinModule)
288 if (y_out > YMaxModule)
291 y_vec_from_in_to_out = y_out - y;
292 vector_coeff = y_vec_from_in_to_out / py;
294 x_vec_from_in_to_out = vector_coeff * px;
295 z_vec_from_in_to_out = vector_coeff * pz;
297 x_out = x + x_vec_from_in_to_out;
303 Double_t track_length =
304 std::sqrt((x_vec_from_in_to_out) * (x_vec_from_in_to_out) + (y_vec_from_in_to_out) * (y_vec_from_in_to_out)
305 + (z_vec_from_in_to_out) * (z_vec_from_in_to_out));
307 Double_t current_length = 0.0;
308 Double_t current_length_ratio = 0.0;
311 Double_t current_step = 0.0;
314 std::vector<CollPoint> collision_points;
316 while (current_length < track_length) {
322 current_step = gRandom->Exp(MCD);
323 current_length += current_step;
325 if (current_length > track_length)
328 current_length_ratio = current_length / track_length;
330 Double_t current_x = x + current_length_ratio * x_vec_from_in_to_out;
331 Double_t current_y = y + current_length_ratio * y_vec_from_in_to_out;
332 Double_t current_z = z + current_length_ratio * z_vec_from_in_to_out;
334 collision_points.push_back(CollPoint(current_x, current_y, current_z));
340 Double_t level1 = InductionGapThickness;
341 Double_t level2 = InductionGapThickness + SecondTransferGapThickness;
342 Double_t level3 = InductionGapThickness + SecondTransferGapThickness + FirstTransferGapThickness;
370 Int_t n_strip_layers = StripLayers.size();
371 vector<StripCluster> cluster_layers(n_strip_layers,
StripCluster());
376 for (
size_t icoll = 0; icoll < collision_points.size(); ++icoll) {
378 Double_t xcoll = collision_points[icoll].x;
379 Double_t ycoll = collision_points[icoll].y;
380 Double_t zcoll = collision_points[icoll].z;
386 zdist = (ModuleThickness + ZStartModulePosition) - zcoll;
388 zdist = zcoll - ZStartModulePosition;
393 xmean = p0_xmean + p1_xmean * zdist + p2_xmean * zdist * zdist + p3_xmean * zdist * zdist * zdist;
394 sigma = p0_sigma + p1_sigma * zdist + p2_sigma * zdist * zdist + p3_sigma * zdist * zdist * zdist
395 + p4_sigma * zdist * zdist * zdist * zdist + p5_sigma * zdist * zdist * zdist * zdist * zdist;
398 Int_t n_electrons_cluster = gRandom->Landau(1.027, 0.11);
399 if (n_electrons_cluster < 1)
400 n_electrons_cluster = 1;
401 if (n_electrons_cluster > 6)
402 n_electrons_cluster = 6;
404 for (Int_t ielectron = 0; ielectron < n_electrons_cluster; ++ielectron) {
410 Double_t gain_gem2 = gRandom->Exp(15);
411 Double_t gain_gem3 = gRandom->Exp(15);
422 if (zdist < level1) {
425 if (zdist >= level1 && zdist < level2) {
426 total_gain = gain_gem3;
428 if (zdist >= level2 && zdist < level3) {
429 total_gain = gain_gem3 * gain_gem2;
431 if (zdist >= level3) {
432 total_gain = gain_gem3 * gain_gem2 * gain_gem1;
436 double x_readout, y_readout;
438 for (
int igain = 0; igain < total_gain; ++igain) {
442 x_readout = gRandom->Gaus(xcoll + xmean, sigma);
444 x_readout = gRandom->Gaus(xcoll - xmean, sigma);
447 y_readout = gRandom->Gaus(ycoll, sigma);
449 for (Int_t ilayer = 0; ilayer < n_strip_layers; ++ilayer) {
451 if (!StripLayers[ilayer].IsPointInsideStripLayer(x_readout, y_readout))
454 Double_t strip_pos = StripLayers[ilayer].ConvertPointToStripPosition(x_readout, y_readout);
456 Double_t dstrip = strip_pos - (int)strip_pos;
457 if (TMath::Abs(StripLayers[ilayer].GetAngleDeg()) < 1.0) {
460 if (dstrip >= 0.4 && dstrip < 0.6)
465 if (dstrip >= 0.3 && dstrip < 0.7)
473 cluster_layers[ilayer].AddStrip((Int_t)strip_pos, 1.0);
488 vector<Double_t> cluster_mean_position(n_strip_layers, 0.0);
489 vector<Double_t> cluster_total_signal(n_strip_layers, 0.0);
491 for (Int_t ilayer = 0; ilayer < n_strip_layers; ++ilayer) {
493 if (cluster_layers[ilayer].GetClusterSize() > 0) {
494 for (
int i = 0;
i < cluster_layers[ilayer].GetClusterSize(); ++
i) {
495 cluster_mean_position[ilayer] += (cluster_layers[ilayer].Strips[
i] + 0.5)
496 * cluster_layers[ilayer].Signals[
i];
497 cluster_total_signal[ilayer] += cluster_layers[ilayer].Signals[
i];
499 cluster_mean_position[ilayer] /= cluster_total_signal[ilayer];
502 cluster_layers[ilayer].MeanPosition = cluster_mean_position[ilayer];
503 cluster_layers[ilayer].TotalSignal = cluster_total_signal[ilayer];
508 for (Int_t ilayer = 0; ilayer < n_strip_layers; ++ilayer) {
509 cluster_layers[ilayer].OriginPosition = StripLayers[ilayer].ConvertPointToStripPosition(x, y);
512 for (Int_t ilayer = 0; ilayer < n_strip_layers; ++ilayer) {
513 cluster_layers[ilayer].OriginPosition =
514 StripLayers[ilayer].ConvertPointToStripPosition(x_out, y_out);
519 for (Int_t ilayer = 0; ilayer < n_strip_layers; ++ilayer) {
520 cluster_layers[ilayer].OriginPosition =
521 StripLayers[ilayer].ConvertPointToStripPosition(x_out, y_out);
524 for (Int_t ilayer = 0; ilayer < n_strip_layers; ++ilayer) {
525 cluster_layers[ilayer].OriginPosition = StripLayers[ilayer].ConvertPointToStripPosition(x, y);
530 for (Int_t ilayer = 0; ilayer < n_strip_layers; ++ilayer) {
531 cluster_layers[ilayer].PositionResidual =
532 cluster_layers[ilayer].MeanPosition - cluster_layers[ilayer].OriginPosition;
549 for (Int_t ilayer = 0; ilayer < n_strip_layers; ++ilayer) {
550 for (
size_t ielement = 0; ielement < cluster_layers[ilayer].Strips.size(); ++ielement) {
551 Int_t strip_num = cluster_layers[ilayer].Strips.at(ielement);
552 Double_t strip_signal = cluster_layers[ilayer].Signals.at(ielement);
553 StripLayers[ilayer].AddStripSignal(strip_num, strip_signal);
559 for (Int_t ilayer = 0; ilayer < n_strip_layers; ++ilayer) {
560 for (
size_t ielement = 0; ielement < cluster_layers[ilayer].Strips.size(); ++ielement) {
561 Int_t strip_num = cluster_layers[ilayer].Strips.at(ielement);
562 Double_t strip_signal = cluster_layers[ilayer].Signals.at(ielement);
563 StripLayers[ilayer].AddLinkToStripMatch(strip_num, strip_signal / cluster_layers[ilayer].TotalSignal,
569 RealPointsX.push_back(x);
570 RealPointsY.push_back(y);
571 RealPointsMC.push_back(refID);
576 cerr <<
"WARNING: BmnGemStripModule::AddRealPointFull(): Point (" << x <<
" : " << y <<
" : " << z
577 <<
") is out of the readout plane or inside a dead zone\n";
598 Double_t radius = AvalancheRadius;
604 radius = gRandom->Gaus(AvalancheRadius, 0.02);
605 if (radius > AvalancheRadius / 2.0 && radius < AvalancheRadius * 2.0 && radius > 0.0)
610 radius = AvalancheRadius;
616 Int_t n_strip_layers = StripLayers.size();
617 vector<StripCluster> cluster_layers(n_strip_layers,
StripCluster());
619 for (Int_t ilayer = 0; ilayer < n_strip_layers; ++ilayer) {
620 if (!StripLayers[ilayer].IsPointInsideStripLayer(x, y))
622 cluster_layers[ilayer] =
MakeCluster(ilayer, x, y, signal, radius);
639 for (Int_t ilayer = 0; ilayer < n_strip_layers; ++ilayer) {
640 for (
size_t ielement = 0; ielement < cluster_layers[ilayer].Strips.size(); ++ielement) {
641 Int_t strip_num = cluster_layers[ilayer].Strips.at(ielement);
642 Double_t strip_signal = cluster_layers[ilayer].Signals.at(ielement);
643 StripLayers[ilayer].AddStripSignal(strip_num, strip_signal);
649 for (Int_t ilayer = 0; ilayer < n_strip_layers; ++ilayer) {
650 for (
size_t ielement = 0; ielement < cluster_layers[ilayer].Strips.size(); ++ielement) {
651 Int_t strip_num = cluster_layers[ilayer].Strips.at(ielement);
652 Double_t strip_signal = cluster_layers[ilayer].Signals.at(ielement);
653 StripLayers[ilayer].AddLinkToStripMatch(strip_num, strip_signal / cluster_layers[ilayer].TotalSignal,
659 RealPointsX.push_back(x);
660 RealPointsY.push_back(y);
661 RealPointsMC.push_back(refID);
666 cerr <<
"WARNING: BmnGemStripModule::AddRealPointFullOne(): Point (" << x <<
" : " << y <<
" : " << z
667 <<
") is out of the readout plane or inside a dead zone\n";
721 Double_t ClusterDistortion = 0.0;
728 Double_t Pitch = StripLayers[layer_num].GetPitch();
730 Double_t RadiusInZones = radius / Pitch;
731 Double_t
Sigma = RadiusInZones / 3.33;
733 TF1 gausF(
"gausF",
"gaus", -4 *
Sigma, 4 *
Sigma);
734 gausF.SetParameter(0, 1.0);
735 gausF.SetParameter(1, 0.0);
736 gausF.SetParameter(2,
Sigma);
738 Double_t SCluster = gausF.Integral(-4 *
Sigma, 4 *
Sigma);
741 Double_t var_level = ClusterDistortion;
743 Int_t NStripsInLayer = StripLayers[layer_num].GetNStrips();
745 if (NStripsInLayer == 0)
748 Double_t CenterZonePos = StripLayers[layer_num].ConvertPointToStripPosition(xcoord, ycoord);
750 if (CenterZonePos < 0.0 || CenterZonePos >= NStripsInLayer)
753 gausF.SetParameter(1, CenterZonePos);
754 Double_t total_signal = 0.0;
756 Double_t LeftZonePos = CenterZonePos - RadiusInZones;
757 Double_t RightZonePos = CenterZonePos + RadiusInZones;
758 Double_t OutLeftBorder = 0.0;
759 Double_t OutRightBorder = 0.0;
761 if (LeftZonePos < 0.0) {
762 OutLeftBorder = LeftZonePos;
765 if (RightZonePos < 0.0) {
766 OutRightBorder = RightZonePos;
769 if (LeftZonePos >= NStripsInLayer) {
770 OutLeftBorder = LeftZonePos;
771 LeftZonePos = NStripsInLayer - 0.001;
773 if (RightZonePos >= NStripsInLayer) {
774 OutRightBorder = RightZonePos;
775 RightZonePos = NStripsInLayer - 0.001;
782 if ((Int_t)LeftZonePos == (Int_t)RightZonePos) {
784 Int_t NumCurrentZone = (Int_t)LeftZonePos;
786 h = RightZonePos - LeftZonePos;
790 Double_t xp = LeftZonePos +
dist;
791 Double_t S = gausF.Integral(xp, xp + h);
792 Double_t Energy = (signal * Gain) * (S / SCluster);
793 Energy += rand.Gaus(0.0, var_level * Energy);
797 if (NumCurrentZone >= 0 && NumCurrentZone < NStripsInLayer && Energy > 0.0) {
798 cluster.
AddStrip(NumCurrentZone, Energy);
799 total_signal += Energy;
806 Int_t NumCurrentZone = (Int_t)LeftZonePos;
808 h = ((Int_t)LeftZonePos + 1) - LeftZonePos;
812 Double_t xp = LeftZonePos +
dist;
813 Double_t S = gausF.Integral(xp, xp + h);
814 Double_t Energy = (signal * Gain) * (S / SCluster);
815 Energy += rand.Gaus(0.0, var_level * Energy);
819 if (NumCurrentZone >= 0 && NumCurrentZone < NStripsInLayer && Energy > 0.0) {
820 cluster.
AddStrip(NumCurrentZone, Energy);
821 total_signal += Energy;
827 for (Int_t
i = (Int_t)LeftZonePos + 1;
i < (Int_t)RightZonePos; ++
i) {
833 xp = LeftZonePos +
dist;
834 S = gausF.Integral(xp, xp + h);
835 Energy = (signal * Gain) * (S / SCluster);
836 Energy += rand.Gaus(0.0, var_level * Energy);
840 if (NumCurrentZone >= 0 && NumCurrentZone < NStripsInLayer && Energy > 0.0) {
841 cluster.
AddStrip(NumCurrentZone, Energy);
842 total_signal += Energy;
848 NumCurrentZone = (Int_t)RightZonePos;
850 h = RightZonePos - (Int_t)RightZonePos;
854 xp = LeftZonePos +
dist;
855 S = gausF.Integral(xp, xp + h);
856 Energy = (signal * Gain) * (S / SCluster);
857 Energy += rand.Gaus(0.0, var_level * Energy);
861 if (NumCurrentZone >= 0 && NumCurrentZone < NStripsInLayer && Energy > 0.0) {
862 cluster.
AddStrip(NumCurrentZone, Energy);
863 total_signal += Energy;
874 Double_t mean_fit_pos = 0.0;
876 Int_t NOutLeftBins = 0;
877 Int_t NOutRightBins = 0;
878 if (OutLeftBorder != 0.0) {
879 NOutLeftBins = (Int_t)(
fabs(OutLeftBorder)) + 1;
881 if (OutRightBorder != 0.0) {
882 NOutRightBins = (Int_t)(OutRightBorder - RightZonePos) + 1;
885 Int_t begin_strip_num = cluster.
Strips.at(0);
887 Int_t nstrips = last_strip_num - begin_strip_num + 1;
889 TH1F hist(
"hist_for_fit",
"hist_for_fit", nstrips + NOutLeftBins + NOutRightBins, begin_strip_num - NOutLeftBins,
890 last_strip_num + 1 + NOutRightBins);
891 Int_t hist_index = 0;
894 Double_t value = cluster.
Signals.at(
i);
895 hist.SetBinContent(hist_index + 1 + NOutLeftBins, value);
900 if (NOutLeftBins > 0.0) {
901 Double_t first = OutLeftBorder;
902 Double_t last = (Int_t)OutLeftBorder;
903 Double_t S = gausF.Integral(first, last);
904 Double_t Energy = (signal * Gain) * (S / SCluster);
905 Energy += rand.Gaus(0.0, var_level * Energy);
908 Double_t value = Energy;
909 hist.SetBinContent(1, value);
912 for (Int_t
i = 1;
i < NOutLeftBins; ++
i) {
914 first = (Int_t)OutLeftBorder +
dist;
916 S = gausF.Integral(first, last);
917 Energy = (signal * Gain) * (S / SCluster);
918 Energy += rand.Gaus(0.0, var_level * Energy);
922 hist.SetBinContent(1 +
i, value);
928 if (NOutRightBins > 0.0) {
930 for (Int_t
i = hist_index;
i < hist_index + NOutRightBins - 1; ++
i) {
932 Double_t first = NStripsInLayer +
dist;
933 Double_t last = first + h;
934 Double_t S = gausF.Integral(first, last);
935 Double_t Energy = (signal * Gain) * (S / SCluster);
936 Energy += rand.Gaus(0.0, var_level * Energy);
939 Double_t value = Energy;
940 hist.SetBinContent(1 +
i, value);
944 Double_t first = (Int_t)OutRightBorder;
945 Double_t last = first + (OutRightBorder - (Int_t)OutRightBorder);
946 Double_t S = gausF.Integral(first, last);
947 Double_t Energy = (signal * Gain) * (S / SCluster);
948 Energy += rand.Gaus(0.0, var_level * Energy);
951 Double_t value = Energy;
952 hist.SetBinContent(hist_index + NOutRightBins, value);
955 TF1* gausFitFunction = 0;
956 TString fit_params =
"WQ0";
958#ifdef DRAW_REAL_CLUSTER_HISTOGRAMS
963 hist.Fit(
"gaus", fit_params);
964 gausFitFunction = hist.GetFunction(
"gaus");
965 if (gausFitFunction) {
966 mean_fit_pos = gausFitFunction->GetParameter(1);
968 mean_fit_pos = hist.GetMean();
971 mean_fit_pos = hist.GetMean();
1006 Int_t n_strip_layers = StripLayers.size();
1009 for (Int_t ilayer = 0; ilayer < n_strip_layers; ++ilayer) {
1010 StripLayers[ilayer].FindClustersAndStripHits();
1014 map<Int_t, Bool_t> UsageStatus_LowerClusters;
1015 map<Int_t, Bool_t> UsageStatus_UpperClusters;
1018 for (Int_t ilayer = 0; ilayer < n_strip_layers; ++ilayer) {
1019 for (Int_t i_strip_hit = 0; i_strip_hit < StripLayers[ilayer].GetNStripHits(); ++i_strip_hit) {
1020 StripCluster cluster = StripLayers[ilayer].GetStripClusters()[i_strip_hit];
1022 UsageStatus_LowerClusters[cluster.GetUniqueID()] =
false;
1025 UsageStatus_UpperClusters[cluster.GetUniqueID()] =
false;
1030 for (Int_t ilayer = 0; ilayer < n_strip_layers; ++ilayer) {
1031 for (Int_t jlayer = ilayer + 1; jlayer < n_strip_layers; ++jlayer) {
1034 if (StripLayers[ilayer].GetType() == StripLayers[jlayer].GetType())
1037 Double_t iAngleRad = StripLayers[ilayer].GetAngleRad();
1038 Double_t jAngleRad = StripLayers[jlayer].GetAngleRad();
1040 if (Abs(iAngleRad - jAngleRad) < 0.01)
1043 Double_t i_PiOver2MinusAngleRad = PiOver2() - iAngleRad;
1044 Double_t j_PiOver2MinusAngleRad = PiOver2() - jAngleRad;
1046 for (Int_t i_strip_hit = 0; i_strip_hit < StripLayers[ilayer].GetNStripHits(); ++i_strip_hit) {
1047 for (Int_t j_strip_hit = 0; j_strip_hit < StripLayers[jlayer].GetNStripHits(); ++j_strip_hit) {
1049 Double_t iStripHitPos = StripLayers[ilayer].GetStripHitPos(i_strip_hit);
1050 Double_t jStripHitPos = StripLayers[jlayer].GetStripHitPos(j_strip_hit);
1052 Double_t iStripHitError = StripLayers[ilayer].GetStripHitError(i_strip_hit);
1053 Double_t jStripHitError = StripLayers[jlayer].GetStripHitError(j_strip_hit);
1058 if (Abs(iAngleRad) >= 0.01 && Abs(jAngleRad) >= 0.01) {
1060 Double_t iB = StripLayers[ilayer].CalculateStripEquationB(iStripHitPos);
1061 Double_t jB = StripLayers[jlayer].CalculateStripEquationB(jStripHitPos);
1063 xcoord = (jB - iB) / (Tan(i_PiOver2MinusAngleRad) - Tan(j_PiOver2MinusAngleRad));
1064 ycoord = Tan(i_PiOver2MinusAngleRad) * xcoord + iB;
1067 if (Abs(iAngleRad) < 0.01) {
1069 if (StripLayers[ilayer].GetStripNumberingOrder() ==
LeftToRight) {
1070 xcoord = StripLayers[ilayer].GetXLeftStripBorderPoint()
1071 + iStripHitPos * StripLayers[ilayer].GetPitch();
1073 xcoord = StripLayers[ilayer].GetXRightStripBorderPoint()
1074 - iStripHitPos * StripLayers[ilayer].GetPitch();
1077 Double_t jB = StripLayers[jlayer].CalculateStripEquationB(jStripHitPos);
1078 ycoord = Tan(j_PiOver2MinusAngleRad) * xcoord + jB;
1081 if (Abs(jAngleRad) < 0.01) {
1083 if (StripLayers[jlayer].GetStripNumberingOrder() ==
LeftToRight) {
1084 xcoord = StripLayers[jlayer].GetXLeftStripBorderPoint()
1085 + jStripHitPos * StripLayers[jlayer].GetPitch();
1087 xcoord = StripLayers[jlayer].GetXRightStripBorderPoint()
1088 - jStripHitPos * StripLayers[jlayer].GetPitch();
1091 Double_t iB = StripLayers[ilayer].CalculateStripEquationB(iStripHitPos);
1092 ycoord = Tan(i_PiOver2MinusAngleRad) * xcoord + iB;
1097 if (StripLayers[ilayer].IsPointInsideStripLayer(xcoord, ycoord)
1098 && StripLayers[jlayer].IsPointInsideStripLayer(xcoord, ycoord))
1101 IntersectionPointsX.push_back(xcoord);
1102 IntersectionPointsY.push_back(ycoord);
1105 Double_t AngleIntersecRad = Abs(iAngleRad - jAngleRad);
1108 Double_t RhombSide1 = (iStripHitError * StripLayers[ilayer].GetPitch()) / Sin(AngleIntersecRad);
1109 Double_t RhombSide2 = (jStripHitError * StripLayers[jlayer].GetPitch()) / Sin(AngleIntersecRad);
1112 Double_t xerr1 = Sin(Abs(jAngleRad)) * RhombSide1;
1113 Double_t xerr2 = Sin(Abs(iAngleRad)) * RhombSide2;
1114 Double_t xcoord_err = xerr1 + xerr2;
1117 Double_t yerr1 = Cos(Abs(jAngleRad)) * RhombSide1;
1118 Double_t yerr2 = Cos(Abs(iAngleRad)) * RhombSide2;
1119 Double_t ycoord_err = yerr1 + yerr2;
1121 IntersectionPointsXErrors.push_back(xcoord_err);
1122 IntersectionPointsYErrors.push_back(ycoord_err);
1126 BmnMatch iStripMatch = StripLayers[ilayer].GetStripMatch((Int_t)iStripHitPos);
1127 BmnMatch jStripMatch = StripLayers[jlayer].GetStripMatch((Int_t)jStripHitPos);
1130 intersection_match.
AddLink(iStripMatch);
1131 intersection_match.
AddLink(jStripMatch);
1133 IntersectionPointMatches.push_back(intersection_match);
1138 StripLayers[ilayer].GetStripDigitNumberMatch((Int_t)iStripHitPos);
1140 StripLayers[jlayer].GetStripDigitNumberMatch((Int_t)jStripHitPos);
1142 BmnMatch intersection_digit_num_match;
1143 intersection_digit_num_match.
AddLink(iStripDigitNumberMatch);
1144 intersection_digit_num_match.
AddLink(jStripDigitNumberMatch);
1146 IntersectionPointDigitNumberMatches.push_back(intersection_digit_num_match);
1151 Int_t iLayerClusterSize = StripLayers[ilayer].GetStripHitClusterSize(i_strip_hit);
1152 Int_t jLayerClusterSize = StripLayers[jlayer].GetStripHitClusterSize(j_strip_hit);
1155 Double_t iLayerStripPosition = StripLayers[ilayer].ConvertPointToStripPosition(xcoord, ycoord);
1156 Double_t jLayerStripPosition = StripLayers[jlayer].ConvertPointToStripPosition(xcoord, ycoord);
1159 IntersectionPoints_LowerLayerClusterSize.push_back(iLayerClusterSize);
1160 IntersectionPoints_UpperLayerClusterSize.push_back(jLayerClusterSize);
1161 IntersectionPoints_LowerLayerStripPosition.push_back(iLayerStripPosition);
1162 IntersectionPoints_UpperLayerStripPosition.push_back(jLayerStripPosition);
1163 IntersectionPoints_LowerLayerStripTotalSignal.push_back(
1164 StripLayers[ilayer].GetStripHitTotalSignal(i_strip_hit));
1165 IntersectionPoints_UpperLayerStripTotalSignal.push_back(
1166 StripLayers[jlayer].GetStripHitTotalSignal(j_strip_hit));
1167 LowerClusters.push_back(StripLayers[ilayer].GetStripClusters().at(i_strip_hit));
1168 UpperClusters.push_back(StripLayers[jlayer].GetStripClusters().at(j_strip_hit));
1169 UsageStatus_LowerClusters
1170 [StripLayers[ilayer].GetStripClusters()[i_strip_hit].GetUniqueID()] =
true;
1171 UsageStatus_UpperClusters
1172 [StripLayers[jlayer].GetStripClusters()[j_strip_hit].GetUniqueID()] =
true;
1174 IntersectionPoints_LowerLayerClusterSize.push_back(jLayerClusterSize);
1175 IntersectionPoints_UpperLayerClusterSize.push_back(iLayerClusterSize);
1176 IntersectionPoints_LowerLayerStripPosition.push_back(jLayerStripPosition);
1177 IntersectionPoints_UpperLayerStripPosition.push_back(iLayerStripPosition);
1178 IntersectionPoints_LowerLayerStripTotalSignal.push_back(
1179 StripLayers[jlayer].GetStripHitTotalSignal(j_strip_hit));
1180 IntersectionPoints_UpperLayerStripTotalSignal.push_back(
1181 StripLayers[ilayer].GetStripHitTotalSignal(i_strip_hit));
1182 LowerClusters.push_back(StripLayers[jlayer].GetStripClusters().at(j_strip_hit));
1183 UpperClusters.push_back(StripLayers[ilayer].GetStripClusters().at(i_strip_hit));
1184 UsageStatus_LowerClusters
1185 [StripLayers[jlayer].GetStripClusters()[j_strip_hit].GetUniqueID()] =
true;
1186 UsageStatus_UpperClusters
1187 [StripLayers[ilayer].GetStripClusters()[i_strip_hit].GetUniqueID()] =
true;
1200 for (
auto it : UsageStatus_LowerClusters) {
1204 if (it.second ==
false) {
1206 for (Int_t ilayer = 0; ilayer < n_strip_layers; ++ilayer) {
1211 for (
size_t icluster = 0; icluster < StripLayers[ilayer].GetStripClusters().size(); ++icluster) {
1212 StripCluster cluster = StripLayers[ilayer].GetStripClusters()[icluster];
1214 if ((
int)cluster.GetUniqueID() != it.first)
1220 if (StripLayers[ilayer].GetStripNumberingOrder() ==
LeftToRight) {
1221 xcoord = StripLayers[ilayer].GetXLeftStripBorderPoint()
1222 + cluster.
MeanPosition * StripLayers[ilayer].GetPitch();
1224 xcoord = StripLayers[ilayer].GetXRightStripBorderPoint()
1225 - cluster.
MeanPosition * StripLayers[ilayer].GetPitch();
1228 ycoord = (StripLayers[ilayer].GetYMinLayer() + StripLayers[ilayer].GetYMaxLayer()) * 0.5;
1230 Double_t xerr = cluster.
Error * StripLayers[ilayer].GetPitch();
1231 Double_t yerr = StripLayers[ilayer].GetYSize() * 0.5;
1242 PseudoIntersectionsX.push_back(xcoord);
1243 PseudoIntersectionsY.push_back(ycoord);
1245 PseudoIntersectionsXErrors.push_back(xerr);
1246 PseudoIntersectionsYErrors.push_back(yerr);
1248 PseudoIntersections_LowerLayerClusterSize.push_back(cluster.
Width);
1249 PseudoIntersections_UpperLayerClusterSize.push_back(0);
1251 PseudoIntersections_LowerLayerStripPosition.push_back(
1252 StripLayers[ilayer].ConvertPointToStripPosition(xcoord, ycoord));
1253 PseudoIntersections_UpperLayerStripPosition.push_back(0);
1255 PseudoIntersections_LowerLayerStripTotalSignal.push_back(cluster.
TotalSignal);
1256 PseudoIntersections_UpperLayerStripTotalSignal.push_back(0);
1258 PseudoIntersectionMatches.push_back(
1259 StripLayers[ilayer].GetStripMatch((Int_t)cluster.
MeanPosition));
1260 PseudoIntersectionDigitNumberMatches.push_back(StripLayers[ilayer].GetStripDigitNumberMatch(
1263 LowerClusters_PseudoIntersections.push_back(cluster);
1264 UpperClusters_PseudoIntersections.push_back(
1275 Double_t strip_pos_layerA,
1276 Double_t strip_pos_layerB,
1281 Int_t ilayer = layerA_index;
1282 Int_t jlayer = layerB_index;
1284 if (StripLayers[ilayer].GetType() == StripLayers[jlayer].GetType())
1287 Double_t iAngleRad = StripLayers[ilayer].GetAngleRad();
1288 Double_t jAngleRad = StripLayers[jlayer].GetAngleRad();
1290 if (Abs(iAngleRad - jAngleRad) < 0.01)
1293 Double_t i_PiOver2MinusAngleRad = PiOver2() - iAngleRad;
1294 Double_t j_PiOver2MinusAngleRad = PiOver2() - jAngleRad;
1296 Double_t iStripHitPos = strip_pos_layerA;
1297 Double_t jStripHitPos = strip_pos_layerB;
1302 if (Abs(iAngleRad) >= 0.01 && Abs(jAngleRad) >= 0.01) {
1304 Double_t iB = StripLayers[ilayer].CalculateStripEquationB(iStripHitPos);
1305 Double_t jB = StripLayers[jlayer].CalculateStripEquationB(jStripHitPos);
1307 xcoord = (jB - iB) / (Tan(i_PiOver2MinusAngleRad) - Tan(j_PiOver2MinusAngleRad));
1308 ycoord = Tan(i_PiOver2MinusAngleRad) * xcoord + iB;
1311 if (Abs(iAngleRad) < 0.01) {
1313 if (StripLayers[ilayer].GetStripNumberingOrder() ==
LeftToRight) {
1314 xcoord = StripLayers[ilayer].GetXLeftStripBorderPoint() + iStripHitPos * StripLayers[ilayer].GetPitch();
1317 StripLayers[ilayer].GetXRightStripBorderPoint() - iStripHitPos * StripLayers[ilayer].GetPitch();
1320 Double_t jB = StripLayers[jlayer].CalculateStripEquationB(jStripHitPos);
1321 ycoord = Tan(j_PiOver2MinusAngleRad) * xcoord + jB;
1324 if (Abs(jAngleRad) < 0.01) {
1326 if (StripLayers[jlayer].GetStripNumberingOrder() ==
LeftToRight) {
1327 xcoord = StripLayers[jlayer].GetXLeftStripBorderPoint() + jStripHitPos * StripLayers[jlayer].GetPitch();
1330 StripLayers[jlayer].GetXRightStripBorderPoint() - jStripHitPos * StripLayers[jlayer].GetPitch();
1333 Double_t iB = StripLayers[ilayer].CalculateStripEquationB(iStripHitPos);
1334 ycoord = Tan(i_PiOver2MinusAngleRad) * xcoord + iB;
1342 if (StripLayers[ilayer].IsPointInsideStripLayer(xcoord, ycoord)
1343 && StripLayers[jlayer].IsPointInsideStripLayer(xcoord, ycoord))