]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFSDigit.cxx
Laurent's mapping plugged for trigger chambers
[u/mrichter/AliRoot.git] / TOF / AliTOFSDigit.cxx
index 1495a744182b88045132caa118497c05d6f0ad8f..a9cc26e6be5b6c6b3714d28dc9c97fbadad0c285 100644 (file)
 #include "TArrayF.h"
 #include "TArrayI.h"
 
+#include "AliLog.h"
 #include "AliRun.h"
 #include "AliTOF.h"
-#include "AliTOFConstants.h"
+#include "AliTOFGeometry.h"
 #include "AliTOFSDigit.h"
 
 ClassImp(AliTOFSDigit)
@@ -54,10 +55,12 @@ ClassImp(AliTOFSDigit)
 
 ////////////////////////////////////////////////////////////////////////
 AliTOFSDigit::AliTOFSDigit(Int_t tracknum, Int_t *vol,Float_t *digit)
+:TObject()
 {
   //
   // Constructor of digit object
   //
+
   fSector = vol[0];
   fPlate  = vol[1];
   fStrip  = vol[2];
@@ -77,6 +80,7 @@ AliTOFSDigit::AliTOFSDigit(Int_t tracknum, Int_t *vol,Float_t *digit)
 
 ////////////////////////////////////////////////////////////////////////
 AliTOFSDigit::AliTOFSDigit(const AliTOFSDigit & digit)
+:TObject()
 {
   // 
   // copy ctor for AliTOFSDigit object
@@ -139,7 +143,7 @@ void AliTOFSDigit::Update(Float_t tdcbin, Int_t tdc, Int_t adc, Int_t track)
   //
   
   Int_t sameTime = -1;
-  Float_t tdcwindow=((Float_t)AliTOFConstants::fgkTimeDiff)/tdcbin;
+  Float_t tdcwindow=((Float_t)AliTOFGeometry::TimeDiff())/tdcbin;
   for (Int_t i = 0; i < fNDigits; i++) {
     if (TMath::Abs(tdc-fTdc->At(i)) < tdcwindow) {
       sameTime = i;
@@ -158,9 +162,8 @@ void AliTOFSDigit::Update(Float_t tdcbin, Int_t tdc, Int_t adc, Int_t track)
       }
       // write warning about many tracks going to this pad
       if (iTrack == kMAXDIGITS) {
-       cerr<<"WARNING: AliTOFSDigit::Update  Many hits in the padhit"<<endl;
-       cerr<<"         ";
-       //      PrintPad();
+       AliWarning("Many hits in the padhit");
+       //      ToAliWarning(PrintPad());
       }
     }
   } else {
@@ -191,7 +194,7 @@ void AliTOFSDigit::Update(AliTOFSDigit* sdig)
   Int_t nlocations=sdig->GetNDigits();
 
   for (Int_t j = 0; j < nlocations; j++) {
-    Float_t tdcbin=50.; // [ps] hardwired for the time being
+    Float_t tdcbin = AliTOFGeometry::TdcBinWidth();// [ps] hardwired for the time being
     Int_t tdc=(Int_t)sdig->GetTdc(j);
     Int_t adc=(Int_t)sdig->GetAdc(j);
     // getting here only the first track number
@@ -199,7 +202,7 @@ void AliTOFSDigit::Update(AliTOFSDigit* sdig)
     
     
     Int_t sameTime = -1;
-    Float_t tdcwindow=((Float_t)AliTOFConstants::fgkTimeDiff)/tdcbin;
+    Float_t tdcwindow=((Float_t)AliTOFGeometry::TimeDiff())/tdcbin;
     for (Int_t i = 0; i < fNDigits; i++) {
       if (TMath::Abs(tdc-fTdc->At(i)) < tdcwindow) {
        sameTime = i;
@@ -218,9 +221,8 @@ void AliTOFSDigit::Update(AliTOFSDigit* sdig)
        }
        // write warning about many tracks going to this pad
        if (iTrack == kMAXDIGITS) {
-         cerr<<"WARNING: AliTOFSDigit::Update  Many hits in the padhit"<<endl;
-         cerr<<"         ";
-         //    PrintPad();
+         AliWarning("Many hits in the padhit");
+         //    ToAliWarning(PrintPad());
        }
       }
     } else {
@@ -252,31 +254,36 @@ AliTOFSDigit::~AliTOFSDigit()
 
 ////////////////////////////////////////////////////////////////////////
 
-Int_t AliTOFSDigit::GetTotPad() const
+Int_t AliTOFSDigit::GetTotPad(AliTOFGeometry *tofGeom) const
 {
   //
   // Get the "total" index of the pad inside a Sector
   // starting from the digits data.
   //
   
-  Int_t pad = fPadx+AliTOFConstants::fgkNpadX*(fPadz-1);
+  Int_t pad = 2*fPadx + fPadz;
+  //Int_t pad = fPadx+AliTOFGeometry::NpadX()*fPadz;
   Int_t before=0;
   
   switch(fPlate){ 
-  case 1: before = 0;
+  case 0:
+    //before = 0;
     break;
-  case 2: before = AliTOFConstants::fgkNStripC;
+  case 1:
+    before = tofGeom->NStripC();
     break;
-  case 3: before = AliTOFConstants::fgkNStripB + AliTOFConstants::fgkNStripC;
+  case 2:
+    before = AliTOFGeometry::NStripB() +   tofGeom->NStripC();
     break;
-  case 4: before = AliTOFConstants::fgkNStripA + AliTOFConstants::fgkNStripB + AliTOFConstants::fgkNStripC;
+  case 3:
+    before = AliTOFGeometry::NStripA() +   AliTOFGeometry::NStripB() + tofGeom->NStripC();
     break;
-  case 5: before = AliTOFConstants::fgkNStripA + 2*AliTOFConstants::fgkNStripB + AliTOFConstants::fgkNStripC;
+  case 4:
+    before = AliTOFGeometry::NStripA() + 2*AliTOFGeometry::NStripB() + tofGeom->NStripC();
     break;
   }
   
-  Int_t strip = fStrip+before;
-  Int_t padTot = AliTOFConstants::fgkPadXStrip*(strip-1)+pad;
+  Int_t strip = fStrip + before;
+  Int_t padTot = AliTOFGeometry::NpadXStrip()*strip + pad;
   return padTot;
 }
-