]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/AliTOFSDigitizer.cxx
Sample program for using the simple fast cluster finder.
[u/mrichter/AliRoot.git] / TOF / AliTOFSDigitizer.cxx
CommitLineData
517b7f8f 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//_________________________________________________________________________
17// This is a TTask that constructs SDigits out of Hits
18// A Summable Digits is the sum of all hits in a pad
19//
20//
21//-- Author: F. Pierella
22//////////////////////////////////////////////////////////////////////////////
23
24
25#include "TTask.h"
26#include "TTree.h"
27#include "TSystem.h"
28#include "TFile.h"
29
5919c40c 30#include "AliTOFHitMap.h"
31#include "AliTOFSDigit.h"
f73548c4 32#include "AliTOFConstants.h"
517b7f8f 33#include "AliTOFhit.h"
34#include "AliTOF.h"
35#include "AliTOFv1.h"
36#include "AliTOFv2.h"
37#include "AliTOFv3.h"
38#include "AliTOFv4.h"
39#include "AliTOFSDigitizer.h"
40#include "AliRun.h"
41#include "AliDetector.h"
42#include "AliMC.h"
43
44#include "TFile.h"
45#include "TTask.h"
46#include "TTree.h"
47#include "TSystem.h"
48#include "TROOT.h"
49#include "TFolder.h"
f73548c4 50#include <TF1.h>
517b7f8f 51#include <stdlib.h>
52#include <iostream.h>
53#include <fstream.h>
54
55ClassImp(AliTOFSDigitizer)
56
57//____________________________________________________________________________
58 AliTOFSDigitizer::AliTOFSDigitizer():TTask("AliTOFSDigitizer","")
59{
60 // ctor
61 fNevents = 0 ;
5919c40c 62// fSDigits = 0 ;
517b7f8f 63 fHits = 0 ;
f73548c4 64 ftail = 0;
517b7f8f 65}
66
67//____________________________________________________________________________
68 AliTOFSDigitizer::AliTOFSDigitizer(char* HeaderFile,char *SdigitsFile ):TTask("AliTOFSDigitizer","")
69{
70 fNevents = 0 ; // Number of events to digitize, 0 means all evens in current file
f73548c4 71 ftail = 0;
72
73 // init parameters for sdigitization
74 InitParameters();
75
517b7f8f 76 // add Task to //root/Tasks folder
77 TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ;
78 roottasks->Add(this) ;
79}
80
81//____________________________________________________________________________
82 AliTOFSDigitizer::~AliTOFSDigitizer()
83{
84 // dtor
f73548c4 85 if (ftail)
86 {
87 delete ftail;
88 ftail = 0;
89 }
90}
91
92//____________________________________________________________________________
93void AliTOFSDigitizer::InitParameters()
94{
95 // set parameters for detector simulation
96
97 fTimeResolution =0.120;
98 fpadefficiency =0.99 ;
99 fEdgeEffect = 2 ;
100 fEdgeTails = 0 ;
101 fHparameter = 0.4 ;
102 fH2parameter = 0.15;
103 fKparameter = 0.5 ;
104 fK2parameter = 0.35;
105 fEffCenter = fpadefficiency;
106 fEffBoundary = 0.65;
107 fEff2Boundary = 0.90;
108 fEff3Boundary = 0.08;
109 fResCenter = 50. ;
110 fResBoundary = 70. ;
111 fResSlope = 40. ;
112 fTimeWalkCenter = 0. ;
113 fTimeWalkBoundary=0. ;
114 fTimeWalkSlope = 0. ;
115 fTimeDelayFlag = 1 ;
116 fPulseHeightSlope=2.0 ;
117 fTimeDelaySlope =0.060;
118 // was fMinimumCharge = TMath::Exp(fPulseHeightSlope*fKparameter/2.);
119 fMinimumCharge = TMath::Exp(-fPulseHeightSlope*fHparameter);
120 fChargeSmearing=0.0 ;
121 fLogChargeSmearing=0.13;
122 fTimeSmearing =0.022;
123 fAverageTimeFlag=0 ;
124
125}
126
127//__________________________________________________________________
128Double_t TimeWithTail(Double_t* x, Double_t* par)
129{
130 // sigma - par[0], alpha - par[1], part - par[2]
131 // at x<part*sigma - gauss
132 // at x>part*sigma - TMath::Exp(-x/alpha)
133 Float_t xx =x[0];
134 Double_t f;
135 if(xx<par[0]*par[2]) {
136 f = TMath::Exp(-xx*xx/(2*par[0]*par[0]));
137 } else {
138 f = TMath::Exp(-(xx-par[0]*par[2])/par[1]-0.5*par[2]*par[2]);
139 }
140 return f;
517b7f8f 141}
142
f73548c4 143
517b7f8f 144//____________________________________________________________________________
145void AliTOFSDigitizer::Exec(Option_t *option) {
146
147
517b7f8f 148 AliTOF *TOF = (AliTOF *) gAlice->GetDetector ("TOF");
149
5919c40c 150 if (!TOF) {
151 Error("AliTOFSDigitizer","TOF not found");
152 return;
153 }
154
f73548c4 155 if (fEdgeTails) ftail = new TF1("tail",TimeWithTail,-2,2,3);
156
517b7f8f 157 if (fNevents == 0)
5919c40c 158 fNevents = (Int_t) gAlice->TreeE()->GetEntries();
517b7f8f 159
5919c40c 160 for (Int_t ievent = 0; ievent < fNevents; ievent++) {
161 gAlice->GetEvent(ievent);
162 TTree *TH = gAlice->TreeH ();
163 if (!TH)
164 return;
165 if (gAlice->TreeS () == 0)
166 gAlice->MakeTree ("S");
517b7f8f 167
168
5919c40c 169 //Make branches
170 char branchname[20];
171 sprintf (branchname, "%s", TOF->GetName ());
172 //Make branch for digits
173 TOF->MakeBranch ("S");
517b7f8f 174
5919c40c 175 //Now made SDigits from hits
176
177 Int_t vol[5]; // location for a digit
178 Float_t digit[2]; // TOF digit variables
179 TParticle *particle;
180 AliTOFhit *tofHit;
181 TClonesArray *TOFhits = TOF->Hits();
182
f73548c4 183 // create hit map
5919c40c 184 AliTOFHitMap *hitMap = new AliTOFHitMap(TOF->SDigits());
185
186 Int_t ntracks = static_cast<Int_t>(TH->GetEntries());
187 for (Int_t track = 0; track < ntracks; track++)
188 {
189 gAlice->ResetHits();
190 TH->GetEvent(track);
191 particle = gAlice->Particle(track);
192 Int_t nhits = TOFhits->GetEntriesFast();
f73548c4 193 // cleaning all hits of the same track in the same pad volume
194 // it is a rare event, however it happens
195
196 Int_t previousTrack =0;
197 Int_t previousSector=0;
198 Int_t previousPlate =0;
199 Int_t previousStrip =0;
200 Int_t previousPadX =0;
201 Int_t previousPadZ =0;
5919c40c 202
203 for (Int_t hit = 0; hit < nhits; hit++)
204 {
205 tofHit = (AliTOFhit *) TOFhits->UncheckedAt(hit);
f73548c4 206 Int_t tracknum = tofHit->GetTrack();
5919c40c 207 vol[0] = tofHit->GetSector();
208 vol[1] = tofHit->GetPlate();
209 vol[2] = tofHit->GetStrip();
210 vol[3] = tofHit->GetPadx();
211 vol[4] = tofHit->GetPadz();
212
f73548c4 213 Bool_t isCloneOfThePrevious=((tracknum==previousTrack) && (vol[0]==previousSector) && (vol[1]==previousPlate) && (vol[2]==previousStrip) && (vol[3]==previousPadX) && (vol[4]==previousPadZ));
214
215 if(!isCloneOfThePrevious){
216 // update "previous" values
217 // in fact, we are yet in the future, so the present is past
218 previousTrack=tracknum;
219 previousSector=vol[0];
220 previousPlate=vol[1];
221 previousStrip=vol[2];
222 previousPadX=vol[3];
223 previousPadZ=vol[4];
5919c40c 224
f73548c4 225 // 95% of efficiency to be inserted here
226 // edge effect to be inserted here
227 // cross talk to be inserted here
228
229 Float_t idealtime = tofHit->GetTof(); // unit s
230 idealtime *= 1.E+12; // conversion from s to ps
231 // fTimeRes is given usually in ps
232 Float_t tdctime = gRandom->Gaus(idealtime, TOF->GetTimeRes());
233 digit[0] = tdctime;
234
235 // typical Landau Distribution to be inserted here
236 // instead of Gaussian Distribution
237 Float_t idealcharge = tofHit->GetEdep();
238 Float_t adccharge = gRandom->Gaus(idealcharge, TOF->GetChrgRes());
239 digit[1] = adccharge;
240
241 // check if two digit are on the same pad; in that case we sum
242 // the two or more digits
243 if (hitMap->TestHit(vol) != kEmpty) {
244 AliTOFSDigit *sdig = static_cast<AliTOFSDigit*>(hitMap->GetHit(vol));
245 sdig->Update(tdctime,adccharge,tracknum);
246 } else {
247 TOF->AddSDigit(tracknum, vol, digit);
248 hitMap->SetHit(vol);
249 }
250 } // close if(!isCloneOfThePrevious)
5919c40c 251 } // end loop on hits for the current track
252 } // end loop on ntracks
253
254 delete hitMap;
517b7f8f 255
5919c40c 256 gAlice->TreeS()->Reset();
257 gAlice->TreeS()->Fill();
258 gAlice->TreeS()->Write(0,TObject::kOverwrite) ;
259 } //event loop
517b7f8f 260
261
262}
263
264//__________________________________________________________________
265void AliTOFSDigitizer::SetSDigitsFile(char * file ){
266 if(!fSDigitsFile.IsNull())
267 cout << "Changing SDigits file from " <<(char *)fSDigitsFile.Data() << " to " << file << endl ;
268 fSDigitsFile=file ;
269}
270//__________________________________________________________________
271void AliTOFSDigitizer::Print(Option_t* option)const
272{
273 cout << "------------------- "<< GetName() << " -------------" << endl ;
274 if(fSDigitsFile.IsNull())
275 cout << " Writing SDigitis to file galice.root "<< endl ;
276 else
277 cout << " Writing SDigitis to file " << (char*) fSDigitsFile.Data() << endl ;
278
279}
f73548c4 280
281//__________________________________________________________________
282void AliTOFSDigitizer::SimulateDetectorResponse(Float_t z0, Float_t x0, Float_t geantTime, Int_t& nActivatedPads, Int_t& nFiredPads, Bool_t* isFired, Int_t* nPlace, Float_t* qInduced, Float_t* tofTime, Float_t& averageTime)
283{
284 // Description:
285 // Input: z0, x0 - hit position in the strip system (0,0 - center of the strip), cm
286 // geantTime - time generated by Geant, ns
287 // Output: nActivatedPads - the number of pads activated by the hit (1 || 2 || 4)
288 // nFiredPads - the number of pads fired (really activated) by the hit (nFiredPads <= nActivatedPads)
289 // qInduced[iPad]- charge induced on pad, arb. units
290 // this array is initialized at zero by the caller
291 // tofAfterSimul[iPad] - time calculated with edge effect algorithm, ns
292 // this array is initialized at zero by the caller
293 // averageTime - time given by pad hited by the Geant track taking into account the times (weighted) given by the pads fired for edge effect also.
294 // The weight is given by the qInduced[iPad]/qCenterPad
295 // this variable is initialized at zero by the caller
296 // nPlace[iPad] - the number of the pad place, iPad = 0, 1, 2, 3
297 // this variable is initialized at zero by the caller
298 //
299 // Description of used variables:
300 // eff[iPad] - efficiency of the pad
301 // res[iPad] - resolution of the pad, ns
302 // timeWalk[iPad] - time walk of the pad, ns
303 // timeDelay[iPad] - time delay for neighbouring pad to hited pad, ns
304 // PadId[iPad] - Pad Identifier
305 // E | F --> PadId[iPad] = 5 | 6
306 // A | B --> PadId[iPad] = 1 | 2
307 // C | D --> PadId[iPad] = 3 | 4
308 // nTail[iPad] - the tail number, = 1 for tailA, = 2 for tailB
309 // qCenterPad - charge extimated for each pad, arb. units
310 // weightsSum - sum of weights extimated for each pad fired, arb. units
311
312 const Float_t kSigmaForTail[2] = {AliTOFConstants::fgkSigmaForTail1,AliTOFConstants::fgkSigmaForTail2}; //for tail
313 Int_t iz = 0, ix = 0;
314 Float_t dX = 0., dZ = 0., x = 0., z = 0.;
315 Float_t h = fHparameter, h2 = fH2parameter, k = fKparameter, k2 = fK2parameter;
316 Float_t effX = 0., effZ = 0., resX = 0., resZ = 0., timeWalkX = 0., timeWalkZ = 0.;
317 Float_t logOfqInd = 0.;
318 Float_t weightsSum = 0.;
319 Int_t nTail[4] = {0,0,0,0};
320 Int_t padId[4] = {0,0,0,0};
321 Float_t eff[4] = {0.,0.,0.,0.};
322 Float_t res[4] = {0.,0.,0.,0.};
323 // Float_t qCenterPad = fMinimumCharge * fMinimumCharge;
324 Float_t qCenterPad = 1.;
325 Float_t timeWalk[4] = {0.,0.,0.,0.};
326 Float_t timeDelay[4] = {0.,0.,0.,0.};
327
328 nActivatedPads = 0;
329 nFiredPads = 0;
330
331 (z0 <= 0) ? iz = 0 : iz = 1;
332 dZ = z0 + (0.5 * AliTOFConstants::fgkNpadZ - iz - 0.5) * AliTOFConstants::fgkZPad; // hit position in the pad frame, (0,0) - center of the pad
333 z = 0.5 * AliTOFConstants::fgkZPad - TMath::Abs(dZ); // variable for eff., res. and timeWalk. functions
334 iz++; // z row: 1, ..., AliTOFConstants::fgkNpadZ = 2
335 ix = (Int_t)((x0 + 0.5 * AliTOFConstants::fgkNpadX * AliTOFConstants::fgkXPad) / AliTOFConstants::fgkXPad);
336 dX = x0 + (0.5 * AliTOFConstants::fgkNpadX - ix - 0.5) * AliTOFConstants::fgkXPad; // hit position in the pad frame, (0,0) - center of the pad
337 x = 0.5 * AliTOFConstants::fgkXPad - TMath::Abs(dX); // variable for eff., res. and timeWalk. functions;
338 ix++; // x row: 1, ..., AliTOFConstants::fgkNpadX = 48
339
340 ////// Pad A:
341 nActivatedPads++;
342 nPlace[nActivatedPads-1] = (iz - 1) * AliTOFConstants::fgkNpadX + ix;
343 qInduced[nActivatedPads-1] = qCenterPad;
344 padId[nActivatedPads-1] = 1;
345
346 if (fEdgeEffect == 0) {
347 eff[nActivatedPads-1] = fEffCenter;
348 if (gRandom->Rndm() < eff[nActivatedPads-1]) {
349 nFiredPads = 1;
350 res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + fResCenter * fResCenter); // 10400=30^2+20^2+40^2+50^2+50^2+50^2 ns;
351 isFired[nActivatedPads-1] = kTRUE;
352 tofTime[nActivatedPads-1] = gRandom->Gaus(geantTime + fTimeWalkCenter, res[0]);
353 averageTime = tofTime[nActivatedPads-1];
354 }
355 } else {
356
357 if(z < h) {
358 if(z < h2) {
359 effZ = fEffBoundary + (fEff2Boundary - fEffBoundary) * z / h2;
360 } else {
361 effZ = fEff2Boundary + (fEffCenter - fEff2Boundary) * (z - h2) / (h - h2);
362 }
363 resZ = fResBoundary + (fResCenter - fResBoundary) * z / h;
364 timeWalkZ = fTimeWalkBoundary + (fTimeWalkCenter - fTimeWalkBoundary) * z / h;
365 nTail[nActivatedPads-1] = 1;
366 } else {
367 effZ = fEffCenter;
368 resZ = fResCenter;
369 timeWalkZ = fTimeWalkCenter;
370 }
371
372 if(x < h) {
373 if(x < h2) {
374 effX = fEffBoundary + (fEff2Boundary - fEffBoundary) * x / h2;
375 } else {
376 effX = fEff2Boundary + (fEffCenter - fEff2Boundary) * (x - h2) / (h - h2);
377 }
378 resX = fResBoundary + (fResCenter - fResBoundary) * x / h;
379 timeWalkX = fTimeWalkBoundary + (fTimeWalkCenter - fTimeWalkBoundary) * x / h;
380 nTail[nActivatedPads-1] = 1;
381 } else {
382 effX = fEffCenter;
383 resX = fResCenter;
384 timeWalkX = fTimeWalkCenter;
385 }
386
387 (effZ<effX) ? eff[nActivatedPads-1] = effZ : eff[nActivatedPads-1] = effX;
388 (resZ<resX) ? res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resX * resX) : res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resZ * resZ); // 10400=30^2+20^2+40^2+50^2+50^2+50^2 ns
389 (timeWalkZ<timeWalkX) ? timeWalk[nActivatedPads-1] = 0.001 * timeWalkZ : timeWalk[nActivatedPads-1] = 0.001 * timeWalkX; // ns
390
391
392 ////// Pad B:
393 if(z < k2) {
394 effZ = fEffBoundary - (fEffBoundary - fEff3Boundary) * (z / k2);
395 } else {
396 effZ = fEff3Boundary * (k - z) / (k - k2);
397 }
398 resZ = fResBoundary + fResSlope * z / k;
399 timeWalkZ = fTimeWalkBoundary + fTimeWalkSlope * z / k;
400
401 if(z < k && z > 0) {
402 if( (iz == 1 && dZ > 0) || (iz == 2 && dZ < 0) ) {
403 nActivatedPads++;
404 nPlace[nActivatedPads-1] = nPlace[0] + (3 - 2 * iz) * AliTOFConstants::fgkNpadX;
405 eff[nActivatedPads-1] = effZ;
406 res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resZ * resZ); // 10400=30^2+20^2+40^2+50^2+50^2+50^2 ns
407 timeWalk[nActivatedPads-1] = 0.001 * timeWalkZ; // ns
408 nTail[nActivatedPads-1] = 2;
409 if (fTimeDelayFlag) {
410 // qInduced[0] = fMinimumCharge * TMath::Exp(fPulseHeightSlope * z / 2.);
411 // qInduced[nActivatedPads-1] = fMinimumCharge * TMath::Exp(-fPulseHeightSlope * z / 2.);
412 qInduced[nActivatedPads-1] = TMath::Exp(-fPulseHeightSlope * z);
413 logOfqInd = gRandom->Gaus(-fPulseHeightSlope * z, fLogChargeSmearing);
414 timeDelay[nActivatedPads-1] = gRandom->Gaus(-fTimeDelaySlope * logOfqInd, fTimeSmearing);
415 } else {
416 timeDelay[nActivatedPads-1] = 0.;
417 }
418 padId[nActivatedPads-1] = 2;
419 }
420 }
421
422
423 ////// Pad C, D, E, F:
424 if(x < k2) {
425 effX = fEffBoundary - (fEffBoundary - fEff3Boundary) * (x / k2);
426 } else {
427 effX = fEff3Boundary * (k - x) / (k - k2);
428 }
429 resX = fResBoundary + fResSlope*x/k;
430 timeWalkX = fTimeWalkBoundary + fTimeWalkSlope*x/k;
431
432 if(x < k && x > 0) {
433 // C:
434 if(ix > 1 && dX < 0) {
435 nActivatedPads++;
436 nPlace[nActivatedPads-1] = nPlace[0] - 1;
437 eff[nActivatedPads-1] = effX;
438 res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resX * resX); // 10400=30^2+20^2+40^2+50^2+50^2+50^2 ns
439 timeWalk[nActivatedPads-1] = 0.001 * timeWalkX; // ns
440 nTail[nActivatedPads-1] = 2;
441 if (fTimeDelayFlag) {
442 // qInduced[0] = fMinimumCharge * TMath::Exp(fPulseHeightSlope * x / 2.);
443 // qInduced[nActivatedPads-1] = fMinimumCharge * TMath::Exp(-fPulseHeightSlope * x / 2.);
444 qInduced[nActivatedPads-1] = TMath::Exp(-fPulseHeightSlope * x);
445 logOfqInd = gRandom->Gaus(-fPulseHeightSlope * x, fLogChargeSmearing);
446 timeDelay[nActivatedPads-1] = gRandom->Gaus(-fTimeDelaySlope * logOfqInd, fTimeSmearing);
447 } else {
448 timeDelay[nActivatedPads-1] = 0.;
449 }
450 padId[nActivatedPads-1] = 3;
451
452 // D:
453 if(z < k && z > 0) {
454 if( (iz == 1 && dZ > 0) || (iz == 2 && dZ < 0) ) {
455 nActivatedPads++;
456 nPlace[nActivatedPads-1] = nPlace[0] + (3 - 2 * iz) * AliTOFConstants::fgkNpadX - 1;
457 eff[nActivatedPads-1] = effX * effZ;
458 (resZ<resX) ? res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resX * resX) : res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resZ * resZ); // 10400=30^2+20^2+40^2+50^2+50^2+50^2 ns
459 (timeWalkZ<timeWalkX) ? timeWalk[nActivatedPads-1] = 0.001 * timeWalkZ : timeWalk[nActivatedPads-1] = 0.001 * timeWalkX; // ns
460
461 nTail[nActivatedPads-1] = 2;
462 if (fTimeDelayFlag) {
463 if (TMath::Abs(x) < TMath::Abs(z)) {
464 // qInduced[0] = fMinimumCharge * TMath::Exp(fPulseHeightSlope * z / 2.);
465 // qInduced[nActivatedPads-1] = fMinimumCharge * TMath::Exp(-fPulseHeightSlope * z / 2.);
466 qInduced[nActivatedPads-1] = TMath::Exp(-fPulseHeightSlope * z);
467 logOfqInd = gRandom->Gaus(-fPulseHeightSlope * z, fLogChargeSmearing);
468 } else {
469 // qInduced[0] = fMinimumCharge * TMath::Exp(fPulseHeightSlope * x / 2.);
470 // qInduced[nActivatedPads-1] = fMinimumCharge * TMath::Exp(-fPulseHeightSlope * x / 2.);
471 qInduced[nActivatedPads-1] = TMath::Exp(-fPulseHeightSlope * x);
472 logOfqInd = gRandom->Gaus(-fPulseHeightSlope * x, fLogChargeSmearing);
473 }
474 timeDelay[nActivatedPads-1] = gRandom->Gaus(-fTimeDelaySlope * logOfqInd, fTimeSmearing);
475 } else {
476 timeDelay[nActivatedPads-1] = 0.;
477 }
478 padId[nActivatedPads-1] = 4;
479 }
480 } // end D
481 } // end C
482
483 // E:
484 if(ix < AliTOFConstants::fgkNpadX && dX > 0) {
485 nActivatedPads++;
486 nPlace[nActivatedPads-1] = nPlace[0] + 1;
487 eff[nActivatedPads-1] = effX;
488 res[nActivatedPads-1] = 0.001 * (TMath::Sqrt(10400 + resX * resX)); // ns
489 timeWalk[nActivatedPads-1] = 0.001 * timeWalkX; // ns
490 nTail[nActivatedPads-1] = 2;
491 if (fTimeDelayFlag) {
492 // qInduced[0] = fMinimumCharge * TMath::Exp(fPulseHeightSlope * x / 2.);
493 // qInduced[nActivatedPads-1] = fMinimumCharge * TMath::Exp(-fPulseHeightSlope * x / 2.);
494 qInduced[nActivatedPads-1] = TMath::Exp(-fPulseHeightSlope * x);
495 logOfqInd = gRandom->Gaus(-fPulseHeightSlope * x, fLogChargeSmearing);
496 timeDelay[nActivatedPads-1] = gRandom->Gaus(-fTimeDelaySlope * logOfqInd, fTimeSmearing);
497 } else {
498 timeDelay[nActivatedPads-1] = 0.;
499 }
500 padId[nActivatedPads-1] = 5;
501
502
503 // F:
504 if(z < k && z > 0) {
505 if( (iz == 1 && dZ > 0) || (iz == 2 && dZ < 0) ) {
506 nActivatedPads++;
507 nPlace[nActivatedPads - 1] = nPlace[0] + (3 - 2 * iz) * AliTOFConstants::fgkNpadX + 1;
508 eff[nActivatedPads - 1] = effX * effZ;
509 (resZ<resX) ? res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resX * resX) : res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resZ * resZ); // 10400=30^2+20^2+40^2+50^2+50^2+50^2 ns
510 (timeWalkZ<timeWalkX) ? timeWalk[nActivatedPads-1] = 0.001 * timeWalkZ : timeWalk[nActivatedPads-1] = 0.001*timeWalkX; // ns
511 nTail[nActivatedPads-1] = 2;
512 if (fTimeDelayFlag) {
513 if (TMath::Abs(x) < TMath::Abs(z)) {
514 // qInduced[0] = fMinimumCharge * TMath::Exp(fPulseHeightSlope * z / 2.);
515 // qInduced[nActivatedPads-1] = fMinimumCharge * TMath::Exp(-fPulseHeightSlope * z / 2.);
516 qInduced[nActivatedPads-1] = TMath::Exp(-fPulseHeightSlope * z);
517 logOfqInd = gRandom->Gaus(-fPulseHeightSlope * z, fLogChargeSmearing);
518 } else {
519 // qInduced[0] = fMinimumCharge * TMath::Exp(fPulseHeightSlope * x / 2.);
520 // qInduced[nActivatedPads-1] = fMinimumCharge * TMath::Exp(-fPulseHeightSlope * x / 2.);
521 qInduced[nActivatedPads-1] = TMath::Exp(-fPulseHeightSlope * x);
522 logOfqInd = gRandom->Gaus(-fPulseHeightSlope * x, fLogChargeSmearing);
523 }
524 timeDelay[nActivatedPads-1] = gRandom->Gaus(-fTimeDelaySlope * logOfqInd, fTimeSmearing);
525 } else {
526 timeDelay[nActivatedPads-1] = 0.;
527 }
528 padId[nActivatedPads-1] = 6;
529 }
530 } // end F
531 } // end E
532 } // end if(x < k)
533
534
535 for (Int_t iPad = 0; iPad < nActivatedPads; iPad++) {
536 if (res[iPad] < fTimeResolution) res[iPad] = fTimeResolution;
537 if(gRandom->Rndm() < eff[iPad]) {
538 isFired[iPad] = kTRUE;
539 nFiredPads++;
540 if(fEdgeTails) {
541 if(nTail[iPad] == 0) {
542 tofTime[iPad] = gRandom->Gaus(geantTime + timeWalk[iPad] + timeDelay[iPad], res[iPad]);
543 } else {
544 ftail->SetParameters(res[iPad], 2. * res[iPad], kSigmaForTail[nTail[iPad]-1]);
545 Double_t timeAB = ftail->GetRandom();
546 tofTime[iPad] = geantTime + timeWalk[iPad] + timeDelay[iPad] + timeAB;
547 }
548 } else {
549 tofTime[iPad] = gRandom->Gaus(geantTime + timeWalk[iPad] + timeDelay[iPad], res[iPad]);
550 }
551 if (fAverageTimeFlag) {
552 averageTime += tofTime[iPad] * qInduced[iPad];
553 weightsSum += qInduced[iPad];
554 } else {
555 averageTime += tofTime[iPad];
556 weightsSum += 1.;
557 }
558 }
559 }
560 if (weightsSum!=0) averageTime /= weightsSum;
561 } // end else (fEdgeEffect != 0)
562}
563
564//__________________________________________________________________
565void AliTOFSDigitizer::PrintParameters()const
566{
567 //
568 // Print parameters used for sdigitization
569 //
570 cout << " ------------------- "<< GetName() << " -------------" << endl ;
571 cout << " Parameters used for TOF SDigitization " << endl ;
572 // Printing the parameters
573
574 cout << " Number of events: " << fNevents << endl;
575
576 cout << " Time Resolution (ns) "<< fTimeResolution <<" Pad Efficiency: "<< fpadefficiency << endl;
577 cout << " Edge Effect option: "<< fEdgeEffect<< endl;
578
579 cout << " Boundary Effect Simulation Parameters " << endl;
580 cout << " Hparameter: "<< fHparameter<<" H2parameter:"<< fH2parameter <<" Kparameter:"<< fKparameter<<" K2parameter: "<< fK2parameter << endl;
581 cout << " Efficiency in the central region of the pad: "<< fEffCenter << endl;
582 cout << " Efficiency at the boundary region of the pad: "<< fEffBoundary << endl;
583 cout << " Efficiency value at H2parameter "<< fEff2Boundary << endl;
584 cout << " Efficiency value at K2parameter "<< fEff3Boundary << endl;
585 cout << " Resolution (ps) in the central region of the pad: "<< fResCenter << endl;
586 cout << " Resolution (ps) at the boundary of the pad : "<< fResBoundary << endl;
587 cout << " Slope (ps/K) for neighbouring pad : "<< fResSlope <<endl;
588 cout << " Time walk (ps) in the central region of the pad : "<< fTimeWalkCenter << endl;
589 cout << " Time walk (ps) at the boundary of the pad : "<< fTimeWalkBoundary<< endl;
590 cout << " Slope (ps/K) for neighbouring pad : "<< fTimeWalkSlope<<endl;
591 cout << " Pulse Heigth Simulation Parameters " << endl;
592 cout << " Flag for delay due to the PulseHeightEffect: "<< fTimeDelayFlag <<endl;
593 cout << " Pulse Height Slope : "<< fPulseHeightSlope<<endl;
594 cout << " Time Delay Slope : "<< fTimeDelaySlope<<endl;
595 cout << " Minimum charge amount which could be induced : "<< fMinimumCharge<<endl;
596 cout << " Smearing in charge in (q1/q2) vs x plot : "<< fChargeSmearing<<endl;
597 cout << " Smearing in log of charge ratio : "<< fLogChargeSmearing<<endl;
598 cout << " Smearing in time in time vs log(q1/q2) plot : "<< fTimeSmearing<<endl;
599 cout << " Flag for average time : "<< fAverageTimeFlag<<endl;
600 cout << " Edge tails option : "<< fEdgeTails << endl;
601
602}