]>
Commit | Line | Data |
---|---|---|
4c039060 | 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$ */ |
68861244 | 17 | |
fe4da5cc | 18 | /////////////////////////////////////////////////////////////////////////////// |
19 | // // | |
68861244 | 20 | // Time Of Flight // |
fe4da5cc | 21 | // This class contains the basic functions for the Time Of Flight // |
22 | // detector. Functions specific to one particular geometry are // | |
23 | // contained in the derived classes // | |
d3c7bfac | 24 | // // |
25 | // VERSIONE WITH 5 SYMMETRIC MODULES ALONG Z AXIS // | |
26 | // ============================================================ // | |
27 | // // | |
28 | // VERSION WITH HOLES FOR PHOS AND TRD IN SPACEFRAME WITH HOLES // | |
29 | // // | |
30 | // Volume sensibile : FPAD // | |
31 | // // | |
32 | // // | |
33 | // // | |
34 | // // | |
35 | /////////////////////////////////////////////////////////////////////////////// | |
937fe4a4 | 36 | // Begin_Html |
fe4da5cc | 37 | /* |
1439f98e | 38 | <img src="picts/AliTOFClass.gif"> |
fe4da5cc | 39 | */ |
40 | //End_Html | |
d3c7bfac | 41 | |
7ca4655f | 42 | #include <TClonesArray.h> |
43 | #include <TFile.h> | |
44 | #include <TFolder.h> | |
45 | #include <TROOT.h> | |
46 | #include <TTask.h> | |
47 | #include <TTree.h> | |
48 | #include <TVirtualMC.h> | |
515faf5d | 49 | #include <TStopwatch.h> |
fe4da5cc | 50 | |
88cb7938 | 51 | #include "AliConst.h" |
52 | #include "AliLoader.h" | |
0e46b9ae | 53 | #include "AliLog.h" |
54 | #include "AliMC.h" | |
88cb7938 | 55 | #include "AliRun.h" |
0e46b9ae | 56 | |
57 | #include "AliTOFDDLRawData.h" | |
58 | #include "AliTOFDigitizer.h" | |
88cb7938 | 59 | #include "AliTOFdigit.h" |
88cb7938 | 60 | #include "AliTOFhitT0.h" |
0e46b9ae | 61 | #include "AliTOFhit.h" |
62 | #include "AliTOFGeometry.h" | |
63 | #include "AliTOFSDigitizer.h" | |
64 | #include "AliTOFSDigit.h" | |
65 | #include "AliTOF.h" | |
66 | ||
67 | class AliTOFcluster; | |
68 | ||
69 | extern TFile *gFile; | |
70 | extern TROOT *gROOT; | |
71 | extern TVirtualMC *gMC; | |
72 | ||
73 | extern AliRun *gAlice; | |
74 | ||
fe4da5cc | 75 | |
76 | ClassImp(AliTOF) | |
77 | ||
78 | //_____________________________________________________________________________ | |
655e379f | 79 | AliTOF::AliTOF(): |
80 | fFGeom(0x0), | |
81 | fDTask(0x0), | |
82 | fReTask(0x0), | |
83 | fSDigits(0x0), | |
84 | fNSDigits(0), | |
85 | fReconParticles(0x0), | |
86 | fIdSens(-1), | |
87 | fTZero(kFALSE), | |
88 | fTOFGeometry(0x0) | |
fe4da5cc | 89 | { |
90 | // | |
91 | // Default constructor | |
92 | // | |
655e379f | 93 | fDigits = 0; |
fe4da5cc | 94 | fIshunt = 0; |
655e379f | 95 | fName = "TOF"; |
fe4da5cc | 96 | } |
97 | ||
98 | //_____________________________________________________________________________ | |
792995c1 | 99 | AliTOF::AliTOF(const char *name, const char *title, Option_t *option) |
655e379f | 100 | : |
101 | AliDetector(name,title), | |
102 | fFGeom(0x0), | |
103 | fDTask(0x0), | |
104 | fReTask(0x0), | |
105 | fSDigits(0x0), | |
106 | fNSDigits(0), | |
107 | fReconParticles(0x0), | |
108 | fIdSens(-1), | |
109 | fTZero(kFALSE), | |
110 | fTOFGeometry(0x0) | |
fe4da5cc | 111 | { |
112 | // | |
113 | // AliTOF standard constructor | |
114 | // | |
2cef3cb2 | 115 | // Here are fixed some important parameters |
116 | // | |
117 | ||
68861244 | 118 | // Initialization of hits, sdigits and digits array |
d599d913 | 119 | // added option for time zero analysis |
655e379f | 120 | //skowron |
d3c7bfac | 121 | fTOFGeometry = new AliTOFGeometry(); |
88cb7938 | 122 | |
d599d913 | 123 | if (strstr(option,"tzero")){ |
124 | fHits = new TClonesArray("AliTOFhitT0", 1000); | |
88cb7938 | 125 | fTZero = kTRUE; |
655e379f | 126 | // AliWarning("tzero option requires AliTOFv4T0/AliTOFv5T0 as TOF version (check Your Config.C)"); |
d599d913 | 127 | }else{ |
128 | fHits = new TClonesArray("AliTOFhit", 1000); | |
88cb7938 | 129 | fTZero = kFALSE; |
d599d913 | 130 | } |
c630aafd | 131 | if (gAlice==0) { |
d076c8d5 | 132 | AliFatal("gAlice==0 !"); |
c630aafd | 133 | } |
0e46b9ae | 134 | |
135 | AliMC *mcApplication = (AliMC*)gAlice->GetMCApp(); | |
136 | ||
137 | if (mcApplication->GetHitLists()) | |
138 | mcApplication->AddHitList(fHits); | |
d076c8d5 | 139 | else AliError("gAlice->GetHitLists()==0"); |
c630aafd | 140 | |
2cef3cb2 | 141 | fIshunt = 0; |
7e6dce66 | 142 | fSDigits = new TClonesArray("AliTOFSDigit", 1000); |
143 | fDigits = new TClonesArray("AliTOFdigit", 1000); | |
00711221 | 144 | |
2cef3cb2 | 145 | // |
146 | // Digitization parameters | |
fe4da5cc | 147 | // |
2cef3cb2 | 148 | // (Transfer Functions to be inserted here) |
fe4da5cc | 149 | // |
e939a978 | 150 | //PH SetMarkerColor(7); |
151 | //PH SetMarkerStyle(2); | |
152 | //PH SetMarkerSize(0.4); | |
2cef3cb2 | 153 | |
2cef3cb2 | 154 | // Strip Parameters |
7e6dce66 | 155 | //fGapA = 4.; //cm Gap beetween tilted strip in A-type plate |
156 | //fGapB = 6.; //cm Gap beetween tilted strip in B-type plate | |
157 | ||
158 | // Physical performances | |
159 | //fTimeRes = 100.;//ps | |
160 | //fChrgRes = 100.;//pC | |
161 | ||
68861244 | 162 | } |
163 | ||
06e24a91 | 164 | //____________________________________________________________________________ |
d0eb8f39 | 165 | void AliTOF::SetTOFSectors(Int_t *sectors) |
166 | { | |
167 | // Setter for partial/full TOF configuration | |
168 | ||
06e24a91 | 169 | for(Int_t isec=0;isec<18;isec++){ |
170 | fTOFSectors[isec]=sectors[isec]; | |
171 | } | |
172 | } | |
173 | //____________________________________________________________________________ | |
d0eb8f39 | 174 | void AliTOF::GetTOFSectors(Int_t *sectors) const |
175 | { | |
176 | // Getter for partial/full TOF configuration | |
06e24a91 | 177 | |
178 | for(Int_t isec=0;isec<18;isec++){ | |
179 | sectors[isec]=fTOFSectors[isec]; | |
180 | } | |
181 | } | |
7aeeaf38 | 182 | //_____________________________________________________________________________ |
183 | AliTOF::AliTOF(const AliTOF &source) | |
655e379f | 184 | :AliDetector(), |
185 | fFGeom(0x0), | |
186 | fDTask(0x0), | |
187 | fReTask(0x0), | |
188 | fSDigits(0x0), | |
189 | fNSDigits(0), | |
190 | fReconParticles(0x0), | |
191 | fIdSens(-1), | |
192 | fTZero(kFALSE), | |
193 | fTOFGeometry(0x0) | |
7aeeaf38 | 194 | { |
195 | // copy constructor | |
196 | ||
197 | this->fReconParticles=source.fReconParticles; | |
198 | this->fSDigits=source.fSDigits; | |
199 | this->fTOFGeometry=source.fTOFGeometry; | |
200 | ||
201 | } | |
202 | ||
203 | //_____________________________________________________________________________ | |
204 | AliTOF& AliTOF::operator=(const AliTOF &source) | |
205 | { | |
206 | // ass. op. | |
207 | ||
208 | this->fReconParticles=source.fReconParticles; | |
209 | this->fSDigits=source.fSDigits; | |
210 | this->fTOFGeometry=source.fTOFGeometry; | |
211 | return *this; | |
212 | ||
213 | } | |
214 | ||
68861244 | 215 | //_____________________________________________________________________________ |
216 | void AliTOF::CreateTOFFolders() | |
217 | { | |
218 | // create the ALICE TFolder | |
219 | // create the ALICE TTasks | |
220 | // create the ALICE main TFolder | |
221 | // to be done by AliRun | |
222 | ||
223 | TFolder * alice = new TFolder(); | |
224 | alice->SetNameTitle("FPAlice", "Alice Folder") ; | |
225 | gROOT->GetListOfBrowsables()->Add(alice) ; | |
226 | ||
227 | TFolder * aliceF = alice->AddFolder("folders", "Alice memory Folder") ; | |
228 | // make it the owner of the objects that it contains | |
229 | aliceF->SetOwner() ; | |
230 | // geometry folder | |
231 | TFolder * geomF = aliceF->AddFolder("Geometry", "Geometry objects") ; | |
232 | TFolder * aliceT = alice->AddFolder("tasks", "Alice tasks Folder") ; | |
233 | // make it the owner of the objects that it contains | |
234 | aliceT->SetOwner() ; | |
235 | ||
236 | TTask * aliceDi = new TTask("(S)Digitizer", "Alice SDigitizer & Digitizer") ; | |
237 | aliceT->Add(aliceDi); | |
238 | ||
239 | TTask * aliceRe = new TTask("Reconstructioner", "Alice Reconstructioner") ; | |
240 | aliceT->Add(aliceRe); | |
241 | ||
242 | char * tempo = new char[80] ; | |
243 | ||
244 | // creates the TOF Digitizer and adds it to alice main (S)Digitizer task | |
245 | sprintf(tempo, "%sDigitizers container",GetName() ) ; | |
246 | fDTask = new TTask(GetName(), tempo); | |
247 | aliceDi->Add(fDTask) ; | |
248 | ||
249 | // creates the TOF reconstructioner and adds it to alice main Reconstructioner task | |
250 | sprintf(tempo, "%sReconstructioner container",GetName() ) ; | |
251 | fReTask = new TTask(GetName(), tempo); | |
252 | aliceRe->Add(fReTask) ; | |
253 | ||
3ff0c331 | 254 | delete [] tempo ; |
68861244 | 255 | |
256 | // creates the TOF geometry folder | |
257 | geomF->AddFolder("TOF", "Geometry for TOF") ; | |
258 | } | |
259 | ||
260 | //_____________________________________________________________________________ | |
261 | AliTOF::~AliTOF() | |
262 | { | |
517b7f8f | 263 | // dtor: |
264 | // it remove also the alice folder | |
68861244 | 265 | // and task that TOF creates instead of AliRun |
5839f074 | 266 | /* PH Temporarily commented because of problems |
68861244 | 267 | TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("FPAlice") ; |
268 | delete alice; | |
269 | alice = 0; | |
5839f074 | 270 | */ |
517b7f8f | 271 | if (fHits) |
272 | { | |
273 | fHits->Delete (); | |
274 | delete fHits; | |
275 | fHits = 0; | |
276 | } | |
277 | if (fDigits) | |
278 | { | |
279 | fDigits->Delete (); | |
280 | delete fDigits; | |
281 | fDigits = 0; | |
282 | } | |
283 | if (fSDigits) | |
284 | { | |
88cb7938 | 285 | fSDigits->Delete(); |
517b7f8f | 286 | delete fSDigits; |
287 | fSDigits = 0; | |
288 | } | |
571dda3d | 289 | |
517b7f8f | 290 | if (fReconParticles) |
291 | { | |
292 | fReconParticles->Delete (); | |
293 | delete fReconParticles; | |
294 | fReconParticles = 0; | |
295 | } | |
296 | ||
fe4da5cc | 297 | } |
298 | ||
299 | //_____________________________________________________________________________ | |
2cef3cb2 | 300 | void AliTOF::AddHit(Int_t track, Int_t *vol, Float_t *hits) |
fe4da5cc | 301 | { |
302 | // | |
303 | // Add a TOF hit | |
68861244 | 304 | // new with placement used |
fe4da5cc | 305 | // |
306 | TClonesArray &lhits = *fHits; | |
2cef3cb2 | 307 | new(lhits[fNhits++]) AliTOFhit(fIshunt, track, vol, hits); |
fe4da5cc | 308 | } |
d599d913 | 309 | |
310 | //_____________________________________________________________________________ | |
311 | void AliTOF::AddT0Hit(Int_t track, Int_t *vol, Float_t *hits) | |
312 | { | |
313 | // | |
314 | // Add a TOF hit | |
315 | // new with placement used | |
316 | // | |
317 | TClonesArray &lhits = *fHits; | |
318 | new(lhits[fNhits++]) AliTOFhitT0(fIshunt, track, vol, hits); | |
319 | } | |
320 | ||
fe4da5cc | 321 | //_____________________________________________________________________________ |
bf33f8f0 | 322 | void AliTOF::AddDigit(Int_t *tracks, Int_t *vol, Int_t *digits) |
fe4da5cc | 323 | { |
324 | // | |
2cef3cb2 | 325 | // Add a TOF digit |
68861244 | 326 | // new with placement used |
2cef3cb2 | 327 | // |
328 | TClonesArray &ldigits = *fDigits; | |
329 | new (ldigits[fNdigits++]) AliTOFdigit(tracks, vol, digits); | |
fe4da5cc | 330 | } |
331 | ||
d3c7bfac | 332 | //_____________________________________________________________________________ |
bf33f8f0 | 333 | void AliTOF::AddSDigit(Int_t tracknum, Int_t *vol, Int_t *digits) |
517b7f8f | 334 | { |
335 | ||
336 | // | |
337 | // Add a TOF sdigit | |
338 | // | |
339 | ||
340 | TClonesArray &lSDigits = *fSDigits; | |
5919c40c | 341 | new(lSDigits[fNSDigits++]) AliTOFSDigit(tracknum, vol, digits); |
517b7f8f | 342 | } |
343 | ||
344 | //_____________________________________________________________________________ | |
345 | void AliTOF::SetTreeAddress () | |
346 | { | |
347 | // Set branch address for the Hits and Digits Tree. | |
88cb7938 | 348 | |
349 | if (fLoader->TreeH()) | |
350 | { | |
351 | if (fHits == 0x0) | |
352 | { | |
353 | if (fTZero) fHits = new TClonesArray("AliTOFhitT0", 1000); | |
354 | else fHits = new TClonesArray("AliTOFhit", 1000); | |
355 | } | |
356 | } | |
517b7f8f | 357 | AliDetector::SetTreeAddress (); |
358 | ||
359 | TBranch *branch; | |
517b7f8f | 360 | |
88cb7938 | 361 | if (fLoader->TreeS () ) |
517b7f8f | 362 | { |
88cb7938 | 363 | branch = fLoader->TreeS ()->GetBranch ("TOF"); |
364 | if (branch) { | |
365 | if (fSDigits == 0x0) fSDigits = new TClonesArray("AliTOFSDigit", 1000); | |
366 | branch->SetAddress (&fSDigits); | |
367 | } | |
517b7f8f | 368 | } |
369 | ||
571dda3d | 370 | if (fLoader->TreeR() ) |
371 | { | |
372 | branch = fLoader->TreeR()->GetBranch("TOF"); | |
373 | if (branch) | |
374 | { | |
375 | if (fReconParticles == 0x0) fReconParticles = new TClonesArray("AliTOFcluster", 1000); | |
376 | branch->SetAddress(&fReconParticles); | |
377 | } | |
378 | } | |
379 | ||
380 | /* | |
88cb7938 | 381 | if (fLoader->TreeR() && fReconParticles) //I do not know where this array is created - skowron |
517b7f8f | 382 | { |
88cb7938 | 383 | branch = fLoader->TreeR()->GetBranch("TOF"); |
384 | if (branch) | |
385 | { | |
386 | branch->SetAddress(&fReconParticles) ; | |
387 | } | |
571dda3d | 388 | } |
389 | */ | |
517b7f8f | 390 | } |
2cef3cb2 | 391 | |
fe4da5cc | 392 | //_____________________________________________________________________________ |
393 | void AliTOF::CreateGeometry() | |
394 | { | |
395 | // | |
3fe3a833 | 396 | // Common geometry code |
fe4da5cc | 397 | // |
398 | //Begin_Html | |
399 | /* | |
1439f98e | 400 | <img src="picts/AliTOFv23.gif"> |
fe4da5cc | 401 | */ |
402 | //End_Html | |
403 | // | |
937fe4a4 | 404 | |
d3c7bfac | 405 | Float_t xTof, yTof; |
406 | ||
dfef1a15 | 407 | if (IsVersion()==8) { |
408 | ||
409 | xTof = 124.5;//fTOFGeometry->StripLength()+2.*(0.3+0.03); // cm, x-dimension of FTOA volume | |
410 | yTof = fTOFGeometry->Rmax()-fTOFGeometry->Rmin(); // cm, y-dimension of FTOA volume | |
411 | Float_t zTof = fTOFGeometry->ZlenA(); // cm, z-dimension of FTOA volume | |
412 | ||
413 | // TOF module internal definitions | |
414 | TOFpc(xTof, yTof, zTof); | |
415 | ||
416 | } else if (IsVersion()==7) { | |
d3c7bfac | 417 | |
1ac1b685 | 418 | xTof = 124.5;//fTOFGeometry->StripLength()+2.*(0.3+0.03); // cm, x-dimension of FTOA volume |
d3c7bfac | 419 | yTof = fTOFGeometry->Rmax()-fTOFGeometry->Rmin(); // cm, y-dimension of FTOA volume |
420 | Float_t zTof = fTOFGeometry->ZlenA(); // cm, z-dimension of FTOA volume | |
421 | ||
422 | // TOF module internal definitions | |
423 | TOFpc(xTof, yTof, zTof, fTOFGeometry->ZlenB()); | |
3fe3a833 | 424 | |
d3c7bfac | 425 | } else { |
426 | ||
427 | Float_t wall = 4.;//cm // frame inbetween TOF modules | |
428 | ||
429 | // Sizes of TOF module with its support etc.. | |
430 | xTof = 2.*(fTOFGeometry->Rmin()*TMath::Tan(10.*kDegrad)-wall/2.-0.5); | |
431 | yTof = fTOFGeometry->Rmax()-fTOFGeometry->Rmin(); | |
432 | ||
433 | // TOF module internal definitions | |
434 | TOFpc(xTof, yTof, fTOFGeometry->ZlenC(), fTOFGeometry->ZlenB(), fTOFGeometry->ZlenA(), fTOFGeometry->MaxhZtof()); | |
435 | } | |
3fe3a833 | 436 | |
fe4da5cc | 437 | } |
438 | ||
439 | //_____________________________________________________________________________ | |
ba380e33 | 440 | void AliTOF::DrawModule() const |
fe4da5cc | 441 | { |
442 | // | |
443 | // Draw a shaded view of the common part of the TOF geometry | |
fe4da5cc | 444 | // |
445 | ||
d076c8d5 | 446 | AliInfo(" Drawing of AliTOF"); |
fe4da5cc | 447 | // Set everything unseen |
cfce8870 | 448 | gMC->Gsatt("*", "seen", -1); |
fe4da5cc | 449 | // |
450 | // Set ALIC mother transparent | |
cfce8870 | 451 | gMC->Gsatt("ALIC","SEEN",0); |
fe4da5cc | 452 | // |
453 | // Set the volumes visible | |
2cef3cb2 | 454 | gMC->Gsatt("FTOA","SEEN",1); |
455 | gMC->Gsatt("FTOB","SEEN",1); | |
456 | gMC->Gsatt("FTOC","SEEN",1); | |
457 | gMC->Gsatt("FLTA","SEEN",1); | |
458 | gMC->Gsatt("FLTB","SEEN",1); | |
459 | gMC->Gsatt("FLTC","SEEN",1); | |
460 | gMC->Gsatt("FSTR","SEEN",1); | |
cfce8870 | 461 | // |
462 | gMC->Gdopt("hide", "on"); | |
463 | gMC->Gdopt("shad", "on"); | |
464 | gMC->Gsatt("*", "fill", 7); | |
465 | gMC->SetClipBox("."); | |
466 | gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000); | |
467 | gMC->DefaultRange(); | |
468 | gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02); | |
469 | gMC->Gdhead(1111, "Time Of Flight"); | |
470 | gMC->Gdman(18, 4, "MAN"); | |
471 | gMC->Gdopt("hide","off"); | |
fe4da5cc | 472 | } |
473 | ||
fe4da5cc | 474 | //_____________________________________________________________________________ |
0e46b9ae | 475 | Int_t AliTOF::DistancetoPrimitive(Int_t , Int_t ) |
fe4da5cc | 476 | { |
477 | // | |
478 | // Returns distance from mouse pointer to detector, default version | |
479 | // | |
480 | return 9999; | |
481 | } | |
517b7f8f | 482 | |
483 | //___________________________________________ | |
484 | void AliTOF::ResetHits () | |
485 | { | |
486 | // Reset number of clusters and the cluster array for this detector | |
487 | AliDetector::ResetHits (); | |
488 | } | |
489 | ||
490 | //____________________________________________ | |
491 | void AliTOF::ResetDigits () | |
492 | { | |
493 | // | |
494 | // Reset number of digits and the digits array for this detector | |
495 | AliDetector::ResetDigits (); | |
496 | // | |
497 | } | |
d61f73d9 | 498 | //____________________________________________ |
499 | void AliTOF::ResetSDigits () | |
500 | { | |
501 | // | |
502 | // Reset number of sdigits and the sdigits array for this detector | |
503 | fNSDigits = 0; | |
e615b5b5 | 504 | //fSDigits = 0x0; |
d61f73d9 | 505 | // |
506 | } | |
fe4da5cc | 507 | //_____________________________________________________________________________ |
508 | void AliTOF::Init() | |
509 | { | |
510 | // | |
511 | // Initialise TOF detector after it has been built | |
512 | // | |
fe4da5cc | 513 | // Set id of TOF sensitive volume |
937fe4a4 | 514 | if (IsVersion() !=0) fIdSens=gMC->VolId("FPAD"); |
d3c7bfac | 515 | |
516 | /* | |
d076c8d5 | 517 | // Save the geometry |
518 | TDirectory* saveDir = gDirectory; | |
519 | gAlice->GetRunLoader()->CdGAFile(); | |
520 | fTOFGeometry->Write("TOFGeometry"); | |
521 | saveDir->cd(); | |
d3c7bfac | 522 | */ |
fe4da5cc | 523 | } |
524 | ||
2cef3cb2 | 525 | //____________________________________________________________________________ |
88cb7938 | 526 | void AliTOF::MakeBranch(Option_t* option) |
2cef3cb2 | 527 | { |
b94fa26c | 528 | // |
529 | // Initializes the Branches of the TOF inside the | |
530 | // trees written for each event. | |
517b7f8f | 531 | // AliDetector::MakeBranch initializes just the |
68861244 | 532 | // Branch inside TreeH. Here we add the branches in |
517b7f8f | 533 | // TreeD, TreeS and TreeR. |
b94fa26c | 534 | // |
88cb7938 | 535 | const char *oH = strstr(option,"H"); |
536 | if (fLoader->TreeH() && oH) | |
537 | { | |
538 | if (fHits == 0x0) | |
539 | { | |
540 | if (fTZero) fHits = new TClonesArray("AliTOFhitT0", 1000); | |
541 | else fHits = new TClonesArray("AliTOFhit", 1000); | |
542 | } | |
543 | } | |
544 | ||
545 | AliDetector::MakeBranch(option); | |
2cef3cb2 | 546 | |
547 | Int_t buffersize = 4000; | |
548 | Char_t branchname[10]; | |
549 | sprintf(branchname,"%s",GetName()); | |
2ab0c725 | 550 | |
68861244 | 551 | const char *oD = strstr(option,"D"); |
552 | const char *oS = strstr(option,"S"); | |
517b7f8f | 553 | const char *oR = strstr(option,"R"); |
68861244 | 554 | |
88cb7938 | 555 | if (fLoader->TreeD() && oD){ |
556 | if (fDigits == 0x0) fDigits = new TClonesArray("AliTOFdigit", 1000); | |
557 | MakeBranchInTree(fLoader->TreeD(), branchname, &fDigits,buffersize, 0) ; | |
2cef3cb2 | 558 | } |
68861244 | 559 | |
88cb7938 | 560 | if (fLoader->TreeS() && oS){ |
561 | if (fSDigits == 0x0) fSDigits = new TClonesArray("AliTOFSDigit", 1000); | |
562 | MakeBranchInTree(fLoader->TreeS(), branchname, &fSDigits,buffersize, 0) ; | |
68861244 | 563 | } |
564 | ||
571dda3d | 565 | if (fLoader->TreeR() && oR){ |
566 | if (fReconParticles == 0x0) fReconParticles = new TClonesArray("AliTOFcluster", 1000); | |
567 | MakeBranchInTree(fLoader->TreeR(), branchname, &fReconParticles,buffersize, 0) ; | |
568 | } | |
569 | ||
570 | /* | |
88cb7938 | 571 | if (fReconParticles && fLoader->TreeR() && oR){ |
572 | MakeBranchInTree(fLoader->TreeR(), branchname, &fReconParticles,buffersize, 0) ; | |
517b7f8f | 573 | } |
571dda3d | 574 | */ |
68861244 | 575 | } |
576 | ||
577 | //____________________________________________________________________________ | |
578 | void AliTOF::Makehits(Bool_t hits) | |
579 | { | |
580 | // default argument used, see AliTOF.h | |
581 | // Enable/Disable the writing of the TOF-hits branch | |
582 | // on TreeH | |
d3c7bfac | 583 | // by default : enabled for TOFv1, v2, v3, v4, v5 |
68861244 | 584 | // disabled for TOFv0 |
585 | // | |
586 | if (hits && (IsVersion()!=0)) | |
587 | fIdSens = gMC->VolId("FPAD"); | |
588 | else | |
d076c8d5 | 589 | AliInfo("Option for writing the TOF-hits branch on TreeH: disabled"); |
2cef3cb2 | 590 | } |
591 | ||
592 | //____________________________________________________________________________ | |
593 | void AliTOF::FinishEvent() | |
594 | { | |
68861244 | 595 | // do nothing |
2cef3cb2 | 596 | } |
597 | ||
d3c7bfac | 598 | //____________________________________________________________________________ |
517b7f8f | 599 | void AliTOF::Hits2SDigits() |
600 | { | |
601 | // | |
602 | // Use the TOF SDigitizer to make TOF SDigits | |
603 | // | |
d61f73d9 | 604 | |
0e46b9ae | 605 | // AliInfo("Start..."); |
68861244 | 606 | |
be385a87 | 607 | AliRunLoader * rl = fLoader->GetRunLoader(); |
608 | AliTOFSDigitizer sd((rl->GetFileName()).Data()); | |
d076c8d5 | 609 | ToAliDebug(1, sd.Print("")); |
68861244 | 610 | |
be385a87 | 611 | sd.Exec("") ; |
d61f73d9 | 612 | |
613 | } | |
614 | ||
d3c7bfac | 615 | //____________________________________________________________________________ |
d61f73d9 | 616 | void AliTOF::Hits2SDigits(Int_t evNumber1, Int_t evNumber2) |
617 | { | |
618 | // | |
619 | // Use the TOF SDigitizer to make TOF SDigits | |
620 | // | |
621 | ||
622 | if ((evNumber2-evNumber1)==1) | |
96f8ea5a | 623 | AliDebug(1, Form("I am making sdigits for the %dth event", evNumber1)); |
624 | if ((evNumber2-evNumber1)>1) | |
625 | AliDebug(1, Form("I am making sdigits for the events from the %dth to the %dth", evNumber1, evNumber2-1)); | |
d61f73d9 | 626 | |
be385a87 | 627 | AliRunLoader * rl = fLoader->GetRunLoader(); |
628 | AliTOFSDigitizer sd((rl->GetFileName()).Data(),evNumber1,evNumber2) ; | |
d076c8d5 | 629 | ToAliDebug(1, sd.Print("")); |
68861244 | 630 | |
be385a87 | 631 | sd.Exec("") ; |
d61f73d9 | 632 | |
2cef3cb2 | 633 | } |
d61f73d9 | 634 | |
2cef3cb2 | 635 | //___________________________________________________________________________ |
c92eb8ad | 636 | AliDigitizer* AliTOF::CreateDigitizer(AliRunDigitizer* manager) const |
85a5290f | 637 | { |
638 | return new AliTOFDigitizer(manager); | |
639 | } | |
640 | ||
641 | //___________________________________________________________________________ | |
bf33f8f0 | 642 | Bool_t AliTOF::CheckOverlap(Int_t* vol, Int_t* digit,Int_t Track) |
b94fa26c | 643 | { |
2cef3cb2 | 644 | // |
645 | // Checks if 2 or more hits belong to the same pad. | |
646 | // In this case the data assigned to the digit object | |
647 | // are the ones of the first hit in order of Time. | |
517b7f8f | 648 | // 2 hits from the same track on the same pad are collected. |
649 | // Called only by Hits2SDigits. | |
650 | // This procedure has to be optimized in the next TOF release. | |
2cef3cb2 | 651 | // |
b94fa26c | 652 | |
d3c7bfac | 653 | Bool_t overlap = kFALSE; |
654 | Int_t vol2[5]; | |
655 | ||
656 | for (Int_t ndig=0; ndig<fSDigits->GetEntries(); ndig++){ | |
657 | AliTOFdigit* currentDigit = (AliTOFdigit*)(fSDigits->UncheckedAt(ndig)); | |
658 | currentDigit->GetLocation(vol2); | |
659 | Bool_t idem= kTRUE; | |
660 | // check on digit volume | |
661 | for (Int_t i=0;i<=4;i++){ | |
662 | if (!idem) break; | |
663 | if (vol[i]!=vol2[i]) idem=kFALSE;} | |
664 | ||
665 | if (idem){ // same pad fired | |
bf33f8f0 | 666 | Int_t tdc2 = digit[0]; |
667 | Int_t tdc1 = currentDigit->GetTdc(); | |
d3c7bfac | 668 | |
669 | // we separate two digits on the same pad if | |
670 | // they are separated in time by at least 25 ns | |
671 | // remember that tdc time is given in ps | |
672 | ||
673 | if (TMath::Abs(tdc1-tdc2)<25000){ | |
674 | // in case of overlap we take the earliest | |
675 | if (tdc1>tdc2){ | |
676 | currentDigit->SetTdc(tdc2); | |
677 | currentDigit->SetAdc(digit[1]); | |
678 | } | |
679 | else { | |
680 | currentDigit->SetTdc(tdc1); | |
681 | currentDigit->SetAdc(digit[1]); | |
682 | } | |
683 | currentDigit->AddTrack(Track); // add track number in the track array | |
684 | overlap = kTRUE; | |
685 | return overlap; | |
686 | } else | |
bf33f8f0 | 687 | overlap= kFALSE; |
517b7f8f | 688 | |
d3c7bfac | 689 | } // close if (idem) -> two digits on the same TOF pad |
517b7f8f | 690 | |
d3c7bfac | 691 | } // end loop on existing sdigits |
517b7f8f | 692 | |
d3c7bfac | 693 | return overlap; |
2cef3cb2 | 694 | } |
2cef3cb2 | 695 | //____________________________________________________________________________ |
7e6dce66 | 696 | void AliTOF::Digits2Raw() |
b94fa26c | 697 | { |
2cef3cb2 | 698 | // |
7e6dce66 | 699 | // Starting from the TOF digits, writes the Raw Data objects |
2cef3cb2 | 700 | // |
701 | ||
515faf5d | 702 | TStopwatch stopwatch; |
703 | stopwatch.Start(); | |
704 | ||
7e6dce66 | 705 | fLoader->LoadDigits(); |
2cef3cb2 | 706 | |
7e6dce66 | 707 | TTree* digits = fLoader->TreeD(); |
708 | if (!digits) { | |
d076c8d5 | 709 | AliError("no digits tree"); |
7e6dce66 | 710 | return; |
711 | } | |
2cef3cb2 | 712 | |
d3c7bfac | 713 | fRunLoader->CdGAFile(); |
714 | TFile *in=(TFile*)gFile; | |
715 | in->cd(); | |
716 | AliTOFGeometry *geometry = (AliTOFGeometry*)in->Get("TOFgeometry"); | |
717 | ||
718 | AliTOFDDLRawData rawWriter(geometry); | |
719 | //AliTOFDDLRawData rawWriter; | |
5b8979d4 | 720 | rawWriter.SetVerbose(0); |
515faf5d | 721 | //rawWriter.SetFakeOrphaneProduction(kTRUE); |
722 | //rawWriter.SetPackedAcquisitionMode(kFALSE); | |
723 | if (rawWriter.GetPackedAcquisitionMode()) { | |
724 | if(rawWriter.GetMatchingWindow()>8192) | |
dfef1a15 | 725 | AliWarning(Form("You are running in packing mode and the matching window is %.2f ns, i.e. greater than 199.8848 ns", |
f45f1432 | 726 | rawWriter.GetMatchingWindow()*AliTOFGeometry::TdcBinWidth()*1.e-03)); |
515faf5d | 727 | } |
2cef3cb2 | 728 | |
ba795372 | 729 | AliDebug(1,"Formatting raw data for TOF"); |
7e6dce66 | 730 | digits->GetEvent(0); |
731 | rawWriter.RawDataTOF(digits->GetBranch("TOF")); | |
2cef3cb2 | 732 | |
7e6dce66 | 733 | fLoader->UnloadDigits(); |
734 | ||
515faf5d | 735 | AliDebug(1, Form("Execution time to write TOF raw data : R:%.2fs C:%.2fs", |
736 | stopwatch.RealTime(),stopwatch.CpuTime())); | |
737 | ||
7e6dce66 | 738 | } |
d3c7bfac | 739 | |
740 | //____________________________________________________________________________ | |
55991c8b | 741 | void AliTOF::RecreateSDigitsArray() { |
742 | // | |
743 | // delete TClonesArray fSDigits and create it again | |
744 | // needed for backward compatability with PPR test production | |
745 | // | |
746 | delete fSDigits; | |
747 | fSDigits = new TClonesArray("AliTOFSDigit", 1000); | |
748 | } | |
d3c7bfac | 749 | //____________________________________________________________________________ |
55991c8b | 750 | void AliTOF::CreateSDigitsArray() { |
751 | // | |
752 | // create TClonesArray fSDigits | |
753 | // needed for backward compatability with PPR test production | |
754 | // | |
755 | fSDigits = new TClonesArray("AliTOFSDigit", 1000); | |
756 | } |