]>
Commit | Line | Data |
---|---|---|
3551db50 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // Class providing the calibration parameters by accessing the CDB // | |
21 | // // | |
22 | // Request an instance with AliTRDcalibDB::Instance() // | |
23 | // If a new event is processed set the event number with SetRun // | |
24 | // Then request the calibration data // | |
25 | // // | |
26 | /////////////////////////////////////////////////////////////////////////////// | |
27 | ||
28 | #include <TRandom.h> | |
29 | ||
30 | #include <AliCDBManager.h> | |
31 | ||
32 | #include "AliTRDcalibDB.h" | |
33 | #include "AliTRDgeometry.h" | |
34 | #include "AliTRDpadPlane.h" | |
35 | #include "AliTRDCommonParam.h" | |
36 | ||
37 | #include "AliTRDCalROC.h" | |
cc7cef99 | 38 | #include "AliTRDCalChamberPos.h" |
39 | #include "AliTRDCalStackPos.h" | |
3551db50 | 40 | #include "AliTRDCalPad.h" |
41 | #include "AliTRDCalDet.h" | |
42 | #include "AliTRDCalGlobals.h" | |
cc7cef99 | 43 | #include "AliTRDCalPIDLQ.h" |
3551db50 | 44 | |
45 | ClassImp(AliTRDcalibDB) | |
46 | ||
47 | AliTRDcalibDB* AliTRDcalibDB::fgInstance = 0; | |
48 | Bool_t AliTRDcalibDB::fgTerminated = kFALSE; | |
49 | ||
50 | //_ singleton implementation __________________________________________________ | |
51 | AliTRDcalibDB* AliTRDcalibDB::Instance() | |
52 | { | |
53 | // | |
54 | // Singleton implementation | |
55 | // Returns an instance of this class, it is created if neccessary | |
56 | // | |
57 | ||
58 | if (fgTerminated != kFALSE) | |
59 | return 0; | |
60 | ||
61 | if (fgInstance == 0) | |
62 | fgInstance = new AliTRDcalibDB(); | |
63 | ||
64 | return fgInstance; | |
65 | } | |
66 | ||
67 | void AliTRDcalibDB::Terminate() | |
68 | { | |
69 | // | |
70 | // Singleton implementation | |
71 | // Deletes the instance of this class and sets the terminated flag, instances cannot be requested anymore | |
72 | // This function can be called several times. | |
73 | // | |
74 | ||
75 | fgTerminated = kTRUE; | |
76 | ||
77 | if (fgInstance != 0) | |
78 | { | |
79 | delete fgInstance; | |
80 | fgInstance = 0; | |
81 | } | |
82 | } | |
83 | ||
84 | //_____________________________________________________________________________ | |
85 | AliTRDcalibDB::AliTRDcalibDB() | |
86 | { | |
87 | // | |
88 | // constructor | |
89 | // | |
90 | ||
3551db50 | 91 | // TODO Default runnumber is set to 0, this should be changed later to an invalid value (e.g. -1) to prevent |
92 | // TODO invalid calibration data to be used. | |
93 | fRun = 0; | |
94 | ||
6a739e92 | 95 | fPadResponse.fPRFbin = 0; |
96 | fPadResponse.fPRFlo = 0.0; | |
97 | fPadResponse.fPRFhi = 0.0; | |
98 | fPadResponse.fPRFwid = 0.0; | |
99 | fPadResponse.fPRFpad = 0; | |
100 | fPadResponse.fPRFsmp = 0; | |
101 | ||
3551db50 | 102 | AliCDBManager* manager = AliCDBManager::Instance(); |
103 | if (!manager) | |
104 | { | |
6a739e92 | 105 | std::cout << "AliTRDcalibDB: CRITICAL: Failed to get instance of AliCDBManager." << std::endl; |
106 | fLocator = 0; | |
3551db50 | 107 | } |
6a739e92 | 108 | else |
109 | fLocator = manager->GetStorage("local://$ALICE_ROOT"); | |
3551db50 | 110 | |
111 | for (Int_t i=0; i<kCDBCacheSize; ++i) | |
112 | { | |
113 | fCDBCache[i] = 0; | |
114 | fCDBEntries[i] = 0; | |
115 | } | |
6a739e92 | 116 | |
117 | // Create the sampled PRF | |
118 | SamplePRF(); | |
acba9bad | 119 | } |
3551db50 | 120 | |
121 | //_____________________________________________________________________________ | |
122 | AliTRDcalibDB::~AliTRDcalibDB() | |
123 | { | |
124 | // | |
125 | // destructor | |
126 | // | |
127 | ||
6a739e92 | 128 | if (fPadResponse.fPRFsmp) { |
129 | delete [] fPadResponse.fPRFsmp; | |
130 | fPadResponse.fPRFsmp = 0; | |
131 | } | |
132 | ||
3551db50 | 133 | Invalidate(); |
acba9bad | 134 | } |
3551db50 | 135 | |
136 | //_____________________________________________________________________________ | |
137 | void AliTRDcalibDB::SetRun(Long64_t run) | |
138 | { | |
139 | // | |
140 | // Sets current run number. Calibration data is read from the corresponding file. | |
141 | // When the run number changes the caching is invalidated. | |
142 | // | |
143 | ||
144 | if (fRun == run) | |
145 | return; | |
146 | ||
147 | fRun = run; | |
148 | Invalidate(); | |
149 | } | |
150 | ||
151 | //_____________________________________________________________________________ | |
152 | void AliTRDcalibDB::Invalidate() | |
153 | { | |
154 | // | |
155 | // Invalidates cache (when run number is changed). | |
156 | // | |
157 | ||
158 | for (Int_t i=0; i<kCDBCacheSize; ++i) | |
159 | { | |
160 | if (fCDBEntries[i]) | |
161 | { | |
dde59437 | 162 | if (fCDBEntries[i]->IsOwner() == kFALSE && fCDBCache[i]) |
3551db50 | 163 | delete fCDBCache[i]; |
dde59437 | 164 | |
3551db50 | 165 | delete fCDBEntries[i]; |
166 | fCDBEntries[i] = 0; | |
167 | fCDBCache[i] = 0; | |
168 | } | |
169 | } | |
170 | } | |
171 | ||
172 | //_____________________________________________________________________________ | |
173 | Bool_t AliTRDcalibDB::GetChamberPos(Int_t det, Float_t* xyz) | |
174 | { | |
175 | // | |
176 | // Returns the deviation of the chamber position from the nominal position. | |
177 | // | |
178 | ||
cc7cef99 | 179 | AliTRDCalChamberPos* chamber = dynamic_cast<AliTRDCalChamberPos*>(GetCachedCDBObject(kIDChamber)); |
3551db50 | 180 | if (!chamber) |
181 | return kFALSE; | |
182 | ||
183 | const Float_t* kvalues = chamber->GetChamberPos(det); | |
184 | if (!kvalues) | |
185 | return kFALSE; | |
186 | ||
187 | xyz[0] = kvalues[0]; | |
188 | xyz[1] = kvalues[1]; | |
189 | xyz[2] = kvalues[2]; | |
190 | ||
191 | return kTRUE; | |
192 | } | |
193 | ||
194 | //_____________________________________________________________________________ | |
195 | Bool_t AliTRDcalibDB::GetChamberRot(Int_t det, Float_t* xyz) | |
196 | { | |
197 | // | |
198 | // Returns the rotation of the chamber from the nominal position. | |
199 | // | |
200 | ||
cc7cef99 | 201 | AliTRDCalChamberPos* chamber = dynamic_cast<AliTRDCalChamberPos*>(GetCachedCDBObject(kIDChamber)); |
3551db50 | 202 | if (!chamber) |
203 | return kFALSE; | |
204 | ||
205 | const Float_t* kvalues = chamber->GetChamberRot(det); | |
206 | if (!kvalues) | |
207 | return kFALSE; | |
208 | ||
209 | xyz[0] = kvalues[0]; | |
210 | xyz[1] = kvalues[1]; | |
211 | xyz[2] = kvalues[2]; | |
212 | ||
213 | return kTRUE; | |
214 | } | |
215 | ||
216 | //_____________________________________________________________________________ | |
217 | Bool_t AliTRDcalibDB::GetStackPos(Int_t chamber, Int_t sector, Float_t* xyz) | |
218 | { | |
219 | // | |
220 | // Returns the deviation of the stack position from the nominal position. | |
221 | // | |
222 | ||
cc7cef99 | 223 | AliTRDCalStackPos* stack = dynamic_cast<AliTRDCalStackPos*>(GetCachedCDBObject(kIDStack)); |
3551db50 | 224 | if (!stack) |
225 | return kFALSE; | |
226 | ||
227 | const Float_t* kvalues = stack->GetStackPos(chamber, sector); | |
228 | if (!kvalues) | |
229 | return kFALSE; | |
230 | ||
231 | xyz[0] = kvalues[0]; | |
232 | xyz[1] = kvalues[1]; | |
233 | xyz[2] = kvalues[2]; | |
234 | ||
235 | return kTRUE; | |
236 | } | |
237 | ||
238 | //_____________________________________________________________________________ | |
239 | Bool_t AliTRDcalibDB::GetStackRot(Int_t chamber, Int_t sector, Float_t* xyz) | |
240 | { | |
241 | // | |
242 | // Returns the rotation of the stack from the nominal position. | |
243 | // | |
244 | ||
cc7cef99 | 245 | AliTRDCalStackPos* stack = dynamic_cast<AliTRDCalStackPos*>(GetCachedCDBObject(kIDStack)); |
3551db50 | 246 | if (!stack) |
247 | return kFALSE; | |
248 | ||
249 | const Float_t* kvalues = stack->GetStackRot(chamber, sector); | |
250 | if (!kvalues) | |
251 | return kFALSE; | |
252 | ||
253 | xyz[0] = kvalues[0]; | |
254 | xyz[1] = kvalues[1]; | |
255 | xyz[2] = kvalues[2]; | |
256 | ||
257 | return kTRUE; | |
258 | } | |
259 | ||
260 | //_____________________________________________________________________________ | |
261 | Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row) | |
262 | { | |
263 | // | |
264 | // Returns the drift velocity for the given pad. | |
265 | // | |
266 | ||
267 | AliTRDCalPad* calPad = dynamic_cast<AliTRDCalPad*> (GetCachedCDBObject(kIDVdrift)); | |
268 | if (!calPad) | |
269 | return -1; | |
270 | ||
271 | AliTRDCalROC* roc = calPad->GetCalROC(det); | |
272 | if (!roc) | |
273 | return -1; | |
274 | ||
275 | return roc->GetValue(col, row); | |
acba9bad | 276 | } |
3551db50 | 277 | |
278 | //_____________________________________________________________________________ | |
279 | Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row) | |
280 | { | |
281 | // | |
282 | // Returns t0 for the given pad. | |
283 | // | |
284 | ||
285 | AliTRDCalPad* calPad = dynamic_cast<AliTRDCalPad*> (GetCachedCDBObject(kIDT0)); | |
286 | if (!calPad) | |
287 | return -1; | |
288 | ||
289 | AliTRDCalROC* roc = calPad->GetCalROC(det); | |
290 | if (!roc) | |
291 | return -1; | |
292 | ||
293 | return roc->GetValue(col, row); | |
acba9bad | 294 | } |
3551db50 | 295 | |
296 | //_____________________________________________________________________________ | |
297 | Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row) | |
298 | { | |
299 | // | |
300 | // Returns the gain factor for the given pad. | |
301 | // | |
302 | ||
303 | AliTRDCalPad* calPad = dynamic_cast<AliTRDCalPad*> (GetCachedCDBObject(kIDGainFactor)); | |
304 | if (!calPad) | |
305 | return -1; | |
306 | ||
307 | AliTRDCalROC* roc = calPad->GetCalROC(det); | |
308 | if (!roc) | |
309 | return -1; | |
310 | ||
311 | return roc->GetValue(col, row); | |
acba9bad | 312 | } |
6a739e92 | 313 | |
314 | //_____________________________________________________________________________ | |
315 | Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row) | |
316 | { | |
317 | // | |
318 | // Returns the PRF width for the given pad. | |
319 | // | |
320 | ||
321 | AliTRDCalPad* calPad = dynamic_cast<AliTRDCalPad*> (GetCachedCDBObject(kIDPRFWidth)); | |
322 | if (!calPad) | |
323 | return -1; | |
324 | ||
325 | AliTRDCalROC* roc = calPad->GetCalROC(det); | |
326 | if (!roc) | |
327 | return -1; | |
328 | ||
329 | return roc->GetValue(col, row); | |
acba9bad | 330 | } |
3551db50 | 331 | |
332 | //_____________________________________________________________________________ | |
333 | Float_t AliTRDcalibDB::GetSamplingFrequency() | |
334 | { | |
335 | // | |
336 | // Returns the sampling frequency of the TRD read-out. | |
337 | // | |
338 | ||
339 | AliTRDCalGlobals* calGlobal = dynamic_cast<AliTRDCalGlobals*> (GetCachedCDBObject(kIDGlobals)); | |
340 | if (!calGlobal) | |
341 | return -1; | |
342 | ||
343 | return calGlobal->GetSamplingFrequency(); | |
344 | } | |
345 | ||
346 | //_____________________________________________________________________________ | |
347 | Int_t AliTRDcalibDB::GetNumberOfTimeBins() | |
348 | { | |
349 | // | |
350 | // Returns the number of time bins which are read-out. | |
351 | // | |
352 | ||
353 | AliTRDCalGlobals* calGlobal = dynamic_cast<AliTRDCalGlobals*> (GetCachedCDBObject(kIDGlobals)); | |
354 | if (!calGlobal) | |
355 | return -1; | |
356 | ||
357 | return calGlobal->GetNumberOfTimeBins(); | |
358 | } | |
359 | ||
cc7cef99 | 360 | //_____________________________________________________________________________ |
361 | AliTRDCalPIDLQ* AliTRDcalibDB::GetPIDLQObject() | |
362 | { | |
363 | // | |
364 | // Returns the object storing the distributions for PID with likelihood | |
365 | // | |
366 | ||
367 | // FAKE | |
368 | /*AliTRDCalPIDLQ* pid = new AliTRDCalPIDLQ(); | |
369 | pid->ReadData("$ALICE_ROOT/TRD/TRDdEdxHistogramsV1.root"); | |
370 | return pid;*/ | |
371 | ||
372 | // TODO due to a bug in the CDB this does not work yet | |
373 | return dynamic_cast<AliTRDCalPIDLQ*> (GetCachedCDBObject(kIDPIDLQ)); | |
374 | } | |
375 | ||
3551db50 | 376 | //_____________________________________________________________________________ |
377 | Float_t AliTRDcalibDB::GetOmegaTau(Float_t vdrift) | |
378 | { | |
379 | // | |
380 | // Returns omega*tau (tan(Lorentz-angle)) for a given drift velocity <vd> | |
381 | // and a B-field <b> for Xe/CO2 (15%). | |
382 | // The values are according to a GARFIELD simulation. | |
383 | // | |
384 | // This function basically does not belong to the calibration class. It should be moved somewhere else. | |
385 | // However, currently it is in use by simulation and reconstruction. | |
386 | // | |
387 | ||
388 | AliTRDCommonParam* commonParam = AliTRDCommonParam::Instance(); | |
389 | if (!commonParam) | |
390 | return -1; | |
391 | Float_t field = commonParam->GetField(); | |
392 | ||
393 | const Int_t kNb = 5; | |
394 | Float_t p0[kNb] = { 0.004810, 0.007412, 0.010252, 0.013409, 0.016888 }; | |
395 | Float_t p1[kNb] = { 0.054875, 0.081534, 0.107333, 0.131983, 0.155455 }; | |
396 | Float_t p2[kNb] = { -0.008682, -0.012896, -0.016987, -0.020880, -0.024623 }; | |
397 | Float_t p3[kNb] = { 0.000155, 0.000238, 0.000330, 0.000428, 0.000541 }; | |
398 | ||
399 | Int_t ib = ((Int_t) (10 * (field - 0.15))); | |
400 | ib = TMath::Max( 0,ib); | |
401 | ib = TMath::Min(kNb,ib); | |
402 | ||
403 | Float_t alphaL = p0[ib] | |
404 | + p1[ib] * vdrift | |
405 | + p2[ib] * vdrift*vdrift | |
406 | + p3[ib] * vdrift*vdrift*vdrift; | |
407 | ||
408 | return TMath::Tan(alphaL); | |
6a739e92 | 409 | } |
410 | ||
411 | //_____________________________________________________________________________ | |
412 | void AliTRDcalibDB::SamplePRF() | |
413 | { | |
414 | // | |
415 | // Samples the pad response function | |
416 | // | |
417 | ||
418 | const Int_t kPRFbin = 61; | |
419 | ||
420 | Float_t prf[kNplan][kPRFbin] = { {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02, | |
421 | 5.2694e-02, 6.1362e-02, 7.1461e-02, 8.3362e-02, | |
422 | 9.7063e-02, 1.1307e-01, 1.3140e-01, 1.5235e-01, | |
423 | 1.7623e-01, 2.0290e-01, 2.3294e-01, 2.6586e-01, | |
424 | 3.0177e-01, 3.4028e-01, 3.8077e-01, 4.2267e-01, | |
425 | 4.6493e-01, 5.0657e-01, 5.4655e-01, 5.8397e-01, | |
426 | 6.1767e-01, 6.4744e-01, 6.7212e-01, 6.9188e-01, | |
427 | 7.0627e-01, 7.1499e-01, 7.1851e-01, 7.1499e-01, | |
428 | 7.0627e-01, 6.9188e-01, 6.7212e-01, 6.4744e-01, | |
429 | 6.1767e-01, 5.8397e-01, 5.4655e-01, 5.0657e-01, | |
430 | 4.6493e-01, 4.2267e-01, 3.8077e-01, 3.4028e-01, | |
431 | 3.0177e-01, 2.6586e-01, 2.3294e-01, 2.0290e-01, | |
432 | 1.7623e-01, 1.5235e-01, 1.3140e-01, 1.1307e-01, | |
433 | 9.7063e-02, 8.3362e-02, 7.1461e-02, 6.1362e-02, | |
434 | 5.2694e-02, 4.5292e-02, 3.9020e-02, 3.3608e-02, | |
435 | 2.9037e-02}, | |
436 | {2.5478e-02, 2.9695e-02, 3.4655e-02, 4.0454e-02, | |
437 | 4.7342e-02, 5.5487e-02, 6.5038e-02, 7.6378e-02, | |
438 | 8.9696e-02, 1.0516e-01, 1.2327e-01, 1.4415e-01, | |
439 | 1.6794e-01, 1.9516e-01, 2.2573e-01, 2.5959e-01, | |
440 | 2.9694e-01, 3.3719e-01, 3.7978e-01, 4.2407e-01, | |
441 | 4.6889e-01, 5.1322e-01, 5.5569e-01, 5.9535e-01, | |
442 | 6.3141e-01, 6.6259e-01, 6.8882e-01, 7.0983e-01, | |
443 | 7.2471e-01, 7.3398e-01, 7.3761e-01, 7.3398e-01, | |
444 | 7.2471e-01, 7.0983e-01, 6.8882e-01, 6.6259e-01, | |
445 | 6.3141e-01, 5.9535e-01, 5.5569e-01, 5.1322e-01, | |
446 | 4.6889e-01, 4.2407e-01, 3.7978e-01, 3.3719e-01, | |
447 | 2.9694e-01, 2.5959e-01, 2.2573e-01, 1.9516e-01, | |
448 | 1.6794e-01, 1.4415e-01, 1.2327e-01, 1.0516e-01, | |
449 | 8.9696e-02, 7.6378e-02, 6.5038e-02, 5.5487e-02, | |
450 | 4.7342e-02, 4.0454e-02, 3.4655e-02, 2.9695e-02, | |
451 | 2.5478e-02}, | |
452 | {2.2363e-02, 2.6233e-02, 3.0782e-02, 3.6140e-02, | |
453 | 4.2535e-02, 5.0157e-02, 5.9197e-02, 6.9900e-02, | |
454 | 8.2707e-02, 9.7811e-02, 1.1548e-01, 1.3601e-01, | |
455 | 1.5998e-01, 1.8739e-01, 2.1840e-01, 2.5318e-01, | |
456 | 2.9182e-01, 3.3373e-01, 3.7837e-01, 4.2498e-01, | |
457 | 4.7235e-01, 5.1918e-01, 5.6426e-01, 6.0621e-01, | |
458 | 6.4399e-01, 6.7700e-01, 7.0472e-01, 7.2637e-01, | |
459 | 7.4206e-01, 7.5179e-01, 7.5551e-01, 7.5179e-01, | |
460 | 7.4206e-01, 7.2637e-01, 7.0472e-01, 6.7700e-01, | |
461 | 6.4399e-01, 6.0621e-01, 5.6426e-01, 5.1918e-01, | |
462 | 4.7235e-01, 4.2498e-01, 3.7837e-01, 3.3373e-01, | |
463 | 2.9182e-01, 2.5318e-01, 2.1840e-01, 1.8739e-01, | |
464 | 1.5998e-01, 1.3601e-01, 1.1548e-01, 9.7811e-02, | |
465 | 8.2707e-02, 6.9900e-02, 5.9197e-02, 5.0157e-02, | |
466 | 4.2535e-02, 3.6140e-02, 3.0782e-02, 2.6233e-02, | |
467 | 2.2363e-02}, | |
468 | {1.9635e-02, 2.3167e-02, 2.7343e-02, 3.2293e-02, | |
469 | 3.8224e-02, 4.5335e-02, 5.3849e-02, 6.4039e-02, | |
470 | 7.6210e-02, 9.0739e-02, 1.0805e-01, 1.2841e-01, | |
471 | 1.5216e-01, 1.7960e-01, 2.1099e-01, 2.4671e-01, | |
472 | 2.8647e-01, 3.2996e-01, 3.7660e-01, 4.2547e-01, | |
473 | 4.7536e-01, 5.2473e-01, 5.7215e-01, 6.1632e-01, | |
474 | 6.5616e-01, 6.9075e-01, 7.1939e-01, 7.4199e-01, | |
475 | 7.5838e-01, 7.6848e-01, 7.7227e-01, 7.6848e-01, | |
476 | 7.5838e-01, 7.4199e-01, 7.1939e-01, 6.9075e-01, | |
477 | 6.5616e-01, 6.1632e-01, 5.7215e-01, 5.2473e-01, | |
478 | 4.7536e-01, 4.2547e-01, 3.7660e-01, 3.2996e-01, | |
479 | 2.8647e-01, 2.4671e-01, 2.1099e-01, 1.7960e-01, | |
480 | 1.5216e-01, 1.2841e-01, 1.0805e-01, 9.0739e-02, | |
481 | 7.6210e-02, 6.4039e-02, 5.3849e-02, 4.5335e-02, | |
482 | 3.8224e-02, 3.2293e-02, 2.7343e-02, 2.3167e-02, | |
483 | 1.9635e-02}, | |
484 | {1.7224e-02, 2.0450e-02, 2.4286e-02, 2.8860e-02, | |
485 | 3.4357e-02, 4.0979e-02, 4.8966e-02, 5.8612e-02, | |
486 | 7.0253e-02, 8.4257e-02, 1.0102e-01, 1.2094e-01, | |
487 | 1.4442e-01, 1.7196e-01, 2.0381e-01, 2.4013e-01, | |
488 | 2.8093e-01, 3.2594e-01, 3.7450e-01, 4.2563e-01, | |
489 | 4.7796e-01, 5.2991e-01, 5.7974e-01, 6.2599e-01, | |
490 | 6.6750e-01, 7.0344e-01, 7.3329e-01, 7.5676e-01, | |
491 | 7.7371e-01, 7.8410e-01, 7.8793e-01, 7.8410e-01, | |
492 | 7.7371e-01, 7.5676e-01, 7.3329e-01, 7.0344e-01, | |
493 | 6.6750e-01, 6.2599e-01, 5.7974e-01, 5.2991e-01, | |
494 | 4.7796e-01, 4.2563e-01, 3.7450e-01, 3.2594e-01, | |
495 | 2.8093e-01, 2.4013e-01, 2.0381e-01, 1.7196e-01, | |
496 | 1.4442e-01, 1.2094e-01, 1.0102e-01, 8.4257e-02, | |
497 | 7.0253e-02, 5.8612e-02, 4.8966e-02, 4.0979e-02, | |
498 | 3.4357e-02, 2.8860e-02, 2.4286e-02, 2.0450e-02, | |
499 | 1.7224e-02}, | |
500 | {1.5096e-02, 1.8041e-02, 2.1566e-02, 2.5793e-02, | |
501 | 3.0886e-02, 3.7044e-02, 4.4515e-02, 5.3604e-02, | |
502 | 6.4668e-02, 7.8109e-02, 9.4364e-02, 1.1389e-01, | |
503 | 1.3716e-01, 1.6461e-01, 1.9663e-01, 2.3350e-01, | |
504 | 2.7527e-01, 3.2170e-01, 3.7214e-01, 4.2549e-01, | |
505 | 4.8024e-01, 5.3460e-01, 5.8677e-01, 6.3512e-01, | |
506 | 6.7838e-01, 7.1569e-01, 7.4655e-01, 7.7071e-01, | |
507 | 7.8810e-01, 7.9871e-01, 8.0255e-01, 7.9871e-01, | |
508 | 7.8810e-01, 7.7071e-01, 7.4655e-01, 7.1569e-01, | |
509 | 6.7838e-01, 6.3512e-01, 5.8677e-01, 5.3460e-01, | |
510 | 4.8024e-01, 4.2549e-01, 3.7214e-01, 3.2170e-01, | |
511 | 2.7527e-01, 2.3350e-01, 1.9663e-01, 1.6461e-01, | |
512 | 1.3716e-01, 1.1389e-01, 9.4364e-02, 7.8109e-02, | |
513 | 6.4668e-02, 5.3604e-02, 4.4515e-02, 3.7044e-02, | |
514 | 3.0886e-02, 2.5793e-02, 2.1566e-02, 1.8041e-02, | |
515 | 1.5096e-02}}; | |
516 | ||
517 | // More sampling precision with linear interpolation | |
518 | fPadResponse.fPRFlo = -1.5; | |
519 | fPadResponse.fPRFhi = 1.5; | |
520 | Float_t pad[kPRFbin]; | |
521 | Int_t sPRFbin = kPRFbin; | |
522 | Float_t sPRFwid = (fPadResponse.fPRFhi - fPadResponse.fPRFlo) / ((Float_t) sPRFbin); | |
523 | for (Int_t iPad = 0; iPad < sPRFbin; iPad++) { | |
524 | pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPadResponse.fPRFlo; | |
525 | } | |
526 | fPadResponse.fPRFbin = 500; | |
527 | fPadResponse.fPRFwid = (fPadResponse.fPRFhi - fPadResponse.fPRFlo) / ((Float_t) fPadResponse.fPRFbin); | |
528 | fPadResponse.fPRFpad = ((Int_t) (1.0 / fPadResponse.fPRFwid)); | |
529 | ||
530 | if (fPadResponse.fPRFsmp) delete [] fPadResponse.fPRFsmp; | |
531 | fPadResponse.fPRFsmp = new Float_t[kNplan*fPadResponse.fPRFbin]; | |
532 | ||
533 | Int_t ipos1; | |
534 | Int_t ipos2; | |
535 | Float_t diff; | |
536 | ||
537 | for (Int_t iPla = 0; iPla < kNplan; iPla++) { | |
538 | ||
539 | for (Int_t iBin = 0; iBin < fPadResponse.fPRFbin; iBin++) { | |
540 | ||
541 | Float_t bin = (((Float_t) iBin) + 0.5) * fPadResponse.fPRFwid + fPadResponse.fPRFlo; | |
542 | ipos1 = ipos2 = 0; | |
543 | diff = 0; | |
544 | do { | |
545 | diff = bin - pad[ipos2++]; | |
546 | } while ((diff > 0) && (ipos2 < kPRFbin)); | |
547 | if (ipos2 == kPRFbin) { | |
548 | fPadResponse.fPRFsmp[iPla*fPadResponse.fPRFbin+iBin] = prf[iPla][ipos2-1]; | |
549 | } | |
550 | else if (ipos2 == 1) { | |
551 | fPadResponse.fPRFsmp[iPla*fPadResponse.fPRFbin+iBin] = prf[iPla][ipos2-1]; | |
552 | } | |
553 | else { | |
554 | ipos2--; | |
555 | if (ipos2 >= kPRFbin) ipos2 = kPRFbin - 1; | |
556 | ipos1 = ipos2 - 1; | |
557 | fPadResponse.fPRFsmp[iPla*fPadResponse.fPRFbin+iBin] = prf[iPla][ipos2] | |
558 | + diff * (prf[iPla][ipos2] - prf[iPla][ipos1]) | |
559 | / sPRFwid; | |
560 | } | |
561 | ||
562 | } | |
563 | } | |
564 | ||
565 | } | |
566 | ||
567 | //_____________________________________________________________________________ | |
568 | Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist | |
569 | , Int_t plane, Double_t *pad) const | |
570 | { | |
571 | // | |
572 | // Applies the pad response | |
573 | // | |
574 | ||
575 | Int_t iBin = ((Int_t) (( - dist - fPadResponse.fPRFlo) / fPadResponse.fPRFwid)); | |
576 | Int_t iOff = plane * fPadResponse.fPRFbin; | |
577 | ||
578 | Int_t iBin0 = iBin - fPadResponse.fPRFpad + iOff; | |
579 | Int_t iBin1 = iBin + iOff; | |
580 | Int_t iBin2 = iBin + fPadResponse.fPRFpad + iOff; | |
581 | ||
582 | pad[0] = 0.0; | |
583 | pad[1] = 0.0; | |
584 | pad[2] = 0.0; | |
585 | if ((iBin1 >= 0) && (iBin1 < (fPadResponse.fPRFbin*kNplan))) { | |
586 | ||
587 | if (iBin0 >= 0) { | |
588 | pad[0] = signal * fPadResponse.fPRFsmp[iBin0]; | |
589 | } | |
590 | pad[1] = signal * fPadResponse.fPRFsmp[iBin1]; | |
591 | if (iBin2 < (fPadResponse.fPRFbin*kNplan)) { | |
592 | pad[2] = signal * fPadResponse.fPRFsmp[iBin2]; | |
593 | } | |
594 | ||
595 | return 1; | |
596 | ||
597 | } | |
598 | else { | |
599 | ||
600 | return 0; | |
601 | ||
602 | } | |
ab0a4106 | 603 | |
3551db50 | 604 | } |
605 |