10 #include "TClonesArray.h"
22 #include "FairTrackParam.h"
25 #include <boost/assign/list_of.hpp>
30 using boost::assign::list_of;
33 : FairTask(
"CbmRichGeoOpt")
39 , fRichRingMatches(NULL)
43 , nPhotonsNotOnPlane(0)
44 , nPhotonsNotOnSphere(0)
48 , ReadPMTPlaneCenter()
49 , ReadPMTPlaneCenterOrig()
67 , H_Diff_LineRefPMT_MomAtPMT(NULL)
68 , H_Theta_TwoVectors(NULL)
69 , H_DistancePMTtoMirrCenter(NULL)
70 , H_DistancePMTtoMirr(NULL)
74 , H_Mom_Theta_MC(NULL)
76 , H_Mom_Theta_Rec(NULL)
77 , H_Pt_Theta_Rec(NULL)
78 , H_Mom_Theta_Acc(NULL)
79 , H_Pt_Theta_Acc(NULL)
83 , H_Mom_XY_Theta25(NULL)
84 , H_MomPrim_RegularTheta(NULL)
85 , H_acc_mom_el_RegularTheta(NULL)
87 , H_Hits_XY_LeftHalf(NULL)
88 , H_Hits_XY_RightHalf(NULL)
89 , H_Hits_XY_Left2Thirds(NULL)
90 , H_Hits_XY_RightThird(NULL)
92 , H_PointsIn_XY_LeftHalf(NULL)
93 , H_PointsIn_XY_RightHalf(NULL)
94 , H_PointsIn_XY_Left2Thirds(NULL)
95 , H_PointsIn_XY_RightThird(NULL)
96 , H_PointsOut_XY(NULL)
97 , H_NofPhotonsPerEv(NULL)
98 , H_NofPhotonsPerHit(NULL)
99 , H_NofPhotonsSmallerThan30(NULL)
102 , H_dFocalPoint_Delta(NULL)
103 , H_dFocalPoint_Rho(NULL)
105 , H_Alpha_UpLeft(NULL)
106 , H_Alpha_UpLeft_II(NULL)
107 , H_Alpha_UpLeft_RegularTheta(NULL)
108 , H_Alpha_UpLeft_LeftHalf(NULL)
109 , H_Alpha_UpLeft_RightHalf(NULL)
110 , H_Alpha_UpLeft_RightThird(NULL)
111 , H_Alpha_UpLeft_Left2Thirds(NULL)
112 , H_Alpha_XYposAtDet(NULL)
113 , H_Alpha_XYposAtDet_RegularTheta(NULL)
114 , H_Alpha_XYposAtDet_LeftHalf(NULL)
115 , H_Alpha_XYposAtDet_RightHalf(NULL)
116 , H_Alpha_XYposAtDet_RightThird(NULL)
117 , H_Alpha_XYposAtDet_Left2Thirds(NULL)
120 , H_NofRings_NofHits(NULL)
121 , H_RingCenterX(NULL)
122 , H_RingCenterY(NULL)
128 , H_boa_RegularTheta(NULL)
129 , H_boa_LeftHalf(NULL)
130 , H_boa_RightHalf(NULL)
131 , H_boa_RightThird(NULL)
132 , H_boa_Left2Thirds(NULL)
135 , H_dR_RegularTheta(NULL)
136 , H_dR_LeftHalf(NULL)
137 , H_dR_RightHalf(NULL)
138 , H_dR_RightThird(NULL)
139 , H_dR_Left2Thirds(NULL)
140 , H_RingCenter_Aaxis(NULL)
141 , H_RingCenter_Baxis(NULL)
142 , H_RingCenter_boa(NULL)
143 , H_RingCenter_boa_RegularTheta(NULL)
144 , H_RingCenter_boa_LeftHalf(NULL)
145 , H_RingCenter_boa_RightHalf(NULL)
146 , H_RingCenter_boa_RightThird(NULL)
147 , H_RingCenter_boa_Left2Thirds(NULL)
148 , H_RingCenter_dR(NULL)
149 , H_RingCenter_dR_RegularTheta(NULL)
150 , H_RingCenter_dR_LeftHalf(NULL)
151 , H_RingCenter_dR_RightHalf(NULL)
152 , H_RingCenter_dR_RightThird(NULL)
153 , H_RingCenter_dR_Left2Thirds(NULL)
169 cout <<
"CbmRichGeoOpt::Init" << endl;
170 FairRootManager* ioman = FairRootManager::Instance();
172 Fatal(
"CbmRichGeoOpt::Init",
"RootManager not instantised!");
175 fRichPoints = (TClonesArray*) ioman->GetObject(
"RichPoint");
177 Fatal(
"CbmRichGeoOpt::Init",
"No RichPoint array!");
180 fRefPoints = (TClonesArray*) ioman->GetObject(
"RefPlanePoint");
182 Fatal(
"CbmRichGeoOpt::Init",
"No fRefPoints array!");
185 fMcTracks = (TClonesArray*) ioman->GetObject(
"MCTrack");
186 if (NULL ==
fMcTracks) { Fatal(
"CbmRichGeoOpt::Init",
"No MCTrack array!"); }
188 fRichHits = (TClonesArray*) ioman->GetObject(
"RichHit");
189 if (NULL ==
fRichHits) { Fatal(
"CbmRichGeoTest::Init",
"No RichHit array!"); }
192 fRichRings = (TClonesArray*) ioman->GetObject(
"RichRing");
194 Fatal(
"CbmRichGeoTest::Init",
"No RichRing array!");
199 Fatal(
"CbmRichGeoTest::Init",
"No RichRingMatch array!");
231 cout <<
"PMTPlanePoints[" << p <<
"].X == PMTPlanePoints[" << p - 1
233 cout <<
"Calling FillPointsAtPMT()" << endl;
302 if (nofPoints < 0 || nofPoints > 2000) {
return; }
304 for (Int_t ip = 0; ip < nofPoints; ip++) {
306 TVector3 PosAtDetOut;
308 if (NULL == point)
continue;
310 PosAtDetIn.SetX(point->GetX());
311 PosAtDetIn.SetY(point->GetY());
312 PosAtDetIn.SetZ(point->GetZ());
315 if (!Checked)
continue;
335 MomAtPMT.SetX(point->GetPx());
336 MomAtPMT.SetY(point->GetPy());
337 MomAtPMT.SetZ(point->GetPz());
340 Int_t PointMCTrackId = point->GetTrackID();
341 if (PointMCTrackId < 0)
continue;
344 if (NULL == PointTrack)
continue;
349 if (PointMotherId == -1) {
continue; }
352 int pdg = TMath::Abs(motherTrack->
GetPdgCode());
355 Double_t ElTheta = 0.;
356 if (pdg == 11 && motherId == -1) {
358 ElTheta = ElMom.Theta() * 180 /
TMath::Pi();
360 double Alpha2 = MomAtPMT.Angle(
PMT_norm);
361 double Alpha2InDeg = Alpha2 * TMath::RadToDeg();
362 if (Alpha2InDeg > 90.) { Alpha2InDeg = 180. - Alpha2InDeg; }
364 if (PosAtDetIn.X() < 0. && PosAtDetIn.Y() > 0) {
368 PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
376 PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
381 PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
386 PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
391 PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
402 Int_t nofHits =
fRichHits->GetEntriesFast();
404 for (Int_t iH = 0; iH < nofHits; iH++) {
406 if (hit == NULL)
continue;
408 if (pointInd < 0)
continue;
410 if (point == NULL)
continue;
414 TVector3 inPos(point->GetX(), point->GetY(), point->GetZ());
439 Int_t nofRefPoints =
fRefPoints->GetEntriesFast();
441 if (nofPoints == 0 || nofRefPoints == 0) {
return; }
442 if (nofPoints > 2000) {
return; }
444 for (
int i = 0;
i < nofRefPoints;
i++) {
449 MomAtRef.SetX(RefPoint->GetPx());
450 MomAtRef.SetY(RefPoint->GetPy());
451 MomAtRef.SetZ(RefPoint->GetPz());
453 if (RefPoint == NULL)
continue;
454 int RefPointTrackId = RefPoint->GetTrackID();
455 if (RefPointTrackId < 0) {
continue; }
459 if (TMath::Abs(pdg0) == 11) {
continue; }
460 RefPoint->Position(PosAtRefl);
466 cout << PosAtRefl.Z() <<
" " << Zpos << endl;
472 PosAtDetIn.SetX(point->GetX());
473 PosAtDetIn.SetY(point->GetY());
474 PosAtDetIn.SetZ(point->GetZ());
476 MomAtPMT.SetX(point->GetPx());
477 MomAtPMT.SetY(point->GetPy());
478 MomAtPMT.SetZ(point->GetPz());
479 float MagMomAtPMT = MomAtPMT.Mag();
482 Int_t PointMCTrackId = point->GetTrackID();
485 if (NULL == PointTrack)
continue;
490 if (PointMotherId == -1) {
continue; }
494 int pdg = TMath::Abs(motherTrack->
GetPdgCode());
497 Double_t ElTheta = 0.;
498 if (pdg == 11 && motherId == -1) {
511 TVector3 LineSensToPMT = PosAtDetIn - PosAtRefl;
512 float MagLineSensToPMT = LineSensToPMT.Mag();
517 double Alpha = LineSensToPMT.Angle(
PMT_norm);
518 double AlphaInDeg = Alpha * TMath::RadToDeg();
519 if (AlphaInDeg > 90.) { AlphaInDeg = 180. - AlphaInDeg; }
522 double Alpha2 = MomAtPMT.Angle(
PMT_norm);
523 double Alpha2InDeg = Alpha2 * TMath::RadToDeg();
524 if (Alpha2InDeg > 90.) { Alpha2InDeg = 180. - Alpha2InDeg; }
531 if (PosAtDetIn.X() < 0. && PosAtDetIn.Y() > 0) {
535 PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
544 PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
549 PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
554 PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
559 PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
565 Int_t nofHits =
fRichHits->GetEntriesFast();
567 for (Int_t iH = 0; iH < nofHits; iH++) {
569 if (hit == NULL)
continue;
571 if (pointInd < 0)
continue;
573 if (point == NULL)
continue;
577 TVector3 inPos(point->GetX(), point->GetY(), point->GetZ());
602 Int_t nofRings =
fRichRings->GetEntriesFast();
603 for (Int_t iR = 0; iR < nofRings; iR++) {
605 if (NULL == ring)
continue;
607 if (NULL == ringMatch) {
624 Int_t pdg = TMath::Abs(mcTrack->
GetPdgCode());
625 if (pdg != 11 || motherId != -1) {
630 Double_t momentum = mcTrack->
GetP();
631 Double_t pt = mcTrack->
GetPt();
636 Double_t theta = mom.Theta() * 180 /
TMath::Pi();
660 if (!(radius <= 1. || radius > 1.)) {
continue; }
667 H_boa->Fill(bA / aA);
676 if (theta <= 25 && theta >= 24.9) {
708 for (
int iH = 0; iH < nAllHitsInR; iH++) {
710 double xH = hit->
GetX();
711 double yH = hit->
GetY();
713 - TMath::Sqrt((CentX - xH) * (CentX - xH)
714 + (CentY - yH) * (CentY - yH));
717 - TMath::Sqrt((CentX - xH) * (CentX - xH)
718 + (CentY - yH) * (CentY - yH));
747 for (Int_t
i = 0;
i <
fMcTracks->GetEntriesFast();
i++) {
749 if (!mcTrack)
continue;
751 Int_t pdg = TMath::Abs(mcTrack->
GetPdgCode());
755 Double_t theta = mom.Theta() * 180 /
TMath::Pi();
757 if (pdg == 11 && motherId == -1) {
775 new TH1D(
"H_Diff_LineRefPMT_MomAtPMT",
776 "H_Diff_LineRefPMT_MomAtPMT;#Delta [cm]; Yield",
782 "H_Theta_TwoVectors;#theta [deg]; Yield",
786 H_MomRing =
new TH1D(
"H_MomRing",
"H_MomRing;p [GeV]; Yield", 49, 0., 12.);
787 H_MomPrim =
new TH1D(
"H_MomPrim",
"H_MomPrim;p [GeV]; Yield", 49, 0., 12.);
788 H_PtPrim =
new TH1D(
"H_PtPrim",
"H_PtPrim;p [GeV]; Yield", 81, 0., 4.);
790 "H_MomPt",
"H_MomPt;p [GeV];pt [GeV]; Yield", 101, 0., 10., 81, 0., 4.);
792 "H_Mom_Theta_MC;p [GeV];theta [deg]; Yield",
800 "H_Pt_Theta_MC;pt [GeV];theta [deg]; Yield",
809 "H_Mom_Theta_Rec;p [GeV];theta [deg]; Yield",
817 "H_Pt_Theta_Rec;pt [GeV];theta [deg]; Yield",
825 "H_Mom_Theta_Acc;p [GeV];theta [deg]; Yield",
833 "H_Pt_Theta_Acc;pt [GeV];theta [deg]; Yield",
842 "H_MomPrim_RegularTheta;p [GeV]; Yield",
847 new TH1D(
"H_acc_mom_el_RegularTheta",
848 "H_acc_mom_el_RegularTheta;p [GeV/c];Yield",
855 "H_Hits_XY;X [cm];Y [cm];Counter",
863 "H_Hits_XY_LeftHalf;X [cm];Y [cm];Counter",
871 "H_Hits_XY_RightHalf;X [cm];Y [cm];Counter",
879 "H_Hits_XY_RightThird;X [cm];Y [cm];Counter",
887 new TH2D(
"H_Hits_XY_Left2Thirds",
888 "H_Hits_XY_Left2Thirds;X [cm];Y [cm];Counter",
897 "H_PointsIn_XY;X [cm];Y [cm];Counter",
905 new TH2D(
"H_PointsIn_XY_LeftHalf",
906 "H_PointsIn_XY_LeftHalf;X [cm];Y [cm];Counter",
914 new TH2D(
"H_PointsIn_XY_RightHalf",
915 "H_PointsIn_XY_RightHalf;X [cm];Y [cm];Counter",
923 new TH2D(
"H_PointsIn_XY_RightThird",
924 "H_PointsIn_XY_RightThird;X [cm];Y [cm];Counter",
932 new TH2D(
"H_PointsIn_XY_Left2Thirds",
933 "H_PointsIn_XY_Left2Thirds;X [cm];Y [cm];Counter",
942 "H_PointsOut_XY;X [cm];Y [cm];Counter",
951 new TH1D(
"H_NofPhotonsPerEv",
952 "H_NofPhotonsPerEv;Number of photons per event;Yield",
957 new TH1D(
"H_NofPhotonsPerHit",
958 "H_NofPhotonsPerHit;Number of photons per hit;Yield",
963 new TH1D(
"H_NofPhotonsSmallerThan30",
964 "H_NofPhotonsSmallerThan30 ;Number of photons;Yield",
969 "H_DiffXhit",
"H_DiffXhit;Y_{point}-Y_{hit} [cm];Yield", 200, -1., 1.);
971 "H_DiffYhit",
"H_DiffYhit;Y_{point}-Y_{hit} [cm];Yield", 200, -1., 1.);
974 "H_Alpha",
"H_Alpha;#alpha_{photon-PMT} [deg];Yield", 180, 0., 180.);
976 "H_Alpha_UpLeft;#alpha_{photon-PMT} [deg];Yield",
981 new TH1D(
"H_Alpha_UpLeft_II",
982 "H_Alpha_UpLeft_II;#alpha_{photon-PMT} [deg];Yield",
987 new TH1D(
"H_Alpha_UpLeft_RegularTheta",
988 "H_Alpha_UpLeft_RegularTheta;#alpha_{photon-PMT} [deg];Yield",
994 new TH1D(
"H_Alpha_UpLeft_LeftHalf",
995 "H_Alpha_UpLeft_LeftHalf;#alpha_{photon-PMT} [deg];Yield",
1000 new TH1D(
"H_Alpha_UpLeft_RightHalf",
1001 "H_Alpha_UpLeft_RightHalf;#alpha_{photon-PMT} [deg];Yield",
1006 new TH1D(
"H_Alpha_UpLeft_Left2Thirds",
1007 "H_Alpha_UpLeft_Left2Thirds;#alpha_{photon-PMT} [deg];Yield",
1012 new TH1D(
"H_Alpha_UpLeft_RightThird",
1013 "H_Alpha_UpLeft_RightThird;#alpha_{photon-PMT} [deg];Yield",
1020 "H_Alpha_XYposAtDet",
1021 "H_Alpha_XYposAtDet; X [cm]; Y [cm];#alpha_{photon-PMT} [deg];Yield",
1032 new TH3D(
"H_Alpha_XYposAtDet_RegularTheta",
1033 "H_Alpha_XYposAtDet_RegularTheta; X [cm]; Y "
1034 "[cm];#alpha_{photon-PMT} [deg];Yield",
1045 new TH3D(
"H_Alpha_XYposAtDet_LeftHalf",
1046 "H_Alpha_XYposAtDet_LeftHalf; X [cm]; Y [cm];#alpha_{photon-PMT} "
1058 new TH3D(
"H_Alpha_XYposAtDet_RightHalf",
1059 "H_Alpha_XYposAtDet_RightHalf; X [cm]; Y [cm];#alpha_{photon-PMT} "
1071 new TH3D(
"H_Alpha_XYposAtDet_Left2Thirds",
1072 "H_Alpha_XYposAtDet_Left2Thirds; X [cm]; Y "
1073 "[cm];#alpha_{photon-PMT} [deg];Yield",
1084 new TH3D(
"H_Alpha_XYposAtDet_RightThird",
1085 "H_Alpha_XYposAtDet_RightThird; X [cm]; Y "
1086 "[cm];#alpha_{photon-PMT} [deg];Yield",
1099 "H_dFocalPoint_Delta;#Delta_{f} [mm];Yield",
1104 "H_dFocalPoint_Rho;#rho_{f} [mm];Yield",
1114 new TH1D(
"H_acc_mom_el",
"H_acc_mom_el;p [GeV/c];Yield", 49, 0., 12.);
1116 "H_acc_pty_el;Rapidity;P_{t} [GeV/c];Yield",
1137 "H_NofHitsAll",
"H_NofHitsAll;Nof hits in ring;Yield", 50, 0., 50.);
1139 new TH1D(
"H_NofRings",
"H_NofRings;Nof rings per event;Yield", 10, 0., 10.);
1141 new TH2D(
"H_NofRings_NofHits",
1142 "H_NofRings_NofHits;Nof rings per event, Nof hits per ring;Yield",
1151 H_Radius =
new TH1D(
"H_Radius",
"H_Radius", 401, 2., 6.);
1152 H_aAxis =
new TH1D(
"H_aAxis",
"H_aAxis", 401, 2., 10.);
1153 H_bAxis =
new TH1D(
"H_bAxis",
"H_bAxis", 401, 2., 10.);
1154 H_boa =
new TH1D(
"H_boa",
"H_boa", 51, 0.5, 1.);
1156 new TH1D(
"H_boa_RegularTheta",
"H_boa_RegularTheta", 51, 0.5, 1.);
1157 H_boa_LeftHalf =
new TH1D(
"H_boa_LeftHalf",
"H_boa_LeftHalf", 51, 0.5, 1.);
1158 H_boa_RightHalf =
new TH1D(
"H_boa_RightHalf",
"H_boa_RightHalf", 51, 0.5, 1.);
1160 new TH1D(
"H_boa_Left2Thirds",
"H_boa_Left2Thirds", 51, 0.5, 1.);
1162 new TH1D(
"H_boa_RightThird",
"H_boa_RightThird", 51, 0.5, 1.);
1165 H_dR_aa =
new TH1D(
"H_dR_aa",
"H_dR_aa", 61, -3., 3.);
1166 H_dR =
new TH1D(
"H_dR",
"H_dR", 61, -3., 3.);
1168 new TH1D(
"H_dR_RegularTheta",
"H_dR_RegularTheta", 61, -3., 3.);
1169 H_dR_LeftHalf =
new TH1D(
"H_dR_LeftHalf",
"H_dR_LeftHalf", 61, -3., 3.);
1170 H_dR_RightHalf =
new TH1D(
"H_dR_RightHalf",
"H_dR_RightHalf", 61, -3., 3.);
1172 new TH1D(
"H_dR_Left2Thirds",
"H_dR_Left2Thirds", 61, -3., 3.);
1173 H_dR_RightThird =
new TH1D(
"H_dR_RightThird",
"H_dR_RightThird", 61, -3., 3.);
1178 new TH2D(
"H_RingCenter",
"H_RingCenter", 201, -100., 0., 351, 0., 350.);
1181 "H_RingCenter_Aaxis",
1192 "H_RingCenter_Baxis",
1214 "H_RingCenter_boa_RegularTheta",
1225 "H_RingCenter_boa_LeftHalf",
1236 "H_RingCenter_boa_RightHalf",
1247 "H_RingCenter_boa_Left2Thirds",
1258 "H_RingCenter_boa_RightThird",
1281 "H_RingCenter_dR_RegularTheta",
1292 "H_RingCenter_dR_LeftHalf",
1303 "H_RingCenter_dR_RightHalf",
1314 "H_RingCenter_dR_Left2Thirds",
1325 "H_RingCenter_dR_RightThird",
1442 for (Int_t ip = 0; ip < nofPoints; ip++) {
1444 if (NULL == point)
continue;
1445 int trackId = point->GetTrackID();
1446 if (trackId < 0)
continue;
1449 == TrackIdOfSensPlane) {
1463 int PointFilled = 1;
1464 for (
int p2 = p - 1; p2 > -1; p2--) {
1470 if (PointFilled == 1) {
continue; }
1475 for (Int_t ip = 0; ip < nofPoints - 10; ip += 10) {
1477 if (NULL == point)
continue;
1478 int trackId = point->GetTrackID();
1479 if (trackId < 0)
continue;
1480 if (point->GetX() >= 0 || point->GetY() <= 0) {
continue; }
1481 cout <<
"FillPointsAtPMT: Fillinf point #" << p <<
" --> "
1482 << point->GetX() <<
", " << point->GetY() <<
", " << point->GetZ()
1499 int PointFilled = 1;
1500 for (
int p2 = p - 1; p2 > -1; p2--) {
1506 if (PointFilled == 1) {
continue; }
1510 Int_t nofRefPoints =
fRefPoints->GetEntriesFast();
1512 for (Int_t ip = 0; ip < nofRefPoints - 10; ip += 10) {
1514 if (RefPoint == NULL)
continue;
1515 int RefPointTrackId = RefPoint->GetTrackID();
1516 if (RefPointTrackId < 0) {
continue; }
1517 if (RefPoint->GetX() >= 0 || RefPoint->GetY() <= 0) {
continue; }
1535 float A = (G_P1 - MirrCenter) * (G_P1 - MirrCenter);
1536 float B = (G_P2 - G_P1) * (G_P2 - G_P1);
1537 float P = 2. * ((G_P1 - MirrCenter) * (G_P2 - G_P1)) / (B);
1538 float q = (A - R * R) / B;
1540 float t1 = -1. * P / 2. - TMath::Sqrt((P / 2.) * (P / 2.) - q);
1541 float t2 = -1. * P / 2. + TMath::Sqrt((P / 2.) * (P / 2.) - q);
1544 if (!(t1 == 1. || t1 > 1.)) {
return -1.; }
1547 TVector3 IntersectP1;
1548 TVector3 IntersectP2;
1549 IntersectP1.SetX(G_P1.X() + t1 * (G_P2.X() - G_P1.X()));
1550 IntersectP1.SetY(G_P1.Y() + t1 * (G_P2.Y() - G_P1.Y()));
1551 IntersectP1.SetZ(G_P1.Z() + t1 * (G_P2.Z() - G_P1.Z()));
1553 IntersectP2.SetX(G_P1.X() + t2 * (G_P2.X() - G_P1.X()));
1554 IntersectP2.SetY(G_P1.Y() + t2 * (G_P2.Y() - G_P1.Y()));
1555 IntersectP2.SetZ(G_P1.Z() + t2 * (G_P2.Z() - G_P1.Z()));
1557 TVector3 Line1 = IntersectP1 - G_P1;
1558 float Length1 = TMath::Sqrt(Line1.X() * Line1.X() + Line1.Y() * Line1.Y()
1559 + Line1.Z() * Line1.Z());
1560 TVector3 Line2 = IntersectP2 - G_P1;
1561 float Length2 = TMath::Sqrt(Line2.X() * Line2.X() + Line2.Y() * Line2.Y()
1562 + Line2.Z() * Line2.Z());
1565 if (Length1 < Length2) {
1579 return TMath::Sqrt(XTerm + YTerm + ZTerm);
1585 double TolaratedDiff = 0.001;
1586 double ProdP0WithNorm =
1588 double ProdPWithNorm =
1590 return TMath::Abs(ProdP0WithNorm - ProdPWithNorm)
1591 <= ((TMath::Abs(ProdP0WithNorm) < TMath::Abs(ProdPWithNorm)
1592 ? TMath::Abs(ProdPWithNorm)
1593 : TMath::Abs(ProdP0WithNorm))