]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDltuParam.cxx
Mods
[u/mrichter/AliRoot.git] / TRD / AliTRDltuParam.cxx
CommitLineData
5e86ff99 1#include <stdio.h>
2
3#include "TMath.h"
4
5#include "AliTRDltuParam.h"
6
7// definition of geometry constants
8Float_t AliTRDltuParam::fgZrow[6][5] = {
9 {301, 177, 53, -57, -181},
10 {301, 177, 53, -57, -181},
11 {315, 184, 53, -57, -188},
12 {329, 191, 53, -57, -195},
13 {343, 198, 53, -57, -202},
14 {347, 200, 53, -57, -204}};
15Float_t AliTRDltuParam::fgX[6] =
16 {300.65, 313.25, 325.85, 338.45, 351.05, 363.65};
17Float_t AliTRDltuParam::fgTiltingAngle[6] =
18 {-2., 2., -2., 2., -2., 2.};
19Int_t AliTRDltuParam::fgDyMax = 63;
20Int_t AliTRDltuParam::fgDyMin = -64;
21Float_t AliTRDltuParam::fgBinDy = 140e-6;
22Float_t AliTRDltuParam::fgWidthPad[6] =
23 {0.635, 0.665, 0.695, 0.725, 0.755, 0.785};
24Float_t AliTRDltuParam::fgLengthInnerPadC1[6] =
25 {7.5, 7.5, 8.0, 8.5, 9.0, 9.0};
26Float_t AliTRDltuParam::fgLengthOuterPadC1[6] =
27 {7.5, 7.5, 7.5, 7.5, 7.5, 8.5};
28Float_t AliTRDltuParam::fgLengthInnerPadC0 = 9.0;
29Float_t AliTRDltuParam::fgLengthOuterPadC0 = 8.0;
30Float_t AliTRDltuParam::fgScalePad = 256. * 32.;
918cceaa 31Float_t AliTRDltuParam::fgDriftLength = 3.;
5e86ff99 32
33AliTRDltuParam::AliTRDltuParam() :
34 TObject(),
35 fMagField(0.),
36 fOmegaTau(0.),
37 fPtMin(0.1),
38 fNtimebins(20 << 5),
51380642 39 fScaleQ0(0),
40 fScaleQ1(0),
5e86ff99 41 fPidTracklengthCorr(kFALSE),
42 fTiltCorr(kFALSE)
43{
44
45}
46
47AliTRDltuParam::~AliTRDltuParam()
48{
49
50}
51
52Int_t AliTRDltuParam::GetDyCorrection(Int_t det, Int_t rob, Int_t mcm) const
53{
54 // calculate the correction of the deflection
55 // i.e. Lorentz angle and tilt correction (if active)
56
57 Int_t layer = det % 6;
58
16477104 59 Float_t dyTilt = ( fgDriftLength * TMath::Tan(fgTiltingAngle[layer] * TMath::Pi()/180.) *
5e86ff99 60 GetLocalZ(det, rob, mcm) / fgX[layer] );
61
62 // calculate Lorentz correction
63 Float_t dyCorr = - fOmegaTau * fgDriftLength;
64
65 if(fTiltCorr)
66 dyCorr += dyTilt; // add tilt correction
67
68 return (int) TMath::Nint(dyCorr * fgScalePad / fgWidthPad[layer]);
69}
70
71void AliTRDltuParam::GetDyRange(Int_t det, Int_t rob, Int_t mcm, Int_t ch,
72 Int_t &dyMinInt, Int_t &dyMaxInt) const
73{
74 // calculate the deflection range in which tracklets are accepted
75
76 dyMinInt = fgDyMin;
77 dyMaxInt = fgDyMax;
78
39e4e4cf 79 if (TMath::Abs(fMagField) < 0.1)
5e86ff99 80 return;
81
82 Float_t e = 0.30;
83
84 Float_t maxDeflTemp = GetPerp(det, rob, mcm, ch)/2. * // Sekante/2
85 (e * TMath::Abs(fMagField) / fPtMin); // 1/R
86
87 Float_t maxDeflAngle = 0.;
88
89 if (maxDeflTemp < 1.) {
90 maxDeflAngle = TMath::ASin(maxDeflTemp);
91
92 Float_t dyMin = ( fgDriftLength *
93 tan(GetPhi(det, rob, mcm, ch) - maxDeflAngle) );
94
95 dyMinInt = Int_t(dyMin / fgBinDy);
96 if (dyMinInt < fgDyMin)
97 dyMinInt = fgDyMin;
98
99 Float_t dyMax = ( fgDriftLength *
100 TMath::Tan(GetPhi(det, rob, mcm, ch) + maxDeflAngle) );
101
102 dyMaxInt = Int_t(dyMax / fgBinDy);
103 if (dyMaxInt > fgDyMax)
104 dyMaxInt = fgDyMax;
105 }
106 if ((dyMaxInt - dyMinInt) <= 0) {
107 printf("strange dy range: [%i,%i]\n", dyMinInt, dyMaxInt);
108 }
109}
110
111Float_t AliTRDltuParam::GetElongation(Int_t det, Int_t rob, Int_t mcm, Int_t ch) const
112{
113 Int_t layer = det % 6;
114
115 Float_t elongation = TMath::Abs(GetDist(det, rob, mcm, ch) / fgX[layer]);
116
117 // sanity check
118 if(elongation<0.001) {
119 elongation=1.;
120 }
121 return elongation;
122}
123
124void AliTRDltuParam::GetCorrectionFactors(Int_t det, Int_t rob, Int_t mcm, Int_t ch,
125 UInt_t &cor0, UInt_t &cor1) const
126{
127 if (fPidTracklengthCorr == kTRUE ) {
128 cor0 = Int_t ((1.0*fScaleQ0* (1./GetElongation(det, rob, mcm, ch)) ));
129 cor1 = Int_t ((1.0*fScaleQ1* (1./GetElongation(det, rob, mcm, ch)) ));
130 }
131 else {
132 cor0 = fScaleQ0;
133 cor1 = fScaleQ1;
134 }
135}
136
137Int_t AliTRDltuParam::GetNtimebins() const
138{
139 return fNtimebins;
140}
141
142Float_t AliTRDltuParam::GetX(Int_t det, Int_t /* rob */, Int_t /* mcm */) const
143{
144 Int_t layer = det%6;
145 return fgX[layer];
146}
147
148Float_t AliTRDltuParam::GetLocalY(Int_t det, Int_t rob, Int_t mcm, Int_t ch) const
149{
150 Int_t layer = det%6;
151 // calculate the pad position as in the TRAP
39e4e4cf 152 Float_t ypos = (-4 + 1 + (rob&0x1) * 4 + (mcm&0x3)) * 18 - ch - 0.5; // y position in bins of pad widths
5e86ff99 153 return ypos*fgWidthPad[layer];
154}
155
156Float_t AliTRDltuParam::GetLocalZ(Int_t det, Int_t rob, Int_t mcm) const
157{
158 Int_t stack = (det%30) / 6;
159 Int_t layer = det % 6;
160 Int_t row = (rob/2) * 4 + mcm/4;
161
162 if (stack == 2) {
163 if (row == 0)
164 return (fgZrow[layer][stack] - 0.5 * fgLengthOuterPadC0);
165 else if (row == 11)
166 return (fgZrow[layer][stack] - 1.5 * fgLengthOuterPadC0 - (row - 1) * fgLengthInnerPadC0);
167 else
168 return (fgZrow[layer][stack] - fgLengthOuterPadC0 - (row - 0.5) * fgLengthInnerPadC0);
169 }
170 else {
171 if (row == 0)
172 return (fgZrow[layer][stack] - 0.5 * fgLengthOuterPadC1[layer]);
173 else if (row == 15)
174 return (fgZrow[layer][stack] - 1.5 * fgLengthOuterPadC1[layer] - (row - 1) * fgLengthInnerPadC1[layer]);
175 else
176 return (fgZrow[layer][stack] - fgLengthOuterPadC1[layer] - (row - 0.5) * fgLengthInnerPadC1[layer]);
177 }
178}
179
180Float_t AliTRDltuParam::GetPerp(Int_t det, Int_t rob, Int_t mcm, Int_t ch) const
181{
182 return TMath::Sqrt(GetLocalY(det, rob, mcm, ch)*GetLocalY(det, rob, mcm, ch) +
183 GetX(det, rob, mcm)*GetX(det, rob, mcm) );
184}
185
186Float_t AliTRDltuParam::GetPhi(Int_t det, Int_t rob, Int_t mcm, Int_t ch) const
187{
188 return TMath::ATan2(GetLocalY(det, rob, mcm, ch), GetX(det, rob, mcm));
189}
190
191Float_t AliTRDltuParam::GetDist(Int_t det, Int_t rob, Int_t mcm, Int_t ch) const
192{
193 return TMath::Sqrt(GetLocalY(det, rob, mcm, ch)*GetLocalY(det, rob, mcm, ch) +
194 GetX(det, rob, mcm)*GetX(det, rob, mcm) +
195 GetLocalZ(det, rob, mcm)*GetLocalZ(det, rob, mcm) );
196}