Project
Loading...
Searching...
No Matches
CoordinateTransformer.cxx
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
13#include <TMath.h>
15#include "TRDBase/Geometry.h"
16
17using namespace o2::trd;
18
19float ChamberSpacePoint::getMCMChannel(int mcmcol) const
20{
21 float c = float(mcmcol * o2::trd::constants::NCOLMCM + o2::trd::constants::NADCMCM) - getPadCol();
22 if (c < 0.0 || c > o2::trd::constants::NADCMCM) {
23 return -1;
24 } else {
25 return c;
26 }
27}
28
29bool ChamberSpacePoint::isInMCM(int detector, int padrow, int mcmcol) const
30{
31 if (detector != mDetector || padrow != mPadrow) {
32 return false;
33 } else {
34 // calculate the channel number in the MCM for the
35 float c = getMCMChannel(mcmcol);
36 if (c < 0.0 || c > o2::trd::constants::NADCMCM) {
37 return false;
38 } else {
39 return true;
40 }
41 }
42}
43
44CoordinateTransformer::CoordinateTransformer()
45 : mGeo(o2::trd::Geometry::instance())
46{
47 mGeo->createPadPlaneArray();
48}
49
50std::array<float, 3> CoordinateTransformer::Local2RCT(int det, float x, float y, float z)
51{
52 std::array<float, 3> rct;
53
54 auto padPlane = mGeo->getPadPlane((det) % 6, (det / 6) % 5);
55
56 // for the z-coordinate, we combine the row number and offset from the padPlane into a single float
57 int row = padPlane->getPadRow(z);
58 if (row == 0 || row == padPlane->getNrows() - 1) {
59 rct[0] = float(row) + padPlane->getPadRowOffsetROC(row, z) / padPlane->getLengthOPad();
60 } else {
61 rct[0] = float(row) + padPlane->getPadRowOffsetROC(row, z) / padPlane->getLengthIPad();
62 }
63
64 // the y-coordinate is calculated directly by the padPlane object
65 rct[1] = padPlane->getPad(y, z);
66
67 // we calculate the time coordinate by hand
68 if (x < -0.35) {
69 // in drift region:
70 // account for offset between anode and cathode wires: add 0.35
71 // convert drift velocity to from cm/us to cm/timebin
72 rct[2] = mT0 - (x + 0.35) / (mVdrift / 10.0);
73 } else {
74 // anode region: very rough guess
75 rct[2] = mT0 - 1.0 + fabs(x);
76 }
77
78 // Correct for Lorentz angle, but only in the drift region. ExB in the anode region causes a small offset (ca. 0.1
79 // pads) that is constant for all clusters in the drift region.
80 rct[1] += (x + 0.35) * mExB;
81 return rct;
82}
83
84std::array<float, 3> CoordinateTransformer::OrigLocal2RCT(int det, float x, float y, float z)
85{
86 std::array<float, 3> rct;
87
88 auto padPlane = mGeo->getPadPlane((det) % 6, (det / 6) % 5);
89
90 // array<double,3> rct;
91
92 double iPadLen = padPlane->getLengthIPad();
93 double oPadLen = padPlane->getLengthOPad();
94 int nRows = padPlane->getNrows();
95
96 double lengthCorr = padPlane->getLengthOPad() / padPlane->getLengthIPad();
97
98 // calculate position based on inner pad length
99 rct[0] = -z / padPlane->getLengthIPad() + padPlane->getNrows() / 2;
100
101 // correct row for outer pad rows
102 if (rct[0] <= 1.0) {
103 rct[0] = 1.0 - (1.0 - rct[0]) * lengthCorr;
104 }
105
106 if (rct[0] >= double(nRows - 1)) {
107 rct[0] = double(nRows - 1) + (rct[0] - double(nRows - 1)) * lengthCorr;
108 }
109
110 // sanity check: is the padrow coordinate reasonable?
111 if (rct[0] < 0.0 || rct[0] > double(nRows)) {
112 std::cout << "ERROR: hit with z=" << z << ", padrow " << rct[0]
113 << " outside of chamber" << std::endl;
114 }
115
116 // simple conversion of pad / local y coordinate
117 // ignore different width of outer pad
118 rct[1] = y / padPlane->getWidthIPad() + 144. / 2.;
119
120 // time coordinate
121 if (x < -0.35) {
122 // drift region
123 rct[2] = mT0 - (x + 0.35) / (mVdrift / 10.0);
124 } else {
125 // anode region: very rough guess
126 rct[2] = mT0 - 1.0 + fabs(x);
127 }
128
129 return rct;
130}
131
133{
134 float x = hit.getLocalT();
135 float y = hit.getLocalC();
136 float z = hit.getLocalR();
137 auto rct = Local2RCT(hit.GetDetectorID(), x, y, z);
138 return o2::trd::ChamberSpacePoint(hit.GetTrackID(), hit.GetDetectorID(), x, y, y, rct, hit.isFromDriftRegion());
139}
140
141namespace o2::trd
142{
143std::ostream& operator<<(std::ostream& os, const ChamberSpacePoint& p)
144{
145 int sector = p.getDetector() / 30;
146 int stack = (p.getDetector() % 30) / 6;
147 int layer = p.getDetector() % 6;
148
149 os << "( " << std::setprecision(5) << p.getX()
150 << " / " << std::setprecision(5) << p.getY()
151 << " / " << std::setprecision(6) << p.getZ() << ") <-> ["
152 << sector << "_" << stack << "_" << layer << " (" << p.getDetector() << ")"
153 << " row " << p.getPadRow()
154 << " pad " << std::setprecision(5) << p.getPadCol() << "]";
155 return os;
156}
157}; // namespace o2::trd
Global TRD definitions and constants.
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual sector
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h trd
configStandalone Reconstruction rec_tpc float
uint32_t c
Definition RawData.h:2
uint32_t stack
Definition RawData.h:1
uint32_t padrow
Definition RawData.h:5
int GetTrackID() const
Definition BaseHits.h:30
unsigned short GetDetectorID() const
Definition BaseHits.h:73
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
float getPadCol() const
pad position (a.k.a. column) within pad row
o2::trd::ChamberSpacePoint MakeSpacePoint(o2::trd::Hit &hit)
std::array< float, 3 > Local2RCT(int det, float x, float y, float z)
float mExB
tan(Lorentz angle): tan(8 deg) ~ 0.140
std::array< float, 3 > OrigLocal2RCT(int det, float x, float y, float z)
float mT0
time offset of start of drift region
float mVdrift
drift velocity in cm/us
float getLocalT() const
Definition Hit.h:34
float getLocalR() const
Definition Hit.h:33
bool isFromDriftRegion() const
Definition Hit.h:28
float getLocalC() const
Definition Hit.h:32
GLint GLenum GLint x
Definition glcorearb.h:403
GLint y
Definition glcorearb.h:270
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
std::ostream & operator<<(std::ostream &stream, const Digit &d)
Definition Digit.cxx:85
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::vector< int > row