5 #include "AliTRDltuParam.h"
7 // definition of geometry constants
8 Float_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}};
15 Float_t AliTRDltuParam::fgX[6] =
16 {300.65, 313.25, 325.85, 338.45, 351.05, 363.65};
17 Float_t AliTRDltuParam::fgTiltingAngle[6] =
18 {-2., 2., -2., 2., -2., 2.};
19 Int_t AliTRDltuParam::fgDyMax = 63;
20 Int_t AliTRDltuParam::fgDyMin = -64;
21 Float_t AliTRDltuParam::fgBinDy = 140e-6;
22 Float_t AliTRDltuParam::fgWidthPad[6] =
23 {0.635, 0.665, 0.695, 0.725, 0.755, 0.785};
24 Float_t AliTRDltuParam::fgLengthInnerPadC1[6] =
25 {7.5, 7.5, 8.0, 8.5, 9.0, 9.0};
26 Float_t AliTRDltuParam::fgLengthOuterPadC1[6] =
27 {7.5, 7.5, 7.5, 7.5, 7.5, 8.5};
28 Float_t AliTRDltuParam::fgLengthInnerPadC0 = 9.0;
29 Float_t AliTRDltuParam::fgLengthOuterPadC0 = 8.0;
30 Float_t AliTRDltuParam::fgScalePad = 256. * 32.;
31 Float_t AliTRDltuParam::fgDriftLength = 3.;
33 AliTRDltuParam::AliTRDltuParam() :
41 fPidTracklengthCorr(kFALSE),
45 // default constructor
48 AliTRDltuParam::~AliTRDltuParam()
53 Int_t AliTRDltuParam::GetDyCorrection(Int_t det, Int_t rob, Int_t mcm) const
55 // calculate the correction of the deflection
56 // i.e. Lorentz angle and tilt correction (if active)
58 Int_t layer = det % 6;
60 Float_t dyTilt = ( fgDriftLength * TMath::Tan(fgTiltingAngle[layer] * TMath::Pi()/180.) *
61 GetLocalZ(det, rob, mcm) / fgX[layer] );
63 // calculate Lorentz correction
64 Float_t dyCorr = - fOmegaTau * fgDriftLength;
67 dyCorr += dyTilt; // add tilt correction
69 return (int) TMath::Nint(dyCorr * fgScalePad / fgWidthPad[layer]);
72 void AliTRDltuParam::GetDyRange(Int_t det, Int_t rob, Int_t mcm, Int_t ch,
73 Int_t &dyMinInt, Int_t &dyMaxInt) const
75 // calculate the deflection range in which tracklets are accepted
80 if (TMath::Abs(fMagField) < 0.1)
85 Float_t maxDeflTemp = GetPerp(det, rob, mcm, ch)/2. * // Sekante/2
86 (e * TMath::Abs(fMagField) / fPtMin); // 1/R
88 Float_t maxDeflAngle = 0.;
90 if (maxDeflTemp < 1.) {
91 maxDeflAngle = TMath::ASin(maxDeflTemp);
93 Float_t dyMin = ( fgDriftLength *
94 tan(GetPhi(det, rob, mcm, ch) - maxDeflAngle) );
96 dyMinInt = Int_t(dyMin / fgBinDy);
97 if (dyMinInt < fgDyMin)
100 Float_t dyMax = ( fgDriftLength *
101 TMath::Tan(GetPhi(det, rob, mcm, ch) + maxDeflAngle) );
103 dyMaxInt = Int_t(dyMax / fgBinDy);
104 if (dyMaxInt > fgDyMax)
107 if ((dyMaxInt - dyMinInt) <= 0) {
108 printf("strange dy range: [%i,%i]\n", dyMinInt, dyMaxInt);
112 Float_t AliTRDltuParam::GetElongation(Int_t det, Int_t rob, Int_t mcm, Int_t ch) const
114 // calculate the ratio of the distance to the primary vertex and the
115 // distance in x-direction for the given ADC channel
117 Int_t layer = det % 6;
119 Float_t elongation = TMath::Abs(GetDist(det, rob, mcm, ch) / fgX[layer]);
122 if(elongation<0.001) {
128 void AliTRDltuParam::GetCorrectionFactors(Int_t det, Int_t rob, Int_t mcm, Int_t ch,
129 UInt_t &cor0, UInt_t &cor1, Float_t gain) const
131 // calculate the gain correction factors for the given ADC channel
133 if (fPidGainCorr==kFALSE)
136 if (fPidTracklengthCorr == kTRUE ) {
137 cor0 = UInt_t ((1.0*fScaleQ0* (1./GetElongation(det, rob, mcm, ch))) / gain );
138 cor1 = UInt_t ((1.0*fScaleQ1* (1./GetElongation(det, rob, mcm, ch))) / gain );
141 cor0 = UInt_t (fScaleQ0 / gain);
142 cor1 = UInt_t ( fScaleQ1 / gain);
146 Int_t AliTRDltuParam::GetNtimebins() const
148 // return the number of timebins used
153 Float_t AliTRDltuParam::GetX(Int_t det, Int_t /* rob */, Int_t /* mcm */) const
155 // return the distance to the beam axis in x-direction
161 Float_t AliTRDltuParam::GetLocalY(Int_t det, Int_t rob, Int_t mcm, Int_t ch) const
163 // get local y-position (r-phi) w.r.t. the chamber centre
166 // calculate the pad position as in the TRAP
167 Float_t ypos = (-4 + 1 + (rob&0x1) * 4 + (mcm&0x3)) * 18 - ch - 0.5; // y position in bins of pad widths
168 return ypos*fgWidthPad[layer];
171 Float_t AliTRDltuParam::GetLocalZ(Int_t det, Int_t rob, Int_t mcm) const
173 // get local z-position w.r.t. to the chamber boundary
175 Int_t stack = (det%30) / 6;
176 Int_t layer = det % 6;
177 Int_t row = (rob/2) * 4 + mcm/4;
181 return (fgZrow[layer][stack] - 0.5 * fgLengthOuterPadC0);
183 return (fgZrow[layer][stack] - 1.5 * fgLengthOuterPadC0 - (row - 1) * fgLengthInnerPadC0);
185 return (fgZrow[layer][stack] - fgLengthOuterPadC0 - (row - 0.5) * fgLengthInnerPadC0);
189 return (fgZrow[layer][stack] - 0.5 * fgLengthOuterPadC1[layer]);
191 return (fgZrow[layer][stack] - 1.5 * fgLengthOuterPadC1[layer] - (row - 1) * fgLengthInnerPadC1[layer]);
193 return (fgZrow[layer][stack] - fgLengthOuterPadC1[layer] - (row - 0.5) * fgLengthInnerPadC1[layer]);
197 Float_t AliTRDltuParam::GetPerp(Int_t det, Int_t rob, Int_t mcm, Int_t ch) const
199 // get transverse distance to the beam axis
201 return TMath::Sqrt(GetLocalY(det, rob, mcm, ch)*GetLocalY(det, rob, mcm, ch) +
202 GetX(det, rob, mcm)*GetX(det, rob, mcm) );
205 Float_t AliTRDltuParam::GetPhi(Int_t det, Int_t rob, Int_t mcm, Int_t ch) const
207 // calculate the azimuthal angle for the given ADC channel
209 return TMath::ATan2(GetLocalY(det, rob, mcm, ch), GetX(det, rob, mcm));
212 Float_t AliTRDltuParam::GetDist(Int_t det, Int_t rob, Int_t mcm, Int_t ch) const
214 // calculate the distance from the origin for the given ADC channel
216 return TMath::Sqrt(GetLocalY(det, rob, mcm, ch)*GetLocalY(det, rob, mcm, ch) +
217 GetX(det, rob, mcm)*GetX(det, rob, mcm) +
218 GetLocalZ(det, rob, mcm)*GetLocalZ(det, rob, mcm) );