]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOF.cxx
Adding stream level and debug streamer to the base class
[u/mrichter/AliRoot.git] / TOF / AliTOF.cxx
index 234515cb517d8e5e3a68cb520e7ec0f27f6c20da..7dd7a0692db55500e050e025de26d9ddb078f107 100644 (file)
@@ -12,7 +12,6 @@
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-
 /* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -46,6 +45,7 @@
 #include <TTask.h>
 #include <TTree.h>
 #include <TVirtualMC.h>
+#include <TStopwatch.h>
 
 #include "AliConst.h"
 #include "AliLoader.h"
@@ -84,11 +84,16 @@ AliTOF::AliTOF():
   fReconParticles(0x0),
   fIdSens(-1),
   fTZero(kFALSE),
+  fTOFHoles(kTRUE),
   fTOFGeometry(0x0)
 {
   //
   // Default constructor
   //
+
+  //by default all sectors switched on
+  for (Int_t ii=0; ii<18; ii++) fTOFSectors[ii]=0;
+
   fDigits = 0;
   fIshunt   = 0;
   fName = "TOF";
@@ -106,6 +111,7 @@ AliTOF::AliTOF(const char *name, const char *title, Option_t *option)
   fReconParticles(0x0),
   fIdSens(-1),
   fTZero(kFALSE),
+  fTOFHoles(kTRUE),
   fTOFGeometry(0x0)
 {
   //
@@ -119,6 +125,9 @@ AliTOF::AliTOF(const char *name, const char *title, Option_t *option)
   //skowron
   fTOFGeometry = new AliTOFGeometry();
 
+  //by default all sectors switched on
+  for (Int_t ii=0; ii<18; ii++) fTOFSectors[ii]=0;
+
   if (strstr(option,"tzero")){
     fHits   = new TClonesArray("AliTOFhitT0",  1000);
     fTZero = kTRUE;
@@ -180,7 +189,8 @@ void AliTOF::GetTOFSectors(Int_t *sectors) const
 }
 //_____________________________________________________________________________
 AliTOF::AliTOF(const AliTOF &source)
-  :AliDetector(),
+  :
+  AliDetector(),
   fFGeom(0x0),
   fDTask(0x0),
   fReTask(0x0),
@@ -189,6 +199,7 @@ AliTOF::AliTOF(const AliTOF &source)
   fReconParticles(0x0),
   fIdSens(-1),
   fTZero(kFALSE),
+  fTOFHoles(kTRUE),
   fTOFGeometry(0x0)
 {
   // copy constructor
@@ -318,7 +329,7 @@ void AliTOF::AddT0Hit(Int_t track, Int_t *vol, Float_t *hits)
 }
 
 //_____________________________________________________________________________
-void AliTOF::AddDigit(Int_t *tracks, Int_t *vol, Float_t *digits)
+void AliTOF::AddDigit(Int_t *tracks, Int_t *vol, Int_t *digits)
 {
   //
   // Add a TOF digit
@@ -329,7 +340,7 @@ void AliTOF::AddDigit(Int_t *tracks, Int_t *vol, Float_t *digits)
 }
 
 //_____________________________________________________________________________
-void AliTOF::AddSDigit(Int_t tracknum, Int_t *vol, Float_t *digits)
+void AliTOF::AddSDigit(Int_t tracknum, Int_t *vol, Int_t *digits)
 {
      
 //
@@ -403,7 +414,16 @@ void AliTOF::CreateGeometry()
 
   Float_t xTof, yTof;
 
-  if (IsVersion()==7) {
+  if (IsVersion()==8) {
+
+    xTof = 124.5;//fTOFGeometry->StripLength()+2.*(0.3+0.03); // cm,  x-dimension of FTOA volume
+    yTof = fTOFGeometry->Rmax()-fTOFGeometry->Rmin(); // cm,  y-dimension of FTOA volume
+    Float_t zTof = fTOFGeometry->ZlenA();             // cm,  z-dimension of FTOA volume
+    
+    //  TOF module internal definitions
+    TOFpc(xTof, yTof, zTof);
+
+  } else if (IsVersion()==7) {
 
     xTof = 124.5;//fTOFGeometry->StripLength()+2.*(0.3+0.03); // cm,  x-dimension of FTOA volume
     yTof = fTOFGeometry->Rmax()-fTOFGeometry->Rmin(); // cm,  y-dimension of FTOA volume
@@ -629,7 +649,7 @@ AliDigitizer* AliTOF::CreateDigitizer(AliRunDigitizer* manager) const
 }
 
 //___________________________________________________________________________
-Bool_t AliTOF::CheckOverlap(Int_t* vol, Float_t* digit,Int_t Track)
+Bool_t AliTOF::CheckOverlap(Int_t* vol, Int_t* digit,Int_t Track)
 {
 //
 // Checks if 2 or more hits belong to the same pad.
@@ -653,8 +673,8 @@ Bool_t AliTOF::CheckOverlap(Int_t* vol, Float_t* digit,Int_t Track)
       if (vol[i]!=vol2[i]) idem=kFALSE;}
 
     if (idem){  // same pad fired
-      Float_t tdc2 = digit[0];
-      Float_t tdc1 = currentDigit->GetTdc();
+      Int_t tdc2 = digit[0];
+      Int_t tdc1 = currentDigit->GetTdc();
 
       // we separate two digits on the same pad if
       // they are separated in time by at least 25 ns
@@ -674,7 +694,7 @@ Bool_t AliTOF::CheckOverlap(Int_t* vol, Float_t* digit,Int_t Track)
        overlap = kTRUE;
        return overlap;
       } else 
-               overlap= kFALSE;
+       overlap= kFALSE;
 
     } // close if (idem) -> two digits on the same TOF pad
 
@@ -689,6 +709,9 @@ void AliTOF::Digits2Raw()
 // Starting from the TOF digits, writes the Raw Data objects
 //
 
+  TStopwatch stopwatch;
+  stopwatch.Start();
+
   fLoader->LoadDigits();
 
   TTree* digits = fLoader->TreeD();
@@ -697,16 +720,22 @@ void AliTOF::Digits2Raw()
     return;
   }
   
-  //AliRunLoader *rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),"read");
+  /*
   fRunLoader->CdGAFile();
   TFile *in=(TFile*)gFile;
   in->cd();
   AliTOFGeometry *geometry  = (AliTOFGeometry*)in->Get("TOFgeometry");
-
-  AliTOFDDLRawData rawWriter(geometry);
+  */
+  AliTOFDDLRawData rawWriter;
   //AliTOFDDLRawData rawWriter;
   rawWriter.SetVerbose(0);
