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& meas_x, const float& meas_y,
41 const float& meas_z) {
42 meas_x_ = meas_x;
43 meas_y_ = meas_y;
44 meas_z_ = meas_z;
45 };
46
48 [[nodiscard]] std::array<float, 3> getGlobalPosition() const {
49 return std::array<float, 3>{meas_x_, meas_y_, meas_z_};
50 };
51
59 void setLocalPosition(const float& meas_u, const float& meas_v) {
60 meas_u_ = meas_u;
61 meas_v_ = meas_v;
62 };
63
65 [[nodiscard]] std::array<float, 2> getLocalPosition() const {
66 return std::array<float, 2>{meas_u_, meas_v_};
67 };
68
75 void setLocalCovariance(const float& cov_uu, const float& cov_vv) {
76 cov_uu_ = cov_uu;
77 cov_vv_ = cov_vv;
78 }
79
82 [[nodiscard]] std::array<float, 2> getLocalCovariance() const {
83 return std::array<float, 2>{cov_uu_, cov_vv_};
84 };
85
91 void setTime(const float& meas_t) { meas_t_ = meas_t; };
92
94 [[nodiscard]] float getTime() const { return meas_t_; };
95
102 void setLayerID(const int& layer_id) {
103 layer_id_ = layer_id;
104 layer_ = ((layer_id_ / 100) % 10 - 1) * 2 + layer_id % 2;
105 };
106
108 [[nodiscard]] int getLayerID() const { return layer_id_; };
109
111 int getLayer() const { return layer_; }
112
114 void addTrackId(int trk_id) { track_ids_.push_back(trk_id); };
116 std::vector<unsigned int> getTrackIds() const { return track_ids_; };
117
120 float getEdep() const { return edep_; };
121
134 friend std::ostream& operator<<(std::ostream& output,
135 const Measurement& measurement);
136
137 private:
139 float meas_x_{0.};
141 float meas_y_{0.};
143 float meas_z_{0.};
145 float meas_t_{0.};
147 float meas_u_{0.};
149 float meas_v_{0.};
151 int layer_id_{0};
153 int layer_{0};
155 float edep_{0.};
157 float cov_uu_{0.};
159 float cov_vv_{0.};
161 int id_{0};
163 std::vector<unsigned int> track_ids_{};
164
165 ClassDef(Measurement, 2);
166}; // Measurement
167
168typedef std::vector<Measurement> Measurements;
169// typedef std::vector<std::reference_wrapper<const Measurement>> Measurements;
170
171} // 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:94
float meas_y_
The global position in x (mm).
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:48
int layer_
The layer number internal to the tracker.
void setLocalPosition(const float &meas_u, const float &meas_v)
Set the local position i.e.
Definition Measurement.h:59
void setLayerID(const int &layer_id)
Set the layer ID of the sensor where this measurement took place.
void addTrackId(int trk_id)
Add a trackId to the internal vector.
virtual ~Measurement()=default
Default destructor.
int getLayerID() const
int getLayer() const
std::vector< unsigned int > track_ids_
TrackIDs the vector of TrackIDs that form the measurement.
std::array< float, 2 > getLocalPosition() const
Definition Measurement.h:65
std::array< float, 2 > getLocalCovariance() const
Definition Measurement.h:82
float meas_v_
Local position in v (mm).
float edep_
The energy deposited in the sensor where the measurement took place.
float meas_z_
The global position in x (mm).
float getEdep() const
float meas_u_
Local position in u (mm).
float meas_t_
Measurement time (ns).
float meas_x_
The global position in x (mm).
void setGlobalPosition(const float &meas_x, const float &meas_y, const float &meas_z)
Set the global position i.e.
Definition Measurement.h:40
void setLocalCovariance(const float &cov_uu, const float &cov_vv)
Set cov(U,U) and cov(V, V).
Definition Measurement.h:75
float cov_uu_
cov(U, U)
int layer_id_
The ID of the sensor where the measurement took place.
std::vector< unsigned int > getTrackIds() const
void setTime(const float &meas_t)
Set the measurement time in ns.
Definition Measurement.h:91
int id_
The ID of the hit.
Represents a simulated tracker hit in the simulation.