updating of the TOF volume numbering (ALICE-INT-2003-038)
authordecaro <decaro@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 17 Oct 2003 17:08:23 +0000 (17:08 +0000)
committerdecaro <decaro@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 17 Oct 2003 17:08:23 +0000 (17:08 +0000)
19 files changed:
TOF/AliTOF.cxx
TOF/AliTOFDigitizer.cxx
TOF/AliTOFHitMap.cxx
TOF/AliTOFHitMap.h
TOF/AliTOFSDigitizer.cxx
TOF/AliTOFSDigits2Digits.C
TOF/AliTOFTrackV2.cxx
TOF/AliTOFTrackV2.h
TOF/AliTOFanalyzeDigits.C
TOF/AliTOFanalyzeHits.C
TOF/AliTOFanalyzeSDigitsV2.C
TOF/AliTOFhits2sdigits.C
TOF/AliTOFv0.cxx
TOF/AliTOFv1.cxx
TOF/AliTOFv2.cxx
TOF/AliTOFv2FHoles.cxx
TOF/AliTOFv3.cxx
TOF/AliTOFv4.cxx
TOF/AliTOFv4T0.cxx

index 0ea2be7..e8fa2e4 100644 (file)
@@ -899,7 +899,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;
index 5f048b6..3052a89 100644 (file)
@@ -166,7 +166,8 @@ void AliTOFDigitizer::CreateDigits()
 
   for (Int_t k = 0; k < ndig; k++) {
     
-    Int_t    vol[5];       // location for a digit
+    Int_t  vol[5];  // location for a digit
+    for (Int_t i=0; i<5; i++) vol[i] = -1; // AdC
     
     // Get the information for this digit
     AliTOFSDigit *tofsdigit = (AliTOFSDigit *) fSDigitsArray->UncheckedAt(k);
@@ -175,11 +176,11 @@ void AliTOFDigitizer::CreateDigits()
     // for current sdigit
     
     // TOF sdigit volumes (always the same for all slots)
-    Int_t sector    = tofsdigit->GetSector(); // range [1-18]
-    Int_t plate     = tofsdigit->GetPlate();  // range [1- 5]
-    Int_t strip     = tofsdigit->GetStrip();  // range [1-20]
-    Int_t padz      = tofsdigit->GetPadz();   // range [1- 2]
-    Int_t padx      = tofsdigit->GetPadx();   // range [1-48]
+    Int_t sector    = tofsdigit->GetSector(); // range [0-17]
+    Int_t plate     = tofsdigit->GetPlate();  // range [0- 4]
+    Int_t strip     = tofsdigit->GetStrip();  // range [0-19]
+    Int_t padz      = tofsdigit->GetPadz();   // range [0- 1]
+    Int_t padx      = tofsdigit->GetPadx();   // range [0-47]
     
     vol[0] = sector;
     vol[1] = plate;
@@ -189,7 +190,8 @@ void AliTOFDigitizer::CreateDigits()
     
     //--------------------- QA section ----------------------
     // in the while, I perform QA
-    Bool_t isSDigitBad = (sector<1 || sector>18 || plate<1 || plate >5 || padz<1 || padz>2 || padx<1 || padx>48);
+    //Bool_t isSDigitBad = (sector<1 || sector>18 || plate<1 || plate >5 || padz<1 || padz>2 || padx<1 || padx>48);
+    Bool_t isSDigitBad = (sector<0 || sector>17 || plate<0 || plate >4 || padz<0 || padz>1 || padx<0 || padx>47); // AdC
     
     if (isSDigitBad) {
       cout << "<AliTOFSDigits2Digits>  strange sdigit found" << endl;
@@ -298,8 +300,9 @@ void AliTOFDigitizer::ReadSDigit(Int_t inputFile )
     for (Int_t k=0; k<ndig; k++) {
       AliTOFSDigit *tofSdigit= (AliTOFSDigit*) sdigitsDummyContainer->UncheckedAt(k);
       
-      Int_t    vol[5];       // location for a sdigit
-      
+      Int_t  vol[5]; // location for a sdigit
+      for (Int_t i=0; i<5; i++) vol[i] = -1; // AdC
+
       // check the sdigit volume
       vol[0] = tofSdigit->GetSector();
       vol[1] = tofSdigit->GetPlate();
index 569d304..a7cc436 100644 (file)
@@ -68,8 +68,8 @@ AliTOFHitMap::AliTOFHitMap(TClonesArray *dig)
   fNplate = AliTOFConstants::fgkNPlates;
   fNstrip = AliTOFConstants::fgkNStripC;
   fNpx  = AliTOFConstants::fgkNpadX;
-  fNpy  = AliTOFConstants::fgkNpadZ;
-  fMaxIndex=fNSector*fNplate*fNstrip*fNpx*fNpy;
+  fNpz  = AliTOFConstants::fgkNpadZ;
+  fMaxIndex=fNSector*fNplate*fNstrip*fNpx*fNpz;
   fHitMap = new Int_t[fMaxIndex];
   fSDigits =  dig;
   Clear();
@@ -111,11 +111,11 @@ Int_t AliTOFHitMap::CheckedIndex(Int_t *vol) const
 // Return checked indices for vol
 //
   Int_t index=
-    (vol[0]-1)*fNplate*fNstrip*fNpx*fNpy+             // sector
-    (vol[1]-1)*fNstrip*fNpx*fNpy+                     // plate
-    (vol[2]-1)*fNpx*fNpy+                             // strip
-    (vol[3]-1)*fNpy+                                  // padx
-    (vol[4]-1);                                        // pady (=padz)
+    (vol[0]/*-1*/)*fNplate*fNstrip*fNpx*fNpz+             // sector
+    (vol[1]/*-1*/)*fNstrip*fNpx*fNpz+                     // plate
+    (vol[2]/*-1*/)*fNpx*fNpz+                             // strip
+    (vol[3]/*-1*/)*fNpz+                                  // padx
+    (vol[4]/*-1*/);                                       // padz
 
     if (index >= fMaxIndex) {
       Error("AliTOFHitMap","CheckedIndex - input outside bounds");
index 64222ff..82ef41c 100644 (file)
@@ -50,7 +50,7 @@ class AliTOFHitMap : public TObject
     Int_t fNplate;                        // Number of plates
     Int_t fNstrip;                        // Maximum number of strips
     Int_t fNpx;                           // Number of pads in x
-    Int_t fNpy;                           // Number of pads in y
+    Int_t fNpz;                           // Number of pads in z
 
     TClonesArray *fSDigits;               // Pointer to sdigits
     Int_t fMaxIndex;                      // maximum index in hit map
index 1b1557e..8707e0e 100644 (file)
@@ -68,8 +68,8 @@ ClassImp(AliTOFSDigitizer)
   fEvent1=0;
   fEvent2=0;
   ftail    = 0;
-  fSelectedSector=0;
-  fSelectedPlate =0;
+  fSelectedSector=-1; //0; // AdC
+  fSelectedPlate =-1; //0; // AdC
 }
            
 //____________________________________________________________________________ 
@@ -78,8 +78,8 @@ ClassImp(AliTOFSDigitizer)
   fEvent1=evNumber1;
   fEvent2=fEvent1+nEvents;
   ftail    = 0;
-  fSelectedSector=0; // by default we sdigitize all sectors
-  fSelectedPlate =0; // by default we sdigitize all plates in all sectors
+  fSelectedSector=-1; //0; // AdC // by default we sdigitize all sectors
+  fSelectedPlate =-1; //0; // AdC // by default we sdigitize all plates in all sectors
 
   fHeadersFile = HeaderFile ; // input filename (with hits)
   TFile * file = (TFile*) gROOT->GetFile(fHeadersFile.Data() ) ;
@@ -222,7 +222,8 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption, Option_t *allEvents) {
     fEvent2= (Int_t) gAlice->TreeE()->GetEntries();
   }
 
-  Bool_t thereIsNotASelection=(fSelectedSector==0) && (fSelectedPlate==0);
+  //Bool_t thereIsNotASelection=(fSelectedSector==0) && (fSelectedPlate==0); // AdC
+  Bool_t thereIsNotASelection=(fSelectedSector==-1) && (fSelectedPlate==-1);
 
   for (Int_t ievent = fEvent1; ievent < fEvent2; ievent++) {
     cout << "------------------- "<< GetName() << " -------------" << endl ;
@@ -276,12 +277,12 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption, Option_t *allEvents) {
       // cleaning all hits of the same track in the same pad volume
       // it is a rare event, however it happens
 
-      Int_t previousTrack =0;
-      Int_t previousSector=0;
-      Int_t previousPlate =0;
-      Int_t previousStrip =0;
-      Int_t previousPadX  =0;
-      Int_t previousPadZ  =0;
+      Int_t previousTrack =-1; //0; // AdC
+      Int_t previousSector=-1; //0; // AdC
+      Int_t previousPlate =-1; //0; // AdC
+      Int_t previousStrip =-1; //0; // AdC
+      Int_t previousPadX  =-1; //0; // AdC
+      Int_t previousPadZ  =-1; //0; // AdC
 
       for (Int_t hit = 0; hit < nhits; hit++)
       {
@@ -345,8 +346,10 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption, Option_t *allEvents) {
              nHitsFromPrim++;
            } // counts hits due to primary particles
            
-           Float_t xStrip=AliTOFConstants::fgkXPad*(vol[3]-0.5-0.5*AliTOFConstants::fgkNpadX)+Xpad;
-           Float_t zStrip=AliTOFConstants::fgkZPad*(vol[4]-0.5-0.5*AliTOFConstants::fgkNpadZ)+Zpad;
+           //Float_t xStrip=AliTOFConstants::fgkXPad*(vol[3]-0.5-0.5*AliTOFConstants::fgkNpadX)+Xpad;
+           //Float_t zStrip=AliTOFConstants::fgkZPad*(vol[4]-0.5-0.5*AliTOFConstants::fgkNpadZ)+Zpad;
+           Float_t xStrip=AliTOFConstants::fgkXPad*(vol[3]+0.5-0.5*AliTOFConstants::fgkNpadX)+Xpad; // AdC
+           Float_t zStrip=AliTOFConstants::fgkZPad*(vol[4]+0.5-0.5*AliTOFConstants::fgkNpadZ)+Zpad; // AdC
 
            //cout << "geantTime " << geantTime << " [ns]" << endl;
            Int_t nActivatedPads = 0, nFiredPads = 0;
@@ -370,8 +373,8 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption, Option_t *allEvents) {
                  
                  // recalculate the volume only for neighbouring pads
                  if(indexOfPad){
-                   (nPlace[indexOfPad]<=AliTOFConstants::fgkNpadX) ? vol[4] = 1 : vol[4] = 2;
-                   (nPlace[indexOfPad]<=AliTOFConstants::fgkNpadX) ? vol[3] = nPlace[indexOfPad] : vol[3] = nPlace[indexOfPad] - AliTOFConstants::fgkNpadX;
+                   (nPlace[indexOfPad]<=AliTOFConstants::fgkNpadX) ? vol[4] = 0/*1*/ : vol[4] = 1/*2*/; // AdC
+                   (nPlace[indexOfPad]<=AliTOFConstants::fgkNpadX) ? vol[3] = nPlace[indexOfPad] - 1 : vol[3] = nPlace[indexOfPad] - AliTOFConstants::fgkNpadX - 1; // AdC
                  }
                  
                  // check if two sdigit are on the same pad; in that case we sum
@@ -469,11 +472,14 @@ void AliTOFSDigitizer::Print(Option_t* /*opt*/)const
 //__________________________________________________________________
 void AliTOFSDigitizer::SelectSectorAndPlate(Int_t sector, Int_t plate)
 {
-  Bool_t isaWrongSelection=(sector < 1) || (sector > AliTOFConstants::fgkNSectors) || (plate < 1) || (plate > AliTOFConstants::fgkNPlates);
+  //Bool_t isaWrongSelection=(sector < 1) || (sector > AliTOFConstants::fgkNSectors) || (plate < 1) || (plate > AliTOFConstants::fgkNPlates);
+  Bool_t isaWrongSelection=(sector < 0) || (sector >= AliTOFConstants::fgkNSectors) || (plate < 0) || (plate >= AliTOFConstants::fgkNPlates); // AdC
   if(isaWrongSelection){
     cout << "You have selected an invalid value for sector or plate " << endl;
-    cout << "The correct range for sector is [1,"<< AliTOFConstants::fgkNSectors <<"]" << endl;
-    cout << "The correct range for plate  is [1,"<< AliTOFConstants::fgkNPlates  <<"]" << endl;
+    //cout << "The correct range for sector is [1,"<< AliTOFConstants::fgkNSectors <<"]" << endl;
+    //cout << "The correct range for plate  is [1,"<< AliTOFConstants::fgkNPlates  <<"]" << endl;
+    cout << "The correct range for sector is [0,"<< AliTOFConstants::fgkNSectors-1 <<"]\n"; // AdC
+    cout << "The correct range for plate  is [0,"<< AliTOFConstants::fgkNPlates-1  <<"]\n"; // AdC
     cout << "By default we continue sdigitizing all hits in all plates of all sectors" << endl;
   } else {
     fSelectedSector=sector;
index 8a42bee..d6cf69a 100644 (file)
@@ -102,11 +102,11 @@ Int_t AliTOFSDigits2Digits(Int_t nev = 1) {
                                             // for current sdigit
 
        // TOF sdigit volumes (always the same for all slots)
-       Int_t sector    = tofsdigit->GetSector(); // range [1-18]
-       Int_t plate     = tofsdigit->GetPlate();  // range [1- 5]
-       Int_t strip     = tofsdigit->GetStrip();  // range [1-20]
-       Int_t padz      = tofsdigit->GetPadz();   // range [1- 2]
-       Int_t padx      = tofsdigit->GetPadx();   // range [1-48]
+       Int_t sector    = tofsdigit->GetSector(); // range [0-17]
+       Int_t plate     = tofsdigit->GetPlate();  // range [0- 4]
+       Int_t strip     = tofsdigit->GetStrip();  // range [0-19]
+       Int_t padz      = tofsdigit->GetPadz();   // range [0- 1]
+       Int_t padx      = tofsdigit->GetPadx();   // range [0-47]
 
        vol[0] = sector;
        vol[1] = plate;
@@ -116,10 +116,10 @@ Int_t AliTOFSDigits2Digits(Int_t nev = 1) {
 
        //--------------------- QA section ----------------------
        // in the while, I perform QA
-       Bool_t isSDigitBad = (sector<1 || sector>18 || 
-                               plate<1 || plate >5  || 
-                                padz<1 || padz>2    || 
-                                padx<1 || padx>48);
+       Bool_t isSDigitBad = (sector<0 || sector>17 || 
+                               plate<0 || plate >4  || 
+                                padz<0 || padz>1    || 
+                                padx<0 || padx>47);
        
        if (isSDigitBad)
          {
index 7dc9ba5..8b90475 100644 (file)
 // - track momentum and position in the last TPC padrow 
 // - track length as given by the geometrical propagation
 // - reconstructed mass from time of flight and time of flight itself
+// - fMatchingStatus
+//             -2 backpropagation goes out of the z acceptance of the TOF
+//             -1 failed backpropagation on TOF inner radius
+//              0 for fake tracks
+//              1 for tracks matched with no signal on TOF (failed DigitFinder)
+//              3 for tracks matched with the actual digit
+//              4 for tracks matched with a wrong (not its own) TOF digit
 ////////////////////////////////////////////////////////////////////////
 
 #include "AliTOFTrackV2.h"
@@ -59,11 +66,18 @@ AliTOFTrackV2::AliTOFTrackV2()
   fLength=-1;
   fTof=-1;
   fMassTOF=-1;
+  // vertex variables from reconstruction
+  fXRecVtx=-1;
+  fYRecVtx=-1;
+  fZRecVtx=-1;
+  fPxRecVtx=-1;
+  fPyRecVtx=-1;
+  fPzRecVtx=-1;
+  fRecTrackLength=-1;
 }
 
 //_____________________________________________________________________________
-AliTOFTrackV2::AliTOFTrackV2(Int_t trackLabel, Int_t matchingStatus, Float_t tpcMom, Float_t dEdX, 
-                             Float_t* tpcXYZ, Float_t* tpcPtPz, Float_t* /*trdXYZ*/, Float_t* /*trdPxPyPz*/)
+AliTOFTrackV2::AliTOFTrackV2(Int_t trackLabel, Int_t matchingStatus, Float_t tpcMom, Float_t dEdX, Float_t* tpcXYZ, Float_t* tpcPtPz, Float_t* trdXYZ, Float_t* trdPxPyPz)
 {
   //
   // par ctor
@@ -92,6 +106,15 @@ AliTOFTrackV2::AliTOFTrackV2(Int_t trackLabel, Int_t matchingStatus, Float_t tpc
   fLength=-1;
   fTof=-1;
   fMassTOF=-1;
+
+  // vertex variables from reconstruction
+  fXRecVtx=-1;
+  fYRecVtx=-1;
+  fZRecVtx=-1;
+  fPxRecVtx=-1;
+  fPyRecVtx=-1;
+  fPzRecVtx=-1;
+  fRecTrackLength=-1;
 }
 
 //_____________________________________________________________________________
index caec5f0..d092eaa 100644 (file)
@@ -22,6 +22,7 @@ class AliTOFTrackV2 : public TObject{
   AliTOFTrackV2(Int_t trackLabel, Int_t matchingStatus, Float_t tpcMom, Float_t dEdX, Float_t* tpcXYZ, Float_t* tpcPtPz, Float_t* trdXYZ, Float_t* trdPxPyPz);
   ~AliTOFTrackV2(){};
 
+  void AddRecLength(Float_t deltaRecLength)              {fRecTrackLength+=deltaRecLength;}
   void UpdateTrack(Int_t tofDigitTrackLabel, Int_t matching, Float_t tof);
   void UpdateTrack(Int_t pdgCode, Float_t trackLength);
 
@@ -43,9 +44,11 @@ class AliTOFTrackV2 : public TObject{
   void SetPzTRD(Float_t pzTRD)                           {fPzTRD=pzTRD;}
   void SetMatchingStatus(Int_t matching)                 {fMatchingStatus=matching;}
   void SetLength(Float_t length)                         {fLength=length;}
+  void SetRecLength(Float_t rlength)                     {fRecTrackLength=rlength;}
   void SetTof(Float_t tof)                               {fTof=tof;}
   void SetMassTOF(Float_t massTOF)                       {fMassTOF=massTOF;}
-  
+  void SetVertex(Float_t xvtx,Float_t yvtx,Float_t zvtx) {fXRecVtx=xvtx; fYRecVtx=yvtx; fZRecVtx=zvtx;}
+  void SetMomVertex(Float_t pxvtx,Float_t pyvtx,Float_t pzvtx) {fPxRecVtx=pxvtx; fPyRecVtx=pyvtx; fPzRecVtx=pzvtx;}
 
   Int_t    GetTrackLabel()         const {return fTrackLabel;}
   Int_t    GetTOFDigitTrackLabel() const {return fTOFDigitTrackLabel;}
@@ -65,9 +68,16 @@ class AliTOFTrackV2 : public TObject{
   Float_t  GetPzTRD()              const {return fPzTRD;}
   Int_t    GetMatchingStatus()     const {return fMatchingStatus;}
   Float_t  GetLength()             const {return fLength;}
+  Float_t  GetRecLength()          const {return fRecTrackLength;}
   Float_t  GetTof()                const {return fTof;}
   Float_t  GetMassTOF()            const {return fMassTOF;}
-  
+  Float_t  GetXVtx()               const {return fXRecVtx;}
+  Float_t  GetYVtx()               const {return fYRecVtx;}
+  Float_t  GetZVtx()               const {return fZRecVtx;}
+  Float_t  GetPxVtx()              const {return fPxRecVtx;}
+  Float_t  GetPyVtx()              const {return fPyRecVtx;}
+  Float_t  GetPzVtx()              const {return fPzRecVtx;}
+
  private:
   Int_t    fTrackLabel;         // track label (rt->GetLabel()) as coming from TPC reconstruction
   Int_t    fTOFDigitTrackLabel; // track label stored into the TOF digit
@@ -89,10 +99,19 @@ class AliTOFTrackV2 : public TObject{
   Int_t    fMatchingStatus; // matching status (not only for MC events)
                             // see details in the implementation file
   Float_t  fLength  ; // Track length [cm] from the origin to the TOF [cm]
+                      // GEANT track length to be compared with that coming from
+                      // reconstruction in order to evaluate the resolution
   Float_t  fTof;      // Time [ns] determined by the TOF digit assigned to the track
   Float_t  fMassTOF;  // Mass [GeV] determined by fTOF,fLength, and reconstructed momentum in TPC
+  Float_t  fXRecVtx;  // x component of the reconstructed vertex position MRF
+  Float_t  fYRecVtx;  // y component of the reconstructed vertex position MRF
+  Float_t  fZRecVtx;  // z component of the reconstructed vertex position MRF
+  Float_t  fPxRecVtx;  // x component of the reconstructed vertex momentum MRF
+  Float_t  fPyRecVtx;  // y component of the reconstructed vertex momentum MRF
+  Float_t  fPzRecVtx;  // z component of the reconstructed vertex momentum MRF
+  Float_t  fRecTrackLength; // reconstructed track length (coarse)
 
-  ClassDef(AliTOFTrackV2,1)   // TOF Reconstructed track
+  ClassDef(AliTOFTrackV2,2)   // TOF Reconstructed track
 };
 
 #endif /* ALITOFTRACKV2_H */
index 93690cf..7bccbac 100644 (file)
@@ -10,14 +10,14 @@ Int_t AliTOFanalyzeDigits(Int_t ndump=15, Int_t iEvNum=0)
   Int_t rc = 0;
   
   // adc and tdc
-  TH1F *htdc  = new TH1F("htdc","TDC [bin]",500,0.,15000.);
-  TH1F *hadc   = new TH1F("hadc","ADC [bin]",100,0., 3000.);
+  TH1F *htdc     = new TH1F("htdc","TDC [bin]",500,0.,15000.);
+  TH1F *hadc     = new TH1F("hadc","ADC [bin]",100,0., 3000.);
   // TOF digit volumes
-  TH1F *hsector  = new TH1F("hsector","Sector",20,0.,20.);
-  TH1F *hplate   = new TH1F("hplate","Plate ", 6,0., 6.);
-  TH1F *hstrip   = new TH1F("hstrip","Strip ",25,0.,25.);
-  TH1F *hpadz    = new TH1F("hpadz","Pad along z ",3,0.,3.);
-  TH1F *hpadx    = new TH1F("hpadx","Pad along x",50,0.,50.);
+  TH1F *hsector  = new TH1F("hsector","Sector",18,0.,18.);
+  TH1F *hplate   = new TH1F("hplate","Plate ", 5,0., 5.);
+  TH1F *hstrip   = new TH1F("hstrip","Strip ",20,0.,20.);
+  TH1F *hpadz    = new TH1F("hpadz","Pad along z ",2,0.,2.);
+  TH1F *hpadx    = new TH1F("hpadx","Pad along x",48,0.,48.);
   // ADC-TDC correlation
   TH2F *h2tdcVSadc = new TH2F("h2tdcVSadc","TDC [bin] VS ADC [bin]",100,0.,3000.,500,0.,15000.);
 
@@ -110,13 +110,13 @@ Int_t AliTOFanalyzeDigits(Int_t ndump=15, Int_t iEvNum=0)
          htdc->Fill(tdc);
          hadc->Fill(adc);
          // TOF digit volumes
-         Int_t sector = tofdigit->GetSector(); // range [1-18]
-         Int_t plate  = tofdigit->GetPlate();  // range [1- 5]
-         Int_t strip  = tofdigit->GetStrip();  // range [1-20]
-         Int_t padz   = tofdigit->GetPadz();   // range [1- 2]
-         Int_t padx   = tofdigit->GetPadx();   // range [1-48]
+         Int_t sector = tofdigit->GetSector(); // range [0-17]
+         Int_t plate  = tofdigit->GetPlate();  // range [0- 4]
+         Int_t strip  = tofdigit->GetStrip();  // range [0-19]
+         Int_t padz   = tofdigit->GetPadz();   // range [0- 1]
+         Int_t padx   = tofdigit->GetPadx();   // range [0-47]
          // it is QA, then I perform QA!
-         Bool_t isDigitBad = (sector<1 || sector>18 || plate<1 || plate >5 || padz<1 || padz>2 || padx<1 || padx>48);
+         Bool_t isDigitBad = (sector<0 || sector>17 || plate<0 || plate >4 || padz<0 || padz>1 || padx<0 || padx>47);
          
          if (isDigitBad)
            {
index 6099ebe..f41b6a6 100644 (file)
@@ -23,22 +23,24 @@ Int_t AliTOFanalyzeHits(Int_t nevents = 1, Bool_t drawing = kFALSE)
   TH1F *htofmomp = new TH1F("htofmomp","Momentum at TOF (primaries)",100,0.,10.);
   TH1F *htofmoms = new TH1F("htofmoms","Momentum at TOF (secondaries)",100,0.,10.);
   // TOF hit volumes
-  TH1F *hsector  = new TH1F("hsector","Sector",20,0.,20.);
-  TH1F *hplate   = new TH1F("hplate","Plate ", 6,0., 6.);
-  TH1F *hstrip   = new TH1F("hstrip","Strip ",25,0.,25.);
-  TH1F *hpadz    = new TH1F("hpadz","Pad along z ",3,0.,3.);
-  TH1F *hpadx    = new TH1F("hpadx","Pad along x",50,0.,50.);
+  TH1F *hsector  = new TH1F("hsector","Sector",18,0.,18.);
+  TH1F *hplate   = new TH1F("hplate","Plate ", 5,0., 5.);
+  TH1F *hstrip   = new TH1F("hstrip","Strip ",20,0.,20.);
+  TH1F *hpadz    = new TH1F("hpadz","Pad along z ",2,0.,2.);
+  TH1F *hpadx    = new TH1F("hpadx","Pad along x",48,0.,48.);
   // track length when striking the TOF (used by AliTOFT0)
   TH1F *htrackLenp= new TH1F("htrackLenp","Track Length on TOF for Primaries",800,0.,800.);
 
   // Histograms added to control the right TOF element numbering:
   // it should be increasing with the azimuthal and polar angles
 
-  TH2F *hmoduleVStheta = new TH2F("hmoduleVStheta", "hmoduleVStheta", 180,0.,180.,6,0,6);
-  TH2F *hsectorVSphi   = new TH2F("hsectorVSphi", "hsectorVSphi", 360,0.,360.,19,0,19);
-  TH2F *hstripVStheta   = new TH2F("hstripVStheta", "hstripVStheta", 180,0.,180.,25,0,25);
-  TH2F *hpadzVStheta   = new TH2F("hpadzVStheta", "hpadzVStheta", 180,0.,180.,3,0,3);
-  TH2F *hpadxVSphi     = new TH2F("hpadxVSphi", "hpadxVSphi", 360,0.,360.,49,0,49);
+  TH2F *hmoduleVStheta     = new TH2F("hmoduleVStheta", "hmoduleVStheta", 180,0.,180.,5,0,5);
+  TH2F *hsectorVSphi       = new TH2F("hsectorVSphi", "hsectorVSphi", 360,0.,360.,18,0,18);
+  TH2F *hstripVStheta      = new TH2F("hstripVStheta", "hstripVStheta", 180,0.,180.,20,0,20);
+  //TH2F *hpadzVStheta       = new TH2F("hpadzVStheta", "hpadzVStheta", 180,0.,180.,2,0,2);
+  TH2F *hpadxVSphi         = new TH2F("hpadxVSphi", "hpadxVSphi", 360,0.,360.,48,0,48);
+  TH2F *hpadz2stripVStheta = new TH2F("hpadz2stripVStheta", "hpadz2stripVStheta", 180,0.,180.,40,0,40);
+  //TH2F *hdzVSpadz2strip    = new TH2F("hdzVSpadz2strip", "hdzVSpadz2strip",40,0,40,70,-3.5,3.5);
 
   // Dynamically link some shared libs
   if (gClassTable->GetID("AliRun") < 0) {
@@ -152,19 +154,43 @@ Int_t AliTOFanalyzeHits(Int_t nevents = 1, Bool_t drawing = kFALSE)
         Int_t padz   = hit->GetPadz();   // range [1- 2]
         Int_t padx   = hit->GetPadx();   // range [1-48]
         // it is QA, then I perform QA!
-        Bool_t isHitBad = (sector<1 || sector>18 || plate<1 || plate >5 || padz<1 || padz>2 || padx<1 || padx>48);
 
-        if (isHitBad) {
-          cout << "<AliTOFanalyzeHits>  strange hit found" << endl;
+       
+        Bool_t isHitBad = (sector<0 || sector>17 || 
+                          plate<0 || plate>4 || 
+                          padz<0 || padz>1 || 
+                          padx<0 || padx>47 ||
+
+                          ((strip<0 || strip>14) && plate == 2) ||
+                          ((strip<0 || strip>18) && (plate == 1 || plate == 3)) ||
+                          ((strip<0 || strip>19) && (plate == 0 || plate == 4)));
+       
+       if (isHitBad) {
+          cout << "<AliTOFanalyzeHits>  strange hit found \n";
+         cout << "sector = " << sector <<
+           " plate = " << plate <<
+           " strip = " << strip <<
+           " padx = " << padx <<
+           " padz = " << padz << endl;
          rc = 5;
          return rc;
         }
-
+       
         hmoduleVStheta->Fill(thetaAngle,plate);
        hstripVStheta->Fill(thetaAngle,strip);
         hsectorVSphi->Fill(phiAngle,sector);
+        //hpadzVStheta->Fill(thetaAngle,padx);
         hpadxVSphi->Fill(phiAngle,padx);
-        hpadzVStheta->Fill(thetaAngle,padz);
+
+       Float_t dummy2 = 2*strip + padz;
+       hpadz2stripVStheta->Fill(thetaAngle,dummy2);
+
+       /*
+         Float_t dummy3;
+         if (hit->GetDz()<=0) dummy3 = hit->GetDz()-1.75;
+         else dummy3 = hit->GetDz()+1.75;      
+         hdzVSpadz2strip->Fill(dummy2,dummy3);
+       */
 
         // filling hit volume histos
         hsector->Fill(sector);
@@ -223,6 +249,8 @@ Int_t AliTOFanalyzeHits(Int_t nevents = 1, Bool_t drawing = kFALSE)
 
   }
 
+  cout << "hpadx->GetEntries() = " << hpadx->GetEntries() << endl;
+
   rl->UnloadHeader();
   rl->UnloadgAlice();
 
@@ -281,8 +309,10 @@ Int_t AliTOFanalyzeHits(Int_t nevents = 1, Bool_t drawing = kFALSE)
   hmoduleVStheta->Write();
   hsectorVSphi->Write();
   hstripVStheta->Write();
-  hpadzVStheta->Write();
+  //hpadzVStheta->Write();
   hpadxVSphi->Write();
+  hpadz2stripVStheta->Write();
+  //hdzVSpadz2strip->Write();
 
   fout->Close(); 
 
index 6241cec..e5012ea 100644 (file)
@@ -10,14 +10,14 @@ Int_t AliTOFanalyzeSDigitsV2(Int_t ndump=15, Int_t iEvNum=0)
   Int_t rc = 0;
 
   // adc and tdc
-  TH1F *htdc  = new TH1F("htdc","TDC [bin]",5000,0.,150000.);
-  TH1F *hadc   = new TH1F("hadc","ADC [bin]",100,0., 3000.);
+  TH1F *htdc     = new TH1F("htdc","TDC [bin]",5000,0.,150000.);
+  TH1F *hadc     = new TH1F("hadc","ADC [bin]",100,0., 3000.);
   // TOF sdigit volumes
-  TH1F *hsector  = new TH1F("hsector","Sector",20,0.,20.);
-  TH1F *hplate   = new TH1F("hplate","Plate ", 6,0., 6.);
-  TH1F *hstrip   = new TH1F("hstrip","Strip ",25,0.,25.);
-  TH1F *hpadz    = new TH1F("hpadz","Pad along z ",3,0.,3.);
-  TH1F *hpadx    = new TH1F("hpadx","Pad along x",50,0.,50.);
+  TH1F *hsector  = new TH1F("hsector","Sector",18,0.,18.);
+  TH1F *hplate   = new TH1F("hplate","Plate ", 5,0., 5.);
+  TH1F *hstrip   = new TH1F("hstrip","Strip ",20,0.,20.);
+  TH1F *hpadz    = new TH1F("hpadz","Pad along z ",2,0.,2.);
+  TH1F *hpadx    = new TH1F("hpadx","Pad along x",48,0.,48.);
   // ADC-TDC correlation
   TH2F *h2tdcVSadc = new TH2F("h2tdcVSadc","TDC [bin] VS ADC [bin]",500,0.,150000.,100,0.,3000.);
   
@@ -110,14 +110,15 @@ Int_t AliTOFanalyzeSDigitsV2(Int_t ndump=15, Int_t iEvNum=0)
          htdc->Fill(firstTDC);
          hadc->Fill(firstADC);
          // TOF sdigit volumes
-         Int_t sector = tofsdigit->GetSector(); // range [1-18]
-         Int_t plate  = tofsdigit->GetPlate();  // range [1- 5]
-         Int_t strip  = tofsdigit->GetStrip();  // range [1-20]
-         Int_t padz   = tofsdigit->GetPadz();   // range [1- 2]
-         Int_t padx   = tofsdigit->GetPadx();   // range [1-48]
+         Int_t sector = tofsdigit->GetSector(); // range [0-17]
+         Int_t plate  = tofsdigit->GetPlate();  // range [0- 4]
+         Int_t strip  = tofsdigit->GetStrip();  // range [0-19]
+         Int_t padz   = tofsdigit->GetPadz();   // range [0- 1]
+         Int_t padx   = tofsdigit->GetPadx();   // range [0-47]
          // it is QA, then I perform QA!
-         Bool_t isSDigitBad = (sector<1 || sector>18 || plate<1 || plate >5 || padz<1 || padz>2 || padx<1 || padx>48);
+         Bool_t isSDigitBad = (sector<0 || sector>17 || plate<0 || plate >4 || padz<0 || padz>1 || padx<0 || padx>47);
          
+
          if (isSDigitBad) {
            cout << "<AliTOFanalyzeSDigits>  strange sdigit found" << endl;
            rc = 4;
index 74072a8..94b64dd 100644 (file)
@@ -42,8 +42,8 @@ void AliTOFhits2sdigits(Int_t firstEvent=0,Int_t nEvents=1)
 
   // e.g. Activate this line if you want to sdigitize only hits from plate 3
   // in sector 15
-  // pay attention that sector must be in the range [1,18]
-  //                and plate  must be in the range [1,5]
+  // pay attention that sector must be in the range [0,17]
+  //                and plate  must be in the range [0,4]
   // by default we sdigitize hits of all plates in all sectors
   // sdigitizer->SelectSectorAndPlate(15,3);
 
index 616975d..847461d 100644 (file)
 /* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
-//
+//                                                                           //
 //  This class contains the functions for version 0 of the Time Of Flight    //
 //  detector.                                                                //
-//
-//  VERSION WITH 5 MODULES AND TILTED STRIPS 
-//  NO HITS DEFINED BY DEFAULT FOR THIS VERSION
-//   FULL COVERAGE VERSION
-//
-//   Authors:
-//
-//   Alessio Seganti
-//   Domenico Vicinanza
-//
-//   University of Salerno - Italy
-//
-//   Fabrizio Pierella
-//   University of Bologna - Italy
-//
-//
-//Begin_Html
-/*
-<img src="picts/AliTOFv0Class.gif">
-*/
-//End_Html
+//                                                                           //
+//  VERSION WITH 5 MODULES AND TILTED STRIPS                                 //
+//  NO HITS DEFINED BY DEFAULT FOR THIS VERSION                              //
+//   FULL COVERAGE VERSION                                                   //
+//                                                                           //
+//   Authors:                                                                //
+//                                                                           //
+//   Alessio Seganti                                                         //
+//   Domenico Vicinanza                                                      //
+//                                                                           //
+//   University of Salerno - Italy                                           //
+//                                                                           //
+//   Fabrizio Pierella                                                       //
+//   University of Bologna - Italy                                           //
+//                                                                           //
+//                                                                           //
+//Begin_Html                                                                 //
+/*                                                                           //
+<img src="picts/AliTOFv0Class.gif">                                          //
+*/                                                                           //
+//End_Html                                                                   //
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -56,6 +56,7 @@
 #include "AliConst.h"
 #include "AliRun.h"
 #include "AliTOFv0.h"
+#include "AliTOFConstants.h" // AdC
  
 ClassImp(AliTOFv0)
  
@@ -437,19 +438,23 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   Float_t gap  = fGapA+0.5; //cm  updated distance between the strip axis
   Float_t zpos = 0;
   Float_t ang  = 0;
-  Int_t i=1,j=1;
+  Int_t j=1; // AdC
   nrot  = 0;
   zcoor = 0;
   ycoor = -14.5 + kspace ; //2 cm over front plate
 
   AliMatrix (idrotm[0],  90.,  0.,90.,90.,0., 90.);   
-  gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
 
-     printf("%f,  St. %2i, Pl.3 ",ang*kRaddeg,i); 
-     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+  Int_t centerLoc= (Int_t)(fNStripA/2.) + 1; // AdC
 
+  //gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
+  gMC->Gspos("FSTR",centerLoc,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY"); // AdC
+  if(fDebug>=1) {
+    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
+    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+  }
   zcoor -= zSenStrip;
-  j++;
+  //j++; // AdC
   Int_t upDown = -1; // upDown=-1 -> Upper strip
                      // upDown=+1 -> Lower strip
   do{
@@ -460,28 +465,30 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
      ang /= kRaddeg;
      ycoor = -14.5+ kspace; //2 cm over front plate
      ycoor += (1-(upDown+1)/2)*gap;
-     gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
-     gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
-
-     printf("%f,  St. %2i, Pl.3 ",ang*kRaddeg,i); 
-     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
-
-     j += 2;
-     upDown*= -1; // Alternate strips 
-     zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
-             upDown*gap*TMath::Tan(ang)-
-            (zSenStrip/2)/TMath::Cos(ang);
+     //gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+     //gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+    gMC->Gspos("FSTR",centerLoc-j,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY"); // AdC
+    gMC->Gspos("FSTR",centerLoc+j,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); // AdC
+    if(fDebug>=1) {
+      printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
+      printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+    }
+    //j += 2; // AdC
+    upDown*= -1; // Alternate strips 
+    zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
+      upDown*gap*TMath::Tan(ang)-
+      (zSenStrip/2)/TMath::Cos(ang);
   } while (zcoor-(stripWidth/2)*TMath::Cos(ang)>-t+zFLTC+zFLTB+db*2);
   
   zcoor = zcoor+(zSenStrip/2)/TMath::Cos(ang)+
-          upDown*gap*TMath::Tan(ang)+
-          (zSenStrip/2)/TMath::Cos(ang);
-
+    upDown*gap*TMath::Tan(ang)+
+    (zSenStrip/2)/TMath::Cos(ang);
+  
   gap = fGapB;
   zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
-          upDown*gap*TMath::Tan(ang)-
-          (zSenStrip/2)/TMath::Cos(ang);
-
+    upDown*gap*TMath::Tan(ang)-
+    (zSenStrip/2)/TMath::Cos(ang);
+  
   ang = atan(zcoor/radius);
   ang *= kRaddeg;
   AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
@@ -490,17 +497,20 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
          
   ycoor = -14.5+ kspace; //2 cm over front plate
   ycoor += (1-(upDown+1)/2)*gap;
-  gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
-  gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
-     printf("%f,  St. %2i, Pl.3 ",ang*kRaddeg,i); 
-     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
-
+  //gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+  //gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+  gMC->Gspos("FSTR",centerLoc-j,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY"); // AdC
+  gMC->Gspos("FSTR",centerLoc+j,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); // AdC
+  if(fDebug>=1) {
+    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
+    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+  }
   ycoor = -hTof/2.+ kspace;//2 cm over front plate
 
   // Plate  B
 
   nrot = 0;
-  i=1;
+  Int_t i=1; // AdC
   upDown = 1;
   Float_t deadRegion = 1.0;//cm
   
@@ -517,10 +527,10 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   ycoor += (1-(upDown+1)/2)*gap;
   zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
   gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
-
-     printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
-     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
-
+  if(fDebug>=1) {   
+    printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); 
+    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+  }
   i++;
   upDown*=-1;
 
@@ -538,10 +548,10 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
      ycoor += (1-(upDown+1)/2)*(gap+deltaGapinB);
      zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
      gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
-
-     printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
-     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
-
+     if(fDebug>=1) {   
+       printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); 
+       printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+     }
      upDown*=-1;
      i++;
   } while (TMath::Abs(ang*kRaddeg)<22.5);
@@ -562,11 +572,13 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
      gMC->Gspos("FSTR",i, "FLTB", 0., ycoor+deltaMovingDown+deltaMovingUp, zcoor,idrotm[nrot], "ONLY");
      deltaMovingUp+=0.8; // update delta moving toward the end of the plate
      zpos = zpos - zSenStrip/TMath::Cos(ang);
-     printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
-     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+     if(fDebug>=1) {
+       printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i);
+       printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+     }
      i++;
   }  while (zpos-stripWidth*0.5/TMath::Cos(ang)>-t+zFLTC+db);
-
+  
   // Plate  C
   
   zpos = zpos + zSenStrip/TMath::Cos(ang);
@@ -588,10 +600,10 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
      ang /= kRaddeg;
      zcoor = zpos+(zFLTC*0.5+zFLTB+zFLTA*0.5+db*2);
      gMC->Gspos("FSTR",i, "FLTC", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
-
-     printf("%f,  St. %2i, Pl.5 ",ang*kRaddeg,i); 
-     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
-
+     if(fDebug>=1) {
+       printf("%s: %f,  St. %2i, Pl.5 ",ClassName(),ang*kRaddeg,i);
+       printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+     }
      zpos = zpos - zSenStrip/TMath::Cos(ang);
   }  while (zpos-stripWidth*TMath::Cos(ang)*0.5>-t);
 
@@ -997,18 +1009,29 @@ void AliTOFv0::StepManager()
     z = pos[2];
 
     plate = 0;   
-    if (TMath::Abs(z) <=  fZlenA*0.5)  plate = 3;
+    if (TMath::Abs(z) <=  fZlenA*0.5)  plate = 2; //3; // AdC
     if (z < (fZlenA*0.5+fZlenB) && 
-        z >  fZlenA*0.5)               plate = 4;
+        z >  fZlenA*0.5)               plate = 1; //4; // AdC
     if (z >-(fZlenA*0.5+fZlenB) &&
-        z < -fZlenA*0.5)               plate = 2;
-    if (z > (fZlenA*0.5+fZlenB))       plate = 5;
-    if (z <-(fZlenA*0.5+fZlenB))       plate = 1;
+        z < -fZlenA*0.5)               plate = 3; //2; // AdC
+    if (z > (fZlenA*0.5+fZlenB))       plate = 0; //5; // AdC
+    if (z <-(fZlenA*0.5+fZlenB))       plate = 4; //1; // AdC
+
+    if (plate==0) strip=AliTOFConstants::fgkNStripC-strip; // AdC
+    else if (plate==1) strip=AliTOFConstants::fgkNStripB-strip; // AdC
+    else strip--; // AdC
+
+    if (z<=0.) padx=AliTOFConstants::fgkNpadX-padx; // AdC
+    else padx--; // AdC
+
+    if (plate==3 || plate==4) padz=AliTOFConstants::fgkNpadZ-padz; // AdC
+    else padz--; // AdC
 
     phi = pos.Phi();
-    phid = phi*kRaddeg+180.;
+    if (phi>=0.) phid = phi*kRaddeg; //+180.; // AdC
+    else phid = phi*kRaddeg + 360.; // AdC
     sector = Int_t (phid/20.);
-    sector++;
+    //sector++;  // AdC
 
     for(i=0;i<3;++i) {
       hits[i]   = pos[i];
index f6b3f0d..5642e86 100644 (file)
 /* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
-//
+//                                                                           //
 //  This class contains the functions for version 1 of the Time Of Flight    //
 //  detector.                                                                //
-//
-//  VERSION WITH 5 MODULES AND TILTED STRIPS 
-//
-//  HOLES FOR PHOS DETECTOR
-//
-//   Authors:
-//
-//   Alessio Seganti
-//   Domenico Vicinanza
-//
-//   University of Salerno - Italy
-//
-//   Fabrizio Pierella
-//   University of Bologna - Italy
-//
-//
-//Begin_Html
-/*
-<img src="picts/AliTOFv1Class.gif">
-*/
-//End_Html
+//                                                                           //
+//  VERSION WITH 5 MODULES AND TILTED STRIPS                                 //
+//                                                                           //
+//  HOLES FOR PHOS DETECTOR                                                  //
+//                                                                           //
+//   Authors:                                                                //
+//                                                                           //
+//   Alessio Seganti                                                         //
+//   Domenico Vicinanza                                                      //
+//                                                                           //
+//   University of Salerno - Italy                                           //
+//                                                                           //
+//   Fabrizio Pierella                                                       //
+//   University of Bologna - Italy                                           //
+//                                                                           //
+//                                                                           //
+//Begin_Html                                                                 //
+/*                                                                           //
+<img src="picts/AliTOFv1Class.gif">                                          //
+*/                                                                           //
+//End_Html                                                                   //
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -57,6 +57,7 @@
 #include "AliMagF.h"
 #include "AliRun.h"
 #include "AliTOFv1.h"
+#include "AliTOFConstants.h" // AdC
  
 ClassImp(AliTOFv1)
  
@@ -447,21 +448,25 @@ void AliTOFv1::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   Float_t gap  = fGapA+0.5; //cm  updated distance between the strip axis
   Float_t zpos = 0;
   Float_t ang  = 0;
-  Int_t i=1,j=1;
+  Int_t j=1; // AdC
   nrot  = 0;
   zcoor = 0;
   ycoor = -14.5 + kspace ; //2 cm over front plate
   
   AliMatrix (idrotm[0],  90.,  0.,90.,90.,0., 90.);   
-  gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
-  
-  printf("%f,  St. %2i, Pl.3 ",ang*kRaddeg,i); 
-  printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
-  
+
+  Int_t centerLoc= (Int_t)(fNStripA/2.) + 1; // AdC
+
+  //gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
+  gMC->Gspos("FSTR",centerLoc,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY"); // AdC
+  if(fDebug>=1) {
+    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
+    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+  }
   zcoor -= zSenStrip;
-  j++;
+  //j++; // AdC
   Int_t upDown = -1; // upDown=-1 -> Upper strip
-  // upDown=+1 -> Lower strip
+                     // upDown=+1 -> Lower strip
   do{
     ang = atan(zcoor/radius);
     ang *= kRaddeg;
@@ -470,13 +475,15 @@ void AliTOFv1::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
     ang /= kRaddeg;
     ycoor = -14.5+ kspace; //2 cm over front plate
     ycoor += (1-(upDown+1)/2)*gap;
-    gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
-    gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
-    
-    printf("%f,  St. %2i, Pl.3 ",ang*kRaddeg,i); 
-    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
-    
-    j += 2;
+    //gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+    //gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+    gMC->Gspos("FSTR",centerLoc-j,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY"); // AdC
+    gMC->Gspos("FSTR",centerLoc+j,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); // AdC
+    if(fDebug>=1) {
+      printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
+      printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+    }
+    j++; //j += 2; // AdC
     upDown*= -1; // Alternate strips 
     zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
       upDown*gap*TMath::Tan(ang)-
@@ -500,18 +507,20 @@ void AliTOFv1::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   
   ycoor = -14.5+ kspace; //2 cm over front plate
   ycoor += (1-(upDown+1)/2)*gap;
-  gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
-  gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
-  
-  printf("%f,  St. %2i, Pl.3 ",ang*kRaddeg,i); 
-  printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
-  
+  //gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+  //gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+  gMC->Gspos("FSTR",centerLoc-j,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY"); // AdC
+  gMC->Gspos("FSTR",centerLoc+j,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); // AdC
+  if(fDebug>=1) {
+    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
+    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+  }
   ycoor = -hTof/2.+ kspace;//2 cm over front plate
   
   // Plate  B
   
   nrot = 0;
-  i=1;
+  Int_t i=1; // AdC
   upDown = 1;
   Float_t deadRegion = 1.0;//cm
   
@@ -528,10 +537,10 @@ void AliTOFv1::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   ycoor += (1-(upDown+1)/2)*gap;
   zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
   gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
-  
-  printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
-  printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
-  
+  if(fDebug>=1) {
+    printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); 
+    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+  }
   i++;
   upDown*=-1;
   
@@ -549,10 +558,10 @@ void AliTOFv1::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
     ycoor += (1-(upDown+1)/2)*(gap+deltaGapinB);
     zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
-    
-    printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
-    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
-    
+    if(fDebug>=1) {
+      printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); 
+      printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+    }
     upDown*=-1;
     i++;
   } while (TMath::Abs(ang*kRaddeg)<22.5);
@@ -573,8 +582,10 @@ void AliTOFv1::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor+deltaMovingDown+deltaMovingUp, zcoor,idrotm[nrot], "ONLY");
     deltaMovingUp+=0.8; // update delta moving toward the end of the plate
     zpos = zpos - zSenStrip/TMath::Cos(ang);
-    printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
-    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+    if(fDebug>=1) {
+      printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); 
+      printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+    }
     i++;
     
   }  while (zpos-stripWidth*0.5/TMath::Cos(ang)>-t+zFLTC+db);
@@ -600,10 +611,10 @@ void AliTOFv1::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
     ang /= kRaddeg;
     zcoor = zpos+(zFLTC*0.5+zFLTB+zFLTA*0.5+db*2);
     gMC->Gspos("FSTR",i, "FLTC", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
-    
-    printf("%f,  St. %2i, Pl.5 ",ang*kRaddeg,i); 
-    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
-    
+    if(fDebug>=1) {
+      printf("%s: %f,  St. %2i, Pl.5 ",ClassName(),ang*kRaddeg,i); 
+      printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+    }
     zpos = zpos - zSenStrip/TMath::Cos(ang);
   }  while (zpos-stripWidth*TMath::Cos(ang)*0.5>-t);
 
@@ -1086,19 +1097,30 @@ void AliTOFv1::StepManager()
 
     z = pos[2];
 
-    plate = 0;   
-    if (TMath::Abs(z) <=  fZlenA*0.5)  plate = 3;
+    plate = 0;
+    if (TMath::Abs(z) <=  fZlenA*0.5)  plate = 2; //3; // AdC
     if (z < (fZlenA*0.5+fZlenB) && 
-        z >  fZlenA*0.5)               plate = 4;
+        z >  fZlenA*0.5)               plate = 1; //4; // AdC
     if (z >-(fZlenA*0.5+fZlenB) &&
-        z < -fZlenA*0.5)               plate = 2;
-    if (z > (fZlenA*0.5+fZlenB))       plate = 5;
-    if (z <-(fZlenA*0.5+fZlenB))       plate = 1;
+        z < -fZlenA*0.5)               plate = 3; //2; // AdC
+    if (z > (fZlenA*0.5+fZlenB))       plate = 0; //5; // AdC
+    if (z <-(fZlenA*0.5+fZlenB))       plate = 4; //1; // AdC
+
+    if (plate==0) strip=AliTOFConstants::fgkNStripC-strip; // AdC
+    else if (plate==1) strip=AliTOFConstants::fgkNStripB-strip; // AdC
+    else strip--; // AdC
+
+    if (z<=0.) padx=AliTOFConstants::fgkNpadX-padx; // AdC
+    else padx--; // AdC
+
+    if (plate==3 || plate==4) padz=AliTOFConstants::fgkNpadZ-padz; // AdC
+    else padz--; // AdC
 
     phi = pos.Phi();
-    phid = phi*kRaddeg+180.;
+    if (phi>=0.) phid = phi*kRaddeg; //+180.; // AdC
+    else phid = phi*kRaddeg + 360.; // AdC
     sector = Int_t (phid/20.);
-    sector++;
+    //sector++; // AdC
 
     for(i=0;i<3;++i) {
       hits[i]   = pos[i];
index 8840563..f773826 100644 (file)
 /* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
-//
+//                                                                           //
 //  This class contains the functions for version 2 of the Time Of Flight    //
 //  detector.                                                                //
-//
-//  VERSION WITH 5 MODULES AND TILTED STRIPS 
-//  
-//  HOLES FOR PHOS AND RICH DETECTOR
-//
-//   Authors:
-//
-//   Alessio Seganti
-//   Domenico Vicinanza
-//
-//   University of Salerno - Italy
-//
-//   Fabrizio Pierella
-//   University of Bologna - Italy
-//
-//
-//Begin_Html
-/*
-<img src="picts/AliTOFv2Class.gif">
-*/
-//End_Html
+//                                                                           //
+//  VERSION WITH 5 MODULES AND TILTED STRIPS                                 //
+//                                                                           //
+//  HOLES FOR PHOS AND RICH DETECTOR                                         //
+//                                                                           //
+//   Authors:                                                                //
+//                                                                           //
+//   Alessio Seganti                                                         //
+//   Domenico Vicinanza                                                      //
+//                                                                           //
+//   University of Salerno - Italy                                           //
+//                                                                           //
+//   Fabrizio Pierella                                                       //
+//   University of Bologna - Italy                                           //
+//                                                                           //
+//                                                                           //
+//Begin_Html                                                                 //
+/*                                                                           //
+<img src="picts/AliTOFv2Class.gif">                                          //
+*/                                                                           //
+//End_Html                                                                   //
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -57,6 +57,7 @@
 #include "AliMagF.h"
 #include "AliRun.h"
 #include "AliTOFv2.h"
+#include "AliTOFConstants.h" // AdC
  
 ClassImp(AliTOFv2)
  
@@ -446,23 +447,26 @@ void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   Float_t gap  = fGapA+0.5; //cm  updated distance between the strip axis
   Float_t zpos = 0;
   Float_t ang  = 0;
-  Int_t i=1,j=1;
+  Int_t j=1; // AdC
   nrot  = 0;
   zcoor = 0;
   ycoor = -14.5 + kspace ; //2 cm over front plate
   
   AliMatrix (idrotm[0],  90.,  0.,90.,90.,0., 90.);   
-  gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
+
+  Int_t centerLoc= (Int_t)(fNStripA/2.) + 1; // AdC
+
+  //gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
   
   if(fDebug) {
-    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); 
+    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
     printf("%s: y = %f,  z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos);
   }
   
   zcoor -= zSenStrip;
-  j++;
+  //j++; // AdC
   Int_t upDown = -1; // upDown=-1 -> Upper strip
-  // upDown=+1 -> Lower strip
+                     // upDown=+1 -> Lower strip
   do{
     ang = atan(zcoor/radius);
     ang *= kRaddeg;
@@ -471,15 +475,17 @@ void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
     ang /= kRaddeg;
     ycoor = -14.5+ kspace; //2 cm over front plate
     ycoor += (1-(upDown+1)/2)*gap;
-    gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
-    gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+    //gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+    //gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+    gMC->Gspos("FSTR",centerLoc-j,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY"); // AdC
+    gMC->Gspos("FSTR",centerLoc+j,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); // AdC
     
     if(fDebug>=1) {
-      printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i);
+      printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
       printf("%s: y = %f,  z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos);
     }
     
-    j += 2;
+    j++; //j += 2; // AdC
     upDown*= -1; // Alternate strips 
     zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
       upDown*gap*TMath::Tan(ang)-
@@ -503,11 +509,12 @@ void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   
   ycoor = -14.5+ kspace; //2 cm over front plate
   ycoor += (1-(upDown+1)/2)*gap;
-  gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
-  gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
-  
+  //gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+  //gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+  gMC->Gspos("FSTR",centerLoc-j,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY"); // AdC
+  gMC->Gspos("FSTR",centerLoc+j,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); // AdC  
   if(fDebug>=1) {   
-    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i);  
+    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
     printf("%s: y = %f,  z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos);  
   }   
   
@@ -516,7 +523,7 @@ void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   // Plate  B
   
   nrot = 0;
-  i=1;
+  Int_t i=1; // AdC
   upDown = 1;
   Float_t deadRegion = 1.0;//cm
   
@@ -1102,19 +1109,30 @@ void AliTOFv2::StepManager()
 
     z = pos[2];
 
-    plate = 0;   
-    if (TMath::Abs(z) <=  fZlenA*0.5)  plate = 3;
+    plate = 0;
+    if (TMath::Abs(z) <=  fZlenA*0.5)  plate = 2; //3; // AdC
     if (z < (fZlenA*0.5+fZlenB) && 
-        z >  fZlenA*0.5)               plate = 4;
+        z >  fZlenA*0.5)               plate = 1; //4; // AdC
     if (z >-(fZlenA*0.5+fZlenB) &&
-        z < -fZlenA*0.5)               plate = 2;
-    if (z > (fZlenA*0.5+fZlenB))       plate = 5;
-    if (z <-(fZlenA*0.5+fZlenB))       plate = 1;
+        z < -fZlenA*0.5)               plate = 3; //2; // AdC
+    if (z > (fZlenA*0.5+fZlenB))       plate = 0; //5;
+    if (z <-(fZlenA*0.5+fZlenB))       plate = 4; //1; // AdC
+
+    if (plate==0) strip=AliTOFConstants::fgkNStripC-strip; // AdC
+    else if (plate==1) strip=AliTOFConstants::fgkNStripB-strip; // AdC
+    else strip--; // AdC
+
+    if (z<=0.) padx=AliTOFConstants::fgkNpadX-padx; // AdC
+    else padx--; // AdC
+
+    if (plate==3 || plate==4) padz=AliTOFConstants::fgkNpadZ-padz; // AdC
+    else padz--; // AdC
 
     phi = pos.Phi();
-    phid = phi*kRaddeg+180.;
+    if (phi>=0.) phid = phi*kRaddeg; //+180.; // AdC
+    else phid = phi*kRaddeg + 360.; //+180.; // AdC
     sector = Int_t (phid/20.);
-    sector++;
+    //sector++; // AdC
 
     for(i=0;i<3;++i) {
       hits[i]   = pos[i];
index 47c9c0c..e50d38a 100644 (file)
@@ -57,6 +57,7 @@
 #include "AliMagF.h"
 #include "AliRun.h"
 #include "AliTOFv2FHoles.h"
+#include "AliTOFConstants.h" // AdC
  
 ClassImp(AliTOFv2FHoles)
  
@@ -456,23 +457,26 @@ void AliTOFv2FHoles::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   // 1 cm is a special value exclusively for AliTOFv2FHoles geometry
   Float_t zpos = 0;
   Float_t ang  = 0;
-  Int_t i=1,j=1;
+  Int_t j=1; // AdC
   nrot  = 0;
   zcoor = 0;
   ycoor = -14.5 + kspace ; //2 cm over front plate
   
   AliMatrix (idrotm[0],  90.,  0.,90.,90.,0., 90.);   
-  gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
-  
+
+  Int_t centerLoc= (Int_t)(fNStripA/2.) + 1; // AdC
+
+  //gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
+  gMC->Gspos("FSTR",centerLoc,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY"); // AdC  
   if(fDebug>=1) {
-    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); 
+    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
     printf("%s: y = %f,  z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos);
   }
   
   zcoor -= zSenStrip;
-  j++;
+  //j++; // AdC
   Int_t upDown = -1; // upDown=-1 -> Upper strip
-  // upDown=+1 -> Lower strip
+                     // upDown=+1 -> Lower strip
   do{
     ang = atan(zcoor/radius);
     ang *= kRaddeg;
@@ -481,15 +485,16 @@ void AliTOFv2FHoles::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
     ang /= kRaddeg;
     ycoor = -14.5+ kspace; //2 cm over front plate
     ycoor += (1-(upDown+1)/2)*gap;
-    gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
-    gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
-    
+    //gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+    //gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+    gMC->Gspos("FSTR",centerLoc-j,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY"); // AdC
+    gMC->Gspos("FSTR",centerLoc+j,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); // AdC
     if(fDebug>=1) {
-      printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i);
+      printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
       printf("%s: y = %f,  z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos);
     }
     
-    j += 2;
+    j++; //j += 2; // AdC
     upDown*= -1; // Alternate strips 
     zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
       upDown*gap*TMath::Tan(ang)-
@@ -515,21 +520,22 @@ void AliTOFv2FHoles::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   ycoor += (1-(upDown+1)/2)*gap;
   
   /* for FRAME v0
-     gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
-     gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+     //gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+     //gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+     gMC->Gspos("FSTR",centerLoc-j,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY"); // AdC
+     gMC->Gspos("FSTR",centerLoc+j,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); // AdC
+     if(fDebug>=1) {   
+     printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
+     printf("%s: y = %f,  z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos);
+     }   
   */
   
-  if(fDebug>=1) {   
-    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i);  
-    printf("%s: y = %f,  z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos);  
-  }   
-  
   ycoor = -hTof/2.+ kspace;//2 cm over front plate
   
   // Plate  B
   
   nrot = 0;
-  i=1;
+  Int_t i=1; // AdC
   upDown = 1;
   Float_t deadRegion = 1.0;//cm
   
@@ -567,7 +573,6 @@ void AliTOFv2FHoles::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
     ycoor += (1-(upDown+1)/2)*gap;
     zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
-    
     if(fDebug>=1) {
       printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i);
       printf("%s: y = %f,  z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos);
@@ -623,7 +628,6 @@ void AliTOFv2FHoles::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
     zcoor = zpos+(zFLTC*0.5+zFLTB+zFLTA*0.5+db*2);
     if (i!=1)
       gMC->Gspos("FSTR",i, "FLTC", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
-    
     if(fDebug>=1) {
       printf("%s: %f,  St. %2i, Pl.5 ",ClassName(),ang*kRaddeg,i);
       printf("%s: y = %f,  z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos);
@@ -631,8 +635,8 @@ void AliTOFv2FHoles::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
     
     zpos = zpos - zSenStrip/TMath::Cos(ang);
   }  while (zpos-stripWidth*TMath::Cos(ang)*0.5>-t);
-
+  
+  
   ////////// Layers after strips /////////////////
   // Al Layer thickness (2.3mm) factor 0.7
   
@@ -1124,19 +1128,29 @@ void AliTOFv2FHoles::StepManager()
     if (z <-(fZlenA*0.5+fZlenB))       plate = 1;
     end to be changed */
 
-    if (TMath::Abs(z) <=  124.*0.5)  plate = 3;
+    if (TMath::Abs(z) <=  124.*0.5)  plate = 2; //3; // AdC
     if (z < (124.*0.5+154.) && 
-        z >  124.*0.5)               plate = 4;
+        z >  124.*0.5)               plate = 1; //4; // AdC
     if (z >-(124.*0.5+154.) &&
-        z < -124.*0.5)               plate = 2;
-    if (z > (124.*0.5+154.))       plate = 5;
-    if (z <-(124.*0.5+154.))       plate = 1;
+        z < -124.*0.5)               plate = 3; //2; // AdC
+    if (z > (124.*0.5+154.))         plate = 0; //5; // AdC
+    if (z <-(124.*0.5+154.))         plate = 4; //1; // AdC
+
+    if (plate==0) strip=AliTOFConstants::fgkNStripC-strip; // AdC
+    else if (plate==1) strip=AliTOFConstants::fgkNStripB-strip; // AdC
+    else strip--; // AdC
+
+    if (z<=0.) padx=AliTOFConstants::fgkNpadX-padx; // AdC
+    else padx--; // AdC
 
+    if (plate==3 || plate==4) padz=AliTOFConstants::fgkNpadZ-padz; // AdC
+    else padz--; // AdC
 
     phi = pos.Phi();
-    phid = phi*kRaddeg+180.;
+    if (phi>=0.) phid = phi*kRaddeg; //+180.; // AdC
+    else phid = phi*kRaddeg + 360.; // AdC
     sector = Int_t (phid/20.);
-    sector++;
+    //sector++; // AdC
 
     for(i=0;i<3;++i) {
       hits[i]   = pos[i];
index a16ab9e..589d27e 100644 (file)
 /* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
-//
+//                                                                           //
 //  This class contains the functions for version 3 of the Time Of Flight    //
 //  detector.                                                                //
-//
-//  VERSION WITH 5 MODULES AND TILTED STRIPS 
-//  HITS DEFINED FOR THIS VERSION
-//  HOLES FOR RICH DETECTOR
-//
-//   Authors:
-//
-//   Alessio Seganti
-//   Domenico Vicinanza
-//
-//   University of Salerno - Italy
-//
-//   Fabrizio Pierella
-//   University of Bologna - Italy
-//
-//
-//Begin_Html
-/*
-<img src="picts/AliTOFv3Class.gif">
-*/
-//End_Html
+//                                                                           //
+//  VERSION WITH 5 MODULES AND TILTED STRIPS                                 //
+//  HITS DEFINED FOR THIS VERSION                                            //
+//  HOLES FOR RICH DETECTOR                                                  //
+//                                                                           //
+//   Authors:                                                                //
+//                                                                           //
+//   Alessio Seganti                                                         //
+//   Domenico Vicinanza                                                      //
+//                                                                           //
+//   University of Salerno - Italy                                           //
+//                                                                           //
+//   Fabrizio Pierella                                                       //
+//   University of Bologna - Italy                                           //
+//                                                                           //
+//                                                                           //
+//Begin_Html                                                                 //
+/*                                                                           //
+<img src="picts/AliTOFv3Class.gif">                                          //
+*/                                                                           //
+//End_Html                                                                   //
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -56,6 +56,7 @@
 #include "AliConst.h"
 #include "AliRun.h"
 #include "AliTOFv3.h"
+#include "AliTOFConstants.h" // AdC
  
 ClassImp(AliTOFv3)
  
@@ -116,7 +117,7 @@ void AliTOFv3::BuildGeometry()
   Float_t zOffsetA = 0.;
   // Define TOF basic volume
   
-  char nodeName0[7], nodeName1[7], nodeName2[7]; 
+  char nodeName0[7], nodeName1[7], nodeName2[7];
   char nodeName3[7], nodeName4[7], rotMatNum[7];
   
   new TBRIK("S_TOF_C","TOF box","void",
@@ -151,23 +152,23 @@ void AliTOFv3::BuildGeometry()
     top->cd();
     node = new TNode(nodeName0,nodeName0,"S_TOF_C",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetC,rotMatNum);
     node->SetLineColor(kColorTOF);
-    fNodes->Add(node); 
+    fNodes->Add(node);
     
-    top->cd(); 
+    top->cd();
     node = new TNode(nodeName1,nodeName1,"S_TOF_C",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),-zOffsetC,rotMatNum);
     node->SetLineColor(kColorTOF);
-    fNodes->Add(node); 
+    fNodes->Add(node);
     if (nodeNum !=1 && nodeNum!=17 && nodeNum !=18)
       {
        top->cd();
        node = new TNode(nodeName2,nodeName2,"S_TOF_B",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetB,rotMatNum);
        node->SetLineColor(kColorTOF);
-       fNodes->Add(node); 
+       fNodes->Add(node);
        
        top->cd();
        node = new TNode(nodeName3,nodeName3,"S_TOF_B",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),-zOffsetB,rotMatNum);
        node->SetLineColor(kColorTOF);
-       fNodes->Add(node); 
+       fNodes->Add(node);
       } // Holes for RICH detector
     
     if (nodeNum !=1 && nodeNum !=17 && nodeNum !=18)
@@ -175,7 +176,7 @@ void AliTOFv3::BuildGeometry()
        top->cd();
        node = new TNode(nodeName4,nodeName4,"S_TOF_A",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetA,rotMatNum);
        node->SetLineColor(kColorTOF);
-       fNodes->Add(node); 
+       fNodes->Add(node);
       } // Holes for RICH detector, central part
   }
 }
@@ -317,7 +318,7 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   Float_t stripWidth = zSenStrip + 2*kdeadBound;
   
   par[0] = xFLT*0.5;
-  par[1] = yPad*0.5; 
+  par[1] = yPad*0.5;
   par[2] = stripWidth*0.5;
   
   // new description for strip volume -double stack strip-
@@ -344,7 +345,7 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   Float_t parfp[3]={klstripx*0.5,khstripy*0.5,kwstripz*0.5};
   // coordinates of the strip center in the strip reference frame; used for positioning
   // internal strip volumes
-  Float_t posfp[3]={0.,0.,0.};   
+  Float_t posfp[3]={0.,0.,0.};  
   
   
   // FSTR volume definition and filling this volume with non sensitive Gas Mixture
@@ -376,7 +377,7 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   parfp[1] = khmyly*0.5;
   gMC->Gsvolu("FMYL","BOX",idtmed[511],parfp,3);
   // positioning 2 MYLAR Layers on FSTR volume
-  posfp[1] = -khstripy*0.5+khhony+khpcby+parfp[1]; 
+  posfp[1] = -khstripy*0.5+khhony+khpcby+parfp[1];
   gMC->Gspos("FMYL",1,"FSTR",0., posfp[1],0.,0,"ONLY");
   gMC->Gspos("FMYL",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
   // adding further 2 MYLAR Layers on FSTR volume
@@ -429,7 +430,7 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   gMC->Gsdvn("FSEX","FSEZ",knx,1);
   
   // FPAD volume definition
-  parfp[0] = klpadx*0.5;    
+  parfp[0] = klpadx*0.5;   
   parfp[1] = khsensmy*0.5;
   parfp[2] = kwpadz*0.5;
   gMC->Gsvolu("FPAD","BOX",idtmed[513],parfp,3);
@@ -445,36 +446,42 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   Float_t gap  = fGapA+0.5; //cm  updated distance between the strip axis
   Float_t zpos = 0;
   Float_t ang  = 0;
-  Int_t i=1,j=1;
+  Int_t j=1; // AdC
   nrot  = 0;
   zcoor = 0;
   ycoor = -14.5 + kspace ; //2 cm over front plate
 
-  AliMatrix (idrotm[0],  90.,  0.,90.,90.,0., 90.);   
-  gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
+  AliMatrix (idrotm[0],  90.,  0.,90.,90.,0., 90.);  
+
+  Int_t centerLoc= (Int_t)(fNStripA/2.) + 1; // AdC
+
+  //gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
+  gMC->Gspos("FSTR",centerLoc,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY"); // AdC
   if(fDebug>=1) {
-    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i);
+    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
   }
   zcoor -= zSenStrip;
-  j++;
+  //j++; // AdC
   Int_t upDown = -1; // upDown=-1 -> Upper strip
-  // upDown=+1 -> Lower strip
+                     // upDown=+1 -> Lower strip
   do{
     ang = atan(zcoor/radius);
     ang *= kRaddeg;
-    AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
+    AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);  
     AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
     ang /= kRaddeg;
     ycoor = -14.5+ kspace; //2 cm over front plate
     ycoor += (1-(upDown+1)/2)*gap;
-    gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
-    gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+    //gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+    //gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+    gMC->Gspos("FSTR",centerLoc-j,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY"); // AdC
+    gMC->Gspos("FSTR",centerLoc+j,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); // AdC
     if(fDebug>=1) {
-      printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i);
+      printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
       printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
     }
-    j += 2;
+    j++; //j += 2; // AdC
     upDown*= -1; // Alternate strips 
     zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
       upDown*gap*TMath::Tan(ang)-
@@ -492,24 +499,26 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   
   ang = atan(zcoor/radius);
   ang *= kRaddeg;
-  AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
+  AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);  
   AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
   ang /= kRaddeg;
   
   ycoor = -14.5+ kspace; //2 cm over front plate
   ycoor += (1-(upDown+1)/2)*gap;
-  gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
-  gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+  //gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+  //gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+  gMC->Gspos("FSTR",centerLoc-j,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY"); // AdC
+  gMC->Gspos("FSTR",centerLoc+j,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); // AdC
   if(fDebug>=1) {   
-    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i);  
-    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);  
+    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
+    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos); 
   }
   ycoor = -hTof/2.+ kspace;//2 cm over front plate
   
   // Plate  B
   
   nrot = 0;
