-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support arbitrary readout orientation #85
base: master
Are you sure you want to change the base?
Changes from all commits
31a0838
2ac9a86
541c556
3f7b895
7586389
3a0fbc7
4707aaa
b19a902
3a00904
5ced2bc
b912f4c
29a879b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,27 +77,13 @@ class TRestDetectorReadoutModule : public TObject { | |
/// Converts the coordinates given by TVector2 in the readout plane reference | ||
/// system to the readout module reference system. | ||
inline TVector2 TransformToModuleCoordinates(const TVector2& p) { | ||
return TransformToModuleCoordinates(p.X(), p.Y()); | ||
} | ||
|
||
/// Converts the coordinates (xPhys,yPhys) in the readout plane reference | ||
/// system to the readout module reference system. | ||
inline TVector2 TransformToModuleCoordinates(Double_t xPhys, Double_t yPhys) { | ||
TVector2 coords(xPhys - fModuleOriginX, yPhys - fModuleOriginY); | ||
TVector2 rot = coords.Rotate(-fModuleRotation * TMath::Pi() / 180.); | ||
|
||
return rot; | ||
return p - TVector2(fModuleOriginX, fModuleOriginY); | ||
} | ||
|
||
/// Converts the coordinates (xMod,yMod) in the readout module reference | ||
/// system to the readout plane reference system. | ||
inline TVector2 TransformToPhysicalCoordinates(Double_t xMod, Double_t yMod) { | ||
TVector2 coords(xMod, yMod); | ||
|
||
coords = coords.Rotate(fModuleRotation * TMath::Pi() / 180.); | ||
coords = coords + TVector2(fModuleOriginX, fModuleOriginY); | ||
|
||
return coords; | ||
inline TVector2 TransformToReadoutCoordinates(const TVector2& p) { | ||
return p + TVector2(fModuleOriginX, fModuleOriginY); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rotation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be |
||
} | ||
|
||
protected: | ||
|
@@ -181,9 +167,7 @@ class TRestDetectorReadoutModule : public TObject { | |
|
||
/// Converts the coordinates given by TVector2 in the readout module reference | ||
/// system to the readout plane reference system. | ||
TVector2 GetPhysicalCoordinates(const TVector2& p) { | ||
return TransformToPhysicalCoordinates(p.X(), p.Y()); | ||
} | ||
TVector2 GetPhysicalCoordinates(const TVector2& p) { return TransformToReadoutCoordinates(p); } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be |
||
|
||
/// Returns the module name | ||
inline const char* GetName() const override { return fModuleName.Data(); } | ||
|
@@ -217,6 +201,7 @@ class TRestDetectorReadoutModule : public TObject { | |
/// plane are inside this readout module. | ||
/// | ||
inline Bool_t isInside(Double_t x, Double_t y) { return isInside({x, y}); } | ||
inline Bool_t isInside(const TVector3& position) const; | ||
|
||
Bool_t isInsideChannel(Int_t channel, Double_t x, Double_t y); | ||
Bool_t isInsideChannel(Int_t channel, const TVector2& position); | ||
|
@@ -225,7 +210,7 @@ class TRestDetectorReadoutModule : public TObject { | |
Bool_t isInsidePixel(Int_t channel, Int_t pixel, const TVector2& position); | ||
|
||
Bool_t isDaqIDInside(Int_t daqID); | ||
Int_t FindChannel(Double_t x, Double_t y); | ||
Int_t FindChannel(const TVector2& position); | ||
TVector2 GetDistanceToModule(const TVector2& position); | ||
|
||
TVector2 GetPixelOrigin(Int_t channel, Int_t pixel); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,13 +40,21 @@ class TRestDetectorReadoutPlane : public TObject { | |
Int_t fPlaneID; ///< The readout plane id. The id number is imposed by the | ||
///< order of creation. Being the first id=0. | ||
|
||
TVector3 fPosition; ///< The position of the readout plane. The relative position | ||
///< of the modules will be shifted by this value. | ||
TVector3 fPlaneVector; ///< The plane std::vector definning the plane orientation | ||
///< and the side of the active volume. | ||
TVector3 fCathodePosition; ///< The cathode position which delimites the active | ||
TVector3 fPosition; ///< The position of the readout plane. The relative position | ||
///< of the modules will be shifted by this value. | ||
TVector3 fPlaneVector; ///< The plane std::vector defining the plane orientation | ||
///< and the side of the active volume. | ||
TVector3 fPlaneAxisX; ///< The first coordinate vector of the plane in absolute coordinates. | ||
/// < This vector is contained in the plane and corresponds to the first local | ||
/// coordinate (1,0) | ||
TVector3 fPlaneAxisY; ///< The first coordinate vector of the plane in absolute coordinates. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no need for Also we said to rename them to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the Y vector is the second coordinate vector in the plane, it's true that it is redundant as it can be obtained via the cross product (but it's different from the normal). |
||
/// < This vector is contained in the plane and corresponds to the second local | ||
/// coordinate (0,1) | ||
Double_t fPlaneRotationAngle; ///< The angle of rotation of the plane around the planeVector | ||
///< axis. This rotates the planeAxisX and planeAxisY vectors. (degrees) | ||
TVector3 fCathodePosition; ///< The cathode position which delimits the active | ||
///< volume together with the readout plane. | ||
Double_t fChargeCollection; ///< A parameter between 0 and 1 definning how | ||
Double_t fChargeCollection; ///< A parameter between 0 and 1 defining how | ||
///< much charge should be collected from a | ||
///< charge hit. It might be used to distribute | ||
///< the charge between different readout planes. | ||
|
@@ -68,15 +76,17 @@ class TRestDetectorReadoutPlane : public TObject { | |
void SetID(int id) { fPlaneID = id; } | ||
|
||
/// Sets the readout plane position | ||
void SetPosition(TVector3 pos) { fPosition = pos; } | ||
void SetPosition(const TVector3& pos) { fPosition = pos; } | ||
|
||
/// Sets the cathode plane position. By default is parallel to the readout | ||
/// plane. | ||
void SetCathodePosition(TVector3 pos) { fCathodePosition = pos; } | ||
void SetCathodePosition(const TVector3& pos) { fCathodePosition = pos; } | ||
|
||
/// Sets the orientation of the readout plane, and defines the side of the | ||
/// active volume. | ||
void SetPlaneVector(TVector3 vect) { fPlaneVector = vect.Unit(); } | ||
/// Sets the orientation of the readout plane, and defines the side of the active volume. | ||
void SetPlaneVector(const TVector3& v); | ||
|
||
/// Sets the orientation of the readout plane, and defines the side of the active volume. | ||
void SetPlaneRotation(Double_t rotationAngle); | ||
|
||
/// Sets the value for the charge collection. | ||
void SetChargeCollection(Double_t charge) { fChargeCollection = charge; } | ||
|
@@ -97,6 +107,9 @@ class TRestDetectorReadoutPlane : public TObject { | |
/// Returns a TVector3 with a std::vector normal to the readout plane | ||
inline TVector3 GetPlaneVector() const { return fPlaneVector; } | ||
|
||
/// Returns the plane rotation angle in degrees | ||
inline Double_t GetPlaneRotationAngle() const { return fPlaneRotationAngle; } | ||
|
||
/// Returns the charge collection ratio at this readout plane | ||
inline Double_t GetChargeCollection() const { return fChargeCollection; } | ||
|
||
|
@@ -105,18 +118,20 @@ class TRestDetectorReadoutPlane : public TObject { | |
|
||
/// Returns the perpendicular distance to the readout plane from a given | ||
/// position *pos*. | ||
Double_t GetDistanceTo(TVector3 pos); | ||
Double_t GetDistanceTo(const TVector3& pos); | ||
|
||
/// Returns the perpendicular distance to the readout plane from a given | ||
/// position *x*, *y*, *z*. | ||
Double_t GetDistanceTo(Double_t x, Double_t y, Double_t z); | ||
|
||
/// Returns a TVector2 oriented as the shortest distance of a given position | ||
/// *pos* on the plane to a specific module with id *mod* | ||
TVector2 GetDistanceToModule(Int_t mod, TVector2 pos) { | ||
TVector2 GetDistanceToModule(Int_t mod, const TVector2& pos) { | ||
return GetModuleByID(mod)->GetDistanceToModule(pos); | ||
} | ||
|
||
TVector2 GetPositionInReadoutPlane(const TVector3& position) const; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Must be renamed to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I see now it is not the position, but the projection. So the method could be named |
||
|
||
TRestDetectorReadoutModule& operator[](int mod) { return fReadoutModules[mod]; } | ||
|
||
/// Returns a pointer to a readout module using its std::vector index | ||
|
@@ -143,13 +158,11 @@ class TRestDetectorReadoutPlane : public TObject { | |
|
||
Int_t isZInsideDriftVolume(Double_t z); | ||
|
||
Int_t isZInsideDriftVolume(TVector3 pos); | ||
Int_t isZInsideDriftVolume(const TVector3& pos); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method must be updated, perhaps now the method should be named |
||
|
||
Bool_t isDaqIDInside(Int_t daqId); | ||
|
||
Int_t GetModuleIDFromPosition(TVector3 pos); | ||
|
||
Int_t GetModuleIDFromPosition(Double_t x, Double_t y, Double_t z); | ||
Int_t GetModuleIDFromPosition(const TVector3& position); | ||
|
||
void SetDriftDistance(); | ||
|
||
|
@@ -170,6 +183,6 @@ class TRestDetectorReadoutPlane : public TObject { | |
// Destructor | ||
virtual ~TRestDetectorReadoutPlane(); | ||
|
||
ClassDef(TRestDetectorReadoutPlane, 1); | ||
ClassDef(TRestDetectorReadoutPlane, 2); | ||
}; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why rotation has disappeared?