HerdSoftware  0.4.0
TimeStamp.h
Go to the documentation of this file.
1 /*
2  * TimeStamp.h
3  *
4  * Created on: 17 Feb 2022
5  * Author: Nicola Mori
6  */
7 
10 #ifndef HERD_TIME_H_
11 #define HERD_TIME_H_
12 
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 TimeStamp {
31 
32 public:
35 
36  TimeStamp(float time, unsigned int volumeID) : m_time{time}, m_volumeId{volumeID} {}
37 
39  virtual ~TimeStamp() = default;
40 
45  float Time() const { return m_time; }
46 
51  void SetTime(float time) { m_time = time; }
52 
57  unsigned int VolumeID() const { return m_volumeId; }
58 
63  void SetVolumeID(unsigned int volumeID) { m_volumeId = volumeID; }
64 
65 private:
66  float m_time;
67  unsigned int m_volumeId;
68 
69 #ifdef HS_USE_ROOT
70  ClassDef(TimeStamp, 1)
71 #endif
72 };
73 
74 inline bool operator==(const TimeStamp &ts1, const TimeStamp &ts2) {
75  return ((ts1.VolumeID() == ts2.VolumeID()) && (ts1.Time() == ts2.Time()));
76 }
77 
78 inline std::ostream &operator<<(std::ostream &out, const TimeStamp &timeStamp) {
79  return out << "{time=" << timeStamp.Time() << "ns, volID=" << timeStamp.VolumeID() << "}";
80 }
81 
82 } // namespace Herd
83 
84 #endif /* HERD_TIME_H_ */
Herd::operator==
bool operator==(const HoughTrackStub &lhs, const HoughTrackStub &rhs)
Definition: HoughTrackStub.h:41
DEFAULT_INIT
#define DEFAULT_INIT(x)
Definition: DefaultValues.h:23
Herd::TimeStamp::TimeStamp
TimeStamp()
Constructor.
Definition: TimeStamp.h:34
Herd::TimeStamp::SetVolumeID
void SetVolumeID(unsigned int volumeID)
Set the ID of the time measurement volume.
Definition: TimeStamp.h:63
Herd
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:22
Herd::operator<<
std::ostream & operator<<(std::ostream &os, const Vec3D &vec)
Write coordinates to stream.
Definition: Vec3D.h:345
Herd::TimeStamp::m_time
float m_time
Time measurement (ns).
Definition: TimeStamp.h:66
Herd::TimeStamp::Time
float Time() const
Get the time measurement.
Definition: TimeStamp.h:45
Herd::TimeStamp::~TimeStamp
virtual ~TimeStamp()=default
Virtual destructor
DefaultValues.h
Herd::TimeStamp::m_volumeId
unsigned int m_volumeId
ID of the time measurement volume.
Definition: TimeStamp.h:67
Herd::TimeStamp::VolumeID
unsigned int VolumeID() const
Get the unique identifier of the sensitive element.
Definition: TimeStamp.h:57
Herd::TimeStamp
TimeStamp object for transient data model.
Definition: TimeStamp.h:30
Herd::TimeStamp::SetTime
void SetTime(float time)
Set the time of the time measurement.
Definition: TimeStamp.h:51
Herd::TimeStamp::TimeStamp
TimeStamp(float time, unsigned int volumeID)
Definition: TimeStamp.h:36