Qmax for merged clusters fixed
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCTransform.h
CommitLineData
a6c02c85 1// @(#) $Id$
4aa41877 2// Original: AliHLTTransform.h,v 1.37 2005/06/14 10:55:21 cvetan
a6c02c85 3
297174de 4//* This file is property of and copyright by the ALICE HLT Project *
5//* ALICE Experiment at CERN, All rights reserved. *
6//* See cxx source for full Copyright notice *
7
a6c02c85 8#ifndef ALIHLTTPCTRANSFORM_H
9#define ALIHLTTPCTRANSFORM_H
10
11#ifdef use_aliroot
12 class AliRunLoader;
13#endif
14
15#include "AliHLTTPCRootTypes.h"
16
17class AliHLTTPCTransform {
18
19 public:
600e6a1b 20 AliHLTTPCTransform();
a6c02c85 21 enum VersionType { kVdefault=0, kVdeprecated=1, kValiroot=10, kVcosmics=100};
22
23 private:
24 static const Double_t fgkBFACT; //bfield
25 static const Double_t fgkPi; //pi
26 static const Double_t fgkPi2; //2pi
27 static const Double_t fgk2Pi; //pi/2
28 static const Double_t fgkAnodeWireSpacing; //anode wire spacing
29 static const Double_t fgkToDeg; //rad to deg
30
31 static Int_t fgNPatches; //6 (dont change this)
32 static Int_t fgRows[6][2]; //rows per patch
33 static Int_t fgNRows[6]; //rows per patch
34
35 static Double_t fgBField; //field
36 static Double_t fgBFieldFactor; //field
37 static Double_t fgSolenoidBField; //field
38 static Int_t fgNTimeBins; //ntimebins
39 static Int_t fgNRowLow; //nrows
40 static Int_t fgNRowUp; //nrows
41 static Int_t fgNRowUp1; //nrows
42 static Int_t fgNRowUp2; //nrows
43 static Int_t fgNSectorLow; //nsector
44 static Int_t fgNSectorUp; //nsector
45 static Int_t fgSlice2Sector[36][2]; //nslice
46 static Int_t fgSector2Slice[72]; //nslice
47 static Int_t fgSectorLow[72]; //nsector
48 static Double_t fgPadPitchWidthLow; //pad pitch
49 static Double_t fgPadPitchWidthUp; //pad pitch
50 static Double_t fgZWidth; //width
51 static Double_t fgZSigma; //sigma
52 static Double_t fgZLength; //length
53 static Double_t fgZOffset; //offset
54 static Int_t fgNSector; //72 (dont change this)
55 static Int_t fgNSlice; //36 (dont change this)
56 static Int_t fgNRow; //159 (dont change this)
57 static Double_t fgNRotShift; //Rotation shift (eg. 0.5 for 10 degrees)
58 static Int_t fgNPads[159]; //fill this following Init and fVersion
59 static Double_t fgX[159]; //X position in local coordinates
60 static Int_t fgVersion; //flags the version
61 static Double_t fgDiffT; //Transversal diffusion constant
62 static Double_t fgDiffL; //Longitudinal diffusion constant
63 static Double_t fgOmegaTau; //ExB effects
64 static Double_t fgInnerPadLength; //innner pad length
65 static Double_t fgOuter1PadLength; //outer pad length
66 static Double_t fgOuter2PadLength; //outer pad length
67 static Double_t fgInnerPRFSigma; //inner pad response function
68 static Double_t fgOuter1PRFSigma; //outer pad response function
69 static Double_t fgOuter2PRFSigma; //outer pad response function
70 static Double_t fgTimeSigma; //Minimal longitudinal width
71 static Int_t fgADCSat; //ADC Saturation (1024 = 10 bit)
72 static Int_t fgZeroSup; //Zero suppression threshold
73 static Double_t fgCos[36]; //stores the cos value for local to global rotations
74 static Double_t fgSin[36]; //stores the sin value for local to global rotations
75
76 public:
77 virtual ~AliHLTTPCTransform() {}
a6c02c85 78
79 //setters
80 static void SetNPatches(Int_t i){fgNPatches = i;}
81 static void SetNRows(Int_t s[6]){for(Int_t i=0;i<fgNPatches;i++) fgNRows[i] = s[i];}
82 static void SetRows(Int_t s[6][2]){
83 for(Int_t i=0;i<fgNPatches;i++){
84 fgRows[i][0] = s[i][0];
85 fgRows[i][1] = s[i][1];
86 }
87 }
88 static void SetBField(Double_t f) {fgBField = f;} //careful, these 3 are not independent!
89 static void SetBFieldFactor(Double_t f) {
90 fgBFieldFactor = f;
91 fgBField=fgBFieldFactor*fgSolenoidBField*0.1;
92 }
93 static void SetSolenoidBField(Double_t f){
94 fgSolenoidBField = f;
95 fgBField=fgBFieldFactor*fgSolenoidBField*0.1;
96 }
42a3bb88 97 static void SetNTimeBins(Int_t i){fgNTimeBins = i; if (fgNTimeBins>0) {fgZWidth = fgZLength / (Double_t)fgNTimeBins;}}
a6c02c85 98 static void SetNRowLow(Int_t i){fgNRowLow = i;}
99 static void SetNRowUp(Int_t i){fgNRowUp = i;}
100 static void SetNRowUp1(Int_t i){fgNRowUp1 = i;}
101 static void SetNRowUp2(Int_t i){fgNRowUp2 = i;}
102 static void SetSlice2Sector(Int_t s[36][2]){
103 for(Int_t i=0;i<fgNSlice;i++){
104 fgSlice2Sector[i][0] = s[i][0];
105 fgSlice2Sector[i][1] = s[i][1];
106 }
107 }
108 static void SetSector2Slice(Int_t s[72]){
109 for(Int_t i=0;i<fgNSector;i++) fgSector2Slice[i] = s[i];}
110 static void SetSectorLow(Int_t s[72]){
111 for(Int_t i=0;i<fgNSector;i++) fgSectorLow[i] = s[i];}
112 static void SetNSectorLow(Int_t i){fgNSectorLow = i;}
113 static void SetNSectorUp(Int_t i){fgNSectorUp = i;}
114 static void SetPadPitchWidthLow(Double_t f){fgPadPitchWidthLow = f;}
115 static void SetPadPitchWidthUp(Double_t f){fgPadPitchWidthUp = f;}
42a3bb88 116 // Matthias 21.09.2007
117 // zwidth is given by zlength and no of timebins and should not be set
118 // otherwise. Was never used
119 //static void SetZWidth(Double_t f){fgZWidth = f;}
a6c02c85 120 static void SetZSigma(Double_t f){fgZSigma = f;}
121 static void SetZLength(Double_t f){fgZLength = f;}
122 static void SetZOffset(Double_t f){fgZOffset = f;}
123 static void SetNSector(Int_t i){fgNSector = i;}
124 static void SetNSlice(Int_t i){fgNSlice = i;}
125 static void SetNRow(Int_t i){fgNRow = i;}
126 static void SetNRotShift(Double_t f){fgNRotShift = f;}
127 static void SetNPads(Int_t pads[159]){
128 for(Int_t i=0;i<fgNRow;i++) fgNPads[i] = pads[i];}
129 static void SetX(Double_t xs[159]){
130 for(Int_t i=0;i<fgNRow;i++) fgX[i] = xs[i];}
131 static void SetVersion(Int_t i){fgVersion = i;}
132 static void SetDiffT(Double_t f){fgDiffT = f;}
133 static void SetDiffL(Double_t f){fgDiffL = f;}
134 static void SetOmegaTau(Double_t f){fgOmegaTau = f;}
135 static void SetInnerPadLength(Double_t f){fgInnerPadLength = f;}
136 static void SetOuter1PadLength(Double_t f){fgOuter1PadLength = f;}
137 static void SetOuter2PadLength(Double_t f){fgOuter2PadLength = f;}
138 static void SetInnerPRFSigma(Double_t f){fgInnerPRFSigma = f;}
139 static void SetOuter1PRFSigma(Double_t f){fgOuter1PRFSigma = f;}
140 static void SetOuter2PRFSigma(Double_t f){fgOuter2PRFSigma = f;}
141 static void SetTimeSigma(Double_t f){fgTimeSigma = f;}
142 static void SetADCSat(Int_t i) {fgADCSat = i;}
143 static void SetZeroSup(Int_t i) {fgZeroSup = i;}
144
145 //getters
146 static const Char_t* GetParamName() {return "75x40_100x60_150x60";}
147 static Double_t Pi() {return fgkPi;}
148 static Double_t PiHalf() {return fgkPi2;}
149 static Double_t TwoPi() {return fgk2Pi;}
150 static Double_t GetAnodeWireSpacing() {return fgkAnodeWireSpacing;}
151 static Double_t GetBFact() {return fgkBFACT;}
152 static Double_t ToRad() {return 1./fgkToDeg;}
153 static Double_t ToDeg() {return fgkToDeg;}
154
84645eb0 155 static Int_t GetNumberOfPatches();
a6c02c85 156 static Int_t GetFirstRow(Int_t patch);
157 static Int_t GetLastRow(Int_t patch);
158 static Int_t GetFirstRowOnDDL(Int_t patch);
159 static Int_t GetLastRowOnDDL(Int_t patch);
160 static Int_t GetNRows(Int_t patch);
161 static Int_t GetPatch(Int_t padrow);
162 static Int_t GetNRows() {return fgNRow;}
163 static Int_t GetNRowLow() {return fgNRowLow;}
164 static Int_t GetNRowUp1() {return fgNRowUp1;}
165 static Int_t GetNRowUp2() {return fgNRowUp2;}
166 static Int_t GetPadRow(Float_t x);
167 static Int_t GetNPatches() {return fgNPatches;}
168 static Int_t GetNPads(Int_t row);
169 static Int_t GetNTimeBins(){return fgNTimeBins;}
170 static Double_t GetBField() {return fgBField;}
171 static Double_t GetSolenoidField() {return fgSolenoidBField;}
172 static Double_t GetBFactFactor() {return fgBFieldFactor;}
173 static Double_t GetBFieldValue() {return (fgBField*fgkBFACT);}
174 static Float_t Deg2Rad(Float_t angle) {return angle/fgkToDeg;}
175 static Float_t Rad2Deg(Float_t angle) {return angle*fgkToDeg;}
176 static Int_t GetVersion(){return fgVersion;}
177 static Double_t GetPadPitchWidthLow() {return fgPadPitchWidthLow;}
178 static Double_t GetPadPitchWidthUp() {return fgPadPitchWidthUp;}
179 static Double_t GetPadPitchWidth(Int_t patch);
180 static Double_t GetZWidth() {return fgZWidth;}
181 static Double_t GetZLength() {return fgZLength;}
182 static Double_t GetZOffset() {return fgZOffset;}
183 static Double_t GetDiffT() {return fgDiffT;}
184 static Double_t GetDiffL() {return fgDiffL;}
185 static Double_t GetParSigmaY2(Int_t padrow,Float_t z,Float_t angle);
186 static Double_t GetParSigmaZ2(Int_t padrow,Float_t z,Float_t tgl);
187 static Double_t GetOmegaTau() {return fgOmegaTau;}
188 static Double_t GetPadLength(Int_t padrow);
189 static Double_t GetPRFSigma(Int_t padrow);
190 static Double_t GetTimeSigma() {return fgTimeSigma;}
191 static Double_t GetZSigma() {return fgZSigma;}
192 static Int_t GetADCSat() {return fgADCSat;}
193 static Int_t GetZeroSup() {return fgZeroSup;}
194 static Int_t GetNSlice() {return fgNSlice;}
195 static Int_t GetNSector() {return fgNSector;}
196 static Int_t GetNSectorLow() {return fgNSectorLow;}
197 static Int_t GetNSectorUp() {return fgNSectorUp;}
198
199 static Bool_t Slice2Sector(Int_t slice, Int_t slicerow, Int_t &sector, Int_t &row);
200 static Bool_t Sector2Slice(Int_t &slice, Int_t sector);
201 static Bool_t Sector2Slice(Int_t &slice, Int_t &slicerow, Int_t sector, Int_t row);
202
203 static Double_t Row2X(Int_t slicerow);
204 static Double_t GetMaxY(Int_t slicerow);
205 static Double_t GetEta(Float_t *xyz);
206 static Double_t GetEta(Int_t slice,Int_t padrow, Int_t pad, Int_t time);
207 static Double_t GetPhi(Float_t *xyz);
208 static Double_t GetZFast(Int_t slice, Int_t time, Float_t vertex=0.);
209
210 static void XYZtoRPhiEta(Float_t *rpe, Float_t *xyz);
211 static void Local2Global(Float_t *xyz, Int_t slice);
212 static void Local2GlobalAngle(Float_t *angle, Int_t slice);
213 static void Global2LocalAngle(Float_t *angle, Int_t slice);
214
215 //we have 3 different system: Raw : row, pad, time
216 // Local : x,y and global z
217 // Global: global x,y and global z
218 //the methods with HLT in the name differ from the other
219 //as you specify slice and slicerow, instead of sector
220 //and sector row. In that way we safe "a few ifs"
221 static void Raw2Local(Float_t *xyz, Int_t sector, Int_t row, Float_t pad, Float_t time);
222 static void RawHLT2Local(Float_t *xyz,Int_t slice,Int_t slicerow,Float_t pad,Float_t time);
223 static void Raw2Local(Float_t *xyz, Int_t sector, Int_t row, Int_t pad, Int_t time);
224 static void RawHLT2Local(Float_t *xyz,Int_t slice,Int_t slicerow,Int_t pad,Int_t time);
225 static void Local2Global(Float_t *xyz, Int_t sector, Int_t row);
226 static void LocHLT2Global(Float_t *xyz, Int_t slice, Int_t slicerow);
227 static void Global2Local(Float_t *xyz, Int_t sector);
228 static void Global2LocHLT(Float_t *xyz, Int_t slice);
229 static void Raw2Global(Float_t *xyz, Int_t sector, Int_t row, Float_t pad, Float_t time);
738c049f 230 static void RawHLT2Global(Float_t *xyz, Int_t slice, Int_t slicerow, Float_t pad, Float_t time);
a6c02c85 231 static void Raw2Global(Float_t *xyz, Int_t sector, Int_t row, Int_t pad, Int_t time);
232 static void RawHLT2Global(Float_t *xyz, Int_t slice,
233 Int_t slicerow, Int_t pad, Int_t time);
234 static void Local2Raw(Float_t *xyz, Int_t sector, Int_t row);
235 static void LocHLT2Raw(Float_t *xyz, Int_t slice, Int_t slicerow);
236 static void Global2Raw(Float_t *xyz, Int_t sector, Int_t row);
237 static void Global2HLT(Float_t *xyz, Int_t slice, Int_t slicerow);
238
239 static void PrintCompileOptions();
240
22240104 241 ClassDef(AliHLTTPCTransform,0)
a6c02c85 242};
243#endif