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