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