]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFdigit.cxx
Reordering cuts to go faster
[u/mrichter/AliRoot.git] / TOF / AliTOFdigit.cxx
index 32362f4460ff9d28a3d8992236eb42335687b4c9..c11a1b9dc6104ab8e5169d3a7b62da72cab8e98c 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)
 
 //______________________________________________________________________________
-AliTOFdigit::AliTOFdigit(Int_t *tracks, Int_t *vol,Float_t *digit)
-:AliDigit(tracks)
+AliTOFdigit::AliTOFdigit()
+  :AliDigit(),
+   fSector(-1),
+   fPlate(-1),
+   fStrip(-1),
+   fPadx(-1),
+   fPadz(-1),
+   fTdc(0),
+   fTdcND(0),
+   fAdc(0),
+   fToT(0)
+{
+}
+//______________________________________________________________________________
+AliTOFdigit::AliTOFdigit(Int_t *tracks, Int_t *vol, Int_t *digit)
+  :AliDigit(tracks),
+   fSector(vol[0]),
+   fPlate(vol[1]),
+   fStrip(vol[2]),
+   fPadx(vol[3]),
+   fPadz(vol[4]),
+   fTdc(digit[0]),
+   fTdcND(digit[3]),
+   fAdc(digit[1]),
+   fToT(digit[2])
 {
 //
 // Constructor of digit object
 //
-  fSector = vol[0];
-  fPlate  = vol[1];
-  fStrip  = vol[2];
-  fPadx  = vol[3];
-  fPadz  = vol[4];
-  fTdc    = digit[0];
-  fAdc    = digit[1];
 }
 
 //____________________________________________________________________________
 AliTOFdigit::AliTOFdigit(const AliTOFdigit & digit)
+  :AliDigit(digit),
+   fSector(digit.fSector),
+   fPlate(digit.fPlate),
+   fStrip(digit.fStrip),
+   fPadx(digit.fPadx),
+   fPadz(digit.fPadz),
+   fTdc(digit.fTdc),
+   fTdcND(digit.fTdcND),
+   fAdc(digit.fAdc),
+   fToT(digit.fToT)
 {
   // 
   // copy ctor for AliTOFdigit object
@@ -63,45 +91,40 @@ AliTOFdigit::AliTOFdigit(const AliTOFdigit & digit)
   Int_t i ;
   for ( i = 0; i < 3 ; i++)
     fTracks[i]  = digit.fTracks[i] ;
-  fSector = digit.fSector;
-  fPlate  = digit.fPlate;
-  fStrip  = digit.fStrip;
-  fPadx   = digit.fPadx;
-  fPadz   = digit.fPadz;
-  fTdc    = digit.fTdc;
-  fAdc    = digit.fAdc;
 
 }
 
 //______________________________________________________________________________
 AliTOFdigit::AliTOFdigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx,
-Int_t padz, Float_t tdc, Float_t adc)
+                        Int_t padz, Int_t tdc, Int_t adc):
+   fSector(sector),
+   fPlate(plate),
+   fStrip(strip),
+   fPadx(padx),
+   fPadz(padz),
+   fTdc(tdc),
+   fTdcND(0),
+   fAdc(adc),
+   fToT(0)
 {
 //
 // Constructor for sdigit
 //
-  fSector = sector;
-  fPlate  = plate;
-  fStrip  = strip;
-  fPadx   = padx;
-  fPadz   = padz;  
-  fTdc    = tdc;   
-  fAdc    = adc;     
 }
    
 //______________________________________________________________________________
-void AliTOFdigit::GetLocation(Int_t *Loc) const
+void AliTOFdigit::GetLocation(Int_t *loc) const
 {
 //
 // Get the cohordinates of the digit
 // in terms of Sector - Plate - Strip - Pad
 //
 
-   Loc[0]=fSector;
-   Loc[1]=fPlate;
-   Loc[2]=fStrip;
-   Loc[3]=fPadx;
-   Loc[4]=fPadz;
+   loc[0] = fSector;
+   loc[1] = fPlate;
+   loc[2] = fStrip;
+   loc[3] = fPadx;
+   loc[4] = fPadz;
 }
 
 //______________________________________________________________________________
@@ -112,33 +135,30 @@ Int_t AliTOFdigit::GetTotPad() const
 // 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 = AliTOFGeometry::NStripC();
+    break;
+  case 2:
+    before = AliTOFGeometry::NStripC() +   AliTOFGeometry::NStripB();
+    break;
+  case 3:
+    before = AliTOFGeometry::NStripC() +   AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
+    break;
+  case 4:
+    before = AliTOFGeometry::NStripC() + 2*AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
+    break;
   }
   
-  Int_t strip = fStrip+before;
-  Int_t padTot = tof->GetPadXStr()*(strip-1)+pad;
+  Int_t pad = AliTOFGeometry::NpadZ()*fPadx + fPadz;
+  Int_t strip  = fStrip + before;
+  Int_t padTot = AliTOFGeometry::NpadXStrip()*strip + pad;
+
   return padTot;
 }
 
@@ -146,16 +166,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 (track==fTracks[0] || track==fTracks[1] || track==fTracks[2]) return;
+   if (fTracks[1]==-1)
+      fTracks[1] = track;
+   else if (fTracks[2]==-1)
+      fTracks[2] = track;
+   else
+     printf("W-AliTOFdigit::AddTrack: Too many tracks (>3) that contribute to the same TOF digit\n");
 
-  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,12 +192,14 @@ 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;
 }
 
 //______________________________________________________________________________
-AliTOFdigit& AliTOFdigit::operator+(AliTOFdigit const &digit)
+AliTOFdigit AliTOFdigit::operator+(const AliTOFdigit &digit)
 {
 //
 // Overloading of Sum operator
@@ -198,14 +220,15 @@ if  (fSector==digit.fSector &&
 }
 
 //______________________________________________________________________________
-ostream& operator << (ostream& out, const AliTOFdigit &digit)
+ostream& operator << (ostream & out, const AliTOFdigit &digit)
 {
-//
-// Output streamer: output of the digit data
-//
-out << "Sector " << digit.fSector << ", Plate " << digit.fPlate << ", Strip " << digit.fStrip << endl;
-out << "Padx" << digit.fPadx << ", Padz " << digit.fPadz << endl;
-out << "TDC " << digit.fTdc << ", ADC "<< digit.fAdc << endl;
-return out;
-}
+  //
+  // Output streamer: output of the digit data
+  //
 
+  out << "Sector " << digit.fSector << ", Plate " << digit.fPlate << ", Strip " << digit.fStrip << endl;
+  out << "Padx" << digit.fPadx << ", Padz " << digit.fPadz << endl;
+  out << "TDC " << digit.fTdc << ", ADC "<< digit.fAdc << endl;
+
+  return out;
+}