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