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