LDMX Software
Measurement.h
1#pragma once
2
3//~~ StdLib ~~//
4#include <array>
5
7
8//~~ ROOT ~~//
9#include "TObject.h" // Needed for ClassDef, ClassImp
10
11namespace ldmx {
13 public:
15 Measurement() = default;
16
26 Measurement(const ldmx::SimTrackerHit& hit, const float& cov_uu = 0.05,
27 const float& cov_vv = 1.0);
28
30 virtual ~Measurement() = default;
31
40 void setGlobalPosition(const float& x, const float& y, const float& z) {
41 x_ = x;
42 y_ = y;
43 z_ = z;
44 };
45
47 [[nodiscard]] std::array<float, 3> getGlobalPosition() const {
48 return std::array<float, 3>{x_, y_, z_};
49 };
50
58 void setLocalPosition(const float& u, const float& v) {
59 u_ = u;
60 v_ = v;
61 };
62
64 [[nodiscard]] std::array<float, 2> getLocalPosition() const {
65 return std::array<float, 2>{u_, v_};
66 };
67
74 void setLocalCovariance(const float& cov_uu, const float& cov_vv) {
75 cov_uu_ = cov_uu;
76 cov_vv_ = cov_vv;
77 }
78
81 [[nodiscard]] std::array<float, 2> getLocalCovariance() const {
82 return std::array<float, 2>{cov_uu_, cov_vv_};
83 };
84
90 void setTime(const float& t) { t_ = t; };
91
93 [[nodiscard]] float getTime() const { return t_; };
94
100 void setLayerID(const int& layerid) {
101 layerid_ = layerid;
102 layer_ = ((layerid_ / 100) % 10 - 1) * 2 + layerid % 2;
103 };
104
106 [[nodiscard]] int getLayerID() const { return layerid_; };
107
109 int getLayer() const { return layer_; }
110
112 void addTrackId(int trkId) { trackIds_.push_back(trkId); };
114 std::vector<unsigned int> getTrackIds() { return trackIds_; };
115
128 friend std::ostream& operator<<(std::ostream& output,
129 const Measurement& measurement);
130
131 private:
133 float x_{0.};
135 float y_{0.};
137 float z_{0.};
139 float t_{0.};
141 float u_{0.};
143 float v_{0.};
145 int layerid_{0};
147 int layer_{0};
149 float edep_{0.};
151 float cov_uu_{0.};
153 float cov_vv_{0.};
155 int id_{0};
157 std::vector<unsigned int> trackIds_{};
158
159 ClassDef(Measurement, 1);
160}; // Measurement
161
162typedef std::vector<Measurement> Measurements;
163// typedef std::vector<std::reference_wrapper<const Measurement>> Measurements;
164
165} // namespace ldmx
Class which encapsulates information from a hit in a simulated tracking detector.
float cov_vv_
cov(V, V)
float getTime() const
Definition Measurement.h:93
std::vector< unsigned int > getTrackIds()
Measurement(const ldmx::SimTrackerHit &hit, const float &cov_uu=0.05, const float &cov_vv=1.0)
Constructor that uses a SimTrackerHit to populate the global position, deposited energy,...
friend std::ostream & operator<<(std::ostream &output, const Measurement &measurement)
Overload the stream insertion operator to output a string representation of this Measurement.
Measurement()=default
Default constructor.
std::array< float, 3 > getGlobalPosition() const
Definition Measurement.h:47
void setTime(const float &t)
Set the measurement time in ns.
Definition Measurement.h:90
int layer_
The layer number internal to the tracker.
void setGlobalPosition(const float &x, const float &y, const float &z)
Set the global position i.e.
Definition Measurement.h:40
virtual ~Measurement()=default
Default destructor.
int getLayerID() const
int getLayer() const
std::array< float, 2 > getLocalPosition() const
Definition Measurement.h:64
float v_
Local position in v (mm).
std::array< float, 2 > getLocalCovariance() const
Definition Measurement.h:81
std::vector< unsigned int > trackIds_
TrackIDs the vector of TrackIDs that form the measurement.
float edep_
The energy deposited in the sensor where the measurement took place.
float z_
The global position in x (mm).
float u_
Local position in u (mm).
float t_
Measurement time (ns).
float x_
The global position in x (mm).
void setLayerID(const int &layerid)
Set the layer ID of the sensor where this measurement took place.
void setLocalPosition(const float &u, const float &v)
Set the local position i.e.
Definition Measurement.h:58
void setLocalCovariance(const float &cov_uu, const float &cov_vv)
Set cov(U,U) and cov(V, V).
Definition Measurement.h:74
float cov_uu_
cov(U, U)
void addTrackId(int trkId)
Add a trackId to the internal vector.
float y_
The global position in x (mm).
int layerid_
The ID of the sensor where the measurement took place.
int id_
The ID of the hit.
Represents a simulated tracker hit in the simulation.