59 canv->Divide(1, 2, 0.000001, 0.000001);
62 gPad->SetBottomMargin(0.000001);
63 gPad->SetRightMargin(0.05);
65 auto* ph_hit_xz =
dynamic_cast<TH2F*
>(
fph_hit_xz.back()->Clone(
"h_hit_xz_clone"));
66 ph_hit_xz->SetTitle(
";z [cm];x [cm]");
67 ph_hit_xz->Draw(
"col");
71 gPad->SetTopMargin(0.000001);
72 gPad->SetRightMargin(0.05);
74 auto* ph_hit_yz =
dynamic_cast<TH2F*
>(
fph_hit_yz.back()->Clone(
"h_hit_yz_clone"));
75 ph_hit_yz->SetTitle(
";z [cm];y [cm]");
76 ph_hit_yz->Draw(
"col");
80 auto LoBinEdge = [](TAxis* pAxis,
double val) {
return pAxis->GetBinLowEdge(pAxis->FindBin(val)); };
81 auto UpBinEdge = [](TAxis* pAxis,
double val) {
return pAxis->GetBinUpEdge(pAxis->FindBin(val)); };
83 for (
int iDet = 0; iDet < static_cast<int>(
fvpDetInterface.size()); ++iDet) {
88 for (
int iSt = 0; iSt < nSt; ++iSt) {
90 Color_t boxColor = (iStActive < 0) ? kGray + 1 : kOrange + 2;
91 const char* detName = Form(
"%s-%d",
fvpDetInterface[iDet]->GetDetectorName().c_str(), iSt);
98 auto* pBox =
new TBox(zMin, xMin, zMax, xMax);
99 pBox->SetFillStyle(0);
100 pBox->SetLineWidth(2);
101 pBox->SetLineColor(boxColor);
103 auto* pText =
new TText(zMin, xMax, detName);
104 pText->SetTextColor(boxColor);
105 pText->SetTextSize(0.035);
106 pText->SetTextAngle(45);
115 auto* pBox =
new TBox(zMin, yMin, zMax, yMax);
116 pBox->SetFillStyle(0);
117 pBox->SetLineWidth(2);
118 pBox->SetLineColor(boxColor);
120 auto* pText =
new TText(zMin, yMax, detName);
121 pText->SetTextSize(0.035);
122 pText->SetTextColor(boxColor);
123 pText->SetTextAngle(45);
138 int nHits =
fvpBrHits[DetID]->GetEntriesFast();
140 for (
int iH = 0; iH < nHits; ++iH) {
141 const auto* pHit =
dynamic_cast<const Hit_t*
>(
fvpBrHits[DetID]->At(iH));
143 LOG(warn) << fName <<
": hit with iH = " << iH <<
" for detector " <<
kDetName[DetID] <<
" is not found";
145 auto address = pHit->GetAddress();
148 if constexpr (ca::EDetectorID::kTof == DetID) {
159 int iStGeo =
fpParameters->GetStationIndexGeometry(iStLoc, DetID);
160 auto xHit = pHit->GetX();
161 auto yHit = pHit->GetY();
162 auto zHit = pHit->GetZ();
163 if (
fvXmin[DetID][iStLoc] > xHit) {
164 fvXmin[DetID][iStLoc] = xHit;
166 if (
fvXmax[DetID][iStLoc] < xHit) {
167 fvXmax[DetID][iStLoc] = xHit;
169 if (
fvYmin[DetID][iStLoc] > yHit) {
170 fvYmin[DetID][iStLoc] = yHit;
172 if (
fvYmax[DetID][iStLoc] < yHit) {
173 fvYmax[DetID][iStLoc] = yHit;
175 if (
fvZmin[DetID][iStLoc] > zHit) {
176 fvZmin[DetID][iStLoc] = zHit;
178 if (
fvZmax[DetID][iStLoc] < zHit) {
179 fvZmax[DetID][iStLoc] = zHit;
192 for (
int iE = 0; iE < nMCevents; ++iE) {
195 int nPoints =
fvpBrPoints[DetID]->Size(iFile, iEvent);
197 for (
int iP = 0; iP < nPoints; ++iP) {
198 const auto* pPoint =
dynamic_cast<const McPoint_t*
>(
fvpBrPoints[DetID]->Get(iFile, iEvent, iP));
200 LOG(error) << fName <<
": point with iFile=" << iFile <<
", iEvent=" << iEvent <<
", iP=" << iP
201 <<
" for detector " <<
kDetName[DetID] <<
" is not found";
204 auto address = pPoint->GetDetectorID();
211 int iStGeo =
fpParameters->GetStationIndexGeometry(iStLoc, DetID);
212 auto xPoint = pPoint->FairMCPoint::GetX();
213 auto yPoint = pPoint->FairMCPoint::GetY();
214 auto zPoint = pPoint->FairMCPoint::GetZ();
254 LOG(info) << fName <<
": initializing... ";
258 LOG(info) << fName <<
": parameters instance, reference: " <<
fpParameters.use_count();
260 auto pFairManager = FairRootManager::Instance();
261 assert(pFairManager);
276 fvXmin[detID].resize(nSt, std::numeric_limits<double>::max());
277 fvXmax[detID].resize(nSt, std::numeric_limits<double>::lowest());
278 fvYmin[detID].resize(nSt, std::numeric_limits<double>::max());
279 fvYmax[detID].resize(nSt, std::numeric_limits<double>::lowest());
280 fvZmin[detID].resize(nSt, std::numeric_limits<double>::max());
281 fvZmax[detID].resize(nSt, std::numeric_limits<double>::lowest());
287 fvpBrHits[detID] =
dynamic_cast<TClonesArray*
>(pFairManager->GetObject(brName));
289 return static_cast<bool>(
fvpBrHits[detID]);
292 auto InitPointBranch = [&](
const char* brName,
ca::EDetectorID detID) {
294 fvpBrPoints[detID] = pMcManager->InitBranch(brName);
304 InitHitBranch(
"MvdHit", ca::EDetectorID::kMvd);
305 InitHitBranch(
"StsHit", ca::EDetectorID::kSts);
306 InitHitBranch(
"MuchPixelHit", ca::EDetectorID::kMuch);
307 InitHitBranch(
"TrdHit", ca::EDetectorID::kTrd);
308 if (!InitHitBranch(
"TofCalHit", ca::EDetectorID::kTof)) {
309 InitHitBranch(
"TofHit", ca::EDetectorID::kTof);
312 InitPointBranch(
"MvdPoint", ca::EDetectorID::kMvd);
313 InitPointBranch(
"StsPoint", ca::EDetectorID::kSts);
314 InitPointBranch(
"MuchPoint", ca::EDetectorID::kMuch);
315 InitPointBranch(
"TrdPoint", ca::EDetectorID::kTrd);
316 InitPointBranch(
"TofPoint", ca::EDetectorID::kTof);
324 for (
int iD = 0; iD < static_cast<int>(ca::EDetectorID::END); ++iD) {
330 for (
int iD = 0; iD < static_cast<int>(ca::EDetectorID::END); ++iD) {
344 constexpr int kNbinsZ = 300;
345 constexpr int kNbinsX = 200;
346 constexpr int kNbinsY = 200;
347 constexpr float kMinZ = -5.;
348 constexpr float kMaxZ = 350.;
349 constexpr float kMinX = -100.;
350 constexpr float kMaxX = 100.;
351 constexpr float kMinY = -100.;
352 constexpr float kMaxY = 100.;
354 for (
int iStGeo = 0; iStGeo <= nStGeo; ++iStGeo) {
355 auto [detID, iStLoc] =
fpParameters->GetStationIndexLocal(iStGeo);
359 TString sNsuff = (iStGeo == nStGeo) ?
"" : Form(
"_st_%s%d",
kDetName[detID], iStLoc);
360 TString sTsuff = (iStGeo == nStGeo) ?
"" : Form(
" in %s station %d",
kDetName[detID], iStLoc);
363 sF = Form(
"hit_occupancy%s", ((iStGeo == nStGeo) ?
"" : Form(
"/%s",
kDetName[detID])));
364 sN = Form(
"hit_xz%s", sNsuff.Data());
365 sT = Form(
"hit occupancy in xz-plane%s;z_{hit} [cm];x_{hit} [cm]", sTsuff.Data());
368 sN = Form(
"hit_yz%s", sNsuff.Data());
369 sT = Form(
"hit occupancy in yz-plane%s;z_{hit} [cm];y_{hit} [cm]", sTsuff.Data());
372 if (iStGeo < nStGeo) {
373 sN = Form(
"hit_xy%s", sNsuff.Data());
374 sT = Form(
"hit occupancy in xy-plane%s;x_{hit} [cm];y_{hit} [cm]", sTsuff.Data());
380 sF = Form(
"point_occupancy%s", ((iStGeo == nStGeo) ?
"" : Form(
"/%s",
kDetName[detID])));
381 sN = Form(
"point_xz%s", sNsuff.Data());
382 sT = Form(
"point occupancy in xz-plane%s;z_{point} [cm];x_{point} [cm]", sTsuff.Data());
385 sN = Form(
"point_yz%s", sNsuff.Data());
386 sT = Form(
"point occupancy in yz-plane%s;z_{point} [cm];y_{point} [cm]", sTsuff.Data());
389 if (iStGeo < nStGeo) {
390 sN = Form(
"point_xy%s", sNsuff.Data());
391 sT = Form(
"point occupancy in xy-plane%s;x_{point} [cm];y_{point} [cm]", sTsuff.Data());
398 auto CreateMaterialBudgetHistograms = [&](
const auto& kfSetup,
const TString& dir) {
399 for (
int iLayer = 0; iLayer < kfSetup.GetNofLayers(); ++iLayer) {
400 const auto& matMap{kfSetup.GetMaterial(iLayer)};
401 auto [detID, stationID] = kfSetup.GetIndexMap().GlobalToLocal(iLayer);
402 TString sN = Form(
"%s/mat_budget_%s_st%d", dir.Data(),
kDetName[detID], stationID);
404 Form(
"Material budget map for %s station %d;x [cm];y [cm]; X/X_{0} [%%]",
kDetName[detID], stationID);
405 auto nBins{matMap.GetNbins()};
406 auto xMin{-matMap.GetXYmax()};
407 auto xMax{+matMap.GetXYmax()};
409 for (
int iX = 0; iX < nBins; ++iX) {
410 for (
int iY = 0; iY < nBins; ++iY) {
411 pHist->SetBinContent(iX + 1, iY + 1, 100. * matMap.template GetBinThicknessX0<float>(iX, iY));
419 CreateMaterialBudgetHistograms(
fpParameters->GetGeometrySetup(),
"TrackingKFSetup/geometry");
421 CreateMaterialBudgetHistograms(
fpParameters->GetActiveSetup(),
"TrackingKFSetup/active");
423 LOG(info) << fName <<
": initializing... \033[1;32mDone\033[0m";
426catch (
const std::exception& e) {
427 LOG(error) << fName <<
": initializing... \033[1;31mFailed\033[0m\nReason: " << e.what();