ATLAS Offline Software
Loading...
Searching...
No Matches
LArHit.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5/* author : Johann Collot */
6/* date of creation : 07/01/2001 */
7/* date of last modification : 13/09/2002 CLID removed */
8
9// 03-Dec-2003 Bill Seligman: Substantially revised. This class no
10// longer inherits from any base class.
11
12// 09-Dec-2006 RD Schaffer: moved energy to double for accumulation
13// precision - float in persistent version
14
15#ifndef LArSimEvent_LArHit_h
16#define LArSimEvent_LArHit_h
17
18#include "Identifier/Identifier.h"
19#include "AthenaKernel/Units.h"
20
21class LArHit
22
24
25{
26public:
27
34 LArHit(Identifier l_cell, double l_energy, double l_time);
35
39 LArHit();
40
42 ~LArHit();
43
45 Identifier cellID() const;
46
48 double energy() const;
49
53 double time() const;
54
56 bool Less(LArHit* const& h) const;
57
59 bool Equals(LArHit* const& h) const;
60
63 void Add(LArHit* const& h);
64
67 void finalize();
68
69
70private:
71
74
76 double m_energy;
77
79 double m_time;
80
81};
82
83
85inline
86LArHit::LArHit(Identifier l_cell, double l_energy, double l_time)
87 :
88 m_ID(l_cell),
89 m_energy(l_energy),
90 m_time( (l_time*l_energy) )
91{}
92
93
94inline
96 :
98 m_energy(0.),
99 m_time(0.)
100{}
101
102inline
105
106inline
109{ return m_ID; }
110
111inline
112double
114{ return (double) m_energy; }
115
116inline
117double
119{ return m_time; }
120
121inline
122bool
123LArHit::Less(LArHit* const& h) const
124{ return m_ID < h->m_ID; }
125
126inline
127bool
128LArHit::Equals(LArHit* const& h) const
129{ return m_ID == h->m_ID; }
130
131inline
132void
134{
135 m_energy += h->m_energy;
136 m_time += h->m_time;
137}
138
139// The method to be called at the end of event by SD
140// For backwards compatibility
141inline
142void
144{
145 m_time = m_energy==0 ? 0. : (double)(m_time/m_energy)/Athena::Units::ns;
146 m_energy = m_energy/Athena::Units::MeV;
147}
148
149#endif // LArSimEvent_LArHit_h
150
Wrapper to avoid constant divisions when using units.
Header file for AthHistogramAlgorithm.
double m_time
time (in ns)
Definition LArHit.h:79
void Add(LArHit *const &h)
Add another hit ot this hit.
Definition LArHit.h:133
double energy() const
Definition LArHit.h:113
bool Equals(LArHit *const &h) const
Operator Equals this.
Definition LArHit.h:128
~LArHit()
Destructor.
Definition LArHit.h:103
LArHit(Identifier l_cell, double l_energy, double l_time)
LArHit Constructor.
Definition LArHit.h:86
Identifier m_ID
identifier of the cell in which this hit occured.
Definition LArHit.h:73
bool Less(LArHit *const &h) const
Operator Less than this for hit ordering.
Definition LArHit.h:123
LArHit()
Default constructor for persistency.
Definition LArHit.h:95
Identifier cellID() const
Definition LArHit.h:108
void finalize()
The method to be called at the end of event by SD.
Definition LArHit.h:143
double m_energy
energy (in MeV) deposited in this hit
Definition LArHit.h:76
double time() const
Definition LArHit.h:118