15 : FairTask(name, verbose)
16 , fOutFolder(
"MuchTransportQA",
"Much Transport QA")
17 , fhNevents(
"nEvents", 0)
24 , fvMcPointPrimRatio() {}
97 TDirectory* oldDirectory = gDirectory;
98 FairRootManager* manager = FairRootManager::Instance();
99 fMcTracks = (TClonesArray*) manager->GetObject(
"MCTrack");
100 fPoints = (TClonesArray*) manager->GetObject(
"MuchPoint");
105 LOG(error) <<
"No FairRootManager found";
109 LOG(error) <<
"No MC tracks found";
113 LOG(error) <<
"No MC points found";
117 LOG(fatal) <<
"No CbmMuchGeoScheme found";
121 LOG(error) <<
"CbmMuchGeoScheme is not initialized";
127 LOG(fatal) <<
"Much station " <<
i <<
" doesn't exist";
140 gDirectory = oldDirectory;
151 new TH1F(
"hUsNtraPrim",
"N primary tracks",
BINS_STA));
153 new TH1F(
"hUsNtraSec",
"N secondary tracks",
BINS_STA));
162 h->GetXaxis()->SetTitle(
"Station");
173 "hFractionPrim",
"Fraction of primary tracks",
BINS_STA));
175 "hFractionSec",
"Fraction of secondary tracks",
BINS_STA));
177 new TH1F(
"hFractionPr",
"Fraction of protons",
BINS_STA));
179 new TH1F(
"hFractionPi",
"Fraction of pions",
BINS_STA));
181 new TH1F(
"hFractionEl",
"Fraction of electrons",
BINS_STA));
183 new TH1F(
"hFractionMu",
"Fraction of muons",
BINS_STA));
185 new TH1F(
"hFractionKa",
"Fraction of kaons",
BINS_STA));
190 h->GetXaxis()->SetTitle(
"Station");
192 h->GetYaxis()->SetTitle(
"N tracks");
194 h->GetYaxis()->SetTitle(
"%");
208 Double_t rMax = station->
GetRmax();
209 Double_t rMin = station->
GetRmin();
212 Form(
"MC point XY : Station %i; X; Y",
i + 1),
220 new TH2F(Form(
"hMcPointPhiZ%i",
i + 1),
221 Form(
"MC point Phi vs Z : Station %i; Z; Phi",
i + 1),
229 float dR = rMax - rMin;
231 Form(
"MC point R vs Z : Station %i; Z; R",
i + 1),
250 new TPie(Form(
"fvMcPointPRatio%i",
i + 1),
251 Form(
"McPoint Particle Ratios: Station %i",
i + 1),
255 new TPie(Form(
"fvMcPointPrimRatio%i",
i + 1),
256 Form(
"McPoint Primary/Secondary Track: Station %i",
i + 1),
267 new CbmQaCanvas(
"cMcPointXY",
"Much: MC point XY", 2 * 400, 2 * 400);
271 "cMcPointPhiZ",
"Much: MC point Phi vs Z", 2 * 800, 2 * 400);
275 new CbmQaCanvas(
"cMcPointRZ",
"Much: MC point R vs Z", 2 * 800, 2 * 400);
279 new CbmQaCanvas(
"cUsNtra",
"Much: MC unscaled counts", 3 * 400, 3 * 400);
283 "cMcPointPRatios",
"Much: MC particle ratios", 2 * 400, 2 * 400);
288 "Much: MC primary/secondary track ratios",
332 LOG(info) <<
"Event: " <<
fhNevents.GetVal();
335 std::vector<UInt_t> trackStaCross(
fMcTracks->GetEntriesFast(), 0);
337 for (Int_t
i = 0;
i <
fPoints->GetEntriesFast();
i++) {
341 UInt_t stMask = (1 << stId);
342 Int_t trackId = point->GetTrackID();
344 LOG(fatal) <<
"Much point " <<
i <<
" doesn't exist";
347 if (trackId < 0 || trackId >=
fMcTracks->GetEntriesFast()) {
348 LOG(fatal) <<
"Much point " <<
i <<
": trackId " << trackId
349 <<
" doesn't belong to [0," <<
fMcTracks->GetEntriesFast() - 1
356 LOG(fatal) <<
"MC track " << trackId <<
" doesn't exist";
363 TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(pdgCode);
365 LOG(warning) <<
"Particle with pdg code " << pdgCode <<
" doesn't exist";
368 if (pdgCode == 0 || pdgCode == 22 ||
371 LOG(warning) <<
"Particle with pdg code " << pdgCode
372 <<
" left an mc point";
376 if (!(trackStaCross[trackId] & stMask)) {
379 trackStaCross[trackId] |= stMask;
388 if (motherId == -1) {
393 switch (abs(pdgCode)) {
423 fvMcPointPhiZ[stId]->Fill(v1.Z(), v1.Phi() * TMath::RadToDeg());
424 fvMcPointPhiZ[stId]->Fill(v2.Z(), v2.Phi() * TMath::RadToDeg());
432 TDirectory* oldDirectory = gDirectory;
447 gDirectory = oldDirectory;
456 gStyle->SetOptStat(0);
460 gStyle->SetOptStat(0);
464 gStyle->SetOptStat(0);
468 gStyle->SetOptStat(0);
472 PRatioPieLeg->SetY1(.56);
473 PRatioPieLeg->SetY2(.86);
476 gStyle->SetOptStat(0);
480 PrimRatioPieLeg->SetY1(.71);
481 PrimRatioPieLeg->SetY2(.86);
482 PrimRatioPieLeg->SetX1(.40);
483 PrimRatioPieLeg->SetX2(.90);
485 gStyle->SetOptStat(1110);
489 gStyle->SetOptStat(0);
493 gStyle->SetOptStat(0);
497 gStyle->SetOptStat(0);
501 gStyle->SetOptStat(0);
505 gStyle->SetOptStat(0);
509 gStyle->SetOptStat(0);
513 gStyle->SetOptStat(0);
517 gStyle->SetOptStat(0);
521 gStyle->SetOptStat(0);
533 Int_t PRatiosColors[] = {4, 3, 2, 5, 6};
548 Form(
"#pi: %.1f %%", PRatios[2]));
550 Form(
"#mu: %.1f %%", PRatios[3]));
563 Int_t PrimRatiosColors[] = {6, 4};
570 Form(
"Primary: %.1f %%", PrimRatios[0]));
572 Form(
"Secondary: %.1f %%", PrimRatios[1]));
582 if (!FairRootManager::Instance() || !FairRootManager::Instance()->GetSink()) {
583 LOG(error) <<
"No sink found";
586 FairSink* sink = FairRootManager::Instance()->GetSink();
587 sink->WriteObject(&
GetQa(),
nullptr);