ATLAS Offline Software
TrackClusterAssValidation.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
10 #include "StoreGate/ReadHandle.h"
11 #include "AtlasHepMC/GenVertex.h"
12 #include "AtlasHepMC/GenParticle.h"
14 
15 #include <cmath>
16 
18 // Constructor
20 
22 (const std::string& name,ISvcLocator* pSvcLocator)
23  : AthReentrantAlgorithm(name,pSvcLocator),
24  m_spacepointsSCTname("SCT_SpacePoints"),
25  m_spacepointsPixelname("PixelSpacePoints"),
26  m_spacepointsOverlapname("OverlapSpacePoints"),
27  m_clustersSCTname("SCT_Clusters"),
28  m_clustersPixelname("PixelClusters"),
29  m_clustersTRTname("TRT_DriftCircles"),
30  m_truth_locationPixel( "PRD_MultiTruthPixel" ),
31  m_truth_locationSCT( "PRD_MultiTruthSCT" ),
32  m_truth_locationTRT( "PRD_MultiTruthTRT" )
33 {
34 
35  // TrackClusterAssValidation steering parameters
36  //
37  m_ptcut = 1000. ;
38  m_ptcutmax = 1.e20 ;
39  m_rapcut = 2.6 ;
40  m_rmin = 0. ;
41  m_rmax = 30. ;
42  m_clcut = 6 ;
43  m_clcutTRT = 0 ;
44  m_spcut = 3 ;
45  m_usePIX = true ;
46  m_useSCT = true ;
47  m_useTRT = true ;
48  m_useOutliers = false ;
49  m_pdg = 0 ;
50  m_tcut = 0. ;
51 
52  declareProperty("TracksLocation" ,m_tracklocation );
53  declareProperty("SpacePointsSCTName" ,m_spacepointsSCTname );
54  declareProperty("SpacePointsPixelName" ,m_spacepointsPixelname );
55  declareProperty("SpacePointsOverlapName",m_spacepointsOverlapname);
56  declareProperty("PixelClusterContainer" ,m_clustersPixelname );
57  declareProperty("SCT_ClusterContainer" ,m_clustersSCTname );
58  declareProperty("TRT_ClusterContainer" ,m_clustersTRTname );
59  declareProperty("TruthLocationSCT" ,m_truth_locationSCT );
60  declareProperty("TruthLocationPixel" ,m_truth_locationPixel );
61  declareProperty("TruthLocationTRT" ,m_truth_locationTRT );
62  declareProperty("MomentumCut" ,m_ptcut );
63  declareProperty("MomentumMaxCut" ,m_ptcutmax );
64  declareProperty("RapidityCut" ,m_rapcut );
65  declareProperty("RadiusMin" ,m_rmin );
66  declareProperty("RadiusMax" ,m_rmax );
67  declareProperty("MinNumberClusters" ,m_clcut );
68  declareProperty("MinNumberClustersTRT" ,m_clcutTRT );
69  declareProperty("MinNumberSpacePoints" ,m_spcut );
70  declareProperty("usePixel" ,m_usePIX );
71  declareProperty("useSCT" ,m_useSCT );
72  declareProperty("useTRT" ,m_useTRT );
73  declareProperty("useOutliers" ,m_useOutliers );
74  declareProperty("pdgParticle" ,m_pdg );
75 }
76 
78 
79 
81 // Initialisation
83 
85 {
86 
87  StatusCode sc;
88 
89  if (m_rapcut == 0) {
90  m_tcut = 0;
91  }
92  else {
93  double den = tan(2.*atan(exp(-m_rapcut)));
94  if (den > 0) {
95  m_tcut = 1./den;
96  }
97  else {
99  }
100  }
101 
102  // Erase statistic information
103  //
104  m_pdg = std::abs(m_pdg) ;
105 
106  m_trackCollectionStat.resize(m_tracklocation.size());
107  m_eventStat = EventStat_t();
108 
109  if(!m_useTRT) m_clcutTRT = 0;
110  if(!m_clcutTRT) m_useTRT = false;
111 
112  // Read Handle Key
116 
120 
122 
125 
126  ATH_CHECK( m_tracklocation.initialize());
127 
128  // Read Cond Handle Key
131 
132  if (msgLvl(MSG::DEBUG)) {
134  msg() << endmsg;
135  }
136 
137  return sc;
138 }
139 
141 // Execute
143 
145 {
146 
147  if(!m_usePIX && !m_useSCT) return StatusCode::SUCCESS;
148  EventData_t event_data(m_tracklocation.size() );
149 
150  std::vector<SG::ReadHandle<PRD_MultiTruthCollection> > read_handle;
151  read_handle.reserve(3);
152  if(m_usePIX) {
153  read_handle.emplace_back(m_truth_locationPixel,ctx);
154  if (not read_handle.back().isValid()) {
155  ATH_MSG_FATAL( "Could not find TruthPIX" );
156  return StatusCode::FAILURE;
157  }
158  event_data.m_truthPIX = &(*read_handle.back());
159  }
160 
161  if(m_useSCT) {
162  read_handle.emplace_back(m_truth_locationSCT,ctx);
163  if (not read_handle.back().isValid()) {
164  ATH_MSG_FATAL( "Could not find TruthSCT" );
165  return StatusCode::FAILURE;
166  }
167  event_data.m_truthSCT = &(*read_handle.back());
168  }
169 
170  if(m_clcutTRT > 0) {
171  read_handle.emplace_back(m_truth_locationTRT,ctx);
172  if (not read_handle.back().isValid()) {
173  ATH_MSG_FATAL( "Could not find TruthTRT" );
174  return StatusCode::FAILURE;
175  }
176  event_data.m_truthTRT = &(*read_handle.back());
177  }
178 
179  newClustersEvent (ctx,event_data);
180  newSpacePointsEvent (ctx,event_data);
181  event_data.m_nqtracks = qualityTracksSelection(event_data);
182  tracksComparison (ctx,event_data);
183  if(!event_data.m_particles[0].empty()) {
184 
185  efficiencyReconstruction(event_data);
186  if(msgLvl(MSG::DEBUG)) noReconstructedParticles(event_data);
187 
188  }
189 
190  {
191  std::lock_guard<std::mutex> lock(m_statMutex);
192  assert( event_data.m_trackCollectionStat.size() == m_trackCollectionStat.size());
193  for (unsigned int i=0; i< m_trackCollectionStat.size(); ++i ) {
194  m_trackCollectionStat[i] += event_data.m_trackCollectionStat[i];
195  }
196  m_eventStat += event_data.m_eventStat;
197  }
198 
199  if (msgLvl(MSG::DEBUG)) {
200  dumpevent(msg(),event_data);
201  msg() << endmsg;
202  }
203  return StatusCode::SUCCESS;
204 }
205 
207 // Finalize
209 
211  if(m_eventStat.m_events<=0) return StatusCode::SUCCESS;
212  const auto & w13 = std::setw(13);
213  const auto & p5 = std::setprecision(5);
214  const auto topNtail=[](const std::string & str){return "|" + str + "|";};
215  const std::string lineSeparator(83,'-');
216  const std::string spaceSeparator(83,' ');
217  std::stringstream out;
218  out<<std::fixed;
219  out<<topNtail(lineSeparator)<<"\n";
220  out<<"| TrackClusterAssValidation statistic for charge truth particles with |\n";
221  out<<topNtail(spaceSeparator)<<"\n";
222  out<<"| pT >="<<w13<<p5<<m_ptcut<<" MeV"<<" |\n";
223  if(m_ptcutmax < 1000000.) {
224  out<<"| pT <="<<w13<<p5<<m_ptcutmax<<" MeV"<<" |\n";
225  }
226  out<<"| |rapidity| <="<<w13<<p5<<m_rapcut<<" |\n";
227  out<<"| max vertex radius <="<<w13<<p5<<m_rmax<<" mm"<<" |\n";
228  out<<"| min vertex radius >="<<w13<<p5<<m_rmin<<" mm"<<" |\n";
229  out<<"| particles pdg ="<<std::setw(8)<<m_pdg<<" |\n";
230 
231  auto yesNo=[](const bool predicate){return predicate ? "yes" : "no ";};
232  out<<"| use Pixels information "<<yesNo(m_usePIX)<<" |\n";
233  out<<"| use SCT information "<<yesNo(m_useSCT)<<" |\n";
234  out<<"| use TRT information "<<yesNo(m_useTRT)<<" |\n";
235  out<<"| take into account outliers "<<yesNo(m_useOutliers)<<" |\n";
236  out<<topNtail(spaceSeparator)<<"\n";
237  if(!m_usePIX && !m_useSCT) return StatusCode::SUCCESS;
238  enum Regions{Barrel, Transition, Endcap, Forward, NRegions};
239  auto incrementArray=[](auto & array, const int idx){for (int j{};j!=NRegions;++j) array[idx][j] += array[idx+1][j];};
240  for(int i=48; i>=0; --i) {
241  m_eventStat.m_particleClusters [i] +=m_eventStat.m_particleClusters [i+1];
242  incrementArray(m_eventStat.m_particleClustersBTE, i);
243  m_eventStat.m_particleSpacePoints [i] +=m_eventStat.m_particleSpacePoints [i+1];
244  incrementArray(m_eventStat.m_particleSpacePointsBTE, i);
245  }
246  auto coerceToOne=[](const double & initialVal)->double {return (initialVal<1.) ? 1. : initialVal; };
247  /* Note that in all cases below, the dimension of the target (i.e. result) array is 10
248  * whereas the dimension of the source, or input, array is 50. The first index of the source
249  * is used for totals, to act as a denominator(coerced to 1 if necessary). Bin 49 is used for overflows.
250  * Stats for single clusters (index 1) appear to be unused in printout.
251  */
252  //all
253  double pa = coerceToOne(m_eventStat.m_particleClusters[0]);
254  std::array<double, 10> pc2ff{};
255  size_t clusterIdx = 2;
256  for (auto & thisCluster: pc2ff){
257  thisCluster = double(m_eventStat.m_particleClusters[ clusterIdx++ ])/ pa;
258  }
259  //barrel
260  pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Barrel]);
261  std::array<double, 10> pcBarrel2ff{};
262  size_t clusterBarrelIdx = 2;
263  for (auto & thisClusterB: pcBarrel2ff){
264  thisClusterB = double(m_eventStat.m_particleClustersBTE[ clusterBarrelIdx++ ][Barrel])/ pa;
265  }
266  //transition
267  pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Transition]);
268  std::array<double, 10> pcTransition2ff{};
269  size_t clusterTransitionIdx = 2;
270  for (auto & thisClusterT: pcTransition2ff){
271  thisClusterT = double(m_eventStat.m_particleClustersBTE[ clusterTransitionIdx++ ][Transition])/ pa;
272  }
273  //endcap
274  pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Endcap]);
275  std::array<double, 10> pcEndcap2ff{};
276  size_t clusterEndcapIdx = 2;
277  for (auto & thisClusterE: pcEndcap2ff){
278  thisClusterE = double(m_eventStat.m_particleClustersBTE[ clusterEndcapIdx++ ][Endcap])/ pa;
279  }
280  //fwd
281  pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][3]);
282  std::array<double, 10> pcFwd2ff{};
283  size_t clusterFwdIdx = 2;
284  for (auto & thisClusterD: pcFwd2ff){
285  thisClusterD = double(m_eventStat.m_particleClustersBTE[ clusterFwdIdx++ ][Forward])/ pa;
286  }
287  //
288  //*** SPACE POINTS ***
289  //
290  //all
291  pa = coerceToOne(m_eventStat.m_particleSpacePoints[0]);
292  std::array<double, 10> sp2ff{};
293  size_t spacepointIdx = 2;
294  for (auto & thisSpacepoint: sp2ff){
295  thisSpacepoint = double(m_eventStat.m_particleSpacePoints[ spacepointIdx++ ])/ pa;
296  }
297  //barrel
298  pa = coerceToOne(m_eventStat.m_particleSpacePointsBTE[0][Barrel]);
299  std::array<double, 10> spBarrel2ff{};
300  size_t spacepointBarrelIdx = 2;
301  for (auto & thisSpacepoint: spBarrel2ff){
302  thisSpacepoint = double(m_eventStat.m_particleSpacePointsBTE[ spacepointBarrelIdx++ ][Barrel])/ pa;
303  }
304  //transition
305  pa = coerceToOne(m_eventStat.m_particleSpacePointsBTE[0][Transition]);
306  std::array<double, 10> spTransition2ff{};
307  size_t spacepointTransitionIdx = 2;
308  for (auto & thisSpacepoint: spTransition2ff){
309  thisSpacepoint = double(m_eventStat.m_particleSpacePointsBTE[ spacepointTransitionIdx++ ][Transition])/ pa;
310  }
311  //endcap
312  pa = coerceToOne(m_eventStat.m_particleSpacePointsBTE[0][Endcap]);
313  std::array<double, 10> spEndcap2ff{};
314  size_t spacepointEndcapIdx = 2;
315  for (auto & thisSpacepoint: spEndcap2ff){
316  thisSpacepoint = double(m_eventStat.m_particleSpacePointsBTE[ spacepointEndcapIdx++ ][Endcap])/ pa;
317  }
318  //Fwd
319  pa = coerceToOne(m_eventStat.m_particleSpacePointsBTE[0][Forward]);
320  std::array<double, 10> spFwd2ff{};
321  size_t spacepointFwdIdx = 2;
322  for (auto & thisSpacepoint: spFwd2ff){
323  thisSpacepoint = double(m_eventStat.m_particleSpacePointsBTE[ spacepointFwdIdx++ ][Forward])/ pa;
324  }
325  auto w8=std::setw(8);
326  out<<"| Probability for such charge particles to have some number silicon |\n";
327  out<<"| clusters | space points |\n";
328  out<<"| Total Barrel Transi Endcap Forward | Total Barrel Transi Endcap Forward |\n";
329 
330  for (size_t idx{0};idx != 10;++idx){
331  out<<"| >= "<<idx+2<< std::string((idx<8)?" ":" ")
332  <<w8<<p5<<pc2ff[idx]
333  <<w8<<p5<<pcBarrel2ff[idx]
334  <<w8<<p5<<pcTransition2ff[idx]
335  <<w8<<p5<<pcEndcap2ff[idx]
336  <<w8<<p5<<pcFwd2ff[idx]<<" | "
337 
338  <<w8<<p5<<sp2ff[idx]
339  <<w8<<p5<<spBarrel2ff[idx]
340  <<w8<<p5<<spTransition2ff[idx]
341  <<w8<<p5<<spEndcap2ff[idx]
342  <<w8<<p5<<spFwd2ff[idx]
343  <<" |\n";
344  }
345 
346  out<<topNtail(spaceSeparator)<<"\n";
347  out<<"| Additional cuts for truth particles are |\n";
348  out<<"| number silicon clusters >="<<w13<<m_clcut<<" |\n";
349  out<<"| number trt clusters >="<<w13<<m_clcutTRT<<" |\n";
350  out<<"| number space points >="<<w13<<m_spcut<<" |\n";
351 
352  pa = coerceToOne(m_eventStat.m_particleClusters[0]);
353  out<<"| Probability find truth particles with this cuts is "<<w8<<p5<<double(m_eventStat.m_events)/pa<<" |\n";
354  pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Barrel]);
355  out<<"| For barrel region "<<w8<<p5<<double(m_eventStat.m_eventsBTE[Barrel])/pa<<" |\n";
356  pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Transition]);
357  out<<"| For transition region "<<w8<<p5<<double(m_eventStat.m_eventsBTE[Transition])/pa<<" |\n";
358  pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Endcap]);
359  out<<"| For endcap region "<<w8<<p5<<double(m_eventStat.m_eventsBTE[Endcap])/pa<<" |\n";
360  pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Forward]);
361  out<<"| For forward region "<<w8<<p5<<double(m_eventStat.m_eventsBTE[Forward])/pa<<" |\n";
362  out<<"| |\n";
363  pa = coerceToOne(m_eventStat.m_nclustersNegBP);
364  double ratio = double(m_eventStat.m_nclustersPosBP)/pa;
365  double eratio = std::sqrt(ratio*(1.+ratio)/pa);
366  out<<"| Ratio barrel pixels clusters for +/- particles ="<<w8<<p5<<ratio<<" +-"<<w8<<p5<<eratio<<" |\n";
367  pa = coerceToOne(m_eventStat.m_nclustersNegEP);
368  ratio = double(m_eventStat.m_nclustersPosEP)/pa;
369  eratio = std::sqrt(ratio*(1.+ratio)/pa);
370  out<<"| Ratio endcap pixels clusters for +/- particles ="<<w8<<p5<<ratio<<" +-"<<w8<<p5<<eratio<<" |\n";
371  pa = coerceToOne(m_eventStat.m_nclustersNegBS);
372  ratio = double(m_eventStat.m_nclustersPosBS)/pa;
373  eratio = std::sqrt(ratio*(1.+ratio)/pa);
374  out<<"| Ratio barrel SCT clusters for +/- particles ="<<w8<<p5<<ratio<<" +-"<<w8<<p5<<eratio<<" |\n";
375  pa = coerceToOne(m_eventStat.m_nclustersNegES);
376  ratio = double(m_eventStat.m_nclustersPosES)/pa;
377  eratio = std::sqrt(ratio*(1.+ratio)/pa);
378  out<<"| Ratio endcap SCT clusters for +/- particles ="<<w8<<p5<<ratio<<" +-"<<w8<<p5<<eratio<<" |\n";
379  pa = double(m_eventStat.m_eventsNEG); if(pa < 1.) pa = 1.;
380  ratio = double(m_eventStat.m_eventsPOS)/pa;
381  eratio = std::sqrt(ratio*(1.+ratio)/pa);
382  out<<"| Number truth particles and +/- ratio ="<<std::setw(10)<<m_eventStat.m_events<<w8<<p5<<ratio<<" +-"<<w8<<p5<<eratio<<" |\n";
383  ratio = 0.;
384  if(m_eventStat.m_nclustersPTOT!=0) ratio = double(m_eventStat.m_nclustersPTOTt)/double(m_eventStat.m_nclustersPTOT);
385 
386  out<<"| Number pix clusters, truth clusters and ratio = "
387  <<std::setw(10)<<m_eventStat.m_nclustersPTOT
388  <<std::setw(10)<<m_eventStat.m_nclustersPTOTt
389  <<std::setw(12)<<std::setprecision(5)<<ratio<<" |\n";
390  ratio = 0.;
391  if(m_eventStat.m_nclustersSTOT!=0) ratio = double(m_eventStat.m_nclustersSTOTt)/double(m_eventStat.m_nclustersSTOT);
392  out<<"| Number sct clusters, truth clusters and ratio = "
393  <<std::setw(10)<<m_eventStat.m_nclustersSTOT
394  <<std::setw(10)<<m_eventStat.m_nclustersSTOTt
395  <<std::setw(12)<<std::setprecision(5)<<ratio<<" |\n";
396 
397  out<<"|-----------------------------------------------------------------------------------|\n\n";
398 
400  int nc = 0;
401  for(; t!=te; ++t) {
402  int n = 47-(t->key().size());
403  std::string s1; for(int i=0; i<n; ++i) s1.append(" "); s1.append("|");
404 
405 
406  out<<"|-----------------------------------------------------------------------------------|\n";
407  out<<"| Statistic for "<<(t->key())<<s1<<"\n";
408 
409  double ne = double(m_eventStat.m_events); if(ne < 1.) ne = 1.;
410  double ef [6]; for(int i=0; i!=6; ++i) ef [i] = double(m_trackCollectionStat[nc].m_efficiency [i]) /ne;
411  double ef0[6]; for(int i=0; i!=6; ++i) ef0[i] = double(m_trackCollectionStat[nc].m_efficiencyN [i][0])/ne;
412  double ef1[6]; for(int i=0; i!=6; ++i) ef1[i] = double(m_trackCollectionStat[nc].m_efficiencyN [i][1])/ne;
413  double ef2[6]; for(int i=0; i!=6; ++i) ef2[i] = double(m_trackCollectionStat[nc].m_efficiencyN [i][2])/ne;
414 
415 
416  using EffArray_t = std::array<double, 6>;
417  //
418  auto makeEffArray = [](const auto & threeDimArray, const size_t secondIdx, const size_t thirdIdx, const double denom){
419  EffArray_t result{};
420  size_t idx{0};
421  auto invDenom = 1./denom;
422  for (auto & entry: result){
423  entry = threeDimArray[idx++][secondIdx][thirdIdx]*invDenom;
424  }
425  return result;
426  };
427  //
428  const auto & efficiencyArrayInput = m_trackCollectionStat[nc].m_efficiencyBTE;
429  //
430  double neBTE = coerceToOne(m_eventStat.m_eventsBTE[Barrel]);
431  const EffArray_t efB0 = makeEffArray(efficiencyArrayInput,0,Barrel,neBTE);
432  const EffArray_t efB1 = makeEffArray(efficiencyArrayInput,1,Barrel,neBTE);
433  const EffArray_t efB2 = makeEffArray(efficiencyArrayInput,2,Barrel,neBTE);
434  const EffArray_t efB3 = makeEffArray(efficiencyArrayInput,3,Barrel,neBTE);
435  const EffArray_t efB4 = makeEffArray(efficiencyArrayInput,4,Barrel,neBTE);
436  //
437  neBTE = coerceToOne(m_eventStat.m_eventsBTE[Transition]);
438  const EffArray_t efT0 = makeEffArray(efficiencyArrayInput,0,Transition,neBTE);
439  const EffArray_t efT1 = makeEffArray(efficiencyArrayInput,1,Transition,neBTE);
440  const EffArray_t efT2 = makeEffArray(efficiencyArrayInput,2,Transition,neBTE);
441  const EffArray_t efT3 = makeEffArray(efficiencyArrayInput,3,Transition,neBTE);
442  const EffArray_t efT4 = makeEffArray(efficiencyArrayInput,4,Transition,neBTE);
443  //
444  neBTE = coerceToOne(m_eventStat.m_eventsBTE[Endcap]);
445  const EffArray_t efE0 = makeEffArray(efficiencyArrayInput,0,Endcap,neBTE);
446  const EffArray_t efE1 = makeEffArray(efficiencyArrayInput,1,Endcap,neBTE);
447  const EffArray_t efE2 = makeEffArray(efficiencyArrayInput,2,Endcap,neBTE);
448  const EffArray_t efE3 = makeEffArray(efficiencyArrayInput,3,Endcap,neBTE);
449  const EffArray_t efE4 = makeEffArray(efficiencyArrayInput,4,Endcap,neBTE);
450  //
451  neBTE = coerceToOne(m_eventStat.m_eventsBTE[Forward]);
452  const EffArray_t efD0 = makeEffArray(efficiencyArrayInput,0,Forward,neBTE);
453  const EffArray_t efD1 = makeEffArray(efficiencyArrayInput,1,Forward,neBTE);
454  const EffArray_t efD2 = makeEffArray(efficiencyArrayInput,2,Forward,neBTE);
455  const EffArray_t efD3 = makeEffArray(efficiencyArrayInput,3,Forward,neBTE);
456  const EffArray_t efD4 = makeEffArray(efficiencyArrayInput,4,Forward,neBTE);
457 
458 
459  double efrec = ef0[0]+ef0[1]+ef0[2]+ef1[0]+ef1[1]+ef2[0];
460  double efrecB = efB0[0]+efB0[1]+efB0[2]+efB1[0]+efB1[1]+efB2[0];
461  double efrecT = efT0[0]+efT0[1]+efT0[2]+efT1[0]+efT1[1]+efT2[0];
462  double efrecE = efE0[0]+efE0[1]+efE0[2]+efE1[0]+efE1[1]+efE2[0];
463  double efrecD = efD0[0]+efD0[1]+efD0[2]+efD1[0]+efD1[1]+efD2[0];
464 
465  ne = coerceToOne(m_eventStat.m_eventsPOS);
466  double efP[6]; for(int i=0; i!=6; ++i) efP[i] = double(m_trackCollectionStat[nc].m_efficiencyPOS[i])/ne;
467  ne = coerceToOne(m_eventStat.m_eventsNEG);
468  double efN[6]; for(int i=0; i!=6; ++i) efN[i] = double(m_trackCollectionStat[nc].m_efficiencyNEG[i])/ne;
469 
470  out<<"|-----------------------------------------------------------------------------------|\n";
471  out<<"| Probability to lose 0 1 2 3 4 >=5 clusters |\n";
472  out<<"|-----------------------------------------------------------------------------------|\n";
473 
474  auto formattedOutput=[&out](auto & effArray){
475  for (size_t i{};i!=6;++i){
476  out<<std::setw(9)<<std::setprecision(4)<<effArray[i];
477  }
478  out<<" |\n";
479  };
480 
481  out<<"| For all particles ";
482  formattedOutput(ef);
483  out<<"| For + particles ";
484  formattedOutput(efP);
485  out<<"| For - particles ";
486  formattedOutput(efN);
487  out<<"|-----------------------------------------------------------------------------------|\n";
488  out<<"| Barrel region |\n";
489  out<<"| 0 wrong clusters ";
490  formattedOutput(efB0);
491  out<<"| 1 wrong clusters ";
492  formattedOutput(efB1);
493  out<<"| 2 wrong clusters ";
494  formattedOutput(efB2);
495  out<<"| 3 wrong clusters ";
496  formattedOutput(efB3);
497  out<<"| >=4 wrong clusters ";
498  formattedOutput(efB4);
499  out<<"|-----------------------------------------------------------------------------------|\n";
500  out<<"| Transition region |\n";
501  out<<"| 0 wrong clusters ";
502  formattedOutput(efT0);
503  out<<"| 1 wrong clusters ";
504  formattedOutput(efT1);
505  out<<"| 2 wrong clusters ";
506  formattedOutput(efT2);
507  out<<"| 3 wrong clusters ";
508  formattedOutput(efT3);
509  out<<"| >=4 wrong clusters ";
510  formattedOutput(efT4);
511  out<<"|-----------------------------------------------------------------------------------|\n";
512  out<<"| Endcap region |\n";
513  out<<"| 0 wrong clusters ";
514  formattedOutput(efE0);
515  out<<"| 1 wrong clusters ";
516  formattedOutput(efE1);
517  out<<"| 2 wrong clusters ";
518  formattedOutput(efE2);
519  out<<"| 3 wrong clusters ";
520  formattedOutput(efE3);
521  out<<"| >=4 wrong clusters ";
522  formattedOutput(efE4);
523  out<<"|-----------------------------------------------------------------------------------|\n";
524  out<<"| Forward region |\n";
525  out<<"| 0 wrong clusters ";
526  formattedOutput(efD0);
527  out<<"| 1 wrong clusters ";
528  formattedOutput(efD1);
529  out<<"| 2 wrong clusters ";
530  formattedOutput(efD2);
531  out<<"| 3 wrong clusters ";
532  formattedOutput(efD3);
533  out<<"| >=4 wrong clusters ";
534  formattedOutput(efD4);
535 
536  out<<"|-----------------------------------------------------------------------------------|\n";
537  pa = coerceToOne(m_eventStat.m_particleClusters[0]);
538  out<<"| Efficiency reconstruction (number lose+wrong < 3) = "
539  <<std::setw(9)<<std::setprecision(5)<<efrec
540  <<" ("
541  <<std::setw(9)<<std::setprecision(5)<<efrec*double(m_eventStat.m_events)/pa
542  <<" ) "
543  <<" |\n";
544  pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Barrel]);
545  out<<"| For barrel region = "
546  <<std::setw(9)<<std::setprecision(5)<<efrecB
547  <<" ("
548  <<std::setw(9)<<std::setprecision(5)<<efrecB*double(m_eventStat.m_eventsBTE[Barrel])/pa
549  <<" ) "
550  <<" |\n";
551  pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Transition]);
552  out<<"| For transition region = "
553  <<std::setw(9)<<std::setprecision(5)<<efrecT
554  <<" ("
555  <<std::setw(9)<<std::setprecision(5)<<efrecT*double(m_eventStat.m_eventsBTE[Transition])/pa
556  <<" ) "
557  <<" |\n";
558  pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Endcap]);
559  out<<"| For endcap region = "
560  <<std::setw(9)<<std::setprecision(5)<<efrecE
561  <<" ("
562  <<std::setw(9)<<std::setprecision(5)<<efrecE*double(m_eventStat.m_eventsBTE[Endcap])/pa
563  <<" ) "
564  <<" |\n";
565  pa = coerceToOne(m_eventStat.m_particleClustersBTE[0][Forward]);
566  out<<"| For forward region = "
567  <<std::setw(9)<<std::setprecision(5)<<efrecD
568  <<" ("
569  <<std::setw(9)<<std::setprecision(5)<<efrecD*double(m_eventStat.m_eventsBTE[Forward])/pa
570  <<" ) "
571  <<" |\n";
572 
573  out<<"|-----------------------------------------------------------------------------------|\n";
574  out<<"| Reconstructed tracks + - +/-ratio error |\n";
575  out<<"|-----------------------------------------------------------------------------------|\n";
576 
577  pa = coerceToOne(m_trackCollectionStat[nc].m_ntracksNEGB);
578  ratio = double(m_trackCollectionStat[nc].m_ntracksPOSB)/pa;
579  eratio = std::sqrt(ratio*(1.+ratio)/pa);
580 
581  out<<"| Barrel "
582  <<std::setw(10)<<m_trackCollectionStat[nc].m_ntracksPOSB
583  <<std::setw(11)<<m_trackCollectionStat[nc].m_ntracksNEGB
584  <<std::setw(11)<<std::setprecision(5)<<ratio
585  <<std::setw(11)<<std::setprecision(5)<<eratio<<" |\n";
586  pa = coerceToOne(m_trackCollectionStat[nc].m_ntracksNEGE);
587  ratio = double(m_trackCollectionStat[nc].m_ntracksPOSE)/pa;
588  eratio = std::sqrt(ratio*(1.+ratio)/pa);
589 
590  out<<"| Endcap "
591  <<std::setw(10)<<m_trackCollectionStat[nc].m_ntracksPOSE
592  <<std::setw(11)<<m_trackCollectionStat[nc].m_ntracksNEGE
593  <<std::setw(11)<<std::setprecision(5)<<ratio
594  <<std::setw(11)<<std::setprecision(5)<<eratio<<" |\n";
595  pa = coerceToOne(m_trackCollectionStat[nc].m_ntracksNEGFWD);
596  ratio = double(m_trackCollectionStat[nc].m_ntracksPOSFWD)/pa;
597  eratio = std::sqrt(ratio*(1.+ratio)/pa);
598 
599  out<<"| Forward "
600  <<std::setw(10)<<m_trackCollectionStat[nc].m_ntracksPOSFWD
601  <<std::setw(11)<<m_trackCollectionStat[nc].m_ntracksNEGFWD
602  <<std::setw(11)<<std::setprecision(5)<<ratio
603  <<std::setw(11)<<std::setprecision(5)<<eratio<<" |\n";
604 
605 
606 
607  int nt=0;
608  int ft=0;
609  int kf=0;
610  for(int k = 0; k!=50; ++k) {
611  nt+=m_trackCollectionStat[nc].m_total[k];
612  ft+=m_trackCollectionStat[nc].m_fake [k];
613  if(!kf && nt) kf = k;
614  }
615 
616  if(kf) {
617 
618  out<<"|-----------------------------------------------------------------------------------|\n";
619  out<<"| Fake tracks rate for different number of clusters on track |\n";
620  out<<"|-----------------------------------------------------------------------------------|\n";
621 
622  for(int k = kf; k!=kf+6; ++k) {
623  out<<"| >= "<<std::setw(2)<<k<<" ";
624  }
625  out<<"|\n";
626 
627  for(int k = kf; k!=kf+6; ++k) {
628  double eff = 0.; if(nt>0) eff = double(ft)/double(nt);
629  out<<"|"<<std::setw(12)<<std::setprecision(5)<<eff<<" ";
630  nt-=m_trackCollectionStat[nc].m_total[k];
631  ft-=m_trackCollectionStat[nc].m_fake [k];
632  }
633  out<<"|\n";
634  out<<"|-----------------------------------------------------------------------------------|\n";
635  }
636  ++nc;
637  }
638  ATH_MSG_INFO("\n"<<out.str());
639  return StatusCode::SUCCESS;
640 }
641 
643 // Dumps conditions information into the MsgStream
645 
647 {
649 
650  int n;
651  out << level <<"\n";
652  out<<"|--------------------------------------------------------------------------------------------------------------------|\n";
653  for(; t!=te; ++t) {
654  n = 65-t->key().size();
655  std::string s1; for(int i=0; i<n; ++i) s1.append(" "); s1.append("|");
656  out<<"| Location of input tracks | "<<t->key()<<s1<<"\n";
657  }
658  auto padString = [](const std::string & s){
659  const int n = 65 - s.size();
660  return s + std::string(n, ' ');
661  };
662  std::string s2 = padString(m_spacepointsPixelname.key());
663  std::string s3 = padString(m_spacepointsSCTname.key());
664  std::string s4 = padString(m_spacepointsOverlapname.key());
665  std::string s5 = padString(m_clustersPixelname.key());
666  std::string s6 = padString(m_clustersSCTname.key());
667  //
668  std::string s9 = padString(m_clustersTRTname.key());
669  //
670  std::string s7 = padString(m_truth_locationPixel.key());
671  std::string s8 = padString(m_truth_locationSCT.key());
672  //
673  std::string s10 = padString(m_truth_locationTRT.key());
674 
675  out<<"| Pixel space points | "<<s2<<"|\n";
676  out<<"| SCT space points | "<<s3<<"|\n";
677  out<<"| Overlap space points | "<<s4<<"|\n";
678  out<<"| Pixel clusters | "<<s5<<"|\n";
679  out<<"| SCT clusters | "<<s6<<"|\n";
680  out<<"| TRT clusters | "<<s9<<"|\n";
681  out<<"| Truth location for pixels | "<<s7<<"|\n";
682  out<<"| Truth location for sct | "<<s8<<"|\n";
683  out<<"| Truth location for trt | "<<s10<<"|\n";
684  out<<"| pT cut | "
685  <<std::setw(14)<<std::setprecision(5)<<m_ptcut
686  <<" |\n";
687  out<<"| max pT cut | "
688  <<std::setw(14)<<std::setprecision(5)<<m_ptcutmax
689  <<" |\n";
690  out<<"| rapidity cut | "
691  <<std::setw(14)<<std::setprecision(5)<<m_rapcut
692  <<" |\n";
693  out<<"| min Radius | "
694  <<std::setw(14)<<std::setprecision(5)<<m_rmin
695  <<" |\n";
696  out<<"| max Radius | "
697  <<std::setw(14)<<std::setprecision(5)<<m_rmax
698  <<" |\n";
699  out<<"| Min. number clusters for generated track | "
700  <<std::setw(14)<<std::setprecision(5)<<m_clcut
701  <<" |\n";
702  out<<"| Min. number sp.points for generated track | "
703  <<std::setw(14)<<std::setprecision(5)<<m_spcut
704  <<" |\n";
705  out<<"| Min. number TRT clusters for generated track | "
706  <<std::setw(14)<<std::setprecision(5)<<m_clcutTRT
707  <<" |\n";
708  out<<"|--------------------------------------------------------------------------------------------------------------------|\n";
709  return out;
710 }
711 
713 // Dumps event information into the ostream
715 
717 {
718  out << MSG::DEBUG << "\n";
719  auto formatOutput = [&out](const auto val){
720  out<<std::setw(12)<<val
721  <<" |\n";
722  };
723  out<<"|---------------------------------------------------------------------|\n";
724  out<<"| m_nspacepoints | ";
725  formatOutput(event_data.m_nspacepoints);
726  out<<"| m_nclusters | ";
727  formatOutput(event_data.m_nclusters);
728  out<<"| Kine-Clusters size | ";
729  formatOutput(event_data.m_kinecluster.size());
730  out<<"| Kine-TRTClusters size | ";
731  formatOutput(event_data.m_kineclusterTRT.size());
732  out<<"| Kine-SpacePoints size | ";
733  formatOutput(event_data.m_kinespacepoint.size());
734  out<<"| Number good kine tracks | ";
735  formatOutput(event_data.m_nqtracks);
736  out<<"|---------------------------------------------------------------------|\n";
737  return out;
738 }
739 
740 
742 // New event for clusters information
744 
746 {
747  std::lock_guard<std::mutex> lock(m_statMutex);
748 
749  // Get pixel clusters container
750  //
751  std::unique_ptr<SG::ReadHandle<SiClusterContainer> > pixelcontainer;
752  std::unique_ptr<SG::ReadHandle<SiClusterContainer> > sctcontainer;
753  std::unique_ptr<SG::ReadHandle<TRT_DriftCircleContainer> > trtcontainer;
754 
755  if(m_usePIX) {
756  pixelcontainer = std::make_unique<SG::ReadHandle<SiClusterContainer> >(m_clustersPixelname,ctx);
757  if (!pixelcontainer->isValid()) ATH_MSG_DEBUG("Failed to create Pixel clusters container read handle with key " << m_clustersPixelname.key());
758  }
759 
760  // Get sct clusters container
761  //
762  if(m_useSCT) {
763  sctcontainer = std::make_unique<SG::ReadHandle<SiClusterContainer> >(m_clustersSCTname,ctx);
764  if (!sctcontainer->isValid()) ATH_MSG_DEBUG("Failed to create SCT clusters container read handle with key " << m_clustersSCTname.key());
765  }
766 
767  // Get trt cluster container
768  //
769  if(m_clcutTRT > 0) {
770  trtcontainer = std::make_unique<SG::ReadHandle<TRT_DriftCircleContainer> >(m_clustersTRTname,ctx);
771  if (!trtcontainer->isValid()) ATH_MSG_DEBUG("Failed to create TRT drift circle container read handle with key " << m_clustersTRTname.key());
772  }
773 
774  int Kine[1000];
775 
776  event_data.m_clusterHandles.reserve(3);
777  // Loop through all pixel clusters
778  //
779  if(pixelcontainer && pixelcontainer->isValid()) {
780  InDet::SiClusterContainer::const_iterator w = (*pixelcontainer)->begin();
781  InDet::SiClusterContainer::const_iterator we = (*pixelcontainer)->end ();
782 
783  for(; w!=we; ++w) {
784 
785  InDet::SiClusterCollection::const_iterator c = (*w)->begin();
786  InDet::SiClusterCollection::const_iterator ce = (*w)->end ();
787 
788  for(; c!=ce; ++c) {
789 
790  ++event_data.m_nclusters;
791  ++m_eventStat.m_nclustersPTOT;
792  if(isTruth(event_data,(*c))) ++m_eventStat.m_nclustersPTOTt;
793 
794 
795  int nk = kine(event_data,(*c),Kine,999);
796  for(int i=0; i!=nk; ++i) {
797  if(!isTheSameDetElement(event_data,Kine[i],(*c))) {
798  event_data.m_kinecluster.insert(std::make_pair(Kine[i],(*c)));
799  }
800  }
801  }
802  }
803  event_data.m_clusterHandles.push_back(std::move(pixelcontainer));
804 
805  }
806 
807  // Loop through all sct clusters
808  //
809  if(sctcontainer && sctcontainer->isValid()) {
810  InDet::SiClusterContainer::const_iterator w = (*sctcontainer)->begin();
811  InDet::SiClusterContainer::const_iterator we = (*sctcontainer)->end ();
812 
813  for(; w!=we; ++w) {
814 
815  InDet::SiClusterCollection::const_iterator c = (*w)->begin();
816  InDet::SiClusterCollection::const_iterator ce = (*w)->end ();
817 
818  for(; c!=ce; ++c) {
819 
820  ++event_data.m_nclusters;
821  ++m_eventStat.m_nclustersSTOT;
822  if(isTruth(event_data,(*c))) ++m_eventStat.m_nclustersSTOTt;
823 
824  int nk = kine(event_data,(*c),Kine,999);
825  for(int i=0; i!=nk; ++i) {
826  if(!isTheSameDetElement(event_data,Kine[i],(*c))) event_data.m_kinecluster.insert(std::make_pair(Kine[i],(*c)));
827  }
828  }
829  }
830  event_data.m_clusterHandles.push_back(std::move(sctcontainer));
831  }
832 
833  if(trtcontainer && trtcontainer->isValid()) {
834  // Loop through all trt clusters
835  //
836  InDet::TRT_DriftCircleContainer::const_iterator w = (*trtcontainer)->begin();
837  InDet::TRT_DriftCircleContainer::const_iterator we = (*trtcontainer)->end ();
838 
839  for(; w!=we; ++w) {
840 
841  InDet::TRT_DriftCircleCollection::const_iterator c = (*w)->begin();
842  InDet::TRT_DriftCircleCollection::const_iterator ce = (*w)->end ();
843 
844  for(; c!=ce; ++c) {
845 
846  ++event_data.m_nclustersTRT;
847  int nk = kine(event_data,(*c),Kine,999);
848  for(int i=0; i!=nk; ++i) event_data.m_kineclusterTRT.insert(std::make_pair(Kine[i],(*c)));
849  }
850  }
851  event_data.m_clusterHandles.push_back(std::move(trtcontainer));
852  }
853 }
854 
856 // New event for space points information
858 
860 {
861 
862  int Kine[1000];
863 
864  if(m_usePIX && !m_spacepointsPixelname.key().empty()) {
865  event_data.m_spacePointContainer.emplace_back(m_spacepointsPixelname,ctx);
866  if (!event_data.m_spacePointContainer.back().isValid()) {
867  ATH_MSG_DEBUG( "Invalid Pixels space points container read handle for key " << m_spacepointsPixelname.key() );
868  }
869  else {
870  SpacePointContainer::const_iterator spc = event_data.m_spacePointContainer.back()->begin();
871  SpacePointContainer::const_iterator spce = event_data.m_spacePointContainer.back()->end ();
872  for(; spc != spce; ++spc) {
873  SpacePointCollection::const_iterator sp = (*spc)->begin();
874  SpacePointCollection::const_iterator spe = (*spc)->end ();
875 
876  for(; sp != spe; ++sp) {
877 
878  ++event_data.m_nspacepoints;
879  int nk = kine(event_data,(*sp)->clusterList().first,Kine,999);
880  for(int i=0; i!=nk; ++i) {
881 
882  if(!isTheSameDetElement(event_data,Kine[i],(*sp))) {
883  event_data.m_kinespacepoint.insert(std::make_pair(Kine[i],(*sp)));
884  }
885  }
886  }
887  }
888  }
889  }
890  // Get sct space points containers from store gate
891  //
892  if(m_useSCT && !m_spacepointsSCTname.key().empty()) {
893  event_data.m_spacePointContainer.emplace_back(m_spacepointsSCTname,ctx);
894  if (!event_data.m_spacePointContainer.back().isValid()) {
895  ATH_MSG_DEBUG( "Invalid SCT space points container read handle for key " << m_spacepointsSCTname.key() );
896  }
897  else {
898  SpacePointContainer::const_iterator spc = event_data.m_spacePointContainer.back()->begin();
899  SpacePointContainer::const_iterator spce = event_data.m_spacePointContainer.back()->end ();
900 
901  for(; spc != spce; ++spc) {
902 
903  SpacePointCollection::const_iterator sp = (*spc)->begin();
904  SpacePointCollection::const_iterator spe = (*spc)->end ();
905 
906  for(; sp != spe; ++sp) {
907 
908 
909  ++event_data.m_nspacepoints;
910  int nk = kine(event_data,(*sp)->clusterList().first,(*sp)->clusterList().second,Kine,999);
911  for(int i=0; i!=nk; ++i) {
912  if(!isTheSameDetElement(event_data,Kine[i],(*sp))) {
913  event_data.m_kinespacepoint.insert(std::make_pair(Kine[i],(*sp)));
914  }
915  }
916  }
917  }
918  }
919  }
920  // Get sct overlap space points containers from store gate
921  //
922  if(m_useSCT && !m_spacepointsOverlapname.key().empty()) {
923  event_data.m_spacepointsOverlap=std::make_unique< SG::ReadHandle<SpacePointOverlapCollection> >(m_spacepointsOverlapname,ctx);
924  if (!event_data.m_spacepointsOverlap->isValid()) {
925  ATH_MSG_DEBUG( "Invalid overlap space points container read handle for key " << m_spacepointsOverlapname.key() );
926  }
927  else {
930 
931  for (; sp!=spe; ++sp) {
932 
933  ++event_data.m_nspacepoints;
934  int nk = kine(event_data,(*sp)->clusterList().first,(*sp)->clusterList().second,Kine,999);
935  for(int i=0; i!=nk; ++i) {
936  if(!isTheSameDetElement(event_data,Kine[i],(*sp))) {
937  event_data.m_kinespacepoint.insert(std::make_pair(Kine[i],(*sp)));
938  }
939  }
940  }
941  }
942  }
943 }
945 // Good kine tracks selection
947 
949 {
953 
954  if( c == event_data.m_kinecluster.end()) {
955  return 0;
956  }
957 
958  if( s == event_data.m_kinespacepoint.end()) {
959  return 0;
960  }
961 
962  if( m_clcutTRT > 0 && u == event_data.m_kineclusterTRT.end()) {
963  return 0;
964  }
965 
966  std::list<int> worskine;
967 
968  int rp = 0;
969  int t = 0;
970  int k0 = (*c).first;
971  int q0 = k0*charge(event_data,(*c),rp);
972  unsigned int nc = 1 ;
973 
974  auto coerceTo49 = [] (const size_t idx){
975  return (idx<50) ? idx : 49;
976  };
977 
978  for(++c; c!=event_data.m_kinecluster.end(); ++c) {
979 
980  if((*c).first==k0) {++nc; continue;}
981  q0 = charge(event_data,(*c),rp)*k0;
982  //
983  const size_t clusterIdx =coerceTo49(nc);
984  ++event_data.m_eventStat.m_particleClusters [clusterIdx];
985  ++event_data.m_eventStat.m_particleClustersBTE[clusterIdx][rp];
986  //
987  int ns = event_data.m_kinespacepoint.count(k0);
988  const size_t spacepointIdx =coerceTo49(ns);
989  ++event_data.m_eventStat.m_particleSpacePoints [spacepointIdx];
990  ++event_data.m_eventStat.m_particleSpacePointsBTE[spacepointIdx][rp];
991 
992  if (nc < m_clcut ) worskine.push_back(k0);
993  else if(event_data.m_kinespacepoint.count(k0)< m_spcut ) worskine.push_back(k0);
994  else if(event_data.m_kineclusterTRT.count(k0)< m_clcutTRT) worskine.push_back(k0);
995  else {
996  event_data.m_particles[0].push_back(InDet::PartPropCache(q0,rp)); ++t;
997  }
998 
999  k0 = (*c).first;
1000  q0 =charge(event_data,(*c),rp)*k0;
1001  nc = 1 ;
1002  }
1003 
1004  ++event_data.m_eventStat.m_particleClusters [coerceTo49(nc)];
1005  ++event_data.m_eventStat.m_particleClustersBTE[coerceTo49(nc)][rp];
1006  int ns = event_data.m_kinespacepoint.count(k0);
1007  ++event_data.m_eventStat.m_particleSpacePoints [coerceTo49(ns)];
1008  ++event_data.m_eventStat.m_particleSpacePointsBTE[coerceTo49(ns)][rp];
1009 
1010  if (nc < m_clcut ) worskine.push_back(k0);
1011  else if(event_data.m_kinespacepoint.count(k0)< m_spcut ) worskine.push_back(k0);
1012  else if(event_data.m_kineclusterTRT.count(k0)< m_clcutTRT) worskine.push_back(k0);
1013  else {
1014  event_data.m_particles[0].push_back(InDet::PartPropCache(q0,rp)); ++t;
1015  }
1016  for(auto & pThisCluster: worskine) {
1017  event_data.m_kinecluster .erase(pThisCluster);
1018  event_data.m_kineclusterTRT.erase(pThisCluster);
1019  event_data.m_kinespacepoint.erase(pThisCluster);
1020  }
1021 
1022  for(c = event_data.m_kinecluster.begin(); c!= event_data.m_kinecluster.end(); ++c) {
1023  const Trk::PrepRawData*
1024  d = (*c).second;
1026  de= dynamic_cast<const InDetDD::SiDetectorElement*>(d->detectorElement());
1027  if (not de) continue;
1028  int q = charge(event_data,*c,rp);
1029 
1030  if (q<0) {
1031  if(de->isBarrel()) {
1032  de->isPixel() ? ++event_data.m_eventStat.m_nclustersNegBP : ++event_data.m_eventStat.m_nclustersNegBS;
1033  }
1034  else {
1035  de->isPixel() ? ++event_data.m_eventStat.m_nclustersNegEP : ++event_data.m_eventStat.m_nclustersNegES;
1036  }
1037 
1038  }
1039  else if(q>0) {
1040  if(de->isBarrel()) {
1041  de->isPixel() ? ++event_data.m_eventStat.m_nclustersPosBP : ++event_data.m_eventStat.m_nclustersPosBS;
1042  }
1043  else {
1044  de->isPixel() ? ++event_data.m_eventStat.m_nclustersPosEP : ++event_data.m_eventStat.m_nclustersPosES;
1045  }
1046  }
1047  }
1048 
1049 
1050 
1051  for(const auto& p: event_data.m_particles[0]) {
1052  for(SG::ReadHandleKeyArray<TrackCollection>::size_type nc=1; nc<m_tracklocation.size(); ++nc) event_data.m_particles[nc].push_back(p);
1053  }
1054  return t;
1055 }
1056 
1058 // Recontructed track comparison with kine information
1060 
1062 {
1063  if(!event_data.m_nqtracks) return;
1064 
1065 
1066  int nc = -1;
1067  event_data.m_trackcontainer.reserve(m_tracklocation.size());
1068  for(const SG::ReadHandleKey<TrackCollection> &track_key : m_tracklocation ) {
1069  if(++nc >= 100) return;
1070  event_data.m_tracks[nc].clear();
1071 
1072  event_data.m_trackcontainer.emplace_back(track_key,ctx );
1073  if (!event_data.m_trackcontainer.back().isValid()) {
1074  continue;
1075  }
1076 
1077  // Loop through all found tracks
1078  //
1079  TrackCollection::const_iterator t,te = event_data.m_trackcontainer.back()->end();
1080 
1081  int KINE[200],NKINE[200];
1082 
1083  for (t=event_data.m_trackcontainer.back()->begin(); t!=te; ++t) {
1084 
1085  Trk::TrackStates::const_iterator s = (*t)->trackStateOnSurfaces()->begin(),
1086  se = (*t)->trackStateOnSurfaces()->end();
1087 
1088  int NK = 0;
1089  int NC = 0;
1090  int N0 = 0;
1091  int nkm = 0;
1092  bool qp = false;
1093 
1094  const Trk::TrackParameters* tpf = (*s)->trackParameters(); if(!tpf) continue;
1095  const AmgVector(5)& Vpf = tpf ->parameters ();
1096  double pTf = std::abs(std::sin(Vpf[3])/Vpf[4]);
1097  bool qTf = pTf > m_ptcut;
1098  for(; s!=se; ++s) {
1099 
1100  if(!qp) {
1101 
1102  const Trk::TrackParameters* tp = (*s)->trackParameters();
1103 
1104  if(tp) {
1105  qp = true;
1106  const AmgVector(5)& Vp = tp->parameters();
1107  double pT = std::sin(Vp[3])/Vp[4] ;
1108  double rap = std::abs(std::log(std::tan(.5*Vp[3])));
1109  if (pT > m_ptcut && pT < m_ptcutmax) {
1110  if (rap < 1. ) ++event_data.m_trackCollectionStat[nc].m_ntracksPOSB;
1111  else if(rap < 3.0) ++event_data.m_trackCollectionStat[nc].m_ntracksPOSE;
1112  else if(rap < m_rapcut) ++event_data.m_trackCollectionStat[nc].m_ntracksPOSFWD;
1113  }
1114  else if(pT < -m_ptcut && pT > -m_ptcutmax) {
1115  if (rap < 1. ) ++event_data.m_trackCollectionStat[nc].m_ntracksNEGB;
1116  else if(rap < 3.0) ++event_data.m_trackCollectionStat[nc].m_ntracksNEGE;
1117  else if(rap < m_rapcut) ++event_data.m_trackCollectionStat[nc].m_ntracksNEGFWD;
1118  }
1119  }
1120  }
1121 
1122  if(!m_useOutliers && !(*s)->type(Trk::TrackStateOnSurface::Measurement)) continue;
1123 
1124  const Trk::MeasurementBase* mb = (*s)->measurementOnTrack();
1125  if(!mb) continue;
1126 
1127  const Trk::RIO_OnTrack* ri = dynamic_cast<const Trk::RIO_OnTrack*>(mb);
1128  if(!ri) continue;
1129 
1130  const Trk::PrepRawData* rd = ri->prepRawData();
1131  if(!rd) continue;
1132 
1133  const InDet::SiCluster* si = dynamic_cast<const InDet::SiCluster*>(rd);
1134  if(!si) continue;
1135 
1136  if(!m_usePIX && dynamic_cast<const InDet::PixelCluster*>(si)) continue;
1137  if(!m_useSCT && dynamic_cast<const InDet::SCT_Cluster*> (si)) continue;
1138 
1139 
1140  int Kine[1000], nk=kine0(event_data,rd,Kine,999); ++NC; if(!nk) ++N0;
1141 
1142  for(int k = 0; k!=nk; ++k) {
1143 
1144  int n = 0;
1145  for(; n!=NK; ++n) {if(Kine[k]==KINE[n]) {++NKINE[n]; break;}}
1146  if(n==NK) {KINE[NK] = Kine[k]; NKINE[NK] = 1; if (NK < 200) ++NK;}
1147  }
1148  for(int n=0; n!=NK; ++n) {if(NKINE[n]>nkm) nkm = NKINE[n];}
1149  }
1150 
1151  for(int n=0; n!=NK; ++n) {
1152  if(NKINE[n]==nkm) {
1153  int NQ = 1000*NKINE[n]+(NC-NKINE[n]);
1154 
1155  event_data.m_tracks[nc].insert(std::make_pair(KINE[n],NQ));
1156  if(qTf) {
1157  if(NC-N0 > 2) {
1158  ++event_data.m_trackCollectionStat[nc].m_total[NC]; if(NC-NKINE[n] > 2) {++event_data.m_trackCollectionStat[nc].m_fake[NC];}
1159  }
1160  }
1161  }
1162  }
1163  }
1164 
1165  }
1166 }
1167 
1169 // Particles and reconstructed tracks comparision
1171 
1173 {
1175 
1176  event_data.m_difference[nc].clear();
1177  auto p = event_data.m_particles[nc].begin(), pe =event_data.m_particles[nc].end();
1178  if(p==pe) return;
1179  std::multimap<int,int>::const_iterator t, te = event_data.m_tracks[nc].end();
1180 
1181  while (p!=pe) {
1182 
1183  const int uniqueID = HepMC::uniqueID(*p);
1184  int n = event_data.m_kinecluster.count(uniqueID);
1185  int m = 0;
1186  int w = 0;
1187  t = event_data.m_tracks[nc].find(uniqueID);
1188  for(; t!=te; ++t) {
1189  if((*t).first!=uniqueID) break;
1190  int ts = (*t).second/1000;
1191  int ws = (*t).second%1000;
1192  if (ts > m ) {m = ts; w = ws;}
1193  else if(ts==m && w > ws) { w = ws;}
1194  }
1195  int d = n-m; if(d<0) d = 0; else if(d > 5) d=5; if(w>4) w = 4;
1196  if(m) {
1197  ++event_data.m_trackCollectionStat[nc].m_efficiency [d];
1198  ++event_data.m_trackCollectionStat[nc].m_efficiencyN[d][w];
1199  }
1200  int ch = (*p).charge();
1201  if(m) {
1202  ++event_data.m_trackCollectionStat[nc].m_efficiencyBTE[d][w][(*p).rapidity()];
1203  ch > 0 ? ++event_data.m_trackCollectionStat[nc].m_efficiencyPOS[d] : ++event_data.m_trackCollectionStat[nc].m_efficiencyNEG[d];
1204  }
1205  if(nc==0) {
1206  ++event_data.m_eventStat.m_events; ch > 0 ? ++event_data.m_eventStat.m_eventsPOS : ++event_data.m_eventStat.m_eventsNEG;
1207  ++event_data.m_eventStat.m_eventsBTE[(*p).rapidity()];
1208  }
1209  if(d==0) event_data.m_particles[nc].erase(p++);
1210  else {event_data.m_difference[nc].push_back(n-m); ++p;}
1211  }
1212  }
1213 }
1214 
1216 // Pointer to particle production for space point
1218 
1220 (const InDet::TrackClusterAssValidation::EventData_t &event_data,const Trk::PrepRawData* d1,const Trk::PrepRawData* d2,int* Kine,int nmax) const
1221 {
1222  int nkine = 0;
1223  int Kine1[1000],Kine2[1000];
1224  int n1 = kine(event_data,d1,Kine1,nmax); if(!n1) return nkine;
1225  int n2 = kine(event_data,d2,Kine2,nmax); if(!n2) return nkine;
1226 
1227  for(int i = 0; i!=n1; ++i) {
1228  for(int j = 0; j!=n2; ++j) {
1229  if(Kine1[i]==Kine2[j]) {Kine[nkine++] = Kine1[i]; break;}
1230  }
1231  }
1232  return nkine;
1233 }
1234 
1236 // Pointer to particle production for cluster
1238 
1240 (const InDet::TrackClusterAssValidation::EventData_t &event_data,const Trk::PrepRawData* d,int* Kine,int nmax) const
1241 {
1242 
1243  PRD_MultiTruthCollection::const_iterator mce;
1244  PRD_MultiTruthCollection::const_iterator mc = findTruth(event_data,d,mce);
1245 
1246  Identifier ID = d->identify();
1247  int nkine = 0;
1248 
1249  for(; mc!=mce; ++mc) {
1250 
1251  if( (*mc).first != ID ) return nkine;
1252 
1253  const int uniqueID = HepMC::uniqueID((*mc).second); if(uniqueID<=0) continue;
1254 
1255  const HepMC::ConstGenParticlePtr pa = (*mc).second.cptr();
1256  if(!pa or !pa->production_vertex()) continue;
1257 
1258  int pdg = std::abs(pa->pdg_id()); if(m_pdg && m_pdg != pdg ) continue;
1259  if (MC::isNucleus(pdg)) continue; // ignore nuclei from hadronic interactions
1260  if (std::abs(MC::charge(pdg)) < .5) { continue; } // FIXME for fractionally charged particles
1261 
1262  // pT cut
1263  //
1264  double px = pa->momentum().px();
1265  double py = pa->momentum().py();
1266  double pz = pa->momentum().pz();
1267  double pt = std::sqrt(px*px+py*py);
1268  if( pt < m_ptcut || pt > m_ptcutmax) continue;
1269 
1270  // Rapidity cut
1271  //
1272  double t = std::abs(pz)/pt;
1273  if( t > m_tcut ) continue;
1274 
1275  // Radius cut
1276  //
1277  double vx = pa->production_vertex()->position().x();
1278  double vy = pa->production_vertex()->position().y();
1279  double r = std::sqrt(vx*vx+vy*vy);
1280  if( r < m_rmin || r > m_rmax) continue;
1281 
1282  Kine[nkine] = uniqueID; if(++nkine >= nmax) break;
1283  }
1284  return nkine;
1285 }
1286 
1288 // Pointer to particle production for cluster
1290 
1292 (const InDet::TrackClusterAssValidation::EventData_t &event_data,const Trk::PrepRawData* d,int* Kine,int nmax)
1293 {
1294 
1295  PRD_MultiTruthCollection::const_iterator mce;
1296  PRD_MultiTruthCollection::const_iterator mc = findTruth(event_data, d,mce);
1297 
1298  Identifier ID = d->identify();
1299  int nkine = 0;
1300 
1301  for(; mc!=mce; ++mc) {
1302 
1303  if( (*mc).first != ID ) return nkine;
1304 
1305  const int uniqueID = HepMC::uniqueID((*mc).second); if(uniqueID<=0) continue;
1306  Kine[nkine] = uniqueID; if(++nkine >= nmax) break;
1307  }
1308  return nkine;
1309 }
1310 
1312 // Test for cluster association with truth particles
1314 
1317 {
1318  PRD_MultiTruthCollection::const_iterator mce;
1319  PRD_MultiTruthCollection::const_iterator mc = findTruth(event_data,d,mce);
1320  return mc!=mce;
1321 }
1322 
1324 // Test detector element
1326 
1328 (const InDet::TrackClusterAssValidation::EventData_t &event_data, int K,const Trk::PrepRawData* d)
1329 {
1330  std::multimap<int,const Trk::PrepRawData*>::const_iterator k = event_data.m_kinecluster.find(K);
1331  for(; k!=event_data.m_kinecluster.end(); ++k) {
1332 
1333  if((*k).first!= K) return false;
1334  if(d->detectorElement()==(*k).second->detectorElement()) return true;
1335  }
1336  return false;
1337 }
1338 
1340 // Test detector element
1342 
1344 (const InDet::TrackClusterAssValidation::EventData_t &event_data, int K,const Trk::SpacePoint* sp)
1345 {
1346  const Trk::PrepRawData* p1 = sp->clusterList().first;
1347  const Trk::PrepRawData* p2 = sp->clusterList().second;
1348 
1349  std::multimap<int,const Trk::SpacePoint*>::const_iterator k = event_data.m_kinespacepoint.find(K);
1350 
1351  if(!p2) {
1352 
1353  for(; k!=event_data.m_kinespacepoint.end(); ++k) {
1354  if((*k).first!= K) return false;
1355 
1356  const Trk::PrepRawData* n1 = (*k).second->clusterList().first ;
1357  const Trk::PrepRawData* n2 = (*k).second->clusterList().second;
1358 
1359  if(p1->detectorElement() == n1->detectorElement()) return true;
1360  if(!n2) continue;
1361  if(p1->detectorElement() == n2->detectorElement()) return true;
1362  }
1363  return false;
1364  }
1365 
1366  for(; k!=event_data.m_kinespacepoint.end(); ++k) {
1367  if((*k).first!= K) return false;
1368 
1369  const Trk::PrepRawData* n1 = (*k).second->clusterList().first ;
1370  const Trk::PrepRawData* n2 = (*k).second->clusterList().second;
1371 
1372  if(p1->detectorElement() == n1->detectorElement()) return true;
1373  if(p2->detectorElement() == n1->detectorElement()) return true;
1374  if(!n2) continue;
1375  if(p1->detectorElement() == n2->detectorElement()) return true;
1376  if(p2->detectorElement() == n2->detectorElement()) return true;
1377  }
1378  return false;
1379 }
1380 
1382 // Dump information about no recontructed particles
1384 
1386 {
1387 
1389 
1390  auto p = event_data.m_particles[nc].begin(), pe =event_data.m_particles[nc].end();
1391  if(p==pe) continue;
1392 
1393  std::list<int>::const_iterator dif = event_data.m_difference[nc].begin();
1394 
1395  std::multimap<int,const Trk::PrepRawData*>::const_iterator c,ce = event_data.m_kinecluster.end();
1396 
1397  int n = 69-m_tracklocation[nc].key().size();
1398  std::string s1; for(int i=0; i<n; ++i) s1.append(" "); s1.append("|");
1399  std::stringstream out;
1400  out<<"|----------------------------------------------------------------------------------------|\n";
1401  out<<"| "<<m_tracklocation[nc]<<s1<<"\n";
1402  out<<"|----------------------------------------------------------------------------------------|\n";
1403  out<<"| # pdg kine Ncl Ntr Nsp Lose pT(MeV) rapidity radius z |\n";
1404  out<<"|----------------------------------------------------------------------------------------|\n";
1405 
1406  n = 0;
1407  for(; p!=pe; ++p) {
1408 
1409  const int uniqueID = HepMC::uniqueID(*p);
1410 
1411  c = event_data.m_kinecluster.find(uniqueID); if(c==ce) continue;
1412  const Trk::PrepRawData* d = (*c).second;
1413 
1414  PRD_MultiTruthCollection::const_iterator mce;
1415  PRD_MultiTruthCollection::const_iterator mc = findTruth(event_data,d,mce);
1416 
1417  Identifier ID = d->identify();
1418  bool Q = false;
1419  for(; mc!=mce; ++mc) {
1420  if((*mc).first != ID) break;
1421  if(HepMC::uniqueID((*mc).second)==uniqueID) {Q=true; break;}
1422  }
1423 
1424  if(!Q) continue;
1425 
1426  const HepMC::ConstGenParticlePtr pa = (*mc).second.cptr();
1427 
1428  double px = pa->momentum().px();
1429  double py = pa->momentum().py();
1430  double pz = pa->momentum().pz();
1431  double vx = pa->production_vertex()->position().x();
1432  double vy = pa->production_vertex()->position().y();
1433  double vz = pa->production_vertex()->position().z();
1434  double pt = std::sqrt(px*px+py*py);
1435  double t = std::atan2(pt,pz);
1436  double ra =-std::log(std::tan(.5*t));
1437  double r = std::sqrt(vx*vx+vy*vy);
1438  ++n;
1439  out<<"| "
1440  <<std::setw(4)<<n
1441  <<std::setw(6)<<pa->pdg_id()
1442  <<std::setw(10)<<HepMC::barcode(pa)
1443  <<std::setw(4)<<event_data.m_kinecluster .count(uniqueID)
1444  <<std::setw(4)<<event_data.m_kineclusterTRT.count(uniqueID)
1445  <<std::setw(4)<<event_data.m_kinespacepoint.count(uniqueID)
1446  <<std::setw(4)<<(*dif)
1447  <<std::setw(12)<<std::setprecision(5)<<pt
1448  <<std::setw(12)<<std::setprecision(5)<<ra
1449  <<std::setw(12)<<std::setprecision(5)<<r
1450  <<std::setw(12)<<std::setprecision(5)<<vz
1451  <<" |\n";
1452  ++dif;
1453 
1454  }
1455  out<<"|----------------------------------------------------------------------------------------|\n";
1456  ATH_MSG_INFO("\n"<<out.str());
1457  }
1458  return true;
1459 }
1460 
1462 // Cluster truth information
1464 
1465 PRD_MultiTruthCollection::const_iterator
1468  const Trk::PrepRawData* d,
1469  PRD_MultiTruthCollection::const_iterator& mce)
1470 {
1471  const InDet::SCT_Cluster * si = dynamic_cast<const InDet::SCT_Cluster*> (d);
1472  const InDet::PixelCluster * px = dynamic_cast<const InDet::PixelCluster*> (d);
1473  const InDet::TRT_DriftCircle* tr = dynamic_cast<const InDet::TRT_DriftCircle*>(d);
1474 
1475  PRD_MultiTruthCollection::const_iterator mc;
1476 
1477  if (px && event_data.m_truthPIX) {mc=event_data.m_truthPIX->find(d->identify()); mce=event_data.m_truthPIX->end();}
1478  else if(si && event_data.m_truthSCT) {mc=event_data.m_truthSCT->find(d->identify()); mce=event_data.m_truthSCT->end();}
1479  else if(tr && event_data.m_truthTRT) {mc=event_data.m_truthTRT->find(d->identify()); mce=event_data.m_truthTRT->end();}
1480  else {
1481  const PRD_MultiTruthCollection *truth[] {event_data. m_truthPIX,event_data.m_truthSCT, event_data.m_truthTRT};
1482  for (int i=0; i<3; i++) {
1483  if (truth[i]) {
1484  mce=truth[i]->end();
1485  return truth[i]->end();
1486  }
1487  }
1488  throw std::runtime_error("Neither Pixel, SCT nor TRT truth.");
1489  }
1490  return mc;
1491 }
1492 
1494 // Cluster truth information
1496 
1497 int InDet::TrackClusterAssValidation::charge(const InDet::TrackClusterAssValidation::EventData_t &event_data,std::pair<int,const Trk::PrepRawData*> pa,int& rap) const
1498 {
1499  const int uniqueID = pa.first;
1500  const Trk::PrepRawData* d = pa.second;
1501  PRD_MultiTruthCollection::const_iterator mce;
1502  PRD_MultiTruthCollection::const_iterator mc = findTruth(event_data,d,mce);
1503 
1504  for(; mc!=mce; ++mc) {
1505  if(HepMC::uniqueID((*mc).second)==uniqueID) {
1506 
1507  const HepMC::ConstGenParticlePtr pat = (*mc).second.cptr();
1508 
1509  rap = 0;
1510  double px = pat->momentum().px();
1511  double py = pat->momentum().py();
1512  double pz = pat->momentum().pz();
1513  double pt = std::sqrt(px*px+py*py) ;
1514  double t = std::atan2(pt,pz) ;
1515  double ra = std::abs(std::log(std::tan(.5*t)));
1516  // Forward
1517  if (ra > 3.0)
1518  rap = 3;
1519  else
1520  // other regions
1521  ra > 1.6 ? rap = 2 : ra > .8 ? rap = 1 : rap = 0;
1522 
1523  int pdg = pat->pdg_id();
1524  if (MC::isNucleus(pdg)) { return 0; } // ignore nuclei from hadronic interactions
1525  const double ch = MC::charge(pdg);
1526  if(ch > .5) return 1;
1527  if(ch < -.5) return -1;
1528  return 0;
1529  }
1530  }
1531  return 0;
1532 }
Trk::SpacePoint::clusterList
const std::pair< const PrepRawData *, const PrepRawData * > & clusterList() const
return the pair of cluster pointers by reference
Definition: Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePoint.h:127
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Trk::SpacePoint
Definition: Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePoint.h:35
beamspotman.r
def r
Definition: beamspotman.py:676
CalculateHighPtTerm.pT
pT
Definition: ICHEP2016/CalculateHighPtTerm.py:57
xAOD::eratio
setCharge setNTRTHiThresholdHits eratio
Definition: TrigElectron_v1.cxx:96
InDet::TrackClusterAssValidation::m_clcutTRT
unsigned int m_clcutTRT
Definition: TrackClusterAssValidation.h:64
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
InDet::EventStat_t::m_nclustersNegEP
int m_nclustersNegEP
Definition: TrackClusterAssValidationUtils.h:114
InDet::TrackClusterAssValidation::m_useTRT
bool m_useTRT
Definition: TrackClusterAssValidation.h:55
InDet::TrackClusterAssValidation::initialize
StatusCode initialize()
Definition: TrackClusterAssValidation.cxx:84
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
PlotCalibFromCool.ft
ft
Definition: PlotCalibFromCool.py:329
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
InDet::TrackClusterAssValidation::m_spacepointsOverlapname
SG::ReadHandleKey< SpacePointOverlapCollection > m_spacepointsOverlapname
Definition: TrackClusterAssValidation.h:75
isNucleus
bool isNucleus(const T &p)
PDG rule 16: Nuclear codes are given as 10-digit numbers±10LZZZAAAI.
Definition: AtlasPID.h:583
InDet::TrackClusterAssValidation::EventData_t::m_nqtracks
int m_nqtracks
Definition: TrackClusterAssValidation.h:107
get_generator_info.result
result
Definition: get_generator_info.py:21
test_pyathena.px
px
Definition: test_pyathena.py:18
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ID
std::vector< Identifier > ID
Definition: CalibHitIDCheck.h:24
InDet::EventStat_t::m_nclustersNegBP
int m_nclustersNegBP
Definition: TrackClusterAssValidationUtils.h:112
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
InDet::TrackClusterAssValidation::m_useOutliers
bool m_useOutliers
Definition: TrackClusterAssValidation.h:56
hist_file_dump.d
d
Definition: hist_file_dump.py:137
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
InDet::TrackClusterAssValidation::EventData_t::m_nclusters
int m_nclusters
Definition: TrackClusterAssValidation.h:106
PRD_MultiTruthCollection
A PRD is mapped onto all contributing particles.
Definition: PRD_MultiTruthCollection.h:24
GenVertex.h
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
InDet::TrackClusterAssValidation::EventData_t::m_particles
std::vector< std::list< PartPropCache > > m_particles
Definition: TrackClusterAssValidation.h:120
test_pyathena.pt
pt
Definition: test_pyathena.py:11
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
ParticleTest.tp
tp
Definition: ParticleTest.py:25
TRT_PAI_gasdata::NC
const int NC
Number of levels for Carbon.
Definition: TRT_PAI_gasdata.h:237
InDet::TrackClusterAssValidation::charge
int charge(const InDet::TrackClusterAssValidation::EventData_t &event_data, std::pair< int, const Trk::PrepRawData * >, int &) const
Definition: TrackClusterAssValidation.cxx:1497
InDet::EventStat_t::m_nclustersNegBS
int m_nclustersNegBS
Definition: TrackClusterAssValidationUtils.h:113
AthCommonMsg< Gaudi::Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
dq_defect_virtual_defect_validation.d1
d1
Definition: dq_defect_virtual_defect_validation.py:79
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
InDet::TrackClusterAssValidation::m_truth_locationSCT
SG::ReadHandleKey< PRD_MultiTruthCollection > m_truth_locationSCT
Definition: TrackClusterAssValidation.h:80
InDet::TrackClusterAssValidation::newSpacePointsEvent
void newSpacePointsEvent(const EventContext &ctx, InDet::TrackClusterAssValidation::EventData_t &event_data) const
Definition: TrackClusterAssValidation.cxx:859
ReadCellNoiseFromCoolCompare.s4
s4
Definition: ReadCellNoiseFromCoolCompare.py:381
InDet::TrackClusterAssValidation::m_clustersPixelname
SG::ReadHandleKey< SiClusterContainer > m_clustersPixelname
Definition: TrackClusterAssValidation.h:77
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
TrackClusterAssValidation.h
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
InDet::TrackClusterAssValidation::m_statMutex
std::mutex m_statMutex
Definition: TrackClusterAssValidation.h:59
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
keylayer_zslicemap.se
se
Definition: keylayer_zslicemap.py:194
InDet::TrackClusterAssValidation::m_spacepointsSCTname
SG::ReadHandleKey< SpacePointContainer > m_spacepointsSCTname
Definition: TrackClusterAssValidation.h:73
LArG4AODNtuplePlotter.pe
pe
Definition: LArG4AODNtuplePlotter.py:116
GenParticle.h
InDet::TrackClusterAssValidation::EventData_t::m_kineclusterTRT
std::multimap< int, const Trk::PrepRawData * > m_kineclusterTRT
Definition: TrackClusterAssValidation.h:118
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
InDet::TRT_DriftCircle
Definition: TRT_DriftCircle.h:32
InDet::TrackClusterAssValidation::EventData_t::m_tracks
std::vector< std::multimap< int, int > > m_tracks
Definition: TrackClusterAssValidation.h:122
InDet::EventStat_t::m_nclustersNegES
int m_nclustersNegES
Definition: TrackClusterAssValidationUtils.h:115
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
InDet::EventStat_t::m_particleClusters
int m_particleClusters[50]
Definition: TrackClusterAssValidationUtils.h:103
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
InDet::TrackClusterAssValidation::kine
int kine(const InDet::TrackClusterAssValidation::EventData_t &event_data, const Trk::PrepRawData *, const Trk::PrepRawData *, int *, int) const
Definition: TrackClusterAssValidation.cxx:1220
InDet::TrackClusterAssValidation::EventData_t::m_truthPIX
const PRD_MultiTruthCollection * m_truthPIX
Definition: TrackClusterAssValidation.h:114
InDet::EventStat_t::m_particleSpacePointsBTE
int m_particleSpacePointsBTE[50][4]
Definition: TrackClusterAssValidationUtils.h:106
InDet::TrackClusterAssValidation::EventData_t::m_nspacepoints
int m_nspacepoints
Definition: TrackClusterAssValidation.h:105
InDet::TrackClusterAssValidation::m_clcut
unsigned int m_clcut
Definition: TrackClusterAssValidation.h:63
InDet::TrackClusterAssValidation::m_spcut
unsigned int m_spcut
Definition: TrackClusterAssValidation.h:65
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
mc
Definition: mc.PG_single_nu_valid.py:1
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
InDet::TrackClusterAssValidation::m_SCTDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
Definition: TrackClusterAssValidation.h:85
InDet::TrackClusterAssValidation::kine0
static int kine0(const InDet::TrackClusterAssValidation::EventData_t &event_data, const Trk::PrepRawData *, int *, int)
Definition: TrackClusterAssValidation.cxx:1292
InDet::TrackClusterAssValidation::m_truth_locationTRT
SG::ReadHandleKey< PRD_MultiTruthCollection > m_truth_locationTRT
Definition: TrackClusterAssValidation.h:81
lumiFormat.i
int i
Definition: lumiFormat.py:85
InDet::TrackClusterAssValidation::m_truth_locationPixel
SG::ReadHandleKey< PRD_MultiTruthCollection > m_truth_locationPixel
Definition: TrackClusterAssValidation.h:79
InDet::TrackClusterAssValidation::noReconstructedParticles
bool noReconstructedParticles(const InDet::TrackClusterAssValidation::EventData_t &event_data) const
Definition: TrackClusterAssValidation.cxx:1385
beamspotman.n
n
Definition: beamspotman.py:731
InDet::TrackClusterAssValidation::EventData_t::m_trackCollectionStat
std::vector< TrackCollectionStat_t > m_trackCollectionStat
Definition: TrackClusterAssValidation.h:123
InDet::PartPropCache
Definition: TrackClusterAssValidationUtils.h:15
InDet::TrackClusterAssValidation::dumptools
MsgStream & dumptools(MsgStream &out, MSG::Level level) const
Definition: TrackClusterAssValidation.cxx:646
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
InDet::TrackClusterAssValidation::~TrackClusterAssValidation
virtual ~TrackClusterAssValidation()
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
AmgVector
AmgVector(4) T2BSTrackFilterTool
Definition: T2BSTrackFilterTool.cxx:114
InDet::TrackClusterAssValidation::m_useSCT
bool m_useSCT
Definition: TrackClusterAssValidation.h:54
TrackCollection.h
InDet::TrackClusterAssValidation::m_spacepointsPixelname
SG::ReadHandleKey< SpacePointContainer > m_spacepointsPixelname
Definition: TrackClusterAssValidation.h:74
HepMC::uniqueID
int uniqueID(const T &p)
Definition: MagicNumbers.h:116
Amg::pz
@ pz
Definition: GeoPrimitives.h:40
InDet::TrackClusterAssValidation::EventData_t::m_eventStat
EventStat_t m_eventStat
Definition: TrackClusterAssValidation.h:124
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
InDet::TrackClusterAssValidation::EventData_t::m_clusterHandles
std::vector< std::unique_ptr< SG::VarHandleBase > > m_clusterHandles
Definition: TrackClusterAssValidation.h:110
InDet::TrackClusterAssValidation::m_pdg
int m_pdg
Definition: TrackClusterAssValidation.h:57
InDet::TrackClusterAssValidation::isTruth
static bool isTruth(const InDet::TrackClusterAssValidation::EventData_t &, const Trk::PrepRawData *)
Definition: TrackClusterAssValidation.cxx:1316
IdentifiableContainerMT::const_iterator
Definition: IdentifiableContainerMT.h:79
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
Trk::ParametersBase
Definition: ParametersBase.h:55
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
InDet::TrackClusterAssValidation::EventData_t::m_truthSCT
const PRD_MultiTruthCollection * m_truthSCT
Definition: TrackClusterAssValidation.h:115
InDet::TrackClusterAssValidation::m_ptcutmax
double m_ptcutmax
Definition: TrackClusterAssValidation.h:67
InDet::SCT_Cluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SCT_Cluster.h:34
compute_lumi.denom
denom
Definition: compute_lumi.py:76
InDet::TrackClusterAssValidation::EventData_t::m_difference
std::vector< std::list< int > > m_difference
Definition: TrackClusterAssValidation.h:121
InDet::TrackClusterAssValidation::findTruth
static PRD_MultiTruthCollection::const_iterator findTruth(const InDet::TrackClusterAssValidation::EventData_t &event_data, const Trk::PrepRawData *, PRD_MultiTruthCollection::const_iterator &)
Definition: TrackClusterAssValidation.cxx:1467
InDet::TrackClusterAssValidation::tracksComparison
void tracksComparison(const EventContext &ctx, InDet::TrackClusterAssValidation::EventData_t &event_data) const
Definition: TrackClusterAssValidation.cxx:1061
lumiFormat.array
array
Definition: lumiFormat.py:91
Trk::PrepRawData
Definition: PrepRawData.h:62
InDet::TrackClusterAssValidation::m_tracklocation
SG::ReadHandleKeyArray< TrackCollection > m_tracklocation
Definition: TrackClusterAssValidation.h:72
Trk::MeasurementBase
Definition: MeasurementBase.h:58
dso-stats.pat
pat
Definition: dso-stats.py:39
InDet::EventStat_t::m_nclustersPosES
int m_nclustersPosES
Definition: TrackClusterAssValidationUtils.h:111
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
InDet::TrackClusterAssValidation::EventData_t::m_trackcontainer
std::vector< SG::ReadHandle< TrackCollection > > m_trackcontainer
Definition: TrackClusterAssValidation.h:111
InDet::TrackClusterAssValidation::EventData_t::m_truthTRT
const PRD_MultiTruthCollection * m_truthTRT
Definition: TrackClusterAssValidation.h:116
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
Amg::py
@ py
Definition: GeoPrimitives.h:39
ReadCellNoiseFromCoolCompare.s3
s3
Definition: ReadCellNoiseFromCoolCompare.py:380
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
RIO_OnTrack.h
PixelClusterContainer.h
InDet::TrackClusterAssValidation::m_tcut
double m_tcut
Definition: TrackClusterAssValidation.h:69
charge
double charge(const T &p)
Definition: AtlasPID.h:756
InDet::TrackClusterAssValidation::EventData_t
Definition: TrackClusterAssValidation.h:87
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
InDet::TrackClusterAssValidation::m_clustersTRTname
SG::ReadHandleKey< TRT_DriftCircleContainer > m_clustersTRTname
Definition: TrackClusterAssValidation.h:78
InDet::TrackClusterAssValidation::TrackClusterAssValidation
TrackClusterAssValidation(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrackClusterAssValidation.cxx:22
InDet::TrackClusterAssValidation::m_pixelDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
Definition: TrackClusterAssValidation.h:83
Trk::RIO_OnTrack::prepRawData
virtual const Trk::PrepRawData * prepRawData() const =0
returns the PrepRawData (also known as RIO) object to which this RIO_OnTrack is associated.
xAOD::k0
@ k0
for Fatras usage
Definition: TrackingPrimitives.h:202
Rtt_histogram.n1
n1
Definition: Rtt_histogram.py:21
InDet::PixelCluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:49
InDet::EventStat_t::m_eventsBTE
int m_eventsBTE[4]
Definition: TrackClusterAssValidationUtils.h:101
InDet::TrackClusterAssValidation::efficiencyReconstruction
void efficiencyReconstruction(InDet::TrackClusterAssValidation::EventData_t &event_data) const
Definition: TrackClusterAssValidation.cxx:1172
python.compareTCTs.ratio
ratio
Definition: compareTCTs.py:295
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
InDet::EventStat_t::m_nclustersPosBP
int m_nclustersPosBP
Definition: TrackClusterAssValidationUtils.h:108
InDet::TrackClusterAssValidation::isTheSameDetElement
static bool isTheSameDetElement(const InDet::TrackClusterAssValidation::EventData_t &event_data, int, const Trk::PrepRawData *)
Definition: TrackClusterAssValidation.cxx:1328
TRT_PAI_physicsConstants::mb
const double mb
1mb to cm2
Definition: TRT_PAI_physicsConstants.h:15
InDet::EventStat_t::m_events
int m_events
Definition: TrackClusterAssValidationUtils.h:98
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
InDet::TrackClusterAssValidation::m_rapcut
double m_rapcut
Definition: TrackClusterAssValidation.h:68
InDet::EventStat_t
Definition: TrackClusterAssValidationUtils.h:96
InDet::TrackClusterAssValidation::finalize
StatusCode finalize()
Definition: TrackClusterAssValidation.cxx:210
dq_defect_virtual_defect_validation.d2
d2
Definition: dq_defect_virtual_defect_validation.py:81
DEBUG
#define DEBUG
Definition: page_access.h:11
ReadCellNoiseFromCoolCompare.s2
s2
Definition: ReadCellNoiseFromCoolCompare.py:379
InDet::TrackClusterAssValidation::EventData_t::m_nclustersTRT
int m_nclustersTRT
Definition: TrackClusterAssValidation.h:108
InDet::EventStat_t::m_eventsPOS
int m_eventsPOS
Definition: TrackClusterAssValidationUtils.h:99
AthCommonMsg< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
InDet::TrackClusterAssValidation::m_usePIX
bool m_usePIX
Definition: TrackClusterAssValidation.h:53
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
InDet::EventStat_t::m_eventsNEG
int m_eventsNEG
Definition: TrackClusterAssValidationUtils.h:100
SCT_ClusterContainer.h
InDet::TrackClusterAssValidation::EventData_t::m_spacepointsOverlap
std::unique_ptr< SG::ReadHandle< SpacePointOverlapCollection > > m_spacepointsOverlap
Definition: TrackClusterAssValidation.h:113
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
extractSporadic.q
list q
Definition: extractSporadic.py:98
python.SystemOfUnits.ns
int ns
Definition: SystemOfUnits.py:130
InDet::TrackClusterAssValidation::qualityTracksSelection
int qualityTracksSelection(InDet::TrackClusterAssValidation::EventData_t &event_data) const
Definition: TrackClusterAssValidation.cxx:948
dqt_zlumi_alleff_HIST.eff
int eff
Definition: dqt_zlumi_alleff_HIST.py:113
str
Definition: BTagTrackIpAccessor.cxx:11
InDet::TrackClusterAssValidation::execute
StatusCode execute(const EventContext &ctx) const
Definition: TrackClusterAssValidation.cxx:144
InDet::TrackClusterAssValidation::dumpevent
static MsgStream & dumpevent(MsgStream &out, const InDet::TrackClusterAssValidation::EventData_t &event_data)
Definition: TrackClusterAssValidation.cxx:716
InDet::EventStat_t::m_nclustersPosEP
int m_nclustersPosEP
Definition: TrackClusterAssValidationUtils.h:110
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
beamspotnt.nt
def nt
Definition: bin/beamspotnt.py:1063
ReadHandle.h
Handle class for reading from StoreGate.
rp
ReadCards * rp
Definition: IReadCards.cxx:26
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
covarianceTool.mc
mc
Definition: covarianceTool.py:554
InDet::TrackClusterAssValidation::m_rmax
double m_rmax
Definition: TrackClusterAssValidation.h:71
python.CaloScaleNoiseConfig.ts
ts
Definition: CaloScaleNoiseConfig.py:86
InDet::TrackClusterAssValidation::EventData_t::m_kinespacepoint
std::multimap< int, const Trk::SpacePoint * > m_kinespacepoint
Definition: TrackClusterAssValidation.h:119
InDet::EventStat_t::m_nclustersPosBS
int m_nclustersPosBS
Definition: TrackClusterAssValidationUtils.h:109
python.compressB64.c
def c
Definition: compressB64.py:93
InDet::TrackClusterAssValidation::EventData_t::m_kinecluster
std::multimap< int, const Trk::PrepRawData * > m_kinecluster
Definition: TrackClusterAssValidation.h:117
nmax
const int nmax(200)
InDet::TrackClusterAssValidation::m_rmin
double m_rmin
Definition: TrackClusterAssValidation.h:70
InDet::SiCluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.h:40
LheEventFiller_Common.ef
ef
Definition: SFGen_i/share/common/LheEventFiller_Common.py:7
plotBeamSpotMon.nc
int nc
Definition: plotBeamSpotMon.py:83
Trk::TrackStateOnSurface::Measurement
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
Definition: TrackStateOnSurface.h:101
HepMCHelpers.h
InDet::TrackClusterAssValidation::m_ptcut
double m_ptcut
Definition: TrackClusterAssValidation.h:66
InDet::EventStat_t::m_particleClustersBTE
int m_particleClustersBTE[50][4]
Definition: TrackClusterAssValidationUtils.h:105
InDet::TrackClusterAssValidation::newClustersEvent
void newClustersEvent(const EventContext &ctx, InDet::TrackClusterAssValidation::EventData_t &event_data) const
Definition: TrackClusterAssValidation.cxx:745
InDet::TrackClusterAssValidation::m_clustersSCTname
SG::ReadHandleKey< SiClusterContainer > m_clustersSCTname
Definition: TrackClusterAssValidation.h:76
fitman.k
k
Definition: fitman.py:528
Trk::PrepRawData::detectorElement
virtual const TrkDetElementBase * detectorElement() const =0
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
InDet::TrackClusterAssValidation::EventData_t::m_spacePointContainer
std::vector< SG::ReadHandle< SpacePointContainer > > m_spacePointContainer
Definition: TrackClusterAssValidation.h:112
InDet::EventStat_t::m_particleSpacePoints
int m_particleSpacePoints[50]
Definition: TrackClusterAssValidationUtils.h:104
Identifier
Definition: IdentifierFieldParser.cxx:14