37#include "FairGeoNode.h"
38#include "FairGeoTransform.h"
39#include "FairRootManager.h"
40#include "FairRunAna.h"
41#include "FairRuntimeDb.h"
43#include "TClonesArray.h"
52#include "TMCProcess.h"
87 LOG(fatal) <<
"CbmRichGeoTest::Init No RichDigi!";
90 LOG(fatal) <<
"CbmRichGeoTest::Init No RichDigiMatch!";
104 LOG(info) <<
"CbmRichGeoTest, event No. " <<
fEventNum;
122 fHM->
Create2<TH2D>(
"fhHitsXY",
"fhHitsXY;X [cm];Y [cm];Counter", nBinsX, xMin, xMax, nBinsY, yMin, yMax);
123 fHM->
Create2<TH2D>(
"fhPointsXY",
"fhPointsXY;X [cm];Y [cm];Counter", nBinsX, xMin, xMax, nBinsY, yMin, yMax);
124 fHM->
Create2<TH2D>(
"fhPointsXYNoRotation",
"fhPointsXYNoRotation;X [cm];Y [cm];Counter", nBinsX, xMin, xMax, nBinsY,
126 fHM->
Create1<TH1D>(
"fhHitsZ",
"fhHitsZ;Z [cm];Yield", 150, 100, 250);
127 fHM->
Create1<TH1D>(
"fhPointsZ",
"fhPointsZ;Z [cm];Yield", 150, 100, 250);
128 fHM->
Create1<TH1D>(
"fhMcVertexZEl",
"fhMcVertexZEl;Z [cm];Counter", 250, -100., 150);
129 fHM->
Create2<TH2D>(
"fhMcVertexXYEl",
"fhMcVertexXYEl;X [cm];Y [cm];Counter", 50, -5., 5., 50, -5., 5.);
131 vector<string> hp = {
"_hits",
"_points"};
132 for (
size_t i = 0; i < hp.size(); i++) {
134 if (i == 0)
fHM->
Create1<TH1D>(
"fhNofHits" + t,
"fhNofHits" + t +
";# hits/ring;Yield", 50, -.5, 49.5);
135 if (i == 1)
fHM->
Create1<TH1D>(
"fhNofHits" + t,
"fhNofHits" + t +
";# points/ring;Yield", 400, -.5, 399.5);
137 fHM->
Create2<TH2D>(
"fhBoAVsMom" + t,
"fhBoAVsMom" + t +
";P [GeV/c];B/A;Yield", 40, 0., 10, 100, 0, 1);
138 fHM->
Create2<TH2D>(
"fhXcYcEllipse" + t,
"fhXcYcEllipse" + t +
";X [cm];Y [cm];Yield", nBinsX, xMin, xMax, nBinsY,
140 fHM->
Create2<TH2D>(
"fhBaxisVsMom" + t,
"fhBaxisVsMom" + t +
";P [GeV/c];B axis [cm];Yield", 40, 0., 10, 200, 0.,
142 fHM->
Create2<TH2D>(
"fhAaxisVsMom" + t,
"fhAaxisVsMom" + t +
";P [GeV/c];A axis [cm];Yield", 40, 0., 10, 200, 0.,
144 fHM->
Create2<TH2D>(
"fhChi2EllipseVsMom" + t,
"fhChi2EllipseVsMom" + t +
";P [GeV/c];#Chi^{2};Yield", 40, 0., 10.,
147 fHM->
Create2<TH2D>(
"fhXcYcCircle" + t,
"fhXcYcCircle" + t +
";X [cm];Y [cm];Yield", nBinsX, xMin, xMax, nBinsY,
149 fHM->
Create2<TH2D>(
"fhRadiusVsMom" + t,
"fhRadiusVsMom" + t +
";P [GeV/c];Radius [cm];Yield", 40, 0., 10, 200, 0.,
151 fHM->
Create2<TH2D>(
"fhChi2CircleVsMom" + t,
"fhChi2CircleVsMom" + t +
";P [GeV/c];#Chi^{2};Yield", 40, 0., 10., 50,
153 fHM->
Create2<TH2D>(
"fhDRVsMom" + t,
"fhDRVsMom" + t +
";P [GeV/c];dR [cm];Yield", 40, 0, 10, 200, -2., 2.);
155 fHM->
Create1<TH1D>(
"fhBaxisUpHalf" + t,
"fhBaxisUpHalf" + t +
";B axis [cm];Yield", 200, 0., 10.);
156 fHM->
Create1<TH1D>(
"fhBaxisDownHalf" + t,
"fhBaxisDownHalf" + t +
";B axis [cm];Yield", 200, 0., 10.);
159 fHM->
Create1<TH1D>(
"fhNofPhotonsPerHit",
"fhNofPhotonsPerHit;Number of photons per hit;Yield", 10, -0.5, 9.5);
162 fHM->
Create2<TH2D>(
"fhDiffAaxis",
"fhDiffAaxis;# hits/ring;A_{point}-A_{hit} [cm];Yield", 25, 0., 50., 100, -1., 1.);
163 fHM->
Create2<TH2D>(
"fhDiffBaxis",
"fhDiffBaxis;# hits/ring;B_{point}-B_{hit} [cm];Yield", 25, 0., 50., 100, -1., 1.);
164 fHM->
Create2<TH2D>(
"fhDiffXcEllipse",
"fhDiffXcEllipse;# hits/ring;Xc_{point}-Xc_{hit} [cm];Yield", 25, 0., 50., 100,
166 fHM->
Create2<TH2D>(
"fhDiffYcEllipse",
"fhDiffYcEllipse;# hits/ring;Yc_{point}-Yc_{hit} [cm];Yield", 25, 0., 50., 100,
168 fHM->
Create2<TH2D>(
"fhDiffXcCircle",
"fhDiffXcCircle;# hits/ring;Xc_{point}-Xc_{hit} [cm];Yield", 25, 0., 50., 100,
170 fHM->
Create2<TH2D>(
"fhDiffYcCircle",
"fhDiffYcCircle;# hits/ring;Yc_{point}-Yc_{hit} [cm];Yield", 25, 0., 50., 100,
172 fHM->
Create2<TH2D>(
"fhDiffRadius",
"fhDiffRadius;# hits/ring;Radius_{point}-Radius_{hit} [cm];Yield", 25, 0., 50.,
176 fHM->
Create2<TH2D>(
"fhRadiusVsNofHits",
"fhRadiusVsNofHits;# hits/ring;Radius [cm];Yield", 40, 0., 40., 100, 0., 10.);
177 fHM->
Create2<TH2D>(
"fhAaxisVsNofHits",
"fhAaxisVsNofHits;# hits/ring;A axis [cm];Yield", 40, 0., 40., 100, 0., 10.);
178 fHM->
Create2<TH2D>(
"fhBaxisVsNofHits",
"fhBaxisVsNofHits;# hits/ring;B axis [cm];Yield", 40, 0., 40., 100, 0., 10.);
179 fHM->
Create2<TH2D>(
"fhDRVsNofHits",
"fhDRVsNofHits;# hits/ring;dR [cm];Yield", 40, 0., 40., 200, -2., 2.);
182 fHM->
Create1<TH1D>(
"fhDiffXhit",
"fhDiffXhit;X_{point}-X_{hit} [cm];Yield", 200, -.5, .5);
183 fHM->
Create1<TH1D>(
"fhDiffYhit",
"fhDiffYhit;Y_{point}-Y_{hit} [cm];Yield", 200, -.5, .5);
186 fHM->
Create1<TH1D>(
"fhNofHitsAll",
"fhNofHitsAll;# hits/ring;Yield", 50, 0., 50.);
187 fHM->
Create1<TH1D>(
"fhNofHitsCircleFit",
"fhNofHitsCircleFit;# hits/ring;Yield", 50, 0., 50.);
188 fHM->
Create1<TH1D>(
"fhNofHitsEllipseFit",
"fhNofHitsEllipseFit;# hits/ring;Yield", 50, 0., 50.);
189 fHM->
Create1<TH1D>(
"fhNofHitsCircleFitEff",
"fhNofHitsCircleFitEff;# hits/ring;Efficiency [%]", 50, 0., 50.);
190 fHM->
Create1<TH1D>(
"fhNofHitsEllipseFitEff",
"fhNofHitsEllipseFitEff;# hits/ring;Efficiency [%]", 50, 0., 50.);
193 vector<string> mcAccTypes{
"Mc",
"Acc"};
194 for (
const string& t : mcAccTypes) {
195 fHM->
Create1<TH1D>(
"fhMomEl" + t,
"fhMomEl" + t +
";p [GeV/c];Yield", 50, 0., 10.);
196 fHM->
Create2<TH2D>(
"fhPtYEl" + t,
"fhPtYEl" + t +
";Rapidity;P_{t} [GeV/c];Yield", 25, 0., 4., 25, 0., 3.);
197 fHM->
Create2<TH2D>(
"fhPYEl" + t,
"fhPYEl" + t +
";Rapidity;P [GeV/c];Yield", 25, 0., 4., 25, 0., 10.);
200 fHM->
Create1<TH1D>(
"fhMcMomPi",
"fhMcMomPi;p [GeV/c];Yield", 50, 0., 10.);
201 fHM->
Create2<TH2D>(
"fhMcPtyPi",
"fhMcPtyPi;Rapidity;P_{t} [GeV/c];Yield", 25, 0., 4., 25, 0., 3.);
204 fHM->
Create3<TH3D>(
"fhNofHitsXYZ",
"fhNofHitsXYZ;X [cm];Y [cm];# hits/ring", nBinsX, xMin, xMax, nBinsY, yMin, yMax,
206 fHM->
Create3<TH3D>(
"fhNofPointsXYZ",
"fhNofPointsXYZ;X [cm];Y [cm];# points/ring", nBinsX, xMin, xMax, nBinsY, yMin,
207 yMax, 50, 100., 300.);
208 fHM->
Create3<TH3D>(
"fhBoAXYZ",
"fhBoAXYZ;X [cm];Y [cm];B/A", nBinsX, xMin, xMax, nBinsY, yMin, yMax, 100, 0., 1.);
209 fHM->
Create3<TH3D>(
"fhBaxisXYZ",
"fhBaxisXYZ;X [cm];Y [cm];B axis [cm]", nBinsX, xMin, xMax, nBinsY, yMin, yMax, 80,
211 fHM->
Create3<TH3D>(
"fhAaxisXYZ",
"fhAaxisXYZ;X [cm];Y [cm];A axis [cm]", nBinsX, xMin, xMax, nBinsY, yMin, yMax, 80,
213 fHM->
Create3<TH3D>(
"fhRadiusXYZ",
"fhRadiusXYZ;X [cm];Y [cm];Radius [cm]", nBinsX, xMin, xMax, nBinsY, yMin, yMax, 80,
215 fHM->
Create3<TH3D>(
"fhdRXYZ",
"fhdRXYZ;X [cm];Y [cm];dR [cm]", nBinsX, xMin, xMax, nBinsY, yMin, yMax, 100, -1., 1.);
224 fHM->
Create2<TH2D>(
"fhNofHitsVsX",
"fhNofHitsVsX;X [cm];# hits/ring", nBinsX1, xMin1, xMax1, 50, 0., 50);
225 fHM->
Create2<TH2D>(
"fhNofHitsVsY",
"fhNofHitsVsY;Abs(Y) [cm];# hits/ring", nBinsY1, yMin1, yMax1, 50, 0., 50);
227 fHM->
Create2<TH2D>(
"fhNofPointsVsX",
"fhNofPointsVsX;X [cm];# points/ring", nBinsX1, xMin1, xMax1, 50, 100., 300.);
228 fHM->
Create2<TH2D>(
"fhNofPointsVsY",
"fhNofPointsVsY;Abs(Y) [cm];# points/ring", nBinsY1, yMin1, yMax1, 50, 100.,
231 fHM->
Create2<TH2D>(
"fhBoAVsX",
"fhBoAVsX;X [cm];B/A", nBinsX1, xMin1, xMax1, 100, 0., 1.);
232 fHM->
Create2<TH2D>(
"fhBoAVsY",
"fhBoAVsY;Abs(Y) [cm];B/A", nBinsY1, yMin1, yMax1, 100, 0., 1.);
234 fHM->
Create2<TH2D>(
"fhBaxisVsX",
"fhBaxisVsX;X [cm];B axis [cm]", nBinsX1, xMin1, xMax1, 80, 3., 7.);
235 fHM->
Create2<TH2D>(
"fhBaxisVsY",
"fhBaxisVsY;Abs(Y) [cm];B axis [cm]", nBinsY1, yMin1, yMax1, 80, 3., 7.);
237 fHM->
Create2<TH2D>(
"fhAaxisVsX",
"fhAaxisVsX;X [cm];A axis [cm]", nBinsX1, xMin1, xMax1, 80, 3., 7.);
238 fHM->
Create2<TH2D>(
"fhAaxisVsY",
"fhAaxisVsY;Abs(Y) [cm];A axis [cm]", nBinsY1, yMin1, yMax1, 80, 3., 7.);
240 fHM->
Create2<TH2D>(
"fhRadiusVsX",
"fhRadiusVsX;X [cm];Radius [cm]", nBinsX1, xMin1, xMax1, 80, 3., 7.);
241 fHM->
Create2<TH2D>(
"fhRadiusVsY",
"fhRadiusVsY;Abs(Y) [cm];Radius [cm]", nBinsY1, yMin1, yMax1, 80, 3., 7.);
243 fHM->
Create2<TH2D>(
"fhdRVsX",
"fhdRVsX;X [cm];dR [cm]", nBinsX1, xMin1, xMax1, 100, -1., 1.);
244 fHM->
Create2<TH2D>(
"fhdRVsY",
"fhdRVsY;Abs(Y) [cm];dR [cm]", nBinsY1, yMin1, yMax1, 100, -1., 1.);
247 vector<string> photonECat = {
"PlaneZ+",
"PlaneZ-",
"PmtPoint",
"PmtHit"};
248 for (
const auto& t : photonECat) {
249 fHM->
Create1<TH1D>(
"fhPhotonE" + t,
"fhPhotonE" + t +
";Photon energy [eV];Counter", 100, 0., 10.);
250 fHM->
Create1<TH1D>(
"fhLambda" + t,
"fhLambda" + t +
";Photon wavelength [nm];Counter", 100, 0., 700.);
257 for (
size_t iE = 0; iE < nofEvents; iE++) {
262 for (
int iT = 0; iT < nofMcTracks; iT++) {
264 if (mcTrack ==
nullptr)
continue;
267 bool isMcPrimaryElectron =
268 (pdgAbs == 11 && motherId == -1) || (mcTrack->
GetGeantProcessId() == kPPrimary && pdgAbs == 11);
270 if (isMcPrimaryElectron) {
271 fHM->
H1(
"fhMomElMc")->Fill(mcTrack->
GetP());
276 fHM->
H1(
"fhMcVertexZEl")->Fill(
v.Z());
277 fHM->
H1(
"fhMcVertexXYEl")->Fill(
v.X(),
v.Y());
280 if (pdgAbs == 211 && motherId == -1) {
281 fHM->
H1(
"fhMcMomPi")->Fill(mcTrack->
GetP());
287 for (
int iP = 0; iP < nofPoints; iP++) {
289 if (point ==
nullptr)
continue;
290 TVector3 inPos(point->GetX(), point->GetY(), point->GetZ());
293 fHM->
H2(
"fhPointsXYNoRotation")->Fill(point->GetX(), point->GetY());
294 fHM->
H2(
"fhPointsXY")->Fill(outPos.X(), outPos.Y());
295 fHM->
H1(
"fhPointsZ")->Fill(point->GetZ());
298 point->Momentum(mom);
299 double momMag = mom.Mag();
300 fHM->
H1(
"fhPhotonEPmtPoint")->Fill(1.e9 * momMag);
302 fHM->
H1(
"fhLambdaPmtPoint")->Fill(lambda);
306 for (
int iP = 0; iP < nofPlanePoints; iP++) {
308 if (point ==
nullptr)
continue;
310 point->Momentum(mom);
311 double momMag = mom.Mag();
313 if (point->GetPz() > 0) {
314 fHM->
H1(
"fhPhotonEPlaneZ+")->Fill(1.e9 * momMag);
315 fHM->
H1(
"fhLambdaPlaneZ+")->Fill(lambda);
318 fHM->
H1(
"fhPhotonEPlaneZ-")->Fill(1.e9 * momMag);
319 fHM->
H1(
"fhLambdaPlaneZ-")->Fill(lambda);
329 for (
int iPoint = 0; iPoint < nofRichPoints; iPoint++) {
331 if (richPoint ==
nullptr)
continue;
332 int trackId = richPoint->GetTrackID();
333 if (trackId < 0)
continue;
335 if (mcTrackRich ==
nullptr)
continue;
337 if (motherIdRich == mcTrackId) {
339 richPoint->Position(posPoint);
353 for (
int iR = 0; iR < nofRings; iR++) {
355 if (ring ==
nullptr)
continue;
357 if (ringMatch ==
nullptr || ringMatch->
GetNofLinks() < 1)
continue;
361 if (mcTrack ==
nullptr)
continue;
364 double mom = mcTrack->
GetP();
365 double pt = mcTrack->
GetPt();
367 bool isMcPrimaryElectron =
368 (pdgAbs == 11 && motherId == -1) || (mcTrack->
GetGeantProcessId() == kPPrimary && pdgAbs == 11);
371 if (isMcPrimaryElectron) {
372 fHM->
H1(
"fhMomElAcc")->Fill(mom);
373 fHM->
H2(
"fhPtYElAcc")->Fill(rapidity, pt);
374 fHM->
H2(
"fhPYElAcc")->Fill(rapidity, mom);
378 if (!isMcPrimaryElectron)
continue;
414 fHM->
H3(
"fhNofHitsXYZ")->Fill(xc, yc, nh);
415 fHM->
H3(
"fhNofPointsXYZ")->Fill(xc, yc, np);
416 fHM->
H3(
"fhBoAXYZ")->Fill(xc, yc, b / a);
417 fHM->
H3(
"fhBaxisXYZ")->Fill(xc, yc, b);
418 fHM->
H3(
"fhAaxisXYZ")->Fill(xc, yc, a);
419 fHM->
H3(
"fhRadiusXYZ")->Fill(xc, yc, r);
421 fHM->
H2(
"fhNofHitsVsX")->Fill(xc, nh);
422 fHM->
H2(
"fhNofPointsVsX")->Fill(xc, np);
423 fHM->
H2(
"fhBoAVsX")->Fill(xc, b / a);
424 fHM->
H2(
"fhBaxisVsX")->Fill(xc, b);
425 fHM->
H2(
"fhAaxisVsX")->Fill(xc, a);
426 fHM->
H2(
"fhRadiusVsX")->Fill(xc, r);
428 fHM->
H2(
"fhNofHitsVsY")->Fill(abs(yc), nh);
429 fHM->
H2(
"fhNofPointsVsY")->Fill(abs(yc), np);
430 fHM->
H2(
"fhBoAVsY")->Fill(abs(yc), b / a);
431 fHM->
H2(
"fhBaxisVsY")->Fill(abs(yc), b);
432 fHM->
H2(
"fhAaxisVsY")->Fill(abs(yc), a);
433 fHM->
H2(
"fhRadiusVsY")->Fill(abs(yc), r);
435 for (
int iH = 0; iH < ringHit.
GetNofHits(); iH++) {
438 double dr = r -
sqrt((xc - xh) * (xc - xh) + (yc - yh) * (yc - yh));
439 fHM->
H3(
"fhdRXYZ")->Fill(xc, yc, dr);
440 fHM->
H2(
"fhdRVsX")->Fill(xc, dr);
441 fHM->
H2(
"fhdRVsY")->Fill(abs(yc), dr);
455 string t = (histIndex == 0) ?
"_hits" :
"_points";
458 fHM->
H1(
"fhBoAVsMom" + t)->Fill(momentum, axisB / axisA);
459 fHM->
H2(
"fhXcYcEllipse" + t)->Fill(xcEllipse, ycEllipse);
461 fHM->
H1(
"fhNofHits" + t)->Fill(nofHitsRing);
463 if (ycEllipse > 149 || ycEllipse < -149) {
464 fHM->
H1(
"fhBaxisUpHalf" + t)->Fill(axisB);
467 fHM->
H1(
"fhBaxisDownHalf" + t)->Fill(axisB);
470 fHM->
H2(
"fhBaxisVsMom" + t)->Fill(momentum, axisB);
471 fHM->
H2(
"fhAaxisVsMom" + t)->Fill(momentum, axisA);
473 if (histIndex == 0) {
474 fHM->
H2(
"fhAaxisVsNofHits")->Fill(nofHitsRing, axisA);
475 fHM->
H2(
"fhBaxisVsNofHits")->Fill(nofHitsRing, axisB);
486 string t = (histIndex == 0) ?
"_hits" :
"_points";
488 fHM->
H1(
"fhXcYcCircle" + t)->Fill(xcCircle, ycCircle);
489 fHM->
H1(
"fhRadiusVsMom" + t)->Fill(momentum, radius);
492 for (
int iH = 0; iH < nofHitsRing; iH++) {
495 double dr = radius -
sqrt((xcCircle - xh) * (xcCircle - xh) + (ycCircle - yh) * (ycCircle - yh));
496 fHM->
H1(
"fhDRVsMom" + t)->Fill(momentum, dr);
498 if (histIndex == 0) {
499 fHM->
H2(
"fhDRVsNofHits")->Fill(nofHitsRing, dr);
503 if (histIndex == 0) {
504 fHM->
H2(
"fhRadiusVsNofHits")->Fill(nofHitsRing, radius);
526 int nofHits =
fRichHits->GetEntriesFast();
527 for (
int iH = 0; iH < nofHits; iH++) {
529 if (hit ==
nullptr)
continue;
531 if (digiIndex < 0)
continue;
533 if (digi ==
nullptr)
continue;
535 if (digiMatch ==
nullptr)
continue;
537 vector<CbmLink> links = digiMatch->
GetLinks();
538 for (
size_t i = 0; i < links.size(); i++) {
539 int pointId = links[i].GetIndex();
540 int eventId = links[i].GetEntry();
541 if (pointId < 0)
continue;
544 if (point ==
nullptr)
continue;
546 TVector3 inPos(point->GetX(), point->GetY(), point->GetZ());
549 fHM->
H1(
"fhDiffXhit")->Fill(hit->
GetX() - outPos.X());
550 fHM->
H1(
"fhDiffYhit")->Fill(hit->
GetY() - outPos.Y());
553 point->Momentum(mom);
554 double momMag = mom.Mag();
555 fHM->
H1(
"fhPhotonEPmtHit")->Fill(1.e9 * momMag);
557 fHM->
H1(
"fhLambdaPmtHit")->Fill(lambda);
572 TCanvas* c =
fHM->
CreateCanvas(ss.str().c_str(), ss.str().c_str(), 800, 800);
573 c->SetGrid(
true,
true);
574 TH2D* pad =
new TH2D(ss.str().c_str(), (ss.str() +
";X [cm];Y [cm]").c_str(), 1, -15., 15., 1, -15., 15);
575 pad->SetStats(
false);
579 double xmin = ringHit->
GetHit(0).
fX;
580 double xmax = ringHit->
GetHit(0).
fX;
581 double ymin = ringHit->
GetHit(0).
fY;
582 double ymax = ringHit->
GetHit(0).
fY;
583 for (
int i = 0; i < ringHit->
GetNofHits(); i++) {
584 double hitX = ringHit->
GetHit(i).
fX;
585 double hitY = ringHit->
GetHit(i).
fY;
586 if (xmin > hitX) xmin = hitX;
587 if (xmax < hitX) xmax = hitX;
588 if (ymin > hitY) ymin = hitY;
589 if (ymax < hitY) ymax = hitY;
591 double xCur = (xmin + xmax) / 2.;
592 double yCur = (ymin + ymax) / 2.;
596 circle->SetFillStyle(0);
597 circle->SetLineWidth(3);
599 TEllipse* center =
new TEllipse(ringHit->
GetCenterX() - xCur, ringHit->
GetCenterY() - yCur, .5);
603 for (
int i = 0; i < ringHit->
GetNofHits(); i++) {
604 TEllipse* hitDr =
new TEllipse(ringHit->
GetHit(i).
fX - xCur, ringHit->
GetHit(i).
fY - yCur, .5);
605 hitDr->SetFillColor(kRed);
610 for (
int i = 0; i < ringPoint->
GetNofHits(); i++) {
611 TEllipse* pointDr =
new TEllipse(ringPoint->
GetHit(i).
fX - xCur, ringPoint->
GetHit(i).
fY - yCur, 0.15);
612 pointDr->SetFillColor(kBlue);
618 ss2 <<
"(r, n)=(" << setprecision(3) << ringHit->
GetRadius() <<
", " << ringHit->
GetNofHits() <<
")";
619 TLatex* latex =
new TLatex(-8., 8., ss2.str().c_str());
625 int nofMc =
fHM->
H1(
"fhMomElMc")->GetEntries();
626 TH1D* hist =
static_cast<TH1D*
>(
fHM->
H1(
"fhNofHits_hits")->Clone(
"fhAccVsMinNofHitsHist"));
627 hist->GetXaxis()->SetTitle(
"Required min nof hits in ring");
628 hist->GetYaxis()->SetTitle(
"Detector acceptance [%]");
630 for (
int i = hist->GetNbinsX(); i > 1; i--) {
631 sum +=
fHM->
H1(
"fhNofHits_hits")->GetBinContent(i);
632 hist->SetBinContent(i, 100. * sum / nofMc);
639 TCanvas* c =
fHM->
CreateCanvas(canvasName.c_str(), canvasName.c_str(), 1200, 600);
644 TH1D* py = (TH1D*) hist->ProjectionY((
string(hist->GetName()) +
"_py").c_str())->Clone();
648 py->Scale(1. / py->Integral());
649 py->GetYaxis()->SetTitle(
"Yield");
657 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_vertex_el",
"richgeo_vertex_el", 2000, 1000);
666 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_hits_xy",
"richgeo_hits_xy", 1200, 1200);
671 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_points_xy",
"richgeo_points_xy", 1200, 1200);
676 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_points_xy_no_rotation",
"richgeo_points_xy_no_rotation", 1200, 1200);
692 vector<string> ph = {
"_hits",
"_points"};
693 for (
const string& t : ph) {
696 fHM->
H2(
"fhBoAVsMom" + t)->GetYaxis()->SetRangeUser(0.8, 1.0);
699 string name =
"richgeo" + t +
"_ellipse_xc_yc";
704 DrawH2MeanRms(
fHM->
H2(
"fhChi2EllipseVsMom" + t),
"richgeo" + t +
"_chi2_ellipse_vs_mom");
709 string name =
"richgeo" + t +
"_b_up_down_halves";
710 TCanvas* c =
fHM->
CreateCanvas(name.c_str(), name.c_str(), 2000, 1000);
717 TH1* hDown =
fHM->
H1Clone(
"fhBaxisDownHalf" + t);
719 hDown->SetStats(
true);
723 string name =
"richgeo" + t +
"_circle";
724 TCanvas* c =
fHM->
CreateCanvas(name.c_str(), name.c_str(), 2000, 1000);
728 LOG(info) <<
"Number of hits/points = " <<
fHM->
H1(
"fhNofHits" + t)->GetMean();
734 DrawH2MeanRms(
fHM->
H2(
"fhChi2CircleVsMom" + t),
"richgeo" + t +
"_chi2_circle_vs_mom");
737 fHM->
H2(
"fhDRVsMom" + t)->GetYaxis()->SetRangeUser(-1.05, 1.05);
741 fHM->
CreateCanvas(
"richgeo_nof_photons_per_hit",
"richgeo_nof_photons_per_hit", 1200, 1200);
747 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_diff_ellipse",
"richgeo_diff_ellipse", 2000, 1000);
768 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_diff_circle",
"richgeo_diff_circle", 1500, 1000);
785 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_hits_residual",
"richgeo_hits", 2000, 1000);
796 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_fit_eff",
"richgeo_fit_eff", 1800, 600);
800 {
"All",
"Circle fit",
"Ellipse fit"},
kLinear,
kLog,
true, 0.7, 0.7, 0.99, 0.99,
"hist");
804 DrawH1(fhNofHitsCircleFitEff);
806 TLatex* circleFitEffTxt =
new TLatex(15, 0.5, circleEff.c_str());
807 LOG(info) <<
"Circle fit efficiency:" << circleEff <<
"%";
808 circleFitEffTxt->Draw();
810 DrawH1(fhNofHitsEllipseFitEff);
812 TLatex* ellipseFitEffTxt =
new TLatex(15, 0.5, ellipseFitEff.c_str());
813 LOG(info) <<
"Ellipse fit efficiency:" << ellipseFitEff <<
"%";
814 ellipseFitEffTxt->Draw();
818 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_acc_el",
"richgeo_acc_el", 1800, 1200);
821 DrawH1(
fHM->
H1Vector({string(
"fhMomElMc"),
"fhMomElAcc"}), {
"MC",
"ACC"},
kLinear,
kLog,
true, 0.8, 0.8, 0.99, 0.99,
825 fHM->
H2(
"fhPtYElMc")->SetMinimum(0.);
828 fHM->
H2(
"fhPtYElAcc")->SetMinimum(0.);
831 fHM->
H2(
"fhPYElMc")->SetMinimum(0.);
834 fHM->
H2(
"fhPYElAcc")->SetMinimum(0.);
839 "Geometrical acceptance [%]");
841 fHM->
CreateCanvas(
"richgeo_acc_eff_el_mom",
"richgeo_acc_eff_el_mom", 800, 800);
843 LOG(info) <<
"Geometrical acceptance electrons:" << effEl <<
"%";
850 fHM->
CreateCanvas(
"richgeo_acc_eff_el_pty",
"richgeo_acc_eff_el_pty", 800, 800);
857 fHM->
CreateCanvas(
"richgeo_acc_eff_el_py",
"richgeo_acc_eff_el_py", 800, 800);
862 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_acc_eff_el_zoom",
"richgeo_acc_eff_el_zoom", 1000, 500);
867 fhMcMomEl->GetXaxis()->SetRangeUser(0., 3.);
868 fhAccMomEl->GetXaxis()->SetRangeUser(0., 3.);
869 fhMcMomEl->SetMinimum(0.);
870 DrawH1({fhMcMomEl, fhAccMomEl}, {
"MC",
"ACC"},
kLinear,
kLog,
true, 0.8, 0.8, 0.99, 0.99);
871 gPad->SetLogy(
false);
873 TH1D* pxEffClone =
static_cast<TH1D*
>(pxEff->Clone());
874 pxEffClone->GetXaxis()->SetRangeUser(0., 3.);
875 pxEffClone->SetMinimum(0.);
881 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_numbers_vs_xy_hits",
"richgeo_numbers_vs_xy_hits", 1800, 600);
892 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_numbers_vs_xy_points",
"richgeo_numbers_vs_xy_points", 1800, 600);
903 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_numbers_vs_xy_boa",
"richgeo_numbers_vs_xy_boa", 1800, 600);
909 fHM->
H2(
"fhBoAVsX")->GetYaxis()->SetRangeUser(0.75, 1.0);
912 fHM->
H2(
"fhBoAVsY")->GetYaxis()->SetRangeUser(0.75, 1.0);
916 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_numbers_vs_xy_b",
"richgeo_numbers_vs_xy_b", 1800, 600);
927 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_numbers_vs_xy_a",
"richgeo_numbers_vs_xy_a", 1800, 600);
938 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_numbers_vs_xy_r",
"richgeo_numbers_vs_xy_r", 1800, 600);
949 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_numbers_vs_xy_dr",
"richgeo_numbers_vs_xy_dr", 1800, 600);
960 fHM->
CreateCanvas(
"richgeo_acc_vs_min_nof_hits",
"richgeo_acc_vs_min_nof_hits", 1000, 1000);
962 h->GetXaxis()->SetRangeUser(0., 40.0);
970 fHM->
H2(
"fhDRVsNofHits")->GetYaxis()->SetRangeUser(-1.05, 1.05);
973 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_hits_rab",
"richgeo_hits_rab", 1500, 600);
977 fHM->
H2(
"fhRadiusVsNofHits")->ProjectionY((
string(
fHM->
H2(
"fhRadiusVsNofHits")->GetName()) +
"_py").c_str());
982 fHM->
H2(
"fhAaxisVsNofHits")->ProjectionY((
string(
fHM->
H2(
"fhAaxisVsNofHits")->GetName()) +
"_py").c_str());
987 fHM->
H2(
"fhBaxisVsNofHits")->ProjectionY((
string(
fHM->
H2(
"fhBaxisVsNofHits")->GetName()) +
"_py").c_str());
994 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_photon_energy",
"richgeo_photon_energy", 2000, 1000);
995 vector<string> labels = {
"Sens plane Z+",
"Sens plane Z-",
"PMT Point",
"PMT hit"};
998 DrawH1(
fHM->
H1Vector({
"fhPhotonEPlaneZ+",
"fhPhotonEPlaneZ-",
"fhPhotonEPmtPoint",
"fhPhotonEPmtHit"}), labels);
1000 DrawH1(
fHM->
H1Vector({
"fhLambdaPlaneZ+",
"fhLambdaPlaneZ-",
"fhLambdaPmtPoint",
"fhLambdaPmtHit"}), labels);
1007 fHM->
Create3<TH3D>(
"fhPointsXYZ",
"fhPointsXYZ;X [cm];Y [cm];Z [cm];Yield", 100, -50, 50, 100, -300, 300, 100, 100,
1009 fHM->
Create3<TH3D>(
"fhHitsXYZ",
"fhHitsXYZ;X [cm];Y [cm];Z [cm];Yield", 100, -50, 50, 100, -300, 300, 100, 100, 300);
1014 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_pixels_xy",
"richgeo_pixels_xy", 1500, 1500);
1015 c->SetGrid(
true,
true);
1016 TH2D* pad =
new TH2D(
"richgeo_pixels_xy",
";X [cm];Y [cm]", 1, -120, 120, 1, -210, 210);
1018 pad->SetStats(
false);
1024 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_pixels_xz",
"richgeo_pixels_xz", 1500, 1500);
1025 c->SetGrid(
true,
true);
1026 TH2D* pad =
new TH2D(
"richgeo_pixels_xz",
";Z [cm];X [cm]", 1, 200, 250, 1, -120., 120.);
1027 pad->SetStats(
false);
1033 fHM->
CreateCanvas(
"richgeo_pixels_yz",
"richgeo_pixels_yz", 1500, 1500);
1034 TH2D* pad =
new TH2D(
"richgeo_pixels_yz",
";Z [cm];Y [cm]", 1, 200, 250, 1, -220, 220);
1035 pad->SetStats(
false);
1041 TCanvas* c =
fHM->
CreateCanvas(
"richgeo_pmts_xy",
"richgeo_pmts_xy", 1500, 1500);
1042 c->SetGrid(
true,
true);
1043 TH2D* pad =
new TH2D(
"richgeo_pmts_xy",
";X [cm];Y [cm]", 1, -120, 120, 1, -210, 210);
1044 pad->SetStats(
false);
1050 for (
unsigned int i = 0; i < pixels.size(); i++) {
1052 TVector3 inPos(pixelData->
fX, pixelData->
fY, pixelData->
fZ);
1056 fHM->
H3(
"fhPointsXYZ")->Fill(inPos.X(), inPos.Y(), inPos.Z());
1057 fHM->
H3(
"fhHitsXYZ")->Fill(outPos.X(), outPos.Y(), outPos.Z());
1061 fHM->
CreateCanvas(
"richgeo_pixels_points_xyz",
"richgeo_pixels_points_xyz", 1500, 1500);
1062 fHM->
H3(
"fhPointsXYZ")->Draw();
1066 fHM->
CreateCanvas(
"richgeo_pixels_hits_xyz",
"richgeo_pixels_hits_xyz", 1500, 1500);
1067 fHM->
H3(
"fhHitsXYZ")->Draw();
1073 for (
size_t i = 0; i < ids.size(); i++) {
1075 double halfSize = 0.0;
1078 inPos.SetXYZ(pixelData->
fX, pixelData->
fY, pixelData->
fZ);
1083 inPos.SetXYZ(pmtData->
fX, pmtData->
fY, pmtData->
fZ);
1084 halfSize = 0.5 * pmtData->
fHeight;
1089 TBox* boxOut =
nullptr;
1090 TBox* boxIn =
nullptr;
1091 if (coordOpt ==
"xy") {
1092 boxOut =
new TBox(outPos.X() - halfSize, outPos.Y() - halfSize, outPos.X() + halfSize, outPos.Y() + halfSize);
1093 boxIn =
new TBox(inPos.X() - halfSize, inPos.Y() - halfSize, inPos.X() + halfSize, inPos.Y() + halfSize);
1095 else if (coordOpt ==
"zx") {
1096 boxOut =
new TBox(outPos.Z() - halfSize, outPos.X() - halfSize, outPos.Z() + halfSize, outPos.X() + halfSize);
1097 boxIn =
new TBox(inPos.Z() - halfSize, inPos.X() - halfSize, inPos.Z() + halfSize, inPos.X() + halfSize);
1099 else if (coordOpt ==
"zy") {
1100 boxOut =
new TBox(outPos.Z() - halfSize, outPos.Y() - halfSize, outPos.Z() + halfSize, outPos.Y() + halfSize);
1101 boxIn =
new TBox(inPos.Z() - halfSize, inPos.Y() - halfSize, inPos.Z() + halfSize, inPos.Y() + halfSize);
1104 if (boxOut !=
nullptr && boxIn !=
nullptr) {
1106 boxOut->SetFillColor(kBlue);
1107 boxIn->SetFillColor(kRed);
1110 boxOut->SetFillStyle(0);
1111 boxOut->SetLineColor(kBlue);
1112 boxIn->SetFillStyle(0);
1113 boxIn->SetLineColor(kRed);
1128 TDirectory* oldir = gDirectory;
1129 TFile* outFile = FairRootManager::Instance()->GetOutFile();
1130 if (outFile !=
nullptr) {
1131 outFile->mkdir(GetName());
1132 outFile->cd(GetName());
1139 gDirectory->cd(oldir->GetPath());
1144 if (histAcc->GetEntries() == 0) {
1148 double eff = 100. * double(histRec->GetEntries()) / double(histAcc->GetEntries());
1158 TFile* oldFile = gFile;
1159 TDirectory* oldDir = gDirectory;
1161 if (
fHM !=
nullptr)
delete fHM;
1164 TFile* file =
new TFile(fileName.c_str());
1173 gDirectory = oldDir;
ClassImp(CbmConverterManager)
@ kRich
Ring-Imaging Cherenkov Detector.
void DrawH1andFitGauss(TH1 *hist, Bool_t drawResults, Bool_t doScale, Double_t userRangeMin, Double_t userRangeMax)
void DrawH2WithProfile(TH2 *hist, Bool_t doGaussFit, Bool_t drawOnlyMean, const string &drawOpt2D, Int_t profileColor, Int_t profileLineWidth)
void SetDefaultDrawStyle()
void DrawH1(TH1 *hist, HistScale logx, HistScale logy, const string &drawOpt, Int_t color, Int_t lineWidth, Int_t lineStyle, Int_t markerSize, Int_t markerStyle)
void DrawH2(TH2 *hist, HistScale logx, HistScale logy, HistScale logz, const string &drawOpt)
TH2D * DrawH3Profile(TH3 *h, Bool_t drawMean, Bool_t doGaussFit, Double_t zMin, Double_t zMax)
Helper functions for drawing 1D and 2D histograms and graphs.
Convert internal data classes to cbmroot common data classes.
RICH geometry checking and testing.
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.
Base class for study reports.
friend fvec sqrt(const fvec &a)
Generates beam ions for transport simulation.
static Bool_t IsPresent(ECbmModuleId systemId)
Presence of a digi branch.
static Bool_t IsMatchPresent(ECbmModuleId systemId)
Presence of a digi match branch.
InitStatus Init()
Initialisation.
const Digi * Get(Int_t index) const
Get a digi object.
static CbmDigiManager * Instance()
Static instance.
const CbmMatch * GetMatch(ECbmModuleId systemId, UInt_t index) const
Get a match object.
TCanvas * CreateCanvas(const std::string &name, const std::string &title, Int_t width, Int_t height)
Create and draw TCanvas and store pointer to it.
void SaveCanvasToImage(const std::string &outputDir, const std::string &options="png,eps")
Save all stored canvases to images.
std::vector< TH1 * > H1Vector(const std::vector< std::string > &names) const
Return vector of pointers to TH1 histogram.
void Clear(Option_t *="")
Clear memory. Remove all histograms and canvases.
TH2 * H2(const std::string &name) const
Return pointer to TH2 histogram.
void Create2(const std::string &name, const std::string &title, Int_t nofBinsX, Double_t minBinX, Double_t maxBinX, Int_t nofBinsY, Double_t minBinY, Double_t maxBinY)
Helper function for creation of 2-dimensional histograms and profiles. Template argument is a real ob...
void ReadFromFile(TFile *file)
Read histograms from file.
void WriteToFile()
Write all objects to current opened file.
TH3 * H3(const std::string &name) const
Return pointer to TH3 histogram.
void NormalizeToIntegral(const std::string &histName)
Normalize histogram to integral.
TH2 * H2Clone(const std::string &name) const
Return clone of TH2 histogram.
void Create1(const std::string &name, const std::string &title, Int_t nofBins, Double_t minBin, Double_t maxBin)
Helper function for creation of 1-dimensional histograms and profiles. Template argument is a real ob...
void Create3(const std::string &name, const std::string &title, Int_t nofBinsX, Double_t minBinX, Double_t maxBinX, Int_t nofBinsY, Double_t minBinY, Double_t maxBinY, Int_t nofBinsZ, Double_t minBinZ, Double_t maxBinZ)
Helper function for creation of 3-dimensional histograms and profiles. Template argument is a real ob...
TH1 * H1Clone(const std::string &name) const
Return clone of TH1 histogram.
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
TObject * Get(const CbmLink *lnk)
Int_t Size(Int_t fileNumber, Int_t eventNumber)
int32_t GetFileIdByIndex(uint32_t index)
File number by index @value File number for event at given index in list.
int32_t GetEventIdByIndex(uint32_t index)
Event number by index @value Event number for event at given index in list.
std::size_t GetNofEvents() const
Number of events in the list @value Number of events.
uint32_t GetGeantProcessId() const
int32_t GetMotherId() const
int32_t GetPdgCode() const
double GetRapidity() const
void GetStartVertex(TVector3 &vertex) const
int32_t GetNofLinks() const
const CbmLink & GetMatchedLink() const
const std::vector< CbmLink > & GetLinks() const
static void CopyHitsToRingLight(const CbmRichRing *ring1, CbmRichRingLight *ring2)
Copy hits from CbmRichRing to CbmRichRingLight.
static CbmRichDigiMapManager & GetInstance()
Return Instance of CbmRichGeoManager.
std::vector< Int_t > GetPmtIds()
Return ids for all pmts.
std::vector< Int_t > GetPixelAddresses()
Return addresses of all pixels.
CbmRichPixelData * GetPixelDataByAddress(Int_t address)
Return CbmRichDataPixel by digi address.
CbmRichPmtData * GetPmtDataById(Int_t id)
Return CbmRichDataPmt by id.
static void DrawPmtH2(TH2 *h, TCanvas *c, Bool_t usePmtBins=false)
void RotatePoint(TVector3 *inPos, TVector3 *outPos, Bool_t noTilting=false)
static CbmRichGeoManager & GetInstance()
RICH geometry checking and testing.
CbmDigiManager * fDigiMan
virtual ~CbmRichGeoTest()
Standard destructor.
CbmMCEventList * fEventList
TH1D * CreateAccVsMinNofHitsHist()
Create histogram: RICH detector acceptance vs. minimum required number of hits in ring.
void FillMcVsHitFitCircle(CbmRichRingLight *ring, CbmRichRingLight *ringMc)
Calculate difference between circle parameters for two fittings using hits and MC points for fit and ...
void RingParameters()
Loop over all rings in array and fill ring parameters histograms.
CbmMCDataArray * fMcTracks
CbmMCDataArray * fRichPoints
std::string CalcEfficiency(TH1 *histRec, TH1 *histAcc)
Calculate efficiency.
void InitHistograms()
Initialize histograms.
virtual void Finish()
Inherited from FairTask.
void ProcessHits()
Calculate residuals between hits and MC points and fill histograms.
CbmRichGeoTest()
Standard constructor.
void FillMcVsHitFitEllipse(CbmRichRingLight *ring, CbmRichRingLight *ringMc)
Calculate difference between ellipse parameters for two fitting using hits and MC points for fit and ...
TClonesArray * fRichRings
void ProcessMc()
Fill MC histogram for detector acceptance calculation.
void FitAndFillHistCircle(int histIndex, CbmRichRingLight *ring, double momentum)
Fit ring using circle fitter and fill histograms.
void DrawPmtPoint(const std::string &coordOpt, const std::vector< int > &ids, bool isDrawPixel)
TClonesArray * fRichRingMatches
CbmRichRingFitterEllipseTau * fTauFit
void DrawH2MeanRms(TH2 *hist, const std::string &canvasName)
virtual InitStatus Init()
Inherited from FairTask.
void DrawHist()
Draw histograms.
virtual void Exec(Option_t *option)
Inherited from FairTask.
void FitAndFillHistEllipse(int histIndex, CbmRichRingLight *ring, double momentum)
Fit ring using ellipse fitter and fill histograms.
CbmRichRingFitterCOP * fCopFit
CbmRichRingLight CreateRingLightWithPoints(int fileId, int mcEventId, int mcTrackId)
void DrawRing(CbmRichRingLight *ringHit, CbmRichRingLight *ringPoint)
Draw ring in separate TCanvas.
void DrawFromFile(const std::string &fileName, const std::string &outputDir)
Draw histogram from file.
CbmMCDataArray * fRichRefPlanePoints
static Double_t getLambda(Double_t momentum)
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.
virtual void DoFit(CbmRichRingLight *ring)
Inherited from CbmRichRingFitterBase.
int GetNofHits() const
Return number of hits in ring.
CbmRichHitLight GetHit(int ind)
Return hit by the index.
void AddHit(CbmRichHitLight hit)
Add new hit to the ring.
int32_t GetNofHits() const
TH1D * DivideH1(TH1 *h1, TH1 *h2, const string &histName, double scale, const string &titleYaxis)
T * GetOrFatal(const std::string &objName, const std::string &description="")
TH2D * DivideH2(TH2 *h1, TH2 *h2, const string &histName, double scale, const string &titleZaxis)
CbmMCDataArray * InitOrFatalMc(const std::string &objName, const std::string &description)
std::string NumberToString(const T &value, int precision=1)