]>
Commit | Line | Data |
---|---|---|
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 | ||
88cb7938 | 16 | /* $Id$ */ |
17 | ||
0e46b9ae | 18 | //__________________________________________________________// |
19 | // // | |
20 | // This is a TTask that constructs SDigits out of Hits // | |
21 | // A Summable Digits is the "sum" of all hits in a pad // | |
22 | // Detector response has been simulated via the method // | |
23 | // SimulateDetectorResponse // | |
24 | // // | |
25 | // -- Authors: F. Pierella, A. De Caro // | |
26 | // Use case: see AliTOFhits2sdigits.C macro in the CVS // | |
27 | //__________________________________________________________// | |
28 | ||
29 | #include "TBenchmark.h" | |
30 | #include "TF1.h" | |
31 | #include "TFile.h" | |
32 | #include "TParticle.h" | |
33 | #include "TTree.h" | |
88cb7938 | 34 | |
88cb7938 | 35 | #include "AliLoader.h" |
0e46b9ae | 36 | #include "AliLog.h" |
d3c7bfac | 37 | #include "AliMC.h" |
88cb7938 | 38 | #include "AliRunLoader.h" |
0e46b9ae | 39 | #include "AliRun.h" |
d3c7bfac | 40 | |
0f4a7374 | 41 | #include "AliTOFGeometry.h" |
5919c40c | 42 | #include "AliTOFHitMap.h" |
016e1f91 | 43 | #include "AliTOFhitT0.h" |
0e46b9ae | 44 | #include "AliTOFhit.h" |
45 | #include "AliTOFSDigitizer.h" | |
46 | #include "AliTOFSDigit.h" | |
47 | #include "AliTOF.h" | |
48 | ||
49 | extern TBenchmark *gBenchmark; | |
50 | extern TDirectory *gDirectory; | |
51 | extern TFile *gFile; | |
52 | extern TRandom *gRandom; | |
53 | extern TROOT *gROOT; | |
54 | ||
55 | extern AliRun *gAlice; | |
56 | ||
517b7f8f | 57 | |
58 | ClassImp(AliTOFSDigitizer) | |
59 | ||
60 | //____________________________________________________________________________ | |
797e311f | 61 | AliTOFSDigitizer::AliTOFSDigitizer():TTask("TOFSDigitizer","") |
517b7f8f | 62 | { |
63 | // ctor | |
88cb7938 | 64 | |
d61f73d9 | 65 | fRunLoader = 0; |
66 | fTOFLoader = 0; | |
88cb7938 | 67 | |
d61f73d9 | 68 | fEvent1 = 0; |
69 | fEvent2 = 0; | |
70 | ftail = 0; | |
71 | fSelectedSector = -1; | |
72 | fSelectedPlate = -1; | |
d3c7bfac | 73 | |
74 | fTOFGeometry = new AliTOFGeometry(); | |
75 | ||
517b7f8f | 76 | } |
d61f73d9 | 77 | |
7aeeaf38 | 78 | //------------------------------------------------------------------------ |
79 | AliTOFSDigitizer::AliTOFSDigitizer(const AliTOFSDigitizer &source) | |
80 | :TTask(source) | |
81 | { | |
82 | // copy constructor | |
83 | this->fTOFGeometry=source.fTOFGeometry; | |
84 | ||
85 | } | |
86 | ||
87 | //____________________________________________________________________________ | |
88 | AliTOFSDigitizer& AliTOFSDigitizer::operator=(const AliTOFSDigitizer &source) | |
89 | { | |
90 | // ass. op. | |
91 | this->fTOFGeometry=source.fTOFGeometry; | |
92 | return *this; | |
93 | ||
94 | } | |
95 | ||
517b7f8f | 96 | //____________________________________________________________________________ |
797e311f | 97 | AliTOFSDigitizer::AliTOFSDigitizer(const char* HeaderFile, Int_t evNumber1, Int_t nEvents):TTask("TOFSDigitizer","") |
517b7f8f | 98 | { |
340693af | 99 | //ctor, reading from input file |
f73548c4 | 100 | ftail = 0; |
d61f73d9 | 101 | fSelectedSector=-1; // by default we sdigitize all sectors |
102 | fSelectedPlate =-1; // by default we sdigitize all plates in all sectors | |
103 | ||
ea7a588a | 104 | fHeadersFile = HeaderFile ; // input filename (with hits) |
d61f73d9 | 105 | TFile * file = (TFile*) gROOT->GetFile(fHeadersFile.Data()); |
106 | ||
107 | //File was not opened yet open file and get alirun object | |
108 | if (file == 0) { | |
109 | file = TFile::Open(fHeadersFile.Data(),"update") ; | |
110 | gAlice = (AliRun *) file->Get("gAlice") ; | |
ea7a588a | 111 | } |
26e447bd | 112 | |
517b7f8f | 113 | // add Task to //root/Tasks folder |
e191bb57 | 114 | TString evfoldname = AliConfig::GetDefaultEventFolderName(); |
f540341d | 115 | fRunLoader = AliRunLoader::GetRunLoader(evfoldname); |
116 | if (!fRunLoader) | |
117 | fRunLoader = AliRunLoader::Open(HeaderFile);//open session and mount on default event folder | |
88cb7938 | 118 | if (fRunLoader == 0x0) |
d61f73d9 | 119 | { |
d076c8d5 | 120 | AliFatal("Event is not loaded. Exiting"); |
d61f73d9 | 121 | return; |
122 | } | |
26e447bd | 123 | |
d3c7bfac | 124 | fRunLoader->CdGAFile(); |
125 | TDirectory *savedir=gDirectory; | |
126 | TFile *in=(TFile*)gFile; | |
127 | ||
128 | if (!in->IsOpen()) { | |
129 | AliWarning("Geometry file is not open default TOF geometry will be used"); | |
130 | fTOFGeometry = new AliTOFGeometry(); | |
131 | } | |
132 | else { | |
133 | in->cd(); | |
134 | fTOFGeometry = (AliTOFGeometry*)in->Get("TOFgeometry"); | |
135 | } | |
136 | ||
137 | savedir->cd(); | |
138 | ||
f540341d | 139 | if (fRunLoader->TreeE() == 0x0) fRunLoader->LoadHeader(); |
d61f73d9 | 140 | |
141 | if (evNumber1>=0) fEvent1 = evNumber1; | |
142 | else fEvent1=0; | |
143 | ||
144 | if (nEvents==0) fEvent2 = (Int_t)(fRunLoader->GetNumberOfEvents()); | |
145 | else if (nEvents>0) fEvent2 = evNumber1+nEvents; | |
146 | else fEvent2 = 1; | |
147 | ||
148 | if (!(fEvent2>fEvent1)) { | |
d076c8d5 | 149 | AliError(Form("fEvent2 = %d <= fEvent1 = %d", fEvent2, fEvent1)); |
d61f73d9 | 150 | fEvent1 = 0; |
151 | fEvent2 = 1; | |
d076c8d5 | 152 | AliError(Form("Correction: fEvent2 = %d <= fEvent1 = %d", fEvent2, fEvent1)); |
26e447bd | 153 | } |
d61f73d9 | 154 | |
26e447bd | 155 | // init parameters for sdigitization |
156 | InitParameters(); | |
d61f73d9 | 157 | |
158 | fTOFLoader = fRunLoader->GetLoader("TOFLoader"); | |
159 | if (fTOFLoader == 0x0) | |
160 | { | |
d076c8d5 | 161 | AliFatal("Can not find TOF loader in event. Exiting."); |
d61f73d9 | 162 | return; |
163 | } | |
164 | fTOFLoader->PostSDigitizer(this); | |
517b7f8f | 165 | } |
166 | ||
167 | //____________________________________________________________________________ | |
d61f73d9 | 168 | AliTOFSDigitizer::~AliTOFSDigitizer() |
517b7f8f | 169 | { |
170 | // dtor | |
797e311f | 171 | fTOFLoader->CleanSDigitizer(); |
d3c7bfac | 172 | |
afd804a3 | 173 | delete fTOFGeometry; |
d3c7bfac | 174 | |
f73548c4 | 175 | } |
176 | ||
177 | //____________________________________________________________________________ | |
178 | void AliTOFSDigitizer::InitParameters() | |
179 | { | |
180 | // set parameters for detector simulation | |
d61f73d9 | 181 | |
7e6dce66 | 182 | fTimeResolution = 0.080; //0.120; OLD |
183 | fpadefficiency = 0.99 ; | |
f73548c4 | 184 | fEdgeEffect = 2 ; |
185 | fEdgeTails = 0 ; | |
186 | fHparameter = 0.4 ; | |
187 | fH2parameter = 0.15; | |
188 | fKparameter = 0.5 ; | |
189 | fK2parameter = 0.35; | |
190 | fEffCenter = fpadefficiency; | |
191 | fEffBoundary = 0.65; | |
192 | fEff2Boundary = 0.90; | |
193 | fEff3Boundary = 0.08; | |
8d6daa31 | 194 | fAddTRes = 68. ; // \sqrt{2x20^2 + 15^2 + 2x10^2 + 30^2 + 50^2} (p-p) |
195 | //fAddTRes = 48. ; // \sqrt{2x20^2 + 15^2 + 2x10^2 + 30^2 + 15^2} (Pb-Pb) | |
7e6dce66 | 196 | // 30^2+20^2+40^2+50^2+50^2+50^2 = 10400 ps^2 (very old value) |
197 | fResCenter = 35. ; //50. ; // OLD | |
f73548c4 | 198 | fResBoundary = 70. ; |
7e6dce66 | 199 | fResSlope = 37. ; //40. ; // OLD |
f73548c4 | 200 | fTimeWalkCenter = 0. ; |
201 | fTimeWalkBoundary=0. ; | |
202 | fTimeWalkSlope = 0. ; | |
203 | fTimeDelayFlag = 1 ; | |
204 | fPulseHeightSlope=2.0 ; | |
205 | fTimeDelaySlope =0.060; | |
206 | // was fMinimumCharge = TMath::Exp(fPulseHeightSlope*fKparameter/2.); | |
207 | fMinimumCharge = TMath::Exp(-fPulseHeightSlope*fHparameter); | |
208 | fChargeSmearing=0.0 ; | |
209 | fLogChargeSmearing=0.13; | |
210 | fTimeSmearing =0.022; | |
211 | fAverageTimeFlag=0 ; | |
43f77f2d | 212 | |
d61f73d9 | 213 | fAdcBin = 0.25; // 1 ADC bin = 0.25 pC (or 0.03 pC) |
ea7a588a | 214 | fAdcMean = 50.; // ADC distribution mpv value for Landau (in bins) |
215 | // it corresponds to a mean value of ~100 bins | |
216 | fAdcRms = 25.; // ADC distribution rms value (in bins) | |
217 | // it corresponds to distribution rms ~50 bins | |
f73548c4 | 218 | } |
219 | ||
220 | //__________________________________________________________________ | |
ea7a588a | 221 | Double_t TimeWithTail(Double_t* x, Double_t* par) |
f73548c4 | 222 | { |
223 | // sigma - par[0], alpha - par[1], part - par[2] | |
224 | // at x<part*sigma - gauss | |
225 | // at x>part*sigma - TMath::Exp(-x/alpha) | |
226 | Float_t xx =x[0]; | |
227 | Double_t f; | |
228 | if(xx<par[0]*par[2]) { | |
229 | f = TMath::Exp(-xx*xx/(2*par[0]*par[0])); | |
230 | } else { | |
231 | f = TMath::Exp(-(xx-par[0]*par[2])/par[1]-0.5*par[2]*par[2]); | |
232 | } | |
233 | return f; | |
517b7f8f | 234 | } |
235 | ||
236 | //____________________________________________________________________________ | |
d61f73d9 | 237 | void AliTOFSDigitizer::Exec(Option_t *verboseOption) { |
340693af | 238 | //execute TOF sdigitization |
d61f73d9 | 239 | if (strstr(verboseOption,"tim") || strstr(verboseOption,"all")) |
ea7a588a | 240 | gBenchmark->Start("TOFSDigitizer"); |
517b7f8f | 241 | |
ea7a588a | 242 | if (fEdgeTails) ftail = new TF1("tail",TimeWithTail,-2,2,3); |
d61f73d9 | 243 | |
ea7a588a | 244 | Int_t nselectedHits=0; |
245 | Int_t ntotalsdigits=0; | |
246 | Int_t ntotalupdates=0; | |
247 | Int_t nnoisesdigits=0; | |
248 | Int_t nsignalsdigits=0; | |
249 | Int_t nHitsFromPrim=0; | |
250 | Int_t nHitsFromSec=0; | |
251 | Int_t nlargeTofDiff=0; | |
f73548c4 | 252 | |
da3d3acd | 253 | Bool_t thereIsNotASelection=(fSelectedSector==-1) && (fSelectedPlate==-1); |
55991c8b | 254 | |
f540341d | 255 | if (fRunLoader->GetAliRun() == 0x0) fRunLoader->LoadgAlice(); |
d61f73d9 | 256 | gAlice = fRunLoader->GetAliRun(); |
ea7a588a | 257 | |
d61f73d9 | 258 | fRunLoader->LoadKinematics(); |
259 | ||
7e6dce66 | 260 | AliTOF *tof = (AliTOF *) gAlice->GetDetector("TOF"); |
d61f73d9 | 261 | |
7e6dce66 | 262 | if (!tof) { |
d076c8d5 | 263 | AliError("TOF not found"); |
d61f73d9 | 264 | return; |
265 | } | |
266 | ||
267 | fTOFLoader->LoadHits("read"); | |
268 | fTOFLoader->LoadSDigits("recreate"); | |
269 | ||
270 | for (Int_t iEvent=fEvent1; iEvent<fEvent2; iEvent++) { | |
0e46b9ae | 271 | //AliInfo(Form("------------------- %s -------------", GetName())); |
272 | //AliInfo(Form("Sdigitizing event %i", iEvent)); | |
517b7f8f | 273 | |
d61f73d9 | 274 | fRunLoader->GetEvent(iEvent); |
275 | ||
7e6dce66 | 276 | TTree *hitTree = fTOFLoader->TreeH (); |
277 | if (!hitTree) return; | |
517b7f8f | 278 | |
d61f73d9 | 279 | if (fTOFLoader->TreeS () == 0) fTOFLoader->MakeTree ("S"); |
280 | ||
5919c40c | 281 | //Make branch for digits |
7e6dce66 | 282 | tof->MakeBranch("S"); |
517b7f8f | 283 | |
d61f73d9 | 284 | // recreate TClonesArray fSDigits - for backward compatibility |
7e6dce66 | 285 | if (tof->SDigits() == 0) { |
286 | tof->CreateSDigitsArray(); | |
d61f73d9 | 287 | } else { |
7e6dce66 | 288 | tof->RecreateSDigitsArray(); |
d61f73d9 | 289 | } |
5919c40c | 290 | |
7e6dce66 | 291 | tof->SetTreeAddress(); |
87e54ebb | 292 | |
7e6dce66 | 293 | Int_t version=tof->IsVersion(); |
d61f73d9 | 294 | |
295 | Int_t nselectedHitsinEv=0; | |
296 | Int_t ntotalsdigitsinEv=0; | |
297 | Int_t ntotalupdatesinEv=0; | |
298 | Int_t nnoisesdigitsinEv=0; | |
299 | Int_t nsignalsdigitsinEv=0; | |
016e1f91 | 300 | |
5919c40c | 301 | TParticle *particle; |
016e1f91 | 302 | //AliTOFhit *tofHit; |
7e6dce66 | 303 | TClonesArray *tofHitArray = tof->Hits(); |
5919c40c | 304 | |
f73548c4 | 305 | // create hit map |
d3c7bfac | 306 | AliTOFHitMap *hitMap = new AliTOFHitMap(tof->SDigits(), fTOFGeometry); |
5919c40c | 307 | |
7e6dce66 | 308 | TBranch * tofHitsBranch = hitTree->GetBranch("TOF"); |
bfec09a6 | 309 | |
7e6dce66 | 310 | Int_t ntracks = static_cast<Int_t>(hitTree->GetEntries()); |
5919c40c | 311 | for (Int_t track = 0; track < ntracks; track++) |
312 | { | |
313 | gAlice->ResetHits(); | |
d7ccea72 | 314 | tofHitsBranch->GetEvent(track); |
0e46b9ae | 315 | |
316 | AliMC *mcApplication = (AliMC*)gAlice->GetMCApp(); | |
317 | ||
318 | particle = mcApplication->Particle(track); | |
7e6dce66 | 319 | Int_t nhits = tofHitArray->GetEntriesFast(); |
f73548c4 | 320 | // cleaning all hits of the same track in the same pad volume |
321 | // it is a rare event, however it happens | |
322 | ||
d61f73d9 | 323 | Int_t previousTrack =-1; |
324 | Int_t previousSector=-1; | |
325 | Int_t previousPlate =-1; | |
326 | Int_t previousStrip =-1; | |
327 | Int_t previousPadX =-1; | |
328 | Int_t previousPadZ =-1; | |
5919c40c | 329 | |
d61f73d9 | 330 | for (Int_t hit = 0; hit < nhits; hit++) { |
016e1f91 | 331 | Int_t vol[5]; // location for a digit |
332 | Float_t digit[2]; // TOF digit variables | |
333 | Int_t tracknum; | |
7e6dce66 | 334 | Float_t dxPad; |
335 | Float_t dzPad; | |
016e1f91 | 336 | Float_t geantTime; |
337 | ||
338 | // fp: really sorry for this, it is a temporary trick to have | |
339 | // track length too | |
d3c7bfac | 340 | if(version!=6 && version!=7){ |
7e6dce66 | 341 | AliTOFhit *tofHit = (AliTOFhit *) tofHitArray->UncheckedAt(hit); |
016e1f91 | 342 | tracknum = tofHit->GetTrack(); |
343 | vol[0] = tofHit->GetSector(); | |
344 | vol[1] = tofHit->GetPlate(); | |
345 | vol[2] = tofHit->GetStrip(); | |
346 | vol[3] = tofHit->GetPadx(); | |
347 | vol[4] = tofHit->GetPadz(); | |
7e6dce66 | 348 | dxPad = tofHit->GetDx(); |
349 | dzPad = tofHit->GetDz(); | |
016e1f91 | 350 | geantTime = tofHit->GetTof(); // unit [s] |
351 | } else { | |
7e6dce66 | 352 | AliTOFhitT0 *tofHit = (AliTOFhitT0 *) tofHitArray->UncheckedAt(hit); |
016e1f91 | 353 | tracknum = tofHit->GetTrack(); |
354 | vol[0] = tofHit->GetSector(); | |
355 | vol[1] = tofHit->GetPlate(); | |
55991c8b | 356 | vol[2] = tofHit->GetStrip(); |
357 | vol[3] = tofHit->GetPadx(); | |
358 | vol[4] = tofHit->GetPadz(); | |
7e6dce66 | 359 | dxPad = tofHit->GetDx(); |
360 | dzPad = tofHit->GetDz(); | |
016e1f91 | 361 | geantTime = tofHit->GetTof(); // unit [s] |
362 | } | |
d61f73d9 | 363 | |
016e1f91 | 364 | geantTime *= 1.e+09; // conversion from [s] to [ns] |
d61f73d9 | 365 | |
016e1f91 | 366 | // selection case for sdigitizing only hits in a given plate of a given sector |
367 | if(thereIsNotASelection || (vol[0]==fSelectedSector && vol[1]==fSelectedPlate)){ | |
55991c8b | 368 | |
369 | Bool_t dummy=((tracknum==previousTrack) && (vol[0]==previousSector) && (vol[1]==previousPlate) && (vol[2]==previousStrip)); | |
370 | ||
371 | Bool_t isCloneOfThePrevious=dummy && ((vol[3]==previousPadX) && (vol[4]==previousPadZ)); | |
372 | ||
b213b8bd | 373 | Bool_t isNeighOfThePrevious=dummy && ((((vol[3]==previousPadX-1) || (vol[3]==previousPadX+1)) && (vol[4]==previousPadZ)) || ((vol[3]==previousPadX) && ((vol[4]==previousPadZ+1) || (vol[4]==previousPadZ-1)))); |
55991c8b | 374 | |
b213b8bd | 375 | if(!isCloneOfThePrevious && !isNeighOfThePrevious){ |
55991c8b | 376 | // update "previous" values |
377 | // in fact, we are yet in the future, so the present is past | |
378 | previousTrack=tracknum; | |
379 | previousSector=vol[0]; | |
380 | previousPlate=vol[1]; | |
381 | previousStrip=vol[2]; | |
382 | previousPadX=vol[3]; | |
383 | previousPadZ=vol[4]; | |
384 | ||
385 | nselectedHits++; | |
386 | nselectedHitsinEv++; | |
d61f73d9 | 387 | if (particle->GetFirstMother() < 0) nHitsFromPrim++; // counts hits due to primary particles |
55991c8b | 388 | |
7e6dce66 | 389 | Float_t xStrip=AliTOFGeometry::XPad()*(vol[3]+0.5-0.5*AliTOFGeometry::NpadX())+dxPad; |
390 | Float_t zStrip=AliTOFGeometry::ZPad()*(vol[4]+0.5-0.5*AliTOFGeometry::NpadZ())+dzPad; | |
016e1f91 | 391 | |
55991c8b | 392 | Int_t nActivatedPads = 0, nFiredPads = 0; |
393 | Bool_t isFired[4] = {kFALSE, kFALSE, kFALSE, kFALSE}; | |
394 | Float_t tofAfterSimul[4] = {0., 0., 0., 0.}; | |
395 | Float_t qInduced[4] = {0.,0.,0.,0.}; | |
396 | Int_t nPlace[4] = {0, 0, 0, 0}; | |
397 | Float_t averageTime = 0.; | |
398 | SimulateDetectorResponse(zStrip,xStrip,geantTime,nActivatedPads,nFiredPads,isFired,nPlace,qInduced,tofAfterSimul,averageTime); | |
399 | if(nFiredPads) { | |
400 | for(Int_t indexOfPad=0; indexOfPad<nActivatedPads; indexOfPad++) { | |
401 | if(isFired[indexOfPad]){ // the pad has fired | |
402 | Float_t timediff=geantTime-tofAfterSimul[indexOfPad]; | |
403 | ||
404 | if(timediff>=0.2) nlargeTofDiff++; | |
405 | ||
845fe446 | 406 | digit[0] = (Int_t) ((tofAfterSimul[indexOfPad]*1.e+03)/AliTOFGeometry::TdcBinWidth()); // TDC bin number (each bin -> 24.4 ps) |
55991c8b | 407 | |
408 | Float_t landauFactor = gRandom->Landau(fAdcMean, fAdcRms); | |
409 | digit[1] = (Int_t) (qInduced[indexOfPad] * landauFactor); // ADC bins (each bin -> 0.25 (or 0.03) pC) | |
d61f73d9 | 410 | |
55991c8b | 411 | // recalculate the volume only for neighbouring pads |
ea7a588a | 412 | if(indexOfPad){ |
0f4a7374 | 413 | (nPlace[indexOfPad]<=AliTOFGeometry::NpadX()) ? vol[4] = 0 : vol[4] = 1; |
414 | (nPlace[indexOfPad]<=AliTOFGeometry::NpadX()) ? vol[3] = nPlace[indexOfPad] - 1 : vol[3] = nPlace[indexOfPad] - AliTOFGeometry::NpadX() - 1; | |
ea7a588a | 415 | } |
d61f73d9 | 416 | // check if two sdigit are on the same pad; |
417 | // in that case we sum the two or more sdigits | |
55991c8b | 418 | if (hitMap->TestHit(vol) != kEmpty) { |
419 | AliTOFSDigit *sdig = static_cast<AliTOFSDigit*>(hitMap->GetHit(vol)); | |
420 | Int_t tdctime = (Int_t) digit[0]; | |
421 | Int_t adccharge = (Int_t) digit[1]; | |
43f77f2d | 422 | sdig->Update(AliTOFGeometry::TdcBinWidth(),tdctime,adccharge,tracknum); |
55991c8b | 423 | ntotalupdatesinEv++; |
424 | ntotalupdates++; | |
425 | } else { | |
426 | ||
7e6dce66 | 427 | tof->AddSDigit(tracknum, vol, digit); |
55991c8b | 428 | |
429 | if(indexOfPad){ | |
430 | nnoisesdigits++; | |
431 | nnoisesdigitsinEv++; | |
432 | } else { | |
433 | nsignalsdigits++; | |
434 | nsignalsdigitsinEv++; | |
435 | } | |
436 | ntotalsdigitsinEv++; | |
437 | ntotalsdigits++; | |
438 | hitMap->SetHit(vol); | |
439 | } // if (hitMap->TestHit(vol) != kEmpty) | |
440 | } // if(isFired[indexOfPad]) | |
441 | } // end loop on nActivatedPads | |
442 | } // if(nFiredPads) i.e. if some pads has fired | |
443 | } // close if(!isCloneOfThePrevious) | |
444 | } // close the selection on sector and plate | |
5919c40c | 445 | } // end loop on hits for the current track |
446 | } // end loop on ntracks | |
55991c8b | 447 | |
5919c40c | 448 | delete hitMap; |
d61f73d9 | 449 | |
450 | fTOFLoader->TreeS()->Reset(); | |
451 | fTOFLoader->TreeS()->Fill(); | |
452 | fTOFLoader->WriteSDigits("OVERWRITE"); | |
453 | ||
7e6dce66 | 454 | if (tof->SDigits()) tof->ResetSDigits(); |
d61f73d9 | 455 | |
456 | if (strstr(verboseOption,"all")) { | |
d076c8d5 | 457 | AliInfo("----------------------------------------"); |
458 | AliInfo(" <AliTOFSDigitizer> "); | |
459 | AliInfo(Form("After sdigitizing %d hits in event %d", nselectedHitsinEv, iEvent)); | |
ea7a588a | 460 | //" (" << nHitsFromPrim << " from primaries and " << nHitsFromSec << " from secondaries) TOF hits, " |
d076c8d5 | 461 | AliInfo(Form("%d digits have been created", ntotalsdigitsinEv)); |
462 | AliInfo(Form("(%d due to signals and %d due to border effect)", nsignalsdigitsinEv, nnoisesdigitsinEv)); | |
463 | AliInfo(Form("%d total updates of the hit map have been performed in current event", ntotalupdatesinEv)); | |
464 | AliInfo("----------------------------------------"); | |
ea7a588a | 465 | } |
466 | ||
467 | } //event loop on events | |
468 | ||
d61f73d9 | 469 | fTOFLoader->UnloadSDigits(); |
470 | fTOFLoader->UnloadHits(); | |
471 | fRunLoader->UnloadKinematics(); | |
e615b5b5 | 472 | //fRunLoader->UnloadgAlice(); |
d61f73d9 | 473 | |
ea7a588a | 474 | // free used memory |
475 | if (ftail){ | |
476 | delete ftail; | |
477 | ftail = 0; | |
478 | } | |
479 | ||
480 | nHitsFromSec=nselectedHits-nHitsFromPrim; | |
481 | if(strstr(verboseOption,"all")){ | |
d076c8d5 | 482 | AliInfo("----------------------------------------"); |
483 | AliInfo("----------------------------------------"); | |
484 | AliInfo("-----------SDigitization Summary--------"); | |
485 | AliInfo(" <AliTOFSDigitizer> "); | |
486 | AliInfo(Form("After sdigitizing %d hits", nselectedHits)); | |
487 | AliInfo(Form("in %d events", fEvent2-fEvent1)); | |
ea7a588a | 488 | //" (" << nHitsFromPrim << " from primaries and " << nHitsFromSec << " from secondaries) TOF hits, " |
d076c8d5 | 489 | AliInfo(Form("%d sdigits have been created", ntotalsdigits)); |
490 | AliInfo(Form("(%d due to signals and " | |
491 | "%d due to border effect)", nsignalsdigits, nnoisesdigits)); | |
492 | AliInfo(Form("%d total updates of the hit map have been performed", ntotalupdates)); | |
493 | AliInfo(Form("in %d cases the time of flight difference is greater than 200 ps", nlargeTofDiff)); | |
ea7a588a | 494 | } |
495 | ||
517b7f8f | 496 | |
ea7a588a | 497 | if(strstr(verboseOption,"tim") || strstr(verboseOption,"all")){ |
498 | gBenchmark->Stop("TOFSDigitizer"); | |
d076c8d5 | 499 | AliInfo("AliTOFSDigitizer:"); |
500 | AliInfo(Form(" took %f seconds in order to make sdigits " | |
501 | "%f seconds per event", gBenchmark->GetCpuTime("TOFSDigitizer"), gBenchmark->GetCpuTime("TOFSDigitizer")/(fEvent2-fEvent1))); | |
502 | AliInfo(" +++++++++++++++++++++++++++++++++++++++++++++++++++ "); | |
ea7a588a | 503 | } |
517b7f8f | 504 | |
505 | } | |
ea7a588a | 506 | |
517b7f8f | 507 | //__________________________________________________________________ |
5c016a7b | 508 | void AliTOFSDigitizer::Print(Option_t* /*opt*/)const |
517b7f8f | 509 | { |
0e46b9ae | 510 | AliInfo(Form(" ------------------- %s ------------- ", GetName())); |
517b7f8f | 511 | } |
f73548c4 | 512 | |
55991c8b | 513 | //__________________________________________________________________ |
514 | void AliTOFSDigitizer::SelectSectorAndPlate(Int_t sector, Int_t plate) | |
515 | { | |
340693af | 516 | //Select sector and plate |
0f4a7374 | 517 | Bool_t isaWrongSelection=(sector < 0) || (sector >= AliTOFGeometry::NSectors()) || (plate < 0) || (plate >= AliTOFGeometry::NPlates()); |
55991c8b | 518 | if(isaWrongSelection){ |
d076c8d5 | 519 | AliError("You have selected an invalid value for sector or plate "); |
520 | AliError(Form("The correct range for sector is [0,%d]", AliTOFGeometry::NSectors()-1)); | |
521 | AliError(Form("The correct range for plate is [0,%d]", AliTOFGeometry::NPlates()-1)); | |
522 | AliError("By default we continue sdigitizing all hits in all plates of all sectors"); | |
55991c8b | 523 | } else { |
524 | fSelectedSector=sector; | |
525 | fSelectedPlate =plate; | |
d076c8d5 | 526 | AliInfo(Form("SDigitizing only hits in plate %d of the sector %d", fSelectedPlate, fSelectedSector)); |
55991c8b | 527 | } |
528 | } | |
529 | ||
f73548c4 | 530 | //__________________________________________________________________ |
531 | void 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) | |
532 | { | |
533 | // Description: | |
534 | // Input: z0, x0 - hit position in the strip system (0,0 - center of the strip), cm | |
535 | // geantTime - time generated by Geant, ns | |
536 | // Output: nActivatedPads - the number of pads activated by the hit (1 || 2 || 4) | |
537 | // nFiredPads - the number of pads fired (really activated) by the hit (nFiredPads <= nActivatedPads) | |
538 | // qInduced[iPad]- charge induced on pad, arb. units | |
539 | // this array is initialized at zero by the caller | |
540 | // tofAfterSimul[iPad] - time calculated with edge effect algorithm, ns | |
541 | // this array is initialized at zero by the caller | |
542 | // 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. | |
543 | // The weight is given by the qInduced[iPad]/qCenterPad | |
544 | // this variable is initialized at zero by the caller | |
545 | // nPlace[iPad] - the number of the pad place, iPad = 0, 1, 2, 3 | |
546 | // this variable is initialized at zero by the caller | |
547 | // | |
548 | // Description of used variables: | |
549 | // eff[iPad] - efficiency of the pad | |
550 | // res[iPad] - resolution of the pad, ns | |
551 | // timeWalk[iPad] - time walk of the pad, ns | |
552 | // timeDelay[iPad] - time delay for neighbouring pad to hited pad, ns | |
553 | // PadId[iPad] - Pad Identifier | |
554 | // E | F --> PadId[iPad] = 5 | 6 | |
555 | // A | B --> PadId[iPad] = 1 | 2 | |
556 | // C | D --> PadId[iPad] = 3 | 4 | |
557 | // nTail[iPad] - the tail number, = 1 for tailA, = 2 for tailB | |
558 | // qCenterPad - charge extimated for each pad, arb. units | |
559 | // weightsSum - sum of weights extimated for each pad fired, arb. units | |
560 | ||
0f4a7374 | 561 | const Float_t kSigmaForTail[2] = {AliTOFGeometry::SigmaForTail1(),AliTOFGeometry::SigmaForTail2()}; //for tail |
f73548c4 | 562 | Int_t iz = 0, ix = 0; |
563 | Float_t dX = 0., dZ = 0., x = 0., z = 0.; | |
564 | Float_t h = fHparameter, h2 = fH2parameter, k = fKparameter, k2 = fK2parameter; | |
565 | Float_t effX = 0., effZ = 0., resX = 0., resZ = 0., timeWalkX = 0., timeWalkZ = 0.; | |
566 | Float_t logOfqInd = 0.; | |
567 | Float_t weightsSum = 0.; | |
568 | Int_t nTail[4] = {0,0,0,0}; | |
569 | Int_t padId[4] = {0,0,0,0}; | |
570 | Float_t eff[4] = {0.,0.,0.,0.}; | |
571 | Float_t res[4] = {0.,0.,0.,0.}; | |
572 | // Float_t qCenterPad = fMinimumCharge * fMinimumCharge; | |
573 | Float_t qCenterPad = 1.; | |
574 | Float_t timeWalk[4] = {0.,0.,0.,0.}; | |
575 | Float_t timeDelay[4] = {0.,0.,0.,0.}; | |
576 | ||
577 | nActivatedPads = 0; | |
578 | nFiredPads = 0; | |
579 | ||
580 | (z0 <= 0) ? iz = 0 : iz = 1; | |
0f4a7374 | 581 | dZ = z0 + (0.5 * AliTOFGeometry::NpadZ() - iz - 0.5) * AliTOFGeometry::ZPad(); // hit position in the pad frame, (0,0) - center of the pad |
582 | z = 0.5 * AliTOFGeometry::ZPad() - TMath::Abs(dZ); // variable for eff., res. and timeWalk. functions | |
583 | iz++; // z row: 1, ..., AliTOFGeometry::NpadZ = 2 | |
584 | ix = (Int_t)((x0 + 0.5 * AliTOFGeometry::NpadX() * AliTOFGeometry::XPad()) / AliTOFGeometry::XPad()); | |
585 | dX = x0 + (0.5 * AliTOFGeometry::NpadX() - ix - 0.5) * AliTOFGeometry::XPad(); // hit position in the pad frame, (0,0) - center of the pad | |
586 | x = 0.5 * AliTOFGeometry::XPad() - TMath::Abs(dX); // variable for eff., res. and timeWalk. functions; | |
587 | ix++; // x row: 1, ..., AliTOFGeometry::NpadX = 48 | |
f73548c4 | 588 | |
589 | ////// Pad A: | |
590 | nActivatedPads++; | |
0f4a7374 | 591 | nPlace[nActivatedPads-1] = (iz - 1) * AliTOFGeometry::NpadX() + ix; |
f73548c4 | 592 | qInduced[nActivatedPads-1] = qCenterPad; |
593 | padId[nActivatedPads-1] = 1; | |
594 | ||
595 | if (fEdgeEffect == 0) { | |
596 | eff[nActivatedPads-1] = fEffCenter; | |
597 | if (gRandom->Rndm() < eff[nActivatedPads-1]) { | |
598 | nFiredPads = 1; | |
7e6dce66 | 599 | res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + fResCenter * fResCenter); // ns |
f73548c4 | 600 | isFired[nActivatedPads-1] = kTRUE; |
601 | tofTime[nActivatedPads-1] = gRandom->Gaus(geantTime + fTimeWalkCenter, res[0]); | |
602 | averageTime = tofTime[nActivatedPads-1]; | |
603 | } | |
604 | } else { | |
605 | ||
606 | if(z < h) { | |
607 | if(z < h2) { | |
608 | effZ = fEffBoundary + (fEff2Boundary - fEffBoundary) * z / h2; | |
609 | } else { | |
610 | effZ = fEff2Boundary + (fEffCenter - fEff2Boundary) * (z - h2) / (h - h2); | |
611 | } | |
612 | resZ = fResBoundary + (fResCenter - fResBoundary) * z / h; | |
613 | timeWalkZ = fTimeWalkBoundary + (fTimeWalkCenter - fTimeWalkBoundary) * z / h; | |
614 | nTail[nActivatedPads-1] = 1; | |
615 | } else { | |
616 | effZ = fEffCenter; | |
617 | resZ = fResCenter; | |
618 | timeWalkZ = fTimeWalkCenter; | |
619 | } | |
620 | ||
621 | if(x < h) { | |
622 | if(x < h2) { | |
623 | effX = fEffBoundary + (fEff2Boundary - fEffBoundary) * x / h2; | |
624 | } else { | |
625 | effX = fEff2Boundary + (fEffCenter - fEff2Boundary) * (x - h2) / (h - h2); | |
626 | } | |
627 | resX = fResBoundary + (fResCenter - fResBoundary) * x / h; | |
628 | timeWalkX = fTimeWalkBoundary + (fTimeWalkCenter - fTimeWalkBoundary) * x / h; | |
629 | nTail[nActivatedPads-1] = 1; | |
630 | } else { | |
631 | effX = fEffCenter; | |
632 | resX = fResCenter; | |
633 | timeWalkX = fTimeWalkCenter; | |
634 | } | |
635 | ||
636 | (effZ<effX) ? eff[nActivatedPads-1] = effZ : eff[nActivatedPads-1] = effX; | |
7e6dce66 | 637 | (resZ<resX) ? res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resX * resX) : res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resZ * resZ); // ns |
f73548c4 | 638 | (timeWalkZ<timeWalkX) ? timeWalk[nActivatedPads-1] = 0.001 * timeWalkZ : timeWalk[nActivatedPads-1] = 0.001 * timeWalkX; // ns |
639 | ||
640 | ||
641 | ////// Pad B: | |
642 | if(z < k2) { | |
643 | effZ = fEffBoundary - (fEffBoundary - fEff3Boundary) * (z / k2); | |
644 | } else { | |
645 | effZ = fEff3Boundary * (k - z) / (k - k2); | |
646 | } | |
647 | resZ = fResBoundary + fResSlope * z / k; | |
648 | timeWalkZ = fTimeWalkBoundary + fTimeWalkSlope * z / k; | |
649 | ||
650 | if(z < k && z > 0) { | |
651 | if( (iz == 1 && dZ > 0) || (iz == 2 && dZ < 0) ) { | |
652 | nActivatedPads++; | |
0f4a7374 | 653 | nPlace[nActivatedPads-1] = nPlace[0] + (3 - 2 * iz) * AliTOFGeometry::NpadX(); |
f73548c4 | 654 | eff[nActivatedPads-1] = effZ; |
7e6dce66 | 655 | res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resZ * resZ); // ns |
f73548c4 | 656 | timeWalk[nActivatedPads-1] = 0.001 * timeWalkZ; // ns |
657 | nTail[nActivatedPads-1] = 2; | |
658 | if (fTimeDelayFlag) { | |
659 | // qInduced[0] = fMinimumCharge * TMath::Exp(fPulseHeightSlope * z / 2.); | |
660 | // qInduced[nActivatedPads-1] = fMinimumCharge * TMath::Exp(-fPulseHeightSlope * z / 2.); | |
661 | qInduced[nActivatedPads-1] = TMath::Exp(-fPulseHeightSlope * z); | |
662 | logOfqInd = gRandom->Gaus(-fPulseHeightSlope * z, fLogChargeSmearing); | |
663 | timeDelay[nActivatedPads-1] = gRandom->Gaus(-fTimeDelaySlope * logOfqInd, fTimeSmearing); | |
664 | } else { | |
665 | timeDelay[nActivatedPads-1] = 0.; | |
666 | } | |
667 | padId[nActivatedPads-1] = 2; | |
668 | } | |
669 | } | |
670 | ||
671 | ||
672 | ////// Pad C, D, E, F: | |
673 | if(x < k2) { | |
674 | effX = fEffBoundary - (fEffBoundary - fEff3Boundary) * (x / k2); | |
675 | } else { | |
676 | effX = fEff3Boundary * (k - x) / (k - k2); | |
677 | } | |
678 | resX = fResBoundary + fResSlope*x/k; | |
679 | timeWalkX = fTimeWalkBoundary + fTimeWalkSlope*x/k; | |
680 | ||
681 | if(x < k && x > 0) { | |
682 | // C: | |
683 | if(ix > 1 && dX < 0) { | |
684 | nActivatedPads++; | |
685 | nPlace[nActivatedPads-1] = nPlace[0] - 1; | |
686 | eff[nActivatedPads-1] = effX; | |
7e6dce66 | 687 | res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resX * resX); // ns |
f73548c4 | 688 | timeWalk[nActivatedPads-1] = 0.001 * timeWalkX; // ns |
689 | nTail[nActivatedPads-1] = 2; | |
690 | if (fTimeDelayFlag) { | |
691 | // qInduced[0] = fMinimumCharge * TMath::Exp(fPulseHeightSlope * x / 2.); | |
692 | // qInduced[nActivatedPads-1] = fMinimumCharge * TMath::Exp(-fPulseHeightSlope * x / 2.); | |
693 | qInduced[nActivatedPads-1] = TMath::Exp(-fPulseHeightSlope * x); | |
694 | logOfqInd = gRandom->Gaus(-fPulseHeightSlope * x, fLogChargeSmearing); | |
695 | timeDelay[nActivatedPads-1] = gRandom->Gaus(-fTimeDelaySlope * logOfqInd, fTimeSmearing); | |
696 | } else { | |
697 | timeDelay[nActivatedPads-1] = 0.; | |
698 | } | |
699 | padId[nActivatedPads-1] = 3; | |
700 | ||
701 | // D: | |
702 | if(z < k && z > 0) { | |
703 | if( (iz == 1 && dZ > 0) || (iz == 2 && dZ < 0) ) { | |
704 | nActivatedPads++; | |
0f4a7374 | 705 | nPlace[nActivatedPads-1] = nPlace[0] + (3 - 2 * iz) * AliTOFGeometry::NpadX() - 1; |
f73548c4 | 706 | eff[nActivatedPads-1] = effX * effZ; |
7e6dce66 | 707 | (resZ<resX) ? res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resX * resX) : res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resZ * resZ); // ns |
f73548c4 | 708 | (timeWalkZ<timeWalkX) ? timeWalk[nActivatedPads-1] = 0.001 * timeWalkZ : timeWalk[nActivatedPads-1] = 0.001 * timeWalkX; // ns |
709 | ||
710 | nTail[nActivatedPads-1] = 2; | |
711 | if (fTimeDelayFlag) { | |
712 | if (TMath::Abs(x) < TMath::Abs(z)) { | |
713 | // qInduced[0] = fMinimumCharge * TMath::Exp(fPulseHeightSlope * z / 2.); | |
714 | // qInduced[nActivatedPads-1] = fMinimumCharge * TMath::Exp(-fPulseHeightSlope * z / 2.); | |
715 | qInduced[nActivatedPads-1] = TMath::Exp(-fPulseHeightSlope * z); | |
716 | logOfqInd = gRandom->Gaus(-fPulseHeightSlope * z, fLogChargeSmearing); | |
717 | } else { | |
718 | // qInduced[0] = fMinimumCharge * TMath::Exp(fPulseHeightSlope * x / 2.); | |
719 | // qInduced[nActivatedPads-1] = fMinimumCharge * TMath::Exp(-fPulseHeightSlope * x / 2.); | |
720 | qInduced[nActivatedPads-1] = TMath::Exp(-fPulseHeightSlope * x); | |
721 | logOfqInd = gRandom->Gaus(-fPulseHeightSlope * x, fLogChargeSmearing); | |
722 | } | |
723 | timeDelay[nActivatedPads-1] = gRandom->Gaus(-fTimeDelaySlope * logOfqInd, fTimeSmearing); | |
724 | } else { | |
725 | timeDelay[nActivatedPads-1] = 0.; | |
726 | } | |
727 | padId[nActivatedPads-1] = 4; | |
728 | } | |
729 | } // end D | |
730 | } // end C | |
731 | ||
732 | // E: | |
0f4a7374 | 733 | if(ix < AliTOFGeometry::NpadX() && dX > 0) { |
f73548c4 | 734 | nActivatedPads++; |
735 | nPlace[nActivatedPads-1] = nPlace[0] + 1; | |
736 | eff[nActivatedPads-1] = effX; | |
7e6dce66 | 737 | res[nActivatedPads-1] = 0.001 * (TMath::Sqrt(fAddTRes*fAddTRes + resX * resX)); // ns |
f73548c4 | 738 | timeWalk[nActivatedPads-1] = 0.001 * timeWalkX; // ns |
739 | nTail[nActivatedPads-1] = 2; | |
740 | if (fTimeDelayFlag) { | |
741 | // qInduced[0] = fMinimumCharge * TMath::Exp(fPulseHeightSlope * x / 2.); | |
742 | // qInduced[nActivatedPads-1] = fMinimumCharge * TMath::Exp(-fPulseHeightSlope * x / 2.); | |
743 | qInduced[nActivatedPads-1] = TMath::Exp(-fPulseHeightSlope * x); | |
744 | logOfqInd = gRandom->Gaus(-fPulseHeightSlope * x, fLogChargeSmearing); | |
745 | timeDelay[nActivatedPads-1] = gRandom->Gaus(-fTimeDelaySlope * logOfqInd, fTimeSmearing); | |
746 | } else { | |
747 | timeDelay[nActivatedPads-1] = 0.; | |
748 | } | |
749 | padId[nActivatedPads-1] = 5; | |
750 | ||
751 | ||
752 | // F: | |
753 | if(z < k && z > 0) { | |
754 | if( (iz == 1 && dZ > 0) || (iz == 2 && dZ < 0) ) { | |
755 | nActivatedPads++; | |
0f4a7374 | 756 | nPlace[nActivatedPads - 1] = nPlace[0] + (3 - 2 * iz) * AliTOFGeometry::NpadX() + 1; |
f73548c4 | 757 | eff[nActivatedPads - 1] = effX * effZ; |
7e6dce66 | 758 | (resZ<resX) ? res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resX * resX) : res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resZ * resZ); // ns |
f73548c4 | 759 | (timeWalkZ<timeWalkX) ? timeWalk[nActivatedPads-1] = 0.001 * timeWalkZ : timeWalk[nActivatedPads-1] = 0.001*timeWalkX; // ns |
760 | nTail[nActivatedPads-1] = 2; | |
761 | if (fTimeDelayFlag) { | |
762 | if (TMath::Abs(x) < TMath::Abs(z)) { | |
763 | // qInduced[0] = fMinimumCharge * TMath::Exp(fPulseHeightSlope * z / 2.); | |
764 | // qInduced[nActivatedPads-1] = fMinimumCharge * TMath::Exp(-fPulseHeightSlope * z / 2.); | |
765 | qInduced[nActivatedPads-1] = TMath::Exp(-fPulseHeightSlope * z); | |
766 | logOfqInd = gRandom->Gaus(-fPulseHeightSlope * z, fLogChargeSmearing); | |
767 | } else { | |
768 | // qInduced[0] = fMinimumCharge * TMath::Exp(fPulseHeightSlope * x / 2.); | |
769 | // qInduced[nActivatedPads-1] = fMinimumCharge * TMath::Exp(-fPulseHeightSlope * x / 2.); | |
770 | qInduced[nActivatedPads-1] = TMath::Exp(-fPulseHeightSlope * x); | |
771 | logOfqInd = gRandom->Gaus(-fPulseHeightSlope * x, fLogChargeSmearing); | |
772 | } | |
773 | timeDelay[nActivatedPads-1] = gRandom->Gaus(-fTimeDelaySlope * logOfqInd, fTimeSmearing); | |
774 | } else { | |
775 | timeDelay[nActivatedPads-1] = 0.; | |
776 | } | |
777 | padId[nActivatedPads-1] = 6; | |
778 | } | |
779 | } // end F | |
780 | } // end E | |
781 | } // end if(x < k) | |
782 | ||
783 | ||
784 | for (Int_t iPad = 0; iPad < nActivatedPads; iPad++) { | |
785 | if (res[iPad] < fTimeResolution) res[iPad] = fTimeResolution; | |
786 | if(gRandom->Rndm() < eff[iPad]) { | |
787 | isFired[iPad] = kTRUE; | |
788 | nFiredPads++; | |
789 | if(fEdgeTails) { | |
790 | if(nTail[iPad] == 0) { | |
791 | tofTime[iPad] = gRandom->Gaus(geantTime + timeWalk[iPad] + timeDelay[iPad], res[iPad]); | |
792 | } else { | |
793 | ftail->SetParameters(res[iPad], 2. * res[iPad], kSigmaForTail[nTail[iPad]-1]); | |
794 | Double_t timeAB = ftail->GetRandom(); | |
795 | tofTime[iPad] = geantTime + timeWalk[iPad] + timeDelay[iPad] + timeAB; | |
796 | } | |
797 | } else { | |
798 | tofTime[iPad] = gRandom->Gaus(geantTime + timeWalk[iPad] + timeDelay[iPad], res[iPad]); | |
799 | } | |
800 | if (fAverageTimeFlag) { | |
801 | averageTime += tofTime[iPad] * qInduced[iPad]; | |
802 | weightsSum += qInduced[iPad]; | |
803 | } else { | |
804 | averageTime += tofTime[iPad]; | |
805 | weightsSum += 1.; | |
806 | } | |
807 | } | |
808 | } | |
809 | if (weightsSum!=0) averageTime /= weightsSum; | |
810 | } // end else (fEdgeEffect != 0) | |
811 | } | |
812 | ||
813 | //__________________________________________________________________ | |
814 | void AliTOFSDigitizer::PrintParameters()const | |
815 | { | |
816 | // | |
817 | // Print parameters used for sdigitization | |
818 | // | |
0e46b9ae | 819 | AliInfo(Form(" ------------------- %s -------------", GetName())); |
820 | AliInfo(" Parameters used for TOF SDigitization "); | |
f73548c4 | 821 | // Printing the parameters |
822 | ||
0e46b9ae | 823 | AliInfo(Form(" Number of events: %i ", (fEvent2-fEvent1))); |
824 | AliInfo(Form(" from event %i to event %i", fEvent1, (fEvent2-1))); | |
825 | AliInfo(Form(" Time Resolution (ns) %d Pad Efficiency: %d ", fTimeResolution, fpadefficiency)); | |
826 | AliInfo(Form(" Edge Effect option: %d", fEdgeEffect)); | |
827 | ||
828 | AliInfo(" Boundary Effect Simulation Parameters "); | |
829 | AliInfo(Form(" Hparameter: %d H2parameter: %d Kparameter: %d K2parameter: %d", fHparameter, fH2parameter, fKparameter, fK2parameter)); | |
830 | AliInfo(Form(" Efficiency in the central region of the pad: %d", fEffCenter)); | |
831 | AliInfo(Form(" Efficiency at the boundary region of the pad: %d", fEffBoundary)); | |
832 | AliInfo(Form(" Efficiency value at H2parameter %d", fEff2Boundary)); | |
833 | AliInfo(Form(" Efficiency value at K2parameter %d", fEff3Boundary)); | |
834 | AliInfo(Form(" Resolution (ps) in the central region of the pad: %d", fResCenter)); | |
835 | AliInfo(Form(" Resolution (ps) at the boundary of the pad : %d", fResBoundary)); | |
836 | AliInfo(Form(" Slope (ps/K) for neighbouring pad : %d", fResSlope)); | |
837 | AliInfo(Form(" Time walk (ps) in the central region of the pad : %d", fTimeWalkCenter)); | |
838 | AliInfo(Form(" Time walk (ps) at the boundary of the pad : %d", fTimeWalkBoundary)); | |
839 | AliInfo(Form(" Slope (ps/K) for neighbouring pad : %d", fTimeWalkSlope)); | |
840 | AliInfo(" Pulse Heigth Simulation Parameters "); | |
841 | AliInfo(Form(" Flag for delay due to the PulseHeightEffect : %d", fTimeDelayFlag)); | |
842 | AliInfo(Form(" Pulse Height Slope : %d", fPulseHeightSlope)); | |
843 | AliInfo(Form(" Time Delay Slope : %d", fTimeDelaySlope)); | |
844 | AliInfo(Form(" Minimum charge amount which could be induced : %d", fMinimumCharge)); | |
845 | AliInfo(Form(" Smearing in charge in (q1/q2) vs x plot : %d", fChargeSmearing)); | |
846 | AliInfo(Form(" Smearing in log of charge ratio : %d", fLogChargeSmearing)); | |
847 | AliInfo(Form(" Smearing in time in time vs log(q1/q2) plot : %d", fTimeSmearing)); | |
848 | AliInfo(Form(" Flag for average time : %d", fAverageTimeFlag)); | |
849 | AliInfo(Form(" Edge tails option : %d", fEdgeTails)); | |
f73548c4 | 850 | |
851 | } |