ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SiTotalCharge Class Reference

#include <SiTotalCharge.h>

Collaboration diagram for SiTotalCharge:

Public Types

typedef std::vector< SiChargelist_t
 

Public Member Functions

 SiTotalCharge ()
 
 SiTotalCharge (const SiTotalCharge &totalCharge)
 
 ~SiTotalCharge ()
 
SiTotalChargeoperator= (const SiTotalCharge &totalCharge)
 
double charge () const
 
const list_tchargeComposition () const
 
bool complexCharge () const
 
bool fromTrack () const
 
bool extraNoise () const
 
int trackBarcode () const
 
const HepMcParticleLinkparticleLink () const
 
double time () const
 
void add (const SiCharge &charge)
 
void add (const SiTotalCharge &totalCharge)
 
void removeTimeInformation ()
 
void removeSmallCharges (const double minimumCharge)
 

Private Member Functions

void addSiCharge (const SiCharge &charge)
 
const SiChargemainCharge () const
 

Private Attributes

double m_charge
 
list_t m_chargeComposition
 

Static Private Attributes

static const HepMcParticleLink m_emptyLink = HepMcParticleLink()
 

Detailed Description

Definition at line 24 of file SiTotalCharge.h.

Member Typedef Documentation

◆ list_t

typedef std::vector<SiCharge> SiTotalCharge::list_t

Definition at line 31 of file SiTotalCharge.h.

Constructor & Destructor Documentation

◆ SiTotalCharge() [1/2]

SiTotalCharge::SiTotalCharge ( )

Definition at line 18 of file SiTotalCharge.cxx.

18  :
19  m_charge(0),
21 {}

◆ SiTotalCharge() [2/2]

SiTotalCharge::SiTotalCharge ( const SiTotalCharge totalCharge)

Definition at line 24 of file SiTotalCharge.cxx.

24  :
25  m_charge(totalCharge.m_charge),
27 {}

◆ ~SiTotalCharge()

SiTotalCharge::~SiTotalCharge ( )
inline

Definition at line 114 of file SiTotalCharge.h.

115 {
116 }

Member Function Documentation

◆ add() [1/2]

void SiTotalCharge::add ( const SiCharge charge)

Definition at line 62 of file SiTotalCharge.cxx.

63 {
64  // increase the total deposited charge
65  m_charge+=charge.charge();
66  // add the SiCharge to the list of charges
68 }

◆ add() [2/2]

void SiTotalCharge::add ( const SiTotalCharge totalCharge)

Definition at line 71 of file SiTotalCharge.cxx.

72 {
73  // increase the total deposited charge
74  m_charge+=totalCharge.charge();
75 
76  std::for_each(totalCharge.chargeComposition().begin(),
77  totalCharge.chargeComposition().end(),
78  [this](const SiCharge & c) { addSiCharge(c); }
79  );
80 }

◆ addSiCharge()

void SiTotalCharge::addSiCharge ( const SiCharge charge)
private

Definition at line 108 of file SiTotalCharge.cxx.

109 {
110  auto element = std::find_if(m_chargeComposition.begin(), m_chargeComposition.end(),
111  [&charge](const SiCharge & other) {
112  return (charge.time() == other.time()) &&
113  (charge.processType() == other.processType()) &&
114  (charge.particleLink() == other.particleLink());
115  } );
116  if(element != m_chargeComposition.end()) element->add(charge);
117  // add the charge to the list if not merged in existing one
118  else m_chargeComposition.push_back(charge);
119 }

◆ charge()

double SiTotalCharge::charge ( ) const
inline

Definition at line 118 of file SiTotalCharge.h.

119 {
120  return m_charge;
121 }

◆ chargeComposition()

const SiTotalCharge::list_t & SiTotalCharge::chargeComposition ( ) const
inline

Definition at line 123 of file SiTotalCharge.h.

124 {
125  return m_chargeComposition;
126 }

◆ complexCharge()

bool SiTotalCharge::complexCharge ( ) const
inline

Definition at line 128 of file SiTotalCharge.h.

129 {
130  return (m_chargeComposition.size()>1);
131 }

◆ extraNoise()

bool SiTotalCharge::extraNoise ( ) const
inline

Definition at line 133 of file SiTotalCharge.h.

134 {
135  if(m_chargeComposition.empty())
136  {
137  return false;
138  }
140 }

◆ fromTrack()

bool SiTotalCharge::fromTrack ( ) const

Definition at line 49 of file SiTotalCharge.cxx.

