2 #include "FairLogger.h"
3 #include "FairRootManager.h"
14 #include "TClonesArray.h"
24 #include "TGeoManager.h"
25 #include "TGeoNavigator.h"
37 : FairTask(
"CbmRichMirrorSortingAlignment")
47 , fRefPlanePoints(NULL)
49 , fRichProjections(NULL)
51 , fRichRingMatches(NULL)
52 , fStsTrackMatches(NULL)
59 FairRootManager* manager = FairRootManager::Instance();
61 fGlobalTracks = (TClonesArray*) manager->GetObject(
"GlobalTrack");
63 Fatal(
"CbmRichMirrorSortingAlignment::Init",
"No GlobalTrack array!");
66 fRichRings = (TClonesArray*) manager->GetObject(
"RichRing");
68 Fatal(
"CbmRichMirrorSortingAlignment::Init",
"No RichRing array !");
71 fMCTracks = (TClonesArray*) manager->GetObject(
"MCTrack");
73 Fatal(
"CbmRichMirrorSortingAlignment::Init",
"No MCTracks array !");
76 fMirrorPoints = (TClonesArray*) manager->GetObject(
"RichMirrorPoint");
78 Fatal(
"CbmRichMirrorSortingAlignment::Init",
"No RichMirrorPoints array !");
83 Fatal(
"CbmRichMirrorSortingAlignment::Init",
84 "No RichRefPlanePoint array !");
87 fPmtPoints = (TClonesArray*) manager->GetObject(
"RichPoint");
89 Fatal(
"CbmRichMirrorSortingAlignment::Init",
"No RichPoint array !");
94 Fatal(
"CbmRichMirrorSortingAlignment::Init",
"No RichProjection array !");
97 fTrackParams = (TClonesArray*) manager->GetObject(
"RichTrackParamZ");
99 Fatal(
"CbmRichMirrorSortingAlignment::Init",
"No RichTrackParamZ array!");
104 Fatal(
"CbmRichMirrorSortingAlignment::Init",
"No RichRingMatch array!");
109 Fatal(
"CbmRichMirrorSortingAlignment::Init",
"No StsTrackMatch array!");
121 cout <<
"CbmRichMirrorSortingAlignment: Event #" <<
fEventNb << endl;
122 TVector3 momentum, outPos;
123 Double_t constantePMT = 0., trackX = 0., trackY = 0.;
124 vector<Double_t> vect(2, 0), ptM(3, 0), ptC(3, 0), ptCIdeal(3, 0), ptR1(3, 0),
125 ptR2Center(3, 0), ptR2Mirr(3, 0), ptPR2(3, 0), ptPMirr(3, 0),
128 ptC.at(0) = 0., ptC.at(1) = 132.594000, ptC.at(2) = 54.267226;
129 TVector3 mirrorPoint, dirCos,
pos;
130 Double_t nx = 0., ny = 0., nz = 0.;
135 cout <<
"Nb of rings in evt = " <<
fRichRings->GetEntries() << endl << endl;
139 for (Int_t iGlobalTrack = 0; iGlobalTrack <
fGlobalTracks->GetEntriesFast();
151 cout <<
"Error richInd < 0" << endl;
156 cout <<
"Error ring == NULL!" << endl;
165 if (NULL == cbmRichTrackMatch) {
continue; }
166 cout <<
"Nof true hits = " << cbmRichTrackMatch->
GetNofTrueHits() << endl;
172 if (mcRichTrackId < 0)
continue;
174 if (mcStsTrackId != mcRichTrackId) {
175 cout <<
"Error StsTrackIndex and TrackIndex from Ring do not match!"
180 if (!mcTrack)
continue;
188 cout <<
"ring Center Coo: " << ringL.
GetCenterX() <<
", "
195 FairTrackParam* point = (FairTrackParam*)
fTrackParams->At(stsInd);
197 cout <<
"CbmRichMirrorSortingAlignment::Exec : pr = NULL." << endl;
200 trackX = pr->GetX(), trackY = pr->GetY();
201 cout <<
"Track: " << trackX <<
", " << trackY << endl;
207 Int_t pdg = TMath::Abs(mcTrack->
GetPdgCode());
208 if (trackMotherId == -1) {
211 for (Int_t iMirrPt = 0; iMirrPt <
fMirrorPoints->GetEntries();
214 if (mirrPoint == 0) {
continue; }
216 if (mirrPoint->GetTrackID() == mcRichTrackId) {
break; }
218 ptM.at(0) = mirrPoint->GetX(), ptM.at(1) = mirrPoint->GetY(),
219 ptM.at(2) = mirrPoint->GetZ();
220 cout <<
"mirrPoint: {" << mirrPoint->GetX() <<
", "
221 << mirrPoint->GetY() <<
", " << mirrPoint->GetZ() <<
"}" << endl;
223 mirrNode = gGeoManager->FindNode(ptM.at(0), ptM.at(1), ptM.at(2));
224 cout <<
"Mirror node name: " << mirrNode->GetName()
225 <<
" and full path " << gGeoManager->GetPath() << endl;
226 string str1 = gGeoManager->GetPath(), str2 =
"mirror_tile_",
228 cout <<
"str1 before CbmRichNavigationUtil::FindIntersection: "
232 point, crossP,
"mirror_tile_");
233 cout <<
"str1 after CbmRichNavigationUtil::FindIntersection: " << str1
236 std::size_t found = str1.find(str2);
237 if (found != std::string::npos) {
239 Int_t end = str2.length() + 3;
240 str3 = str1.substr(found, end);
242 cout <<
"Mirror ID: " << str3 << endl;
246 TGeoNavigator* navi = gGeoManager->GetCurrentNavigator();
248 ptCIdeal.at(0) = navi->GetCurrentMatrix()->GetTranslation()[0];
249 ptCIdeal.at(1) = navi->GetCurrentMatrix()->GetTranslation()[1];
250 ptCIdeal.at(2) = navi->GetCurrentMatrix()->GetTranslation()[2];
251 cout <<
"Sphere center coordinates of the aligned mirror tile, "
253 << ptCIdeal.at(0) <<
", " << ptCIdeal.at(1) <<
", "
254 << ptCIdeal.at(2) <<
"}" << endl;
259 if (refPlanePoint->GetTrackID() == mcRichTrackId) {
break; }
261 ptR1.at(0) = refPlanePoint->GetX(),
262 ptR1.at(1) = refPlanePoint->GetY(),
263 ptR1.at(2) = refPlanePoint->GetZ();
264 cout <<
"Refl plane point coo = {" << ptR1[0] <<
", " << ptR1[1]
265 <<
", " << ptR1[2] <<
"}" << endl;
267 ptR2Center, ptR2Mirr, ptM, ptC, ptR1, navi,
"Uncorrected");
268 ComputeP(ptPMirr, ptPR2, normalPMT, ptM, ptR2Mirr, constantePMT);
269 TVector3 inPos(ptPMirr.at(0), ptPMirr.at(1), ptPMirr.at(2));
270 cout <<
"inPos vector: " << inPos.x() <<
", " << inPos.y() <<
", "
271 << inPos.z() << endl;
273 cout <<
"New PMT points coordinates = {" << outPos.x() <<
", "
274 << outPos.y() <<
", " << outPos.z() <<
"}" << endl;
278 cout <<
"No mirror points registered." << endl;
281 cout <<
"Not a mother particle." << endl;
285 cout <<
"Key str: " << mirrorObject->
getMirrorId() << endl
293 cout <<
"CbmRichMirrorSortingAlignment::Exec No rings in event were found."
299 vector<Double_t>& normalPMT,
300 Double_t& normalCste) {
303 Int_t pmtTrackID, pmtMotherID;
304 Double_t buffNormX = 0., buffNormY = 0., buffNormZ = 0., k = 0.,
306 Double_t pmtPt[] = {0., 0., 0.};
307 Double_t a[] = {0., 0., 0.}, b[] = {0., 0., 0.}, c[] = {0., 0., 0.};
315 for (Int_t iPmt = 0; iPmt < NofPMTPoints; iPmt++) {
317 pmtTrackID = pmtPoint->GetTrackID();
320 a[0] = pmtPoint->GetX(), a[1] = pmtPoint->GetY(), a[2] = pmtPoint->GetZ();
324 for (Int_t iPmt = 0; iPmt < NofPMTPoints; iPmt++) {
326 pmtTrackID = pmtPoint->GetTrackID();
330 if (TMath::Sqrt(TMath::Power(a[0] - pmtPoint->GetX(), 2)
331 + TMath::Power(a[1] - pmtPoint->GetY(), 2)
332 + TMath::Power(a[2] - pmtPoint->GetZ(), 2))
334 b[0] = pmtPoint->GetX(), b[1] = pmtPoint->GetY(), b[2] = pmtPoint->GetZ();
339 for (Int_t iPmt = 0; iPmt < NofPMTPoints; iPmt++) {
341 pmtTrackID = pmtPoint->GetTrackID();
345 if (TMath::Sqrt(TMath::Power(a[0] - pmtPoint->GetX(), 2)
346 + TMath::Power(a[1] - pmtPoint->GetY(), 2)
347 + TMath::Power(a[2] - pmtPoint->GetZ(), 2))
349 && TMath::Sqrt(TMath::Power(b[0] - pmtPoint->GetX(), 2)
350 + TMath::Power(b[1] - pmtPoint->GetY(), 2)
351 + TMath::Power(b[2] - pmtPoint->GetZ(), 2))
353 c[0] = pmtPoint->GetX(), c[1] = pmtPoint->GetY(), c[2] = pmtPoint->GetZ();
359 k = (b[0] - a[0]) / (c[0] - a[0]);
360 if ((b[1] - a[1]) - (k * (c[1] - a[1])) == 0
361 || (b[2] - a[2]) - (k * (c[2] - a[2])) == 0) {
362 cout <<
"Error in normal calculation, vect_AB and vect_AC are collinear."
365 buffNormX = (b[1] - a[1]) * (c[2] - a[2]) - (b[2] - a[2]) * (c[1] - a[1]);
366 buffNormY = (b[2] - a[2]) * (c[0] - a[0]) - (b[0] - a[0]) * (c[2] - a[2]);
367 buffNormZ = (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
370 / TMath::Sqrt(TMath::Power(buffNormX, 2) + TMath::Power(buffNormY, 2)
371 + TMath::Power(buffNormZ, 2));
374 / TMath::Sqrt(TMath::Power(buffNormX, 2) + TMath::Power(buffNormY, 2)
375 + TMath::Power(buffNormZ, 2));
378 / TMath::Sqrt(TMath::Power(buffNormX, 2) + TMath::Power(buffNormY, 2)
379 + TMath::Power(buffNormZ, 2));
383 scalarProd = normalPMT.at(0) * (pmtPoint1->GetX() - a[0])
384 + normalPMT.at(1) * (pmtPoint1->GetY() - a[1])
385 + normalPMT.at(2) * (pmtPoint1->GetZ() - a[2]);
390 * (normalPMT.at(0) * pmtPoint1->GetX() + normalPMT.at(1) * pmtPoint1->GetY()
391 + normalPMT.at(2) * pmtPoint1->GetZ());
393 scalarProd = normalPMT.at(0) * (pmtPoint2->GetX() - a[0])
394 + normalPMT.at(1) * (pmtPoint2->GetY() - a[1])
395 + normalPMT.at(2) * (pmtPoint2->GetZ() - a[2]);
398 scalarProd = normalPMT.at(0) * (pmtPoint3->GetX() - a[0])
399 + normalPMT.at(1) * (pmtPoint3->GetY() - a[1])
400 + normalPMT.at(2) * (pmtPoint3->GetZ() - a[2]);
405 vector<Double_t>& ptR2Mirr,
406 vector<Double_t> ptM,
407 vector<Double_t> ptC,
408 vector<Double_t> ptR1,
413 vector<Double_t> normalMirr(3), ptCNew(3), ptTileCenter(3);
414 Double_t t1 = 0., t2 = 0., t3 = 0.;
416 if (s ==
"Corrected") {
419 vector<Double_t> outputFit(4);
422 TString str =
fOutputDir +
"/correction_table/correction_param.txt";
424 if (corrFile.is_open()) {
425 for (Int_t
i = 0;
i < 4;
i++) {
426 corrFile >> outputFit.at(
i);
430 cout <<
"Error in CbmRichCorrection: unable to open parameter file!"
432 cout <<
"Parameter file path = " << str << endl << endl;
439 ptCNew.at(0) = ptC.at(0) + outputFit.at(3);
440 ptCNew.at(1) = ptC.at(1) + outputFit.at(2);
441 ptCNew.at(2) = ptC.at(2);
442 ptTileCenter.at(0) = navi->GetMotherMatrix()->GetTranslation()[0];
443 ptTileCenter.at(1) = navi->GetMotherMatrix()->GetTranslation()[1];
444 ptTileCenter.at(2) = navi->GetMotherMatrix()->GetTranslation()[2];
446 Double_t
x = 0.,
y = 0., z = 0., dist = 0., dist2 = 0.,
z2 = 0.;
447 x = TMath::Power(ptCNew.at(0) - ptTileCenter.at(0), 2);
448 y = TMath::Power(ptCNew.at(1) - ptTileCenter.at(1), 2);
449 z = TMath::Power(ptCNew.at(2) - ptTileCenter.at(2), 2);
450 dist = TMath::Sqrt(
x +
y + z);
451 z2 = ptTileCenter.at(2) - TMath::Sqrt(TMath::Power(300, 2) -
x -
y)
454 dist2 = TMath::Sqrt(
x +
y + TMath::Power(
z2 - ptTileCenter.at(2), 2));
458 }
else if (s ==
"Uncorrected") {
468 normalMirr.at(0) = (ptCNew.at(0) - ptM.at(0))
469 / TMath::Sqrt(TMath::Power(ptCNew.at(0) - ptM.at(0), 2)
470 + TMath::Power(ptCNew.at(1) - ptM.at(1), 2)
471 + TMath::Power(ptCNew.at(2) - ptM.at(2), 2));
472 normalMirr.at(1) = (ptCNew.at(1) - ptM.at(1))
473 / TMath::Sqrt(TMath::Power(ptCNew.at(0) - ptM.at(0), 2)
474 + TMath::Power(ptCNew.at(1) - ptM.at(1), 2)
475 + TMath::Power(ptCNew.at(2) - ptM.at(2), 2));
476 normalMirr.at(2) = (ptCNew.at(2) - ptM.at(2))
477 / TMath::Sqrt(TMath::Power(ptCNew.at(0) - ptM.at(0), 2)
478 + TMath::Power(ptCNew.at(1) - ptM.at(1), 2)
479 + TMath::Power(ptCNew.at(2) - ptM.at(2), 2));
482 t1 = ((ptR1.at(0) - ptM.at(0)) * (ptCNew.at(0) - ptM.at(0))
483 + (ptR1.at(1) - ptM.at(1)) * (ptCNew.at(1) - ptM.at(1))
484 + (ptR1.at(2) - ptM.at(2)) * (ptCNew.at(2) - ptM.at(2)))
485 / (TMath::Power(ptCNew.at(0) - ptM.at(0), 2)
486 + TMath::Power(ptCNew.at(1) - ptM.at(1), 2)
487 + TMath::Power(ptCNew.at(2) - ptM.at(2), 2));
489 2 * (ptM.at(0) + t1 * (ptCNew.at(0) - ptM.at(0))) - ptR1.at(0);
491 2 * (ptM.at(1) + t1 * (ptCNew.at(1) - ptM.at(1))) - ptR1.at(1);
493 2 * (ptM.at(2) + t1 * (ptCNew.at(2) - ptM.at(2))) - ptR1.at(2);
494 t2 = ((ptR1.at(0) - ptCNew.at(0)) * (ptCNew.at(0) - ptM.at(0))
495 + (ptR1.at(1) - ptCNew.at(1)) * (ptCNew.at(1) - ptM.at(1))
496 + (ptR1.at(2) - ptCNew.at(2)) * (ptCNew.at(2) - ptM.at(2)))
497 / (TMath::Power(ptCNew.at(0) - ptM.at(0), 2)
498 + TMath::Power(ptCNew.at(1) - ptM.at(1), 2)
499 + TMath::Power(ptCNew.at(2) - ptM.at(2), 2));
501 2 * (ptCNew.at(0) + t2 * (ptCNew.at(0) - ptM.at(0))) - ptR1.at(0);
503 2 * (ptCNew.at(1) + t2 * (ptCNew.at(1) - ptM.at(1))) - ptR1.at(1);
505 2 * (ptCNew.at(2) + t2 * (ptCNew.at(2) - ptM.at(2))) - ptR1.at(2);
520 vector<Double_t>& ptPR2,
521 vector<Double_t> normalPMT,
522 vector<Double_t> ptM,
523 vector<Double_t> ptR2Mirr,
524 Double_t constantePMT) {
527 Double_t k1 = 0., k2 = 0., checkCalc1 = 0., checkCalc2 = 0.;
530 * ((normalPMT.at(0) * ptM.at(0) + normalPMT.at(1) * ptM.at(1)
531 + normalPMT.at(2) * ptM.at(2) + constantePMT)
532 / (normalPMT.at(0) * (ptR2Mirr.at(0) - ptM.at(0))
533 + normalPMT.at(1) * (ptR2Mirr.at(1) - ptM.at(1))
534 + normalPMT.at(2) * (ptR2Mirr.at(2) - ptM.at(2))));
535 ptPMirr.at(0) = ptM.at(0) + k1 * (ptR2Mirr.at(0) - ptM.at(0));
536 ptPMirr.at(1) = ptM.at(1) + k1 * (ptR2Mirr.at(1) - ptM.at(1));
537 ptPMirr.at(2) = ptM.at(2) + k1 * (ptR2Mirr.at(2) - ptM.at(2));
539 * ((normalPMT.at(0) * ptR2Mirr.at(0) + normalPMT.at(1) * ptR2Mirr.at(1)
540 + normalPMT.at(2) * ptR2Mirr.at(2) + constantePMT)
541 / (normalPMT.at(0) * (ptR2Mirr.at(0) - ptM.at(0))
542 + normalPMT.at(1) * (ptR2Mirr.at(1) - ptM.at(1))
543 + normalPMT.at(2) * (ptR2Mirr.at(2) - ptM.at(2))));
544 ptPR2.at(0) = ptR2Mirr.at(0) + k2 * (ptR2Mirr.at(0) - ptM.at(0));
545 ptPR2.at(1) = ptR2Mirr.at(1) + k2 * (ptR2Mirr.at(1) - ptM.at(1));
546 ptPR2.at(2) = ptR2Mirr.at(2) + k2 * (ptR2Mirr.at(2) - ptM.at(2));
550 checkCalc1 = ptPMirr.at(0) * normalPMT.at(0) + ptPMirr.at(1) * normalPMT.at(1)
551 + ptPMirr.at(2) * normalPMT.at(2) + constantePMT;
554 checkCalc2 = ptPR2.at(0) * normalPMT.at(0) + ptPR2.at(1) * normalPMT.at(1)
555 + ptPR2.at(2) * normalPMT.at(2) + constantePMT;
560 std::map<
string, vector<CbmRichMirror*>> mirrorMap,
561 std::map<string, TH2D*>& histoMap) {
563 Double_t phi = 0., theta0 = 0., thetaCh = 0.;
565 for (std::map<
string, vector<CbmRichMirror*>>::iterator it =
567 it != mirrorMap.end();
570 string curMirrorId = it->first;
571 cout <<
"curMirrorId: '" << curMirrorId
572 <<
"' and vector size: " << it->second.size() << endl;
573 vector<CbmRichMirror*> mirror = it->second;
574 if (curMirrorId !=
"" && it->second.size() >
fThreshold) {
575 histoMap[it->first] =
576 new TH2D(
string(
"CherenkovHitsDistribReduced_" + it->first).c_str(),
577 "CherenkovHitsDistribReduced;#Phi_{Ch} "
578 "[rad];#theta_{Ch}-#theta_{0} [cm];Entries",
585 histoMap[it->first]->GetXaxis()->SetTitleSize(0.05);
586 histoMap[it->first]->GetXaxis()->SetTitleOffset(0.75);
587 histoMap[it->first]->GetYaxis()->SetTitleSize(0.04);
588 histoMap[it->first]->GetYaxis()->SetTitleOffset(1.2);
589 histoMap[it->first]->GetZaxis()->SetTitleSize(0.03);
590 histoMap[it->first]->GetZaxis()->SetTitleOffset(0.6);
591 for (
int i = 0;
i < it->second.size();
i++) {
595 vector<Double_t> projHit = mirr->
getProjHit();
603 for (Int_t iH = 0; iH < ringL.
GetNofHits(); iH++) {
611 thetaCh =
sqrt(TMath::Power(projHit[0] - hit.
fX, 2)
612 + TMath::Power(projHit[1] - hit.
fY, 2));
617 histoMap[it->first]->Fill(phi, thetaCh - theta0);
632 std::map<
string, vector<Double_t>>& anglesMap,
633 std::map<string, TH2D*> histoMap) {
635 Double_t p1 = 0, p2 = 0, p3 = 0, chi2 = 0, focalLength = 150., q = 0., A = 0.,
636 alpha = 0., mis_x = 0., mis_y = 0.;
640 for (std::map<string, TH2D*>::iterator it = histoMap.begin();
641 it != histoMap.end();
643 if (it->first !=
"") {
644 TCanvas* can =
new TCanvas(
"can");
648 gStyle->SetOptStat(0);
650 TH2D* histo = it->second;
651 for (Int_t y_bin = 1; y_bin <= 500; y_bin++) {
652 for (Int_t x_bin = 1; x_bin <= 200; x_bin++) {
653 if (histo->GetBinContent(x_bin, y_bin) < thresh) {
654 histo->SetBinContent(x_bin, y_bin, 0);
659 histo->FitSlicesY(0, 0, -1, 1);
663 string histoName =
"CherenkovHitsDistribReduced_" + it->first +
"_1";
665 TH1D* histo_1 = (TH1D*) gDirectory->Get((histoName).c_str());
666 histo_1->GetXaxis()->SetTitle(
"#Phi_{Ch} [rad]");
667 histo_1->GetYaxis()->SetTitle(
"#theta_{Ch}-#theta_{0} [cm]");
668 histo_1->GetXaxis()->SetTitleSize(0.05);
669 histo_1->GetXaxis()->SetTitleOffset(0.75);
670 histo_1->GetYaxis()->SetTitleSize(0.04);
671 histo_1->GetYaxis()->SetTitleOffset(1.2);
672 histo_1->Draw(
"HIST");
683 TF1* f1 =
new TF1(
"f1",
"[2]+[0]*cos(x)+[1]*sin(x)", -3.5, 3.5);
684 f1->SetParameters(0, 0, 0);
685 f1->SetParNames(
"Delta_phi",
"Delta_lambda",
"Offset");
686 histo_1->Fit(
"f1",
"",
"");
687 TF1* fit = histo_1->GetFunction(
"f1");
688 p1 = fit->GetParameter(
"Delta_phi"),
689 p2 = fit->GetParameter(
"Delta_lambda"), p3 = fit->GetParameter(
"Offset"),
690 chi2 = fit->GetChisquare();
691 f1->SetParameters(fit->GetParameter(0), fit->GetParameter(1));
697 cout << setprecision(6) << endl;
698 q = TMath::ATan(fit->GetParameter(0) / fit->GetParameter(1));
701 A = fit->GetParameter(1) / TMath::Cos(q);
704 TMath::ATan(A / 1.5) * 0.5
709 mis_x = TMath::ATan(fit->GetParameter(1) / focalLength) * 0.5
710 * TMath::Power(10, 3);
711 mis_y = TMath::ATan(fit->GetParameter(0) / focalLength) * 0.5
712 * TMath::Power(10, 3);
713 cout <<
"Horizontal displacement = " << mis_x
714 <<
" [mrad] and vertical displacement = " << mis_y <<
" [mrad]."
717 TLegend* LEG =
new TLegend(0.15, 0.25, 0.84, 0.4);
718 LEG->SetBorderSize(1);
719 LEG->SetFillColor(0);
721 LEG->SetTextSize(0.04);
722 sprintf(leg,
"Fitted sinusoid");
723 LEG->AddEntry(f1, leg,
"l");
724 sprintf(leg,
"Rotation angle around X = %.3f", -1 * mis_x);
725 LEG->AddEntry(
"", leg,
"l");
726 sprintf(leg,
"Rotation angle around Y = %.3f", mis_y);
727 LEG->AddEntry(
"", leg,
"l");
728 sprintf(leg,
"Offset = %.3f", fit->GetParameter(2));
729 LEG->AddEntry(
"", leg,
"l");
734 anglesMap[it->first].push_back(fit->GetParameter(1));
735 anglesMap[it->first].push_back(fit->GetParameter(0));
736 anglesMap[it->first].push_back(mis_x);
737 anglesMap[it->first].push_back(mis_y);
743 std::map<string, TH2D*> histoMap;
745 std::map<string, vector<Double_t>> anglesMap;
755 TString str_correction =
756 fOutputDir +
"/correction_table/correction_param_array.txt";
759 TString pathToCorrectionTable =
fOutputDir +
"/correction_table/";
760 gSystem->mkdir(pathToCorrectionTable,
true);
763 corrFile.open(str_correction, std::ofstream::trunc);
764 if (corrFile.is_open()) {
767 cout <<
"Error in CbmRichMirrorSortingAlignment::Finish ; unable to open "
773 for (std::map<
string, vector<Double_t>>::iterator it = anglesMap.begin();
774 it != anglesMap.end();
776 string mirrorId = it->first;
777 cout <<
"curMirrorId: " << mirrorId << endl;
778 vector<Double_t> misAngles = it->second;
779 cout <<
"mirror correction parameters infos: {" << misAngles[0] <<
", "
780 << misAngles[1] <<
"}" << endl;
781 corrFile.open(str_correction, std::ofstream::app);
782 if (corrFile.is_open()) {
783 corrFile << mirrorId <<
"\n";
784 corrFile << setprecision(7) << misAngles[0] <<
"\n";
785 corrFile << setprecision(7) << misAngles[1] <<
"\n";
787 cout <<
"Wrote correction parameters to: " << str_correction << endl;
789 cout <<
"Error in CbmRichMirrorSortingAlignment::Finish ; unable to open "
797 fOutputDir +
"/correction_table/reconstructed_angles_array.txt";
799 anglesFile.open(str_angles, std::ofstream::trunc);
800 if (anglesFile.is_open()) {
803 cout <<
"Error in CbmRichMirrorSortingAlignment::Finish ; unable to open "
809 for (std::map<
string, vector<Double_t>>::iterator it = anglesMap.begin();
810 it != anglesMap.end();
812 string mirrorId = it->first;
813 cout <<
"curMirrorId: " << mirrorId << endl;
814 vector<Double_t> misAngles = it->second;
815 cout <<
"mirror reconstructed angles infos: {" << misAngles[2] <<
", "
816 << misAngles[3] <<
"}" << endl;
817 anglesFile.open(str_angles, std::ofstream::app);
818 if (anglesFile.is_open()) {
819 anglesFile << mirrorId <<
"\n";
820 anglesFile << setprecision(7) << misAngles[2] <<
"\n";
821 anglesFile << setprecision(7) << misAngles[3] <<
"\n";
823 cout <<
"Wrote reconstructed angles to: " << str_angles << endl;
825 cout <<
"Error in CbmRichMirrorSortingAlignment::Finish ; unable to open "