ATLAS Offline Software
TrigIDHitStats.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /*
6 * TrigInDetTrackTruth Helper class to keep numbers of hits in ID sub-detectors
7 *
8 * Copied from Tracking/TrkEvent/TrkTruthData/TrkTruthData/SubDetHitStatistics.h
9 */
10 
11 #ifndef TRIGIDHITSTATS_TRUTH_H
12 #define TRIGIDHITSTATS_TRUTH_H
13 
14 #include <cstring>
15 #include "AthenaKernel/CLASS_DEF.h"
16 
17 
19 
20  public:
21 
23 
26  memset(m_numHits, 0, NUM_SUBDETECTORS);
27  }
28 
29  virtual ~TrigIDHitStats() { }
30 
31  unsigned char& operator[](IDSubDetType i) { return m_numHits[i]; }
32 
33  const unsigned char& operator[](IDSubDetType i) const { return m_numHits[i]; }
34 
35  unsigned int total() const {
36  unsigned char tot=0;
37  for(unsigned i=0; i<NUM_SUBDETECTORS; i++) {
38  tot += m_numHits[i];
39  }
40  return (unsigned int)tot;
41  }
42 
43  unsigned int pixhits() const { return (unsigned int)m_numHits[PIX];}
44  unsigned int scthits() const { return (unsigned int)m_numHits[SCT];}
45  unsigned int trthits() const { return (unsigned int)m_numHits[TRT];}
46 
47 
49  for(unsigned i=0; i<NUM_SUBDETECTORS; i++) {
50  m_numHits[i] += b.m_numHits[i];
51  }
52  return *this;
53  }
54 
55 private:
56 
57  // For InDet, the largest typical number of measurements per track is 36 in
58  // the TRT. One byte is enough to keep any of the numbers.
59  unsigned char m_numHits[NUM_SUBDETECTORS];
60 
61 };
62 
63 template<class Ostream> Ostream& operator<<(Ostream& os, const TrigIDHitStats& m) {
64  os<<"IDSubDetStat(";
65  for(unsigned i=0; i<TrigIDHitStats::NUM_SUBDETECTORS; i++) {
68  }
69  return os<<")";
70 }
71 
72 CLASS_DEF( TrigIDHitStats , 212921831 , 1 )
73 #endif
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
TrigIDHitStats::trthits
unsigned int trthits() const
Definition: TrigIDHitStats.h:45
TrigIDHitStats::PIX
@ PIX
Definition: TrigIDHitStats.h:22
TrigIDHitStats
Definition: TrigIDHitStats.h:18
TrigIDHitStats::~TrigIDHitStats
virtual ~TrigIDHitStats()
Definition: TrigIDHitStats.h:29
TrigIDHitStats::NUM_SUBDETECTORS
@ NUM_SUBDETECTORS
Definition: TrigIDHitStats.h:22
xAOD::unsigned
unsigned
Definition: RingSetConf_v1.cxx:662
TrigIDHitStats::pixhits
unsigned int pixhits() const
Definition: TrigIDHitStats.h:43
TrigIDHitStats::TrigIDHitStats
TrigIDHitStats()
Constructors: POOL needs default constructor.
Definition: TrigIDHitStats.h:25
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrigIDHitStats::m_numHits
unsigned char m_numHits[NUM_SUBDETECTORS]
Definition: TrigIDHitStats.h:59
operator<<
Ostream & operator<<(Ostream &os, const TrigIDHitStats &m)
Definition: TrigIDHitStats.h:63
TrigIDHitStats::operator+=
TrigIDHitStats & operator+=(const TrigIDHitStats &b)
Definition: TrigIDHitStats.h:48
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
TrigIDHitStats::operator[]
unsigned char & operator[](IDSubDetType i)
Definition: TrigIDHitStats.h:31
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
TrigIDHitStats::SCT
@ SCT
Definition: TrigIDHitStats.h:22
TrigIDHitStats::operator[]
const unsigned char & operator[](IDSubDetType i) const
Definition: TrigIDHitStats.h:33
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
TrigIDHitStats::scthits
unsigned int scthits() const
Definition: TrigIDHitStats.h:44
TrigIDHitStats::total
unsigned int total() const
Definition: TrigIDHitStats.h:35
TrigIDHitStats::TRT
@ TRT
Definition: TrigIDHitStats.h:22
TrigIDHitStats::IDSubDetType
IDSubDetType
Definition: TrigIDHitStats.h:22
CLASS_DEF.h
macros to associate a CLID to a type