-  //rawWriter.SetAcquisitionMode(kFALSE);
+  //rawWriter.SetFakeOrphaneProduction(kTRUE);
+  //rawWriter.SetPackedAcquisitionMode(kFALSE);
+  if (rawWriter.GetPackedAcquisitionMode()) {
+    if(rawWriter.GetMatchingWindow()>8192)
+      AliWarning(Form("You are running in packing mode and the matching window is %.2f ns, i.e. greater than 199.8848 ns",
+                     rawWriter.GetMatchingWindow()*AliTOFGeometry::TdcBinWidth()*1.e-03));
+  }
   
   AliDebug(1,"Formatting raw data for TOF");
   digits->GetEvent(0);
@@ -714,6 +743,9 @@ void AliTOF::Digits2Raw()
 
   fLoader->UnloadDigits();
   
+  AliDebug(1, Form("Execution time to write TOF raw data : R:%.2fs C:%.2fs",
+                  stopwatch.RealTime(),stopwatch.CpuTime()));
+
 }
 
 //____________________________________________________________________________
@@ -722,8 +754,7 @@ void AliTOF::RecreateSDigitsArray() {
 // delete TClonesArray fSDigits and create it again
 //  needed for backward compatability with PPR test production
 //
-  delete fSDigits;
-  fSDigits       = new TClonesArray("AliTOFSDigit",  1000);
+  fSDigits->Clear();
 }
 //____________________________________________________________________________
 void AliTOF::CreateSDigitsArray() {