35
35
// / allows to integrate any number of independent readout channels.
36
36
class TRestDetectorReadoutModule {
37
37
private:
38
- Int_t fModuleID ; // /< The module id given by the readout definition.
38
+ Int_t fId = - 1 ; // /< The module id given by the readout definition.
39
39
40
- TString fModuleName ; // /< The assigned module name.
40
+ std::string fName ; // /< The assigned module name.
41
41
42
- TVector2 fModuleOrigin ; // /< The module (x, y) position relative to the readout plane position.
42
+ TVector2 fOrigin = { 0 , 0 } ; // /< The module (x, y) position relative to the readout plane position.
43
43
44
- TVector2 fModuleSize ; // /< The module (x, y) size. All pixels should be contained within this size.
44
+ TVector2 fSize = { 0 , 0 } ; // /< The module (x, y) size. All pixels should be contained within this size.
45
45
46
- Double_t fModuleRotation ; // /< The rotation of the module around the
47
- // /< position=(fModuleOriginX, fModuleOriginY) in
48
- // /< degrees.
46
+ // / The rotation of the module around the module origin (fModuleOriginX, fModuleOriginY) in radians.
47
+ Double_t fRotation = 0 ; // <
49
48
50
- Int_t fMinimumDaqId ; // /< The minimum daq channel id associated to the
51
- // /< module.
52
- Int_t fMaximumDaqId ; // /< The maximum daq channel id associated to the module.
49
+ std::pair<Int_t, Int_t> fDaqIdRange = {
50
+ -1 , -1 }; // /< The minimum and maximum daq channel ids associated to the module.
53
51
54
52
std::vector<TRestDetectorReadoutChannel>
55
53
fReadoutChannel ; // /< A std::vector of the instances of TRestDetectorReadoutChannel
@@ -68,8 +66,8 @@ class TRestDetectorReadoutModule {
68
66
// / Converts the coordinates (xPhys,yPhys) in the readout plane reference
69
67
// / system to the readout module reference system.
70
68
inline TVector2 TransformToModuleCoordinates (const TVector2& xyPhysical) const {
71
- auto coords = xyPhysical - fModuleOrigin ;
72
- TVector2 rot = coords.Rotate (-fModuleRotation * TMath::Pi () / 180 . );
69
+ auto coords = xyPhysical - fOrigin ;
70
+ TVector2 rot = coords.Rotate (-fRotation );
73
71
74
72
return rot;
75
73
}
@@ -79,8 +77,8 @@ class TRestDetectorReadoutModule {
79
77
inline TVector2 TransformToPlaneCoordinates (Double_t xMod, Double_t yMod) const {
80
78
TVector2 coords (xMod, yMod);
81
79
82
- coords = coords.Rotate (fModuleRotation * TMath::Pi () / 180 . );
83
- coords += fModuleOrigin ;
80
+ coords = coords.Rotate (fRotation );
81
+ coords += fOrigin ;
84
82
85
83
return coords;
86
84
}
@@ -90,22 +88,19 @@ class TRestDetectorReadoutModule {
90
88
// Setters
91
89
92
90
// / Sets the module by id definition
93
- inline void SetModuleID (Int_t modID) { fModuleID = modID; }
91
+ inline void SetModuleID (Int_t modID) { fId = modID; }
94
92
95
93
// / Sets the module size by definition using TVector2 input
96
- inline void SetSize (const TVector2& size) { fModuleSize = size; }
94
+ inline void SetSize (const TVector2& size) { fSize = size; }
97
95
98
96
// / Sets the module origin by definition using TVector2 input
99
- inline void SetOrigin (const TVector2& origin) { fModuleOrigin = origin; }
100
-
101
- // / Sets the module origin by definition using (x,y) coordinates
102
- inline void SetOrigin (Double_t x, Double_t y) { SetOrigin ({x, y}); }
97
+ inline void SetOrigin (const TVector2& origin) { fOrigin = origin; }
103
98
104
99
// / Sets the module rotation in degrees
105
- inline void SetRotation (Double_t rotation) { fModuleRotation = rotation; }
100
+ inline void SetRotation (Double_t rotation) { fRotation = rotation; }
106
101
107
102
// / Sets the name of the readout module
108
- inline void SetName (const TString & name) { fModuleName = name; }
103
+ inline void SetName (const std::string & name) { fName = name; }
109
104
110
105
// / Sets the tolerance for independent pixel overlaps
111
106
inline void SetTolerance (Double_t tolerance) { fTolerance = tolerance; }
@@ -114,42 +109,32 @@ class TRestDetectorReadoutModule {
114
109
inline Double_t GetTolerance () const { return fTolerance ; }
115
110
116
111
// / Returns the minimum daq id number
117
- inline Int_t GetMinDaqID () const { return fMinimumDaqId ; }
112
+ inline Int_t GetMinDaqID () const { return fDaqIdRange . first ; }
118
113
119
114
// / Returns the maximum daq id number
120
- inline Int_t GetMaxDaqID () const { return fMaximumDaqId ; }
115
+ inline Int_t GetMaxDaqID () const { return fDaqIdRange . second ; }
121
116
122
- // / Returns the physical readout channel index for a given daq id channel
123
- // / number
117
+ // / Returns the physical readout channel index for a given daq id channel number
124
118
inline Int_t DaqToReadoutChannel (Int_t daqChannel) {
125
- for (size_t n = 0 ; n < GetNumberOfChannels (); n++)
126
- if (GetChannel (n)->GetDaqID () == daqChannel) return n;
119
+ for (size_t n = 0 ; n < GetNumberOfChannels (); n++) {
120
+ if (GetChannel (n)->GetDaqID () == daqChannel) {
121
+ return n;
122
+ }
123
+ }
127
124
return -1 ;
128
125
}
129
126
130
127
// / Returns the module id
131
- inline Int_t GetModuleID () const { return fModuleID ; }
132
-
133
- // / Returns the module x-coordinate origin
134
- inline Double_t GetModuleOriginX () const { return fModuleOrigin .X (); }
135
-
136
- // / Returns the module y-coordinate origin
137
- inline Double_t GetModuleOriginY () const { return fModuleOrigin .Y (); }
138
-
139
- // / Returns the module x-coordinate origin
140
- inline Double_t GetOriginX () const { return fModuleOrigin .X (); }
141
-
142
- // / Returns the module y-coordinate origin
143
- inline Double_t GetOriginY () const { return fModuleOrigin .Y (); }
128
+ inline Int_t GetModuleID () const { return fId ; }
144
129
145
- // / Returns the module size x-coordinate
146
- inline Double_t GetModuleSizeX () const { return fModuleSize . X () ; }
130
+ // / Returns the module origin position
131
+ inline TVector2 GetOrigin () const { return fOrigin ; }
147
132
148
- // / Returns the module size y-coordinate
149
- inline Double_t GetModuleSizeY () const { return fModuleSize . Y () ; }
133
+ // / Returns the module size (x, y) in mm
134
+ inline TVector2 GetSize () const { return fSize ; }
150
135
151
136
// / Returns the module rotation in degrees
152
- inline Double_t GetModuleRotation () const { return fModuleRotation ; }
137
+ inline Double_t GetRotation () const { return fRotation ; }
153
138
154
139
// / Converts the coordinates given by TVector2 in the readout plane reference
155
140
// / system to the readout module reference system.
@@ -160,7 +145,7 @@ class TRestDetectorReadoutModule {
160
145
TVector2 GetPlaneCoordinates (const TVector2& p) { return TransformToPlaneCoordinates (p.X (), p.Y ()); }
161
146
162
147
// / Returns the module name
163
- inline const char * GetName () const { return fModuleName . Data (); }
148
+ inline const char * GetName () const { return fName . c_str (); }
164
149
165
150
// / Returns a pointer to the readout mapping
166
151
inline TRestDetectorReadoutMapping* GetMapping () { return &fMapping ; }
@@ -169,7 +154,9 @@ class TRestDetectorReadoutModule {
169
154
170
155
// / Returns a pointer to a readout channel by index
171
156
inline TRestDetectorReadoutChannel* GetChannel (size_t n) {
172
- if (n >= GetNumberOfChannels ()) return nullptr ;
157
+ if (n >= GetNumberOfChannels ()) {
158
+ return nullptr ;
159
+ }
173
160
return &fReadoutChannel [n];
174
161
}
175
162
@@ -226,6 +213,6 @@ class TRestDetectorReadoutModule {
226
213
// Destructor
227
214
virtual ~TRestDetectorReadoutModule ();
228
215
229
- ClassDef (TRestDetectorReadoutModule, 2 );
216
+ ClassDef (TRestDetectorReadoutModule, 3 );
230
217
};
231
218
#endif
0 commit comments