]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFdigit.cxx
Store in ESD mip Q as pTrk->SetRICHnclusters(100000*Q+nphots)
[u/mrichter/AliRoot.git] / TOF / AliTOFdigit.cxx
index 32362f4460ff9d28a3d8992236eb42335687b4c9..d73b24a16cbb23bbf6f243ca018e3fb84556e153 100644 (file)
@@ -1,18 +1,3 @@
-//_________________________________________________________________________
-//  TOF digit: member variables 
-//  fSector  : TOF sector
-//  fPlate   : TOF plate
-//  fStrip   : strips number
-//  fPadx    : pad number along x
-//  fPadz    : pad number along z
-//  fTdc     : TDC
-//  fAdc     : ADC
-//              
-//  Getters, setters and member functions  defined here
-//
-//*-- Authors: F. Pierella, A. Seganti, D. Vicinanza
-
 /**************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
  * provided "as is" without express or implied warranty.                  * 
  **************************************************************************/
 
-#include <iostream.h>
+/* $Id$ */
+
+//_________________________________________________________________________//
+//                                                                         //
+//  TOF digit: member variables                                            //
+//  fSector  : TOF sector                                                  //
+//  fPlate   : TOF plate                                                   //
+//  fStrip   : strips number                                               //
+//  fPadx    : pad number along x                                          //
+//  fPadz    : pad number along z                                          //
+//  fTdc     : TDC                                                         //
+//  fAdc     : ADC                                                         //
+//                                                                         //
+//  Getters, setters and member functions  defined here                    //
+//                                                                         //
+// -- Authors: F. Pierella, A. Seganti, D. Vicinanza                       //
+//_________________________________________________________________________//
+
+#include "Riostream.h"
 
-#include "AliTOF.h"
 #include "AliTOFdigit.h"
-#include "AliRun.h"
-#include "AliMC.h"
+#include "AliTOFGeometry.h"
 
 ClassImp(AliTOFdigit)
 
@@ -47,14 +49,17 @@ AliTOFdigit::AliTOFdigit(Int_t *tracks, Int_t *vol,Float_t *digit)
   fSector = vol[0];
   fPlate  = vol[1];
   fStrip  = vol[2];
-  fPadx  = vol[3];
-  fPadz  = vol[4];
+  fPadx   = vol[3];
+  fPadz   = vol[4];
   fTdc    = digit[0];
+  fTdcND  =0;
   fAdc    = digit[1];
+  fToT = 0;
 }
 
 //____________________________________________________________________________
 AliTOFdigit::AliTOFdigit(const AliTOFdigit & digit)
+:AliDigit(digit)
 {
   // 
   // copy ctor for AliTOFdigit object
@@ -69,7 +74,9 @@ AliTOFdigit::AliTOFdigit(const AliTOFdigit & digit)
   fPadx   = digit.fPadx;
   fPadz   = digit.fPadz;
   fTdc    = digit.fTdc;
+  fTdcND    = digit.fTdcND;
   fAdc    = digit.fAdc;
+  fToT = digit.fToT;
 
 }
 
@@ -86,7 +93,9 @@ Int_t padz, Float_t tdc, Float_t adc)
   fPadx   = padx;
   fPadz   = padz;  
   fTdc    = tdc;   
+  fTdcND    = 0;   
   fAdc    = adc;     
+  fToT = 0;
 }
    
 //______________________________________________________________________________
@@ -105,40 +114,38 @@ void AliTOFdigit::GetLocation(Int_t *Loc) const
 }
 
 //______________________________________________________________________________
-Int_t AliTOFdigit::GetTotPad() const
+Int_t AliTOFdigit::GetTotPad(AliTOFGeometry *tofGeom) const
 {
 //
 // Get the "total" index of the pad inside a Sector
 // starting from the digits data.
 //
 
-  AliTOF* tof;
-  
-  if(gAlice){
-     tof =(AliTOF*) gAlice->GetDetector("TOF");
-  }else{
-     printf("AliTOFdigit::GetTotPad - No AliRun object present, exiting");
-     return 0;
-  }
-  
-  Int_t pad = fPadx+tof->GetNpadX()*(fPadz-1);
   Int_t before=0;
 
   switch(fPlate){ 
-  case 1: before = 0;
-          break;
-  case 2: before = tof->GetNStripC();
-          break;
-  case 3: before = tof->GetNStripB() + tof->GetNStripC();
-          break;
-  case 4: before = tof->GetNStripA() + tof->GetNStripB() + tof->GetNStripC();
-          break;
-  case 5: before = tof->GetNStripA() + 2*tof->GetNStripB() + tof->GetNStripC();
-          break;
+  case 0:
+    //before = 0;
+    break;
+  case 1:
+    before = tofGeom->NStripC();
+    break;
+  case 2:
+    before = tofGeom->NStripC() +   AliTOFGeometry::NStripB();
+    break;
+  case 3:
+    before = tofGeom->NStripC() +   AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
+    break;
+  case 4:
+    before = tofGeom->NStripC() + 2*AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
+    break;
   }
   
-  Int_t strip = fStrip+before;
-  Int_t padTot = tof->GetPadXStr()*(strip-1)+pad;
+  Int_t pad = 2*fPadx + fPadz;
+  //Int_t pad = fPadx+AliTOFGeometry::NpadX()*fPadz;
+  Int_t strip  = fStrip + before;
+  Int_t padTot = AliTOFGeometry::NpadXStrip()*strip + pad;
+
   return padTot;
 }
 
@@ -146,16 +153,16 @@ Int_t AliTOFdigit::GetTotPad() const
 void AliTOFdigit::AddTrack(Int_t track)
 {
 //
-// Add a track to the digit 
+// Add a new and different track to the digit 
 //
-
-  if (fTracks[1]==0){
-     fTracks[1] = track;
-  }else if (fTracks[2]==0){
-     fTracks[2] = track;
-  }else{
-  //   printf("AliTOFdigit::AddTrack ERROR: Too many Tracks (>3) \n");
-  }
+  if (track==fTracks[0] || track==fTracks[1] || track==fTracks[2]) return;
+   if (fTracks[1]==0){
+      fTracks[1] = track;
+   }else if (fTracks[2]==0){
+      fTracks[2] = track;
+   }else{
+   // printf("AliTOFdigit::AddTrack ERROR: Too many Tracks (>3) \n");
+   }
 }
 
 // Overloading of Streaming, Sum and Comparison operators
@@ -172,7 +179,9 @@ Bool_t AliTOFdigit::operator==(AliTOFdigit const &digit) const
      fPadx==digit.fPadx &&
      fPadz==digit.fPadz &&
      fTdc==digit.fTdc &&
-     fAdc==digit.fAdc) return kTRUE;
+     fTdcND==digit.fTdcND &&
+     fAdc==digit.fAdc &&
+     fToT==digit.fToT ) return kTRUE;
      else return kFALSE;
 }
 
@@ -208,4 +217,3 @@ out << "Padx" << digit.fPadx << ", Padz " << digit.fPadz << endl;
 out << "TDC " << digit.fTdc << ", ADC "<< digit.fAdc << endl;
 return out;
 }
-