-  i=1;
+  Int_t i=1; // AdC
   upDown = 1;
   Float_t deadRegion = 1.0;//cm
   
@@ -527,8 +536,8 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
   gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
   if(fDebug>=1) {   
-    printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i);  
-    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);  
+    printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); 
+    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
    }
   i++;
   upDown*=-1;
@@ -699,8 +708,8 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   for (icard=0; icard<19; ++icard) {
     cardpos[2]= cardpos[2]+stepforcardB;
     aplpos2 = cardpos[2]+0.15;  
-    gMC->Gspos("FCAR",icard,"FAIB",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY"); 
-    gMC->Gspos("FALP",icard,"FAIB",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY"); 
+    gMC->Gspos("FCAR",icard,"FAIB",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY");
+    gMC->Gspos("FALP",icard,"FAIB",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY");
   }
   
   
@@ -710,7 +719,7 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   for (icard=0; icard<20; ++icard) {
     cardpos[2]= cardpos[2]+stepforcardC;
     aplpos2 = cardpos[2]+0.15;
-    gMC->Gspos("FCAR",icard,"FAIC",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY"); 
+    gMC->Gspos("FCAR",icard,"FAIC",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY");
     gMC->Gspos("FALP",icard,"FAIC",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY");
   }
   
@@ -1057,10 +1066,10 @@ void AliTOFv3::StepManager()
     // getting information about hit volumes
     
     padzid=gMC->CurrentVolOffID(2,copy);
-    padz=copy;  
+    padz=copy;
     
     padxid=gMC->CurrentVolOffID(1,copy);
-    padx=copy;  
+    padx=copy;
     
     stripid=gMC->CurrentVolOffID(4,copy);
     strip=copy;  
@@ -1087,19 +1096,30 @@ void AliTOFv3::StepManager()
 
     z = pos[2];
 
-    plate = 0;   
-    if (TMath::Abs(z) <=  fZlenA*0.5)  plate = 3;
+    plate = 0;
+    if (TMath::Abs(z) <=  fZlenA*0.5)  plate = 2; //3; // AdC
     if (z < (fZlenA*0.5+fZlenB) && 
-        z >  fZlenA*0.5)               plate = 4;
+        z >  fZlenA*0.5)               plate = 1; //4; // AdC
     if (z >-(fZlenA*0.5+fZlenB) &&
-        z < -fZlenA*0.5)               plate = 2;
-    if (z > (fZlenA*0.5+fZlenB))       plate = 5;
-    if (z <-(fZlenA*0.5+fZlenB))       plate = 1;
+        z < -fZlenA*0.5)               plate = 3; //2; // AdC
+    if (z > (fZlenA*0.5+fZlenB))       plate = 0; //5; // AdC
+    if (z <-(fZlenA*0.5+fZlenB))       plate = 4; //1; // AdC
+
+    if (plate==0) strip=AliTOFConstants::fgkNStripC-strip; // AdC
+    else if (plate==1) strip=AliTOFConstants::fgkNStripB-strip; // AdC
+    else strip--; // AdC
+
+    if (z<=0.) padx=AliTOFConstants::fgkNpadX-padx; // AdC
+    else padx--; // AdC
+
+    if (plate==3 || plate==4) padz=AliTOFConstants::fgkNpadZ-padz; // AdC
+    else padz--; // AdC
 
     phi = pos.Phi();
-    phid = phi*kRaddeg+180.;
+    if (phi>=0.) phid = phi*kRaddeg; //+180.; // AdC
+    else phid = phi*kRaddeg + 360.; // AdC
     sector = Int_t (phid/20.);
-    sector++;
+    //sector++; // AdC
 
     for(i=0;i<3;++i) {
       hits[i]   = pos[i];
index a5aeb10..1bafa73 100644 (file)
 /* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
-//
+//                                                                           //
 //  This class contains the functions for version 4 of the Time Of Flight    //
 //  detector.                                                                //
-//
-//  VERSION WITH 5 MODULES AND TILTED STRIPS
-//                                                                             
-//   FULL COVERAGE VERSION
-//
-//   Authors:
-//  
-//   Alessio Seganti
-//   Domenico Vicinanza
-//                                                                             
-//   University of Salerno - Italy
-//
-//   Fabrizio Pierella
-//   University of Bologna - Italy
-//
-//   
-//Begin_Html                                                                   
-/*
-<img src="picts/AliTOFv4Class.gif">
-*/
-//End_Html
+//                                                                           //
+//  VERSION WITH 5 MODULES AND TILTED STRIPS                                 //
+//                                                                           //
+//   FULL COVERAGE VERSION                                                   //
+//                                                                           //
+//                                                                           //
+//   Authors:                                                                //
+//                                                                           //
+//   Alessio Seganti                                                         //
+//   Domenico Vicinanza                                                      //
+//                                                                           //
+//   University of Salerno - Italy                                           //
+//                                                                           //
+//   Fabrizio Pierella                                                       //
+//   University of Bologna - Italy                                           //
+//                                                                           //
+//                                                                           //
+//Begin_Html                                                                 //
+/*                                                                           //
+<img src="picts/AliTOFv4Class.gif">                                          //
+*/                                                                           //
+//End_Html                                                                   //
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -56,6 +57,7 @@
 #include "AliConst.h"
 #include "AliRun.h"
 #include "AliTOFv4.h"
+#include "AliTOFConstants.h" // AdC
  
 ClassImp(AliTOFv4)
  
@@ -116,7 +118,7 @@ void AliTOFv4::BuildGeometry()
   Float_t zOffsetA = 0.;
   // Define TOF basic volume
   
-  char nodeName0[7], nodeName1[7], nodeName2[7]; 
+  char nodeName0[7], nodeName1[7], nodeName2[7];
   char nodeName3[7], nodeName4[7], rotMatNum[7];
   
   new TBRIK("S_TOF_C","TOF box","void",
@@ -151,27 +153,27 @@ void AliTOFv4::BuildGeometry()
     top->cd();
     node = new TNode(nodeName0,nodeName0,"S_TOF_C",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetC,rotMatNum);
     node->SetLineColor(kColorTOF);
-    fNodes->Add(node); 
+    fNodes->Add(node);
     
-    top->cd(); 
+    top->cd();
     node = new TNode(nodeName1,nodeName1,"S_TOF_C",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),-zOffsetC,rotMatNum);
     node->SetLineColor(kColorTOF);
-    fNodes->Add(node); 
+    fNodes->Add(node);
     
     top->cd();
     node = new TNode(nodeName2,nodeName2,"S_TOF_B",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetB,rotMatNum);
     node->SetLineColor(kColorTOF);
-    fNodes->Add(node); 
+    fNodes->Add(node);
     
     top->cd();
     node = new TNode(nodeName3,nodeName3,"S_TOF_B",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),-zOffsetB,rotMatNum);
     node->SetLineColor(kColorTOF);
-    fNodes->Add(node); 
+    fNodes->Add(node);
     
     top->cd();
     node = new TNode(nodeName4,nodeName4,"S_TOF_A",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetA,rotMatNum);
     node->SetLineColor(kColorTOF);
-    fNodes->Add(node); 
+    fNodes->Add(node);
   } // end loop on nodeNum
 }
 
@@ -315,7 +317,7 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   Float_t stripWidth = zSenStrip + 2*kdeadBound;
   
   par[0] = xFLT*0.5;
-  par[1] = yPad*0.5; 
+  par[1] = yPad*0.5;
   par[2] = stripWidth*0.5;
   
   // new description for strip volume -double stack strip-
@@ -342,7 +344,7 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   Float_t parfp[3]={klstripx*0.5,khstripy*0.5,kwstripz*0.5};
   // coordinates of the strip center in the strip reference frame; used for positioning
   // internal strip volumes
-  Float_t posfp[3]={0.,0.,0.};   
+  Float_t posfp[3]={0.,0.,0.};  
   
   
   // FSTR volume definition and filling this volume with non sensitive Gas Mixture
@@ -374,7 +376,7 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   parfp[1] = khmyly*0.5;
   gMC->Gsvolu("FMYL","BOX",idtmed[511],parfp,3);
   // positioning 2 MYLAR Layers on FSTR volume
-  posfp[1] = -khstripy*0.5+khhony+khpcby+parfp[1]; 
+  posfp[1] = -khstripy*0.5+khhony+khpcby+parfp[1];
   gMC->Gspos("FMYL",1,"FSTR",0., posfp[1],0.,0,"ONLY");
   gMC->Gspos("FMYL",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
   // adding further 2 MYLAR Layers on FSTR volume
@@ -427,7 +429,7 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   gMC->Gsdvn("FSEX","FSEZ",knx,1);
   
   // FPAD volume definition
-  parfp[0] = klpadx*0.5;    
+  parfp[0] = klpadx*0.5;   
   parfp[1] = khsensmy*0.5;
   parfp[2] = kwpadz*0.5;
   gMC->Gsvolu("FPAD","BOX",idtmed[513],parfp,3);
@@ -443,36 +445,42 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   Float_t gap  = fGapA+0.5; //cm  updated distance between the strip axis
   Float_t zpos = 0;
   Float_t ang  = 0;
-  Int_t i=1,j=1;
+  Int_t j=1; // AdC
   nrot  = 0;
   zcoor = 0;
   ycoor = -14.5 + kspace ; //2 cm over front plate
 
-  AliMatrix (idrotm[0],  90.,  0.,90.,90.,0., 90.);   
-  gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
+  AliMatrix (idrotm[0],  90.,  0.,90.,90.,0., 90.);  
+
+  Int_t centerLoc= (Int_t)(fNStripA/2.) + 1; // AdC
+
+  //gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
+  gMC->Gspos("FSTR",centerLoc,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY"); // AdC
   if(fDebug>=1) {
-     printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i);
-     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
+    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
   }
   zcoor -= zSenStrip;
-  j++;
+  //j++; // AdC
   Int_t upDown = -1; // upDown=-1 -> Upper strip
                      // upDown=+1 -> Lower strip
   do{
      ang = atan(zcoor/radius);
      ang *= kRaddeg;
-     AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
+     AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);  
      AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
      ang /= kRaddeg;
      ycoor = -14.5+ kspace; //2 cm over front plate
      ycoor += (1-(upDown+1)/2)*gap;
-     gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
-     gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+     //gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+     //gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+     gMC->Gspos("FSTR",centerLoc-j,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY"); // AdC
+     gMC->Gspos("FSTR",centerLoc+j,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); // AdC
      if(fDebug>=1) {
-       printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i);
+       printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
        printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
      }
-     j += 2;
+     j++; //j += 2; // AdC
      upDown*= -1; // Alternate strips 
      zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
              upDown*gap*TMath::Tan(ang)-
@@ -490,24 +498,26 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
 
   ang = atan(zcoor/radius);
   ang *= kRaddeg;
-  AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
+  AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);  
   AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
   ang /= kRaddeg;
          
   ycoor = -14.5+ kspace; //2 cm over front plate
   ycoor += (1-(upDown+1)/2)*gap;
-  gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
-  gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+  //gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+  //gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+  gMC->Gspos("FSTR",centerLoc-j,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY"); // AdC
+  gMC->Gspos("FSTR",centerLoc+j,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); // AdC
   if(fDebug>=1) {   
-     printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i);  
-     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);  
+    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
+    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
   }   
   ycoor = -hTof/2.+ kspace;//2 cm over front plate
 
   // Plate  B
 
   nrot = 0;
