137 constexpr double kZmin = 0.;
138 constexpr double kZmax = 300.;
139 constexpr double kXmin = -100.;
140 constexpr double kXmax = +100.;
141 constexpr double kYmin = -100.;
142 constexpr double kYmax = +100.;
143 constexpr std::array<Color_t, 11> kColorMC = {205, 209, 213, 217, 225, 208, 213, 216, 219, 224, 227};
144 constexpr std::array<Color_t, 3> kColorGhost = {201, 202, 203};
145 constexpr int kCanvX = 1920;
146 constexpr int kCanvY = 1080;
147 constexpr double kLMargin = 0.05;
148 constexpr double kVEMargin = 0.15;
149 constexpr double kRMarginDispl = 0.4;
150 constexpr double kVIMargin = 0.0001;
151 constexpr Marker_t kMarkerPointWHit = 25;
152 constexpr Marker_t kMarkerPointWOHit = 5;
153 constexpr Marker_t kMarkerHitWPoint = 24;
154 constexpr Marker_t kMarkerHitWOPoint = 28;
155 constexpr double kFontSize = 0.035;
156 constexpr Width_t kLineWidth = 1;
157 constexpr Style_t kLineMCTrackReconstructed = 9;
158 constexpr Style_t kLineMCTrackNotReconstructed = 10;
159 constexpr Style_t kLineRecoTrackGhost = 2;
160 constexpr Style_t kLineRecoTrackNotGhost = 1;
164 pCanv->Divide(1, 2, kVIMargin, kVIMargin);
166 gPad->SetMargin(kLMargin, kRMarginDispl, kVIMargin, kVEMargin);
168 auto* pHistX =
new TH2F(Form(
"hFrameX_%d", iEvent),
";z [cm];x [cm]", 2, kZmin, kZmax, 2, kXmin, kXmax);
169 pHistX->GetYaxis()->SetTitleOffset(0.6);
170 pHistX->GetXaxis()->SetLabelSize(kFontSize);
171 pHistX->GetYaxis()->SetLabelSize(kFontSize);
172 pHistX->GetXaxis()->SetTitleSize(kFontSize);
173 pHistX->GetYaxis()->SetTitleSize(kFontSize);
174 pHistX->SetStats(
false);
177 gPad->SetMargin(kLMargin, kRMarginDispl, kVEMargin, kVIMargin);
179 auto* pHistY =
new TH2F(Form(
"hFrameY_%d", iEvent),
";z [cm];y [cm]", 2, kZmin, kZmax, 2, kYmin, kYmax);
180 pHistY->GetYaxis()->SetTitleOffset(0.6);
181 pHistY->GetXaxis()->SetLabelSize(kFontSize);
182 pHistY->GetYaxis()->SetLabelSize(kFontSize);
183 pHistY->GetXaxis()->SetTitleSize(kFontSize);
184 pHistY->GetYaxis()->SetTitleSize(kFontSize);
185 pHistY->SetStats(
false);
190 auto* pHeader =
new TLegend(kLMargin, 1 - kVEMargin + 0.01, 0.99, 0.99);
191 pHeader->SetNColumns(6);
192 pHeader->SetTextSize(kFontSize);
193 pHeader->SetMargin(0.1);
194 pHeader->AddEntry(
static_cast<TObject*
>(
nullptr), Form(
"event #%d", iEvent),
"");
195 pHeader->AddEntry(
new TMarker(0, 0, kMarkerPointWHit),
"point w/ hit",
"p");
196 pHeader->AddEntry(
new TMarker(0, 0, kMarkerPointWOHit),
"point w/o hit",
"p");
197 pHeader->AddEntry(
new TMarker(0, 0, kMarkerHitWPoint),
"hit w/ point",
"p");
198 pHeader->AddEntry(
new TMarker(0, 0, kMarkerHitWOPoint),
"hit w/o point",
"p");
199 pHeader->Draw(
"same");
201 auto* pLegendReco =
new TLegend(1 - kRMarginDispl, kVIMargin, 0.99, 1 - kVEMargin,
"Reco tracks");
202 pLegendReco->SetMargin(0.1);
203 pLegendReco->SetTextSize(kFontSize);
206 auto* pLegendMC =
new TLegend(1 - kRMarginDispl, kVEMargin, 0.99, 1 - kVIMargin,
"MC tracks");
207 pLegendMC->SetMargin(0.1);
208 pLegendMC->SetTextSize(kFontSize);
215 std::map<int, Color_t> mMCtrkColors;
219 for (
int iTmc = 0; iTmc <
nMCTracks; ++iTmc) {
221 int nPoints = trk.GetNofPoints();
225 std::vector<double> trkPointX(nPoints);
226 std::vector<double> trkPointY(nPoints);
227 std::vector<double> trkPointZ(nPoints);
228 for (
int iPLoc = 0; iPLoc < nPoints; ++iPLoc) {
230 trkPointX[iPLoc] = point.GetX();
231 trkPointY[iPLoc] = point.GetY();
232 trkPointZ[iPLoc] = point.GetZ();
234 Color_t currColor = 1;
235 Style_t currStyle = trk.IsReconstructed() ? kLineMCTrackReconstructed : kLineMCTrackNotReconstructed;
236 currColor = kColorMC[iColorRec];
237 iColorRec = (iColorRec + 1) %
static_cast<int>(kColorMC.size());
238 mMCtrkColors[trk.GetId()] = currColor;
241 auto*
gr =
new TGraph(nPoints, trkPointZ.data(), trkPointX.data());
242 gr->SetMarkerStyle(1);
243 gr->SetMarkerColor(currColor);
244 gr->SetLineColor(currColor);
245 gr->SetLineStyle(currStyle);
246 gr->SetLineWidth(kLineWidth);
249 std::stringstream msg;
250 msg <<
"ID=" << trk.GetId() <<
", ";
251 msg <<
"PDG=" << trk.GetPdgCode() <<
", ";
252 msg <<
"p=" << trk.GetP() <<
" GeV/c, ";
253 msg <<
"rec-able=" << trk.IsReconstructable() <<
", ";
254 msg <<
"rec-ed=" << trk.IsReconstructed() <<
", ";
255 if (trk.GetNofRecoTracks() > 0) {
257 for (
int iTr : trk.GetRecoTrackIndexes()) {
262 if (trk.GetNofTouchTracks() > 0) {
263 msg <<
"touch_IDs=(";
264 for (
int iTr : trk.GetTouchTrackIndexes()) {
269 pLegendMC->AddEntry(
gr, msg.str().c_str(),
"l");
273 auto*
gr =
new TGraph(nPoints, trkPointZ.data(), trkPointY.data());
274 gr->SetMarkerStyle(1);
275 gr->SetMarkerColor(currColor);
276 gr->SetLineColor(currColor);
277 gr->SetLineStyle(currStyle);
278 gr->SetLineWidth(kLineWidth);
285 for (
int iP = 0; iP < nPoints; ++iP) {
287 bool bHasHit = point.GetHitIndexes().size() > 0;
288 Marker_t style = bHasHit ? kMarkerPointWHit : kMarkerPointWOHit;
289 Color_t color = mMCtrkColors.at(point.GetTrackId());
292 auto* marker =
new TMarker(point.GetZ(), point.GetX(), style);
293 marker->SetMarkerColor(color);
294 marker->Draw(
"same");
296 auto* pText =
new TText(point.GetZ() + 2., point.GetX() + 2., Form(
"%d", point.GetStationId()));
297 pText->SetTextColor(color);
298 pText->SetTextSize(kFontSize);
303 auto* marker =
new TMarker(point.GetZ(), point.GetY(), style);
304 marker->SetMarkerColor(color);
305 marker->Draw(
"same");
307 auto* pText =
new TText(point.GetZ() + 2., point.GetY() + 2., Form(
"%d", point.GetStationId()));
308 pText->SetTextColor(color);
309 pText->SetTextSize(kFontSize);
316 std::vector<char> vbHitUsed(
fvHits.size());
317 std::vector<Color_t> vRecoTrkColors(
fvHits.size());
318 if (nRecoTracks > 0) {
319 for (
int iTr = 0; iTr < nRecoTracks; ++iTr) {
321 Color_t currColor = 1;
322 Style_t currStyle = trk.IsGhost() ? kLineRecoTrackGhost : kLineRecoTrackNotGhost;
324 currColor = kColorGhost[iColorGhost];
325 iColorGhost = (iColorGhost + 1) %
static_cast<int>(kColorGhost.size());
328 int iTmc = trk.GetMatchedMCTrackIndex();
329 currColor = iTmc > -1 ? mMCtrkColors[iTmc] : 1;
332 int nHits = trk.GetNofHits();
333 std::vector<double> trkHitX(nHits);
334 std::vector<double> trkHitY(nHits);
335 std::vector<double> trkHitZ(nHits);
336 for (
int iHLoc = 0; iHLoc < nHits; ++iHLoc) {
337 int iH = trk.GetHitIndexes()[iHLoc];
338 const auto& hit =
fvHits[iH];
339 vbHitUsed[iH] =
true;
340 trkHitX[iHLoc] = hit.GetX();
341 trkHitY[iHLoc] = hit.GetY();
342 trkHitZ[iHLoc] = hit.GetZ();
343 vRecoTrkColors[iH] = currColor;
348 auto*
gr =
new TGraph(nHits, trkHitZ.data(), trkHitX.data());
349 gr->SetMarkerStyle(1);
350 gr->SetMarkerColor(currColor);
351 gr->SetLineColor(currColor);
352 gr->SetLineStyle(currStyle);
353 gr->SetLineWidth(kLineWidth + 2);
358 auto*
gr =
new TGraph(nHits, trkHitZ.data(), trkHitY.data());
359 gr->SetMarkerStyle(1);
360 gr->SetMarkerColor(currColor);
361 gr->SetLineColor(currColor);
362 gr->SetLineStyle(currStyle);
363 gr->SetLineWidth(kLineWidth + 2);
365 std::stringstream msg;
366 msg <<
"ID=" << trk.index <<
", ";
368 for (
int iTmc : trk.GetMCTrackIndexes()) {
372 msg <<
"purity=" << trk.GetMaxPurity();
373 pLegendReco->AddEntry(
gr, msg.str().c_str(),
"l");
378 int nHits =
fvHits.size();
380 for (
int iH = 0; iH < nHits; ++iH) {
381 const auto& hit =
fvHits[iH];
382 bool bFake = hit.GetBestMcPointId() == -1;
383 bool bUsed = vbHitUsed[iH];
385 Marker_t style = bFake ? kMarkerHitWOPoint : kMarkerHitWPoint;
386 Color_t color = bUsed ? vRecoTrkColors[iH] : 1;
389 auto* marker =
new TMarker(hit.GetZ(), hit.GetX(), style);
390 marker->SetMarkerColor(color);
391 marker->Draw(
"same");
395 auto* marker =
new TMarker(hit.GetZ(), hit.GetY(), style);
396 marker->SetMarkerColor(color);
397 marker->Draw(
"same");
791 std::stringstream errMsg;
792 errMsg <<
"CA parameters input filename is not set. Please, provide initializer or read parameters from binary "
793 <<
"via OutputQa::ReadParameters(filename) from the qa macro\n";
794 throw std::runtime_error(errMsg.str());
798 LOG(info) << fName <<
": parameters instance, reference: " <<
fpParameters.use_count();
811 auto* fairManager = FairRootManager::Instance();
819 LOG(info) << fName <<
": Detector subsystems used:";
820 LOG(info) <<
"\tMVD: " << (
fbUseMvd ?
"ON" :
"OFF");
821 LOG(info) <<
"\tSTS: " << (
fbUseSts ?
"ON" :
"OFF");
822 LOG(info) <<
"\tMuCh: " << (
fbUseMuch ?
"ON" :
"OFF");
823 LOG(info) <<
"\tTRD: " << (
fbUseTrd ?
"ON" :
"OFF");
824 LOG(info) <<
"\tTOF: " << (
fbUseTof ?
"ON" :
"OFF");
826 LOG(info) << fName <<
": Initializing data branches";
847 throw std::runtime_error(
"Initialization of the CbmCaTimesliceReader object failed");
866 throw std::runtime_error(
"Initialization of the CbmCaMCModule object failed");
880 auto RegisterTrackQa = [&](
const char* typeName,
const char* title,
ETrackType type,
bool bSuppressMC =
false) {
884 bool bUseMC =
IsMCUsed() && !bSuppressMC;
964catch (
const std::exception& err) {
965 LOG(error) << fName <<
": Initialization failed. Reason: " << err.what();