407 cout <<
"//------------------------------ CbmRichPMTMapping: Projection "
408 "Producer ------------------------------//"
413 Int_t NofRingsInEvent =
fRichRings->GetEntriesFast();
416 Int_t NofPMTPoints =
fRichPoints->GetEntriesFast();
419 Double_t t1 = 0., t2 = 0., t3 = 0., k1 = 0., k2 = 0., checkCalc1 = 0., checkCalc2 = 0.;
421 Double_t sphereRadius = 0., constantePMT = 0.;
422 Double_t ptMirr[] = {0., 0., 0.}, ptC[] = {0., 0., 0.}, ptR1[] = {0., 0., 0.}, normalPMT[] = {0., 0., 0.},
423 normalMirr[] = {0., 0., 0.};
424 Double_t ptR2Mirr[] = {0., 0., 0.}, ptR2Center[] = {0., 0., 0.}, ptPMirr[] = {0., 0., 0.}, ptPR2[] = {0., 0., 0.};
425 Double_t reflectedPtCooVectSphereUnity[] = {0., 0., 0.};
427 Double_t ringCenter[] = {0., 0., 0.}, distToExtrapTrackHit = 0., distToExtrapTrackHitInPlane = 0.;
429 Int_t mirrTrackID = -1, pmtTrackID = -1, refPlaneTrackID = -1, motherID = -100, pmtMotherID = -100;
430 const Char_t *mirrPath, *topNodePath;
433 TGeoMatrix *mirrMatrix, *pmtMatrix, *richMatrix;
436 GetPmtNormal(NofPMTPoints, normalPMT[0], normalPMT[1], normalPMT[2], constantePMT);
437 cout <<
"Calculated normal vector to PMT plane = {" << normalPMT[0] <<
", " << normalPMT[1] <<
", " << normalPMT[2]
438 <<
"} and constante d = " << constantePMT << endl
441 for (Int_t iMirr = 0; iMirr < NofMirrorPoints; iMirr++) {
444 mirrTrackID = mirrPoint->GetTrackID();
446 if (mirrTrackID <= -1) {
447 cout <<
"Mirror track ID <= 1 !!!" << endl;
448 cout <<
"----------------------------------- End of loop N°" << iMirr + 1
449 <<
" on the mirror points. -----------------------------------" << endl
455 if (motherID == -1) {
457 ptMirr[0] = mirrPoint->GetX(), ptMirr[1] = mirrPoint->GetY(), ptMirr[2] = mirrPoint->GetZ();
459 mirrNode = gGeoManager->FindNode(ptMirr[0], ptMirr[1], ptMirr[2]);
461 mirrPath = mirrNode->GetName();
462 topNodePath = gGeoManager->GetTopNode()->GetName();
463 cout <<
"Top node path: " << topNodePath <<
" and mirror path: " << mirrPath << endl;
464 mirrMatrix = mirrNode->GetMatrix();
465 cout <<
"Mirror matrix parameters: " << endl;
467 ptrShape = mirrNode->GetVolume()->GetShape();
468 cout <<
"Shape of the mirror tile:" << endl;
479 <<
"Sphere center coordinates of the rotated mirror tile = {" << ptC[0] <<
", " << ptC[1] <<
", " << ptC[2]
480 <<
"} and sphere inner radius = " << sphereRadius << endl;
482 for (Int_t iRefl = 0; iRefl < NofRefPlanePoints; iRefl++) {
484 refPlaneTrackID = refPlanePoint->GetTrackID();
486 if (mirrTrackID == refPlaneTrackID) {
488 ptR1[0] = refPlanePoint->GetX(), ptR1[1] = refPlanePoint->GetY(), ptR1[2] = refPlanePoint->GetZ();
489 cout <<
"Reflective Plane Point coordinates = {" << ptR1[0] <<
", " << ptR1[1] <<
", " << ptR1[2] <<
"}"
491 cout <<
"Mirror Point coordinates = {" << ptMirr[0] <<
", " << ptMirr[1] <<
", " << ptMirr[2] <<
"}" << endl
493 normalMirr[0] = (ptC[0] - ptMirr[0])
494 / TMath::Sqrt(TMath::Power(ptC[0] - ptMirr[0], 2) + TMath::Power(ptC[1] - ptMirr[1], 2)
495 + TMath::Power(ptC[2] - ptMirr[2], 2));
496 normalMirr[1] = (ptC[1] - ptMirr[1])
497 / TMath::Sqrt(TMath::Power(ptC[0] - ptMirr[0], 2) + TMath::Power(ptC[1] - ptMirr[1], 2)
498 + TMath::Power(ptC[2] - ptMirr[2], 2));
499 normalMirr[2] = (ptC[2] - ptMirr[2])
500 / TMath::Sqrt(TMath::Power(ptC[0] - ptMirr[0], 2) + TMath::Power(ptC[1] - ptMirr[1], 2)
501 + TMath::Power(ptC[2] - ptMirr[2], 2));
502 cout <<
"Calculated and normalized normal of mirror tile = {" << normalMirr[0] <<
", " << normalMirr[1]
503 <<
", " << normalMirr[2] <<
"}" << endl;
505 t1 = ((ptR1[0] - ptMirr[0]) * (ptC[0] - ptMirr[0]) + (ptR1[1] - ptMirr[1]) * (ptC[1] - ptMirr[1])
506 + (ptR1[2] - ptMirr[2]) * (ptC[2] - ptMirr[2]))
507 / (TMath::Power(ptC[0] - ptMirr[0], 2) + TMath::Power(ptC[1] - ptMirr[1], 2)
508 + TMath::Power(ptC[2] - ptMirr[2], 2));
509 ptR2Center[0] = 2 * (ptMirr[0] + t1 * (ptC[0] - ptMirr[0])) - ptR1[0];
510 ptR2Center[1] = 2 * (ptMirr[1] + t1 * (ptC[1] - ptMirr[1])) - ptR1[1];
511 ptR2Center[2] = 2 * (ptMirr[2] + t1 * (ptC[2] - ptMirr[2])) - ptR1[2];
512 t2 = ((ptR1[0] - ptC[0]) * (ptC[0] - ptMirr[0]) + (ptR1[1] - ptC[1]) * (ptC[1] - ptMirr[1])
513 + (ptR1[2] - ptC[2]) * (ptC[2] - ptMirr[2]))
514 / (TMath::Power(ptC[0] - ptMirr[0], 2) + TMath::Power(ptC[1] - ptMirr[1], 2)
515 + TMath::Power(ptC[2] - ptMirr[2], 2));
516 ptR2Mirr[0] = 2 * (ptC[0] + t2 * (ptC[0] - ptMirr[0])) - ptR1[0];
517 ptR2Mirr[1] = 2 * (ptC[1] + t2 * (ptC[1] - ptMirr[1])) - ptR1[1];
518 ptR2Mirr[2] = 2 * (ptC[2] + t2 * (ptC[2] - ptMirr[2])) - ptR1[2];
524 cout <<
"Coordinates of point R2 on reflective plane after "
525 "reflection on the mirror tile:"
527 cout <<
"* using mirror point M to define \U00000394: {" << ptR2Center[0] <<
", " << ptR2Center[1] <<
", "
528 << ptR2Center[2] <<
"}" << endl;
529 cout <<
"* using sphere center C to define \U00000394: {" << ptR2Mirr[0] <<
", " << ptR2Mirr[1] <<
", "
530 << ptR2Mirr[2] <<
"}" << endl
536 * ((normalPMT[0] * ptMirr[0] + normalPMT[1] * ptMirr[1] + normalPMT[2] * ptMirr[2] + constantePMT)
537 / (normalPMT[0] * (ptR2Mirr[0] - ptMirr[0]) + normalPMT[1] * (ptR2Mirr[1] - ptMirr[1])
538 + normalPMT[2] * (ptR2Mirr[2] - ptMirr[2])));
539 ptPMirr[0] = ptMirr[0] + k1 * (ptR2Mirr[0] - ptMirr[0]);
540 ptPMirr[1] = ptMirr[1] + k1 * (ptR2Mirr[1] - ptMirr[1]);
541 ptPMirr[2] = ptMirr[2] + k1 * (ptR2Mirr[2] - ptMirr[2]);
543 * ((normalPMT[0] * ptR2Mirr[0] + normalPMT[1] * ptR2Mirr[1] + normalPMT[2] * ptR2Mirr[2] + constantePMT)
544 / (normalPMT[0] * (ptR2Mirr[0] - ptMirr[0]) + normalPMT[1] * (ptR2Mirr[1] - ptMirr[1])
545 + normalPMT[2] * (ptR2Mirr[2] - ptMirr[2])));
546 ptPR2[0] = ptR2Mirr[0] + k2 * (ptR2Mirr[0] - ptMirr[0]);
547 ptPR2[1] = ptR2Mirr[1] + k2 * (ptR2Mirr[1] - ptMirr[1]);
548 ptPR2[2] = ptR2Mirr[2] + k2 * (ptR2Mirr[2] - ptMirr[2]);
549 cout <<
"Coordinates of point P on PMT plane, after reflection on "
550 "the mirror tile and extrapolation to the PMT plane:"
552 cout <<
"* using mirror point M to define \U0001D49F ': {" << ptPMirr[0] <<
", " << ptPMirr[1] <<
", "
553 << ptPMirr[2] <<
"}" << endl;
554 cout <<
"* using reflected point R2 to define \U0001D49F ': {" << ptPR2[0] <<
", " << ptPR2[1] <<
", "
555 << ptPR2[2] <<
"}" << endl;
556 checkCalc1 = ptPMirr[0] * normalPMT[0] + ptPMirr[1] * normalPMT[1] + ptPMirr[2] * normalPMT[2] + constantePMT;
557 cout <<
"Check whether extrapolated track point on PMT plane "
558 "verifies its equation (value should be 0.):"
560 cout <<
"* using mirror point M, checkCalc = " << checkCalc1 << endl;
561 checkCalc2 = ptPR2[0] * normalPMT[0] + ptPR2[1] * normalPMT[1] + ptPR2[2] * normalPMT[2] + constantePMT;
562 cout <<
"* using reflected point R2, checkCalc = " << checkCalc2 << endl;
564 TVector3 pmtVector(ptPMirr[0], ptPMirr[1], ptPMirr[2]);
565 TVector3 pmtVectorNew;
567 cout <<
"New coordinates of point P on PMT plane, after PMT plane "
569 << pmtVectorNew.X() <<
", " << pmtVectorNew.Y() <<
", " << pmtVectorNew.Z() <<
"}" << endl
571 ptPMirr[0] = pmtVectorNew.X(), ptPMirr[1] = pmtVectorNew.Y(), ptPMirr[2] = pmtVectorNew.Z();
600 for (Int_t iGlobalTrack = 0; iGlobalTrack < NofGTracks; iGlobalTrack++) {
603 if (NULL == gTrack)
continue;
613 Int_t ringTrackID = ring->GetTrackID();
615 Int_t ringMotherID = track2->GetMotherId();
625 -1 * ((normalPMT[0] * ringCenter[0] + normalPMT[1] * ringCenter[1] + constantePMT) / normalPMT[2]);
626 cout <<
"Ring center coordinates = {" << ringCenter[0] <<
", " << ringCenter[1] <<
", " << ringCenter[2] <<
"}"
628 cout <<
"Difference in X = " << TMath::Abs(ringCenter[0] - ptPMirr[0]) <<
"\t"
629 <<
"Difference in Y = " << TMath::Abs(ringCenter[1] - ptPMirr[1]) <<
"\t"
630 <<
"Difference in Z = " << TMath::Abs(ringCenter[2] - ptPMirr[2]) << endl;
631 fHM->
H1(
"fhDifferenceX")->Fill(TMath::Abs(ringCenter[0] - ptPMirr[0]));
632 fHM->
H1(
"fhDifferenceY")->Fill(TMath::Abs(ringCenter[1] - ptPMirr[1]));
633 distToExtrapTrackHit =
634 TMath::Sqrt(TMath::Power(ringCenter[0] - ptPMirr[0], 2) + TMath::Power(ringCenter[1] - ptPMirr[1], 2)
635 + TMath::Power(ringCenter[2] - ptPMirr[2], 2));
636 distToExtrapTrackHitInPlane =
637 TMath::Sqrt(TMath::Power(ringCenter[0] - ptPMirr[0], 2) + TMath::Power(ringCenter[1] - ptPMirr[1], 2));
638 fHM->
H1(
"fhDistanceCenterToExtrapolatedTrack")->Fill(distToExtrapTrackHit);
639 fHM->
H1(
"fhDistanceCenterToExtrapolatedTrackInPlane")->Fill(distToExtrapTrackHitInPlane);
640 cout <<
"Distance between fitted ring center and extrapolated track hit = " << distToExtrapTrackHit << endl;
641 cout <<
"Distance between fitted ring center and extrapolated track "
643 << distToExtrapTrackHitInPlane << endl
648 cout <<
"End of loop on global tracks;" << endl;
651 cout <<
"Not a mother particle ..." << endl;
653 cout <<
"----------------------------------- "
654 <<
"End of loop N°" << iMirr + 1 <<
" on the mirror points."
655 <<
" -----------------------------------" << endl
662 cout <<
"//------------------------------ CbmRichPMTMapping: Projection "
663 "Producer ------------------------------//"
668 Int_t NofRingsInEvent =
fRichRings->GetEntriesFast();
671 Int_t NofPMTPoints =
fRichPoints->GetEntriesFast();
674 Double_t sphereX = 0., sphereY = 0., sphereZ = 0., sphereR = 0., normalX = 0., normalY = 0., normalZ = 0.,
676 Double_t CenterX = 0., CenterY = 0., CenterZ = 0., distToExtrapTrackHit = 0.;
677 Double_t a1 = 0., a2 = 0., a3 = 0., a4 = 0., a5 = 0., t1 = 0., t2 = 0.;
679 Double_t refPointCoo[] = {0., 0., 0.}, refPointMom[] = {0., 0., 0.};
680 Double_t reflectedPtCooNormMirr[] = {0., 0., 0.}, reflectedPtCooNormSphere[] = {0., 0., 0.};
681 Double_t reflectedPtCooVectMirr[] = {0., 0., 0.}, reflectedPtCooVectSphere[] = {0., 0., 0.};
682 Double_t reflectedPtCooVectSphereUnity[] = {0., 0., 0.}, vectMSUnity[] = {0., 0., 0.};
683 Double_t mirrPt[] = {0., 0., 0.}, mirrMom[] = {0., 0., 0.}, pmtPt[] = {0., 0., 0.};
684 Double_t computedNormal[] = {0., 0., 0.}, computedNormal2[] = {0., 0., 0.};
685 Double_t extrapolatedTrackCoo[] = {0., 0., 0.}, extrapolatedTrackCooComputedNormal[] = {0., 0., 0.};
686 Double_t checkCalc = 0.;
688 Int_t mirrTrackID = -1, pmtTrackID = -1, refPlaneTrackID = -1, motherID = -100, pmtMotherID = -100;
689 const Char_t *mirrPath, *topNodePath;
692 TGeoMatrix *mirrMatrix, *pmtMatrix, *richMatrix;
705 GetPmtNormal(NofPMTPoints, normalX, normalY, normalZ, normalCste);
706 cout <<
"Calculated normal vector to PMT plane = {" << normalX <<
", " << normalY <<
", " << normalZ
707 <<
"} and constante d = " << normalCste << endl
710 for (Int_t iMirr = 0; iMirr < NofMirrorPoints; iMirr++) {
713 mirrTrackID = mirrPoint->GetTrackID();
715 if (mirrTrackID <= -1) {
716 cout <<
"Mirror track ID <= 1 !!!" << endl;
717 cout <<
"----------------------------------- End of loop N°" << iMirr + 1
718 <<
" on the mirror points. -----------------------------------" << endl
724 if (motherID == -1) {
726 mirrPt[0] = mirrPoint->GetX(), mirrPt[1] = mirrPoint->GetY(), mirrPt[2] = mirrPoint->GetZ();
727 mirrMom[0] = mirrPoint->GetPx(), mirrMom[1] = mirrPoint->GetPy(), mirrMom[2] = mirrPoint->GetPz();
729 mirrNode = gGeoManager->FindNode(mirrPt[0], mirrPt[1], mirrPt[2]);
731 mirrPath = mirrNode->GetName();
732 topNodePath = gGeoManager->GetTopNode()->GetName();
733 cout <<
"Mirror path: " << mirrPath <<
" and top node path: " << topNodePath << endl;
734 mirrMatrix = mirrNode->GetMatrix();
735 cout <<
"Mirror matrix parameters: " << endl;
737 ptrShape = mirrNode->GetVolume()->GetShape();
746 Double_t sphere2X = 0., sphere2Y = 0., sphere2Z = 0., sphere2R = 0.;
749 <<
"Old sphere coordinates = {" << sphere2X <<
", " << sphere2Y <<
", " << sphere2Z
750 <<
"} and sphere inner radius = " << sphere2R << endl;
752 cout <<
"New sphere coordinates = {" << sphereX <<
", " << sphereY <<
", " << sphereZ
753 <<
"} and sphere inner radius = " << sphereR << endl;
755 for (Int_t iRefl = 0; iRefl < NofRefPlanePoints; iRefl++) {
757 refPlaneTrackID = refPlanePoint->GetTrackID();
759 if (mirrTrackID == refPlaneTrackID) {
761 refPointCoo[0] = refPlanePoint->GetX(), refPointCoo[1] = refPlanePoint->GetY(),
762 refPointCoo[2] = refPlanePoint->GetZ();
763 refPointMom[0] = refPlanePoint->GetPx(), refPointMom[1] = refPlanePoint->GetPy(),
764 refPointMom[2] = refPlanePoint->GetPz();
765 cout <<
"Reflective Plane Point coordinates = {" << refPointCoo[0] <<
", " << refPointCoo[1] <<
", "
766 << refPointCoo[2] <<
"} and momentum = {" << refPointMom[0] <<
", " << refPointMom[1] <<
", "
767 << refPointMom[2] <<
"}" << endl;
768 cout <<
"Mirror Point coordinates = {" << mirrPt[0] <<
", " << mirrPt[1] <<
", " << mirrPt[2]
769 <<
"} and momentum = {" << mirrMom[0] <<
", " << mirrMom[1] <<
", " << mirrMom[2] <<
"}" << endl
771 ptrShape->ComputeNormal(refPointCoo, refPointMom, computedNormal);
772 cout <<
"Computed normal to mirror tile coordinates = {" << computedNormal[0] <<
", " << computedNormal[1]
773 <<
", " << computedNormal[2] <<
"}" << endl;
776 vectMSUnity[0] = (sphereX - mirrPt[0])
777 / TMath::Sqrt(TMath::Power(sphereX - mirrPt[0], 2) + TMath::Power(sphereY - mirrPt[1], 2)
778 + TMath::Power(sphereZ - mirrPt[2], 2));
779 vectMSUnity[1] = (sphereY - mirrPt[1])
780 / TMath::Sqrt(TMath::Power(sphereX - mirrPt[0], 2) + TMath::Power(sphereY - mirrPt[1], 2)
781 + TMath::Power(sphereZ - mirrPt[2], 2));
782 vectMSUnity[2] = (sphereZ - mirrPt[2])
783 / TMath::Sqrt(TMath::Power(sphereX - mirrPt[0], 2) + TMath::Power(sphereY - mirrPt[1], 2)
784 + TMath::Power(sphereZ - mirrPt[2], 2));
785 cout <<
"Calculated unity Mirror-Sphere vector = {" << vectMSUnity[0] <<
", " << vectMSUnity[1] <<
", "
786 << vectMSUnity[2] <<
"}" << endl;
788 a1 = (computedNormal[0] * (refPointCoo[0] - mirrPt[0]) + computedNormal[1] * (refPointCoo[1] - mirrPt[1])
789 + computedNormal[2] * (refPointCoo[2] - mirrPt[2]))
790 / (TMath::Power(computedNormal[0], 2) + TMath::Power(computedNormal[1], 2)
791 + TMath::Power(computedNormal[2], 2));
792 reflectedPtCooNormMirr[0] = 2 * (mirrPt[0] + a1 * computedNormal[0]) - refPointCoo[0];
793 reflectedPtCooNormMirr[1] = 2 * (mirrPt[1] + a1 * computedNormal[1]) - refPointCoo[1];
794 reflectedPtCooNormMirr[2] = 2 * (mirrPt[2] + a1 * computedNormal[2]) - refPointCoo[2];
803 a4 = ((refPointCoo[0] - sphereX) * (sphereX - mirrPt[0]) + (refPointCoo[1] - sphereY) * (sphereY - mirrPt[1])
804 + (refPointCoo[2] - sphereZ) * (sphereZ - mirrPt[2]))
805 / (TMath::Power(sphereX - mirrPt[0], 2) + TMath::Power(sphereY - mirrPt[1], 2)
806 + TMath::Power(sphereZ - mirrPt[2], 2));
807 reflectedPtCooVectSphere[0] = 2 * (sphereX + a4 * (sphereX - mirrPt[0])) - refPointCoo[0];
808 reflectedPtCooVectSphere[1] = 2 * (sphereY + a4 * (sphereY - mirrPt[1])) - refPointCoo[1];
809 reflectedPtCooVectSphere[2] = 2 * (sphereZ + a4 * (sphereZ - mirrPt[2])) - refPointCoo[2];
816 cout <<
"Ref Pt Coo using computed normal & mirror pt = {" << reflectedPtCooNormMirr[0] <<
", "
817 << reflectedPtCooNormMirr[1] <<
", " << reflectedPtCooNormMirr[2] <<
"}" << endl;
820 cout <<
"Ref Pt Coo using MS vector & sphere pt = {" << reflectedPtCooVectSphere[0] <<
", "
821 << reflectedPtCooVectSphere[1] <<
", " << reflectedPtCooVectSphere[2] <<
"}" << endl
827 * ((normalX * reflectedPtCooVectSphere[0] + normalY * reflectedPtCooVectSphere[1]
828 + normalZ * reflectedPtCooVectSphere[2] + normalCste)
829 / (normalX * (reflectedPtCooVectSphere[0] - mirrPt[0])
830 + normalY * (reflectedPtCooVectSphere[1] - mirrPt[1])
831 + normalZ * (reflectedPtCooVectSphere[2] - mirrPt[2])));
832 extrapolatedTrackCoo[0] = reflectedPtCooVectSphere[0] + t1 * (reflectedPtCooVectSphere[0] - mirrPt[0]);
833 extrapolatedTrackCoo[1] = reflectedPtCooVectSphere[1] + t1 * (reflectedPtCooVectSphere[1] - mirrPt[1]);
834 extrapolatedTrackCoo[2] = reflectedPtCooVectSphere[2] + t1 * (reflectedPtCooVectSphere[2] - mirrPt[2]);
835 cout <<
"Extrapolated track point on PMT plane using MS vector = {" << extrapolatedTrackCoo[0] <<
", "
836 << extrapolatedTrackCoo[1] <<
", " << extrapolatedTrackCoo[2] <<
"}" << endl;
837 checkCalc = extrapolatedTrackCoo[0] * normalX + extrapolatedTrackCoo[1] * normalY
838 + extrapolatedTrackCoo[2] * normalZ + normalCste;
839 cout <<
"Check whether extrapolated track point on PMT plane "
840 "verifies its equation (extrapolation with MS vector method):"
842 cout <<
"Check calculation = " << checkCalc << endl;
846 * ((normalX * reflectedPtCooNormMirr[0] + normalY * reflectedPtCooNormMirr[1]
847 + normalZ * reflectedPtCooNormMirr[2] + normalCste)
848 / (normalX * (reflectedPtCooNormMirr[0] - mirrPt[0]) + normalY * (reflectedPtCooNormMirr[1] - mirrPt[1])
849 + normalZ * (reflectedPtCooNormMirr[2] - mirrPt[2])));
850 extrapolatedTrackCooComputedNormal[0] =
851 reflectedPtCooNormMirr[0] + t1 * (reflectedPtCooNormMirr[0] - mirrPt[0]);
852 extrapolatedTrackCooComputedNormal[1] =
853 reflectedPtCooNormMirr[1] + t1 * (reflectedPtCooNormMirr[1] - mirrPt[1]);
854 extrapolatedTrackCooComputedNormal[2] =
855 reflectedPtCooNormMirr[2] + t1 * (reflectedPtCooNormMirr[2] - mirrPt[2]);
856 cout <<
"Extrapolated track point on PMT plane using computed normal = {"
857 << extrapolatedTrackCooComputedNormal[0] <<
", " << extrapolatedTrackCooComputedNormal[1] <<
", "
858 << extrapolatedTrackCooComputedNormal[2] <<
"}" << endl;
859 checkCalc = extrapolatedTrackCooComputedNormal[0] * normalX + extrapolatedTrackCooComputedNormal[1] * normalY
860 + extrapolatedTrackCooComputedNormal[2] * normalZ + normalCste;
861 cout <<
"Check whether extrapolated track point on PMT plane verifies "
862 "its equation (extrapolation with computed normal method):"
864 cout <<
"Check calculation = " << checkCalc << endl << endl;
882 for (Int_t iGlobalTrack = 0; iGlobalTrack < NofGTracks; iGlobalTrack++) {
885 if (NULL == gTrack)
continue;
895 Int_t ringTrackID = ring->GetTrackID();
897 Int_t ringMotherID = track2->GetMotherId();
906 CenterZ = -1 * ((normalX * CenterX + normalY * CenterY + normalCste) / normalZ);
907 cout <<
"Ring center coordinates = {" << CenterX <<
", " << CenterY <<
", " << CenterZ <<
"}" << endl;
908 cout <<
"Difference in X = " << TMath::Abs(CenterX - extrapolatedTrackCoo[0]) << endl;
909 cout <<
"Difference in Y = " << TMath::Abs(CenterY - extrapolatedTrackCoo[1]) << endl;
910 cout <<
"Difference in Z = " << TMath::Abs(CenterZ - extrapolatedTrackCoo[2]) << endl;
911 fHM->
H1(
"fhDifferenceX")->Fill(TMath::Abs(CenterX - extrapolatedTrackCoo[0]));
912 fHM->
H1(
"fhDifferenceY")->Fill(TMath::Abs(CenterY - extrapolatedTrackCoo[1]));
913 distToExtrapTrackHit = TMath::Sqrt(TMath::Power(CenterX - extrapolatedTrackCoo[0], 2)
914 + TMath::Power(CenterY - extrapolatedTrackCoo[1], 2)
915 + TMath::Power(CenterZ - extrapolatedTrackCoo[2], 2));
916 fHM->
H1(
"fhDistanceCenterToExtrapolatedTrack")->Fill(distToExtrapTrackHit);
917 fHM->
H1(
"fhDistanceCenterToExtrapolatedTrackInPlane")
918 ->Fill(TMath::Sqrt(TMath::Power(CenterX - extrapolatedTrackCoo[0], 2)
919 + TMath::Power(CenterY - extrapolatedTrackCoo[1], 2)));
920 cout <<
"Distance between fitted ring center and extrapolated track hit = " << distToExtrapTrackHit << endl
925 cout <<
"End of loop on global tracks;" << endl;
928 cout <<
"Not a mother particle ..." << endl;
930 cout <<
"----------------------------------- "
931 <<
"End of loop N°" << iMirr + 1 <<
" on the mirror points."
932 <<
" -----------------------------------" << endl
938 Double_t& normalCste)
942 Int_t pmtTrackID, pmtMotherID;
943 Double_t buffNormX = 0., buffNormY = 0., buffNormZ = 0., k = 0., scalarProd = 0.;
944 Double_t pmtPt[] = {0., 0., 0.};
945 Double_t a[] = {0., 0., 0.}, b[] = {0., 0., 0.}, c[] = {0., 0., 0.};
953 for (Int_t iPmt = 0; iPmt < NofPMTPoints; iPmt++) {
955 pmtTrackID = pmtPoint->GetTrackID();
958 a[0] = pmtPoint->GetX(), a[1] = pmtPoint->GetY(), a[2] = pmtPoint->GetZ();
962 for (Int_t iPmt = 0; iPmt < NofPMTPoints; iPmt++) {
964 pmtTrackID = pmtPoint->GetTrackID();
968 if (TMath::Sqrt(TMath::Power(a[0] - pmtPoint->GetX(), 2) + TMath::Power(a[1] - pmtPoint->GetY(), 2)
969 + TMath::Power(a[2] - pmtPoint->GetZ(), 2))
971 b[0] = pmtPoint->GetX(), b[1] = pmtPoint->GetY(), b[2] = pmtPoint->GetZ();
976 for (Int_t iPmt = 0; iPmt < NofPMTPoints; iPmt++) {
978 pmtTrackID = pmtPoint->GetTrackID();
982 if (TMath::Sqrt(TMath::Power(a[0] - pmtPoint->GetX(), 2) + TMath::Power(a[1] - pmtPoint->GetY(), 2)
983 + TMath::Power(a[2] - pmtPoint->GetZ(), 2))
985 && TMath::Sqrt(TMath::Power(b[0] - pmtPoint->GetX(), 2) + TMath::Power(b[1] - pmtPoint->GetY(), 2)
986 + TMath::Power(b[2] - pmtPoint->GetZ(), 2))
988 c[0] = pmtPoint->GetX(), c[1] = pmtPoint->GetY(), c[2] = pmtPoint->GetZ();
994 k = (b[0] - a[0]) / (c[0] - a[0]);
995 if ((b[1] - a[1]) - (k * (c[1] - a[1])) == 0 || (b[2] - a[2]) - (k * (c[2] - a[2])) == 0) {
996 cout <<
"Error in normal calculation, vect_AB and vect_AC are collinear." << endl;
999 buffNormX = (b[1] - a[1]) * (c[2] - a[2]) - (b[2] - a[2]) * (c[1] - a[1]);
1000 buffNormY = (b[2] - a[2]) * (c[0] - a[0]) - (b[0] - a[0]) * (c[2] - a[2]);
1001 buffNormZ = (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
1003 buffNormX / TMath::Sqrt(TMath::Power(buffNormX, 2) + TMath::Power(buffNormY, 2) + TMath::Power(buffNormZ, 2));
1005 buffNormY / TMath::Sqrt(TMath::Power(buffNormX, 2) + TMath::Power(buffNormY, 2) + TMath::Power(buffNormZ, 2));
1007 buffNormZ / TMath::Sqrt(TMath::Power(buffNormX, 2) + TMath::Power(buffNormY, 2) + TMath::Power(buffNormZ, 2));
1012 normalX * (pmtPoint1->GetX() - a[0]) + normalY * (pmtPoint1->GetY() - a[1]) + normalZ * (pmtPoint1->GetZ() - a[2]);
1015 normalCste = -1 * (normalX * pmtPoint1->GetX() + normalY * pmtPoint1->GetY() + normalZ * pmtPoint1->GetZ());
1018 normalX * (pmtPoint2->GetX() - a[0]) + normalY * (pmtPoint2->GetY() - a[1]) + normalZ * (pmtPoint2->GetZ() - a[2]);
1022 normalX * (pmtPoint3->GetX() - a[0]) + normalY * (pmtPoint3->GetY() - a[1]) + normalZ * (pmtPoint3->GetZ() - a[2]);
1027 Double_t& sphereZ, Double_t& sphereR)
1031 const Char_t* mirrorHalf;
1033 mirrorHalf =
"RICH_mirror_half_total_208";
1036 mirrorHalf =
"RICH_mirror_half_total_207";
1040 TObjArray* nodesTop = gGeoManager->GetTopNode()->GetNodes();
1041 for (Int_t i1 = 0; i1 < nodesTop->GetEntriesFast(); i1++) {
1042 TGeoNode* richNode = (TGeoNode*) nodesTop->At(i1);
1043 if (TString(richNode->GetName()).Contains(
"rich")) {
1044 const Double_t* trRich = richNode->GetMatrix()->GetTranslation();
1045 TObjArray* nodes2 = richNode->GetNodes();
1046 for (Int_t i2 = 0; i2 < nodes2->GetEntriesFast(); i2++) {
1047 TGeoNode* gasNode = (TGeoNode*) nodes2->At(i2);
1048 if (TString(gasNode->GetName()).Contains(
"RICH_gas")) {
1049 const Double_t* trGas = gasNode->GetMatrix()->GetTranslation();
1050 TObjArray* nodes3 = gasNode->GetNodes();
1051 for (Int_t i3 = 0; i3 < nodes3->GetEntriesFast(); i3++) {
1052 TGeoNode* mirrorHalfNode = (TGeoNode*) nodes3->At(i3);
1053 if (TString(mirrorHalfNode->GetName()).Contains(mirrorHalf)) {
1054 const Double_t* rotMirror = mirrorHalfNode->GetMatrix()->GetRotationMatrix();
1057 const Double_t* trHalfMirror = mirrorHalfNode->GetMatrix()->GetTranslation();
1058 const TGeoBBox* mirrorShape = (
const TGeoBBox*) (mirrorHalfNode->GetVolume()->GetShape());
1059 TObjArray* nodes4 = mirrorHalfNode->GetNodes();
1060 for (Int_t i4 = 0; i4 < nodes4->GetEntriesFast(); i4++) {
1061 TGeoNode* suppBeltStripNode = (TGeoNode*) nodes4->At(i4);
1062 if (TString(suppBeltStripNode->GetName()).Contains(
"RICH_mirror_and_support_belt_strip")) {
1063 const Double_t* trSuppBeltStrip = suppBeltStripNode->GetMatrix()->GetTranslation();
1064 TObjArray* nodes5 = suppBeltStripNode->GetNodes();
1065 for (Int_t i5 = 0; i5 < nodes5->GetEntriesFast(); i5++) {
1066 TGeoNode* mirrorTileNode = (TGeoNode*) nodes5->At(i5);
1068 if (TString(mirrorTileNode->GetName()).Contains(mirrID)) {
1070 const Double_t* trMirrorTile = mirrorTileNode->GetMatrix()->GetTranslation();
1071 sphereX = trRich[0] + trGas[0] + trHalfMirror[0] + trSuppBeltStrip[0] + trMirrorTile[0];
1072 sphereY = trRich[1] + trGas[1] + trHalfMirror[1] + trSuppBeltStrip[1] + trMirrorTile[1];
1073 sphereZ = trRich[2] + trGas[2] + trHalfMirror[2] + trSuppBeltStrip[2]
1081 TGeoShape* ptrShape = mirrorTileNode->GetVolume()->GetShape();
1082 TGeoSphere* ptrSphere =
static_cast<TGeoSphere*
>(ptrShape);
1083 sphereR = ptrSphere->GetRmin();
1097 Double_t& sphereZ, Double_t& sphereR)
1101 const Char_t* mirrorHalf;
1103 mirrorHalf =
"RICH_mirror_half_total_208";
1106 mirrorHalf =
"RICH_mirror_half_total_207";
1110 TObjArray* nodesTop = gGeoManager->GetTopNode()->GetNodes();
1111 for (Int_t i1 = 0; i1 < nodesTop->GetEntriesFast(); i1++) {
1112 TGeoNode* richNode = (TGeoNode*) nodesTop->At(i1);
1113 if (TString(richNode->GetName()).Contains(
"rich")) {
1114 TGeoMatrix* matRich = richNode->GetMatrix();
1117 const Double_t* trRich = richNode->GetMatrix()->GetTranslation();
1118 TObjArray* nodes2 = richNode->GetNodes();
1119 for (Int_t i2 = 0; i2 < nodes2->GetEntriesFast(); i2++) {
1120 TGeoNode* gasNode = (TGeoNode*) nodes2->At(i2);
1121 if (TString(gasNode->GetName()).Contains(
"RICH_gas")) {
1122 TGeoMatrix* matRichGas = gasNode->GetMatrix();
1125 const Double_t* trGas = gasNode->GetMatrix()->GetTranslation();
1126 TObjArray* nodes3 = gasNode->GetNodes();
1127 for (Int_t i3 = 0; i3 < nodes3->GetEntriesFast(); i3++) {
1128 TGeoNode* mirrorHalfNode = (TGeoNode*) nodes3->At(i3);
1129 if (TString(mirrorHalfNode->GetName()).Contains(mirrorHalf)) {
1130 TGeoMatrix* matMirrorHalf = mirrorHalfNode->GetMatrix();
1133 const Double_t* rotMirrorHalf = mirrorHalfNode->GetMatrix()->GetRotationMatrix();
1136 const Double_t* trHalfMirror = mirrorHalfNode->GetMatrix()->GetTranslation();
1137 const TGeoBBox* mirrorShape = (
const TGeoBBox*) (mirrorHalfNode->GetVolume()->GetShape());
1138 TObjArray* nodes4 = mirrorHalfNode->GetNodes();
1139 for (Int_t i4 = 0; i4 < nodes4->GetEntriesFast(); i4++) {
1140 TGeoNode* suppBeltStripNode = (TGeoNode*) nodes4->At(i4);
1141 if (TString(suppBeltStripNode->GetName()).Contains(
"RICH_mirror_and_support_belt_strip")) {
1142 TGeoMatrix* matSuppBeltStrip = suppBeltStripNode->GetMatrix();
1145 const Double_t* trSuppBeltStrip = suppBeltStripNode->GetMatrix()->GetTranslation();
1146 TObjArray* nodes5 = suppBeltStripNode->GetNodes();
1147 for (Int_t i5 = 0; i5 < nodes5->GetEntriesFast(); i5++) {
1148 TGeoNode* mirrorTileNode = (TGeoNode*) nodes5->At(i5);
1150 if (TString(mirrorTileNode->GetName()).Contains(mirrID)) {
1155 const Double_t* trMirrorTile = mirrorTileNode->GetMatrix()->GetTranslation();
1156 const Double_t* rotMirrorTile = mirrorTileNode->GetMatrix()->GetRotationMatrix();
1157 sphereX = trRich[0] + trGas[0] + trHalfMirror[0] + trSuppBeltStrip[0] + trMirrorTile[1];
1158 sphereY = trRich[1] + trGas[1] + trHalfMirror[1] + trSuppBeltStrip[1] + trMirrorTile[2];
1159 sphereZ = trRich[2] + trGas[2] + trHalfMirror[2] + trSuppBeltStrip[2]
1161 TGeoShape* ptrShape = mirrorTileNode->GetVolume()->GetShape();
1162 TGeoSphere* ptrSphere =
static_cast<TGeoSphere*
>(ptrShape);
1163 sphereR = ptrSphere->GetRmin();