CbmRoot
Loading...
Searching...
No Matches
CbmRichMirrorSortingAlignment.cxx
Go to the documentation of this file.
1/* Copyright (C) 2016-2021 Justus-Liebig-Universitaet Giessen, Giessen
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Jordan Bendarouach [committer] */
4
6
7#include "FairRootManager.h"
8
9#include <Logger.h>
10
11// ----- PART 1 ----- //
12#include "CbmGlobalTrack.h"
13#include "CbmMCTrack.h"
14#include "CbmRichConverter.h"
15#include "CbmRichRing.h"
18#include "CbmUtils.h"
19#include "TCanvas.h"
20#include "TClonesArray.h"
21#include "TF1.h"
22#include "TH2D.h"
23#include "TLegend.h"
24#include "TVector3.h"
25
26#include <vector>
27
28// ----- PART 2 ----- //
29#include "CbmRichGeoManager.h"
30#include "CbmRichPoint.h"
31#include "TGeoManager.h"
32#include "TGeoNavigator.h"
33class TGeoNode;
34class TGeoMatrix;
36#include "CbmTrackMatchNew.h"
37#include "TStyle.h"
38#include "TSystem.h"
39#include "string.h"
40
41#include <iostream>
42
44 : FairTask("CbmRichMirrorSortingAlignment")
45 , fEventNb(0)
46 , fGlobalTracks(NULL)
47 , fRichRings(NULL)
48 , fMCTracks(NULL)
49 , fCopFit(NULL)
50 , fTauFit(NULL)
51 , fOutputDir("")
52 , fStudyName("")
53 , fMirrorPoints(NULL)
54 , fRefPlanePoints(NULL)
55 , fPmtPoints(NULL)
56 , fRichProjections(NULL)
57 , fTrackParams(NULL)
58 , fRichRingMatches(NULL)
59 , fStsTrackMatches(NULL)
60 , fMirrorMap()
61 , fThreshold(0)
62{
63}
64
66
68{
69 FairRootManager* manager = FairRootManager::Instance();
70
71 fGlobalTracks = (TClonesArray*) manager->GetObject("GlobalTrack");
72 if (NULL == fGlobalTracks) {
73 Fatal("CbmRichMirrorSortingAlignment::Init", "No GlobalTrack array!");
74 }
75
76 fRichRings = (TClonesArray*) manager->GetObject("RichRing");
77 if (NULL == fRichRings) {
78 Fatal("CbmRichMirrorSortingAlignment::Init", "No RichRing array !");
79 }
80
81 fMCTracks = (TClonesArray*) manager->GetObject("MCTrack");
82 if (NULL == fMCTracks) {
83 Fatal("CbmRichMirrorSortingAlignment::Init", "No MCTracks array !");
84 }
85
86 fMirrorPoints = (TClonesArray*) manager->GetObject("RichMirrorPoint");
87 if (NULL == fMirrorPoints) {
88 Fatal("CbmRichMirrorSortingAlignment::Init", "No RichMirrorPoints array !");
89 }
90
91 fRefPlanePoints = (TClonesArray*) manager->GetObject("RefPlanePoint");
92 if (NULL == fRefPlanePoints) {
93 Fatal("CbmRichMirrorSortingAlignment::Init", "No RichRefPlanePoint array !");
94 }
95
96 fPmtPoints = (TClonesArray*) manager->GetObject("RichPoint");
97 if (NULL == fPmtPoints) {
98 Fatal("CbmRichMirrorSortingAlignment::Init", "No RichPoint array !");
99 }
100
101 fRichProjections = (TClonesArray*) manager->GetObject("RichProjection");
102 if (NULL == fRichProjections) {
103 Fatal("CbmRichMirrorSortingAlignment::Init", "No RichProjection array !");
104 }
105
106 fTrackParams = (TClonesArray*) manager->GetObject("RichTrackParamZ");
107 if (NULL == fTrackParams) {
108 Fatal("CbmRichMirrorSortingAlignment::Init", "No RichTrackParamZ array!");
109 }
110
111 fRichRingMatches = (TClonesArray*) manager->GetObject("RichRingMatch");
112 if (NULL == fRichRingMatches) {
113 Fatal("CbmRichMirrorSortingAlignment::Init", "No RichRingMatch array!");
114 }
115
116 fStsTrackMatches = (TClonesArray*) manager->GetObject("StsTrackMatch");
117 if (NULL == fStsTrackMatches) {
118 Fatal("CbmRichMirrorSortingAlignment::Init", "No StsTrackMatch array!");
119 }
120
124
125 return kSUCCESS;
126}
127
129{
130 fEventNb++;
131 cout << "CbmRichMirrorSortingAlignment: Event #" << fEventNb << endl;
132 TVector3 momentum, outPos;
133 Double_t constantePMT = 0., trackX = 0., trackY = 0.;
134 vector<Double_t> vect(2, 0), ptM(3, 0), ptC(3, 0), ptCIdeal(3, 0), ptR1(3, 0), ptR2Center(3, 0), ptR2Mirr(3, 0),
135 ptPR2(3, 0), ptPMirr(3, 0), normalPMT(3, 0);
136 //ptC[0]=0.;
137 ptC.at(0) = 0., ptC.at(1) = 132.594000, ptC.at(2) = 54.267226;
138 TVector3 mirrorPoint, dirCos, pos;
139 Double_t nx = 0., ny = 0., nz = 0.;
140 TGeoNode* mirrNode;
141 CbmRichPoint *mirrPoint, *refPlanePoint;
142
143 if (fRichRings->GetEntriesFast() != 0) {
144 cout << "Nb of rings in evt = " << fRichRings->GetEntriesFast() << endl << endl;
145 GetPmtNormal(fPmtPoints->GetEntriesFast(), normalPMT, constantePMT);
146 //cout << "Calculated normal vector to PMT plane = {" << normalPMT.at(0) << ", " << normalPMT.at(1) << ", " << normalPMT.at(2) << "} and constante d = " << constantePMT << endl;
147
148 for (Int_t iGlobalTrack = 0; iGlobalTrack < fGlobalTracks->GetEntriesFast(); iGlobalTrack++) {
149 CbmRichMirror* mirrorObject = new CbmRichMirror(); // Create CbmRichMirror object, to be later filled.
150 // ----- PART 1 ----- //
151 // Ring-Track matching + Ring fit + Track momentum:
152 CbmGlobalTrack* gTrack = (CbmGlobalTrack*) fGlobalTracks->At(iGlobalTrack);
153 Int_t richInd = gTrack->GetRichRingIndex();
154 Int_t stsInd = gTrack->GetStsTrackIndex();
155 //cout << "richInd: " << richInd << endl;
156 if (richInd < 0) {
157 cout << "Error richInd < 0" << endl;
158 continue;
159 }
160 CbmRichRing* ring = (CbmRichRing*) fRichRings->At(richInd);
161 if (ring == NULL) {
162 cout << "Error ring == NULL!" << endl;
163 continue;
164 }
165 //Int_t ringTrackID = ring->GetTrackID(); //Old code not working with changes for new matching method.
166 //cout << "ringTrackID: " << ringTrackID << endl;
167 CbmTrackMatchNew* cbmRichTrackMatch = (CbmTrackMatchNew*) fRichRingMatches->At(richInd);
168 CbmTrackMatchNew* cbmStsTrackMatch = (CbmTrackMatchNew*) fStsTrackMatches->At(stsInd);
169 if (NULL == cbmRichTrackMatch) {
170 continue;
171 }
172 cout << "Nof true hits = " << cbmRichTrackMatch->GetNofTrueHits() << endl;
173 cout << "Nof wrong hits = " << cbmRichTrackMatch->GetNofWrongHits() << endl;
174 Int_t mcRichTrackId = cbmRichTrackMatch->GetMatchedLink().GetIndex();
175 Int_t mcStsTrackId = cbmStsTrackMatch->GetMatchedLink().GetIndex();
176 //cout << "mcTrackId: " << mcRichTrackId << endl;
177 if (mcRichTrackId < 0) continue;
178 //if (mcStsTrackId != ringTrackID) { //Old code not working with changes for new matching method.
179 if (mcStsTrackId != mcRichTrackId) {
180 cout << "Error StsTrackIndex and TrackIndex from Ring do not match!" << endl;
181 continue;
182 }
183 CbmMCTrack* mcTrack = (CbmMCTrack*) fMCTracks->At(mcRichTrackId);
184 if (!mcTrack) continue;
185
186 CbmRichRingLight ringL;
188 fCopFit->DoFit(&ringL);
189 //fTauFit->DoFit(&ringL);
190 mirrorObject->setRingLight(ringL); // Fill Cbm Rich Ring Light inside mirrorObject.
191 cout << "ring Center Coo: " << ringL.GetCenterX() << ", " << ringL.GetCenterY() << endl;
192 mcTrack->GetMomentum(momentum);
193 mirrorObject->setMomentum(momentum); // Fill track momentum inside mirrorObject.
194 //FairTrackParam* pr = (FairTrackParam*) fRichProjections->At(ringTrackID); //Old code not working with changes for new matching method.
195 FairTrackParam* pr = (FairTrackParam*) fRichProjections->At(stsInd);
196 FairTrackParam* point = (FairTrackParam*) fTrackParams->At(stsInd);
197 if (pr == NULL) {
198 cout << "CbmRichMirrorSortingAlignment::Exec : pr = NULL." << endl;
199 continue;
200 }
201 trackX = pr->GetX(), trackY = pr->GetY();
202 cout << "Track: " << trackX << ", " << trackY << endl;
203 mirrorObject->setProjHit(trackX, trackY);
204
205 // ----- PART 2 ----- //
206 // Mirror ID via TGeoNavigator + Extrap hit:
207 Int_t trackMotherId = mcTrack->GetMotherId();
208 Int_t pdg = TMath::Abs(mcTrack->GetPdgCode());
209 if (trackMotherId == -1) {
210 if (fMirrorPoints->GetEntriesFast() > 0) {
211 //loop on mirrorPoint and compare w/ TrackID->GetTrackId to get correct one
212 for (Int_t iMirrPt = 0; iMirrPt < fMirrorPoints->GetEntriesFast(); iMirrPt++) {
213 mirrPoint = (CbmRichPoint*) fMirrorPoints->At(iMirrPt);
214 if (mirrPoint == 0) {
215 continue;
216 }
217 //cout << "Mirror point track ID: " << mirrPoint->GetTrackID() << endl;
218 if (mirrPoint->GetTrackID() == mcRichTrackId) {
219 break;
220 }
221 }
222 ptM.at(0) = mirrPoint->GetX(), ptM.at(1) = mirrPoint->GetY(), ptM.at(2) = mirrPoint->GetZ();
223 cout << "mirrPoint: {" << mirrPoint->GetX() << ", " << mirrPoint->GetY() << ", " << mirrPoint->GetZ() << "}"
224 << endl;
225
226 mirrNode = gGeoManager->FindNode(ptM.at(0), ptM.at(1), ptM.at(2));
227 cout << "Mirror node name: " << mirrNode->GetName() << " and full path " << gGeoManager->GetPath() << endl;
228 string str1 = gGeoManager->GetPath(), str2 = "mirror_tile_", str3 = "";
229 cout << "str1 before CbmRichNavigationUtil::FindIntersection: " << str1 << endl;
230 TVector3 crossP;
231 str1 = CbmRichNavigationUtil::FindIntersection(point, crossP, "mirror_tile_");
232 cout << "str1 after CbmRichNavigationUtil::FindIntersection: " << str1 << endl;
233
234 std::size_t found = str1.find(str2);
235 if (found != std::string::npos) {
236 //cout << "first 'mirror_tile_type' found at: " << found << '\n';
237 Int_t end = str2.length() + 3;
238 str3 = str1.substr(found, end);
239 }
240 cout << "Mirror ID: " << str3 << endl;
241 mirrorObject->setMirrorId(str3);
242
243 if (mirrNode) {
244 TGeoNavigator* navi = gGeoManager->GetCurrentNavigator();
245 //cout << "Navigator path: " << navi->GetPath() << endl;
246 ptCIdeal.at(0) = navi->GetCurrentMatrix()->GetTranslation()[0];
247 ptCIdeal.at(1) = navi->GetCurrentMatrix()->GetTranslation()[1];
248 ptCIdeal.at(2) = navi->GetCurrentMatrix()->GetTranslation()[2];
249 cout << "Sphere center coordinates of the aligned mirror tile, "
250 "ideal = {"
251 << ptCIdeal.at(0) << ", " << ptCIdeal.at(1) << ", " << ptCIdeal.at(2) << "}" << endl;
252 for (Int_t iRefPt = 0; iRefPt < fRefPlanePoints->GetEntriesFast(); iRefPt++) {
253 refPlanePoint = (CbmRichPoint*) fRefPlanePoints->At(iRefPt);
254 //cout << "Refl plane point track ID: " << refPlanePoint->GetTrackID() << endl;
255 if (refPlanePoint->GetTrackID() == mcRichTrackId) {
256 break;
257 }
258 }
259 ptR1.at(0) = refPlanePoint->GetX(), ptR1.at(1) = refPlanePoint->GetY(), ptR1.at(2) = refPlanePoint->GetZ();
260 cout << "Refl plane point coo = {" << ptR1[0] << ", " << ptR1[1] << ", " << ptR1[2] << "}" << endl;
261 ComputeR2(ptR2Center, ptR2Mirr, ptM, ptC, ptR1, navi, "Uncorrected");
262 ComputeP(ptPMirr, ptPR2, normalPMT, ptM, ptR2Mirr, constantePMT);
263 TVector3 inPos(ptPMirr.at(0), ptPMirr.at(1), ptPMirr.at(2));
264 cout << "inPos vector: " << inPos.x() << ", " << inPos.y() << ", " << inPos.z() << endl;
266 cout << "New PMT points coordinates = {" << outPos.x() << ", " << outPos.y() << ", " << outPos.z() << "}"
267 << endl;
268 mirrorObject->setExtrapHit(outPos.x(), outPos.y());
269 }
270 }
271 else {
272 cout << "No mirror points registered." << endl;
273 }
274 }
275 else {
276 cout << "Not a mother particle." << endl;
277 }
278 //ComputeAngles();
279 fMirrorMap[mirrorObject->getMirrorId()].push_back(mirrorObject);
280 cout << "Key str: " << mirrorObject->getMirrorId() << endl
281 << "Mirror map: " << fMirrorMap[mirrorObject->getMirrorId()].size() << endl
282 << endl;
283 //mirrNode->Clear();
284 //gGeoManager->Clear();
285 }
286 }
287 else {
288 cout << "CbmRichMirrorSortingAlignment::Exec No rings in event were found." << endl;
289 }
290}
291
292void CbmRichMirrorSortingAlignment::GetPmtNormal(Int_t NofPMTPoints, vector<Double_t>& normalPMT, Double_t& normalCste)
293{
294 //cout << endl << "//------------------------------ CbmRichMirrorSortingAlignment: Calculate PMT Normal ------------------------------//" << endl << endl;
295
296 Int_t pmtTrackID, pmtMotherID;
297 Double_t buffNormX = 0., buffNormY = 0., buffNormZ = 0., k = 0., scalarProd = 0.;
298 Double_t pmtPt[] = {0., 0., 0.};
299 Double_t a[] = {0., 0., 0.}, b[] = {0., 0., 0.}, c[] = {0., 0., 0.};
300 CbmMCTrack* track;
301
302 /*
303 * Selection of three points (A, B, C), which form a plan and from which the calculation of the normal of the plan can be computed.
304 * Formula used is: vect(AB) x vect(AC) = normal.
305 * Normalize the normal vector obtained and check with three random points from the PMT plane, whether the scalar product is equal to zero.
306 */
307 for (Int_t iPmt = 0; iPmt < NofPMTPoints; iPmt++) {
308 CbmRichPoint* pmtPoint = (CbmRichPoint*) fPmtPoints->At(iPmt);
309 pmtTrackID = pmtPoint->GetTrackID();
310 track = (CbmMCTrack*) fMCTracks->At(pmtTrackID);
311 pmtMotherID = track->GetMotherId();
312 a[0] = pmtPoint->GetX(), a[1] = pmtPoint->GetY(), a[2] = pmtPoint->GetZ();
313 //cout << "a[0] = " << a[0] << ", a[1] = " << a[1] << " et a[2] = " << a[2] << endl;
314 break;
315 }
316 for (Int_t iPmt = 0; iPmt < NofPMTPoints; iPmt++) {
317 CbmRichPoint* pmtPoint = (CbmRichPoint*) fPmtPoints->At(iPmt);
318 pmtTrackID = pmtPoint->GetTrackID();
319 track = (CbmMCTrack*) fMCTracks->At(pmtTrackID);
320 pmtMotherID = track->GetMotherId();
321 //cout << "PMT Point coordinates; x = " << pmtPoint->GetX() << ", y = " << pmtPoint->GetY() << " and z = " << pmtPoint->GetZ() << endl;
322 if (TMath::Sqrt(TMath::Power(a[0] - pmtPoint->GetX(), 2) + TMath::Power(a[1] - pmtPoint->GetY(), 2)
323 + TMath::Power(a[2] - pmtPoint->GetZ(), 2))
324 > 7) {
325 b[0] = pmtPoint->GetX(), b[1] = pmtPoint->GetY(), b[2] = pmtPoint->GetZ();
326 //cout << "b[0] = " << b[0] << ", b[1] = " << b[1] << " et b[2] = " << b[2] << endl;
327 break;
328 }
329 }
330 for (Int_t iPmt = 0; iPmt < NofPMTPoints; iPmt++) {
331 CbmRichPoint* pmtPoint = (CbmRichPoint*) fPmtPoints->At(iPmt);
332 pmtTrackID = pmtPoint->GetTrackID();
333 track = (CbmMCTrack*) fMCTracks->At(pmtTrackID);
334 pmtMotherID = track->GetMotherId();
335 //cout << "PMT Point coordinates; x = " << pmtPoint->GetX() << ", y = " << pmtPoint->GetY() << " and z = " << pmtPoint->GetZ() << endl;
336 if (TMath::Sqrt(TMath::Power(a[0] - pmtPoint->GetX(), 2) + TMath::Power(a[1] - pmtPoint->GetY(), 2)
337 + TMath::Power(a[2] - pmtPoint->GetZ(), 2))
338 > 7
339 && TMath::Sqrt(TMath::Power(b[0] - pmtPoint->GetX(), 2) + TMath::Power(b[1] - pmtPoint->GetY(), 2)
340 + TMath::Power(b[2] - pmtPoint->GetZ(), 2))
341 > 7) {
342 c[0] = pmtPoint->GetX(), c[1] = pmtPoint->GetY(), c[2] = pmtPoint->GetZ();
343 //cout << "c[0] = " << c[0] << ", c[1] = " << c[1] << " et c[2] = " << c[2] << endl;
344 break;
345 }
346 }
347
348 k = (b[0] - a[0]) / (c[0] - a[0]);
349 if ((b[1] - a[1]) - (k * (c[1] - a[1])) == 0 || (b[2] - a[2]) - (k * (c[2] - a[2])) == 0) {
350 cout << "Error in normal calculation, vect_AB and vect_AC are collinear." << endl;
351 }
352 else {
353 buffNormX = (b[1] - a[1]) * (c[2] - a[2]) - (b[2] - a[2]) * (c[1] - a[1]);
354 buffNormY = (b[2] - a[2]) * (c[0] - a[0]) - (b[0] - a[0]) * (c[2] - a[2]);
355 buffNormZ = (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
356 normalPMT.at(0) =
357 buffNormX / TMath::Sqrt(TMath::Power(buffNormX, 2) + TMath::Power(buffNormY, 2) + TMath::Power(buffNormZ, 2));
358 normalPMT.at(1) =
359 buffNormY / TMath::Sqrt(TMath::Power(buffNormX, 2) + TMath::Power(buffNormY, 2) + TMath::Power(buffNormZ, 2));
360 normalPMT.at(2) =
361 buffNormZ / TMath::Sqrt(TMath::Power(buffNormX, 2) + TMath::Power(buffNormY, 2) + TMath::Power(buffNormZ, 2));
362 }
363
364 CbmRichPoint* pmtPoint1 = (CbmRichPoint*) fPmtPoints->At(20);
365 scalarProd = normalPMT.at(0) * (pmtPoint1->GetX() - a[0]) + normalPMT.at(1) * (pmtPoint1->GetY() - a[1])
366 + normalPMT.at(2) * (pmtPoint1->GetZ() - a[2]);
367 //cout << "1st scalar product between vectAM and normale = " << scalarProd << endl;
368 // To determine the constant term of the plane equation, inject the coordinates of a pmt point, which should solve it: a*x+b*y+c*z+d=0.
369 normalCste =
370 -1
371 * (normalPMT.at(0) * pmtPoint1->GetX() + normalPMT.at(1) * pmtPoint1->GetY() + normalPMT.at(2) * pmtPoint1->GetZ());
372 CbmRichPoint* pmtPoint2 = (CbmRichPoint*) fPmtPoints->At(15);
373 scalarProd = normalPMT.at(0) * (pmtPoint2->GetX() - a[0]) + normalPMT.at(1) * (pmtPoint2->GetY() - a[1])
374 + normalPMT.at(2) * (pmtPoint2->GetZ() - a[2]);
375 //cout << "2nd scalar product between vectAM and normale = " << scalarProd << endl;
376 CbmRichPoint* pmtPoint3 = (CbmRichPoint*) fPmtPoints->At(25);
377 scalarProd = normalPMT.at(0) * (pmtPoint3->GetX() - a[0]) + normalPMT.at(1) * (pmtPoint3->GetY() - a[1])
378 + normalPMT.at(2) * (pmtPoint3->GetZ() - a[2]);
379 //cout << "3nd scalar product between vectAM and normale = " << scalarProd << endl;
380}
381
382void CbmRichMirrorSortingAlignment::ComputeR2(vector<Double_t>& ptR2Center, vector<Double_t>& ptR2Mirr,
383 vector<Double_t> ptM, vector<Double_t> ptC, vector<Double_t> ptR1,
384 TGeoNavigator* navi, TString s)
385{
386 //cout << endl << "//------------------------------ CbmRichCorrection: ComputeR2 ------------------------------//" << endl << endl;
387
388 vector<Double_t> normalMirr(3), ptCNew(3), ptTileCenter(3);
389 Double_t t1 = 0., t2 = 0., t3 = 0.;
390
391 if (s == "Corrected") {
392 // Use the correction information from text file, to the tile sphere center:
393 // Reading misalignment information from correction_param.txt text file.
394 vector<Double_t> outputFit(4);
395 ifstream corrFile;
396 //TString str = fOutputDir + "correction_param_" + fNumbAxis + fTile + ".txt";
397 TString str = fOutputDir + "/correction_table/correction_param.txt";
398 corrFile.open(str);
399 if (corrFile.is_open()) {
400 for (Int_t i = 0; i < 4; i++) {
401 corrFile >> outputFit.at(i);
402 }
403 corrFile.close();
404 }
405 else {
406 cout << "Error in CbmRichCorrection: unable to open parameter file!" << endl;
407 cout << "Parameter file path = " << str << endl << endl;
408 sleep(5);
409 }
410 //cout << "Misalignment parameters read from file = [" << outputFit.at(0) << " ; " << outputFit.at(1) << " ; " << outputFit.at(2) << " ; " << outputFit.at(3) << "]" << endl;
411
412 //ptCNew.at(0) = TMath::Abs(ptC.at(0) - TMath::Abs(outputFit.at(3)));
413 //ptCNew.at(1) = TMath::Abs(ptC.at(1) - TMath::Abs(outputFit.at(2)));
414 ptCNew.at(0) = ptC.at(0) + outputFit.at(3);
415 ptCNew.at(1) = ptC.at(1) + outputFit.at(2);
416 ptCNew.at(2) = ptC.at(2);
417 ptTileCenter.at(0) = navi->GetMotherMatrix()->GetTranslation()[0];
418 ptTileCenter.at(1) = navi->GetMotherMatrix()->GetTranslation()[1];
419 ptTileCenter.at(2) = navi->GetMotherMatrix()->GetTranslation()[2];
420 //cout << "Mirror tile center coordinates = {" << ptTileCenter.at(0) << ", " << ptTileCenter.at(1) << ", " << ptTileCenter.at(2) << "}" << endl;
421 Double_t x = 0., y = 0., z = 0., dist = 0., dist2 = 0., z2 = 0.;
422 x = TMath::Power(ptCNew.at(0) - ptTileCenter.at(0), 2);
423 y = TMath::Power(ptCNew.at(1) - ptTileCenter.at(1), 2);
424 z = TMath::Power(ptCNew.at(2) - ptTileCenter.at(2), 2);
425 dist = TMath::Sqrt(x + y + z);
426 z2 = ptTileCenter.at(2) - TMath::Sqrt(TMath::Power(300, 2) - x - y) - ptCNew.at(2);
427 //cout << "{x, y, z} = {" << x << ", " << y << ", " << z << "}, dist = " << dist << " and z2 = " << z2 << endl;
428 dist2 = TMath::Sqrt(x + y + TMath::Power(z2 - ptTileCenter.at(2), 2));
429 //cout << "dist2 = " << dist2 << endl;
430 ptCNew.at(2) += z2;
431 //cout << "Sphere center coordinates of the rotated mirror tile, after correction, = {" << ptCNew.at(0) << ", " << ptCNew.at(1) << ", " << ptCNew.at(2) << "}" << endl;
432 }
433 else if (s == "Uncorrected") {
434 // Keep the same tile sphere center, with no correction information.
435 ptCNew = ptC;
436 //cout << "Sphere center coordinates of the rotated mirror tile, without correction = {" << ptCNew.at(0) << ", " << ptCNew.at(1) << ", " << ptCNew.at(2) << "}" << endl;
437 }
438 else {
439 //cout << "No input given in function ComputeR2! Uncorrected parameters for the sphere center of the tile will be used!" << endl;
440 ptCNew = ptC;
441 //cout << "Sphere center coordinates of the rotated mirror tile, without correction = {" << ptCNew.at(0) << ", " << ptCNew.at(1) << ", " << ptCNew.at(2) << "}" << endl;
442 }
443
444 normalMirr.at(0) = (ptCNew.at(0) - ptM.at(0))
445 / TMath::Sqrt(TMath::Power(ptCNew.at(0) - ptM.at(0), 2) + TMath::Power(ptCNew.at(1) - ptM.at(1), 2)
446 + TMath::Power(ptCNew.at(2) - ptM.at(2), 2));
447 normalMirr.at(1) = (ptCNew.at(1) - ptM.at(1))
448 / TMath::Sqrt(TMath::Power(ptCNew.at(0) - ptM.at(0), 2) + TMath::Power(ptCNew.at(1) - ptM.at(1), 2)
449 + TMath::Power(ptCNew.at(2) - ptM.at(2), 2));
450 normalMirr.at(2) = (ptCNew.at(2) - ptM.at(2))
451 / TMath::Sqrt(TMath::Power(ptCNew.at(0) - ptM.at(0), 2) + TMath::Power(ptCNew.at(1) - ptM.at(1), 2)
452 + TMath::Power(ptCNew.at(2) - ptM.at(2), 2));
453 //cout << "Calculated and normalized normal of mirror tile = {" << normalMirr.at(0) << ", " << normalMirr.at(1) << ", " << normalMirr.at(2) << "}" << endl;
454
455 t1 = ((ptR1.at(0) - ptM.at(0)) * (ptCNew.at(0) - ptM.at(0)) + (ptR1.at(1) - ptM.at(1)) * (ptCNew.at(1) - ptM.at(1))
456 + (ptR1.at(2) - ptM.at(2)) * (ptCNew.at(2) - ptM.at(2)))
457 / (TMath::Power(ptCNew.at(0) - ptM.at(0), 2) + TMath::Power(ptCNew.at(1) - ptM.at(1), 2)
458 + TMath::Power(ptCNew.at(2) - ptM.at(2), 2));
459 ptR2Center.at(0) = 2 * (ptM.at(0) + t1 * (ptCNew.at(0) - ptM.at(0))) - ptR1.at(0);
460 ptR2Center.at(1) = 2 * (ptM.at(1) + t1 * (ptCNew.at(1) - ptM.at(1))) - ptR1.at(1);
461 ptR2Center.at(2) = 2 * (ptM.at(2) + t1 * (ptCNew.at(2) - ptM.at(2))) - ptR1.at(2);
462 t2 =
463 ((ptR1.at(0) - ptCNew.at(0)) * (ptCNew.at(0) - ptM.at(0)) + (ptR1.at(1) - ptCNew.at(1)) * (ptCNew.at(1) - ptM.at(1))
464 + (ptR1.at(2) - ptCNew.at(2)) * (ptCNew.at(2) - ptM.at(2)))
465 / (TMath::Power(ptCNew.at(0) - ptM.at(0), 2) + TMath::Power(ptCNew.at(1) - ptM.at(1), 2)
466 + TMath::Power(ptCNew.at(2) - ptM.at(2), 2));
467 ptR2Mirr.at(0) = 2 * (ptCNew.at(0) + t2 * (ptCNew.at(0) - ptM.at(0))) - ptR1.at(0);
468 ptR2Mirr.at(1) = 2 * (ptCNew.at(1) + t2 * (ptCNew.at(1) - ptM.at(1))) - ptR1.at(1);
469 ptR2Mirr.at(2) = 2 * (ptCNew.at(2) + t2 * (ptCNew.at(2) - ptM.at(2))) - ptR1.at(2);
470 /*//SAME AS calculation of t2 above
471 t3 = ((ptR1.at(0)-ptCNew.at(0))*(ptCNew.at(0)-ptM.at(0)) + (ptR1.at(1)-ptCNew.at(1))*(ptCNew.at(1)-ptM.at(1)) + (ptR1.at(2)-ptCNew.at(2))*(ptCNew.at(2)-ptM.at(2)))/TMath::Sqrt(TMath::Power(ptCNew.at(0) - ptM.at(0),2)+TMath::Power(ptCNew.at(1) - ptM.at(1),2)+TMath::Power(ptCNew.at(2) - ptM.at(2),2));
472 reflectedPtCooVectSphereUnity[0] = 2*(ptCNew.at(0)+t3*(normalMirr.at(0)))-ptR1.at(0);
473 reflectedPtCooVectSphereUnity[1] = 2*(ptCNew.at(1)+t3*(normalMirr.at(1)))-ptR1.at(1);
474 reflectedPtCooVectSphereUnity[2] = 2*(ptCNew.at(2)+t3*(normalMirr.at(2)))-ptR1.at(2);*/
475 //cout << "* using mirror point M to define \U00000394: {" << ptR2Center.at(0) << ", " << ptR2Center.at(1) << ", " << ptR2Center.at(2) << "}" << endl;
476 //cout << "Ref Pt Coo using unity Mirror-Sphere vector & sphere pt = {" << reflectedPtCooVectSphereUnity[0] << ", " << reflectedPtCooVectSphereUnity[1] << ", " << reflectedPtCooVectSphereUnity[2] << "}" << endl << endl;
477 //cout << "NofPMTPoints = " << NofPMTPoints << endl;
478
479 //cout << "Coordinates of point R2 on reflective plane after reflection on the mirror tile:" << endl;
480 //cout << "* using sphere center C to define \U00000394: {" << ptR2Mirr.at(0) << ", " << ptR2Mirr.at(1) << ", " << ptR2Mirr.at(2) << "}" << endl;
481}
482
483void CbmRichMirrorSortingAlignment::ComputeP(vector<Double_t>& ptPMirr, vector<Double_t>& ptPR2,
484 vector<Double_t> normalPMT, vector<Double_t> ptM,
485 vector<Double_t> ptR2Mirr, Double_t constantePMT)
486{
487 //cout << endl << "//------------------------------ CbmRichCorrection: ComputeP ------------------------------//" << endl << endl;
488
489 Double_t k1 = 0., k2 = 0., checkCalc1 = 0., checkCalc2 = 0.;
490
491 k1 = -1
492 * ((normalPMT.at(0) * ptM.at(0) + normalPMT.at(1) * ptM.at(1) + normalPMT.at(2) * ptM.at(2) + constantePMT)
493 / (normalPMT.at(0) * (ptR2Mirr.at(0) - ptM.at(0)) + normalPMT.at(1) * (ptR2Mirr.at(1) - ptM.at(1))
494 + normalPMT.at(2) * (ptR2Mirr.at(2) - ptM.at(2))));
495 ptPMirr.at(0) = ptM.at(0) + k1 * (ptR2Mirr.at(0) - ptM.at(0));
496 ptPMirr.at(1) = ptM.at(1) + k1 * (ptR2Mirr.at(1) - ptM.at(1));
497 ptPMirr.at(2) = ptM.at(2) + k1 * (ptR2Mirr.at(2) - ptM.at(2));
498 k2 = -1
499 * ((normalPMT.at(0) * ptR2Mirr.at(0) + normalPMT.at(1) * ptR2Mirr.at(1) + normalPMT.at(2) * ptR2Mirr.at(2)
500 + constantePMT)
501 / (normalPMT.at(0) * (ptR2Mirr.at(0) - ptM.at(0)) + normalPMT.at(1) * (ptR2Mirr.at(1) - ptM.at(1))
502 + normalPMT.at(2) * (ptR2Mirr.at(2) - ptM.at(2))));
503 ptPR2.at(0) = ptR2Mirr.at(0) + k2 * (ptR2Mirr.at(0) - ptM.at(0));
504 ptPR2.at(1) = ptR2Mirr.at(1) + k2 * (ptR2Mirr.at(1) - ptM.at(1));
505 ptPR2.at(2) = ptR2Mirr.at(2) + k2 * (ptR2Mirr.at(2) - ptM.at(2));
506 //cout << "Coordinates of point P on PMT plane, after reflection on the mirror tile and extrapolation to the PMT plane:" << endl;
507 //cout << "* using mirror point M to define \U0001D49F ': {" << ptPMirr.at(0) << ", " << ptPMirr.at(1) << ", " << ptPMirr.at(2) << "}" << endl;
508 //cout << "* using reflected point R2 to define \U0001D49F ': {" << ptPR2.at(0) << ", " << ptPR2.at(1) << ", " << ptPR2.at(2) << "}" << endl;
509 checkCalc1 =
510 ptPMirr.at(0) * normalPMT.at(0) + ptPMirr.at(1) * normalPMT.at(1) + ptPMirr.at(2) * normalPMT.at(2) + constantePMT;
511 //cout << "Check whether extrapolated track point on PMT plane verifies its equation (value should be 0.):" << endl;
512 //cout << "* using mirror point M, checkCalc = " << checkCalc1 << endl;
513 checkCalc2 =
514 ptPR2.at(0) * normalPMT.at(0) + ptPR2.at(1) * normalPMT.at(1) + ptPR2.at(2) * normalPMT.at(2) + constantePMT;
515 //cout << "* using reflected point R2, checkCalc = " << checkCalc2 << endl;
516}
517
518void CbmRichMirrorSortingAlignment::CreateHistoMap(std::map<string, vector<CbmRichMirror*>> mirrorMap,
519 std::map<string, TH2D*>& histoMap)
520{
521 Int_t NofHits = 0;
522 Double_t phi = 0., theta0 = 0., thetaCh = 0.;
523
524 for (std::map<string, vector<CbmRichMirror*>>::iterator it = mirrorMap.begin(); it != mirrorMap.end(); ++it) {
525 // to get mirror Id:
526 string curMirrorId = it->first;
527 cout << "curMirrorId: '" << curMirrorId << "' and vector size: " << it->second.size() << endl;
528 vector<CbmRichMirror*> mirror = it->second;
529 if (curMirrorId != "" && it->second.size() > fThreshold) {
530 histoMap[it->first] = new TH2D(string("CherenkovHitsDistribReduced_" + it->first).c_str(),
531 "CherenkovHitsDistribReduced;#Phi_{Ch} "
532 "[rad];#theta_{Ch}-#theta_{0} [cm];Entries",
533 200, -3.4, 3.4, 500, -6., 6.);
534 histoMap[it->first]->GetXaxis()->SetTitleSize(0.05);
535 histoMap[it->first]->GetXaxis()->SetTitleOffset(0.75);
536 histoMap[it->first]->GetYaxis()->SetTitleSize(0.04);
537 histoMap[it->first]->GetYaxis()->SetTitleOffset(1.2);
538 histoMap[it->first]->GetZaxis()->SetTitleSize(0.03);
539 histoMap[it->first]->GetZaxis()->SetTitleOffset(0.6);
540 for (int i = 0; i < it->second.size(); i++) {
541 CbmRichMirror* mirr = mirror.at(i);
542 string str = mirr->getMirrorId();
543 TVector3 mom = mirr->getMomentum();
544 vector<Double_t> projHit = mirr->getProjHit();
545 vector<Double_t> extrapHit = mirr->getExtrapHit();
546 CbmRichRingLight ringL = mirr->getRingLight();
547 // cout << "mirror: " << str << endl;
548 // cout << "momentum: {" << mom.X() << ", " << mom.Y() << ", " << mom.Z() << "}" << endl;
549 // cout << "Proj hit coo: {" << projHit[0] << ", " << projHit[1] << "}" << endl;
550 // cout << "Extrap hit coo: {" << extrapHit[0] << ", " << extrapHit[1] << "}" << endl;
551
552 for (Int_t iH = 0; iH < ringL.GetNofHits(); iH++) {
553 // ----- Phi angle calculation ----- //
554 CbmRichHitLight hit = ringL.GetHit(iH);
555 //CbmRichHit* hit = static_cast<CbmRichHit*>(fPmtPoints->At(HitIndex));
556 phi = TMath::ATan2(hit.fY - ringL.GetCenterY(), hit.fX - ringL.GetCenterX());
557
558 // ----- Theta_Ch and Theta_0 calculations ----- //
559 thetaCh = sqrt(TMath::Power(projHit[0] - hit.fX, 2) + TMath::Power(projHit[1] - hit.fY, 2));
560 theta0 = sqrt(TMath::Power(ringL.GetCenterX() - hit.fX, 2) + TMath::Power(ringL.GetCenterY() - hit.fY, 2));
561 //cout << "Theta_0 = " << Theta_0 << endl;
562
563 histoMap[it->first]->Fill(phi, thetaCh - theta0);
564 }
565 }
566 }
567 }
568 cout << endl;
569 // For loop to draw all histograms collected for all misaligned mirror tiles
570 // for (std::map<string, TH2D*>::iterator it=histoMap.begin(); it!=histoMap.end(); ++it) {
571 // cout << "Key str: " << it->first << " and nb of entries: " << it->second->GetEntries() << endl << endl;
572 // TCanvas* can = new TCanvas();
573 // it->second->Draw("colz");
574 // }
575}
576
577void CbmRichMirrorSortingAlignment::DrawFitAndExtractAngles(std::map<string, vector<Double_t>>& anglesMap,
578 std::map<string, TH2D*> histoMap)
579{
580 Int_t thresh = 3;
581 Double_t p1 = 0, p2 = 0, p3 = 0, chi2 = 0, focalLength = 150., q = 0., A = 0., alpha = 0., mis_x = 0., mis_y = 0.;
582 // mis_x && mis_y corresponds respect. to rotation angles around the Y and X axes.
583 // !!! BEWARE: AXES INDEXES ARE SWITCHED !!!
584
585 for (std::map<string, TH2D*>::iterator it = histoMap.begin(); it != histoMap.end(); ++it) {
586 if (it->first != "") {
587 TCanvas* can = new TCanvas("can");
588 // can->Divide(3,1);
589 can->Divide(2, 1);
590 can->SetGrid();
591 gStyle->SetOptStat(0);
592 can->cd(1);
593 TH2D* histo = it->second;
594 for (Int_t y_bin = 1; y_bin <= 500; y_bin++) {
595 for (Int_t x_bin = 1; x_bin <= 200; x_bin++) {
596 if (histo->GetBinContent(x_bin, y_bin) < thresh) {
597 histo->SetBinContent(x_bin, y_bin, 0);
598 }
599 }
600 }
601 histo->Draw("colz");
602 histo->FitSlicesY(0, 0, -1, 1);
603 histo->Write();
604
605 can->cd(2);
606 string histoName = "CherenkovHitsDistribReduced_" + it->first + "_1";
607 //cout << "HistoName: " << histoName << endl;
608 TH1D* histo_1 = gDirectory->Get<TH1D>((histoName).c_str());
609 histo_1->GetXaxis()->SetTitle("#Phi_{Ch} [rad]");
610 histo_1->GetYaxis()->SetTitle("#theta_{Ch}-#theta_{0} [cm]");
611 histo_1->GetXaxis()->SetTitleSize(0.05);
612 histo_1->GetXaxis()->SetTitleOffset(0.75);
613 histo_1->GetYaxis()->SetTitleSize(0.04);
614 histo_1->GetYaxis()->SetTitleOffset(1.2);
615 histo_1->Draw("HIST");
616 histo_1->Write();
617 //
618 // if ( histo_1->GetSumOfWeights() == 0 || histo_1->Integral() == 0 ) {
619 // cout << "For mirror tile: " << it->first << ":" << endl;
620 // cout << "Sum of weights: " << histo_1->GetSumOfWeights() << endl;
621 // cout << "Integral: " << histo_1->Integral() << endl;
622 // continue;
623 // }
624 //
625 // can->cd(3);
626 TF1* f1 = new TF1("f1", "[2]+[0]*cos(x)+[1]*sin(x)", -3.5, 3.5);
627 f1->SetParameters(0, 0, 0);
628 f1->SetParNames("Delta_phi", "Delta_lambda", "Offset");
629 histo_1->Fit("f1", "", "");
630 TF1* fit = histo_1->GetFunction("f1");
631 p1 = fit->GetParameter("Delta_phi"), p2 = fit->GetParameter("Delta_lambda"), p3 = fit->GetParameter("Offset"),
632 chi2 = fit->GetChisquare();
633 f1->SetParameters(fit->GetParameter(0), fit->GetParameter(1));
634 char leg[128];
635 f1->SetLineColor(2);
636 f1->Draw("same");
637 f1->Write();
638 // ------------------------------ CALCULATION OF MISALIGNMENT ANGLE ------------------------------ //
639 cout << setprecision(6) << endl;
640 q = TMath::ATan(fit->GetParameter(0) / fit->GetParameter(1));
641 //cout << endl << "fit_1 = " << fit->GetParameter(0) << " and fit_2 = " << fit->GetParameter(1) << endl;
642 //cout << "q = " << q << endl;
643 A = fit->GetParameter(1) / TMath::Cos(q);
644 //cout << "Parameter a = " << A << endl;
645 alpha =
646 TMath::ATan(A / 1.5) * 0.5
647 * TMath::Power(
648 10,
649 3); // *0.5, because a mirror rotation of alpha implies a rotation in the particle trajectory of 2*alpha ; 1.5 meters = Focal length = Radius_of_curvature/2
650 //cout << setprecision(6) << "Total angle of misalignment alpha = " << alpha << endl;
651 mis_x = TMath::ATan(fit->GetParameter(1) / focalLength) * 0.5 * TMath::Power(10, 3);
652 mis_y = TMath::ATan(fit->GetParameter(0) / focalLength) * 0.5 * TMath::Power(10, 3);
653 cout << "Horizontal displacement = " << mis_x << " [mrad] and vertical displacement = " << mis_y << " [mrad]."
654 << endl
655 << endl;
656 TLegend* LEG = new TLegend(0.15, 0.25, 0.84, 0.4);
657 LEG->SetBorderSize(1);
658 LEG->SetFillColor(0);
659 LEG->SetMargin(0.2);
660 LEG->SetTextSize(0.04);
661 sprintf(leg, "Fitted sinusoid");
662 LEG->AddEntry(f1, leg, "l");
663 sprintf(leg, "Rotation angle around X = %.3f", -1 * mis_x);
664 LEG->AddEntry("", leg, "l");
665 sprintf(leg, "Rotation angle around Y = %.3f", mis_y);
666 LEG->AddEntry("", leg, "l");
667 sprintf(leg, "Offset = %.3f", fit->GetParameter(2));
668 LEG->AddEntry("", leg, "l");
669 LEG->Draw();
670 Cbm::SaveCanvasAsImage(can, string(fOutputDir.Data() + fStudyName), "png");
671
672 anglesMap[it->first].push_back(fit->GetParameter(1));
673 anglesMap[it->first].push_back(fit->GetParameter(0));
674 anglesMap[it->first].push_back(mis_x);
675 anglesMap[it->first].push_back(mis_y);
676 }
677 }
678}
679
681{
682 std::map<string, TH2D*> histoMap;
683 histoMap.clear();
684 std::map<string, vector<Double_t>> anglesMap;
685 anglesMap.clear();
686
687 // Filling the reduced thetaCh VS phi histogram and writing the resulting histogram in histoMap:
688 CreateHistoMap(fMirrorMap, histoMap);
689
690 // Drawing the obtained thetaCh VS phi histogram ; fitting with sinusoid ; write calculated misalignment angles in anglesMap:
691 DrawFitAndExtractAngles(anglesMap, histoMap);
692
693 //TString str_correction = fOutputDir + "/corr_params/correction_param_array_" + fStudyName + ".txt";
694 TString str_correction = fOutputDir + "/correction_table/correction_param_array.txt";
695
696 // Check if the directory exists, otherwise creates it.
697 TString pathToCorrectionTable = fOutputDir + "/correction_table/";
698 gSystem->mkdir(pathToCorrectionTable, true);
699
700 ofstream corrFile;
701 corrFile.open(str_correction, std::ofstream::trunc);
702 if (corrFile.is_open()) {
703 corrFile.close();
704 }
705 else {
706 cout << "Error in CbmRichMirrorSortingAlignment::Finish ; unable to open "
707 "parameter file!"
708 << endl;
709 }
710
711 // Write correction values in output file:
712 for (std::map<string, vector<Double_t>>::iterator it = anglesMap.begin(); it != anglesMap.end(); ++it) {
713 string mirrorId = it->first;
714 cout << "curMirrorId: " << mirrorId << endl;
715 vector<Double_t> misAngles = it->second;
716 cout << "mirror correction parameters infos: {" << misAngles[0] << ", " << misAngles[1] << "}" << endl;
717 corrFile.open(str_correction, std::ofstream::app);
718 if (corrFile.is_open()) {
719 corrFile << mirrorId << "\n";
720 corrFile << setprecision(7) << misAngles[0] << "\n";
721 corrFile << setprecision(7) << misAngles[1] << "\n";
722 corrFile.close();
723 cout << "Wrote correction parameters to: " << str_correction << endl;
724 }
725 else {
726 cout << "Error in CbmRichMirrorSortingAlignment::Finish ; unable to open "
727 "parameter file!"
728 << endl;
729 }
730 }
731
732 //TString str_angles = fOutputDir + "/corr_params/reconstructed_angles_array_" + fStudyName + ".txt";
733 TString str_angles = fOutputDir + "/correction_table/reconstructed_angles_array.txt";
734 ofstream anglesFile;
735 anglesFile.open(str_angles, std::ofstream::trunc);
736 if (anglesFile.is_open()) {
737 anglesFile.close();
738 }
739 else {
740 cout << "Error in CbmRichMirrorSortingAlignment::Finish ; unable to open "
741 "parameter file!"
742 << endl;
743 }
744
745 // Write misalignment angles in output file:
746 for (std::map<string, vector<Double_t>>::iterator it = anglesMap.begin(); it != anglesMap.end(); ++it) {
747 string mirrorId = it->first;
748 cout << "curMirrorId: " << mirrorId << endl;
749 vector<Double_t> misAngles = it->second;
750 cout << "mirror reconstructed angles infos: {" << misAngles[2] << ", " << misAngles[3] << "}" << endl;
751 anglesFile.open(str_angles, std::ofstream::app);
752 if (anglesFile.is_open()) {
753 anglesFile << mirrorId << "\n";
754 anglesFile << setprecision(7) << misAngles[2] << "\n";
755 anglesFile << setprecision(7) << misAngles[3] << "\n";
756 anglesFile.close();
757 cout << "Wrote reconstructed angles to: " << str_angles << endl;
758 }
759 else {
760 cout << "Error in CbmRichMirrorSortingAlignment::Finish ; unable to open "
761 "parameter file!"
762 << endl;
763 }
764 }
765}
ClassImp(CbmConverterManager)
Convert internal data classes to cbmroot common data classes.
Here the ring is fitted with the COP algorithm from A. Ayriyan/G. Ososkov.
Here the ring is fitted with Taubin algorithm from A. Ayriyan, G. Ososkov, N. Chernov.
friend fvec sqrt(const fvec &a)
int32_t GetStsTrackIndex() const
int32_t GetRichRingIndex() const
void GetMomentum(TVector3 &momentum) const
Definition CbmMCTrack.h:170
int32_t GetMotherId() const
Definition CbmMCTrack.h:69
int32_t GetPdgCode() const
Definition CbmMCTrack.h:68
const CbmLink & GetMatchedLink() const
Definition CbmMatch.h:41
static void Init()
Initialize array of RICH hits.
static void CopyHitsToRingLight(const CbmRichRing *ring1, CbmRichRingLight *ring2)
Copy hits from CbmRichRing to CbmRichRingLight.
void RotatePoint(TVector3 *inPos, TVector3 *outPos, Bool_t noTilting=false)
static CbmRichGeoManager & GetInstance()
virtual void Exec(Option_t *option)
Inherited from FairTask.
void DrawFitAndExtractAngles(std::map< string, vector< Double_t > > &anglesMap, std::map< string, TH2D * > histoMap)
void GetPmtNormal(Int_t NofPMTPoints, vector< Double_t > &normalPMT, Double_t &normalCste)
void ComputeP(vector< Double_t > &ptPMirr, vector< Double_t > &ptPR2, vector< Double_t > normalPMT, vector< Double_t > ptM, vector< Double_t > ptR2Mirr, Double_t constantePMT)
virtual void Finish()
Inherited from FairTask.
void CreateHistoMap(std::map< string, vector< CbmRichMirror * > > mirrorMap, std::map< string, TH2D * > &histoMap)
std::map< string, vector< CbmRichMirror * > > fMirrorMap
CbmRichRingFitterEllipseTau * fTauFit
virtual InitStatus Init()
Inherited from FairTask.
void ComputeR2(vector< Double_t > &ptR2Center, vector< Double_t > &ptR2Mirr, vector< Double_t > ptM, vector< Double_t > ptC, vector< Double_t > ptR1, TGeoNavigator *navi, TString s)
void setMomentum(TVector3 v)
void setProjHit(Double_t xX, Double_t yY)
vector< Double_t > getProjHit()
TVector3 getMomentum()
void setRingLight(CbmRichRingLight ringL)
string getMirrorId()
void setMirrorId(string s)
CbmRichRingLight getRingLight()
void setExtrapHit(Double_t xX, Double_t yY)
vector< Double_t > getExtrapHit()
static string FindIntersection(const FairTrackParam *par, TVector3 &crossPoint, const string &volumeName)
Here the ring is fitted with the COP algorithm from A. Ayriyan/G. Ososkov.
virtual void DoFit(CbmRichRingLight *ring)
Inherited from CbmRichRingFitterBase.
Here the ring is fitted with Taubin algorithm from A. Ayriyan, G. Ososkov, N. Chernov.
float GetCenterX() const
float GetCenterY() const
int GetNofHits() const
Return number of hits in ring.
CbmRichHitLight GetHit(int ind)
Return hit by the index.
int32_t GetNofWrongHits() const
int32_t GetNofTrueHits() const
void SaveCanvasAsImage(TCanvas *c, const string &dir, const string &option)
Definition CbmUtils.cxx:36