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