Project
Loading...
Searching...
No Matches
CoordinateTransformer.h
Go to the documentation of this file.
1// Copyright 2019-2023 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#ifndef ALICEO2_TRD_COORDINATE_TRANSFORMER_H_
13#define ALICEO2_TRD_COORDINATE_TRANSFORMER_H_
14
19
20#include "DataFormatsTRD/Hit.h"
21
22#include <array>
23
24namespace o2::trd
25{
26
27class Geometry;
28class CoordinateTransformer;
29
34{
35 public:
36 ChamberSpacePoint(int det = -999) : mDetector(det){};
37 ChamberSpacePoint(int id, int detector, float x, float y, float z, std::array<float, 3> rct, bool inDrift)
38 : mID(id), mDetector(detector), mX(x), mY(y), mZ(z), mPadrow(rct[0]), mPadcol(rct[1]), mTimebin(rct[2]), mInDrift(inDrift){};
39
41 bool isValid() const { return mDetector >= 0; }
42
44 bool isFromDriftRegion() const { return mInDrift; }
45
47 int getID() const { return mID; }
48
50 float getX() const { return mX; }
51
53 float getY() const { return mY; }
54
56 float getZ() const { return mZ; }
57
59 int getDetector() const { return mDetector; }
60
62 int getPadRow() const { return int(floor(mPadrow)); }
63 float getPadRowF() const { return mPadrow; }
64
66 float getPadCol() const { return mPadcol; }
67
69 float getTimeBin() const { return mTimebin; }
70
72 float getMCMChannel(int mcmcol) const;
73
74 bool isInMCM(int detector, int padrow, int mcmcol) const;
75
77 // int getMCM() const { return o2::trd::HelperMethods::getMCMfromPad(mPadrow, mPadcol); }
78
80 // int getROB() const { return o2::trd::HelperMethods::getROBfromPad(mPadrow, mPadcol); }
81
82 protected:
83 float mX, mY, mZ;
85 int mID;
88
89 // static constexpr float xscale = 1.0 / (o2::trd::Geometry::cheight() + o2::trd::Geometry::cspace());
90 // static constexpr float xoffset = o2::trd::Geometry::getTime0(0);
91 // static constexpr float alphascale = 1.0 / o2::trd::Geometry::getAlpha();
92};
93
94std::ostream& operator<<(std::ostream& os, const ChamberSpacePoint& p);
95
99{
100 public:
102 : ChamberSpacePoint(position), mCharge(charge)
103 {
104 }
105
107
108 float getCharge() { return mCharge; }
109
110 private:
111 float mCharge{0.0};
112};
113
119{
120 public:
121 TrackSegment(){}; // default constructor, will create invalid start and end points
124 {
125 assert(start.getDetector() == end.getDetector());
126 }
127
129 bool isValid() const { return mStartPoint.isValid(); }
130
132 float getPadColAtTimeBin(float timebin = 0) const
133 {
134 return mStartPoint.getPadCol() - getSlope() * (mStartPoint.getTimeBin() - timebin);
135 }
136
137 float getSlope() const
138 {
140 }
141
143 int getDetector() const { return mStartPoint.getDetector(); }
144
147
148 protected:
151
152 // int mDetector;
153};
154
155// std::ostream& operator<<(std::ostream& os, const ChamberSpacePoint& p);
156
164{
165 public:
167 {
168 static CoordinateTransformer mCTrans;
169 return &mCTrans;
170 }
171
180 std::array<float, 3> Local2RCT(int det, float x, float y, float z);
181
183 std::array<float, 3> Local2RCT(o2::trd::Hit& hit)
184 {
185 return Local2RCT(hit.GetDetectorID(), hit.getLocalT(), hit.getLocalC(), hit.getLocalR());
186 }
187
189
192 std::array<float, 3> OrigLocal2RCT(int det, float x, float y, float z);
193
196 std::array<float, 3> OrigLocal2RCT(o2::trd::Hit& hit)
197 {
198 return OrigLocal2RCT(hit.GetDetectorID(), hit.getLocalT(), hit.getLocalC(), hit.getLocalR());
199 }
200
201 float GetVdrift() { return mVdrift; }
202 void SetVdrift(float x) { mVdrift = x; }
203
204 float GetT0() { return mT0; }
205 void SetT0(float x) { mT0 = x; }
206
207 float GetExB() { return mExB; }
208 void SetExB(float x) { mExB = x; }
209
210 protected:
212 float mVdrift{1.5625};
213 float mT0{4.0};
214 float mExB{0.140};
215
216 private:
218};
219
220} // namespace o2::trd
221
222#endif // ALICEO2_TRD_RAWDISPLAY_H_
int16_t charge
Definition RawEventData.h:5
uint32_t padrow
Definition RawData.h:5
short GetDetectorID() const
Definition BaseHits.h:73
ChamberSpacePoint(int id, int detector, float x, float y, float z, std::array< float, 3 > rct, bool inDrift)
float getX() const
spatial x coordinate of space point
float getMCMChannel(int mcmcol) const
calculate the channel number within the MCM. 0..21 if valid, -1 if not within this MCM
bool isInMCM(int detector, int padrow, int mcmcol) const
int getPadRow() const
pad row within detector of space point
int getDetector() const
detector number corresponding to space point
float mX
calculate MCM corresponding to pad row/column
bool isValid() const
check if the space point has been initialized
float getZ() const
spatial z coordinate of space point
bool isFromDriftRegion() const
check if the space point is in the drift region
float getY() const
spatial y coordinate of space point
int getID() const
return the ID of the associated track (either MC or reconstructed)
float getTimeBin() const
time coordinate in drift direction
float getPadCol() const
pad position (a.k.a. column) within pad row
std::array< float, 3 > Local2RCT(o2::trd::Hit &hit)
Wrapper to conveniently calculate the row/column/time coordinate of a MC hit.
o2::trd::ChamberSpacePoint MakeSpacePoint(o2::trd::Hit &hit)
std::array< float, 3 > Local2RCT(int det, float x, float y, float z)
static CoordinateTransformer * instance()
float mExB
tan(Lorentz angle): tan(8 deg) ~ 0.140
std::array< float, 3 > OrigLocal2RCT(int det, float x, float y, float z)
std::array< float, 3 > OrigLocal2RCT(o2::trd::Hit &hit)
float mT0
time offset of start of drift region
float mVdrift
drift velocity in cm/us
HitPoint(ChamberSpacePoint position, float charge)
float getLocalT() const
Definition Hit.h:34
float getLocalR() const
Definition Hit.h:33
float getLocalC() const
Definition Hit.h:32
int getDetector() const
detector number
float getPadColAtTimeBin(float timebin=0) const
position of track segment at timebin 0
bool isValid() const
check if the space point has been initialized
TrackSegment(ChamberSpacePoint start, ChamberSpacePoint end, int id)
ChamberSpacePoint & getEndPoint()
ChamberSpacePoint & getStartPoint()
GLint GLenum GLint x
Definition glcorearb.h:403
GLuint GLuint end
Definition glcorearb.h:469
GLuint start
Definition glcorearb.h:469
GLuint id
Definition glcorearb.h:650
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
std::ostream & operator<<(std::ostream &stream, const Digit &d)
Definition Digit.cxx:78