HerdSoftware  0.1.1
Hit.h
Go to the documentation of this file.
1 /*
2  * Hit.h
3  *
4  * Created on: 8 Nov 2018
5  * Author: Nicola Mori
6  */
7 
10 #ifndef HERD_HIT_H_
11 #define HERD_HIT_H_
12 
13 #include "common/DefaultValues.h"
14 
15 #ifdef HS_USE_ROOT
16 #include "Rtypes.h"
17 #endif
18 
19 #include <array>
20 #include <limits>
21 
22 namespace Herd {
23 
30 class Hit {
31 
32 public:
35 
36  Hit(float eDep, unsigned int volumeID) : _eDep{eDep}, _volumeId{volumeID} {}
37 
39  virtual ~Hit() = default;
40 
45  float EDep() const { return _eDep; }
46 
51  void SetEDep(float eDep) { _eDep = eDep; }
52 
57  unsigned int VolumeID() const { return _volumeId; }
58 
63  void SetVolumeID(unsigned int volumeID) { _volumeId = volumeID; }
64 
65 private:
66  float _eDep;
67  unsigned int _volumeId;
68 
69 #ifdef HS_USE_ROOT
70  ClassDef(Hit, 1)
71 #endif
72 };
73 
74 inline bool operator==(const Hit &h1, const Hit &h2) {
75  return ((h1.VolumeID() == h2.VolumeID()) && (h1.EDep() == h2.EDep()));
76 }
77 
78 inline std::ostream &operator<<(std::ostream &out, const Hit &hit) {
79  return out << "{eDep=" << hit.EDep() << ",volID=" << hit.VolumeID() << "}";
80 }
81 
82 } // namespace Herd
83 
84 #endif /* HERD_HIT_H_ */
void SetVolumeID(unsigned int volumeID)
Set the ID of the hit volume.
Definition: Hit.h:63
bool operator==(const HoughTrackStub &lhs, const HoughTrackStub &rhs)
Definition: HoughTrackStub.h:41
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:24
unsigned int _volumeId
Id of the hit volume.
Definition: Hit.h:67
#define DEFAULT_INIT(x)
Definition: DefaultValues.h:23
unsigned int VolumeID() const
Get the unique identifier of the sensitive element.
Definition: Hit.h:57
Hit()
Constructor.
Definition: Hit.h:34
std::ostream & operator<<(std::ostream &os, const Vec3D &vec)
Write coordinates to stream.
Definition: Vec3D.h:323
virtual ~Hit()=default
Virtual destructor.
void SetEDep(float eDep)
Set the energy deposit of the hit.
Definition: Hit.h:51
float EDep() const
Get the deposited energy.
Definition: Hit.h:45
float _eDep
Deposited energy [GeV].
Definition: Hit.h:66
Hit object for transient data model.
Definition: Hit.h:30
Hit(float eDep, unsigned int volumeID)
Definition: Hit.h:36