1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // Class containing constant common parameters //
22 // Request an instance with AliTRDCommonParam::Instance() //
23 // Then request the needed values //
25 ///////////////////////////////////////////////////////////////////////////////
29 #include "AliTRDCommonParam.h"
30 #include "AliTRDpadPlane.h"
33 ClassImp(AliTRDCommonParam)
35 AliTRDCommonParam* AliTRDCommonParam::fgInstance = 0;
36 Bool_t AliTRDCommonParam::fgTerminated = kFALSE;
38 //_ singleton implementation __________________________________________________
39 AliTRDCommonParam* AliTRDCommonParam::Instance()
42 // Singleton implementation
43 // Returns an instance of this class, it is created if neccessary
46 if (fgTerminated != kFALSE)
50 fgInstance = new AliTRDCommonParam();
55 void AliTRDCommonParam::Terminate()
58 // Singleton implementation
59 // Deletes the instance of this class and sets the terminated flag, instances cannot be requested anymore
60 // This function can be called several times.
72 //_____________________________________________________________________________
73 AliTRDCommonParam::AliTRDCommonParam()
96 //_____________________________________________________________________________
97 void AliTRDCommonParam::Init()
100 // constructor helper
106 // The pad response function
109 // The magnetic field strength in Tesla
110 Double_t x[3] = { 0.0, 0.0, 0.0 };
112 gAlice->Field(x,b); // b[] is in kilo Gauss
113 fField = b[2] * 0.1; // Tesla
115 // Create the sampled PRF
118 // ----------------------------------------------------------------------------
120 // ----------------------------------------------------------------------------
122 fPadPlaneArray = new TObjArray(kNplan * kNcham);
124 for (Int_t iplan = 0; iplan < kNplan; iplan++) {
125 for (Int_t icham = 0; icham < kNcham; icham++) {
126 Int_t ipp = iplan + icham * kNplan;
127 fPadPlaneArray->AddAt(new AliTRDpadPlane(iplan,icham),ipp);
132 //_____________________________________________________________________________
133 AliTRDCommonParam::~AliTRDCommonParam()
144 if (fPadPlaneArray) {
145 fPadPlaneArray->Delete();
146 delete fPadPlaneArray;
151 //_____________________________________________________________________________
152 AliTRDCommonParam::AliTRDCommonParam(const AliTRDCommonParam &p):TObject(p)
158 ((AliTRDCommonParam &) p).Copy(*this);
162 //_____________________________________________________________________________
163 AliTRDCommonParam &AliTRDCommonParam::operator=(const AliTRDCommonParam &p)
166 // Assignment operator
169 if (this != &p) ((AliTRDCommonParam &) p).Copy(*this);
173 //_____________________________________________________________________________
174 void AliTRDCommonParam::Copy(TObject &p) const
180 AliTRDCommonParam* target = dynamic_cast<AliTRDCommonParam*> (&p);
184 target->fExBOn = fExBOn;
185 target->fPRFOn = fPRFOn;
186 target->fPRFbin = fPRFbin;
187 target->fPRFlo = fPRFlo;
188 target->fPRFhi = fPRFhi;
189 target->fPRFwid = fPRFwid;
190 target->fPRFpad = fPRFpad;
191 if (target->fPRFsmp) delete [] target->fPRFsmp;
192 target->fPRFsmp = new Float_t[fPRFbin];
193 for (Int_t iBin = 0; iBin < fPRFbin; iBin++) {
194 target->fPRFsmp[iBin] = fPRFsmp[iBin];
198 //_____________________________________________________________________________
199 void AliTRDCommonParam::SamplePRF()
202 // Samples the pad response function
205 const Int_t kPRFbin = 61;
207 Float_t prf[kNplan][kPRFbin] = { {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02,
208 5.2694e-02, 6.1362e-02, 7.1461e-02, 8.3362e-02,
209 9.7063e-02, 1.1307e-01, 1.3140e-01, 1.5235e-01,
210 1.7623e-01, 2.0290e-01, 2.3294e-01, 2.6586e-01,
211 3.0177e-01, 3.4028e-01, 3.8077e-01, 4.2267e-01,
212 4.6493e-01, 5.0657e-01, 5.4655e-01, 5.8397e-01,
213 6.1767e-01, 6.4744e-01, 6.7212e-01, 6.9188e-01,
214 7.0627e-01, 7.1499e-01, 7.1851e-01, 7.1499e-01,
215 7.0627e-01, 6.9188e-01, 6.7212e-01, 6.4744e-01,
216 6.1767e-01, 5.8397e-01, 5.4655e-01, 5.0657e-01,
217 4.6493e-01, 4.2267e-01, 3.8077e-01, 3.4028e-01,
218 3.0177e-01, 2.6586e-01, 2.3294e-01, 2.0290e-01,
219 1.7623e-01, 1.5235e-01, 1.3140e-01, 1.1307e-01,
220 9.7063e-02, 8.3362e-02, 7.1461e-02, 6.1362e-02,
221 5.2694e-02, 4.5292e-02, 3.9020e-02, 3.3608e-02,
223 {2.5478e-02, 2.9695e-02, 3.4655e-02, 4.0454e-02,
224 4.7342e-02, 5.5487e-02, 6.5038e-02, 7.6378e-02,
225 8.9696e-02, 1.0516e-01, 1.2327e-01, 1.4415e-01,
226 1.6794e-01, 1.9516e-01, 2.2573e-01, 2.5959e-01,
227 2.9694e-01, 3.3719e-01, 3.7978e-01, 4.2407e-01,
228 4.6889e-01, 5.1322e-01, 5.5569e-01, 5.9535e-01,
229 6.3141e-01, 6.6259e-01, 6.8882e-01, 7.0983e-01,
230 7.2471e-01, 7.3398e-01, 7.3761e-01, 7.3398e-01,
231 7.2471e-01, 7.0983e-01, 6.8882e-01, 6.6259e-01,
232 6.3141e-01, 5.9535e-01, 5.5569e-01, 5.1322e-01,
233 4.6889e-01, 4.2407e-01, 3.7978e-01, 3.3719e-01,
234 2.9694e-01, 2.5959e-01, 2.2573e-01, 1.9516e-01,
235 1.6794e-01, 1.4415e-01, 1.2327e-01, 1.0516e-01,
236 8.9696e-02, 7.6378e-02, 6.5038e-02, 5.5487e-02,
237 4.7342e-02, 4.0454e-02, 3.4655e-02, 2.9695e-02,
239 {2.2363e-02, 2.6233e-02, 3.0782e-02, 3.6140e-02,
240 4.2535e-02, 5.0157e-02, 5.9197e-02, 6.9900e-02,
241 8.2707e-02, 9.7811e-02, 1.1548e-01, 1.3601e-01,
242 1.5998e-01, 1.8739e-01, 2.1840e-01, 2.5318e-01,
243 2.9182e-01, 3.3373e-01, 3.7837e-01, 4.2498e-01,
244 4.7235e-01, 5.1918e-01, 5.6426e-01, 6.0621e-01,
245 6.4399e-01, 6.7700e-01, 7.0472e-01, 7.2637e-01,
246 7.4206e-01, 7.5179e-01, 7.5551e-01, 7.5179e-01,
247 7.4206e-01, 7.2637e-01, 7.0472e-01, 6.7700e-01,
248 6.4399e-01, 6.0621e-01, 5.6426e-01, 5.1918e-01,
249 4.7235e-01, 4.2498e-01, 3.7837e-01, 3.3373e-01,
250 2.9182e-01, 2.5318e-01, 2.1840e-01, 1.8739e-01,
251 1.5998e-01, 1.3601e-01, 1.1548e-01, 9.7811e-02,
252 8.2707e-02, 6.9900e-02, 5.9197e-02, 5.0157e-02,
253 4.2535e-02, 3.6140e-02, 3.0782e-02, 2.6233e-02,
255 {1.9635e-02, 2.3167e-02, 2.7343e-02, 3.2293e-02,
256 3.8224e-02, 4.5335e-02, 5.3849e-02, 6.4039e-02,
257 7.6210e-02, 9.0739e-02, 1.0805e-01, 1.2841e-01,
258 1.5216e-01, 1.7960e-01, 2.1099e-01, 2.4671e-01,
259 2.8647e-01, 3.2996e-01, 3.7660e-01, 4.2547e-01,
260 4.7536e-01, 5.2473e-01, 5.7215e-01, 6.1632e-01,
261 6.5616e-01, 6.9075e-01, 7.1939e-01, 7.4199e-01,
262 7.5838e-01, 7.6848e-01, 7.7227e-01, 7.6848e-01,
263 7.5838e-01, 7.4199e-01, 7.1939e-01, 6.9075e-01,
264 6.5616e-01, 6.1632e-01, 5.7215e-01, 5.2473e-01,
265 4.7536e-01, 4.2547e-01, 3.7660e-01, 3.2996e-01,
266 2.8647e-01, 2.4671e-01, 2.1099e-01, 1.7960e-01,
267 1.5216e-01, 1.2841e-01, 1.0805e-01, 9.0739e-02,
268 7.6210e-02, 6.4039e-02, 5.3849e-02, 4.5335e-02,
269 3.8224e-02, 3.2293e-02, 2.7343e-02, 2.3167e-02,
271 {1.7224e-02, 2.0450e-02, 2.4286e-02, 2.8860e-02,
272 3.4357e-02, 4.0979e-02, 4.8966e-02, 5.8612e-02,
273 7.0253e-02, 8.4257e-02, 1.0102e-01, 1.2094e-01,
274 1.4442e-01, 1.7196e-01, 2.0381e-01, 2.4013e-01,
275 2.8093e-01, 3.2594e-01, 3.7450e-01, 4.2563e-01,
276 4.7796e-01, 5.2991e-01, 5.7974e-01, 6.2599e-01,
277 6.6750e-01, 7.0344e-01, 7.3329e-01, 7.5676e-01,
278 7.7371e-01, 7.8410e-01, 7.8793e-01, 7.8410e-01,
279 7.7371e-01, 7.5676e-01, 7.3329e-01, 7.0344e-01,
280 6.6750e-01, 6.2599e-01, 5.7974e-01, 5.2991e-01,
281 4.7796e-01, 4.2563e-01, 3.7450e-01, 3.2594e-01,
282 2.8093e-01, 2.4013e-01, 2.0381e-01, 1.7196e-01,
283 1.4442e-01, 1.2094e-01, 1.0102e-01, 8.4257e-02,
284 7.0253e-02, 5.8612e-02, 4.8966e-02, 4.0979e-02,
285 3.4357e-02, 2.8860e-02, 2.4286e-02, 2.0450e-02,
287 {1.5096e-02, 1.8041e-02, 2.1566e-02, 2.5793e-02,
288 3.0886e-02, 3.7044e-02, 4.4515e-02, 5.3604e-02,
289 6.4668e-02, 7.8109e-02, 9.4364e-02, 1.1389e-01,
290 1.3716e-01, 1.6461e-01, 1.9663e-01, 2.3350e-01,
291 2.7527e-01, 3.2170e-01, 3.7214e-01, 4.2549e-01,
292 4.8024e-01, 5.3460e-01, 5.8677e-01, 6.3512e-01,
293 6.7838e-01, 7.1569e-01, 7.4655e-01, 7.7071e-01,
294 7.8810e-01, 7.9871e-01, 8.0255e-01, 7.9871e-01,
295 7.8810e-01, 7.7071e-01, 7.4655e-01, 7.1569e-01,
296 6.7838e-01, 6.3512e-01, 5.8677e-01, 5.3460e-01,
297 4.8024e-01, 4.2549e-01, 3.7214e-01, 3.2170e-01,
298 2.7527e-01, 2.3350e-01, 1.9663e-01, 1.6461e-01,
299 1.3716e-01, 1.1389e-01, 9.4364e-02, 7.8109e-02,
300 6.4668e-02, 5.3604e-02, 4.4515e-02, 3.7044e-02,
301 3.0886e-02, 2.5793e-02, 2.1566e-02, 1.8041e-02,
304 // More sampling precision with linear interpolation
307 Float_t pad[kPRFbin];
308 Int_t sPRFbin = kPRFbin;
309 Float_t sPRFwid = (fPRFhi - fPRFlo) / ((Float_t) sPRFbin);
310 for (Int_t iPad = 0; iPad < sPRFbin; iPad++) {
311 pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPRFlo;
314 fPRFwid = (fPRFhi - fPRFlo) / ((Float_t) fPRFbin);
315 fPRFpad = ((Int_t) (1.0 / fPRFwid));
317 if (fPRFsmp) delete [] fPRFsmp;
318 fPRFsmp = new Float_t[kNplan*fPRFbin];
324 for (Int_t iPla = 0; iPla < kNplan; iPla++) {
326 for (Int_t iBin = 0; iBin < fPRFbin; iBin++) {
328 Float_t bin = (((Float_t) iBin) + 0.5) * fPRFwid + fPRFlo;
332 diff = bin - pad[ipos2++];
333 } while ((diff > 0) && (ipos2 < kPRFbin));
334 if (ipos2 == kPRFbin) {
335 fPRFsmp[iPla*fPRFbin+iBin] = prf[iPla][ipos2-1];
337 else if (ipos2 == 1) {
338 fPRFsmp[iPla*fPRFbin+iBin] = prf[iPla][ipos2-1];
342 if (ipos2 >= kPRFbin) ipos2 = kPRFbin - 1;
344 fPRFsmp[iPla*fPRFbin+iBin] = prf[iPla][ipos2]
345 + diff * (prf[iPla][ipos2] - prf[iPla][ipos1])
354 //_____________________________________________________________________________
355 Int_t AliTRDCommonParam::PadResponse(Double_t signal, Double_t dist
356 , Int_t plane, Double_t *pad) const
359 // Applies the pad response
362 Int_t iBin = ((Int_t) (( - dist - fPRFlo) / fPRFwid));
363 Int_t iOff = plane * fPRFbin;
365 Int_t iBin0 = iBin - fPRFpad + iOff;
366 Int_t iBin1 = iBin + iOff;
367 Int_t iBin2 = iBin + fPRFpad + iOff;
372 if ((iBin1 >= 0) && (iBin1 < (fPRFbin*kNplan))) {
375 pad[0] = signal * fPRFsmp[iBin0];
377 pad[1] = signal * fPRFsmp[iBin1];
378 if (iBin2 < (fPRFbin*kNplan)) {
379 pad[2] = signal * fPRFsmp[iBin2];
393 //_____________________________________________________________________________
394 AliTRDpadPlane *AliTRDCommonParam::GetPadPlane(Int_t p, Int_t c) const
397 // Returns the pad plane for a given plane <p> and chamber <c> number
400 Int_t ipp = p + c * kNplan;
401 return ((AliTRDpadPlane *) fPadPlaneArray->At(ipp));
405 //_____________________________________________________________________________
406 Int_t AliTRDCommonParam::GetRowMax(Int_t p, Int_t c, Int_t /*s*/) const
409 // Returns the number of rows on the pad plane
412 return GetPadPlane(p,c)->GetNrows();
416 //_____________________________________________________________________________
417 Int_t AliTRDCommonParam::GetColMax(Int_t p) const
420 // Returns the number of rows on the pad plane
423 return GetPadPlane(p,0)->GetNcols();
427 //_____________________________________________________________________________
428 Double_t AliTRDCommonParam::GetRow0(Int_t p, Int_t c, Int_t /*s*/) const
431 // Returns the position of the border of the first pad in a row
434 return GetPadPlane(p,c)->GetRow0();
438 //_____________________________________________________________________________
439 Double_t AliTRDCommonParam::GetCol0(Int_t p) const
442 // Returns the position of the border of the first pad in a column
445 return GetPadPlane(p,0)->GetCol0();