Line data Source code
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 *TVirtualMC::GetMC();
73 :
74 : // extern AliRun *gAlice;
75 :
76 26 : ClassImp(AliTOF)
77 :
78 : //_____________________________________________________________________________
79 12 : AliTOF::AliTOF():
80 12 : fFGeom(0x0),
81 12 : fSDigits(0x0),
82 12 : fNSDigits(0),
83 12 : fReconParticles(0x0),
84 12 : fIdSens(-1),
85 12 : fTZero(kFALSE),
86 12 : fTOFHoles(kTRUE),
87 12 : fTOFGeometry(0x0),
88 12 : fTOFRawWriter(AliTOFDDLRawData())
89 36 : {
90 : //
91 : // Default constructor
92 : //
93 :
94 : //by default all sectors switched on
95 456 : for (Int_t ii=0; ii<18; ii++) fTOFSectors[ii]=0;
96 :
97 12 : fDigits = 0;
98 12 : fIshunt = 0;
99 12 : fName = "TOF";
100 :
101 12 : }
102 :
103 : //_____________________________________________________________________________
104 : AliTOF::AliTOF(const char *name, const char *title, Option_t *option)
105 : :
106 1 : AliDetector(name,title),
107 1 : fFGeom(0x0),
108 1 : fSDigits(0x0),
109 1 : fNSDigits(0),
110 1 : fReconParticles(0x0),
111 1 : fIdSens(-1),
112 1 : fTZero(kFALSE),
113 1 : fTOFHoles(kTRUE),
114 1 : fTOFGeometry(0x0),
115 1 : fTOFRawWriter(AliTOFDDLRawData())
116 3 : {
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 3 : fTOFGeometry = new AliTOFGeometry();
127 :
128 : //by default all sectors switched on
129 38 : for (Int_t ii=0; ii<18; ii++) fTOFSectors[ii]=0;
130 :
131 2 : if (strstr(option,"tzero")){
132 3 : fHits = new TClonesArray("AliTOFhitT0", 1000);
133 1 : fTZero = kTRUE;
134 : // AliWarning("tzero option requires AliTOFv4T0/AliTOFv5T0 as TOF version (check Your Config.C)");
135 1 : }else{
136 0 : fHits = new TClonesArray("AliTOFhit", 1000);
137 0 : fTZero = kFALSE;
138 : }
139 1 : if (gAlice==0) {
140 0 : AliFatal("gAlice==0 !");
141 : }
142 :
143 1 : AliMC *mcApplication = (AliMC*)gAlice->GetMCApp();
144 :
145 1 : if (mcApplication->GetHitLists())
146 1 : mcApplication->AddHitList(fHits);
147 0 : else AliError("gAlice->GetHitLists()==0");
148 :
149 1 : fIshunt = 0;
150 3 : fSDigits = new TClonesArray("AliTOFSDigit", 1000);
151 3 : 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 1 : }
171 :
172 : //____________________________________________________________________________
173 : void AliTOF::SetTOFSectors(Int_t * const sectors)
174 : {
175 : // Setter for partial/full TOF configuration
176 :
177 0 : for(Int_t isec=0;isec<18;isec++){
178 0 : fTOFSectors[isec]=sectors[isec];
179 : }
180 0 : }
181 : //____________________________________________________________________________
182 : void AliTOF::GetTOFSectors(Int_t *sectors) const
183 : {
184 : // Getter for partial/full TOF configuration
185 :
186 0 : for(Int_t isec=0;isec<18;isec++){
187 0 : sectors[isec]=fTOFSectors[isec];
188 : }
189 0 : }
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 0 : TFolder * alice = new TFolder();
199 0 : alice->SetNameTitle("FPAlice", "Alice Folder") ;
200 0 : gROOT->GetListOfBrowsables()->Add(alice) ;
201 :
202 0 : TFolder * aliceF = alice->AddFolder("folders", "Alice memory Folder") ;
203 : // make it the owner of the objects that it contains
204 0 : aliceF->SetOwner() ;
205 : // geometry folder
206 0 : TFolder * geomF = aliceF->AddFolder("Geometry", "Geometry objects") ;
207 :
208 : // creates the TOF geometry folder
209 0 : geomF->AddFolder("TOF", "Geometry for TOF") ;
210 0 : }
211 :
212 : //_____________________________________________________________________________
213 : AliTOF::~AliTOF()
214 26 : {
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 13 : if (fHits)
223 : {
224 3 : fHits->Delete ();
225 6 : delete fHits;
226 3 : fHits = 0;
227 3 : }
228 13 : if (fDigits)
229 : {
230 1 : fDigits->Delete ();
231 2 : delete fDigits;
232 1 : fDigits = 0;
233 1 : }
234 13 : if (fSDigits)
235 : {
236 4 : fSDigits->Delete();
237 8 : delete fSDigits;
238 4 : fSDigits = 0;
239 4 : }
240 :
241 13 : if (fReconParticles)
242 : {
243 1 : fReconParticles->Delete ();
244 2 : delete fReconParticles;
245 1 : fReconParticles = 0;
246 1 : }
247 :
248 13 : }
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 0 : TClonesArray &lhits = *fHits;
258 0 : new(lhits[fNhits++]) AliTOFhit(fIshunt, track, vol, hits);
259 0 : }
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 168 : TClonesArray &lhits = *fHits;
269 84 : new(lhits[fNhits++]) AliTOFhitT0(fIshunt, track, vol, hits);
270 84 : }
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 0 : TClonesArray &ldigits = *fDigits;
280 0 : new (ldigits[fNdigits++]) AliTOFdigit(tracks, vol, digits);
281 0 : }
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 200 : TClonesArray &lSDigits = *fSDigits;
292 100 : new(lSDigits[fNSDigits++]) AliTOFSDigit(tracknum, vol, digits);
293 100 : }
294 :
295 : //_____________________________________________________________________________
296 : void AliTOF::SetTreeAddress ()
297 : {
298 : // Set branch address for the Hits and Digits Tree.
299 :
300 328 : if (fLoader->TreeH())
301 : {
302 34 : if (fHits == 0x0)
303 : {
304 6 : if (fTZero) fHits = new TClonesArray("AliTOFhitT0", 1000);
305 0 : else fHits = new TClonesArray("AliTOFhit", 1000);
306 : }
307 : }
308 164 : AliDetector::SetTreeAddress ();
309 :
310 : TBranch *branch;
311 :
312 164 : if (fLoader->TreeS () )
313 : {
314 36 : branch = fLoader->TreeS ()->GetBranch ("TOF");
315 36 : if (branch) {
316 39 : if (fSDigits == 0x0) fSDigits = new TClonesArray("AliTOFSDigit", 1000);
317 35 : branch->SetAddress (&fSDigits);
318 35 : }
319 : }
320 :
321 164 : if (fLoader->TreeR() )
322 : {
323 16 : branch = fLoader->TreeR()->GetBranch("TOF");
324 16 : if (branch)
325 : {
326 14 : if (fReconParticles == 0x0) fReconParticles = new TClonesArray("AliTOFcluster", 1000);
327 12 : branch->SetAddress(&fReconParticles);
328 12 : }
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 164 : }
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 2 : if (IsVersion()==8) {
359 :
360 : xTof = 124.5;//fTOFGeometry->StripLength()+2.*(0.3+0.03); // cm, x-dimension of FTOA volume
361 1 : yTof = fTOFGeometry->Rmax()-fTOFGeometry->Rmin(); // cm, y-dimension of FTOA volume
362 1 : Float_t zTof = fTOFGeometry->ZlenA(); // cm, z-dimension of FTOA volume
363 :
364 : // TOF module internal definitions
365 1 : TOFpc(xTof, yTof, zTof);
366 :
367 1 : } else if (IsVersion()==7) {
368 :
369 : xTof = 124.5;//fTOFGeometry->StripLength()+2.*(0.3+0.03); // cm, x-dimension of FTOA volume
370 0 : yTof = fTOFGeometry->Rmax()-fTOFGeometry->Rmin(); // cm, y-dimension of FTOA volume
371 0 : Float_t zTof = fTOFGeometry->ZlenA(); // cm, z-dimension of FTOA volume
372 :
373 : // TOF module internal definitions
374 0 : TOFpc(xTof, yTof, zTof, fTOFGeometry->ZlenB());
375 :
376 0 : } else {
377 :
378 : Float_t wall = 4.;//cm // frame inbetween TOF modules
379 :
380 : // Sizes of TOF module with its support etc..
381 0 : xTof = 2.*(fTOFGeometry->Rmin()*TMath::Tan(10.*kDegrad)-wall/2.-0.5);
382 0 : yTof = fTOFGeometry->Rmax()-fTOFGeometry->Rmin();
383 :
384 : // TOF module internal definitions
385 0 : TOFpc(xTof, yTof, fTOFGeometry->ZlenC(), fTOFGeometry->ZlenB(), fTOFGeometry->ZlenA(), fTOFGeometry->MaxhZtof());
386 : }
387 :
388 1 : }
389 :
390 :
391 : //___________________________________________
392 : void AliTOF::ResetHits ()
393 : {
394 : // Reset number of clusters and the cluster array for this detector
395 904 : AliDetector::ResetHits ();
396 452 : }
397 :
398 : //____________________________________________
399 : void AliTOF::ResetDigits ()
400 : {
401 : //
402 : // Reset number of digits and the digits array for this detector
403 0 : AliDetector::ResetDigits ();
404 : //
405 0 : }
406 : //____________________________________________
407 : void AliTOF::ResetSDigits ()
408 : {
409 : //
410 : // Reset number of sdigits and the sdigits array for this detector
411 8 : fNSDigits = 0;
412 : //fSDigits = 0x0;
413 : //
414 4 : }
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 3 : if (IsVersion() !=0) fIdSens=TVirtualMC::GetMC()->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 1 : }
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 16 : const char *oH = strstr(option,"H");
444 8 : if (fLoader->TreeH() && oH)
445 : {
446 4 : if (fHits == 0x0)
447 : {
448 0 : if (fTZero) fHits = new TClonesArray("AliTOFhitT0", 1000);
449 0 : else fHits = new TClonesArray("AliTOFhit", 1000);
450 : }
451 : }
452 :
453 8 : AliDetector::MakeBranch(option);
454 :
455 : Int_t buffersize = 4000;
456 : const Int_t kSize=10;
457 8 : Char_t branchname[kSize];
458 8 : snprintf(branchname,kSize,"%s",GetName());
459 :
460 8 : const char *oD = strstr(option,"D");
461 8 : const char *oS = strstr(option,"S");
462 8 : const char *oR = strstr(option,"R");
463 :
464 8 : if (fLoader->TreeD() && oD){
465 0 : if (fDigits == 0x0) fDigits = new TClonesArray("AliTOFdigit", 1000);
466 0 : MakeBranchInTree(fLoader->TreeD(), branchname, &fDigits,buffersize, 0) ;
467 0 : }
468 :
469 8 : if (fLoader->TreeS() && oS){
470 6 : if (fSDigits == 0x0) fSDigits = new TClonesArray("AliTOFSDigit", 1000);
471 4 : MakeBranchInTree(fLoader->TreeS(), branchname, &fSDigits,buffersize, 0) ;
472 4 : }
473 :
474 8 : if (fLoader->TreeR() && oR){
475 0 : if (fReconParticles == 0x0) fReconParticles = new TClonesArray("AliTOFcluster", 1000);
476 0 : MakeBranchInTree(fLoader->TreeR(), branchname, &fReconParticles,buffersize, 0) ;
477 0 : }
478 :
479 : /*
480 : if (fReconParticles && fLoader->TreeR() && oR){
481 : MakeBranchInTree(fLoader->TreeR(), branchname, &fReconParticles,buffersize, 0) ;
482 : }
483 : */
484 8 : }
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 0 : if (hits && (IsVersion()!=0))
496 0 : fIdSens = TVirtualMC::GetMC()->VolId("FPAD");
497 : else
498 0 : AliInfo("Option for writing the TOF-hits branch on TreeH: disabled");
499 0 : }
500 :
501 : //____________________________________________________________________________
502 : void AliTOF::FinishEvent()
503 : {
504 : // do nothing
505 8 : }
506 :
507 : //____________________________________________________________________________
508 : void AliTOF::Hits2SDigits()
509 : {
510 : //
511 : // Use the TOF SDigitizer to make TOF SDigits
512 : //
513 :
514 : // AliInfo("Start...");
515 :
516 2 : AliRunLoader * rl = fLoader->GetRunLoader();
517 3 : AliDebug(2,"Initialized runLoader");
518 3 : AliTOFSDigitizer sd((rl->GetFileName()).Data());
519 5 : AliDebug(2,"Initialized TOF sdigitizer");
520 : //ToAliDebug(1, sd.Print(""));
521 : //AliInfo("ToAliDebug");
522 :
523 : //sd.Digitize("all") ;
524 1 : sd.Digitize("partial") ;
525 :
526 5 : AliDebug(2,"I am sorting from AliTOF class");
527 :
528 1 : }
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 0 : if ((evNumber2-evNumber1)==1)
538 0 : AliDebug(1, Form("I am making sdigits for the %dth event", evNumber1));
539 0 : if ((evNumber2-evNumber1)>1)
540 0 : AliDebug(1, Form("I am making sdigits for the events from the %dth to the %dth", evNumber1, evNumber2-1));
541 :
542 0 : AliRunLoader * rl = fLoader->GetRunLoader();
543 0 : AliTOFSDigitizer sd((rl->GetFileName()).Data(),evNumber1,evNumber2) ;
544 0 : ToAliDebug(1, sd.Print(""));
545 :
546 0 : sd.Digitize("") ;
547 :
548 0 : }
549 :
550 : //___________________________________________________________________________
551 : AliDigitizer* AliTOF::CreateDigitizer(AliDigitizationInput* digInput) const
552 : {
553 4 : AliDebug(2,"I am creating the TOF digitizer");
554 2 : return new AliTOFDigitizer(digInput);
555 0 : }
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 0 : Int_t vol2[5];
572 :
573 0 : for (Int_t ndig=0; ndig<fSDigits->GetEntries(); ndig++){
574 0 : AliTOFdigit* currentDigit = (AliTOFdigit*)(fSDigits->UncheckedAt(ndig));
575 0 : currentDigit->GetLocation(vol2);
576 : Bool_t idem= kTRUE;
577 : // check on digit volume
578 0 : for (Int_t i=0;i<=4;i++){
579 0 : if (!idem) break;
580 0 : if (vol[i]!=vol2[i]) idem=kFALSE;}
581 :
582 0 : if (idem){ // same pad fired
583 0 : Int_t tdc2 = digit[0];
584 0 : 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 0 : if (TMath::Abs(tdc1-tdc2)<25000){
591 : // in case of overlap we take the earliest
592 0 : if (tdc1>tdc2){
593 0 : currentDigit->SetTdc(tdc2);
594 0 : currentDigit->SetAdc(digit[1]);
595 0 : }
596 : else {
597 0 : currentDigit->SetTdc(tdc1);
598 0 : currentDigit->SetAdc(digit[1]);
599 : }
600 0 : currentDigit->AddTrack(Track); // add track number in the track array
601 : overlap = kTRUE;
602 0 : return overlap;
603 : } else
604 : overlap= kFALSE;
605 :
606 0 : } // close if (idem) -> two digits on the same TOF pad
607 :
608 0 : } // end loop on existing sdigits
609 :
610 0 : return overlap;
611 0 : }
612 : //____________________________________________________________________________
613 : void AliTOF::Digits2Raw()
614 : {
615 : //
616 : // Starting from the TOF digits, writes the Raw Data objects
617 : //
618 :
619 8 : TStopwatch stopwatch;
620 4 : stopwatch.Start();
621 :
622 4 : fLoader->LoadDigits();
623 :
624 4 : TTree* digits = fLoader->TreeD();
625 4 : if (!digits) {
626 0 : AliError("no digits tree");
627 0 : return;
628 : }
629 :
630 : //AliTOFDDLRawData rawWriter;
631 4 : fTOFRawWriter.Clear();
632 4 : fTOFRawWriter.SetVerbose(0);
633 4 : if (fTOFRawWriter.GetPackedAcquisitionMode()) {
634 0 : if(fTOFRawWriter.GetMatchingWindow()>8192)
635 0 : 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 20 : AliDebug(1,"Formatting raw data for TOF");
640 4 : digits->GetEvent(0);
641 8 : fTOFRawWriter.RawDataTOF(digits->GetBranch("TOF"));
642 :
643 4 : fLoader->UnloadDigits();
644 :
645 20 : AliDebug(1, Form("Execution time to write TOF raw data : R:%.2fs C:%.2fs",
646 : stopwatch.RealTime(),stopwatch.CpuTime()));
647 :
648 8 : }
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 8 : fSDigits->Clear();
657 4 : }
658 : //____________________________________________________________________________
659 : void AliTOF::CreateSDigitsArray() {
660 : //
661 : // create TClonesArray fSDigits
662 : // needed for backward compatability with PPR test production
663 : //
664 0 : fSDigits = new TClonesArray("AliTOFSDigit", 1000);
665 0 : }
666 : //____________________________________________________________________________
667 : Bool_t AliTOF::Raw2SDigits(AliRawReader* rawReader)
668 : {
669 : //
670 : // Converts raw data to sdigits for TOF
671 : //
672 :
673 0 : TStopwatch stopwatch;
674 0 : stopwatch.Start();
675 :
676 0 : if(!GetLoader()->TreeS()) {MakeTree("S"); MakeBranch("S");}
677 : //TClonesArray &aSDigits = *fSDigits;
678 :
679 0 : AliTOFRawStream tofRawStream = AliTOFRawStream();
680 0 : tofRawStream.Raw2SDigits(rawReader, fSDigits);
681 :
682 0 : GetLoader()->TreeS()->Fill(); GetLoader()->WriteSDigits("OVERWRITE");//write out sdigits
683 0 : Int_t nSDigits = fSDigits->GetEntries();
684 :
685 0 : ResetSDigits();
686 :
687 0 : AliDebug(1, Form("Got %d TOF sdigits", nSDigits));
688 0 : 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 0 : }
694 :
695 : //____________________________________________________________________________
696 : void AliTOF::Raw2Digits(AliRawReader* rawReader)
697 : {
698 : //
699 : // Converts raw data to digits for TOF
700 : //
701 :
702 0 : TStopwatch stopwatch;
703 0 : stopwatch.Start();
704 :
705 0 : if(!GetLoader()->TreeD()) {MakeTree("D"); MakeBranch("D");}
706 : //TClonesArray &aDigits = *fDigits;
707 :
708 0 : AliTOFRawStream tofRawStream = AliTOFRawStream();
709 0 : tofRawStream.Raw2Digits(rawReader, fDigits);
710 :
711 0 : GetLoader()->TreeD()->Fill(); GetLoader()->WriteDigits("OVERWRITE");//write out digits
712 0 : Int_t nDigits = fDigits->GetEntries();
713 :
714 0 : ResetDigits();
715 :
716 0 : AliDebug(1, Form("Got %d TOF digits", nDigits));
717 0 : 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 0 : }
|