ATLAS Offline Software
SiTotalCharge.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // SiTotalCharge.h
7 // Header file for class SiTotalCharge
9 // (c) ATLAS Detector software
11 // Class which contains the sum and the composition of all bare charges
12 // corresponding to a single element
14 // Version 1.5 08/06/2001 David Calvet
16 
17 #ifndef SITRACKEREVENT_SITOTALCHARGE_H
18 #define SITRACKEREVENT_SITOTALCHARGE_H
19 
20 #include <list>
21 #include "InDetSimEvent/SiCharge.h"
23 
25 
27  // Public methods:
29 public:
30 
31  typedef std::vector<SiCharge> list_t;
32 
33  // Implicit constructor:
34  SiTotalCharge();
35 
36  // Copy constructor:
37  SiTotalCharge(const SiTotalCharge &totalCharge);
38 
39  // Destructor:
41 
42  // Assignment operator:
43  SiTotalCharge &operator=(const SiTotalCharge &totalCharge);
44 
46  // Const methods:
48 
49  // total deposited charge in this element:
50  double charge() const;
51 
52  // list of individual charges:
53  const list_t &chargeComposition() const;
54 
55  // return true if the charge composition contains more than one charge:
56  bool complexCharge() const;
57 
58  // return true if the main charge comes from a track (track/diodeX_Talk):
59  bool fromTrack() const;
60 
61  // return true if the main charge is extraNoise:
62  bool extraNoise() const;
63 
64  // return the barcode of the main charge:
65  int trackBarcode() const;
66 
67  // returns the HepMcParticleLink of the main charge
68  const HepMcParticleLink& particleLink() const;
69 
70  // return the time of the main charge
71  double time() const;
73  // Non-const methods:
75 
76  // add another SiCharge:
77  void add(const SiCharge &charge);
78 
79  // add another SiTotalCharge:
80  void add(const SiTotalCharge &totalCharge);
81 
82  // remove time information of the SiCharge objects:
83  void removeTimeInformation();
84 
85  // remove small SiCharge objects:
86  // minimum charge allowed to keep a SiCharge in the composition list
87  void removeSmallCharges(const double minimumCharge);
88 
90  // Private methods:
92 private:
93 
94  // add another SiCharge to the charge composition (not the total value):
95  void addSiCharge(const SiCharge &charge);
96 
97  // return the SiCharge corresponding to the process which deposited
98  // the biggest amount of charge (returns dummy charge if list is empty)
99  // (used to be a public method, but this caused problems if the list was empty):
100  const SiCharge& mainCharge() const;
101 
103  // Private data:
105 private:
106  double m_charge; // total deposited charge in this element
107  list_t m_chargeComposition; // list of individual charges
108  static const HepMcParticleLink m_emptyLink; // An empty link
109 };
110 
112 // Inline methods:
115 {
116 }
117 
118 inline double SiTotalCharge::charge() const
119 {
120  return m_charge;
121 }
122 
124 {
125  return m_chargeComposition;
126 }
127 
128 inline bool SiTotalCharge::complexCharge() const
129 {
130  return (m_chargeComposition.size()>1);
131 }
132 
133 inline bool SiTotalCharge::extraNoise() const
134 {
135  if(m_chargeComposition.empty())
136  {
137  return false;
138  }
140 }
141 
142 inline int SiTotalCharge::trackBarcode() const
143 {
144  if(m_chargeComposition.empty())
145  {
146  return 0;
147  }
148  return mainCharge().trackBarcode();
149 }
150 
151 inline double SiTotalCharge::time() const
152 {
153  if(m_chargeComposition.empty())
154  {
155  return 0.0;
156  }
157  return mainCharge().time();
158 }
159 
161 {
162  if(m_chargeComposition.empty())
163  {
165  }
166  return mainCharge().particleLink();
167 }
168 
169 
171 // Input/Output stream functions:
173 std::ostream &operator<<(std::ostream &out,const SiTotalCharge &totalCharge);
174 
175 #endif // SITRACKEREVENT_SITOTALCHARGE_H
SiTotalCharge::time
double time() const
Definition: SiTotalCharge.h:151
SiTotalCharge::trackBarcode
int trackBarcode() const
Definition: SiTotalCharge.h:142
SiTotalCharge::addSiCharge
void addSiCharge(const SiCharge &charge)
Definition: SiTotalCharge.cxx:108
SiCharge::particleLink
const HepMcParticleLink & particleLink() const
Definition: SiCharge.h:129
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
SiTotalCharge::charge
double charge() const
Definition: SiTotalCharge.h:118
SiCharge
Definition: SiCharge.h:25
SiTotalCharge::~SiTotalCharge
~SiTotalCharge()
Definition: SiTotalCharge.h:114
SiCharge::trackBarcode
int trackBarcode() const
Definition: SiCharge.h:124
SiCharge::extraNoise
@ extraNoise
Definition: SiCharge.h:28
SiTotalCharge::list_t
std::vector< SiCharge > list_t
Definition: SiTotalCharge.h:31
SiTotalCharge::m_chargeComposition
list_t m_chargeComposition
Definition: SiTotalCharge.h:107
SiTotalCharge::fromTrack
bool fromTrack() const
Definition: SiTotalCharge.cxx:49
SiTotalCharge::chargeComposition
const list_t & chargeComposition() const
Definition: SiTotalCharge.h:123
SiTotalCharge::add
void add(const SiCharge &charge)
Definition: SiTotalCharge.cxx:62
SiTotalCharge::SiTotalCharge
SiTotalCharge()
Definition: SiTotalCharge.cxx:18
operator<<
std::ostream & operator<<(std::ostream &out, const SiTotalCharge &totalCharge)
Definition: SiTotalCharge.cxx:124
ArenaSharedHeapSTLAllocator.h
STL-style allocator wrapper for ArenaHeapAllocator allowing the heap to be shared between containers.
SiTotalCharge::m_emptyLink
static const HepMcParticleLink m_emptyLink
Definition: SiTotalCharge.h:108
runSelector.processType
processType
Definition: runSelector.py:225
SiCharge::time
double time() const
Definition: SiCharge.h:114
SiTotalCharge::m_charge
double m_charge
Definition: SiTotalCharge.h:106
SiTotalCharge::mainCharge
const SiCharge & mainCharge() const
Definition: SiTotalCharge.cxx:40
SiTotalCharge::complexCharge
bool complexCharge() const
Definition: SiTotalCharge.h:128
SiCharge.h
SiTotalCharge
Definition: SiTotalCharge.h:24
SiTotalCharge::operator=
SiTotalCharge & operator=(const SiTotalCharge &totalCharge)
Definition: SiTotalCharge.cxx:30
SiTotalCharge::extraNoise
bool extraNoise() const
Definition: SiTotalCharge.h:133
SiTotalCharge::removeSmallCharges
void removeSmallCharges(const double minimumCharge)
Definition: SiTotalCharge.cxx:98
SiTotalCharge::removeTimeInformation
void removeTimeInformation()
Definition: SiTotalCharge.cxx:83
SiTotalCharge::particleLink
const HepMcParticleLink & particleLink() const
Definition: SiTotalCharge.h:160