148 if(m_eventStat.m_events<=0)
return StatusCode::SUCCESS;
149 const auto & w13 = std::setw(13);
150 const auto & p5 = std::setprecision(5);
151 const auto topNtail=[](
const std::string &
str){
return "|" +
str +
"|";};
152 const std::string lineSeparator(83,
'-');
153 const std::string spaceSeparator(83,
' ');
154 std::stringstream
out;
156 out<<topNtail(lineSeparator)<<
"\n";
157 out<<
"| TrackClusterAssValidation statistic for charge truth particles with |\n";
158 out<<topNtail(spaceSeparator)<<
"\n";
160 out<<
"| eta bins for eta dependent variables = [0.0, ";
161 for (
unsigned int etabin = 1; etabin<(
m_etabins.size()-1); etabin++)
162 out << std::setw(2) << std::setprecision(1) <<
m_etabins.value().at(etabin) <<
", ";
163 out << std::setw(2) <<
m_etabins.value().back() <<
"] |\n";
164 out<<
"| eta dependent pT [MeV] >= [";
165 for (
unsigned int ptbin = 0; ptbin<(
m_ptcuts.size()-1); ptbin++)
166 out<<std::setw(6)<<std::setprecision(2)<<
m_ptcuts.value().at(ptbin)<<
", ";
167 out<<std::setw(6)<<std::setprecision(2)<<
m_ptcuts.value().back()<<
"] |\n";
172 out<<
"| max vertex radius <="<<w13<<p5<<
m_rmax<<
" mm"<<
" |\n";
173 out<<
"| min vertex radius >="<<w13<<p5<<
m_rmin<<
" mm"<<
" |\n";
174 out<<
"| particles pdg ="<<std::setw(8)<<
m_pdg<<
" |\n";
176 auto yesNo=[](
const bool predicate){
return predicate ?
"yes" :
"no ";};
177 out<<
"| use Pixels information "<<yesNo(
m_usePix)<<
" |\n";
180 out<<topNtail(spaceSeparator)<<
"\n";
183 auto incrementArray=[](
auto &
array,
const int idx){
for (
int j{};j!=NRegions;++j)
array[
idx][j] +=
array[
idx+1][j];};
184 for(
int i=48;
i>=0; --
i) {
185 m_eventStat.m_particleClusters [
i] +=m_eventStat.m_particleClusters [
i+1];
186 incrementArray(m_eventStat.m_particleClustersBTE,
i);
187 m_eventStat.m_particleSpacePoints [
i] +=m_eventStat.m_particleSpacePoints [
i+1];
188 incrementArray(m_eventStat.m_particleSpacePointsBTE,
i);
190 auto coerceToOne=[](
const double & initialVal)->
double {
return (initialVal<1.) ? 1. : initialVal; };
197 double pa = coerceToOne(m_eventStat.m_particleClusters[0]);
198 std::array<double, 10> pc2ff{};
199 size_t clusterIdx = 2;
200 for (
auto & thisCluster: pc2ff){
201 thisCluster =
double(m_eventStat.m_particleClusters[ clusterIdx++ ])/ pa;
204 pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Barrel]);
205 std::array<double, 10> pcBarrel2ff{};
206 size_t clusterBarrelIdx = 2;
207 for (
auto & thisClusterB: pcBarrel2ff){
208 thisClusterB =
double(m_eventStat.m_particleClustersBTE[ clusterBarrelIdx++ ][Barrel])/ pa;
211 pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Transition]);
212 std::array<double, 10> pcTransition2ff{};
213 size_t clusterTransitionIdx = 2;
214 for (
auto & thisClusterT: pcTransition2ff){
215 thisClusterT =
double(m_eventStat.m_particleClustersBTE[ clusterTransitionIdx++ ][Transition])/ pa;
218 pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Endcap]);
219 std::array<double, 10> pcEndcap2ff{};
220 size_t clusterEndcapIdx = 2;
221 for (
auto & thisClusterE: pcEndcap2ff){
222 thisClusterE =
double(m_eventStat.m_particleClustersBTE[ clusterEndcapIdx++ ][Endcap])/ pa;
225 pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][3]);
226 std::array<double, 10> pcFwd2ff{};
227 size_t clusterFwdIdx = 2;
228 for (
auto & thisClusterD: pcFwd2ff){
229 thisClusterD =
double(m_eventStat.m_particleClustersBTE[ clusterFwdIdx++ ][Forward])/ pa;
235 pa = coerceToOne(m_eventStat.m_particleSpacePoints[0]);
236 std::array<double, 10> sp2ff{};
237 size_t spacepointIdx = 2;
238 for (
auto & thisSpacepoint: sp2ff){
239 thisSpacepoint =
double(m_eventStat.m_particleSpacePoints[ spacepointIdx++ ])/ pa;
242 pa = coerceToOne(m_eventStat.m_particleSpacePointsBTE[0][Barrel]);
243 std::array<double, 10> spBarrel2ff{};
244 size_t spacepointBarrelIdx = 2;
245 for (
auto & thisSpacepoint: spBarrel2ff){
246 thisSpacepoint =
double(m_eventStat.m_particleSpacePointsBTE[ spacepointBarrelIdx++ ][Barrel])/ pa;
249 pa = coerceToOne(m_eventStat.m_particleSpacePointsBTE[0][Transition]);
250 std::array<double, 10> spTransition2ff{};
251 size_t spacepointTransitionIdx = 2;
252 for (
auto & thisSpacepoint: spTransition2ff){
253 thisSpacepoint =
double(m_eventStat.m_particleSpacePointsBTE[ spacepointTransitionIdx++ ][Transition])/ pa;
256 pa = coerceToOne(m_eventStat.m_particleSpacePointsBTE[0][Endcap]);
257 std::array<double, 10> spEndcap2ff{};
258 size_t spacepointEndcapIdx = 2;
259 for (
auto & thisSpacepoint: spEndcap2ff){
260 thisSpacepoint =
double(m_eventStat.m_particleSpacePointsBTE[ spacepointEndcapIdx++ ][Endcap])/ pa;
263 pa = coerceToOne(m_eventStat.m_particleSpacePointsBTE[0][Forward]);
264 std::array<double, 10> spFwd2ff{};
265 size_t spacepointFwdIdx = 2;
266 for (
auto & thisSpacepoint: spFwd2ff){
267 thisSpacepoint =
double(m_eventStat.m_particleSpacePointsBTE[ spacepointFwdIdx++ ][Forward])/ pa;
269 auto w8=std::setw(8);
270 out<<
"| Probability for such charge particles to have some number silicon |\n";
271 out<<
"| clusters | space points |\n";
272 out<<
"| Total Barrel Transi Endcap Forward | Total Barrel Transi Endcap Forward |\n";
275 out<<
"| >= "<<
idx+2<< std::string((
idx<8)?
" ":
" ")
277 <<w8<<p5<<pcBarrel2ff[
idx]
278 <<w8<<p5<<pcTransition2ff[
idx]
279 <<w8<<p5<<pcEndcap2ff[
idx]
280 <<w8<<p5<<pcFwd2ff[
idx]<<
" | "
283 <<w8<<p5<<spBarrel2ff[
idx]
284 <<w8<<p5<<spTransition2ff[
idx]
285 <<w8<<p5<<spEndcap2ff[
idx]
286 <<w8<<p5<<spFwd2ff[
idx]
290 out<<topNtail(spaceSeparator)<<
"\n";
291 out<<
"| Additional cuts for truth particles are |\n";
292 out<<
"| eta dependent number of silicon clusters >= [";
293 for (
unsigned int clbin = 0; clbin<(
m_clcuts.size()-1); clbin++)
294 out<<std::setw(2)<<
m_clcuts.value().at(clbin)<<
", ";
295 out<<std::setw(2)<<
m_clcuts.value().back()<<
"] |\n";
296 out<<
"| number space points >="<<w13<<
m_spcut.value()<<
" |\n";
298 pa = coerceToOne(m_eventStat.m_particleClusters[0]);
299 out<<
"| Probability find truth particles with this cuts is "<<w8<<p5<<
double(m_eventStat.m_events)/pa<<
" |\n";
300 pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Barrel]);
301 out<<
"| For barrel region "<<w8<<p5<<
double(m_eventStat.m_eventsBTE[Barrel])/pa<<
" |\n";
302 pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Transition]);
303 out<<
"| For transition region "<<w8<<p5<<
double(m_eventStat.m_eventsBTE[Transition])/pa<<
" |\n";
304 pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Endcap]);
305 out<<
"| For endcap region "<<w8<<p5<<
double(m_eventStat.m_eventsBTE[Endcap])/pa<<
" |\n";
306 pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Forward]);
307 out<<
"| For forward region "<<w8<<p5<<
double(m_eventStat.m_eventsBTE[Forward])/pa<<
" |\n";
309 pa = coerceToOne(m_eventStat.m_nclustersNegBP);
310 double ratio =
double(m_eventStat.m_nclustersPosBP)/pa;
312 out<<
"| Ratio barrel pixels clusters for +/- particles ="<<w8<<p5<<
ratio<<
" +-"<<w8<<p5<<
eratio<<
" |\n";
313 pa = coerceToOne(m_eventStat.m_nclustersNegEP);
316 out<<
"| Ratio endcap pixels clusters for +/- particles ="<<w8<<p5<<
ratio<<
" +-"<<w8<<p5<<
eratio<<
" |\n";
317 pa = coerceToOne(m_eventStat.m_nclustersNegBS);
320 out<<
"| Ratio barrel Strip clusters for +/- particles ="<<w8<<p5<<
ratio<<
" +-"<<w8<<p5<<
eratio<<
" |\n";
321 pa = coerceToOne(m_eventStat.m_nclustersNegES);
324 out<<
"| Ratio endcap Strip clusters for +/- particles ="<<w8<<p5<<
ratio<<
" +-"<<w8<<p5<<
eratio<<
" |\n";
325 pa =
double(m_eventStat.m_eventsNEG);
if(pa < 1.) pa = 1.;
328 out<<
"| Number truth particles and +/- ratio ="<<std::setw(10)<<m_eventStat.m_events<<w8<<p5<<
ratio<<
" +-"<<w8<<p5<<
eratio<<
" |\n";
330 if(m_eventStat.m_nclustersPTOT!=0)
ratio =
double(m_eventStat.m_nclustersPTOTt)/
double(m_eventStat.m_nclustersPTOT);
332 out<<
"| Number pix clusters, truth clusters and ratio = "
333 <<std::setw(10)<<m_eventStat.m_nclustersPTOT
334 <<std::setw(10)<<m_eventStat.m_nclustersPTOTt
335 <<std::setw(12)<<std::setprecision(5)<<
ratio<<
" |\n";
337 if(m_eventStat.m_nclustersSTOT!=0)
ratio =
double(m_eventStat.m_nclustersSTOTt)/
double(m_eventStat.m_nclustersSTOT);
338 out<<
"| Number strip clusters, truth clusters and ratio = "
339 <<std::setw(10)<<m_eventStat.m_nclustersSTOT
340 <<std::setw(10)<<m_eventStat.m_nclustersSTOTt
341 <<std::setw(12)<<std::setprecision(5)<<
ratio<<
" |\n";
343 out<<
"|-----------------------------------------------------------------------------------|\n\n";
348 int n = 47-(
t->key().size());
349 std::string
s1;
for(
int i=0;
i<
n; ++
i)
s1.append(
" ");
s1.append(
"|");
352 out<<
"|-----------------------------------------------------------------------------------|\n";
353 out<<
"| Statistic for "<<(
t->key())<<s1<<
"\n";
355 double ne =
double(m_eventStat.m_events);
if(ne < 1.) ne = 1.;
356 double ef [6];
for(
int i=0;
i!=6; ++
i)
ef [
i] =
double(m_trackCollectionStat[
nc].m_efficiency [
i]) /ne;
357 double ef0[6];
for(
int i=0;
i!=6; ++
i) ef0[
i] =
double(m_trackCollectionStat[
nc].m_efficiencyN [
i][0])/ne;
358 double ef1[6];
for(
int i=0;
i!=6; ++
i) ef1[
i] =
double(m_trackCollectionStat[
nc].m_efficiencyN [
i][1])/ne;
359 double ef2[6];
for(
int i=0;
i!=6; ++
i) ef2[
i] =
double(m_trackCollectionStat[
nc].m_efficiencyN [
i][2])/ne;
362 using EffArray_t = std::array<double, 6>;
364 auto makeEffArray = [](
const auto & threeDimArray,
const size_t secondIdx,
const size_t thirdIdx,
const double denom){
367 auto invDenom = 1./
denom;
369 entry = threeDimArray[
idx++][secondIdx][thirdIdx]*invDenom;
374 const auto & efficiencyArrayInput = m_trackCollectionStat[
nc].m_efficiencyBTE;
376 double neBTE = coerceToOne(m_eventStat.m_eventsBTE[Barrel]);
377 const EffArray_t efB0 = makeEffArray(efficiencyArrayInput,0,Barrel,neBTE);
378 const EffArray_t efB1 = makeEffArray(efficiencyArrayInput,1,Barrel,neBTE);
379 const EffArray_t efB2 = makeEffArray(efficiencyArrayInput,2,Barrel,neBTE);
380 const EffArray_t efB3 = makeEffArray(efficiencyArrayInput,3,Barrel,neBTE);
381 const EffArray_t efB4 = makeEffArray(efficiencyArrayInput,4,Barrel,neBTE);
383 neBTE = coerceToOne(m_eventStat.m_eventsBTE[Transition]);
384 const EffArray_t efT0 = makeEffArray(efficiencyArrayInput,0,Transition,neBTE);
385 const EffArray_t efT1 = makeEffArray(efficiencyArrayInput,1,Transition,neBTE);
386 const EffArray_t efT2 = makeEffArray(efficiencyArrayInput,2,Transition,neBTE);
387 const EffArray_t efT3 = makeEffArray(efficiencyArrayInput,3,Transition,neBTE);
388 const EffArray_t efT4 = makeEffArray(efficiencyArrayInput,4,Transition,neBTE);
390 neBTE = coerceToOne(m_eventStat.m_eventsBTE[Endcap]);
391 const EffArray_t efE0 = makeEffArray(efficiencyArrayInput,0,Endcap,neBTE);
392 const EffArray_t efE1 = makeEffArray(efficiencyArrayInput,1,Endcap,neBTE);
393 const EffArray_t efE2 = makeEffArray(efficiencyArrayInput,2,Endcap,neBTE);
394 const EffArray_t efE3 = makeEffArray(efficiencyArrayInput,3,Endcap,neBTE);
395 const EffArray_t efE4 = makeEffArray(efficiencyArrayInput,4,Endcap,neBTE);
397 neBTE = coerceToOne(m_eventStat.m_eventsBTE[Forward]);
398 const EffArray_t efD0 = makeEffArray(efficiencyArrayInput,0,Forward,neBTE);
399 const EffArray_t efD1 = makeEffArray(efficiencyArrayInput,1,Forward,neBTE);
400 const EffArray_t efD2 = makeEffArray(efficiencyArrayInput,2,Forward,neBTE);
401 const EffArray_t efD3 = makeEffArray(efficiencyArrayInput,3,Forward,neBTE);
402 const EffArray_t efD4 = makeEffArray(efficiencyArrayInput,4,Forward,neBTE);
405 double efrec = ef0[0]+ef0[1]+ef0[2]+ef1[0]+ef1[1]+ef2[0];
406 double efrecB = efB0[0]+efB0[1]+efB0[2]+efB1[0]+efB1[1]+efB2[0];
407 double efrecT = efT0[0]+efT0[1]+efT0[2]+efT1[0]+efT1[1]+efT2[0];
408 double efrecE = efE0[0]+efE0[1]+efE0[2]+efE1[0]+efE1[1]+efE2[0];
409 double efrecD = efD0[0]+efD0[1]+efD0[2]+efD1[0]+efD1[1]+efD2[0];
411 ne = coerceToOne(m_eventStat.m_eventsPOS);
412 double efP[6];
for(
int i=0;
i!=6; ++
i) efP[
i] =
double(m_trackCollectionStat[
nc].m_efficiencyPOS[
i])/ne;
413 ne = coerceToOne(m_eventStat.m_eventsNEG);
414 double efN[6];
for(
int i=0;
i!=6; ++
i) efN[
i] =
double(m_trackCollectionStat[
nc].m_efficiencyNEG[
i])/ne;
416 out<<
"|-----------------------------------------------------------------------------------|\n";
417 out<<
"| Probability to lose 0 1 2 3 4 >=5 clusters |\n";
418 out<<
"|-----------------------------------------------------------------------------------|\n";
420 auto formattedOutput=[&
out](
auto & effArray){
421 for (
size_t i{};
i!=6;++
i){
422 out<<std::setw(9)<<std::setprecision(4)<<effArray[
i];
427 out<<
"| For all particles ";
429 out<<
"| For + particles ";
430 formattedOutput(efP);
431 out<<
"| For - particles ";
432 formattedOutput(efN);
433 out<<
"|-----------------------------------------------------------------------------------|\n";
434 out<<
"| Barrel region |\n";
435 out<<
"| 0 wrong clusters ";
436 formattedOutput(efB0);
437 out<<
"| 1 wrong clusters ";
438 formattedOutput(efB1);
439 out<<
"| 2 wrong clusters ";
440 formattedOutput(efB2);
441 out<<
"| 3 wrong clusters ";
442 formattedOutput(efB3);
443 out<<
"| >=4 wrong clusters ";
444 formattedOutput(efB4);
445 out<<
"|-----------------------------------------------------------------------------------|\n";
446 out<<
"| Transition region |\n";
447 out<<
"| 0 wrong clusters ";
448 formattedOutput(efT0);
449 out<<
"| 1 wrong clusters ";
450 formattedOutput(efT1);
451 out<<
"| 2 wrong clusters ";
452 formattedOutput(efT2);
453 out<<
"| 3 wrong clusters ";
454 formattedOutput(efT3);
455 out<<
"| >=4 wrong clusters ";
456 formattedOutput(efT4);
457 out<<
"|-----------------------------------------------------------------------------------|\n";
458 out<<
"| Endcap region |\n";
459 out<<
"| 0 wrong clusters ";
460 formattedOutput(efE0);
461 out<<
"| 1 wrong clusters ";
462 formattedOutput(efE1);
463 out<<
"| 2 wrong clusters ";
464 formattedOutput(efE2);
465 out<<
"| 3 wrong clusters ";
466 formattedOutput(efE3);
467 out<<
"| >=4 wrong clusters ";
468 formattedOutput(efE4);
469 out<<
"|-----------------------------------------------------------------------------------|\n";
470 out<<
"| Forward region |\n";
471 out<<
"| 0 wrong clusters ";
472 formattedOutput(efD0);
473 out<<
"| 1 wrong clusters ";
474 formattedOutput(efD1);
475 out<<
"| 2 wrong clusters ";
476 formattedOutput(efD2);
477 out<<
"| 3 wrong clusters ";
478 formattedOutput(efD3);
479 out<<
"| >=4 wrong clusters ";
480 formattedOutput(efD4);
482 out<<
"|-----------------------------------------------------------------------------------|\n";
483 pa = coerceToOne(m_eventStat.m_particleClusters[0]);
484 out<<
"| Efficiency reconstruction (number lose+wrong < 3) = "
485 <<std::setw(9)<<std::setprecision(5)<<efrec
487 <<std::setw(9)<<std::setprecision(5)<<efrec*
double(m_eventStat.m_events)/pa
490 pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Barrel]);
491 out<<
"| For barrel region = "
492 <<std::setw(9)<<std::setprecision(5)<<efrecB
494 <<std::setw(9)<<std::setprecision(5)<<efrecB*
double(m_eventStat.m_eventsBTE[Barrel])/pa
497 pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Transition]);
498 out<<
"| For transition region = "
499 <<std::setw(9)<<std::setprecision(5)<<efrecT
501 <<std::setw(9)<<std::setprecision(5)<<efrecT*
double(m_eventStat.m_eventsBTE[Transition])/pa
504 pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Endcap]);
505 out<<
"| For endcap region = "
506 <<std::setw(9)<<std::setprecision(5)<<efrecE
508 <<std::setw(9)<<std::setprecision(5)<<efrecE*
double(m_eventStat.m_eventsBTE[Endcap])/pa
511 pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Forward]);
512 out<<
"| For forward region = "
513 <<std::setw(9)<<std::setprecision(5)<<efrecD
515 <<std::setw(9)<<std::setprecision(5)<<efrecD*
double(m_eventStat.m_eventsBTE[Forward])/pa
519 out<<
"|-----------------------------------------------------------------------------------|\n";
520 out<<
"| Reconstructed tracks + - +/-ratio error |\n";
521 out<<
"|-----------------------------------------------------------------------------------|\n";
523 pa = coerceToOne(m_trackCollectionStat[
nc].m_ntracksNEGB);
528 <<std::setw(10)<<m_trackCollectionStat[
nc].m_ntracksPOSB
529 <<std::setw(11)<<m_trackCollectionStat[
nc].m_ntracksNEGB
530 <<std::setw(11)<<std::setprecision(5)<<
ratio
531 <<std::setw(11)<<std::setprecision(5)<<
eratio<<
" |\n";
532 pa = coerceToOne(m_trackCollectionStat[
nc].m_ntracksNEGE);
537 <<std::setw(10)<<m_trackCollectionStat[
nc].m_ntracksPOSE
538 <<std::setw(11)<<m_trackCollectionStat[
nc].m_ntracksNEGE
539 <<std::setw(11)<<std::setprecision(5)<<
ratio
540 <<std::setw(11)<<std::setprecision(5)<<
eratio<<
" |\n";
541 pa = coerceToOne(m_trackCollectionStat[
nc].m_ntracksNEGFWD);
542 ratio =
double(m_trackCollectionStat[
nc].m_ntracksPOSFWD)/pa;
546 <<std::setw(10)<<m_trackCollectionStat[
nc].m_ntracksPOSFWD
547 <<std::setw(11)<<m_trackCollectionStat[
nc].m_ntracksNEGFWD
548 <<std::setw(11)<<std::setprecision(5)<<
ratio
549 <<std::setw(11)<<std::setprecision(5)<<
eratio<<
" |\n";
556 for(
int k = 0;
k!=50; ++
k) {
557 nt+=m_trackCollectionStat[
nc].m_total[
k];
558 ft+=m_trackCollectionStat[
nc].m_fake [
k];
559 if(!kf &&
nt) kf =
k;
564 out<<
"|-----------------------------------------------------------------------------------|\n";
565 out<<
"| Fake tracks rate for different number of clusters on track |\n";
566 out<<
"|-----------------------------------------------------------------------------------|\n";
568 for(
int k = kf;
k!=kf+6; ++
k) {
569 out<<
"| >= "<<std::setw(2)<<
k<<
" ";
573 for(
int k = kf;
k!=kf+6; ++
k) {
575 out<<
"|"<<std::setw(12)<<std::setprecision(5)<<
eff<<
" ";
576 nt-=m_trackCollectionStat[
nc].m_total[
k];
577 ft-=m_trackCollectionStat[
nc].m_fake [
k];
580 out<<
"|-----------------------------------------------------------------------------------|\n";
585 return StatusCode::SUCCESS;