77 canv->Divide(1, 2, 0.000001, 0.000001);
80 gPad->SetBottomMargin(0.000001);
81 gPad->SetRightMargin(0.05);
83 auto* ph_hit_xz =
dynamic_cast<TH2F*
>(
fph_hit_xz.back()->Clone(
"h_hit_xz_clone"));
84 ph_hit_xz->SetTitle(
";z [cm];x [cm]");
85 ph_hit_xz->Draw(
"col");
89 gPad->SetTopMargin(0.000001);
90 gPad->SetRightMargin(0.05);
92 auto* ph_hit_yz =
dynamic_cast<TH2F*
>(
fph_hit_yz.back()->Clone(
"h_hit_yz_clone"));
93 ph_hit_yz->SetTitle(
";z [cm];y [cm]");
94 ph_hit_yz->Draw(
"col");
98 auto LoBinEdge = [](TAxis* pAxis,
double val) {
return pAxis->GetBinLowEdge(pAxis->FindBin(val)); };
99 auto UpBinEdge = [](TAxis* pAxis,
double val) {
return pAxis->GetBinUpEdge(pAxis->FindBin(val)); };
101 for (
int iDet = 0; iDet < static_cast<int>(
fvpDetInterface.size()); ++iDet) {
106 for (
int iSt = 0; iSt < nSt; ++iSt) {
108 Color_t boxColor = (iStActive < 0) ? kGray + 1 : kOrange + 2;
109 const char* detName = Form(
"%s-%d",
fvpDetInterface[iDet]->GetDetectorName().c_str(), iSt);
116 auto* pBox =
new TBox(zMin, xMin, zMax, xMax);
117 pBox->SetFillStyle(0);
118 pBox->SetLineWidth(2);
119 pBox->SetLineColor(boxColor);
121 auto* pText =
new TText(zMin, xMax, detName);
122 pText->SetTextColor(boxColor);
123 pText->SetTextSize(0.035);
124 pText->SetTextAngle(45);
133 auto* pBox =
new TBox(zMin, yMin, zMax, yMax);
134 pBox->SetFillStyle(0);
135 pBox->SetLineWidth(2);
136 pBox->SetLineColor(boxColor);
138 auto* pText =
new TText(zMin, yMax, detName);
139 pText->SetTextSize(0.035);
140 pText->SetTextColor(boxColor);
141 pText->SetTextAngle(45);
156 int nHits =
fvpBrHits[DetID]->GetEntriesFast();
158 for (
int iH = 0; iH < nHits; ++iH) {
159 const auto* pHit =
dynamic_cast<const Hit_t*
>(
fvpBrHits[DetID]->At(iH));
161 LOG(warn) << fName <<
": hit with iH = " << iH <<
" for detector " <<
kDetName[DetID] <<
" is not found";
163 auto address = pHit->GetAddress();
166 if constexpr (ca::EDetectorID::kTof == DetID) {
177 int iStGeo =
fpParameters->GetStationIndexGeometry(iStLoc, DetID);
178 auto xHit = pHit->GetX();
179 auto yHit = pHit->GetY();
180 auto zHit = pHit->GetZ();
181 if (
fvXmin[DetID][iStLoc] > xHit) {
182 fvXmin[DetID][iStLoc] = xHit;
184 if (
fvXmax[DetID][iStLoc] < xHit) {
185 fvXmax[DetID][iStLoc] = xHit;
187 if (
fvYmin[DetID][iStLoc] > yHit) {
188 fvYmin[DetID][iStLoc] = yHit;
190 if (
fvYmax[DetID][iStLoc] < yHit) {
191 fvYmax[DetID][iStLoc] = yHit;
193 if (
fvZmin[DetID][iStLoc] > zHit) {
194 fvZmin[DetID][iStLoc] = zHit;
196 if (
fvZmax[DetID][iStLoc] < zHit) {
197 fvZmax[DetID][iStLoc] = zHit;
210 for (
int iE = 0; iE < nMCevents; ++iE) {
213 int nPoints =
fvpBrPoints[DetID]->Size(iFile, iEvent);
215 for (
int iP = 0; iP < nPoints; ++iP) {
216 const auto* pPoint =
dynamic_cast<const McPoint_t*
>(
fvpBrPoints[DetID]->Get(iFile, iEvent, iP));
218 LOG(error) << fName <<
": point with iFile=" << iFile <<
", iEvent=" << iEvent <<
", iP=" << iP
219 <<
" for detector " <<
kDetName[DetID] <<
" is not found";
222 auto address = pPoint->GetDetectorID();
229 int iStGeo =
fpParameters->GetStationIndexGeometry(iStLoc, DetID);
230 auto xPoint = pPoint->FairMCPoint::GetX();
231 auto yPoint = pPoint->FairMCPoint::GetY();
232 auto zPoint = pPoint->FairMCPoint::GetZ();
272 LOG(info) << fName <<
": initializing... ";
277 LOG(info) << fName <<
": parameters instance, reference: " <<
fpParameters.use_count();
279 auto pFairManager = FairRootManager::Instance();
280 assert(pFairManager);
295 fvXmin[detID].resize(nSt, std::numeric_limits<double>::max());
296 fvXmax[detID].resize(nSt, std::numeric_limits<double>::lowest());
297 fvYmin[detID].resize(nSt, std::numeric_limits<double>::max());
298 fvYmax[detID].resize(nSt, std::numeric_limits<double>::lowest());
299 fvZmin[detID].resize(nSt, std::numeric_limits<double>::max());
300 fvZmax[detID].resize(nSt, std::numeric_limits<double>::lowest());
306 fvpBrHits[detID] =
dynamic_cast<TClonesArray*
>(pFairManager->GetObject(brName));
311 return static_cast<bool>(
fvpBrHits[detID]);
314 auto InitPointBranch = [&](
const char* brName,
ca::EDetectorID detID) {
316 fvpBrPoints[detID] = pMcManager->InitBranch(brName);
326 InitHitBranch(
"MvdHit", ca::EDetectorID::kMvd);
327 InitHitBranch(
"StsHit", ca::EDetectorID::kSts);
328 InitHitBranch(
"MuchPixelHit", ca::EDetectorID::kMuch);
329 InitHitBranch(
"TrdHit", ca::EDetectorID::kTrd);
330 if (!InitHitBranch(
"TofCalHit", ca::EDetectorID::kTof)) {
331 InitHitBranch(
"TofHit", ca::EDetectorID::kTof);
334 InitPointBranch(
"MvdPoint", ca::EDetectorID::kMvd);
335 InitPointBranch(
"StsPoint", ca::EDetectorID::kSts);
336 InitPointBranch(
"MuchPoint", ca::EDetectorID::kMuch);
337 InitPointBranch(
"TrdPoint", ca::EDetectorID::kTrd);
338 InitPointBranch(
"TofPoint", ca::EDetectorID::kTof);
346 for (
int iD = 0; iD < static_cast<int>(ca::EDetectorID::END); ++iD) {
352 for (
int iD = 0; iD < static_cast<int>(ca::EDetectorID::END); ++iD) {
366 constexpr int kNbinsZ = 300;
367 constexpr int kNbinsX = 200;
368 constexpr int kNbinsY = 200;
369 constexpr float kMinZ = -5.;
370 constexpr float kMaxZ = 350.;
371 constexpr float kMinX = -100.;
372 constexpr float kMaxX = 100.;
373 constexpr float kMinY = -100.;
374 constexpr float kMaxY = 100.;
376 for (
int iStGeo = 0; iStGeo <= nStGeo; ++iStGeo) {
377 auto [detID, iStLoc] =
fpParameters->GetStationIndexLocal(iStGeo);
381 TString sNsuff = (iStGeo == nStGeo) ?
"" : Form(
"_st_%s%d",
kDetName[detID], iStLoc);
382 TString sTsuff = (iStGeo == nStGeo) ?
"" : Form(
" in %s station %d",
kDetName[detID], iStLoc);
385 sF = Form(
"hit_occupancy%s", ((iStGeo == nStGeo) ?
"" : Form(
"/%s",
kDetName[detID])));
386 sN = Form(
"hit_xz%s", sNsuff.Data());
387 sT = Form(
"hit occupancy in xz-plane%s;z_{hit} [cm];x_{hit} [cm]", sTsuff.Data());
390 sN = Form(
"hit_yz%s", sNsuff.Data());
391 sT = Form(
"hit occupancy in yz-plane%s;z_{hit} [cm];y_{hit} [cm]", sTsuff.Data());
394 if (iStGeo < nStGeo) {
395 sN = Form(
"hit_xy%s", sNsuff.Data());
396 sT = Form(
"hit occupancy in xy-plane%s;x_{hit} [cm];y_{hit} [cm]", sTsuff.Data());
402 sF = Form(
"point_occupancy%s", ((iStGeo == nStGeo) ?
"" : Form(
"/%s",
kDetName[detID])));
403 sN = Form(
"point_xz%s", sNsuff.Data());
404 sT = Form(
"point occupancy in xz-plane%s;z_{point} [cm];x_{point} [cm]", sTsuff.Data());
407 sN = Form(
"point_yz%s", sNsuff.Data());
408 sT = Form(
"point occupancy in yz-plane%s;z_{point} [cm];y_{point} [cm]", sTsuff.Data());
411 if (iStGeo < nStGeo) {
412 sN = Form(
"point_xy%s", sNsuff.Data());
413 sT = Form(
"point occupancy in xy-plane%s;x_{point} [cm];y_{point} [cm]", sTsuff.Data());
420 auto CreateMaterialBudgetHistograms = [&](
const auto& kfSetup,
const TString& dir) {
421 for (
int iLayer = 0; iLayer < kfSetup.GetNofLayers(); ++iLayer) {
422 const auto& matMap{kfSetup.GetMaterial(iLayer)};
423 auto [detID, stationID] = kfSetup.GetIndexMap().GlobalToLocal(iLayer);
424 TString sN = Form(
"%s/mat_budget_%s_st%d", dir.Data(),
kDetName[detID], stationID);
426 Form(
"Material budget map for %s station %d;x [cm];y [cm]; X/X_{0} [%%]",
kDetName[detID], stationID);
427 auto nBins{matMap.GetNbins()};
428 auto xMin{-matMap.GetXYmax()};
429 auto xMax{+matMap.GetXYmax()};
431 for (
int iX = 0; iX < nBins; ++iX) {
432 for (
int iY = 0; iY < nBins; ++iY) {
433 pHist->SetBinContent(iX + 1, iY + 1, 100. * matMap.template GetBinThicknessX0<float>(iX, iY));
441 CreateMaterialBudgetHistograms(
fpParameters->GetGeometrySetup(),
"TrackingKFSetup/geometry");
443 CreateMaterialBudgetHistograms(
fpParameters->GetActiveSetup(),
"TrackingKFSetup/active");
445 LOG(info) << fName <<
": initializing... \033[1;32mDone\033[0m";
448catch (
const std::exception& e) {
449 LOG(error) << fName <<
": initializing... \033[1;31mFailed\033[0m\nReason: " << e.what();