50 {
51  if(m_chargeComposition.empty())
52  {
53  return false;
54  }
56  return (process==SiCharge::track ||
59 }

◆ mainCharge()

const SiCharge & SiTotalCharge::mainCharge ( ) const
private

Definition at line 40 of file SiTotalCharge.cxx.

41 {
42  auto max_element = std::max_element(m_chargeComposition.cbegin(), m_chargeComposition.cend(),
43  [](SiCharge const & lhs, SiCharge const & rhs)
44  { return lhs.charge() < rhs.charge(); }
45  );
46  return *max_element;
47 }

◆ operator=()

SiTotalCharge & SiTotalCharge::operator= ( const SiTotalCharge totalCharge)

Definition at line 30 of file SiTotalCharge.cxx.

31 {
32  if (this!=&totalCharge) {
33  m_charge=totalCharge.m_charge;
35  } else {}
36  return *this;
37 }

◆ particleLink()

const HepMcParticleLink & SiTotalCharge::particleLink ( ) const
inline

Definition at line 160 of file SiTotalCharge.h.

161 {
162  if(m_chargeComposition.empty())
163  {
165  }
166  return mainCharge().particleLink();
167 }

◆ removeSmallCharges()

void SiTotalCharge::removeSmallCharges ( const double  minimumCharge)

Definition at line 98 of file SiTotalCharge.cxx.

99 {
100  //erase-remove idiom to remove small charges
101  auto new_end = std::remove_if(m_chargeComposition.begin(), m_chargeComposition.end(),
102  [&minimumCharge](const SiCharge& c){ return (c.charge() > -minimumCharge) &&
103  (c.charge() < minimumCharge); });
104  m_chargeComposition.erase(new_end, m_chargeComposition.end());
105 }

◆ removeTimeInformation()

void SiTotalCharge::removeTimeInformation ( )

Definition at line 83 of file SiTotalCharge.cxx.

84 {
85  // save the old charge composition
86  list_t oldComposition;
87  m_chargeComposition.swap(oldComposition);
88 
89  // loop on all old charges
90  for(const auto & p_charge : oldComposition) {
91  // add the old charge (without time) to the list
92  addSiCharge(SiCharge(p_charge.charge(),0,
93  p_charge.processType(),p_charge.particleLink()));
94  }
95 }

◆ time()

double SiTotalCharge::time ( ) const
inline

Definition at line 151 of file SiTotalCharge.h.

152 {
153  if(m_chargeComposition.empty())
154  {
155  return 0.0;
156  }
157  return mainCharge().time();
158 }

◆ trackBarcode()

int SiTotalCharge::trackBarcode ( ) const
inline

Definition at line 142 of file SiTotalCharge.h.

143 {
144  if(m_chargeComposition.empty())
145  {
146  return 0;
147  }
148  return mainCharge().trackBarcode();
149 }

Member Data Documentation

◆ m_charge

double SiTotalCharge::m_charge
private

Definition at line 106 of file SiTotalCharge.h.

◆ m_chargeComposition

list_t SiTotalCharge::m_chargeComposition
private

Definition at line 107 of file SiTotalCharge.h.

◆ m_emptyLink

const HepMcParticleLink SiTotalCharge::m_emptyLink = HepMcParticleLink()
staticprivate

Definition at line 108 of file SiTotalCharge.h.


The documentation for this class was generated from the following files:
SiTotalCharge::addSiCharge
void addSiCharge(const SiCharge &charge)
Definition: SiTotalCharge.cxx:108
SiCharge::particleLink
const HepMcParticleLink & particleLink() const
Definition: SiCharge.h:129
SiCharge::track
@ track
Definition: SiCharge.h:28
SiTotalCharge::charge
double charge() const
Definition: SiTotalCharge.h:118
SiCharge
Definition: SiCharge.h:25
SiCharge::diodeX_Talk
@ diodeX_Talk
Definition: SiCharge.h:28
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
SUSY_SimplifiedModel_PostInclude.process
string process
Definition: SUSY_SimplifiedModel_PostInclude.py:42
SiTotalCharge::m_chargeComposition
list_t m_chargeComposition
Definition: SiTotalCharge.h:107
SiTotalCharge::chargeComposition
const list_t & chargeComposition() const
Definition: SiTotalCharge.h:123
SiCharge::processType
Process processType() const
Definition: SiCharge.h:119
std::remove_if
std::reverse_iterator< DataModel_detail::iterator< DVL > > remove_if(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, Predicate pred)
Specialization of remove_if for DataVector/List.
Definition: DVL_algorithms.h:114
SiTotalCharge::m_emptyLink
static const HepMcParticleLink m_emptyLink
Definition: SiTotalCharge.h:108
runSelector.processType
processType
Definition: runSelector.py:225
SiCharge::Process
Process
Definition: SiCharge.h:28
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
SiCharge::cut_track
@ cut_track
Definition: SiCharge.h:28
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
python.compressB64.c
def c
Definition: compressB64.py:93