69 const auto& rActSetup = rSetup.GetActiveSetup();
73 int nSt = rSetup.GetNofActStations();
84 std::vector<double> vMinX(nSt);
85 std::vector<double> vMaxX(nSt);
86 std::vector<double> vMinY(nSt);
87 std::vector<double> vMaxY(nSt);
92 for (
int iSt = 0; iSt < nSt; ++iSt) {
93 const auto& station = rActSetup.GetActiveLayer(iSt);
94 vMaxX[iSt] = station.GetXmax()[0];
95 vMinX[iSt] = station.GetXmin()[0];
96 vMaxY[iSt] = station.GetYmax()[0];
97 vMinY[iSt] = station.GetYmin()[0];
98 double dy = (vMaxY[iSt] - vMinY[iSt]) *
kXYZMargin;
99 double dx = (vMaxX[iSt] - vMinX[iSt]) *
kXYZMargin;
106 double xMinA = *std::min_element(vMinX.begin(), vMinX.end());
107 double xMaxA = *std::max_element(vMaxX.begin(), vMaxX.end());
108 double yMinA = *std::min_element(vMinY.begin(), vMinY.end());
109 double yMaxA = *std::max_element(vMaxY.begin(), vMaxY.end());
110 double zMinA = rActSetup.GetActiveLayers().front().GetZref()[0];
111 double zMaxA = rActSetup.GetActiveLayers().back().GetZref()[0];
117 for (
int iSt = 0; iSt < nSt; ++iSt) {
118 auto [detID, iStLoc] = rSetup.ActToLocStationId(iSt);
123 auto name = format(
"hit_{}_occup_xy_sta_{}", setNm, iSt);
124 auto titl = format(
"{} hit occupancy in XY plane for station {} ({}{});x [cm];y [cm]", setTl, iSt,
127 MakeObj<H2D>(name, titl, nBinsXY, vMinX[iSt], vMaxX[iSt], nBinsXY, vMinY[iSt], vMaxY[iSt]);
130 auto name = format(
"hit_{}_occup_zx_sta_{}", setNm, iSt);
131 auto titl = format(
"{} hit occupancy in ZX plane for station {} ({}{});z [cm];x [cm]", setTl, iSt,
136 auto name = format(
"hit_{}_occup_zy_sta_{}", setNm, iSt);
137 auto titl = format(
"{} hit occupancy in ZY plane for station {} ({}{});z [cm];y [cm]", setTl, iSt,
143 auto name = format(
"hit_usage_xy_sta_{}", iSt);
144 auto titl = format(
"Hit usage in XY plane for station {} ({}{});x [cm];y [cm]", iSt,
kDetName[detID], iStLoc);
146 MakeObj<Prof2D>(name, titl, nBinsXY, vMinX[iSt], vMaxX[iSt], nBinsXY, vMinY[iSt], vMaxY[iSt], 0., 1.);
151 constexpr int NBins = 1000000;
155 auto name = format(
"hit_{}_front_key_index", setNm);
156 auto titl = format(
"{} hit front key index;ID_{{key}}/N_{{keys}};Count", setTl);
160 auto name = format(
"hit_{}_back_key_index", setNm);
161 auto titl = format(
"{} hit back key index;ID_{{key}}/N_{{keys}};Count", setTl);
170 for (
int iSt = 0; iSt < nSt + 1; ++iSt) {
171 auto staNm = iSt == nSt ?
"" : format(
"_sta_{}", iSt);
172 auto staTl = iSt == nSt ?
"" : format(
" in station {}", iSt);
176 auto name = format(
"hit_{}_rel_time{}", setNm, staNm);
177 auto titl = format(
"{} hit relative time{}; #delta t_{{hit}};Count", setTl, staTl);
186 std::vector<std::string> vsPointName = {
"first",
"last"};
192 auto sName = format(
"{}_track_{}_theta",
GetTaskName(), vsPointName[i]);
193 auto sTitl = format(
"#theta at {} hit; #theta", vsPointName[i]);
197 auto sName = format(
"{}_track_{}_phi",
GetTaskName(), vsPointName[i]);
198 auto sTitl = format(
"#phi at {} hit; #phi", vsPointName[i]);
202 auto sName = format(
"{}_track_{}_thata_phi",
GetTaskName(), vsPointName[i]);
203 auto sTitl = format(
"#theta vs #phi at {} hit; #phi; #theta", vsPointName[i]);
207 auto sName = format(
"{}_track_{}_chi2_ndf",
GetTaskName(), vsPointName[i]);
208 auto sTitl = format(
"#chi^{{2}}/NDF at {} hit; #chi^{{2}}/NDF", vsPointName[i]);
215 double xMax = double(
knStaMax) - 0.5;
217 auto sName = format(
"{}_track_fst_lst_sta",
GetTaskName());
218 auto sTitl =
"First vs. last station index;ID^{last}_{station};ID^{first}_{station}";
222 auto sName = format(
"{}_track_origin",
GetTaskName());
223 auto sTitl =
"Track origin;x [cm];y [cm]";
237 auto name = format(
"{}_ca_hit_{}_occupancy_xy",
GetTaskName(), setNm);
238 auto titl = format(
"{} hit occupancy in different stations in XY plane", setNm);
240 for (
int iSt = 0; iSt < nSt; ++iSt) {
241 auto pad =
PadConfig(
false,
false,
false,
false,
true);
243 canv.AddPadConfig(pad);
248 auto name = format(
"{}_ca_hit_{}_occupancy_zx_zy",
GetTaskName(), setNm);
249 auto titl = format(
"{} hit occupancy in different stations in ZX and ZY planes", setTl);
253 for (
int iSt = 0; iSt < nSt; ++iSt) {
254 pad.RegisterHistogram(
fvphHitOccupZX[iSt][hitSet], (iSt == 0 ?
"colz" :
"cols same"));
256 canv.AddPadConfig(pad);
260 for (
int iSt = 0; iSt < nSt; ++iSt) {
261 pad.RegisterHistogram(
fvphHitOccupZY[iSt][hitSet], (iSt == 0 ?
"colz" :
"cols same"));
263 canv.AddPadConfig(pad);
269 auto name = format(
"{}_ca_hit_usage_xy",
GetTaskName());
270 auto titl = format(
"Hit usage in different stations in XY plane");
272 for (
int iSt = 0; iSt < nSt; ++iSt) {
275 canv.AddPadConfig(pad);
285 auto pad =
PadConfig(
true,
true,
false,
false,
true);
287 canv.AddPadConfig(pad);
290 auto pad =
PadConfig(
true,
true,
false,
false,
false);
292 canv.AddPadConfig(pad);
295 auto pad =
PadConfig(
true,
true,
false,
true,
false);
297 canv.AddPadConfig(pad);
300 auto pad =
PadConfig(
true,
true,
false,
false,
true);
302 canv.AddPadConfig(pad);
305 auto pad =
PadConfig(
true,
true,
false,
false,
false);
307 canv.AddPadConfig(pad);
323 L_(fatal) <<
"ca::Qa: instance is not initialized";
329 std::vector<unsigned char> vbHitUsed(nHitsInput,
false);
331 vbHitUsed[iH] =
true;
337 auto [minTimeIt, maxTimeIt] =
338 std::minmax_element(
hits.cbegin(),
hits.cend(), [](
const auto& h1,
const auto& h2) { return h1.T() < h2.T(); });
345 for (
int iH = 0; iH < nHitsInput; ++iH) {
352 int iSt = hit.Station();
364 auto& track = *trkIt;
365 int nHits = track.fNofHits;
367 int iFstHit = (*fpvRecoHits)[trkFirstHit];
368 int iLstHit = (*fpvRecoHits)[trkFirstHit + nHits - 1];
377 const auto& trkPar = (ip == 0 ? track.fParFirst : track.fParLast);
387 trkFirstHit += nHits;