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