325 Double_t trackX = 0., trackY = 0.;
329 Float_t DistCenters, Theta_Ch, Theta_0, Angles_0;
331 Float_t TwoPi = 2. * 3.14159265;
335 if (nofRingsInEvent >= 1) {
336 cout <<
"Number of Rings in event: " << nofRingsInEvent << endl;
338 for (
Int_t iR = 0; iR < nofRingsInEvent; iR++) {
346 fHM2->H1(
"fHCenterDistance")->Fill(DistCenters);
352 for (
Int_t iH = 0; iH < NofHits; iH++) {
362 if (xRing - xHit == 0 || yRing - yHit == 0)
continue;
363 fPhi[iH] = TMath::ATan2(yHit - yRing, xHit - xRing);
367 Theta_Ch =
sqrt(TMath::Power(trackX - hit->
GetX(), 2) + TMath::Power(trackY - hit->
GetY(), 2));
371 fHM2->H1(
"fHThetaDiff")->Fill(Theta_Ch - Theta_0);
374 fHM2->H2(
"fHCherenkovHitsDistribTheta0")->Fill(Angles_0, Theta_0);
375 fHM2->H2(
"fHCherenkovHitsDistribThetaCh")->Fill(
fPhi[iH], Theta_Ch);
376 fHM2->H2(
"fHCherenkovHitsDistribReduced")->Fill(
fPhi[iH], (Theta_Ch - Theta_0));
404 cout <<
"//---------------------------------------- MATCH_FINDER Function "
405 "----------------------------------------//"
413 Double_t x_Mirr = 0, y_Mirr = 0, z_Mirr = 0, x_PMT = 0, y_PMT = 0, z_PMT = 0;
414 Double_t CenterX = 0, CenterY = 0;
416 const Char_t* mirr_path;
419 for (
Int_t iMirr = 0; iMirr < NofMirrorPoints; iMirr++) {
421 Int_t trackID = MirrPoint->GetTrackID();
424 for (
Int_t iMCPoint = 0; iMCPoint < NofMCPoints; iMCPoint++) {
426 if (NULL == pPoint)
continue;
428 if (NULL == pTrack)
continue;
431 if (motherID == -1)
continue;
433 if (trackID == motherID) {
437 x_Mirr = MirrPoint->GetX();
438 y_Mirr = MirrPoint->GetY();
439 z_Mirr = MirrPoint->GetZ();
441 mirr_node = gGeoManager->FindNode(x_Mirr, y_Mirr, z_Mirr);
442 mirr_path = gGeoManager->GetPath();
449 for (
Int_t iRing = 0; iRing < NofRingsInEvent; iRing++) {
451 if (NULL == ring)
continue;
462 if (richMCID == -1)
continue;
464 if (trackID == richMCID) {
466 cout <<
"MATCH BETWEEN TRACK_ID AND RICH_MC_ID FOUND !" << endl;
467 cout <<
"Center X = " << CenterX <<
" and center Y = " << CenterY << endl;
468 x_Mirr = MirrPoint->GetX();
469 y_Mirr = MirrPoint->GetY();
470 z_Mirr = MirrPoint->GetZ();
471 cout <<
"x_Mirr: " << x_Mirr <<
", y_Mirr: " << y_Mirr <<
" and z_Mirr: " << z_Mirr << endl;
472 mirr_node = gGeoManager->FindNode(x_Mirr, y_Mirr, z_Mirr);
473 mirr_path = gGeoManager->GetPath();
474 cout <<
"Mirror path: " << mirr_path << endl;
522 cout <<
"//------------------------------ CbmRichCorrectionVector: "
523 "Projection Producer ------------------------------//"
534 projectedPoint->Delete();
536 TMatrixFSym covMat(5);
537 for (
Int_t iMatrix = 0; iMatrix < 5; iMatrix++) {
538 for (
Int_t jMatrix = 0; jMatrix <= iMatrix; jMatrix++) {
539 covMat(iMatrix, jMatrix) = 0;
542 covMat(0, 0) = covMat(1, 1) = covMat(2, 2) = covMat(3, 3) = covMat(4, 4) = 1.e-4;
545 Double_t sphereRadius = 300., constantePMT = 0.;
546 vector<Double_t> ptM(3), ptC(3), ptR1(3), momR1(3), normalPMT(3), ptR2Mirr(3), ptR2Center(3), ptPMirr(3), ptPR2(3);
547 vector<Double_t> ptMUnCorr(3), ptCUnCorr(3), ptR2CenterUnCorr(3), ptR2MirrUnCorr(3), ptPMirrUnCorr(3), ptPR2UnCorr(3);
548 Double_t reflectedPtCooVectSphereUnity[] = {0., 0., 0.};
549 TVector3 outPos, outPosUnCorr;
551 Double_t ringCenter[] = {0., 0., 0.}, distToExtrapTrackHit = 0., distToExtrapTrackHitInPlane = 0.;
553 Int_t mirrTrackID = -1, pmtTrackID = -1, refPlaneTrackID = -1, motherID = -100, pmtMotherID = -100;
557 TGeoMatrix *mirrMatrix, *pmtMatrix, *richMatrix;
567 cout <<
"Calculated normal vector to PMT plane = {" << normalPMT.at(0) <<
", " << normalPMT.at(1) <<
", "
568 << normalPMT.at(2) <<
"} and constante d = " << constantePMT << endl
571 for (
Int_t iMirr = 0; iMirr < NofMirrorPoints; iMirr++) {
574 mirrTrackID = mirrPoint->GetTrackID();
576 if (mirrTrackID <= -1) {
577 cout <<
"Mirror track ID <= 1 !!!" << endl;
578 cout <<
"----------------------------------- End of loop N " << iMirr + 1
579 <<
" on the mirror points. -----------------------------------" << endl
585 if (motherID == -1) {
587 ptM.at(0) = mirrPoint->GetX(), ptM.at(1) = mirrPoint->GetY(), ptM.at(2) = mirrPoint->GetZ();
588 ptMUnCorr.at(0) = -70.6622238, ptMUnCorr.at(1) = 55.1816025, ptMUnCorr.at(2) = 335.3621216;
590 mirrNode = gGeoManager->FindNode(ptM.at(0), ptM.at(1), ptM.at(2));
592 cout <<
"Mirror node found! Mirror node name = " << mirrNode->GetName() << endl;
593 navi = gGeoManager->GetCurrentNavigator();
594 cout <<
"Navigator path: " << navi->GetPath() << endl;
595 cout <<
"Coordinates of sphere center: " << endl;
596 navi->GetCurrentMatrix()->Print();
601 ptC.at(0) = navi->GetCurrentMatrix()->GetTranslation()[0];
602 ptC.at(1) = navi->GetCurrentMatrix()->GetTranslation()[1];
603 ptC.at(2) = navi->GetCurrentMatrix()->GetTranslation()[2];
605 ptCUnCorr.at(0) = 0., ptCUnCorr.at(1) = 132.594000, ptCUnCorr.at(2) = 54.267226;
606 cout <<
"Coordinates of tile center: " << endl;
607 navi->GetMotherMatrix()->Print();
609 <<
"Sphere center coordinates of the rotated mirror tile = {" << ptC.at(0) <<
", " << ptC.at(1) <<
", "
610 << ptC.at(2) <<
"} and sphere inner radius = " << sphereRadius << endl;
612 for (
Int_t iRefl = 0; iRefl < NofRefPlanePoints; iRefl++) {
615 refPlaneTrackID = refPlanePoint->GetTrackID();
617 if (mirrTrackID == refPlaneTrackID) {
619 ptR1.at(0) = refPlanePoint->GetX(), ptR1.at(1) = refPlanePoint->GetY(), ptR1.at(2) = refPlanePoint->GetZ();
620 momR1.at(0) = refPlanePoint->GetPx(), momR1.at(1) = refPlanePoint->GetPy(),
621 momR1.at(2) = refPlanePoint->GetPz();
622 cout <<
"Reflective Plane Point coordinates = {" << ptR1.at(0) <<
", " << ptR1.at(1) <<
", " << ptR1.at(2)
624 cout <<
"And reflective Plane Point momenta = {" << momR1.at(0) <<
", " << momR1.at(1) <<
", "
625 << momR1.at(2) <<
"}" << endl;
626 cout <<
"Mirror Point coordinates = {" << ptM.at(0) <<
", " << ptM.at(1) <<
", " << ptM.at(2) <<
"}" << endl
628 cout <<
"Mirror Point coordinates (Uncorrected) = {" << ptMUnCorr.at(0) <<
", " << ptMUnCorr.at(1) <<
", "
629 << ptMUnCorr.at(2) <<
"}" << endl
638 ComputeR2(ptR2Center, ptR2Mirr, ptC, ptM, ptR1);
639 ComputeR2(ptR2CenterUnCorr, ptR2MirrUnCorr, ptCUnCorr, ptM, ptR1);
641 ComputeP(ptPMirr, ptPR2, normalPMT, ptM, ptR2Mirr, constantePMT);
642 ComputeP(ptPMirrUnCorr, ptPR2UnCorr, normalPMT, ptM, ptR2MirrUnCorr, constantePMT);
644 TVector3 inPos(ptPMirr.at(0), ptPMirr.at(1), ptPMirr.at(2));
646 cout <<
"New mirror points coordinates = {" << outPos.x() <<
", " << outPos.y() <<
", " << outPos.z() <<
"}"
649 TVector3 inPosUnCorr(ptPMirrUnCorr.at(0), ptPMirrUnCorr.at(1), ptPMirrUnCorr.at(2));
651 cout <<
"New mirror points coordinates = {" << outPosUnCorr.x() <<
", " << outPosUnCorr.y() <<
", "
652 << outPosUnCorr.z() <<
"}" << endl
685 cout <<
"Not a mother particle ..." << endl;
687 cout <<
"----------------------------------- "
688 <<
"End of loop N " << iMirr + 1 <<
" on the mirror points."
689 <<
" -----------------------------------" << endl
699 Int_t pmtTrackID, pmtMotherID;
700 Double_t buffNormX = 0., buffNormY = 0., buffNormZ = 0., k = 0., scalarProd = 0.;
701 Double_t pmtPt[] = {0., 0., 0.};
702 Double_t a[] = {0., 0., 0.}, b[] = {0., 0., 0.}, c[] = {0., 0., 0.};
710 for (
Int_t iPmt = 0; iPmt < NofPMTPoints; iPmt++) {
712 pmtTrackID = pmtPoint->GetTrackID();
715 a[0] = pmtPoint->GetX(), a[1] = pmtPoint->GetY(), a[2] = pmtPoint->GetZ();
719 for (
Int_t iPmt = 0; iPmt < NofPMTPoints; iPmt++) {
721 pmtTrackID = pmtPoint->GetTrackID();
725 if (TMath::Sqrt(TMath::Power(a[0] - pmtPoint->GetX(), 2) + TMath::Power(a[1] - pmtPoint->GetY(), 2)
726 + TMath::Power(a[2] - pmtPoint->GetZ(), 2))
728 b[0] = pmtPoint->GetX(), b[1] = pmtPoint->GetY(), b[2] = pmtPoint->GetZ();
733 for (
Int_t iPmt = 0; iPmt < NofPMTPoints; iPmt++) {
735 pmtTrackID = pmtPoint->GetTrackID();
739 if (TMath::Sqrt(TMath::Power(a[0] - pmtPoint->GetX(), 2) + TMath::Power(a[1] - pmtPoint->GetY(), 2)
740 + TMath::Power(a[2] - pmtPoint->GetZ(), 2))
742 && TMath::Sqrt(TMath::Power(b[0] - pmtPoint->GetX(), 2) + TMath::Power(b[1] - pmtPoint->GetY(), 2)
743 + TMath::Power(b[2] - pmtPoint->GetZ(), 2))
745 c[0] = pmtPoint->GetX(), c[1] = pmtPoint->GetY(), c[2] = pmtPoint->GetZ();
751 k = (b[0] - a[0]) / (c[0] - a[0]);
752 if ((b[1] - a[1]) - (k * (c[1] - a[1])) == 0 || (b[2] - a[2]) - (k * (c[2] - a[2])) == 0) {
753 cout <<
"Error in normal calculation, vect_AB and vect_AC are collinear." << endl;
756 buffNormX = (b[1] - a[1]) * (c[2] - a[2]) - (b[2] - a[2]) * (c[1] - a[1]);
757 buffNormY = (b[2] - a[2]) * (c[0] - a[0]) - (b[0] - a[0]) * (c[2] - a[2]);
758 buffNormZ = (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
760 buffNormX / TMath::Sqrt(TMath::Power(buffNormX, 2) + TMath::Power(buffNormY, 2) + TMath::Power(buffNormZ, 2));
762 buffNormY / TMath::Sqrt(TMath::Power(buffNormX, 2) + TMath::Power(buffNormY, 2) + TMath::Power(buffNormZ, 2));
764 buffNormZ / TMath::Sqrt(TMath::Power(buffNormX, 2) + TMath::Power(buffNormY, 2) + TMath::Power(buffNormZ, 2));
768 scalarProd = normalPMT.at(0) * (pmtPoint1->GetX() - a[0]) + normalPMT.at(1) * (pmtPoint1->GetY() - a[1])
769 + normalPMT.at(2) * (pmtPoint1->GetZ() - a[2]);
774 * (normalPMT.at(0) * pmtPoint1->GetX() + normalPMT.at(1) * pmtPoint1->GetY() + normalPMT.at(2) * pmtPoint1->GetZ());
776 scalarProd = normalPMT.at(0) * (pmtPoint2->GetX() - a[0]) + normalPMT.at(1) * (pmtPoint2->GetY() - a[1])
777 + normalPMT.at(2) * (pmtPoint2->GetZ() - a[2]);
780 scalarProd = normalPMT.at(0) * (pmtPoint3->GetX() - a[0]) + normalPMT.at(1) * (pmtPoint3->GetY() - a[1])
781 + normalPMT.at(2) * (pmtPoint3->GetZ() - a[2]);
787 const Char_t* topNodePath;
788 topNodePath = gGeoManager->GetTopNode()->GetName();
789 cout <<
"Top node path: " << topNodePath << endl;
791 rootTop = gGeoManager->GetTopVolume();
794 TGeoIterator nextNode(rootTop);
796 const TGeoMatrix* curMatrix;
797 const Double_t* curNodeTranslation;
798 const Double_t* curNodeRotationM;
799 TString filterName0(
"mirror_tile_type0");
800 TString filterName1(
"mirror_tile_type1");
801 TString filterName2(
"mirror_tile_type2");
802 TString filterName3(
"mirror_tile_type3");
803 TString filterName4(
"mirror_tile_type4");
804 TString filterName5(
"mirror_tile_type5");
806 Double_t sphereXTot = 0., sphereYTot = 0., sphereZTot = 0.;
808 while ((curNode = nextNode())) {
809 TString nodeName(curNode->GetName());
814 if (curNode->GetVolume()->GetName() == filterName0 || curNode->GetVolume()->GetName() == filterName1
815 || curNode->GetVolume()->GetName() == filterName2 || curNode->GetVolume()->GetName() == filterName3
816 || curNode->GetVolume()->GetName() == filterName4 || curNode->GetVolume()->GetName() == filterName5) {
817 if (curNode->GetNdaughters() == 0) {
820 nextNode.GetPath(nodePath);
821 curMatrix = nextNode.GetCurrentMatrix();
822 curNodeTranslation = curMatrix->GetTranslation();
823 curNodeRotationM = curMatrix->GetRotationMatrix();
824 printf(
"%s tr:\t", nodePath.Data());
825 printf(
"%08f\t%08f\t%08f\t\n", curNodeTranslation[0], curNodeTranslation[1], curNodeTranslation[2]);
826 if (curNodeTranslation[1] > 0) {
827 sphereXTot += curNodeTranslation[0];
828 sphereYTot += curNodeTranslation[1];
829 sphereZTot += curNodeTranslation[2];
835 ptC.at(0) = sphereXTot /
counter;
836 ptC.at(1) = sphereYTot /
counter;
837 ptC.at(2) = sphereZTot /
counter;
844 vector<Double_t> momR1, vector<Double_t> ptC, Double_t sphereRadius)
846 Double_t a = 0., b = 0., c = 0., d = 0., k0 = 0., k1 = 0., k2 = 0.;
848 a = TMath::Power(momR1.at(0), 2) + TMath::Power(momR1.at(1), 2) + TMath::Power(momR1.at(2), 2);
850 * (momR1.at(0) * (ptR1.at(0) - ptC.at(0)) + momR1.at(1) * (ptR1.at(1) - ptC.at(1))
851 + momR1.at(2) * (ptR1.at(2) - ptC.at(2)));
852 c = TMath::Power(ptR1.at(0) - ptC.at(0), 2) + TMath::Power(ptR1.at(1) - ptC.at(1), 2)
853 + TMath::Power(ptR1.at(2) - ptC.at(2), 2) - TMath::Power(sphereRadius, 2);
854 d = b * b - 4 * a * c;
855 cout <<
"d = " << d << endl;
858 cout <<
"Error no solution to degree 2 equation found ; discriminant below 0." << endl;
859 ptM.at(0) = 0., ptM.at(1) = 0., ptM.at(2) = 0.;
862 cout <<
"One solution to degree 2 equation found." << endl;
864 ptM.at(0) = ptR1.at(0) + k0 * momR1.at(0);
865 ptM.at(1) = ptR1.at(1) + k0 * momR1.at(1);
866 ptM.at(2) = ptR1.at(2) + k0 * momR1.at(2);
869 cout <<
"Two solutions to degree 2 equation found." << endl;
870 k1 = ((-b - TMath::Sqrt(d)) / (2 * a));
871 k2 = ((-b + TMath::Sqrt(d)) / (2 * a));
873 if (ptR1.at(2) + k1 * momR1.at(2) > ptR1.at(2) + k2 * momR1.at(2)) {
874 ptM.at(0) = ptR1.at(0) + k1 * momR1.at(0);
875 ptM.at(1) = ptR1.at(1) + k1 * momR1.at(1);
876 ptM.at(2) = ptR1.at(2) + k1 * momR1.at(2);
878 else if (ptR1.at(2) + k1 * momR1.at(2) < ptR1.at(2) + k2 * momR1.at(2)) {
879 ptM.at(0) = ptR1.at(0) + k2 * momR1.at(0);
880 ptM.at(1) = ptR1.at(1) + k2 * momR1.at(1);
881 ptM.at(2) = ptR1.at(2) + k2 * momR1.at(2);
887 vector<Double_t> ptC, vector<Double_t> ptR1)
889 vector<Double_t> normalMirr(3);
890 Double_t t1 = 0., t2 = 0., t3 = 0.;
892 normalMirr.at(0) = (ptC.at(0) - ptM.at(0))
893 / TMath::Sqrt(TMath::Power(ptC.at(0) - ptM.at(0), 2) + TMath::Power(ptC.at(1) - ptM.at(1), 2)
894 + TMath::Power(ptC.at(2) - ptM.at(2), 2));
895 normalMirr.at(1) = (ptC.at(1) - ptM.at(1))
896 / TMath::Sqrt(TMath::Power(ptC.at(0) - ptM.at(0), 2) + TMath::Power(ptC.at(1) - ptM.at(1), 2)
897 + TMath::Power(ptC.at(2) - ptM.at(2), 2));
898 normalMirr.at(2) = (ptC.at(2) - ptM.at(2))
899 / TMath::Sqrt(TMath::Power(ptC.at(0) - ptM.at(0), 2) + TMath::Power(ptC.at(1) - ptM.at(1), 2)
900 + TMath::Power(ptC.at(2) - ptM.at(2), 2));
903 t1 = ((ptR1.at(0) - ptM.at(0)) * (ptC.at(0) - ptM.at(0)) + (ptR1.at(1) - ptM.at(1)) * (ptC.at(1) - ptM.at(1))
904 + (ptR1.at(2) - ptM.at(2)) * (ptC.at(2) - ptM.at(2)))
905 / (TMath::Power(ptC.at(0) - ptM.at(0), 2) + TMath::Power(ptC.at(1) - ptM.at(1), 2)
906 + TMath::Power(ptC.at(2) - ptM.at(2), 2));
907 ptR2Center.at(0) = 2 * (ptM.at(0) + t1 * (ptC.at(0) - ptM.at(0))) - ptR1.at(0);
908 ptR2Center.at(1) = 2 * (ptM.at(1) + t1 * (ptC.at(1) - ptM.at(1))) - ptR1.at(1);
909 ptR2Center.at(2) = 2 * (ptM.at(2) + t1 * (ptC.at(2) - ptM.at(2))) - ptR1.at(2);
910 t2 = ((ptR1.at(0) - ptC.at(0)) * (ptC.at(0) - ptM.at(0)) + (ptR1.at(1) - ptC.at(1)) * (ptC.at(1) - ptM.at(1))
911 + (ptR1.at(2) - ptC.at(2)) * (ptC.at(2) - ptM.at(2)))
912 / (TMath::Power(ptC.at(0) - ptM.at(0), 2) + TMath::Power(ptC.at(1) - ptM.at(1), 2)
913 + TMath::Power(ptC.at(2) - ptM.at(2), 2));
914 ptR2Mirr.at(0) = 2 * (ptC.at(0) + t2 * (ptC.at(0) - ptM.at(0))) - ptR1.at(0);
915 ptR2Mirr.at(1) = 2 * (ptC.at(1) + t2 * (ptC.at(1) - ptM.at(1))) - ptR1.at(1);
916 ptR2Mirr.at(2) = 2 * (ptC.at(2) + t2 * (ptC.at(2) - ptM.at(2))) - ptR1.at(2);
922 cout <<
"Coordinates of point R2 on reflective plane after reflection on the "
926 cout <<
"* using sphere center C to define \U00000394: {" << ptR2Mirr.at(0) <<
", " << ptR2Mirr.at(1) <<
", "
927 << ptR2Mirr.at(2) <<
"}" << endl
934 vector<Double_t> ptM, vector<Double_t> ptR2Mirr, Double_t constantePMT)
936 Double_t k1 = 0., k2 = 0., checkCalc1 = 0., checkCalc2 = 0.;
939 * ((normalPMT.at(0) * ptM.at(0) + normalPMT.at(1) * ptM.at(1) + normalPMT.at(2) * ptM.at(2) + constantePMT)
940 / (normalPMT.at(0) * (ptR2Mirr.at(0) - ptM.at(0)) + normalPMT.at(1) * (ptR2Mirr.at(1) - ptM.at(1))
941 + normalPMT.at(2) * (ptR2Mirr.at(2) - ptM.at(2))));
942 ptPMirr.at(0) = ptM.at(0) + k1 * (ptR2Mirr.at(0) - ptM.at(0));
943 ptPMirr.at(1) = ptM.at(1) + k1 * (ptR2Mirr.at(1) - ptM.at(1));
944 ptPMirr.at(2) = ptM.at(2) + k1 * (ptR2Mirr.at(2) - ptM.at(2));
946 * ((normalPMT.at(0) * ptR2Mirr.at(0) + normalPMT.at(1) * ptR2Mirr.at(1) + normalPMT.at(2) * ptR2Mirr.at(2)
948 / (normalPMT.at(0) * (ptR2Mirr.at(0) - ptM.at(0)) + normalPMT.at(1) * (ptR2Mirr.at(1) - ptM.at(1))
949 + normalPMT.at(2) * (ptR2Mirr.at(2) - ptM.at(2))));
950 ptPR2.at(0) = ptR2Mirr.at(0) + k2 * (ptR2Mirr.at(0) - ptM.at(0));
951 ptPR2.at(1) = ptR2Mirr.at(1) + k2 * (ptR2Mirr.at(1) - ptM.at(1));
952 ptPR2.at(2) = ptR2Mirr.at(2) + k2 * (ptR2Mirr.at(2) - ptM.at(2));
953 cout <<
"Coordinates of point P on PMT plane, after reflection on the mirror "
954 "tile and extrapolation to the PMT plane:"
956 cout <<
"* using mirror point M to define \U0001D49F ': {" << ptPMirr.at(0) <<
", " << ptPMirr.at(1) <<
", "
957 << ptPMirr.at(2) <<
"}" << endl;
960 ptPMirr.at(0) * normalPMT.at(0) + ptPMirr.at(1) * normalPMT.at(1) + ptPMirr.at(2) * normalPMT.at(2) + constantePMT;
961 cout <<
"Check whether extrapolated track point on PMT plane verifies its "
962 "equation (value should be 0.):"
964 cout <<
"* using mirror point M, checkCalc = " << checkCalc1 << endl;
966 ptPR2.at(0) * normalPMT.at(0) + ptPR2.at(1) * normalPMT.at(1) + ptPR2.at(2) * normalPMT.at(2) + constantePMT;
971 vector<Double_t> normalPMT, Double_t constantePMT)
974 Double_t ringCenter[] = {0, 0, 0}, distToExtrapTrackHit = 0, distToExtrapTrackHitInPlane = 0;
975 Double_t distToExtrapTrackHitInPlaneUnCorr = 0;
977 for (
Int_t iGlobalTrack = 0; iGlobalTrack < NofGTracks; iGlobalTrack++) {
980 if (NULL == gTrack)
continue;
990 Int_t ringTrackID = ring->GetTrackID();
1002 -1 * ((normalPMT.at(0) * ringCenter[0] + normalPMT.at(1) * ringCenter[1] + constantePMT) / normalPMT.at(2));
1004 vector<Double_t> r(3),
1006 r.at(0) = TMath::Abs(ringCenter[0]), r.at(1) = TMath::Abs(ringCenter[1]), r.at(2) = TMath::Abs(ringCenter[2]);
1007 p.at(0) = TMath::Abs(outPos.x()), p.at(1) = TMath::Abs(outPos.y()), p.at(2) = TMath::Abs(outPos.z());
1008 cout <<
"Ring center coordinates = {" << ringCenter[0] <<
", " << ringCenter[1] <<
", " << ringCenter[2] <<
"}"
1010 cout <<
"Difference in X = " << TMath::Abs(r.at(0) - p.at(0)) <<
"\t ; \t"
1011 <<
"Difference in Y = " << TMath::Abs(r.at(1) - p.at(1)) <<
"\t ; \t"
1012 <<
"Difference in Z = " << TMath::Abs(r.at(2) - p.at(2)) << endl;
1013 fHM->H1(
"fhDifferenceX")->Fill(TMath::Abs(r.at(0) - p.at(0)));
1014 fHM->H1(
"fhDifferenceY")->Fill(TMath::Abs(r.at(1) - p.at(1)));
1015 distToExtrapTrackHit = TMath::Sqrt(TMath::Power(r.at(0) - p.at(0), 2) + TMath::Power(r.at(1) - p.at(1), 2)
1016 + TMath::Power(r.at(2) - p.at(2), 2));
1017 distToExtrapTrackHitInPlane = TMath::Sqrt(TMath::Power(r.at(0) - p.at(0), 2) + TMath::Power(r.at(1) - p.at(1), 2));
1018 fHM->H1(
"fhDistanceCenterToExtrapolatedTrack")->Fill(distToExtrapTrackHit);
1019 fHM->H1(
"fhDistanceCenterToExtrapolatedTrackInPlane")->Fill(distToExtrapTrackHitInPlane);
1020 cout <<
"Distance between fitted ring center and extrapolated track hit = " << distToExtrapTrackHit << endl;
1021 cout <<
"Distance between fitted ring center and extrapolated track hit in "
1023 << distToExtrapTrackHitInPlane << endl;
1025 vector<Double_t> pUnCorr(3);
1026 pUnCorr.at(0) = TMath::Abs(outPosUnCorr.x()), pUnCorr.at(1) = TMath::Abs(outPosUnCorr.y()),
1027 pUnCorr.at(2) = TMath::Abs(outPosUnCorr.z());
1029 cout <<
"Difference in X = " << TMath::Abs(r.at(0) - pUnCorr.at(0)) <<
"\t ; \t"
1030 <<
"Difference in Y = " << TMath::Abs(r.at(1) - pUnCorr.at(1)) <<
"\t ; \t"
1031 <<
"Difference in Z = " << TMath::Abs(r.at(2) - pUnCorr.at(2)) << endl;
1032 fHM->H1(
"fhDifferenceXUncorrected")->Fill(TMath::Abs(r.at(0) - pUnCorr.at(0)));
1033 fHM->H1(
"fhDifferenceYUncorrected")->Fill(TMath::Abs(r.at(1) - pUnCorr.at(1)));
1034 distToExtrapTrackHitInPlaneUnCorr =
1035 TMath::Sqrt(TMath::Power(r.at(0) - pUnCorr.at(0), 2) + TMath::Power(r.at(1) - pUnCorr.at(1), 2));
1036 fHM->H1(
"fhDistanceCenterToExtrapolatedTrackInPlaneUncorrected")->Fill(distToExtrapTrackHitInPlaneUnCorr);
1037 cout <<
"Distance between fitted ring center and extrapolated track hit in "
1039 << distToExtrapTrackHitInPlaneUnCorr << endl
1044 cout <<
"End of loop on global tracks;" << endl;
1100 c3->SetFillColor(42);
1102 gPad->SetTopMargin(0.1);
1103 gPad->SetFillColor(33);
1106 TH2D* CloneArr = (TH2D*)
fHM2->H2(
"fHCherenkovHitsDistribReduced")->Clone();
1107 CloneArr->GetXaxis()->SetLabelSize(0.03);
1108 CloneArr->GetXaxis()->SetTitleSize(0.03);
1109 CloneArr->GetXaxis()->CenterTitle();
1110 CloneArr->GetXaxis()->SetNdivisions(612, kTRUE);
1111 CloneArr->GetYaxis()->SetLabelSize(0.03);
1112 CloneArr->GetYaxis()->SetTitleSize(0.03);
1113 CloneArr->GetYaxis()->SetNdivisions(612, kTRUE);
1114 CloneArr->GetYaxis()->CenterTitle();
1116 CloneArr->GetZaxis()->SetLabelSize(0.03);
1117 CloneArr->GetZaxis()->SetTitleSize(0.03);
1118 CloneArr->GetYaxis()->SetTitleOffset(1.0);
1119 CloneArr->Draw(
"colz");
1126 TH2D* CloneArr_2 = (TH2D*)
fHM2->H2(
"fHCherenkovHitsDistribReduced")->Clone();
1127 for (
Int_t y_bin = 1; y_bin <= 500; y_bin++) {
1128 for (
Int_t x_bin = 1; x_bin <= 200; x_bin++) {
1134 if (CloneArr_2->GetBinContent(x_bin, y_bin) < thresh) {
1135 CloneArr_2->SetBinContent(x_bin, y_bin, 0);
1140 CloneArr_2->GetXaxis()->SetLabelSize(0.03);
1141 CloneArr_2->GetXaxis()->SetTitleSize(0.03);
1142 CloneArr_2->GetXaxis()->CenterTitle();
1143 CloneArr_2->GetXaxis()->SetNdivisions(612, kTRUE);
1144 CloneArr_2->GetYaxis()->SetLabelSize(0.03);
1145 CloneArr_2->GetYaxis()->SetTitleSize(0.03);
1146 CloneArr_2->GetYaxis()->SetNdivisions(612, kTRUE);
1147 CloneArr_2->GetYaxis()->CenterTitle();
1149 CloneArr_2->GetZaxis()->SetLabelSize(0.03);
1150 CloneArr_2->GetZaxis()->SetTitleSize(0.03);
1151 CloneArr_2->GetYaxis()->SetTitleOffset(1.0);
1152 CloneArr_2->Draw(
"colz");
1153 CloneArr_2->Write();
1156 CloneArr_2->FitSlicesY(0, 0, -1, 1);
1158 TH1D* histo_0 = gDirectory->Get<TH1D>(
"fHCherenkovHitsDistribReduced_0");
1161 TH1D* histo_1 = gDirectory->Get<TH1D>(
"fHCherenkovHitsDistribReduced_1");
1165 TH1D* histo_2 = gDirectory->Get<TH1D>(
"fHCherenkovHitsDistribReduced_2");
1168 TH1D* histo_chi2 = gDirectory->Get<TH1D>(
"fHCherenkovHitsDistribReduced_chi2");
1172 TF1* f1 =
new TF1(
"f1",
"[2]+[0]*cos(x)+[1]*sin(x)", -3.5, 3.5);
1173 f1->SetParameters(0, 0, 0);
1174 f1->SetParNames(
"Delta_phi",
"Delta_lambda",
"Offset");
1175 histo_1->Fit(
"f1",
"",
"");
1176 TF1* fit = histo_1->GetFunction(
"f1");
1177 Double_t p1 = fit->GetParameter(
"Delta_phi");
1178 Double_t p2 = fit->GetParameter(
"Delta_lambda");
1179 Double_t p3 = fit->GetParameter(
"Offset");
1180 Double_t chi2 = fit->GetChisquare();
1191 f1->SetParameters(fit->GetParameter(0), fit->GetParameter(1));
1193 f1->SetLineColor(2);
1198 Double_t Focal_length = 150., q = 0.,
A = 0., Alpha = 0., mis_x = 0., mis_y = 0.;
1199 q = TMath::ATan(fit->GetParameter(0) / fit->GetParameter(1));
1200 cout << endl <<
"fit_1 = " << fit->GetParameter(0) <<
" and fit_2 = " << fit->GetParameter(1) << endl;
1202 A = fit->GetParameter(1) / TMath::Cos(q);
1205 TMath::ATan(
A / 1.5) * 0.5
1210 mis_x = TMath::ATan(fit->GetParameter(0) / Focal_length) * 0.5 * TMath::Power(10, 3);
1211 mis_y = TMath::ATan(fit->GetParameter(1) / Focal_length) * 0.5 * TMath::Power(10, 3);
1214 TLegend* LEG =
new TLegend(0.30, 0.7, 0.72, 0.85);
1215 LEG->SetBorderSize(1);
1216 LEG->SetFillColor(0);
1217 LEG->SetMargin(0.2);
1218 LEG->SetTextSize(0.03);
1219 sprintf(leg,
"Fitted sinusoid");
1220 LEG->AddEntry(f1, leg,
"l");
1221 sprintf(leg,
"Misalign in X = %f", mis_x);
1222 LEG->AddEntry(
"", leg,
"l");
1223 sprintf(leg,
"Misalign in Y = %f", mis_y);
1224 LEG->AddEntry(
"", leg,
"l");
1225 sprintf(leg,
"Offset = %f", fit->GetParameter(2));
1226 LEG->AddEntry(
"", leg,
"l");
1231 CloneArr_2->Draw(
"colz");
1233 TLegend* LEG1 =
new TLegend(0.30, 0.7, 0.72, 0.85);
1234 LEG1->SetBorderSize(1);
1235 LEG1->SetFillColor(0);
1236 LEG1->SetMargin(0.2);
1237 LEG1->SetTextSize(0.03);
1238 sprintf(leg,
"Fitted sinusoid");
1239 LEG1->AddEntry(f1, leg,
"l");
1240 sprintf(leg,
"Misalign in X = %f", mis_x);
1241 LEG1->AddEntry(
"", leg,
"l");
1242 sprintf(leg,
"Misalign in Y = %f", mis_y);
1243 LEG1->AddEntry(
"", leg,
"l");
1244 sprintf(leg,
"Offset = %f", fit->GetParameter(2));
1245 LEG1->AddEntry(
"", leg,
"l");
1285 outputFit.at(0) = mis_x;
1286 outputFit.at(1) = mis_y;