CbmRoot
Loading...
Searching...
No Matches
CbmRichGeoOpt.cxx
Go to the documentation of this file.
1/* Copyright (C) 2014-2020 UGiessen/JINR-LIT, Giessen/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Semen Lebedev [committer], Tariq Mahmoud */
4
12#include "CbmRichGeoOpt.h"
13
14#include "CbmDrawHist.h"
15#include "CbmMCTrack.h"
16#include "CbmRichGeoManager.h"
17#include "CbmRichHit.h"
18#include "CbmRichRing.h"
19#include "CbmRichRingLight.h"
20#include "CbmTrackMatchNew.h"
21#include "TCanvas.h"
22#include "TClonesArray.h"
23#include "TH1.h"
24#include "TH1D.h"
25#include "TH2D.h"
26#include "TH3D.h"
27
28#include <FairRootManager.h>
29#include <FairTrackParam.h>
30
31#include <boost/assign/list_of.hpp>
32
33#include <iostream>
34#include <string>
35
36using namespace std;
37using boost::assign::list_of;
38
40 : FairTask("CbmRichGeoOpt")
41 , fRichPoints(NULL)
42 , fMcTracks(NULL)
43 , fRefPoints(NULL)
44 , fRichHits(NULL)
45 , fRichRings(NULL)
46 , fRichRingMatches(NULL)
47 , fEventNum(0)
48 , PMTPointsFilled(0)
49 , fMinNofHits(7)
50 , nPhotonsNotOnPlane(0)
51 , nPhotonsNotOnSphere(0)
52 , nTotalPhorons(0)
53 , PMTPlanePoints()
54 , PMTPlaneCenter()
55 , ReadPMTPlaneCenter()
56 , ReadPMTPlaneCenterOrig()
57 , MirrorCenter()
58 ,
59 // ReadMirrorCenter(),
60 RotX(0.)
61 , RotY(0.)
62 , PMT_r1()
63 , PMT_r2()
64 , PMT_norm()
65 , PMTPlaneCenterX(0.)
66 , PMTPlaneCenterY(0.)
67 , PMTPlaneThirdX(0.)
68 , MirrPosition()
69 , SensPointsFilled(0)
70 , SensPlanePoints()
71 , Sens_r1()
72 , Sens_r2()
73 , Sens_norm()
74 , H_Diff_LineRefPMT_MomAtPMT(NULL)
75 , H_Theta_TwoVectors(NULL)
76 , H_DistancePMTtoMirrCenter(NULL)
77 , H_DistancePMTtoMirr(NULL)
78 , H_MomPrim(NULL)
79 , H_PtPrim(NULL)
80 , H_MomPt(NULL)
81 , H_Mom_Theta_MC(NULL)
82 , H_Pt_Theta_MC(NULL)
83 , H_Mom_Theta_Rec(NULL)
84 , H_Pt_Theta_Rec(NULL)
85 , H_Mom_Theta_Acc(NULL)
86 , H_Pt_Theta_Acc(NULL)
87 , H_MomRing(NULL)
88 , H_acc_mom_el(NULL)
89 , H_acc_pty_el(NULL)
90 , H_Mom_XY_Theta25(NULL)
91 , H_MomPrim_RegularTheta(NULL)
92 , H_acc_mom_el_RegularTheta(NULL)
93 , H_Hits_XY(NULL)
94 , H_Hits_XY_LeftHalf(NULL)
95 , H_Hits_XY_RightHalf(NULL)
96 , H_Hits_XY_Left2Thirds(NULL)
97 , H_Hits_XY_RightThird(NULL)
98 , H_PointsIn_XY(NULL)
99 , H_PointsIn_XY_LeftHalf(NULL)
100 , H_PointsIn_XY_RightHalf(NULL)
101 , H_PointsIn_XY_Left2Thirds(NULL)
102 , H_PointsIn_XY_RightThird(NULL)
103 , H_PointsOut_XY(NULL)
104 , H_NofPhotonsPerEv(NULL)
105 , H_NofPhotonsPerHit(NULL)
106 , H_NofPhotonsSmallerThan30(NULL)
107 , H_DiffXhit(NULL)
108 , H_DiffYhit(NULL)
109 , H_dFocalPoint_Delta(NULL)
110 , H_dFocalPoint_Rho(NULL)
111 , H_Alpha(NULL)
112 , H_Alpha_UpLeft(NULL)
113 , H_Alpha_UpLeft_II(NULL)
114 , H_Alpha_UpLeft_RegularTheta(NULL)
115 , H_Alpha_UpLeft_LeftHalf(NULL)
116 , H_Alpha_UpLeft_RightHalf(NULL)
117 , H_Alpha_UpLeft_RightThird(NULL)
118 , H_Alpha_UpLeft_Left2Thirds(NULL)
119 , H_Alpha_XYposAtDet(NULL)
120 , H_Alpha_XYposAtDet_RegularTheta(NULL)
121 , H_Alpha_XYposAtDet_LeftHalf(NULL)
122 , H_Alpha_XYposAtDet_RightHalf(NULL)
123 , H_Alpha_XYposAtDet_RightThird(NULL)
124 , H_Alpha_XYposAtDet_Left2Thirds(NULL)
125 , H_NofHitsAll(NULL)
126 , H_NofRings(NULL)
127 , H_NofRings_NofHits(NULL)
128 , H_RingCenterX(NULL)
129 , H_RingCenterY(NULL)
130 , H_RingCenter(NULL)
131 , H_Radius(NULL)
132 , H_aAxis(NULL)
133 , H_bAxis(NULL)
134 , H_boa(NULL)
135 , H_boa_RegularTheta(NULL)
136 , H_boa_LeftHalf(NULL)
137 , H_boa_RightHalf(NULL)
138 , H_boa_RightThird(NULL)
139 , H_boa_Left2Thirds(NULL)
140 , H_dR(NULL)
141 , H_dR_aa(NULL)
142 , H_dR_RegularTheta(NULL)
143 , H_dR_LeftHalf(NULL)
144 , H_dR_RightHalf(NULL)
145 , H_dR_RightThird(NULL)
146 , H_dR_Left2Thirds(NULL)
147 , H_RingCenter_Aaxis(NULL)
148 , H_RingCenter_Baxis(NULL)
149 , H_RingCenter_boa(NULL)
150 , H_RingCenter_boa_RegularTheta(NULL)
151 , H_RingCenter_boa_LeftHalf(NULL)
152 , H_RingCenter_boa_RightHalf(NULL)
153 , H_RingCenter_boa_RightThird(NULL)
154 , H_RingCenter_boa_Left2Thirds(NULL)
155 , H_RingCenter_dR(NULL)
156 , H_RingCenter_dR_RegularTheta(NULL)
157 , H_RingCenter_dR_LeftHalf(NULL)
158 , H_RingCenter_dR_RightHalf(NULL)
159 , H_RingCenter_dR_RightThird(NULL)
160 , H_RingCenter_dR_Left2Thirds(NULL)
161
162{
163 /*
164 fEventNum = 0;
165 PMTPointsFilled = 0;
166 fMinNofHits = 7;
167 nPhotonsNotOnPlane = 0;
168 nPhotonsNotOnSphere = 0;
169 nTotalPhorons = 0;
170 */
171}
172
174
176{
177 cout << "CbmRichGeoOpt::Init" << endl;
178 FairRootManager* ioman = FairRootManager::Instance();
179 if (NULL == ioman) {
180 LOG(fatal) << GetName() << "::Init: RootManager not instantised!";
181 }
182
183 fRichPoints = (TClonesArray*) ioman->GetObject("RichPoint");
184 if (NULL == fRichPoints) {
185 LOG(fatal) << GetName() << "::Init: No RichPoint array!";
186 }
187
188 fRefPoints = (TClonesArray*) ioman->GetObject("RefPlanePoint");
189 if (NULL == fRefPoints) {
190 LOG(fatal) << GetName() << "::Init: No RefPlanePoint array!";
191 }
192
193 fMcTracks = (TClonesArray*) ioman->GetObject("MCTrack");
194 if (NULL == fMcTracks) {
195 LOG(fatal) << GetName() << "::Init: No MCTrack array!";
196 }
197
198 fRichHits = (TClonesArray*) ioman->GetObject("RichHit");
199 if (NULL == fRichHits) {
200 LOG(fatal) << GetName() << "::Init: No RichHit array!";
201 }
202
204 fRichRings = (TClonesArray*) ioman->GetObject("RichRing");
205 if (NULL == fRichRings) {
206 LOG(fatal) << GetName() << "::Init: No RichRing array!";
207 }
208
209 fRichRingMatches = (TClonesArray*) ioman->GetObject("RichRingMatch");
210 if (NULL == fRichRingMatches) {
211 LOG(fatal) << GetName() << "::Init: No RichRingMatch array!";
212 }
213
215 //cout<<" initializing points values -1000"<<endl;
216 PMTPlanePoints.resize(3);
217 SensPlanePoints.resize(3);
218 for (unsigned int p = 0; p < PMTPlanePoints.size(); p++) {
219 PMTPlanePoints[p].SetX(-1000.);
220 PMTPlanePoints[p].SetY(-1000.);
221 PMTPlanePoints[p].SetZ(-1000.);
222 SensPlanePoints[p].SetX(-1000.);
223 SensPlanePoints[p].SetY(-1000.);
224 SensPlanePoints[p].SetZ(-1000.);
225 }
226 // CbmRichRecGeoPar* gp = CbmRichGeoManager::GetInstance().fGP;
227 PMTPlaneCenterX = 0.; //-1.*gp->fPmtWidthX/2.;
228 PMTPlaneCenterY = 0.; //-1.*gp->fPmtWidthY/2.;
229 PMTPlaneThirdX = 0.; //-1.*gp->fPmtWidthX/3.;
230 //cout<<"fGP.fPmtWidthX = "<< gp->fPmtWidthX<<", PMTPlaneCenterX = "<< PMTPlaneCenterX<<", PMTPlaneThirdX = "<< PMTPlaneThirdX<<endl;
231
233 return kSUCCESS;
234}
235
236void CbmRichGeoOpt::Exec(Option_t* /*option*/)
237{
238 fEventNum++;
239 // cout << "#################### CbmRichGeoOpt, event No. " << fEventNum << endl;
240
241 if (PMTPointsFilled == 0) {
242 for (unsigned int p = 1; p < PMTPlanePoints.size(); p++) {
243 if (PMTPlanePoints[p].X() == PMTPlanePoints[p - 1].X()) {
244 cout << "PMTPlanePoints[" << p << "].X == PMTPlanePoints[" << p - 1 << "].X ==" << PMTPlanePoints[p - 1].X()
245 << endl;
246 cout << "Calling FillPointsAtPMT()" << endl;
248 PMTPointsFilled = 0;
249 }
250 else {
251 PMTPointsFilled = 1;
252 }
253 }
254 }
255 if (SensPointsFilled == 0) {
256 for (unsigned int p = 1; p < SensPlanePoints.size(); p++) {
257 if (SensPlanePoints[p].X() == SensPlanePoints[p - 1].X()) {
260 }
261 else {
263 }
264 }
265 }
266
267 //cout << "#################### CbmRichGeoOpt, event No. " << fEventNum << endl;
268 //Fill the coordinates of the three points on the PMT plane
270 PMTPlaneCenter.SetX(gp->fPmt.fX);
271 PMTPlaneCenter.SetY(gp->fPmt.fY);
272 PMTPlaneCenter.SetZ(gp->fPmt.fZ);
274 // if(PMTPointsFilled==1 && SensPointsFilled==1 ){cout<<" Both are filled."<<endl;}
275 // else if(PMTPointsFilled==1 && SensPointsFilled==0){cout<<" PMTPointsFilled==1 && SensPointsFilled==0."<<endl;}
276 // else if(PMTPointsFilled==0 && SensPointsFilled==1){cout<<" PMTPointsFilled==0 && SensPointsFilled==1."<<endl;}
277 // else{cout<<" PMTPointsFilled==0 && SensPointsFilled==0."<<endl;}
278
279 if (PMTPointsFilled == 1) {
280 if (fEventNum < 10) {
281 for (unsigned int p = 0; p < PMTPlanePoints.size(); p++) {
282 cout << "Point " << p << ": (" << PMTPlanePoints[p].X() << " , " << PMTPlanePoints[p].Y() << " , "
283 << PMTPlanePoints[p].Z() << ")" << endl;
284 }
285
288 PMT_norm = PMT_r1.Cross(PMT_r2);
289 MirrorCenter.SetX(gp->fMirrorX);
290 MirrorCenter.SetY(gp->fMirrorY);
291 MirrorCenter.SetZ(gp->fMirrorZ);
292 cout << "MirrorCenter=(" << MirrorCenter.X() << "," << MirrorCenter.Y() << "," << MirrorCenter.Z() << ")" << endl;
293 cout << "PMT_r1=(" << PMT_r1.X() << "," << PMT_r1.Y() << "," << PMT_r1.Z() << ")" << endl;
294 cout << "PMT_r2=(" << PMT_r2.X() << "," << PMT_r2.Y() << "," << PMT_r2.Z() << ")" << endl;
295 cout << "PMT_norm=(" << PMT_norm.X() << "," << PMT_norm.Y() << "," << PMT_norm.Z() << ")" << endl;
296 }
297 // //HitsAndPointsWithRef();
300 FillMcHist();
301 }
302 //fGP.Print();
303 // cout<<" ========== PMT_TRAZ = "<<TString(gSystem->Getenv("PMT_TRAZ")).Atof()<<endl;
304 // cout<<" ========== PMT_ROTX = "<<TString(gSystem->Getenv("PMT_ROTX")).Atof()<<endl;
305}
308{
309 //***********************************************************
310 //**** points
311 //***************
312 Int_t nofPoints = fRichPoints->GetEntriesFast();
313 if (nofPoints < 0 || nofPoints > 2000) {
314 return;
315 }
316 H_NofPhotonsPerEv->Fill(nofPoints);
317 for (Int_t ip = 0; ip < nofPoints; ip++) {
318 TVector3 PosAtDetIn;
319 TVector3 PosAtDetOut;
320 CbmRichPoint* point = (CbmRichPoint*) fRichPoints->At(ip);
321 if (NULL == point) continue;
322 //int trackId = point->GetTrackID(); if(trackId<0) continue;
323 PosAtDetIn.SetX(point->GetX());
324 PosAtDetIn.SetY(point->GetY());
325 PosAtDetIn.SetZ(point->GetZ());
326 bool Checked = CheckPointLiesOnPlane(PosAtDetIn, PMTPlanePoints[0], PMT_norm);
327 if (!Checked) continue;
328 H_PointsIn_XY->Fill(PosAtDetIn.X(), PosAtDetIn.Y());
329 if (PosAtDetIn.X() <= PMTPlaneCenterX) {
330 H_PointsIn_XY_LeftHalf->Fill(PosAtDetIn.X(), PosAtDetIn.Y());
331 }
332 if (PosAtDetIn.X() > PMTPlaneCenterX) {
333 H_PointsIn_XY_RightHalf->Fill(PosAtDetIn.X(), PosAtDetIn.Y());
334 }
335 if (PosAtDetIn.X() <= PMTPlaneThirdX) {
336 H_PointsIn_XY_Left2Thirds->Fill(PosAtDetIn.X(), PosAtDetIn.Y());
337 }
338 if (PosAtDetIn.X() > PMTPlaneThirdX) {
339 H_PointsIn_XY_RightThird->Fill(PosAtDetIn.X(), PosAtDetIn.Y());
340 }
341
342 CbmRichGeoManager::GetInstance().RotatePoint(&PosAtDetIn, &PosAtDetOut);
343 H_PointsOut_XY->Fill(PosAtDetOut.X(), PosAtDetOut.Y());
344
346 TVector3 MomAtPMT;
347 MomAtPMT.SetX(point->GetPx());
348 MomAtPMT.SetY(point->GetPy());
349 MomAtPMT.SetZ(point->GetPz());
350 // float MagMomAtPMT=MomAtPMT.Mag();
351
352 Int_t PointMCTrackId = point->GetTrackID();
353 if (PointMCTrackId < 0) continue;
354 CbmMCTrack* PointTrack = static_cast<CbmMCTrack*>(fMcTracks->At(PointMCTrackId));
355 if (NULL == PointTrack) continue;
356 TVector3 PointMom;
357 PointTrack->GetMomentum(PointMom);
358
359 Int_t PointMotherId = PointTrack->GetMotherId();
360 if (PointMotherId == -1) {
361 continue;
362 }
363 CbmMCTrack* motherTrack = static_cast<CbmMCTrack*>(fMcTracks->At(PointMotherId));
364 int pdg = TMath::Abs(motherTrack->GetPdgCode());
365 int motherId = motherTrack->GetMotherId();
366 TVector3 ElMom;
367 Double_t ElTheta = 0.;
368 if (pdg == 11 && motherId == -1) {
369 motherTrack->GetMomentum(ElMom);
370 ElTheta = ElMom.Theta() * 180 / TMath::Pi();
371 }
372 double Alpha2 = MomAtPMT.Angle(PMT_norm); //*TMath::RadToDeg();
373 double Alpha2InDeg = Alpha2 * TMath::RadToDeg();
374 if (Alpha2InDeg > 90.) {
375 Alpha2InDeg = 180. - Alpha2InDeg;
376 }
377 H_Alpha->Fill(Alpha2InDeg);
378 if (PosAtDetIn.X() < 0. && PosAtDetIn.Y() > 0) {
379 if (ElTheta <= 25) {
380 H_Alpha_UpLeft_RegularTheta->Fill(Alpha2InDeg);
381 H_Alpha_XYposAtDet_RegularTheta->Fill(PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
382 }
383 H_Alpha_UpLeft->Fill(Alpha2InDeg);
384 H_Alpha_XYposAtDet->Fill(PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
385
386 if (PosAtDetIn.X() <= PMTPlaneCenterX) {
387 H_Alpha_UpLeft_LeftHalf->Fill(Alpha2InDeg);
388 H_Alpha_XYposAtDet_LeftHalf->Fill(PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
389 }
390 if (PosAtDetIn.X() > PMTPlaneCenterX) {
391 H_Alpha_UpLeft_RightHalf->Fill(Alpha2InDeg);
392 H_Alpha_XYposAtDet_RightHalf->Fill(PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
393 }
394 if (PosAtDetIn.X() <= PMTPlaneThirdX) {
395 H_Alpha_UpLeft_Left2Thirds->Fill(Alpha2InDeg);
396 H_Alpha_XYposAtDet_Left2Thirds->Fill(PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
397 }
398 if (PosAtDetIn.X() > PMTPlaneThirdX) {
399 H_Alpha_UpLeft_RightThird->Fill(Alpha2InDeg);
400 H_Alpha_XYposAtDet_RightThird->Fill(PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
401 }
402 }
403
404
405 } //end loop points
406
407
408 //***********************************************************
409 //**** Hits
410 //***************
411 Int_t nofHits = fRichHits->GetEntriesFast();
412
413 for (Int_t iH = 0; iH < nofHits; iH++) {
414 CbmRichHit* hit = (CbmRichHit*) fRichHits->At(iH);
415 if (hit == NULL) continue;
416 Int_t pointInd = hit->GetRefId();
417 if (pointInd < 0) continue;
418 CbmRichPoint* point = (CbmRichPoint*) fRichPoints->At(pointInd);
419 if (point == NULL) continue;
420
421 // H_NofPhotonsPerHit->Fill(hit->GetNPhotons());
422
423 TVector3 inPos(point->GetX(), point->GetY(), point->GetZ());
424 TVector3 outPos;
426 H_Hits_XY->Fill(hit->GetX(), hit->GetY());
427
428 if (hit->GetX() <= PMTPlaneCenterX) {
429 H_Hits_XY_LeftHalf->Fill(hit->GetX(), hit->GetY());
430 }
431 if (hit->GetX() > PMTPlaneCenterX) {
432 H_Hits_XY_RightHalf->Fill(hit->GetX(), hit->GetY());
433 }
434 if (hit->GetX() <= PMTPlaneThirdX) {
435 H_Hits_XY_Left2Thirds->Fill(hit->GetX(), hit->GetY());
436 }
437 if (hit->GetX() > PMTPlaneThirdX) {
438 H_Hits_XY_RightThird->Fill(hit->GetX(), hit->GetY());
439 }
440
441 H_DiffXhit->Fill(hit->GetX() - outPos.X());
442 H_DiffYhit->Fill(hit->GetY() - outPos.Y());
443 }
444}
445
448{
449 Int_t nofRefPoints = fRefPoints->GetEntriesFast();
450 Int_t nofPoints = fRichPoints->GetEntriesFast();
451 if (nofPoints == 0 || nofRefPoints == 0) {
452 return;
453 }
454 if (nofPoints > 2000) {
455 return;
456 }
457
458 for (int i = 0; i < nofRefPoints; i++) {
459 TVector3 PosAtRefl;
460 TVector3 PosAtDetIn;
461 CbmRichPoint* RefPoint = (CbmRichPoint*) fRefPoints->At(i);
462 TVector3 MomAtRef;
463 MomAtRef.SetX(RefPoint->GetPx());
464 MomAtRef.SetY(RefPoint->GetPy());
465 MomAtRef.SetZ(RefPoint->GetPz()); //RefPoint->GetMomentum(MomAtRef);
466
467 if (RefPoint == NULL) continue;
468 int RefPointTrackId = RefPoint->GetTrackID();
469 if (RefPointTrackId < 0) {
470 continue;
471 }
472 CbmMCTrack* RefPointTrack = static_cast<CbmMCTrack*>(fMcTracks->At(RefPointTrackId));
473 int pdg0 = RefPointTrack->GetPdgCode();
474 if (TMath::Abs(pdg0) == 11) {
475 continue;
476 }
477 RefPoint->Position(PosAtRefl);
478 int Zpos = int(10. * PosAtRefl.Z()); //3037 0r 3038 -->take 3038 which is the entrance point
479 //of the REFLECTED photon into the sensitive plane
480 cout << PosAtRefl.Z() << " " << Zpos << endl;
481 //if(Zpos==3037){continue;}
482 TVector3 momRef;
483 RefPointTrack->GetMomentum(momRef);
484
485 CbmRichPoint* point = GetPMTPoint(RefPointTrackId); //
486 PosAtDetIn.SetX(point->GetX());
487 PosAtDetIn.SetY(point->GetY());
488 PosAtDetIn.SetZ(point->GetZ());
489 TVector3 MomAtPMT;
490 MomAtPMT.SetX(point->GetPx());
491 MomAtPMT.SetY(point->GetPy());
492 MomAtPMT.SetZ(point->GetPz());
493 float MagMomAtPMT = MomAtPMT.Mag();
494 //point->GetMomentum(MomAtPMT);
495
496 Int_t PointMCTrackId = point->GetTrackID();
497 CbmMCTrack* PointTrack = static_cast<CbmMCTrack*>(fMcTracks->At(PointMCTrackId));
498 if (NULL == PointTrack) continue;
499 TVector3 PointMom;
500 PointTrack->GetMomentum(PointMom);
501
502 Int_t PointMotherId = PointTrack->GetMotherId();
503 if (PointMotherId == -1) {
504 continue;
505 }
506
507 CbmMCTrack* motherTrack = static_cast<CbmMCTrack*>(fMcTracks->At(PointMotherId));
508 int pdg = TMath::Abs(motherTrack->GetPdgCode());
509 int motherId = motherTrack->GetMotherId();
510 TVector3 ElMom;
511 Double_t ElTheta = 0.; //float ElMomentum=0.;
512 if (pdg == 11 && motherId == -1) {
513 motherTrack->GetMomentum(ElMom);
514 ElTheta = ElMom.Theta() * 180 / TMath::Pi(); //ElMomentum=motherTrack->GetP();
515 //cout<<"ElTheta = "<<ElTheta<<", ElMomentum = "<<ElMomentum<<endl;
516 }
517
519 bool Checked = CheckPointLiesOnPlane(PosAtDetIn, PMTPlanePoints[0], PMT_norm);
520 if (!Checked)
521 continue; //cout<<" point not on plane: ("<<point->GetX()<<","<<point->GetY()<<","<<point->GetZ()<<")"<<endl; continue;
522
523 TVector3 LineSensToPMT = PosAtDetIn - PosAtRefl;
524 float MagLineSensToPMT = LineSensToPMT.Mag();
525 H_Diff_LineRefPMT_MomAtPMT->Fill(MagLineSensToPMT - MagMomAtPMT);
526
527 H_Theta_TwoVectors->Fill(LineSensToPMT.Angle(MomAtPMT));
529 double Alpha = LineSensToPMT.Angle(PMT_norm); //*TMath::RadToDeg();
530 double AlphaInDeg = Alpha * TMath::RadToDeg();
531 if (AlphaInDeg > 90.) {
532 AlphaInDeg = 180. - AlphaInDeg;
533 }
535 //double Alpha2=PointMom.Angle(PMT_norm);//*TMath::RadToDeg();
536 double Alpha2 = MomAtPMT.Angle(PMT_norm); //*TMath::RadToDeg();
537 double Alpha2InDeg = Alpha2 * TMath::RadToDeg();
538 if (Alpha2InDeg > 90.) {
539 Alpha2InDeg = 180. - Alpha2InDeg;
540 }
541 //cout<<PointMom.X()<<" "<<MomAtPMT.X()<<" "<<MomAtRef.X()<<" "<<Alpha<<" "<<Alpha2<<endl;
542
543 //PosAtDetOut
544
545
546 H_Alpha->Fill(Alpha2InDeg);
547 if (PosAtDetIn.X() < 0. && PosAtDetIn.Y() > 0) {
548 if (ElTheta <= 25) {
549 H_Alpha_UpLeft_RegularTheta->Fill(Alpha2InDeg);
550 H_Alpha_XYposAtDet_RegularTheta->Fill(PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
551 }
552 H_Alpha_UpLeft->Fill(Alpha2InDeg);
553 H_Alpha_UpLeft_II->Fill(AlphaInDeg);
554 H_Alpha_XYposAtDet->Fill(PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
555
556 if (PosAtDetIn.X() <= PMTPlaneCenterX) {
557 H_Alpha_UpLeft_LeftHalf->Fill(Alpha2InDeg);
558 H_Alpha_XYposAtDet_LeftHalf->Fill(PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
559 }
560 if (PosAtDetIn.X() > PMTPlaneCenterX) {
561 H_Alpha_UpLeft_RightHalf->Fill(Alpha2InDeg);
562 H_Alpha_XYposAtDet_RightHalf->Fill(PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
563 }
564 if (PosAtDetIn.X() <= PMTPlaneThirdX) {
565 H_Alpha_UpLeft_Left2Thirds->Fill(Alpha2InDeg);
566 H_Alpha_XYposAtDet_Left2Thirds->Fill(PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
567 }
568 if (PosAtDetIn.X() > PMTPlaneThirdX) {
569 H_Alpha_UpLeft_RightThird->Fill(Alpha2InDeg);
570 H_Alpha_XYposAtDet_RightThird->Fill(PosAtDetIn.X(), PosAtDetIn.Y(), Alpha2InDeg);
571 }
572 }
573 }
574
575 //***********************************************************
576 Int_t nofHits = fRichHits->GetEntriesFast();
577
578 for (Int_t iH = 0; iH < nofHits; iH++) {
579 CbmRichHit* hit = (CbmRichHit*) fRichHits->At(iH);
580 if (hit == NULL) continue;
581 Int_t pointInd = hit->GetRefId();
582 if (pointInd < 0) continue;
583 CbmRichPoint* point = (CbmRichPoint*) fRichPoints->At(pointInd);
584 if (point == NULL) continue;
585
586 // H_NofPhotonsPerHit->Fill(hit->GetNPhotons());
587
588 TVector3 inPos(point->GetX(), point->GetY(), point->GetZ());
589 TVector3 outPos;
591 H_Hits_XY->Fill(hit->GetX(), hit->GetY());
592
593 if (hit->GetX() <= PMTPlaneCenterX) {
594 H_Hits_XY_LeftHalf->Fill(hit->GetX(), hit->GetY());
595 }
596 if (hit->GetX() > PMTPlaneCenterX) {
597 H_Hits_XY_RightHalf->Fill(hit->GetX(), hit->GetY());
598 }
599 if (hit->GetX() <= PMTPlaneThirdX) {
600 H_Hits_XY_Left2Thirds->Fill(hit->GetX(), hit->GetY());
601 }
602 if (hit->GetX() > PMTPlaneThirdX) {
603 H_Hits_XY_RightThird->Fill(hit->GetX(), hit->GetY());
604 }
605
606 H_DiffXhit->Fill(hit->GetX() - outPos.X());
607 H_DiffYhit->Fill(hit->GetY() - outPos.Y());
608 }
609}
610
613{
614 Int_t nofRings = fRichRings->GetEntriesFast();
615 for (Int_t iR = 0; iR < nofRings; iR++) {
616 CbmRichRing* ring = (CbmRichRing*) fRichRings->At(iR);
617 if (NULL == ring) continue;
618 CbmTrackMatchNew* ringMatch = (CbmTrackMatchNew*) fRichRingMatches->At(iR);
619 if (NULL == ringMatch || ringMatch->GetNofLinks() < 1) {
620 // H_NofRings->SetBinContent(8,H_NofRings->GetBinCenter(8)+1);
621 continue;
622 }
623
624 Int_t mcTrackId = ringMatch->GetMatchedLink().GetIndex();
625 if (mcTrackId < 0) {
626 //H_NofRings->SetBinContent(8,H_NofRings->GetBinCenter(8)+1);
627 continue;
628 } //{ continue;}
629 CbmMCTrack* mcTrack = (CbmMCTrack*) fMcTracks->At(mcTrackId);
630 if (!mcTrack) {
631 //H_NofRings->SetBinContent(8,H_NofRings->GetBinCenter(8)+1);
632 continue;
633 } // continue;
634
635 Int_t motherId = mcTrack->GetMotherId();
636 Int_t pdg = TMath::Abs(mcTrack->GetPdgCode());
637 if (pdg != 11 || motherId != -1) {
638 //H_NofRings->SetBinContent(8,H_NofRings->GetBinCenter(8)+1);
639 continue;
640 } // continue; // only primary electrons
641
642 Double_t momentum = mcTrack->GetP();
643 Double_t pt = mcTrack->GetPt();
644 Double_t rapidity = mcTrack->GetRapidity();
645
646 TVector3 mom;
647 mcTrack->GetMomentum(mom);
648 Double_t theta = mom.Theta() * 180 / TMath::Pi();
649 H_MomRing->Fill(momentum);
650 H_Mom_Theta_Rec->Fill(momentum, theta);
651 H_Pt_Theta_Rec->Fill(pt, theta);
652
653 // Double_t theta = mcTrack->Theta();
654 // cout<<" **************************** "<<theta<<endl;
655
656 H_NofRings->Fill(nofRings);
657 if (ring->GetNofHits() >= fMinNofHits) {
658 H_Mom_Theta_Acc->Fill(momentum, theta);
659 H_Pt_Theta_Acc->Fill(pt, theta);
660 H_acc_mom_el->Fill(momentum);
661 if (theta <= 25) {
662 H_acc_mom_el_RegularTheta->Fill(momentum);
663 }
664
665 H_acc_pty_el->Fill(rapidity, pt);
666 }
667
669 float radius = ring->GetRadius();
670 if (radius <= 0.) {
671 continue;
672 } //with ideal finder --> many rings with radius -1.
673 //Test if radius is a NAN:
674 if (!(radius <= 1. || radius > 1.)) {
675 continue;
676 }
677 float aA = ring->GetAaxis();
678 float bA = ring->GetBaxis();
679
680 H_Radius->Fill(radius);
681 H_aAxis->Fill(aA);
682 H_bAxis->Fill(bA);
683 H_boa->Fill(bA / aA);
684
685 float CentX = ring->GetCenterX();
686 float CentY = ring->GetCenterY();
687
688 H_RingCenter->Fill(CentX, CentY);
689 H_RingCenter_Aaxis->Fill(CentX, CentY, aA);
690 H_RingCenter_Baxis->Fill(CentX, CentY, bA);
691 //cout << "PMT size in x and y [cm]: " << fGP.fPmtWidthX << " " << fGP.fPmtWidthY << endl;
692 if (theta <= 25 && theta >= 24.9) {
693 H_Mom_XY_Theta25->Fill(CentX, CentY, momentum);
694 }
695
696 H_RingCenter_boa->Fill(CentX, CentY, bA / aA);
697 if (theta <= 25) {
698 H_boa_RegularTheta->Fill(bA / aA);
699 H_RingCenter_boa_RegularTheta->Fill(CentX, CentY, bA / aA);
700 }
701 if (CentX > PMTPlaneCenterX) {
702 H_boa_RightHalf->Fill(bA / aA);
703 H_RingCenter_boa_RightHalf->Fill(CentX, CentY, bA / aA);
704 }
705 if (CentX <= PMTPlaneCenterX) {
706 H_boa_LeftHalf->Fill(bA / aA);
707 H_RingCenter_boa_LeftHalf->Fill(CentX, CentY, bA / aA);
708 }
709 if (CentX > PMTPlaneThirdX) {
710 H_boa_RightThird->Fill(bA / aA);
711 H_RingCenter_boa_RightThird->Fill(CentX, CentY, bA / aA);
712 }
713 if (CentX <= PMTPlaneThirdX) {
714 H_boa_Left2Thirds->Fill(bA / aA);
715 H_RingCenter_boa_Left2Thirds->Fill(CentX, CentY, bA / aA);
716 }
717
718
719 // if(CentX <= PMTPlaneCenterX && CentY >PMTPlaneCenterY){H_boa_Q1->Fill(bA/aA);}
720 int nAllHitsInR = ring->GetNofHits();
721 H_NofHitsAll->Fill(nAllHitsInR);
722 H_NofRings_NofHits->Fill(nofRings, nAllHitsInR);
723
724 for (int iH = 0; iH < nAllHitsInR; iH++) {
725 CbmRichHit* hit = (CbmRichHit*) fRichHits->At(ring->GetHit(iH));
726 double xH = hit->GetX();
727 double yH = hit->GetY();
728 double dRaa = aA - TMath::Sqrt((CentX - xH) * (CentX - xH) + (CentY - yH) * (CentY - yH));
729 H_dR_aa->Fill(dRaa);
730 double dR = radius - TMath::Sqrt((CentX - xH) * (CentX - xH) + (CentY - yH) * (CentY - yH));
731 H_dR->Fill(dR);
732 H_RingCenter_dR->Fill(CentX, CentY, dR);
733 if (theta <= 25) {
734 H_dR_RegularTheta->Fill(dR);
735 H_RingCenter_dR_RegularTheta->Fill(CentX, CentY, dR);
736 }
737 if (CentX > PMTPlaneCenterX) {
738 H_dR_RightHalf->Fill(dR);
739 H_RingCenter_dR_RightHalf->Fill(CentX, CentY, dR);
740 }
741 if (CentX <= PMTPlaneCenterX) {
742 H_dR_LeftHalf->Fill(dR);
743 H_RingCenter_dR_LeftHalf->Fill(CentX, CentY, dR);
744 }
745 if (CentX > PMTPlaneThirdX) {
746 H_dR_RightThird->Fill(dR);
747 H_RingCenter_dR_RightThird->Fill(CentX, CentY, dR);
748 }
749 if (CentX <= PMTPlaneThirdX) {
750 H_dR_Left2Thirds->Fill(dR);
751 H_RingCenter_dR_Left2Thirds->Fill(CentX, CentY, dR);
752 }
753 }
754 }
755}
756
759{
760 for (Int_t i = 0; i < fMcTracks->GetEntriesFast(); i++) {
761 CbmMCTrack* mcTrack = (CbmMCTrack*) fMcTracks->At(i);
762 if (!mcTrack) continue;
763 Int_t motherId = mcTrack->GetMotherId();
764 Int_t pdg = TMath::Abs(mcTrack->GetPdgCode());
765
766 TVector3 mom;
767 mcTrack->GetMomentum(mom);
768 Double_t theta = mom.Theta() * 180 / TMath::Pi();
769
770 if (pdg == 11 && motherId == -1) {
771
772 H_MomPt->Fill(mcTrack->GetP(), mcTrack->GetPt());
773 H_MomPrim->Fill(mcTrack->GetP());
774 H_PtPrim->Fill(mcTrack->GetPt());
775 H_Mom_Theta_MC->Fill(mcTrack->GetP(), theta);
776 H_Pt_Theta_MC->Fill(mcTrack->GetPt(), theta);
777 if (theta <= 25) {
778 H_MomPrim_RegularTheta->Fill(mcTrack->GetP());
779 }
780 }
781 }
782}
783
786{
787 // int nBinsX = 28; double xMin = -110.; double xMax = 110.;
788 // int nBinsY = 40; double yMin = -200; double yMax = 200.;
789
791 new TH1D("H_Diff_LineRefPMT_MomAtPMT", "H_Diff_LineRefPMT_MomAtPMT;#Delta [cm]; Yield", 100, -10., 10.);
792
793 H_Theta_TwoVectors = new TH1D("H_Theta_TwoVectors", "H_Theta_TwoVectors;#theta [deg]; Yield", 100, 0., 10.);
794 H_MomRing = new TH1D("H_MomRing", "H_MomRing;p [GeV]; Yield", 49, 0., 12.);
795 H_MomPrim = new TH1D("H_MomPrim", "H_MomPrim;p [GeV]; Yield", 49, 0., 12.);
796 H_PtPrim = new TH1D("H_PtPrim", "H_PtPrim;p [GeV]; Yield", 81, 0., 4.);
797 H_MomPt = new TH2D("H_MomPt", "H_MomPt;p [GeV];pt [GeV]; Yield", 101, 0., 10., 81, 0., 4.);
798 H_Mom_Theta_MC = new TH2D("H_Mom_Theta_MC", "H_Mom_Theta_MC;p [GeV];theta [deg]; Yield", 40, 0., 10., 50, 0, 25.);
799 H_Pt_Theta_MC = new TH2D("H_Pt_Theta_MC", "H_Pt_Theta_MC;pt [GeV];theta [deg]; Yield", 16, 0., 4., 50, 0, 25.);
800
801 H_Mom_Theta_Rec = new TH2D("H_Mom_Theta_Rec", "H_Mom_Theta_Rec;p [GeV];theta [deg]; Yield", 40, 0., 10., 50, 0, 25.);
802 H_Pt_Theta_Rec = new TH2D("H_Pt_Theta_Rec", "H_Pt_Theta_Rec;pt [GeV];theta [deg]; Yield", 16, 0., 4., 50, 0, 25.);
803 H_Mom_Theta_Acc = new TH2D("H_Mom_Theta_Acc", "H_Mom_Theta_Acc;p [GeV];theta [deg]; Yield", 40, 0., 10., 50, 0, 25.);
804 H_Pt_Theta_Acc = new TH2D("H_Pt_Theta_Acc", "H_Pt_Theta_Acc;pt [GeV];theta [deg]; Yield", 16, 0., 4., 50, 0, 25.);
805
806 H_MomPrim_RegularTheta = new TH1D("H_MomPrim_RegularTheta", "H_MomPrim_RegularTheta;p [GeV]; Yield", 49, 0., 12.);
808 new TH1D("H_acc_mom_el_RegularTheta", "H_acc_mom_el_RegularTheta;p [GeV/c];Yield", 49, 0., 12.);
809
810
811 H_Hits_XY = new TH2D("H_Hits_XY", "H_Hits_XY;X [cm];Y [cm];Counter", 151, -150., 0., 351, 0., 350.);
813 new TH2D("H_Hits_XY_LeftHalf", "H_Hits_XY_LeftHalf;X [cm];Y [cm];Counter", 151, -150., 0., 351, 0., 350.);
815 new TH2D("H_Hits_XY_RightHalf", "H_Hits_XY_RightHalf;X [cm];Y [cm];Counter", 151, -150., 0., 351, 0., 350.);
817 new TH2D("H_Hits_XY_RightThird", "H_Hits_XY_RightThird;X [cm];Y [cm];Counter", 151, -150., 0., 351, 0., 350.);
819 new TH2D("H_Hits_XY_Left2Thirds", "H_Hits_XY_Left2Thirds;X [cm];Y [cm];Counter", 151, -150., 0., 351, 0., 350.);
820
821 H_PointsIn_XY = new TH2D("H_PointsIn_XY", "H_PointsIn_XY;X [cm];Y [cm];Counter", 151, -150., 0., 251, 50., 250.);
823 new TH2D("H_PointsIn_XY_LeftHalf", "H_PointsIn_XY_LeftHalf;X [cm];Y [cm];Counter", 151, -150., 0., 251, 50., 250.);
824 H_PointsIn_XY_RightHalf = new TH2D("H_PointsIn_XY_RightHalf", "H_PointsIn_XY_RightHalf;X [cm];Y [cm];Counter", 151,
825 -150., 0., 251, 50., 250.);
826 H_PointsIn_XY_RightThird = new TH2D("H_PointsIn_XY_RightThird", "H_PointsIn_XY_RightThird;X [cm];Y [cm];Counter", 151,
827 -150., 0., 251, 50., 250.);
828 H_PointsIn_XY_Left2Thirds = new TH2D("H_PointsIn_XY_Left2Thirds", "H_PointsIn_XY_Left2Thirds;X [cm];Y [cm];Counter",
829 151, -150., 0., 251, 50., 250.);
830
831 H_PointsOut_XY = new TH2D("H_PointsOut_XY", "H_PointsOut_XY;X [cm];Y [cm];Counter", 151, -150., 0., 351, 0., 350.);
832 //cout<<" init hist H_NofPhotonsPerEv"<<endl;
834 new TH1D("H_NofPhotonsPerEv", "H_NofPhotonsPerEv;Number of photons per event;Yield", 500, 0., 1000.);
836 new TH1D("H_NofPhotonsPerHit", "H_NofPhotonsPerHit;Number of photons per hit;Yield", 10, -0.5, 9.5);
838 new TH1D("H_NofPhotonsSmallerThan30", "H_NofPhotonsSmallerThan30 ;Number of photons;Yield", 10, -0.5, 9.5);
839 H_DiffXhit = new TH1D("H_DiffXhit", "H_DiffXhit;Y_{point}-Y_{hit} [cm];Yield", 200, -1., 1.);
840 H_DiffYhit = new TH1D("H_DiffYhit", "H_DiffYhit;Y_{point}-Y_{hit} [cm];Yield", 200, -1., 1.);
841
842 H_Alpha = new TH1D("H_Alpha", "H_Alpha;#alpha_{photon-PMT} [deg];Yield", 180, 0., 180.);
843 H_Alpha_UpLeft = new TH1D("H_Alpha_UpLeft", "H_Alpha_UpLeft;#alpha_{photon-PMT} [deg];Yield", 180, 0., 180.);
844 H_Alpha_UpLeft_II = new TH1D("H_Alpha_UpLeft_II", "H_Alpha_UpLeft_II;#alpha_{photon-PMT} [deg];Yield", 180, 0., 180.);
845 H_Alpha_UpLeft_RegularTheta = new TH1D("H_Alpha_UpLeft_RegularTheta",
846 "H_Alpha_UpLeft_RegularTheta;#alpha_{photon-PMT} [deg];Yield", 180, 0., 180.);
847
849 new TH1D("H_Alpha_UpLeft_LeftHalf", "H_Alpha_UpLeft_LeftHalf;#alpha_{photon-PMT} [deg];Yield", 180, 0., 180.);
851 new TH1D("H_Alpha_UpLeft_RightHalf", "H_Alpha_UpLeft_RightHalf;#alpha_{photon-PMT} [deg];Yield", 180, 0., 180.);
853 new TH1D("H_Alpha_UpLeft_Left2Thirds", "H_Alpha_UpLeft_Left2Thirds;#alpha_{photon-PMT} [deg];Yield", 180, 0., 180.);
855 new TH1D("H_Alpha_UpLeft_RightThird", "H_Alpha_UpLeft_RightThird;#alpha_{photon-PMT} [deg];Yield", 180, 0., 180.);
856
857 //cout<<" init hist H_Alpha_XYposAtDet"<<endl;
859 new TH3D("H_Alpha_XYposAtDet", "H_Alpha_XYposAtDet; X [cm]; Y [cm];#alpha_{photon-PMT} [deg];Yield", 151, -150., 0.,
860 251, 50, 250, 180, 0., 180.);
861 H_Alpha_XYposAtDet_RegularTheta = new TH3D("H_Alpha_XYposAtDet_RegularTheta",
862 "H_Alpha_XYposAtDet_RegularTheta; X [cm]; Y "
863 "[cm];#alpha_{photon-PMT} [deg];Yield",
864 151, -150., 0., 251, 50, 250, 180, 0., 180.);
865 H_Alpha_XYposAtDet_LeftHalf = new TH3D("H_Alpha_XYposAtDet_LeftHalf",
866 "H_Alpha_XYposAtDet_LeftHalf; X [cm]; Y [cm];#alpha_{photon-PMT} "
867 "[deg];Yield",
868 151, -150., 0., 251, 50, 250, 180, 0., 180.);
869 H_Alpha_XYposAtDet_RightHalf = new TH3D("H_Alpha_XYposAtDet_RightHalf",
870 "H_Alpha_XYposAtDet_RightHalf; X [cm]; Y [cm];#alpha_{photon-PMT} "
871 "[deg];Yield",
872 151, -150., 0., 251, 50, 250, 180, 0., 180.);
873 H_Alpha_XYposAtDet_Left2Thirds = new TH3D("H_Alpha_XYposAtDet_Left2Thirds",
874 "H_Alpha_XYposAtDet_Left2Thirds; X [cm]; Y "
875 "[cm];#alpha_{photon-PMT} [deg];Yield",
876 151, -150., 0., 251, 50, 250, 180, 0., 180.);
877 H_Alpha_XYposAtDet_RightThird = new TH3D("H_Alpha_XYposAtDet_RightThird",
878 "H_Alpha_XYposAtDet_RightThird; X [cm]; Y "
879 "[cm];#alpha_{photon-PMT} [deg];Yield",
880 151, -150., 0., 251, 50, 250, 180, 0., 180.);
881
883 H_dFocalPoint_Delta = new TH1D("H_dFocalPoint_Delta", "H_dFocalPoint_Delta;#Delta_{f} [mm];Yield", 80, -20., 20.);
884 H_dFocalPoint_Rho = new TH1D("H_dFocalPoint_Rho", "H_dFocalPoint_Rho;#rho_{f} [mm];Yield", 150, 50., 200.);
885
886 //cout<<" init hist H_acc_mom_el"<<endl;
887
889 // Detector acceptance efficiency vs. (pt,y) and p
890 H_acc_mom_el = new TH1D("H_acc_mom_el", "H_acc_mom_el;p [GeV/c];Yield", 49, 0., 12.);
891 H_acc_pty_el = new TH2D("H_acc_pty_el", "H_acc_pty_el;Rapidity;P_{t} [GeV/c];Yield", 25, 0., 4., 61, 0., 10.);
892 H_Mom_XY_Theta25 = new TH3D("H_Mom_XY_Theta25", "H_Mom_XY_Theta25", 151, -150, 0, 351, 0, 350, 121, 0.,
893 12.); //25, 0., 4., 61, 0., 10.);
895
896 H_NofHitsAll = new TH1D("H_NofHitsAll", "H_NofHitsAll;Nof hits in ring;Yield", 50, 0., 50.);
897 H_NofRings = new TH1D("H_NofRings", "H_NofRings;Nof rings per event;Yield", 10, 0., 10.);
898 H_NofRings_NofHits = new TH2D("H_NofRings_NofHits", "H_NofRings_NofHits;Nof rings per event, Nof hits per ring;Yield",
899 10, 0., 10., 50, 0., 50.);
900
902 H_Radius = new TH1D("H_Radius", "H_Radius", 401, 2., 6.);
903 H_aAxis = new TH1D("H_aAxis", "H_aAxis", 401, 2., 10.);
904 H_bAxis = new TH1D("H_bAxis", "H_bAxis", 401, 2., 10.);
905 H_boa = new TH1D("H_boa", "H_boa", 51, 0.5, 1.);
906 H_boa_RegularTheta = new TH1D("H_boa_RegularTheta", "H_boa_RegularTheta", 51, 0.5, 1.);
907 H_boa_LeftHalf = new TH1D("H_boa_LeftHalf", "H_boa_LeftHalf", 51, 0.5, 1.);
908 H_boa_RightHalf = new TH1D("H_boa_RightHalf", "H_boa_RightHalf", 51, 0.5, 1.);
909 H_boa_Left2Thirds = new TH1D("H_boa_Left2Thirds", "H_boa_Left2Thirds", 51, 0.5, 1.);
910 H_boa_RightThird = new TH1D("H_boa_RightThird", "H_boa_RightThird", 51, 0.5, 1.);
911
912
913 H_dR_aa = new TH1D("H_dR_aa", "H_dR_aa", 61, -3., 3.);
914 H_dR = new TH1D("H_dR", "H_dR", 61, -3., 3.);
915 H_dR_RegularTheta = new TH1D("H_dR_RegularTheta", "H_dR_RegularTheta", 61, -3., 3.);
916 H_dR_LeftHalf = new TH1D("H_dR_LeftHalf", "H_dR_LeftHalf", 61, -3., 3.);
917 H_dR_RightHalf = new TH1D("H_dR_RightHalf", "H_dR_RightHalf", 61, -3., 3.);
918 H_dR_Left2Thirds = new TH1D("H_dR_Left2Thirds", "H_dR_Left2Thirds", 61, -3., 3.);
919 H_dR_RightThird = new TH1D("H_dR_RightThird", "H_dR_RightThird", 61, -3., 3.);
920
921 //cout<<" init hist H_RingCenter"<<endl;
922
923 H_RingCenter = new TH2D("H_RingCenter", "H_RingCenter", 201, -100., 0., 351, 0., 350.);
924
925 H_RingCenter_Aaxis = new TH3D("H_RingCenter_Aaxis", "H_RingCenter_Aaxis", 151, -150, 0, 351, 0, 350, 80, 2., 10.);
926 H_RingCenter_Baxis = new TH3D("H_RingCenter_Baxis", "H_RingCenter_Baxis", 151, -150, 0, 351, 0, 350, 80, 2., 10.);
927 H_RingCenter_boa = new TH3D("H_RingCenter_boa", "H_RingCenter_boa", 151, -150, 0, 351, 0, 350, 51, 0.5, 1.);
929 new TH3D("H_RingCenter_boa_RegularTheta", "H_RingCenter_boa_RegularTheta", 151, -150, 0, 351, 0, 350, 51, 0.5, 1.);
931 new TH3D("H_RingCenter_boa_LeftHalf", "H_RingCenter_boa_LeftHalf", 151, -150, 0, 351, 0, 350, 51, 0.5, 1.);
933 new TH3D("H_RingCenter_boa_RightHalf", "H_RingCenter_boa_RightHalf", 151, -150, 0, 351, 0, 350, 51, 0.5, 1.);
935 new TH3D("H_RingCenter_boa_Left2Thirds", "H_RingCenter_boa_Left2Thirds", 151, -150, 0, 351, 0, 350, 51, 0.5, 1.);
937 new TH3D("H_RingCenter_boa_RightThird", "H_RingCenter_boa_RightThird", 151, -150, 0, 351, 0, 350, 51, 0.5, 1.);
938
939 H_RingCenter_dR = new TH3D("H_RingCenter_dR", "H_RingCenter_dR", 151, -150, 0, 351, 0, 350, 61, -3., 3.);
941 new TH3D("H_RingCenter_dR_RegularTheta", "H_RingCenter_dR_RegularTheta", 151, -150, 0, 351, 0, 350, 61, -3., 3.);
943 new TH3D("H_RingCenter_dR_LeftHalf", "H_RingCenter_dR_LeftHalf", 151, -150, 0, 351, 0, 350, 61, -3., 3.);
945 new TH3D("H_RingCenter_dR_RightHalf", "H_RingCenter_dR_RightHalf", 151, -150, 0, 351, 0, 350, 61, -3., 3.);
947 new TH3D("H_RingCenter_dR_Left2Thirds", "H_RingCenter_dR_Left2Thirds", 151, -150, 0, 351, 0, 350, 61, -3., 3.);
949 new TH3D("H_RingCenter_dR_RightThird", "H_RingCenter_dR_RightThird", 151, -150, 0, 351, 0, 350, 61, -3., 3.);
950}
953{
954
956 H_Theta_TwoVectors->Write();
957 H_MomRing->Write();
958 H_MomPrim->Write();
959 H_PtPrim->Write();
960 H_MomPt->Write();
961
962 H_Mom_Theta_MC->Write();
963 H_Pt_Theta_MC->Write();
964 H_Mom_Theta_Rec->Write();
965 H_Pt_Theta_Rec->Write();
966 H_Mom_Theta_Acc->Write();
967 H_Pt_Theta_Acc->Write();
968
969 H_Mom_XY_Theta25->Write();
970
971 H_MomPrim_RegularTheta->Write();
973 H_Hits_XY->Write();
974 H_Hits_XY_LeftHalf->Write();
975 H_Hits_XY_RightHalf->Write();
976 H_Hits_XY_RightThird->Write();
977 H_Hits_XY_Left2Thirds->Write();
978
979 H_PointsIn_XY->Write();
980 H_PointsIn_XY_LeftHalf->Write();
984
985 H_PointsOut_XY->Write();
986 H_NofPhotonsPerEv->Write();
987 H_NofPhotonsPerHit->Write();
989 H_DiffXhit->Write();
990 H_DiffYhit->Write();
991
992 H_Alpha->Write();
993 H_Alpha_UpLeft->Write();
994 H_Alpha_UpLeft_II->Write();
1000
1001 H_Alpha_XYposAtDet->Write();
1007
1008
1009 H_acc_mom_el->Write();
1010 H_acc_pty_el->Write();
1011
1012 H_dFocalPoint_Delta->Write();
1013 H_dFocalPoint_Rho->Write();
1014 H_NofHitsAll->Write();
1015 H_NofRings->Write();
1016 H_NofRings_NofHits->Write();
1017 H_Radius->Write();
1018 H_aAxis->Write();
1019 H_bAxis->Write();
1020
1021 H_boa->Write();
1022 H_boa_RegularTheta->Write();
1023 H_boa_LeftHalf->Write();
1024 H_boa_RightHalf->Write();
1025 H_boa_Left2Thirds->Write();
1026 H_boa_RightThird->Write();
1027
1028 H_dR_aa->Write();
1029 H_dR->Write();
1030 H_dR_RegularTheta->Write();
1031 H_dR_LeftHalf->Write();
1032 H_dR_RightHalf->Write();
1033 H_dR_Left2Thirds->Write();
1034 H_dR_RightThird->Write();
1035
1036 H_RingCenter->Write();
1037 H_RingCenter_Aaxis->Write();
1038 H_RingCenter_Baxis->Write();
1039
1040 H_RingCenter_boa->Write();
1046
1047 H_RingCenter_dR->Write();
1049 H_RingCenter_dR_LeftHalf->Write();
1053}
1057{
1058 Int_t nofPoints = fRichPoints->GetEntriesFast();
1059 for (Int_t ip = 0; ip < nofPoints; ip++) {
1060 CbmRichPoint* point = (CbmRichPoint*) fRichPoints->At(ip);
1061 if (NULL == point) continue;
1062 int trackId = point->GetTrackID();
1063 if (trackId < 0) continue;
1064 if (trackId == TrackIdOfSensPlane) { //cout<<"In Function: got corresponding trackid:"<<trackId<<endl;
1065 return point;
1066 }
1067 }
1068 return NULL;
1069}
1072{
1073
1074 for (unsigned int p = 0; p < PMTPlanePoints.size(); p++) {
1075 if (PMTPlanePoints[p].X() != -1000.) {
1076 if (p == 0) {
1077 continue;
1078 }
1079 else {
1080 int PointFilled = 1;
1081 for (int p2 = p - 1; p2 > -1; p2--) {
1082 if (TMath::Abs(PMTPlanePoints[p2].X() - PMTPlanePoints[p].X()) < 1.0) {
1083 PointFilled = 0;
1084 }
1085 }
1086 if (PointFilled == 1) {
1087 continue;
1088 }
1089 }
1090 }
1091 Int_t nofPoints = fRichPoints->GetEntriesFast();
1092 // cout<<"We have "<<nofPoints<<" points registered on PMT plane"<<endl;
1093 for (Int_t ip = 0; ip < nofPoints - 10; ip += 10) {
1094 CbmRichPoint* point = (CbmRichPoint*) fRichPoints->At(ip);
1095 if (NULL == point) continue;
1096 int trackId = point->GetTrackID();
1097 if (trackId < 0) continue;
1098 if (point->GetX() >= 0 || point->GetY() <= 0) {
1099 continue;
1100 }
1101 cout << "FillPointsAtPMT: Fillinf point #" << p << " --> " << point->GetX() << ", " << point->GetY() << ", "
1102 << point->GetZ() << endl;
1103 PMTPlanePoints[p].SetX(point->GetX());
1104 PMTPlanePoints[p].SetY(point->GetY());
1105 PMTPlanePoints[p].SetZ(point->GetZ());
1106 if (PMTPlanePoints[p].X() != -1000.) {
1107 break;
1108 }
1109 }
1110 }
1111}
1114{
1115
1116 for (unsigned int p = 0; p < SensPlanePoints.size(); p++) {
1117 if (SensPlanePoints[p].X() != -1000.) {
1118 if (p == 0) {
1119 continue;
1120 }
1121 else {
1122 int PointFilled = 1;
1123 for (int p2 = p - 1; p2 > -1; p2--) {
1124 if (TMath::Abs(SensPlanePoints[p2].X() - SensPlanePoints[p].X()) < 1.0) {
1125 PointFilled = 0;
1126 }
1127 }
1128 if (PointFilled == 1) {
1129 continue;
1130 }
1131 }
1132 }
1133
1134 Int_t nofRefPoints = fRefPoints->GetEntriesFast();
1135 // cout<<"We have "<<nofRefPoints<<" points registered on sens plane"<<endl;
1136 for (Int_t ip = 0; ip < nofRefPoints - 10; ip += 10) {
1137 CbmRichPoint* RefPoint = (CbmRichPoint*) fRefPoints->At(ip);
1138 if (RefPoint == NULL) continue;
1139 int RefPointTrackId = RefPoint->GetTrackID();
1140 if (RefPointTrackId < 0) {
1141 continue;
1142 }
1143 if (RefPoint->GetX() >= 0 || RefPoint->GetY() <= 0) {
1144 continue;
1145 }
1146
1147 SensPlanePoints[p].SetX(RefPoint->GetX());
1148 SensPlanePoints[p].SetY(RefPoint->GetY());
1149 SensPlanePoints[p].SetZ(RefPoint->GetZ());
1150 if (SensPlanePoints[p].X() != -1000.) {
1151 break;
1152 }
1153 }
1154 }
1155}
1156
1158
1159
1161float CbmRichGeoOpt::GetIntersectionPointsLS(TVector3 MirrCenter, TVector3 G_P1, TVector3 G_P2, float R)
1162{
1163 float A = (G_P1 - MirrCenter) * (G_P1 - MirrCenter);
1164 float B = (G_P2 - G_P1) * (G_P2 - G_P1);
1165 float P = 2. * ((G_P1 - MirrCenter) * (G_P2 - G_P1)) / (B);
1166 float q = (A - R * R) / B;
1167
1168 float t1 = -1. * P / 2. - TMath::Sqrt((P / 2.) * (P / 2.) - q);
1169 float t2 = -1. * P / 2. + TMath::Sqrt((P / 2.) * (P / 2.) - q);
1170 //cout<<"t1="<<t1<<", t2="<<t2<<endl;
1171 //Check if nan --> no intersection
1172 if (!(t1 == 1. || t1 > 1.)) {
1173 return -1.;
1174 }
1175 //cout<<"t1="<<t1<<", t2="<<t2<<endl;
1176
1177 TVector3 IntersectP1;
1178 TVector3 IntersectP2;
1179 IntersectP1.SetX(G_P1.X() + t1 * (G_P2.X() - G_P1.X()));
1180 IntersectP1.SetY(G_P1.Y() + t1 * (G_P2.Y() - G_P1.Y()));
1181 IntersectP1.SetZ(G_P1.Z() + t1 * (G_P2.Z() - G_P1.Z()));
1182
1183 IntersectP2.SetX(G_P1.X() + t2 * (G_P2.X() - G_P1.X()));
1184 IntersectP2.SetY(G_P1.Y() + t2 * (G_P2.Y() - G_P1.Y()));
1185 IntersectP2.SetZ(G_P1.Z() + t2 * (G_P2.Z() - G_P1.Z()));
1186
1187 TVector3 Line1 = IntersectP1 - G_P1;
1188 float Length1 = TMath::Sqrt(Line1.X() * Line1.X() + Line1.Y() * Line1.Y() + Line1.Z() * Line1.Z());
1189 TVector3 Line2 = IntersectP2 - G_P1;
1190 float Length2 = TMath::Sqrt(Line2.X() * Line2.X() + Line2.Y() * Line2.Y() + Line2.Z() * Line2.Z());
1191
1192 //return Length1<Length2 ? Length1 : Length2;
1193 if (Length1 < Length2) {
1194 return Length1;
1195 }
1196 else {
1197 return Length2;
1198 }
1199}
1202{
1203 float XTerm = (PMTpoint.X() - MirrorCenter.X()) * (PMTpoint.X() - MirrorCenter.X());
1204 float YTerm = (PMTpoint.Y() - MirrorCenter.Y()) * (PMTpoint.Y() - MirrorCenter.Y());
1205 float ZTerm = (PMTpoint.Z() - MirrorCenter.Z()) * (PMTpoint.Z() - MirrorCenter.Z());
1206 return TMath::Sqrt(XTerm + YTerm + ZTerm);
1207}
1209bool CbmRichGeoOpt::CheckPointLiesOnPlane(TVector3 Point, TVector3 p0, TVector3 norm)
1210{
1211 double TolaratedDiff = 0.001;
1212 double ProdP0WithNorm = p0.Dot(norm); //cout<<"ProdP0WithNorm = "<<ProdP0WithNorm;
1213 double ProdPWithNorm = Point.Dot(norm); //cout<<" ProdPWithNorm = "<<ProdPWithNorm<<endl;
1214 return TMath::Abs(ProdP0WithNorm - ProdPWithNorm)
1215 <= ((TMath::Abs(ProdP0WithNorm) < TMath::Abs(ProdPWithNorm) ? TMath::Abs(ProdPWithNorm)
1216 : TMath::Abs(ProdP0WithNorm))
1217 * TolaratedDiff);
1218}
1226
1228//void CbmRichGeoOpt::GetPlaneCenter(float rotMir, float rotX, float rotY)
1229//{
1230// PMTPlaneCenterX=MinX+(MaxX-MinX)/2.; PMTPlaneCenterY=MinY+(MaxY-MinY)/2.;
1231//}
1232
1234bool CbmRichGeoOpt::CheckPointLiesOnSphere(TVector3 /*Point*/) { return true; }
1235
1237bool CbmRichGeoOpt::CheckLineIntersectsPlane(TVector3 /*Point*/) { return true; }
1239bool CbmRichGeoOpt::CheckLineIntersectsSphere(TVector3 /*Point*/) { return true; }
1242{
1243 // cout<<nPhotonsNotOnPlane<<" out of "<<nTotalPhorons<<" are not on the plane("<<float(nPhotonsNotOnPlane)/float(nTotalPhorons)<<")"<<endl;
1244 // cout<<nPhotonsNotOnSphere<<" out of "<<nTotalPhorons<<" are not on the ideal sphere("<<float(nPhotonsNotOnSphere)/float(nTotalPhorons)<<")"<<endl;
1246}
1247
1248
TH1F * H_aAxis
TH1F * H_dR
TH1F * H_boa
TH1F * H_bAxis
TH1F * H_Radius
ClassImp(CbmConverterManager)
Helper functions for drawing 1D and 2D histograms and graphs.
Optimization of the RICH geometry.
int32_t GetRefId() const
Definition CbmHit.h:73
double GetPt() const
Definition CbmMCTrack.h:97
double GetP() const
Definition CbmMCTrack.h:98
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
double GetRapidity() const
int32_t GetNofLinks() const
Definition CbmMatch.h:42
const CbmLink & GetMatchedLink() const
Definition CbmMatch.h:41
double GetY() const
Definition CbmPixelHit.h:74
double GetX() const
Definition CbmPixelHit.h:73
void RotatePoint(TVector3 *inPos, TVector3 *outPos, Bool_t noTilting=false)
CbmRichRecGeoPar * fGP
static CbmRichGeoManager & GetInstance()
Optimization of the RICH geometry.
TH1D * H_boa_RightThird
TH1D * H_Alpha_UpLeft_Left2Thirds
TH1D * H_dFocalPoint_Delta
TH1D * H_Theta_TwoVectors
TH1D * H_dR_RightHalf
TClonesArray * fRichRings
TH3D * H_RingCenter_dR
TClonesArray * fRichPoints
TH1D * H_dR_RightThird
TH2D * H_NofRings_NofHits
TH1D * H_Alpha_UpLeft_RightThird
vector< TVector3 > SensPlanePoints
TH1D * H_dFocalPoint_Rho
TH3D * H_RingCenter_dR_Left2Thirds
TVector3 MirrorCenter
TH3D * H_Alpha_XYposAtDet_RightThird
TH3D * H_RingCenter_boa_RegularTheta
TH3D * H_RingCenter_boa_LeftHalf
float GetDistanceMirrorCenterToPMTPoint(TVector3 PMTpoint)
calculate distance between mirror center and pmt-point.
TH1D * H_boa_RegularTheta
TH1D * H_acc_mom_el_RegularTheta
TH3D * H_Alpha_XYposAtDet_RightHalf
TH1D * H_Alpha_UpLeft_RegularTheta
double PMTPlaneCenterY
Int_t PMTPointsFilled
TH3D * H_RingCenter_Baxis
TH2D * H_PointsIn_XY_RightThird
TH3D * H_RingCenter_Aaxis
void FillPointsAtPMT()
get point coordinates.
void FillMcHist()
get MC Histos (P & Pt).
TH3D * H_RingCenter_dR_LeftHalf
TClonesArray * fRichHits
TH1D * H_NofPhotonsSmallerThan30
TH3D * H_Alpha_XYposAtDet
void InitHistograms()
Initialize histograms.
bool CheckPointLiesOnSphere(TVector3 Point)
TH2D * H_Mom_Theta_Acc
TH3D * H_Alpha_XYposAtDet_RegularTheta
TH2D * H_Mom_Theta_MC
virtual void Finish()
Inherited from FairTask.
TH2D * H_PointsOut_XY
TH1D * H_Diff_LineRefPMT_MomAtPMT
histograms.
TH1D * H_boa_LeftHalf
TH1D * H_NofPhotonsPerEv
TH1D * H_boa_Left2Thirds
CbmRichGeoOpt()
Standard constructor.
bool CheckLineIntersectsSphere(TVector3 Point)
Check if a given line intersects a given sphere.
TH2D * H_PointsIn_XY_LeftHalf
TH1D * H_Alpha_UpLeft
virtual void Exec(Option_t *option)
Inherited from FairTask.
TH1D * H_Alpha_UpLeft_II
TH2D * H_Pt_Theta_Rec
virtual ~CbmRichGeoOpt()
Standard destructor.
TH1D * H_Alpha_UpLeft_LeftHalf
TH3D * H_Alpha_XYposAtDet_Left2Thirds
TH3D * H_RingCenter_dR_RightThird
float GetIntersectionPointsLS(TVector3 MirrCenter, TVector3 G_P1, TVector3 G_P2, float R)
TH1D * H_dR_RegularTheta
TH1D * H_boa_RightHalf
TH2D * H_Hits_XY_RightThird
void FillPointsAtPMTSensPlane()
get senspoint coordinates.
TH3D * H_RingCenter_boa_Left2Thirds
void WriteHistograms()
write histograms to a root-file.
TH2D * H_PointsIn_XY_Left2Thirds
TH2D * H_Hits_XY_RightHalf
TH3D * H_RingCenter_boa_RightThird
void HitsAndPointsWithRef()
TH3D * H_Alpha_XYposAtDet_LeftHalf
vector< TVector3 > PMTPlanePoints
TH3D * H_RingCenter_dR_RightHalf
double PMTPlaneCenterX
bool CheckLineIntersectsPlane(TVector3 Point)
Check if a given line intersects a given plane.
TH1D * H_Alpha_UpLeft_RightHalf
TH3D * H_Mom_XY_Theta25
TClonesArray * fMcTracks
virtual InitStatus Init()
Inherited from FairTask.
TH3D * H_RingCenter_boa_RightHalf
CbmRichPoint * GetPMTPoint(int TrackIdOfSensPlane)
get a point coressponding to point at sens-plane.
TVector3 PMT_norm
TH2D * H_Pt_Theta_Acc
TVector3 PMTPlaneCenter
TH3D * H_RingCenter_dR_RegularTheta
TH1D * H_NofPhotonsPerHit
TH2D * H_Mom_Theta_Rec
double PMTPlaneThirdX
TH1D * H_dR_Left2Thirds
TH2D * H_Hits_XY_LeftHalf
TClonesArray * fRefPoints
TClonesArray * fRichRingMatches
TH2D * H_PointsIn_XY_RightHalf
TH1D * H_MomPrim_RegularTheta
bool CheckPointLiesOnPlane(TVector3 Point, TVector3 p0, TVector3 n)
Check if a given point lies on agiven plane.
TH3D * H_RingCenter_boa
void RingParameters()
Loop over all rings in array and fill ring parameters histograms.
TH2D * H_Hits_XY_Left2Thirds
PMT parameters for the RICH geometry.
CbmRichRecGeoParPmt fPmt
uint32_t GetHit(int32_t i) const
Definition CbmRichRing.h:39
float GetRadius() const
Definition CbmRichRing.h:79
double GetAaxis() const
Definition CbmRichRing.h:80
int32_t GetNofHits() const
Definition CbmRichRing.h:37
float GetCenterX() const
Definition CbmRichRing.h:77
float GetCenterY() const
Definition CbmRichRing.h:78
double GetBaxis() const
Definition CbmRichRing.h:81
Hash for CbmL1LinkKey.