-  i=1;
+  Int_t i=1; // AdC
   upDown = 1;
   Float_t deadRegion = 1.0;//cm
   
@@ -525,8 +535,8 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
   gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
   if(fDebug>=1) {   
-     printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i);  
-     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);  
+     printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); 
+     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
   }   
   i++;
   upDown*=-1;
@@ -685,7 +695,7 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   for (icard=0; icard<15; ++icard) {
     cardpos[2]= cardpos[2]+stepforcardA;
     aplpos2 = cardpos[2]+0.15;
-    gMC->Gspos("FCAR",icard,"FAIA",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY"); 
+    gMC->Gspos("FCAR",icard,"FAIA",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY");
     gMC->Gspos("FALP",icard,"FAIA",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY");
     
   }
@@ -696,9 +706,9 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   cardpos[2]= -70.5;
   for (icard=0; icard<19; ++icard) {
     cardpos[2]= cardpos[2]+stepforcardB;
-    aplpos2 = cardpos[2]+0.15;  
-    gMC->Gspos("FCAR",icard,"FAIB",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY"); 
-    gMC->Gspos("FALP",icard,"FAIB",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY"); 
+    aplpos2 = cardpos[2]+0.15; 
+    gMC->Gspos("FCAR",icard,"FAIB",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY");
+    gMC->Gspos("FALP",icard,"FAIB",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY");
   }
   
   
@@ -708,7 +718,7 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   for (icard=0; icard<20; ++icard) {
     cardpos[2]= cardpos[2]+stepforcardC;
     aplpos2 = cardpos[2]+0.15;
-    gMC->Gspos("FCAR",icard,"FAIC",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY"); 
+    gMC->Gspos("FCAR",icard,"FAIC",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY");
     gMC->Gspos("FALP",icard,"FAIC",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY");
   }
   
@@ -1056,13 +1066,13 @@ void AliTOFv4::StepManager()
     // getting information about hit volumes
     
     padzid=gMC->CurrentVolOffID(2,copy);
-    padz=copy;  
+    padz=copy; 
     
     padxid=gMC->CurrentVolOffID(1,copy);
-    padx=copy;  
+    padx=copy; 
     
     stripid=gMC->CurrentVolOffID(4,copy);
-    strip=copy;  
+    strip=copy; 
 
     gMC->TrackPosition(pos);
     gMC->TrackMomentum(mom);
@@ -1086,19 +1096,30 @@ void AliTOFv4::StepManager()
 
     z = pos[2];
 
-    plate = 0;   
-    if (TMath::Abs(z) <=  fZlenA*0.5)  plate = 3;
+    plate = 0;  
+    if (TMath::Abs(z) <=  fZlenA*0.5)  plate = 2; //3; // AdC
     if (z < (fZlenA*0.5+fZlenB) && 
-        z >  fZlenA*0.5)               plate = 4;
+        z >  fZlenA*0.5)               plate = 1; //4; // AdC
     if (z >-(fZlenA*0.5+fZlenB) &&
-        z < -fZlenA*0.5)               plate = 2;
-    if (z > (fZlenA*0.5+fZlenB))       plate = 5;
-    if (z <-(fZlenA*0.5+fZlenB))       plate = 1;
+        z < -fZlenA*0.5)               plate = 3; //2; // AdC
+    if (z > (fZlenA*0.5+fZlenB))       plate = 0; //5; // AdC
+    if (z <-(fZlenA*0.5+fZlenB))       plate = 4; //1; // AdC
+
+    if (plate==0) strip=AliTOFConstants::fgkNStripC-strip; // AdC
+    else if (plate==1) strip=AliTOFConstants::fgkNStripB-strip; // AdC
+    else strip--; // AdC
+
+    if (z<=0.) padx=AliTOFConstants::fgkNpadX-padx; // AdC
+    else padx--; // AdC
+
+    if (plate==3 || plate==4) padz=AliTOFConstants::fgkNpadZ-padz; // AdC
+    else padz--; // AdC
 
     phi = pos.Phi();
-    phid = phi*kRaddeg+180.;
-    sector = Int_t (phid/20.);
-    sector++;
+    if (phi>=0.) phid = phi*kRaddeg; //+180.; // AdC
+    else phid = phi*kRaddeg + 360.; // AdC
+    sector = Int_t (phid/20.); // AdC
+    //sector++; // AdC
 
     for(i=0;i<3;++i) {
       hits[i]   = pos[i];
index d7f1e79..eb2927e 100644 (file)
 /* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
-//
+//                                                                           //
 //  This class contains the functions for version 4 of the Time Of Flight    //
 //  detector.                                                                //
-//
-//  VERSION WITH 5 MODULES AND TILTED STRIPS
-//                                                                             
-//   FULL COVERAGE VERSION
-//
-//   Author:
-//   Fabrizio Pierella
-//   University of Bologna - Italy
-//
-//   
-//Begin_Html                                                                   
-/*
-<img src="picts/AliTOFv4T0Class.gif">
-*/
-//End_Html
+//                                                                           //
+//  VERSION WITH 5 MODULES AND TILTED STRIPS                                 //
+//                                                                           //
+//   FULL COVERAGE VERSION                                                   //
+//                                                                           //
+//   Author:                                                                 //
+//   Fabrizio Pierella                                                       //
+//   University of Bologna - Italy                                           //
+//                                                                           //
+//                                                                           //
+//Begin_Html                                                                 //
+/*                                                                           //
+<img src="picts/AliTOFv4T0Class.gif">                                        //
+*/                                                                           //
+//End_Html                                                                   //
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -51,6 +51,7 @@
 #include "AliConst.h"
 #include "AliRun.h"
 #include "AliTOFv4T0.h"
+#include "AliTOFConstants.h" // AdC
  
 ClassImp(AliTOFv4T0)
  
@@ -111,7 +112,7 @@ void AliTOFv4T0::BuildGeometry()
   Float_t zOffsetA = 0.;
   // Define TOF basic volume
   
-  char nodeName0[7], nodeName1[7], nodeName2[7]; 
+  char nodeName0[7], nodeName1[7], nodeName2[7];
   char nodeName3[7], nodeName4[7], rotMatNum[7];
   
   new TBRIK("S_TOF_C","TOF box","void",
@@ -146,27 +147,27 @@ void AliTOFv4T0::BuildGeometry()
     top->cd();
     node = new TNode(nodeName0,nodeName0,"S_TOF_C",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetC,rotMatNum);
     node->SetLineColor(kColorTOF);
-    fNodes->Add(node); 
+    fNodes->Add(node);
     
-    top->cd(); 
+    top->cd();
     node = new TNode(nodeName1,nodeName1,"S_TOF_C",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),-zOffsetC,rotMatNum);
     node->SetLineColor(kColorTOF);
-    fNodes->Add(node); 
+    fNodes->Add(node);
     
     top->cd();
     node = new TNode(nodeName2,nodeName2,"S_TOF_B",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetB,rotMatNum);
     node->SetLineColor(kColorTOF);
-    fNodes->Add(node); 
+    fNodes->Add(node);
     
     top->cd();
     node = new TNode(nodeName3,nodeName3,"S_TOF_B",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),-zOffsetB,rotMatNum);
     node->SetLineColor(kColorTOF);
-    fNodes->Add(node); 
+    fNodes->Add(node);
     
     top->cd();
     node = new TNode(nodeName4,nodeName4,"S_TOF_A",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetA,rotMatNum);
     node->SetLineColor(kColorTOF);
-    fNodes->Add(node); 
+    fNodes->Add(node);
   } // end loop on nodeNum
 }
 
@@ -310,7 +311,7 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   Float_t stripWidth = zSenStrip + 2*kdeadBound;
   
   par[0] = xFLT*0.5;
-  par[1] = yPad*0.5; 
+  par[1] = yPad*0.5;
   par[2] = stripWidth*0.5;
   
   // new description for strip volume -double stack strip-
@@ -337,7 +338,7 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   Float_t parfp[3]={klstripx*0.5,khstripy*0.5,kwstripz*0.5};
   // coordinates of the strip center in the strip reference frame; used for positioning
   // internal strip volumes
-  Float_t posfp[3]={0.,0.,0.};   
+  Float_t posfp[3]={0.,0.,0.};  
   
   
   // FSTR volume definition and filling this volume with non sensitive Gas Mixture
@@ -369,7 +370,7 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   parfp[1] = khmyly*0.5;
   gMC->Gsvolu("FMYL","BOX",idtmed[511],parfp,3);
   // positioning 2 MYLAR Layers on FSTR volume
-  posfp[1] = -khstripy*0.5+khhony+khpcby+parfp[1]; 
+  posfp[1] = -khstripy*0.5+khhony+khpcby+parfp[1];
   gMC->Gspos("FMYL",1,"FSTR",0., posfp[1],0.,0,"ONLY");
   gMC->Gspos("FMYL",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
   // adding further 2 MYLAR Layers on FSTR volume
@@ -422,7 +423,7 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   gMC->Gsdvn("FSEX","FSEZ",knx,1);
   
   // FPAD volume definition
-  parfp[0] = klpadx*0.5;    
+  parfp[0] = klpadx*0.5;   
   parfp[1] = khsensmy*0.5;
   parfp[2] = kwpadz*0.5;
   gMC->Gsvolu("FPAD","BOX",idtmed[513],parfp,3);
@@ -438,36 +439,42 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   Float_t gap  = fGapA+0.5; //cm  updated distance between the strip axis
   Float_t zpos = 0;
   Float_t ang  = 0;
-  Int_t i=1,j=1;
+  Int_t j=1; // AdC
   nrot  = 0;
   zcoor = 0;
   ycoor = -14.5 + kspace ; //2 cm over front plate
   
-  AliMatrix (idrotm[0],  90.,  0.,90.,90.,0., 90.);   
-  gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
+  AliMatrix (idrotm[0],  90.,  0.,90.,90.,0., 90.);  
+
+  Int_t centerLoc= (Int_t)(fNStripA/2.) + 1; // AdC
+
+  //gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
+  gMC->Gspos("FSTR",centerLoc,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY"); // AdC
   if(fDebug>=1) {
-    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i);
+    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
   }
   zcoor -= zSenStrip;
-  j++;
+  //j++; // AdC
   Int_t upDown = -1; // upDown=-1 -> Upper strip
-  // upDown=+1 -> Lower strip
+                     // upDown=+1 -> Lower strip
   do{
     ang = atan(zcoor/radius);
     ang *= kRaddeg;
-    AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
+    AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);  
     AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
     ang /= kRaddeg;
     ycoor = -14.5+ kspace; //2 cm over front plate
     ycoor += (1-(upDown+1)/2)*gap;
-    gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
-    gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+    //gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+    //gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+    gMC->Gspos("FSTR",centerLoc-j,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY"); // AdC
+    gMC->Gspos("FSTR",centerLoc+j,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); // AdC
     if(fDebug>=1) {
-      printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i);
+      printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
       printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
     }
-    j += 2;
+    j++; //j += 2; // AdC
     upDown*= -1; // Alternate strips 
     zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
       upDown*gap*TMath::Tan(ang)-
@@ -485,24 +492,26 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   
   ang = atan(zcoor/radius);
   ang *= kRaddeg;
-  AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
+  AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);  
   AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
   ang /= kRaddeg;
   
   ycoor = -14.5+ kspace; //2 cm over front plate
   ycoor += (1-(upDown+1)/2)*gap;
-  gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
-  gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
-  if(fDebug>=1) {   
-    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i);  
-    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);  
-  }   
+  //gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
+  //gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
+  gMC->Gspos("FSTR",centerLoc-j,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY"); // AdC
+  gMC->Gspos("FSTR",centerLoc+j,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); // AdC
+  if(fDebug>=1) {
+    printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
+    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
+  }
   ycoor = -hTof/2.+ kspace;//2 cm over front plate
   
   // Plate  B
   
   nrot = 0;
-  i=1;
+  Int_t i=1; // AdC
   upDown = 1;
   Float_t deadRegion = 1.0;//cm
   
@@ -520,8 +529,8 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
   gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
   if(fDebug>=1) {   
-    printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i);  
-    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);  
+    printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); 
+    printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos); 
   }   
   i++;
   upDown*=-1;
