20#include "FairMCPoint.h"
21#include "FairTrackParam.h"
23#include "TClonesArray.h"
28#include "TMCProcess.h"
33#include <boost/assign/list_of.hpp>
40using boost::assign::list_of;
43 : FairTask(
"CbmRichRecoQa")
48 , fRichPoints(nullptr)
52 , fRichRingMatches(nullptr)
53 , fGlobalTracks(nullptr)
55 , fStsTrackMatches(nullptr)
56 , fRichProjections(nullptr)
65 cout <<
"CbmRichRecoQa::Init" << endl;
66 FairRootManager* ioman = FairRootManager::Instance();
67 if (
nullptr == ioman) {
68 Fatal(
"CbmRichRecoQa::Init",
"RootManager not instantised!");
71 fMCTracks = (TClonesArray*) ioman->GetObject(
"MCTrack");
73 Fatal(
"CbmRichRecoQa::Init",
"No MC Tracks!");
76 fRichPoints = (TClonesArray*) ioman->GetObject(
"RichPoint");
78 Fatal(
"CbmRichRecoQa::Init",
"No Rich Points!");
81 fRichDigis = (TClonesArray*) ioman->GetObject(
"RichDigi");
83 Fatal(
"CbmRichRecoQa::Init",
"No Rich Digis!");
86 fRichHits = (TClonesArray*) ioman->GetObject(
"RichHit");
88 Fatal(
"CbmRichRecoQa::Init",
"No RichHits!");
91 fRichRings = (TClonesArray*) ioman->GetObject(
"RichRing");
93 Fatal(
"CbmRichRecoQa::Init",
"No RichRings!");
98 Fatal(
"CbmRichRecoQa::Init",
"No RichRingMatch array!");
101 fGlobalTracks = (TClonesArray*) ioman->GetObject(
"GlobalTrack");
103 Fatal(
"CbmRichRecoQa::Init",
"No GlobalTrack array!");
106 fStsTracks = (TClonesArray*) ioman->GetObject(
"StsTrack");
108 Fatal(
"CbmRichRecoQa::Init",
": No StsTrack array!");
113 Fatal(
"CbmRichRecoQa::Init",
": No StsTrackMatch array!");
118 Fatal(
"CbmRichUrqmdTest::Init",
"No fRichProjections array!");
148 for (Int_t i = 0; i < 4; i++) {
150 if (i == 0) s =
"Primel";
151 if (i == 1) s =
"Pi";
152 if (i == 2) s =
"PrimelPlus";
153 if (i == 3) s =
"PrimelMinus";
156 fHM->
Create2<TH2D>(
"fhRingTrackDistVsMomTruematch" + s,
157 "fhRingTrackDistVsMomTruematch" + s +
";P [GeV/c];Ring-track distance [cm];Yield (a.u.)", 40, 0.,
159 fHM->
Create2<TH2D>(
"fhRingTrackDistVsMomWrongmatch" + s,
160 "fhRingTrackDistVsMomWrongmatch" + s +
";P [GeV/c];Ring-track distance [cm];Yield (a.u.)", 20,
161 0., 10., 100, 0., 5.);
164 fHM->
Create2<TH2D>(
"fhRingTrackDistVsNofHitsTruematch" + s,
165 "fhRingTrackDistVsNofHitsTruematch" + s
166 +
";Nof hits in found ring;Ring-track distance [cm];Yield (a.u.)",
167 41, -.5, 40.5, 100, 0., 5.);
169 fHM->
Create3<TH3D>(
"fhRingTrackDistVsXYTruematch" + s,
170 "fhRingTrackDistVsXYTruematch" + s +
";X [cm];Y [cm];Ring-track distance [cm]", 240, xMin, xMax,
171 416, -200., 200., 400, 0., 5.);
172 fHM->
Create2<TH2D>(
"fhRingTrackDistVsXTruematch" + s,
173 "fhRingTrackDistVsXTruematch" + s +
";X [cm];Ring-track distance [cm]", nBinsX1, xMin1, xMax1,
176 fHM->
Create2<TH2D>(
"fhRingTrackDistVsYTruematch" + s,
177 "fhRingTrackDistVsYTruematch" + s +
";Abs(Y) [cm];Ring-track distance [cm]", 34, 110., yMax1,
180 Double_t range = 3., nbBinsX = 120., nbBinsY = 208;
181 fHM->
Create3<TH3D>(
"fhRingTrackDistDiffXRingVsXYTruematchUp" + s,
182 "fhRingTrackDistDiffXRingVsXYTruematchUp" + s +
";X [cm];Y [cm];X Ring-track distance [cm]",
183 nbBinsX, xMin, xMax, nbBinsY, 110, 200, 200, -range, range);
184 fHM->
Create3<TH3D>(
"fhRingTrackDistDiffYRingVsXYTruematchUp" + s,
185 "fhRingTrackDistDiffYRingVsXYTruematchUp" + s +
";X [cm];Y [cm];Y Ring-track distance [cm]",
186 nbBinsX, xMin, xMax, nbBinsY, 110, 200, 200, -range, range);
187 fHM->
Create3<TH3D>(
"fhRingTrackDistDiffXTrackVsXYTruematchUp" + s,
188 "fhRingTrackDistDiffXTrackVsXYTruematchUp" + s +
";X [cm];Y [cm];X Track-ring distance [cm]",
189 nbBinsX, xMin, xMax, nbBinsY, 110, 200, 200, -range, range);
190 fHM->
Create3<TH3D>(
"fhRingTrackDistDiffYTrackVsXYTruematchUp" + s,
191 "fhRingTrackDistDiffYTrackVsXYTruematchUp" + s +
";X [cm];Y [cm];Y Track-ring distance [cm]",
192 nbBinsX, xMin, xMax, nbBinsY, 110, 200, 200, -range, range);
194 fHM->
Create3<TH3D>(
"fhRingTrackDistDiffXRingVsXYTruematchDown" + s,
195 "fhRingTrackDistDiffXRingVsXYTruematchDown" + s +
";X [cm];Y [cm];X Ring-track distance [cm]",
196 nbBinsX, xMin, xMax, nbBinsY, -200, -110, 200, -range, range);
197 fHM->
Create3<TH3D>(
"fhRingTrackDistDiffYRingVsXYTruematchDown" + s,
198 "fhRingTrackDistDiffYRingVsXYTruematchDown" + s +
";X [cm];Y [cm];Y Ring-track distance [cm]",
199 nbBinsX, xMin, xMax, nbBinsY, -200, -110, 200, -range, range);
200 fHM->
Create3<TH3D>(
"fhRingTrackDistDiffXTrackVsXYTruematchDown" + s,
201 "fhRingTrackDistDiffXTrackVsXYTruematchDown" + s +
";X [cm];Y [cm];X Track-ring distance [cm]",
202 nbBinsX, xMin, xMax, nbBinsY, -200, -110, 200, -range, range);
203 fHM->
Create3<TH3D>(
"fhRingTrackDistDiffYTrackVsXYTruematchDown" + s,
204 "fhRingTrackDistDiffYTrackVsXYTruematchDown" + s +
";X [cm];Y [cm];Y Track-ring distance [cm]",
205 nbBinsX, xMin, xMax, nbBinsY, -200, -110, 200, -range, range);
207 fHM->
Create3<TH3D>(
"fhRingTrackDistVsXYHalfUpTruematch" + s,
208 "fhRingTrackDistVsXYHalfUpTruematch" + s +
";X [cm];Y [cm];Ring-track distance [cm]", nbBinsX,
209 xMin, xMax, nbBinsY, 110., 200., 100, 0., range);
210 fHM->
Create3<TH3D>(
"fhRingTrackDistVsXYHalfDownTruematch" + s,
211 "fhRingTrackDistVsXYHalfDownTruematch" + s +
";X [cm];Y [cm];Ring-track distance [cm]", nbBinsX,
212 xMin, xMax, nbBinsY, -200., -110., 100, 0., range);
216 Double_t range_2 = 3.;
218 fHM->
Create2<TH2D>(
"fhRingTrackDistVsMomTruematchElId",
219 "fhRingTrackDistVsMomTruematchElId;P [GeV/c];Ring-track "
220 "distance [cm];Yield (a.u.)",
221 40, 0., 10., 120, 0., 3.);
222 fHM->
Create3<TH3D>(
"fhRingTrackDistDiffXAfterEl",
223 "fhRingTrackDistDiffXAfterEl;X [cm];Y [cm];X Ring-track distance [cm]", 60, xMin, xMax, 104, 110,
224 200, 200, -range_2, range_2);
225 fHM->
Create3<TH3D>(
"fhRingTrackDistDiffYAfterEl",
226 "fhRingTrackDistDiffYAfterEl;X [cm];Y [cm];Y Ring-track distance [cm]", 60, xMin, xMax, 104, 110,
227 200, 200, -range_2, range_2);
229 fHM->
Create1<TH1D>(
"fhMismatchSource",
"fhMismatchSource;Global track category;% from MC", 13, -0.5, 12.5);
231 fHM->
Create1<TH1D>(
"fhMismatchSourceMomMc",
"fhMismatchSourceMomMc;Momentum [GeV/c];Yield", 40, 0., 10.);
232 fHM->
Create1<TH1D>(
"fhMismatchSourceMomSts",
"fhMismatchSourceMomSts;Momentum [GeV/c];Yield", 40, 0., 10.);
233 fHM->
Create1<TH1D>(
"fhMismatchSourceMomStsAccRich",
"fhMismatchSourceMomStsAccRich;Momentum [GeV/c];Yield", 40, 0.,
235 fHM->
Create1<TH1D>(
"fhMismatchSourceMomStsRich",
"fhMismatchSourceMomStsRich;Momentum [GeV/c];Yield", 40, 0., 10.);
236 fHM->
Create1<TH1D>(
"fhMismatchSourceMomStsRichTrue",
"fhMismatchSourceMomStsRichTrue;Momentum [GeV/c];Yield", 40, 0.,
238 fHM->
Create1<TH1D>(
"fhMismatchSourceMomStsNoRich",
"fhMismatchSourceMomStsNoRich;Momentum [GeV/c];Yield", 40, 0.,
240 fHM->
Create1<TH1D>(
"fhMismatchSourceMomStsNoRichRF",
"fhMismatchSourceMomStsNoRichRF;Momentum [GeV/c];Yield", 40, 0.,
242 fHM->
Create1<TH1D>(
"fhMismatchSourceMomStsNoRichRM",
"fhMismatchSourceMomStsNoRichRM;Momentum [GeV/c];Yield", 40, 0.,
244 fHM->
Create1<TH1D>(
"fhMismatchSourceMomStsNoRichNoRF",
"fhMismatchSourceMomStsNoRichNoRF;Momentum [GeV/c];Yield", 40,
246 fHM->
Create1<TH1D>(
"fhMismatchSourceMomStsNoRichNoProj",
"fhMismatchSourceMomStsNoRichNoProj;Momentum [GeV/c];Yield",
248 fHM->
Create1<TH1D>(
"fhMismatchSourceMomStsRichWrong",
"fhMismatchSourceMomStsRichWrong;Momentum [GeV/c];Yield", 40,
250 fHM->
Create1<TH1D>(
"fhMismatchSourceMomStsRichWrongRF",
"fhMismatchSourceMomStsRichWrongRF;Momentum [GeV/c];Yield",
252 fHM->
Create1<TH1D>(
"fhMismatchSourceMomStsRichWrongRM",
"fhMismatchSourceMomStsRichWrongRM;Momentum [GeV/c];Yield",
259 cout <<
"CbmRichRecoQa, event No. " <<
fEventNum << endl;
269 Int_t nofRichHits =
fRichHits->GetEntriesFast();
270 for (Int_t iHit = 0; iHit < nofRichHits; iHit++) {
272 if (
nullptr == hit)
continue;
275 for (UInt_t i = 0; i < motherIds.size(); i++) {
283 Int_t nofMcTracks =
fMCTracks->GetEntriesFast();
284 for (Int_t iTrack = 0; iTrack < nofMcTracks; iTrack++) {
286 if (mcTrack ==
nullptr)
continue;
290 fHM->
H1(
"fhMismatchSource")->Fill(0);
291 fHM->
H1(
"fhMismatchSourceMomMc")->Fill(mcTrack->
GetP());
297 for (Int_t iTrack = 0; iTrack < nofGlobalTracks; iTrack++) {
301 if (stsId < 0)
continue;
303 if (stsTrackMatch ==
nullptr)
continue;
307 if (mctrack ==
nullptr)
continue;
308 Double_t mom = mctrack->
GetP();
314 fHM->
H1(
"fhMismatchSource")->Fill(1);
315 fHM->
H1(
"fhMismatchSourceMomSts")->Fill(mom);
319 fHM->
H1(
"fhMismatchSource")->Fill(2);
320 fHM->
H1(
"fhMismatchSourceMomStsAccRich")->Fill(mctrack->
GetP());
328 fHM->
H1(
"fhMismatchSource")->Fill(5);
329 fHM->
H1(
"fhMismatchSourceMomStsNoRich")->Fill(mom);
335 fHM->
H1(
"fhMismatchSource")->Fill(6);
336 fHM->
H1(
"fhMismatchSourceMomStsNoRichRF")->Fill(mom);
340 fHM->
H1(
"fhMismatchSource")->Fill(8);
341 fHM->
H1(
"fhMismatchSourceMomStsNoRichNoRF")->Fill(mom);
346 fHM->
H1(
"fhMismatchSource")->Fill(7);
347 fHM->
H1(
"fhMismatchSourceMomStsNoRichRM")->Fill(mom);
352 fHM->
H1(
"fhMismatchSource")->Fill(9);
353 fHM->
H1(
"fhMismatchSourceMomStsNoRichNoProj")->Fill(mom);
360 fHM->
H1(
"fhMismatchSource")->Fill(3);
361 fHM->
H1(
"fhMismatchSourceMomStsRich")->Fill(mom);
364 if (richRingMatch ==
nullptr)
continue;
367 if (
nullptr == ring)
continue;
369 if (stsMcTrackId == richMcTrackId) {
371 fHM->
H1(
"fhMismatchSource")->Fill(4);
372 fHM->
H1(
"fhMismatchSourceMomStsRichTrue")->Fill(mom);
376 fHM->
H1(
"fhMismatchSource")->Fill(10);
377 fHM->
H1(
"fhMismatchSourceMomStsRichWrong")->Fill(mom);
380 fHM->
H1(
"fhMismatchSource")->Fill(11);
381 fHM->
H1(
"fhMismatchSourceMomStsRichWrongRF")->Fill(mom);
386 fHM->
H1(
"fhMismatchSource")->Fill(12);
387 fHM->
H1(
"fhMismatchSourceMomStsRichWrongRM")->Fill(mom);
395 Int_t nofRings =
fRichRings->GetEntriesFast();
396 for (Int_t iR = 0; iR < nofRings; iR++) {
398 if (ring ==
nullptr)
continue;
400 if (richRingMatch ==
nullptr)
continue;
402 if (richMcTrackId == mcTrackId)
return true;
410 for (Int_t iTrack = 0; iTrack < nofGlobalTracks; iTrack++) {
414 if (richId < 0)
continue;
416 if (richRingMatch ==
nullptr)
continue;
418 if (richMcTrackId == mcTrackId) {
428 if (stsTrackId < 0) {
431 FairTrackParam* pTrack = (FairTrackParam*)
fRichProjections->At(stsTrackId);
432 if (pTrack ==
nullptr) {
436 if (pTrack->GetX() == 0. && pTrack->GetY() == 0.) {
447 for (Int_t iTrack = 0; iTrack < nofGlobalTracks; iTrack++) {
452 if (stsId < 0 || richId < 0)
continue;
455 if (stsTrackMatch ==
nullptr)
continue;
459 if (richRingMatch ==
nullptr)
continue;
462 if (
nullptr == ring)
continue;
472 if (mctrack ==
nullptr)
continue;
473 double mom = mctrack->
GetP();
479 if (!isEl && !isPi)
continue;
483 for (
int i = 0; i < 2; i++) {
500 else if (charge < 0) {
512 if (stsMcTrackId == richMcTrackId) {
513 fHM->
H2(
"fhRingTrackDistVsMomTruematch" + s)->Fill(mom, rtDistance);
514 fHM->
H3(
"fhRingTrackDistVsXYTruematch" + s)->Fill(xc, yc, rtDistance);
515 fHM->
H2(
"fhRingTrackDistVsXTruematch" + s)->Fill(xc, rtDistance);
516 fHM->
H2(
"fhRingTrackDistVsYTruematch" + s)->Fill(abs(yc), rtDistance);
517 fHM->
H2(
"fhRingTrackDistVsNofHitsTruematch" + s)->Fill(nofHits, rtDistance);
519 Double_t rtX = -1 * rtDistanceX;
520 Double_t rtY = -1 * rtDistanceY;
523 fHM->
H3(
"fhRingTrackDistDiffXRingVsXYTruematchUp" + s)->Fill(xc, yc, rtDistanceX);
524 fHM->
H3(
"fhRingTrackDistDiffYRingVsXYTruematchUp" + s)->Fill(xc, yc, rtDistanceY);
525 fHM->
H3(
"fhRingTrackDistDiffXTrackVsXYTruematchUp" + s)->Fill(xc, yc, rtX);
526 fHM->
H3(
"fhRingTrackDistDiffYTrackVsXYTruematchUp" + s)->Fill(xc, yc, rtY);
527 fHM->
H3(
"fhRingTrackDistVsXYHalfUpTruematch" + s)->Fill(xc, yc, rtDistance);
531 fHM->
H3(
"fhRingTrackDistDiffXRingVsXYTruematchDown" + s)->Fill(xc, yc, rtDistanceX);
532 fHM->
H3(
"fhRingTrackDistDiffYRingVsXYTruematchDown" + s)->Fill(xc, yc, rtDistanceY);
533 fHM->
H3(
"fhRingTrackDistDiffXTrackVsXYTruematchDown" + s)->Fill(xc, yc, rtX);
534 fHM->
H3(
"fhRingTrackDistDiffYTrackVsXYTruematchDown" + s)->Fill(xc, yc, rtY);
535 fHM->
H3(
"fhRingTrackDistVsXYHalfDownTruematch" + s)->Fill(xc, yc, rtDistance);
540 if (i == 0 && isEl) {
542 fHM->
H2(
"fhRingTrackDistVsMomTruematchElId")->Fill(mom, rtDistance);
543 fHM->
H3(
"fhRingTrackDistDiffXAfterEl")->Fill(xc, yc, rtDistanceX);
544 fHM->
H3(
"fhRingTrackDistDiffYAfterEl")->Fill(xc, yc, rtDistanceY);
549 fHM->
H2(
"fhRingTrackDistVsMomWrongmatch" + s)->Fill(mom, rtDistance);
564 TCanvas* c =
fHM->
CreateCanvas(
"fh_ring_track_distance_truematch_comparison_primel",
565 "fh_ring_track_distance_truematch_comparison_primel", 800, 800);
566 TH1D* py_minus = (TH1D*) (
fHM->
H2(
"fhRingTrackDistVsMomTruematchPrimelMinus")
567 ->ProjectionY(
"fhRingTrackDistVsMomTruematchPrimelMinus_py")
569 py_minus->Scale(1. / py_minus->Integral());
570 TH1D* py_plus = (TH1D*) (
fHM->
H2(
"fhRingTrackDistVsMomTruematchPrimelPlus")
571 ->ProjectionY(
"fhRingTrackDistVsMomTruematchPrimelPlus_py")
573 py_plus->Scale(1. / py_plus->Integral());
574 DrawH1({py_minus, py_plus},
581 TCanvas* c =
fHM->
CreateCanvas(
"fh_ring_track_distance_truematch_comparison_elpi",
582 "fh_ring_track_distance_truematch_comparison_elpi", 800, 800);
583 TH1D* py_el = (TH1D*) (
fHM->
H2(
"fhRingTrackDistVsMomTruematchPrimel")
584 ->ProjectionY(
"fhRingTrackDistVsMomTruematchPrimel_py")
586 py_el->Scale(1. / py_el->Integral());
588 (TH1D*) (
fHM->
H2(
"fhRingTrackDistVsMomTruematchPi")->ProjectionY(
"fhRingTrackDistVsMomTruematchPi_py")->Clone());
589 py_pi->Scale(1. / py_pi->Integral());
597 gStyle->SetPaintTextFormat(
"4.1f");
598 TCanvas* c =
fHM->
CreateCanvas(
"fh_mismatch_source",
"fh_mismatch_source", 1000, 800);
599 Double_t nofMcEl =
fHM->
H1(
"fhMismatchSource")->GetBinContent(1);
600 cout <<
"nofMcEl = " << nofMcEl << endl;
601 fHM->
H1(
"fhMismatchSource")->Scale(100. / nofMcEl);
603 fHM->
H1(
"fhMismatchSource")->SetMarkerSize(1.9);
605 vector<string> labels = {
"MC",
617 "STS-RICH wrong RM"};
618 for (
int i = 0; i < labels.size(); i++) {
619 fHM->
H1(
"fhMismatchSource")->GetXaxis()->SetBinLabel(i + 1, labels[i].c_str());
621 fHM->
H1(
"fhMismatchSource")->GetXaxis()->SetLabelSize(0.03);
625 TCanvas* c =
fHM->
CreateCanvas(
"fh_mismatch_source_mom",
"fh_mismatch_source_mom", 1000, 800);
626 vector<string> labels = {
"MC",
638 "STS-RICH wrong RM"};
639 vector<TH1*> hists = {
fHM->
H1(
"fhMismatchSourceMomMc"),
640 fHM->
H1(
"fhMismatchSourceMomSts"),
641 fHM->
H1(
"fhMismatchSourceMomStsAccRich"),
642 fHM->
H1(
"fhMismatchSourceMomStsRich"),
643 fHM->
H1(
"fhMismatchSourceMomStsRichTrue"),
644 fHM->
H1(
"fhMismatchSourceMomStsNoRich"),
645 fHM->
H1(
"fhMismatchSourceMomStsNoRichRF"),
646 fHM->
H1(
"fhMismatchSourceMomStsNoRichRM"),
647 fHM->
H1(
"fhMismatchSourceMomStsNoRichNoRF"),
648 fHM->
H1(
"fhMismatchSourceMomStsNoRichNoProj"),
649 fHM->
H1(
"fhMismatchSourceMomStsRichWrong"),
650 fHM->
H1(
"fhMismatchSourceMomStsRichWrongRF"),
651 fHM->
H1(
"fhMismatchSourceMomStsRichWrongRM")};
654 fHM->
H1(
"fhMismatchSourceMomMc")->SetMinimum(0.9);
670 fHM->
CreateCanvas(
"fh_ring_track_distance_truematch_elid",
"fh_ring_track_distance_truematch_elid", 1400, 1400);
674 fHM->
H2(
"fhRingTrackDistVsMomTruematchPrimel")->GetYaxis()->SetRangeUser(0., 2.);
677 fHM->
H2(
"fhRingTrackDistVsMomTruematchElId")->GetYaxis()->SetRangeUser(0., 2.);
679 TH1D* py = (TH1D*) (
fHM->
H2(
"fhRingTrackDistVsMomTruematchPrimel")
680 ->ProjectionY(
string(
"fhRingTrackDistVsMomTruematchPrimel_py2").c_str())
682 TH1D* pyElId = (TH1D*) (
fHM->
H2(
"fhRingTrackDistVsMomTruematchElId")
683 ->ProjectionY(
string(
"fhRingTrackDistVsMomTruematchElId_py").c_str())
685 TH1D* pyElId2 = (TH1D*) (
fHM->
H2(
"fhRingTrackDistVsMomTruematchElId")->ProjectionY(
"test_py", 0, 40));
692 0.45, 0.2, 0.9, 0.35);
695 Double_t range = 2.5;
697 TCanvas* c =
fHM->
CreateCanvas(
"fh_track_ring_distance_diff_x_y_track_vs_xy_truematch_after_el",
698 "fh_track_ring_distance_diff_x_y_track_vs_xy_truematch_after_el", 1800, 600);
710 double overflow =
h->GetBinContent(
h->GetNbinsX() + 1);
723 fHM->
CreateCanvas(
"fh_ring_track_distance_truematch_" + s,
"fh_ring_track_distance_truematch_" + s, 1800, 600);
730 TH1D* py = (TH1D*) (
fHM->
H2(
"fhRingTrackDistVsMomTruematch" + s)
731 ->ProjectionY((
"fhRingTrackDistVsMomTruematch_py" + s).c_str())
737 fHM->
H2(
"fhRingTrackDistVsMomTruematch" + s)->GetYaxis()->SetRangeUser(0., 2.);
738 fHM->
H2(
"fhRingTrackDistVsNofHitsTruematch" + s)->GetYaxis()->SetRangeUser(0., 2.);
743 fHM->
CreateCanvas(
"fh_ring_track_distance_wrongmatch" + s,
"fh_ring_track_distance_wrongmatch" + s, 600, 600);
744 TH1D* py = (TH1D*) (
fHM->
H2(
"fhRingTrackDistVsMomWrongmatch" + s)
745 ->ProjectionY((
"fhRingTrackDistVsMomWrongmatch_py" + s).c_str())
753 TCanvas* c =
fHM->
CreateCanvas(
"fh_ring_track_distance_vs_xy_truematch" + s,
754 "fh_ring_track_distance_vs_xy_truematch" + s, 1800, 600);
760 fHM->
H2(
"fhRingTrackDistVsXTruematch" + s)->GetYaxis()->SetRangeUser(0., 1.5);
763 fHM->
H2(
"fhRingTrackDistVsYTruematch" + s)->GetYaxis()->SetRangeUser(0., 1.5);
770 TCanvas* c =
fHM->
CreateCanvas(
"fh_ring_track_distance_vs_xy_truematch_half_" + s,
771 "fh_ring_track_distance_vs_xy_truematch_half_" + s, 1800, 600);
773 TH3D* h1 = (TH3D*)
fHM->
H3(
"fhRingTrackDistVsXYTruematch" + s)->Clone();
774 TH3D* h2 = (TH3D*)
fHM->
H3(
"fhRingTrackDistVsXYTruematch" + s)->Clone();
776 h1->GetYaxis()->SetRangeUser(110., 200.);
779 h2->GetYaxis()->SetRangeUser(-200., -110.);
784 TCanvas* c =
fHM->
CreateCanvas(
"fh_track_ring_distance_diff_x_y_track_vs_xy_truematch_projection_" + s,
785 "fh_track_ring_distance_diff_x_y_track_vs_xy_truematch_projection_" + s, 1800, 600);
787 TH3D* h1 = (TH3D*)
fHM->
H3(
"fhRingTrackDistVsXYTruematch" + s)->Clone();
789 TH2D* h2 = (TH2D*) h1->Project3D(
"yx")->Clone();
790 h2->GetYaxis()->SetRangeUser(110., 200.);
794 TH2D* h3 = (TH2D*) h1->Project3D(
"yx")->Clone();
795 h3->GetYaxis()->SetRangeUser(-200., -110.);
802 TCanvas* c =
fHM->
CreateCanvas(
"fh_ring_track_distance_diff_x_y_ring_vs_xy_truematch_up_" + s,
803 "fh_ring_track_distance_diff_x_y_ring_vs_xy_truematch_up_" + s, 1800, 600);
806 DrawH3Profile(
fHM->
H3(
"fhRingTrackDistDiffXRingVsXYTruematchUp" + s),
true,
false, -range, range);
808 DrawH3Profile(
fHM->
H3(
"fhRingTrackDistDiffYRingVsXYTruematchUp" + s),
true,
false, -range, range);
812 TCanvas* c =
fHM->
CreateCanvas(
"fh_ring_track_distance_diff_x_y_ring_vs_xy_truematch_down_" + s,
813 "fh_ring_track_distance_diff_x_y_ring_vs_xy_truematch_down_" + s, 1800, 600);
816 DrawH3Profile(
fHM->
H3(
"fhRingTrackDistDiffXRingVsXYTruematchDown" + s),
true,
false, -range, range);
818 DrawH3Profile(
fHM->
H3(
"fhRingTrackDistDiffYRingVsXYTruematchDown" + s),
true,
false, -range, range);
835 TCanvas* c =
fHM->
CreateCanvas(
"fh_track_ring_distance_diff_x_y_track_vs_xy_truematch_up_" + s,
836 "fh_track_ring_distance_diff_x_y_track_vs_xy_truematch_up_" + s, 1800, 600);
839 DrawH3Profile(
fHM->
H3(
"fhRingTrackDistDiffXTrackVsXYTruematchUp" + s),
true,
false, -range, range);
841 DrawH3Profile(
fHM->
H3(
"fhRingTrackDistDiffYTrackVsXYTruematchUp" + s),
true,
false, -range, range);
845 TCanvas* c =
fHM->
CreateCanvas(
"fh_track_ring_distance_diff_x_y_track_vs_xy_truematch_down_" + s,
846 "fh_track_ring_distance_diff_x_y_track_vs_xy_truematch_down_" + s, 1800, 600);
849 DrawH3Profile(
fHM->
H3(
"fhRingTrackDistDiffXTrackVsXYTruematchDown" + s),
true,
false, -range, range);
851 DrawH3Profile(
fHM->
H3(
"fhRingTrackDistDiffYTrackVsXYTruematchDown" + s),
true,
false, -range, range);
855 TCanvas* c =
fHM->
CreateCanvas(
"fh_track_ring_distance_vs_xy_truematch_halves_" + s,
856 "fh_track_ring_distance_vs_xy_truematch_halves_" + s, 1800, 600);
859 DrawH3Profile(
fHM->
H3(
"fhRingTrackDistVsXYHalfUpTruematch" + s),
true,
false, 0., range);
861 DrawH3Profile(
fHM->
H3(
"fhRingTrackDistVsXYHalfDownTruematch" + s),
true,
false, 0., range);
867 if (mctrack ==
nullptr)
return false;
875 if (mctrack ==
nullptr)
return false;
877 if (pdg == 211)
return true;
885 TDirectory* oldir = gDirectory;
886 TFile* outFile = FairRootManager::Instance()->GetOutFile();
887 if (outFile != NULL) {
891 gDirectory->cd(oldir->GetPath());
902 TFile* oldFile = gFile;
903 TDirectory* oldDir = gDirectory;
905 if (
fHM !=
nullptr)
delete fHM;
908 TFile* file =
new TFile(fileName.c_str());
ClassImp(CbmConverterManager)
void DrawH2WithProfile(TH2 *hist, Bool_t doGaussFit, Bool_t drawOnlyMean, const string &drawOpt2D, Int_t profileColor, Int_t profileLineWidth)
void DrawTextOnPad(const string &text, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
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)
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.
FairTask for matching RECO data to MC.
Generates beam ions for transport simulation.
int32_t GetStsTrackIndex() const
int32_t GetRichRingIndex() const
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.
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 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 * H1(const std::string &name) const
Return pointer to TH1 histogram.
double GetCharge() const
Charge of the associated particle.
uint32_t GetGeantProcessId() const
int32_t GetPdgCode() const
static std::vector< CbmLink > GetMcTrackMotherIdsForRichHit(CbmDigiManager *digiMan, const CbmRichHit *hit, CbmMCDataArray *richPoints, CbmMCDataArray *mcTracks)
Get CbmLinks of Mother MC Tracks for RICH hit.
const CbmLink & GetMatchedLink() const
TClonesArray * fRichProjections
void RingTrackMismatchSource()
Fill histograms related to study of the source of ring-track mismatch.
void DrawRingTrackDistHistWithSuffix(const string &suffix)
Draw histograms related to ring-track distance for pions or electrons (+/-).
TClonesArray * fGlobalTracks
std::map< Int_t, Int_t > fNofHitsInRingMap
TClonesArray * fRichDigis
void FillRingTrackDistance()
Fill histogramms related to ring track distance.
void InitHistograms()
Initialize histograms.
string GetMeanRmsOverflowString(TH1 *h, Bool_t withOverflow=true)
Return string with mean, RMS and overflow percent for input TH1.
static Bool_t IsMcPrimaryElectron(const CbmMCTrack *mctrack)
TClonesArray * fRichRings
virtual InitStatus Init()
Inherited from FairTask.
bool HasRichProjection(Int_t stsTrackId)
void DrawRingTrackDistHistWithSuffixPmtHalf(const string &suffix)
bool WasRingMatched(Int_t mcTrackId)
TClonesArray * fRichRingMatches
void DrawFromFile(const string &fileName, const string &outputDir)
Draw histogram from file.
TClonesArray * fStsTracks
TClonesArray * fStsTrackMatches
bool WasRingFound(Int_t mcTrackId)
static Bool_t IsMcPion(const CbmMCTrack *mctrack)
TClonesArray * fRichPoints
void DrawHist()
Draw histograms.
virtual void Exec(Option_t *option)
Inherited from FairTask.
CbmRichRecoQa()
Standard constructor.
virtual void Finish()
Inherited from FairTask.
void FillRichRingNofHits()
Fill map mcTrackId -> nof RICH hits.
int32_t GetNofHits() const
static double GetRingTrackDistanceY(int globalTrackId)
static double GetRingTrackDistance(int globalTrackId)
static double GetRingTrackDistanceX(int globalTrackId)
std::string NumberToString(const T &value, int precision=1)