]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOF.cxx
Implementation of reconstructors (T.Kuhr)
[u/mrichter/AliRoot.git] / TOF / AliTOF.cxx
index 0ea2be794203a5521a1ebd3162a935479915e3c8..7ef0943d2e5dd8ec27caa7b554921627ce6818fb 100644 (file)
@@ -69,6 +69,8 @@
 #include "AliTOFdigit.h"
 #include "AliTOFhit.h"
 #include "AliTOFhitT0.h"
+#include "AliMC.h"
+#include "AliTOFDigitizer.h"
  
 ClassImp(AliTOF)
  
@@ -89,6 +91,7 @@ AliTOF::AliTOF()
   fName="TOF";
   fMerger = 0x0;
   fTZero = kFALSE;
+  fTOFGeometry = 0;
 }
  
 //_____________________________________________________________________________
@@ -108,6 +111,7 @@ AliTOF::AliTOF(const char *name, const char *title, Option_t *option)
   fReTask= 0x0;
   fReconParticles= 0x0;
   fMerger = 0x0;
+  fTOFGeometry = 0;
 
   if (strstr(option,"tzero")){
     fHits   = new TClonesArray("AliTOFhitT0",  1000);
@@ -120,8 +124,8 @@ AliTOF::AliTOF(const char *name, const char *title, Option_t *option)
   if (gAlice==0) {
      Fatal("AliTOF","gAlice==0 !");
   }
-  if (gAlice->GetHitLists())
-     gAlice->AddHitList(fHits);
+  if (gAlice->GetMCApp()->GetHitLists())
+     gAlice->GetMCApp()->AddHitList(fHits);
   else Error("AliTOF","gAlice->GetHitLists()==0");
 
   fIshunt  = 0;
@@ -593,6 +597,15 @@ void AliTOF::ResetDigits ()
   AliDetector::ResetDigits ();
   //
 } 
+//____________________________________________
+void AliTOF::ResetSDigits ()
+{
+  //
+  // Reset number of sdigits and the sdigits array for this detector
+  fNSDigits = 0;
+  //fSDigits = 0x0;
+  //
+} 
 //_____________________________________________________________________________
 void AliTOF::Init()
 {
@@ -708,29 +721,50 @@ AliTOFMerger*  AliTOF::Merger()
     return fMerger;
 }
 
-
 //---------------------------------------------------------------------
-
 void AliTOF::Hits2SDigits()
 {
 //
 // Use the TOF SDigitizer to make TOF SDigits
 //
-//
-  //#ifdef DEBUG
-  cout<<"ALiTOF::Hits2SDigits> start...\n";
-  //#endif
+
+//  cout<<"AliTOF::Hits2SDigits> start...\n";
   
-  //char * fileSDigits = 0 ;
-  char * fileHeader = 0;
-  AliTOFSDigitizer * sd = new AliTOFSDigitizer(fileHeader) ;
+  AliRunLoader * rl = fLoader->GetRunLoader();
+  AliTOFSDigitizer sd((rl->GetFileName()).Data());
+  if (GetDebug()) sd.Print("");
 
-  sd->Exec("") ;
-  sd->Print("");
+  sd.Exec("") ;
+
+}
+
+//---------------------------------------------------------------------
+void AliTOF::Hits2SDigits(Int_t evNumber1, Int_t evNumber2)
+{
+//
+// Use the TOF SDigitizer to make TOF SDigits
+//
+
+  if ((evNumber2-evNumber1)==1) 
+      cout << "<AliTOF::Hits2SDigits>: I am making sdigits for the " << evNumber1 << "th event \n";
+  else if ((evNumber2-evNumber1)>1)
+      cout << "<AliTOF::Hits2SDigits>: I am making sdigits for the events from the " 
+           << evNumber1 << "th to the " << evNumber2-1 << "th \n";
+  AliRunLoader * rl = fLoader->GetRunLoader();
+  AliTOFSDigitizer sd((rl->GetFileName()).Data(),evNumber1,evNumber2) ;
+  if (GetDebug()) sd.Print("");
+
+  sd.Exec("") ;
 
-  delete sd ;
-  
 }
+
+//___________________________________________________________________________
+AliDigitizer* AliTOF::CreateDigitizer(AliRunDigitizer* manager) const
+{
+  return new AliTOFDigitizer(manager);
+}
+
 //___________________________________________________________________________
 Bool_t AliTOF::CheckOverlap(Int_t* vol, Float_t* digit,Int_t Track)
 {
@@ -899,7 +933,7 @@ void AliTOF::Raw2Digits(Int_t evNumber)
           if (nStrip<=fNStripC+2*fNStripB+fNStripA) nPlate = 4;
           if (nStrip<=fNStripC+fNStripB+fNStripA)   nPlate = 3;
           if (nStrip<=fNStripC+fNStripB)            nPlate = 2;
-          if (nStrip<=fNStripC)                     nPlate=1;
+          if (nStrip<=fNStripC)                     nPlate = 1;
           vol[1] = nPlate;
           switch (nPlate){
           case 1: break;
@@ -949,3 +983,4 @@ void AliTOF::CreateSDigitsArray() {
 //
   fSDigits       = new TClonesArray("AliTOFSDigit",  1000);
 }
+