@@ -680,7 +689,7 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   for (icard=0; icard<15; ++icard) {
     cardpos[2]= cardpos[2]+stepforcardA;
     aplpos2 = cardpos[2]+0.15;
-    gMC->Gspos("FCAR",icard,"FAIA",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY"); 
+    gMC->Gspos("FCAR",icard,"FAIA",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY");
     gMC->Gspos("FALP",icard,"FAIA",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY");
     
   }
@@ -691,9 +700,9 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   cardpos[2]= -70.5;
   for (icard=0; icard<19; ++icard) {
     cardpos[2]= cardpos[2]+stepforcardB;
-    aplpos2 = cardpos[2]+0.15;  
-    gMC->Gspos("FCAR",icard,"FAIB",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY"); 
-    gMC->Gspos("FALP",icard,"FAIB",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY"); 
+    aplpos2 = cardpos[2]+0.15; 
+    gMC->Gspos("FCAR",icard,"FAIB",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY");
+    gMC->Gspos("FALP",icard,"FAIB",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY");
   }
   
   
@@ -703,7 +712,7 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   for (icard=0; icard<20; ++icard) {
     cardpos[2]= cardpos[2]+stepforcardC;
     aplpos2 = cardpos[2]+0.15;
-    gMC->Gspos("FCAR",icard,"FAIC",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY"); 
+    gMC->Gspos("FCAR",icard,"FAIC",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY");
     gMC->Gspos("FALP",icard,"FAIC",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY");
   }
   
@@ -1051,13 +1060,13 @@ void AliTOFv4T0::StepManager()
     // getting information about hit volumes
     
     padzid=gMC->CurrentVolOffID(2,copy);
-    padz=copy;  
+    padz=copy; 
     
     padxid=gMC->CurrentVolOffID(1,copy);
-    padx=copy;  
+    padx=copy; 
     
     stripid=gMC->CurrentVolOffID(4,copy);
-    strip=copy;  
+    strip=copy; 
 
     gMC->TrackPosition(pos);
     gMC->TrackMomentum(mom);
@@ -1081,19 +1090,30 @@ void AliTOFv4T0::StepManager()
 
     z = pos[2];
 
-    plate = 0;   
-    if (TMath::Abs(z) <=  fZlenA*0.5)  plate = 3;
+    plate = 0;  
+    if (TMath::Abs(z) <=  fZlenA*0.5)  plate = 2; //3; // AdC
     if (z < (fZlenA*0.5+fZlenB) && 
-        z >  fZlenA*0.5)               plate = 4;
+        z >  fZlenA*0.5)               plate = 1; //4; // AdC
     if (z >-(fZlenA*0.5+fZlenB) &&
-        z < -fZlenA*0.5)               plate = 2;
-    if (z > (fZlenA*0.5+fZlenB))       plate = 5;
-    if (z <-(fZlenA*0.5+fZlenB))       plate = 1;
+        z < -fZlenA*0.5)               plate = 3; //2; // AdC
+    if (z > (fZlenA*0.5+fZlenB))       plate = 0; //5; // AdC
+    if (z <-(fZlenA*0.5+fZlenB))       plate = 4; //1; // AdC
+
+    if (plate==0) strip=AliTOFConstants::fgkNStripC-strip; // AdC
+    else if (plate==1) strip=AliTOFConstants::fgkNStripB-strip; // AdC
+    else strip--; // AdC
+
+    if (z<=0.) padx=AliTOFConstants::fgkNpadX-padx; // AdC
+    else padx--; // AdC
+
+    if (plate==3 || plate==4) padz=AliTOFConstants::fgkNpadZ-padz; // AdC
+    else padz--; // AdC
 
     phi = pos.Phi();
-    phid = phi*kRaddeg+180.;
+    if (phi>=0.) phid = phi*kRaddeg; //+180.; // AdC
+    else phid = phi*kRaddeg + 360.; // AdC
     sector = Int_t (phid/20.);
-    sector++;
+    //sector++; // AdC
 
     for(i=0;i<3;++i) {
       hits[i]   = pos[i];