]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
TOF raw data: preliminary implementation and style changes
authordecaro <decaro@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 Jun 2004 15:27:59 +0000 (15:27 +0000)
committerdecaro <decaro@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 Jun 2004 15:27:59 +0000 (15:27 +0000)
14 files changed:
TOF/AliTOF.cxx
TOF/AliTOF.h
TOF/AliTOFDDLRawData.cxx [new file with mode: 0644]
TOF/AliTOFDDLRawData.h [new file with mode: 0644]
TOF/AliTOFDigitizer.cxx
TOF/AliTOFGeometry.cxx
TOF/AliTOFGeometry.h
TOF/AliTOFSDigit.cxx
TOF/AliTOFSDigitizer.cxx
TOF/AliTOFSDigitizer.h
TOF/AliTOFdigit.cxx
TOF/AliTOFv4T0.cxx
TOF/TOFLinkDef.h
TOF/libTOF.pkg

index 7ef0943d2e5dd8ec27caa7b554921627ce6818fb..0d79f5f4e06c31d3c81e08e3091576b7a70c06d1 100644 (file)
 #include <TTree.h>
 #include <TVirtualMC.h>
 
+#include "AliConfig.h"
+#include "AliHeader.h"
 #include "AliConst.h"
 #include "AliLoader.h"
 #include "AliMagF.h"
 #include "AliRun.h"
 #include "AliTOF.h"
-#include "AliTOFRawDigit.h"
-#include "AliTOFRawSector.h"
-#include "AliTOFRoc.h"
+#include "AliTOFGeometry.h"
 #include "AliTOFSDigit.h"
 #include "AliTOFdigit.h"
 #include "AliTOFhit.h"
 #include "AliTOFhitT0.h"
 #include "AliMC.h"
 #include "AliTOFDigitizer.h"
+#include "AliTOFDDLRawData.h"
  
 ClassImp(AliTOF)
  
@@ -80,17 +81,17 @@ AliTOF::AliTOF()
   //
   // Default constructor
   //
-  fFGeom = 0x0;
-  fDTask = 0x0;
+  fFGeom  = 0x0;
+  fDTask  = 0x0;
   fReTask = 0x0;
   fIshunt   = 0;
-  fSDigits       = 0 ;
+  fSDigits  = 0 ;
   fNSDigits = 0;
-  fDigits        = 0 ;
+  fDigits   = 0 ;
   fReconParticles = 0x0;
   fName="TOF";
   fMerger = 0x0;
-  fTZero = kFALSE;
+  fTZero  = kFALSE;
   fTOFGeometry = 0;
 }
  
@@ -106,9 +107,9 @@ AliTOF::AliTOF(const char *name, const char *title, Option_t *option)
 
   // Initialization of hits, sdigits and digits array
   // added option for time zero analysis
-  fFGeom = 0x0; //skowron
-  fDTask = 0x0;
-  fReTask= 0x0;
+  fFGeom  = 0x0; //skowron
+  fDTask  = 0x0;
+  fReTask = 0x0;
   fReconParticles= 0x0;
   fMerger = 0x0;
   fTOFGeometry = 0;
@@ -129,8 +130,8 @@ AliTOF::AliTOF(const char *name, const char *title, Option_t *option)
   else Error("AliTOF","gAlice->GetHitLists()==0");
 
   fIshunt  = 0;
-  fSDigits       = new TClonesArray("AliTOFSDigit",  1000);
-  fDigits        = new TClonesArray("AliTOFdigit",  1000);
+  fSDigits = new TClonesArray("AliTOFSDigit", 1000);
+  fDigits  = new TClonesArray("AliTOFdigit",  1000);
   fNSDigits = 0;
 
   fFGeom = 0x0;
@@ -148,47 +149,14 @@ AliTOF::AliTOF(const char *name, const char *title, Option_t *option)
   SetMarkerStyle(2);
   SetMarkerSize(0.4);
 
-// General Geometrical Parameters
-  fNTof    =  18;  // number of sectors
-  fRmax    = 399.0;//cm 
-  fRmin    = 370.0;//cm
-  fZlenC   = 177.5;//cm length of module C
-  fZlenB   = 141.0;//cm length of module B
-  fZlenA   = 106.0;//cm length of module A
-  fZtof    = 371.5;//cm total semi-length of TOF detector
-
 // Strip Parameters
-  fStripLn = 122.0;//cm  Strip Length
-  fSpace   =   5.5;//cm  Space Beetween the strip and the bottom of the plate 
-  fDeadBndZ=   1.5;//cm  Dead Boundaries of a Strip along Z direction (width)
-  fDeadBndX=   1.0;//cm  Dead Boundaries of a Strip along X direction (length)
-  fXpad    =   2.5;//cm  X size of a pad
-  fZpad    =   3.5;//cm  Z size of a pad
-  fGapA    =   4.; //cm  Gap beetween tilted strip in A-type plate
-  fGapB    =   6.; //cm  Gap beetween tilted strip in B-type plate
-  fOverSpc =  15.3;//cm Space available for sensitive layers in radial direction
-  fNpadX   =  48;  // Number of pads in a strip along the X direction
-  fNpadZ   =   2;  // Number of pads in a strip along the Z direction
-  fPadXStr = fNpadX*fNpadZ; //Number of pads per strip
-  fNStripA = 15; // number of strips in A type module 
-  fNStripB = 19; // number of strips in B type module
-  fNStripC = 20; // number of strips in C type module
-// Physical performances
-  fTimeRes = 100.;//ps
-  fChrgRes = 100.;//pC
-
-// DAQ characteristics
-// cfr. TOF-TDR pag. 105 for Glossary
-// TARODA : TOF-ALICE Read Out and Data Acquisition system
-  fPadXSector = 8928; // number of pad per sector -with no holes-
-                      // ((15+2*19+2*20)*(48*2))
-  fNRoc       = 14;   // number of Roc (Read Out Controller) (TARODA)
-  fNFec       = 32;   // number of Fec (Front-End electronic Card)
-                      // (TARODA)
-  fNTdc       = 32;   // number of Tdc (Time to Digital Converter)
-  fNPadXRoc   = (Int_t)fPadXSector/fNRoc; // number of pads for each ROC
-  
+  //fGapA    =   4.; //cm  Gap beetween tilted strip in A-type plate
+  //fGapB    =   6.; //cm  Gap beetween tilted strip in B-type plate
+
+  // Physical performances
+  //fTimeRes = 100.;//ps
+  //fChrgRes = 100.;//pC
+
 }
 
 //_____________________________________________________________________________
@@ -388,11 +356,12 @@ void AliTOF::CreateGeometry()
   wall = 4.;//cm
 
   // Sizes of TOF module with its support etc..
-  xTof = 2.*(fRmin*TMath::Tan(10*kDegrad)-wall/2-.5);
-  yTof = fRmax-fRmin;
+  xTof = 2.*(AliTOFGeometry::Rmin()*TMath::Tan(10*kDegrad)-wall/2-.5);
+  yTof = AliTOFGeometry::Rmax()-AliTOFGeometry::Rmin();
 
 //  TOF module internal definitions 
-  TOFpc(xTof, yTof, fZlenC, fZlenB, fZlenA, fZtof);
+  //TOFpc(xTof, yTof, fZlenC, fZlenB, fZlenA, AliTOFGeometry::MaxhZtof());
+  TOFpc(xTof, yTof, AliTOFGeometry::ZlenC(), AliTOFGeometry::ZlenB(), AliTOFGeometry::ZlenA(), AliTOFGeometry::MaxhZtof());
 }
 
 //_____________________________________________________________________________
@@ -822,150 +791,30 @@ Bool_t AliTOF::CheckOverlap(Int_t* vol, Float_t* digit,Int_t Track)
 
 
 //____________________________________________________________________________
-void AliTOF::Digits2Raw(Int_t evNumber)
+void AliTOF::Digits2Raw()
 {
 //
-// Starting from digits, writes the 
-// Raw Data objects, i.e. a 
-// TClonesArray of 18 AliTOFRawSector objects
+// Starting from the TOF digits, writes the Raw Data objects
 //
 
-  TTree* tD;
+  fLoader->LoadDigits();
 
-  // do nothing if no particles
-  Int_t nparticles = gAlice->GetEvent(evNumber); 
-  if (nparticles <= 0) return;
-
-  tD = gAlice->TreeD();
-  
-  TClonesArray* tofdigits = this->Digits();
-  Int_t ndigits = tofdigits->GetEntriesFast();
-
-  TClonesArray* rawsectors = new TClonesArray("AliTOFRawSector",fNTof+2); 
-
-  for (Int_t isect=1;isect<=fNTof;isect++){
-     AliTOFRawSector* currentSector = (AliTOFRawSector*)rawsectors->UncheckedAt(isect);
-     TClonesArray* rocData = (TClonesArray*)currentSector->GetRocData();
-
-     for (Int_t digit=0; digit<ndigits; digit++){
-        AliTOFdigit* currentDigit = (AliTOFdigit*)tofdigits->UncheckedAt(digit);
-        Int_t sector = currentDigit->GetSector();
-        if (sector==isect){
-           Int_t   pad    = currentDigit -> GetTotPad();
-           Int_t   roc    = (Int_t)(pad/fNPadXRoc)-1;
-           if (roc>=fNRoc) printf("Wrong n. of ROC ! Roc = %i",roc);
-            Int_t   padRoc = (Int_t) pad%fNPadXRoc;
-           Int_t   fec    = (Int_t)(padRoc/fNFec)-1;
-            Int_t   tdc    = (Int_t)(padRoc%fNFec)-1;
-            Float_t time   = currentDigit->GetTdc();
-            Float_t charge = currentDigit->GetAdc();
-           AliTOFRoc* currentROC = (AliTOFRoc*)rocData->UncheckedAt(roc);
-           Int_t error    = 0;
-            currentROC->AddItem(fec, tdc, error, charge, time);
-       } // close if (sector==isect) i.e. end loop on digits for the current sector
-     } // end loop on TOF digits
-     
-     UInt_t totSize=16,rocSize=0;
-     UInt_t rocHead[14],rocChek[14];
-     UInt_t globalCheckSum=0;
-
-     for (UInt_t iRoc = 1; iRoc<(UInt_t)fNRoc; iRoc++){
-        AliTOFRoc* currentRoc = (AliTOFRoc*)rocData->UncheckedAt(iRoc); 
-       rocSize  = currentRoc->GetItems()*2+1;
-       totSize += rocSize*4;
-       if (rocSize>=TMath::Power(2,16)) rocSize=0;
-       rocHead[iRoc]   = iRoc<<28;
-       rocHead[iRoc]  += rocSize;
-       rocChek[iRoc]   = currentRoc->GetCheckSum();
-        Int_t headCheck = currentRoc->BitCount(rocHead[iRoc]);
-       globalCheckSum += headCheck;
-       globalCheckSum += rocChek[iRoc];
-     }
-     
-     AliTOFRoc* dummyRoc = new AliTOFRoc();
-     totSize *= 4;
-     if (totSize>=TMath::Power(2,24)) totSize=0;
-     UInt_t header = totSize;
-     UInt_t sectId = ((UInt_t)isect)<<24;
-     header += sectId;
-     globalCheckSum += dummyRoc->BitCount(header);
-     currentSector->SetGlobalCS(globalCheckSum);
-     currentSector->SetHeader(header);
-  }  
-}
-//____________________________________________________________________________
-void AliTOF::Raw2Digits(Int_t evNumber)
-{
-//
-//  Converts Raw Data objects into digits objects.
-//  We schematize the raw data with a 
-//  TClonesArray of 18 AliTOFRawSector objects
-//
-
-  TTree    *tD;
-  Int_t    vol[5];
-  Int_t    tracks[3];
-  Float_t  digit[2];
-  tracks[0]=0;
-  tracks[1]=0;
-  tracks[2]=0;
-  Int_t nparticles = gAlice->GetEvent(evNumber); 
-  if (nparticles <= 0) return;
-
-  tD = gAlice->TreeD();
+  TTree* digits = fLoader->TreeD();
+  if (!digits) {
+    Error("Digits2Raw", "no digits tree");
+    return;
+  }
   
-  TClonesArray* rawsectors = new TClonesArray("AliTOFRawSector",fNTof+2);
+  AliTOFDDLRawData rawWriter;
+  rawWriter.SetVerbose(0);
   
-  for(Int_t nSec=1; nSec<=fNTof; nSec++){
-     AliTOFRawSector* currentSector = (AliTOFRawSector*)rawsectors->UncheckedAt(nSec);
-     TClonesArray* rocData = (TClonesArray*)currentSector->GetRocData();
-     for(Int_t nRoc=1; nRoc<=14; nRoc++){
-        AliTOFRoc* currentRoc = (AliTOFRoc*)rocData->UncheckedAt(nRoc);
-        Int_t currentItems = currentRoc->GetItems();
-        for(Int_t item=1; item<currentItems; item++){ 
-           Int_t nPad = currentRoc->GetTotPad(item);        
-          vol[0] = nSec;
-          Int_t nStrip = (Int_t)(nPad/fPadXStr)+1;
-          Int_t nPlate = 5;
-          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;
-          vol[1] = nPlate;
-          switch (nPlate){
-          case 1: break;
-          case 2: nStrip -= (fNStripC);
-                  break;
-          case 3: nStrip -= (fNStripC+fNStripB);
-                  break;
-          case 4: nStrip -= (fNStripC+fNStripB+fNStripA);
-                  break;
-          case 5: nStrip -= (fNStripC+2*fNStripB+fNStripA);
-                  break;
-          }
-           vol[2] = nStrip;
-           Int_t pad = nPad%fPadXStr;
-          if (pad==0) pad=fPadXStr;
-          Int_t nPadX=0, nPadZ=0;
-          (pad>fNpadX)? nPadX -= fNpadX : nPadX = pad ;
-          vol[3] = nPadX;
-          (pad>fNpadX)? nPadZ = 2 : nPadZ = 1 ;
-          vol[4] = nPadZ;
-          UInt_t error=0;
-          Float_t tdc = currentRoc->GetTime(item,error);
-          if (!error) digit[0]=tdc;
-          digit[1] = currentRoc->GetCharge(item);
-          AddDigit(tracks,vol,digit);
-        }
-     }
-  }
-  tD->Fill();
-  tD->Write(0,TObject::kOverwrite);
-} 
+  Info("Digits2Raw", "Formatting raw data for TOF");
+  digits->GetEvent(0);
+  rawWriter.RawDataTOF(digits->GetBranch("TOF"));  
 
+  fLoader->UnloadDigits();
+  
+}
 ////////////////////////////////////////////////////////////////////////
 void AliTOF::RecreateSDigitsArray() {
 //
index d271a9f4c4ca59bbb245969166536c44e6a2d0e7..26586c1bf3b5ba4910e9b193d1a1b8614bcab0d6 100644 (file)
@@ -38,15 +38,16 @@ public:
   AliTOF(); 
   AliTOF(const char *name, const char *title, Option_t *option="noTimeZero");
   virtual ~AliTOF() ;
+
+  static  Int_t NDDL()        { return kNDDL;};
+  static  Int_t NTRM()        { return kNTRM;}
+  static  Int_t NTdc()        { return kNTdc;};
+  static  Int_t NCh()         { return kNCh;};
+  static  Int_t NPadXTRM()    { return kNCh*kNTdc;};
+
 // getters for AliTOF object status
-  Int_t GetNStripA() const {return fNStripA;}
-  Int_t GetNStripB() const {return fNStripB;}
-  Int_t GetNStripC() const {return fNStripC;}
-  Int_t GetNpadX()   const {return fNpadX;}
-  Int_t GetNpadZ()   const {return fNpadZ;}
-  Int_t GetPadXStr() const {return fPadXStr;}
-  Float_t GetTimeRes() const {return fTimeRes;}
-  Float_t GetChrgRes() const {return fChrgRes;}
+  //Float_t GetTimeRes() const {return fTimeRes;};
+  //Float_t GetChrgRes() const {return fChrgRes;};
 
   virtual void    SetTreeAddress();
   virtual void    AddHit(Int_t track, Int_t* vol, Float_t* hits);
@@ -56,7 +57,7 @@ public:
   virtual void    CreateGeometry();
   virtual void    CreateMaterials();
   virtual void    Init();
-//  virtual void    MakeBranch(Option_t* option, const char *file=0);
+  //virtual void    MakeBranch(Option_t* option, const char *file=0);
   virtual void    MakeBranch(Option_t *opt=" ");
   virtual void    Makehits(Bool_t hits=1);
   virtual void    FinishEvent();
@@ -68,20 +69,20 @@ public:
   virtual void    DrawModule() const;
   virtual void    DrawDetectorModules()=0;
   virtual void    DrawDetectorStrips()=0;
-//  virtual void   DrawDetectorModulesinFrame()=0;
-//  virtual void   DrawDetectorStripsinFrame()=0;
+  //virtual void   DrawDetectorModulesinFrame()=0;
+  //virtual void   DrawDetectorStripsinFrame()=0;
           void    CreateTOFFolders();
   Bool_t    CheckOverlap(Int_t* vol, Float_t* digit, Int_t Track);
   virtual void    SDigits2Digits();
   virtual void    SetMerger(AliTOFMerger* merger);
   virtual AliTOFMerger* Merger();
-//  virtual void    Hits2Digits();   
+  //virtual void    Hits2Digits();   
   virtual void    Hits2SDigits();
   virtual void    Hits2SDigits(Int_t evNumber1, Int_t evNumber2);
   virtual AliDigitizer* CreateDigitizer(AliRunDigitizer* manager) const; 
-  virtual void    Digits2Reco() {cout << "AliTOF::Digits2Reco()  dummy function called" << endl;}
-          void    Digits2Raw (Int_t evNumber=0);
-          void    Raw2Digits (Int_t evNumber=0);
+  virtual void    Digits2Reco() {};
+          void    Digits2Raw ();
+          void    Raw2Digits (){};
   virtual void    ResetHits();
   virtual void    ResetDigits();
   virtual void    ResetSDigits();
@@ -91,52 +92,39 @@ public:
   void CreateSDigitsArray();
   AliTOFGeometry *GetGeometry() const { return fTOFGeometry; }; 
 
-  Int_t   fNevents ;        // Number of events to digitize
-
 protected:
   TFolder* fFGeom ;       //  Folder that holds the Geometry definition
   TTask*   fDTask ;       //  TOF Digitizer container
   TTask*   fReTask;       //  TOF Reconstructioner container
-  TClonesArray* fSDigits; //!  List of summable digits
-  Int_t    fNSDigits;           //! Number of sdigits
+  TClonesArray* fSDigits; //! List of summable digits
+  Int_t   fNSDigits;      //! Number of sdigits
   TClonesArray* fReconParticles; // List of reconstructed particles
-  AliTOFMerger *fMerger;   // ! pointer to merger
-  Int_t   fNTof;  // number of TOF sectors
-  Float_t fRmax;  // upper bound for radial extension of TOF detector
-  Float_t fRmin;  // lower bound for radial extension of TOF detector
-  Float_t fZlenA; // length along z-axis of type A module 
-  Float_t fZlenB; // length along z-axis of type B module
-  Float_t fZlenC; // length along z-axis of type C module
-  Float_t fZtof;  // total semi-length of TOF detector
-  Float_t fStripLn;  //  Strip Length
-  Float_t fSpace;    //  Space Beetween the strip and the bottom of the plate
-  Float_t fDeadBndZ; //  Dead Boundaries of a Strip along Z direction (width)
-  Float_t fDeadBndX; //  Dead Boundaries of a Strip along X direction (length)
-  Float_t fXpad;  //  X size of a pad
-  Float_t fZpad;  //  Z size of a pad
-  Float_t fGapA;  //  Gap beetween tilted strip in A-type plate
-  Float_t fGapB;  //  Gap beetween tilted strip in B-type plate
-  Float_t fOverSpc; // Space available for sensitive layers in radial direction
-  Int_t   fNpadX; // Number of pads in a strip along the X direction
-  Int_t   fNpadZ; // Number of pads in a strip along the Z direction
-  Int_t   fPadXStr; // Number of pads per strip
-  Int_t   fNStripA; // number of strips in A type module
-  Int_t   fNStripB; // number of strips in B type module
-  Int_t   fNStripC; // number of strips in C type module
-  Float_t fTimeRes; // time resolution of the TOF
-  Float_t fChrgRes; // charge resolution of ADC
-  Int_t   fPadXSector; // number of pads per sector
-  Int_t   fNRoc;       // number of ROC
-  Int_t   fNFec;       // number of FEC
-  Int_t   fNTdc;       // number of TDC
-  Int_t   fNPadXRoc;   // number of pads for each ROC
-  Int_t   fIdSens;     // the unique identifier for sensitive volume FPAD 
-  Bool_t  fTZero;      // flag indicating if T0 is used
+  AliTOFMerger *fMerger;  // ! pointer to merger
+
+  //Float_t fGapA;     //  Gap beetween tilted strip in A-type plate
+  //Float_t fGapB;     //  Gap beetween tilted strip in B-type plate
+
+  //Float_t fTimeRes;  //  Time resolution of the TOF
+  //Float_t fChrgRes;  //  Charge resolution of ADC
+
+  Int_t   fIdSens;     // The unique identifier for sensitive volume FPAD 
+
+  Bool_t  fTZero;      // Flag indicating if T0 is used
   AliTOFGeometry *fTOFGeometry; //The TOF Geometry parameters
  
 private:
 
-  ClassDef(AliTOF,6)  // Time Of Flight base class
+  // DAQ characteristics
+  // cfr. TOF-TDR pag. 105 for Glossary
+  // TARODA : TOF-ALICE Read Out and Data Acquisition system
+  enum {
+    kNDDL        =    4, // Number of DDL (Detector Data Link) per sector
+    kNTRM        =   10, // Number of TRM ( Readout Module) per DDL
+    kNTdc        =   30, // Number of Tdc (Time to Digital Converter) per TRM
+    kNCh         =    8  // Number of channels per Tdc
+  };
+
+  ClassDef(AliTOF,7)  // Time Of Flight base class
 };
  
 #endif /* ALITOF_H */
diff --git a/TOF/AliTOFDDLRawData.cxx b/TOF/AliTOFDDLRawData.cxx
new file mode 100644 (file)
index 0000000..6a15e37
--- /dev/null
@@ -0,0 +1,358 @@
+/**************************************************************************
+ * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/*
+Revision 0.01  2004/6/11 A.De Caro, S.B.Sellitto, R.Silvestri
+        First implementation: global methods RawDataTOF
+                                             GetDigits
+                                             (Un)PackWord
+*/
+//
+// This class contains the methods to create the Raw Data files
+// for the TOF detector starting from the Digits.
+// In this preliminary implementation, we defined the structure
+// of the ALICE-TOF raw data starting from the current format
+// for the TOF digits and the TOF raw data.
+//
+
+#include <stdlib.h>
+#include <Riostream.h>
+#include <TClonesArray.h>
+#include <TTree.h>
+#include <TMath.h>
+#include "AliTOF.h"
+#include "AliTOFGeometry.h"
+#include "AliTOFdigit.h"
+#include "AliTOFDDLRawData.h"
+#include "AliRawDataHeader.h"
+
+ClassImp(AliTOFDDLRawData)
+
+//----------------------------------------------------------------------------------------
+AliTOFDDLRawData::AliTOFDDLRawData()
+{
+  //Default constructor
+  fIndex=-1;
+  fVerbose=0;
+}
+
+//----------------------------------------------------------------------------------------
+
+AliTOFDDLRawData::AliTOFDDLRawData(const AliTOFDDLRawData &source) : 
+    TObject(source){
+  //Copy Constructor
+  this->fIndex=source.fIndex;
+  this->fVerbose=source.fVerbose;
+  return;
+}
+
+//---------------------------------------------------------------------------------------
+
+AliTOFDDLRawData& AliTOFDDLRawData::operator=(const AliTOFDDLRawData &source){
+  //Assigment operator
+  this->fIndex=source.fIndex;
+  this->fVerbose=source.fVerbose;
+  return *this;
+}
+
+//---------------------------------------------------------------------------------------
+
+void AliTOFDDLRawData::GetDigits(TClonesArray *TOFdigits,Int_t nDDL,UInt_t *buf)
+{
+  //This method packs the TOF digits in a proper 32 bits structure
+  Int_t iDDL=(Int_t)((nDDL/4.-(Int_t)(nDDL/4.))*4);
+  Int_t iSector=(Int_t)(nDDL/4.);
+  Int_t iTRM=0;
+  Int_t iTDC=0;
+  Int_t iCH=-1;
+  Int_t sector; 
+  Int_t plate;
+  Int_t strip;
+  Int_t padx;
+  Int_t padz;
+  Int_t totCharge;
+  Int_t timeOfFlight;
+  Int_t error=0;
+  Int_t eureka;
+  UInt_t word;
+  UInt_t baseWord;
+  Int_t ndigits = TOFdigits->GetEntries();
+  AliTOFdigit *digs;
+  ofstream ftxt;
+  if(!ndigits) 
+    {
+      Error("GetDigits", "No found TOF digits\n");      
+      return;
+    }
+
+  if (fVerbose==2) ftxt.open("TOFdigits.txt",ios::app);
+  for (Int_t digit=0;digit<ndigits;digit++) {
+    digs = (AliTOFdigit*)TOFdigits->UncheckedAt(digit);
+    sector=digs->GetSector(); // Sector Number (0-17)
+    plate=digs->GetPlate();   // Plate Number (0-4)
+    strip=digs->GetStrip();   // Strip Number (0-14/18/19)
+    padx=digs->GetPadx();     // Pad Number in x direction (0-47)
+    padz=digs->GetPadz();     // Pad Number in z direction (0-1)
+    eureka=digs->GetTotPad(); // Global Pad Number inside a Sector
+    totCharge = (Int_t)digs->GetAdc();
+    timeOfFlight = (Int_t)digs->GetTdc();
+    /*
+    Int_t istriPlate=0;
+    switch (plate)
+      {
+      case 0:
+       break;
+      case 1:
+       istriPlate = AliTOFGeometry::NStripC();
+       break;
+      case 2:
+       istriPlate = AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB();
+       break;
+      case 3:
+       istriPlate = AliTOFGeometry::NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA();
+       break;
+      case 4:
+       istriPlate = AliTOFGeometry::NStripC()+2*AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA();
+       break;
+      }
+
+    eureka=2*padx+padz+AliTOFGeometry::NpadXStrip()*(strip+istriPlate);
+    
+    if (eureka!=digs->GetTotPad()) printf(" eureka = %d AND digs->GetTotPad() = %d",eureka,digs->GetTotPad());
+    */
+    if (sector!=iSector || (Int_t)((Float_t)eureka/AliTOF::NPadXTRM()/AliTOF::NTRM())!=iDDL) continue;
+    
+    if (fVerbose==2) ftxt <<" Sector: "<<sector<<" plate: "<<plate<<" strip "<<strip<<" padx "<<padx<<" padz "<<padz<<" eureka "<<eureka<<endl;
+    
+    iTRM = (Int_t)((Float_t)eureka/AliTOF::NPadXTRM() - AliTOF::NTRM()*iDDL);
+    
+    iTDC = (Int_t)(AliTOF::NTdc()* 
+                  (
+                   (Float_t)eureka/AliTOF::NPadXTRM() -
+                   (Int_t)((Float_t)eureka/AliTOF::NPadXTRM())
+                   )
+                  );
+    
+    iCH  = (Int_t)(AliTOF::NCh() * 
+                  (
+                   (Float_t)eureka/AliTOF::NPadXTRM()*AliTOF::NTdc() - (Int_t)((Float_t)eureka/AliTOF::NPadXTRM()*AliTOF::NTdc()) -
+                   (Int_t)((Float_t)eureka/AliTOF::NPadXTRM()*AliTOF::NTdc() - (Int_t)((Float_t)eureka/AliTOF::NPadXTRM()*AliTOF::NTdc()))
+                   )
+                  );
+    
+    if (fVerbose==2) ftxt << "DDL: "<<iDDL<<" Sector: "<<sector<<" TRM: "<<iTRM<<" TDC: "<<iTDC<<" Channel: "<<iCH<<" totCharge: "<<totCharge<<" tof: "<<timeOfFlight<<endl;
+    
+    baseWord=0;
+    
+    word=iTRM;
+    PackWord(baseWord,word, 0, 3); // TRM ID
+    word=iTDC;
+    PackWord(baseWord,word, 4, 8); // TDC ID
+    word=iCH;
+    PackWord(baseWord,word, 9,11); // CH ID
+
+    // temporary control
+    if (totCharge<0) word=TMath::Abs(totCharge);
+    else word=totCharge;
+    PackWord(baseWord,word,12,31); // Charge (TOT)
+    
+    fIndex++;
+    buf[fIndex]=baseWord;
+    
+    baseWord=0;
+    
+    word=error;
+    PackWord(baseWord,word,0, 7); // Error flag
+    word=timeOfFlight;
+    PackWord(baseWord,word,8,31); // time-of-flight
+    
+    fIndex++;
+    buf[fIndex]=baseWord;
+    word=0;
+    baseWord=0;
+    
+  }//end for
+  
+  if (fVerbose==2) ftxt.close();
+
+  return;
+
+}//end GetDigits
+
+//-------------------------------------------------------------------------------------
+
+void AliTOFDDLRawData::PackWord(UInt_t &BaseWord, UInt_t Word, Int_t StartBit, Int_t StopBit)
+{
+  //This method packs a word into the Baseword buffer starting form the "StartBit" 
+  //and tacking StopBit-StartBit+1 bits
+  UInt_t dummyWord,offSet;
+  Int_t  length;
+  UInt_t sum;
+  //The BaseWord is being filled with 1 from StartBit to StopBit
+  length=StopBit-StartBit+1;
+  sum=(UInt_t)TMath::Power(2,length)-1;
+
+  if(Word > sum){
+    Error("PackWord", "Word to be filled is not within desired length\n"
+         "Word:%d Start bit:%d Stop Bit:%d",Word,StartBit,StopBit);
+    return;
+  }
+  offSet=sum;
+  offSet<<=StartBit;
+  BaseWord=BaseWord|offSet;
+
+  //The Word to be filled is shifted to the position StartBit
+  //and the remaining  Left and Right bits are filled with 1
+  sum=(UInt_t)TMath::Power(2,StartBit)-1;
+  dummyWord=0xFFFFFFFF<<length;
+  dummyWord +=Word;
+  dummyWord<<=StartBit;
+  dummyWord+=sum;
+  BaseWord=BaseWord&dummyWord;
+
+  return;
+}
+
+//------------------------------------------------------------------------------------------------
+
+void AliTOFDDLRawData::UnpackWord(UInt_t PackedWord, Int_t StartBit, Int_t StopBit, UInt_t &Word)
+{
+  //This method unpacks a words of StopBit-StartBit+1 bits starting from "StopBits"  
+  UInt_t offSet;
+  Int_t length;
+  length=StopBit-StartBit+1;
+  offSet=(UInt_t)TMath::Power(2,length)-1;
+  offSet<<=StartBit;
+  Word=PackedWord&offSet;
+  Word>>=StartBit;
+  return;
+}
+
+//---------------------------------------------------------------------------------------
+
+Int_t AliTOFDDLRawData::RawDataTOF(TBranch* branch){
+  //This method creates the Raw data files for TOF detector
+  const Int_t kSize=5000; //2*AliTOFGeometry::NpadXSector() 
+                          //max number of digits per DDL file times 2
+  UInt_t buf[kSize];
+  UInt_t baseWord;
+  UInt_t word;
+
+  fIndex=-1;
+
+  TClonesArray*& digits = * (TClonesArray**) branch->GetAddress();
+  char fileName[15];
+  ofstream outfile;         // logical name of the output file 
+  AliRawDataHeader header;
+
+  //loop over TOF DDL files
+  for(Int_t i=0;i<72;i++){
+    sprintf(fileName,"TOF_%d.ddl",i); //The name of the output file
+#ifndef __DECCXX
+    outfile.open(fileName,ios::binary);
+#else
+    outfile.open(fileName);
+#endif
+    //write Dummy DATA HEADER
+    UInt_t dataHeaderPosition=outfile.tellp();
+    outfile.write((char*)(&header),sizeof(header));
+
+    baseWord=0;
+    word=i;
+    PackWord(baseWord,word,0, 31); // Number of DDL file
+
+    fIndex++;
+    buf[fIndex]=baseWord;
+
+    branch->GetEvent();
+
+    //For each DDL file, buf contains the array of data words in Binary format
+    //fIndex gives the number of 32 bits words in the buffer for each DDL file
+    GetDigits(digits,i,buf);
+    outfile.write((char *)buf,((fIndex+1)*sizeof(UInt_t)));
+
+    for(Int_t ii=0;ii<(fIndex+1);ii++) buf[ii]=0;
+    fIndex=-1;
+    
+    //Write REAL DATA HEADER
+    UInt_t currentFilePosition=outfile.tellp();
+    outfile.seekp(dataHeaderPosition);
+    header.fSize=currentFilePosition-dataHeaderPosition;
+    header.SetAttribute(0);  // valid data
+    outfile.write((char*)(&header),sizeof(header));
+    outfile.close();
+
+  }//end for
+  
+  return 0;  
+}
+
+//-----------------------------------------------------------------------------------------
+/*
+void AliTOFDDLRawData::WriteChipHeader(Int_t ChipAddr,Int_t EventCnt,UInt_t &BaseWord)
+{
+  //This method writes a chip header 
+  BaseWord=0;
+  PackWord(BaseWord,ChipAddr,0,3);
+  PackWord(BaseWord,EventCnt,4,10);
+  PackWord(BaseWord,0x7,11,13);
+  PackWord(BaseWord,0x1,14,15);
+  return;
+}//end WriteChipHeader
+*/
+//----------------------------------------------------------------------------------------
+/*
+void AliTOFDDLRawData::ReadChipHeader(Int_t &ChipAddr,Int_t &EventCnt,UInt_t BaseWord)
+{
+  //This method reads a chip header
+  UInt_t temp=0;
+  UnpackWord(BaseWord,0,3,temp);
+  ChipAddr=(Int_t)temp;
+  UnpackWord(BaseWord,4,10,temp);
+  EventCnt=(Int_t)temp;
+  if(fVerbose)
+    Info("ReadChipHeader", "Chip:&d Half Stave module:%d",ChipAddr,EventCnt);
+  return;
+}//end ReadChipHeader
+*/
+//----------------------------------------------------------------------------------------
+/*
+void  AliTOFDDLRawData::WriteChipTrailer(UInt_t *buf,Int_t ChipHitCount,UInt_t &BaseWord)
+{
+  //This method writes a chip trailer
+  //pixel fill word
+  if((ChipHitCount%2)!=0){
+    PackWord(BaseWord,0xFEDC,0,15);
+  }
+  PackWord(BaseWord,ChipHitCount,16,28);
+  PackWord(BaseWord,0x0,30,31);
+  fIndex++;
+  buf[fIndex]=BaseWord;
+  BaseWord=0;
+  return;
+}//end WriteChipTrailer
+*/
+//------------------------------------------------------------------------------------------
+/*
+void  AliTOFDDLRawData::ReadChipTrailer(Int_t &ChipHitCount,UInt_t BaseWord)
+{
+  //This method reads a chip trailer
+  UInt_t temp=0;
+  UnpackWord(BaseWord,16,28,temp);
+  ChipHitCount=(Int_t)temp;
+  return;
+}//end ReadChipTrailer
+*/
+//------------------------------------------------------------------------------------------
diff --git a/TOF/AliTOFDDLRawData.h b/TOF/AliTOFDDLRawData.h
new file mode 100644 (file)
index 0000000..3d59f42
--- /dev/null
@@ -0,0 +1,53 @@
+/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+////////////////////////////////////////////////////////////////////////////
+// Class used for generating the files containing raw data,               //
+// required for  Data Challenge                                           //
+////////////////////////////////////////////////////////////////////////////
+
+#ifndef AliTOFDDLRAWDATA_H
+#define AliTOFDDLRAWDATA_H
+
+class AliTOF;
+class TTree;
+
+class AliTOFDDLRawData:public TObject{
+ public:
+  AliTOFDDLRawData();                               // default constructor
+  virtual ~AliTOFDDLRawData(){;}                    // destructor
+  AliTOFDDLRawData(const AliTOFDDLRawData &source); // copy constructor
+  AliTOFDDLRawData& operator=(const AliTOFDDLRawData &source); // ass. op.
+  Int_t RawDataTOF(TBranch* branch); 
+  // This method generates the files with the TOF detector data
+  void SetVerbose(Int_t Verbose){fVerbose=Verbose;}
+  // To set the verbose level
+ private:
+  void  GetDigits(TClonesArray *TOFdigits, Int_t ddl,UInt_t *buf);
+  //This method formats and stores in buf all the digits of a TOF module
+
+  void  PackWord(UInt_t &BaseWord, UInt_t Word, Int_t StartBit, Int_t StopBit);
+  //This method stores the value of the variable Word of StopBit-StartBit+1 bits 
+  //in BaseWord, starting from the bit StartBit
+
+  void  UnpackWord(UInt_t PackedWord, Int_t StartBit, Int_t StopBit, UInt_t &Word);
+  //This method extracts a group of adjacent bits, specified by StartBit and StopBit, 
+  //from the word PackedWord. The resulting word is saved in the Word variable
+
+  /*
+  void  WriteChipHeader(Int_t ChipAddr,Int_t EventCnt,UInt_t &BaseWord);
+  void  WriteChipTrailer(UInt_t *buf,Int_t ChipHitCount,UInt_t &BaseWord);
+  //The three previous  methods are used to store the data according to the 
+  //TOF detector data format
+
+  void  ReadChipHeader(Int_t &ChipAddr,Int_t &EventCnt,UInt_t BaseWord);
+  void  ReadChipTrailer(Int_t &ChipHitCount,UInt_t BaseWord);
+  //Methods used for reading and dubugging TOF data files
+  */
+
+  Int_t fVerbose;            //Verbose level (0:no msg, 1:msg, 2:digits in txt files)
+  Int_t fIndex;              //number of 32 words to be stored into the output file
+  ClassDef(AliTOFDDLRawData,1)
+};
+    
+#endif
index 2b589075b6e342a4c326db8c1116ab6a70e0d97e..51d4f0df486195dc2f02b6fb96ddffe4d0c66e79 100644 (file)
@@ -169,7 +169,7 @@ void AliTOFDigitizer::CreateDigits()
   for (Int_t k = 0; k < ndig; k++) {
     
     Int_t  vol[5];  // location for a digit
-    for (Int_t i=0; i<5; i++) vol[i] = -1; // AdC
+    for (Int_t i=0; i<5; i++) vol[i] = -1;
     
     // Get the information for this digit
     AliTOFSDigit *tofsdigit = (AliTOFSDigit *) fSDigitsArray->UncheckedAt(k);
@@ -192,8 +192,7 @@ 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<0 || sector>17 || plate<0 || plate >4 || padz<0 || padz>1 || padx<0 || padx>47); // AdC
+    Bool_t isSDigitBad = (sector<0 || sector>17 || plate<0 || plate >4 || padz<0 || padz>1 || padx<0 || padx>47);
     
     if (isSDigitBad) {
       cout << "<AliTOFSDigits2Digits>  strange sdigit found" << endl;
@@ -303,7 +302,7 @@ void AliTOFDigitizer::ReadSDigit(Int_t inputFile )
       AliTOFSDigit *tofSdigit= (AliTOFSDigit*) sdigitsDummyContainer->UncheckedAt(k);
       
       Int_t  vol[5]; // location for a sdigit
-      for (Int_t i=0; i<5; i++) vol[i] = -1; // AdC
+      for (Int_t i=0; i<5; i++) vol[i] = -1;
 
       // check the sdigit volume
       vol[0] = tofSdigit->GetSector();
index e901b51136c86af88f628b43ce636569647eeefe..6bd1fc10ec6364cb8f003f3d6741cc61229d53b3 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.5  2004/04/20 14:37:22  hristov
+Using TMath::Abs instead of fabs, arrays of variable size created/deleted correctly (HP,Sun)
+
 Revision 1.4  2004/04/13 09:42:51  decaro
 Track reconstruction code for TOF: updating
 
@@ -27,14 +30,17 @@ Using enum to initaialize static ints in the header file, the initialization of
 Revision 1.1  2003/12/29 15:18:03  decaro
 TOF geometry updating (addition of AliTOFGeometry)
 
-Revision 0.01  2003/12/04 S.Arcelli
-Revision 0.02  2003/12/10 S.Arcelli:
-        Implement Global methods GetPos & GetDetID 
-Revision 0.03  2003/12/14 S.Arcelli
-        Set Phi range [-180,180]->[0,360] 
-Revision 0.03  2004/4/05 S.Arcelli
+Revision 0.05  2004/6/11 A.De Caro
+        Implement Global method NpadXStrip
+        Insert four float constants (originally  in AliTOF class)
+Revision 0.04  2004/4/05 S.Arcelli
         Implement Global methods IsInsideThePad 
                                   DistanceToPad 
+Revision 0.03  2003/12/14 S.Arcelli
+        Set Phi range [-180,180]->[0,360] 
+Revision 0.02  2003/12/10 S.Arcelli:
+        Implement Global methods GetPos & GetDetID 
+Revision 0.01  2003/12/04 S.Arcelli
 */
 
 #include <stdlib.h>
@@ -50,17 +56,21 @@ Revision 0.03  2004/4/05 S.Arcelli
 
 ClassImp(AliTOFGeometry)
 
-const Int_t AliTOFGeometry::fgkTimeDiff   = 25000;// Min signal separation (ps)
-
-const Float_t AliTOFGeometry::fgkxTOF     = 371.; // Inner radius of the TOF for Reconstruction (cm)
-const Float_t AliTOFGeometry::fgkRmin     = 370.; // Inner radius of the TOF (cm)
-const Float_t AliTOFGeometry::fgkRmax     = 399;  // Outer radius of the TOF (cm)
-const Float_t AliTOFGeometry::fgkZlenA    = 106.0;// length (cm) of the A module
-const Float_t AliTOFGeometry::fgkZlenB    = 141.0;// length (cm) of the B module
-const Float_t AliTOFGeometry::fgkZlenC    = 177.5;// length (cm) of the C module
-const Float_t AliTOFGeometry::fgkXPad     = 2.5;  // Pad size in the x direction (cm)
-const Float_t AliTOFGeometry::fgkZPad     = 3.5;  // Pad size in the z direction (cm)
-const Float_t AliTOFGeometry::fgkMaxhZtof = 371.5;// Max half z-size of TOF (cm)
+const Int_t AliTOFGeometry::fgkTimeDiff   = 25000;  // Min signal separation (ps)
+
+const Float_t AliTOFGeometry::fgkxTOF     = 371.;   // Inner radius of the TOF for Reconstruction (cm)
+const Float_t AliTOFGeometry::fgkRmin     = 370.;   // Inner radius of the TOF (cm)
+const Float_t AliTOFGeometry::fgkRmax     = 399;    // Outer radius of the TOF (cm)
+const Float_t AliTOFGeometry::fgkZlenA    = 106.0;  // length (cm) of the A module
+const Float_t AliTOFGeometry::fgkZlenB    = 141.0;  // length (cm) of the B module
+const Float_t AliTOFGeometry::fgkZlenC    = 177.5;  // length (cm) of the C module
+const Float_t AliTOFGeometry::fgkXPad     = 2.5;    // Pad size in the x direction (cm)
+const Float_t AliTOFGeometry::fgkZPad     = 3.5;    // Pad size in the z direction (cm)
+const Float_t AliTOFGeometry::fgkMaxhZtof = 371.5;  // Max half z-size of TOF (cm)
+const Float_t AliTOFGeometry::fgkStripLength = 122.;// Strip Length (rho X phi direction) (cm)
+const Float_t AliTOFGeometry::fgkDeadBndX = 1.0;    // Dead Boundaries of a Strip along X direction (length) (cm)
+const Float_t AliTOFGeometry::fgkDeadBndZ = 1.5;    // Dead Boundaries of a Strip along Z direction (width) (cm)
+const Float_t AliTOFGeometry::fgkOverSpc = 15.3;    // Space available for sensitive layers in radial direction (cm)
 
 
 const Float_t AliTOFGeometry::fgkSigmaForTail1= 2.;//Sig1 for simulation of TDC tails 
index d84b685e6fdc713a7cc144940df173e3b0583add..5f63bd9a5fe40fcf16d86f950c896d63f0896320 100644 (file)
@@ -24,6 +24,7 @@ class AliTOFGeometry{
   static  Int_t NStripC()     { return kNStripC;};
   static  Int_t NpadX()       { return kNpadX;};
   static  Int_t NpadZ()       { return kNpadZ;};
+  static  Int_t NpadXStrip()  { return kNpadX*kNpadZ;};
   static  Int_t NSectors()    { return kNSectors;};
   static  Int_t NPlates()     { return kNPlates;};
   static  Int_t NPadXSector() { return (kNStripA + 2*kNStripB +
@@ -32,16 +33,19 @@ class AliTOFGeometry{
   static  Int_t MaxTOFTree()  { return kMaxTOFTree;};
 
 
-  static  Float_t RinTOF()   { return fgkxTOF;};
-  static  Float_t Rmin()     { return fgkRmin;};
-  static  Float_t Rmax()     { return fgkRmax;};
-  static  Float_t ZlenA()    { return fgkZlenA;};
-  static  Float_t ZlenB()    { return fgkZlenB;};
-  static  Float_t ZlenC()    { return fgkZlenC;};
-  static  Float_t XPad()     { return fgkXPad;};
-  static  Float_t ZPad()     { return fgkZPad;};
-  static  Float_t MaxhZtof() { return fgkMaxhZtof;};
-
+  static  Float_t RinTOF()      { return fgkxTOF;};
+  static  Float_t Rmin()        { return fgkRmin;};
+  static  Float_t Rmax()        { return fgkRmax;};
+  static  Float_t ZlenA()       { return fgkZlenA;};
+  static  Float_t ZlenB()       { return fgkZlenB;};
+  static  Float_t ZlenC()       { return fgkZlenC;};
+  static  Float_t XPad()        { return fgkXPad;};
+  static  Float_t ZPad()        { return fgkZPad;};
+  static  Float_t MaxhZtof()    { return fgkMaxhZtof;};
+  static  Float_t StripLength() { return fgkStripLength;};
+  static  Float_t DeadBndX()    { return fgkDeadBndX;};
+  static  Float_t DeadBndZ()    { return fgkDeadBndZ;};
+  static  Float_t OverSpc()     { return fgkOverSpc;};
 
   static  Float_t SigmaForTail1() { return fgkSigmaForTail1;};
   static  Float_t SigmaForTail2() { return fgkSigmaForTail2;};
@@ -92,16 +96,20 @@ class AliTOFGeometry{
     kMaxTOFTree = 5   // numer of geom. levels: 
   };
 
-  static const Int_t fgkTimeDiff;  // Min signal separation (ps)
-
-  static const Float_t fgkRmin;    // Inner radius of the TOF (cm)
-  static const Float_t fgkRmax;    // Outer radius of the TOF (cm)
-  static const Float_t fgkZlenA;   // length (cm) of the A module
-  static const Float_t fgkZlenB;   // length (cm) of the B module
-  static const Float_t fgkZlenC;   // length (cm) of the C module
-  static const Float_t fgkXPad;    // Pad size in the x direction (cm)
-  static const Float_t fgkZPad;    // Pad size in the z direction (cm)
-  static const Float_t fgkMaxhZtof;// Max half z-size of TOF (cm)
+  static const Int_t fgkTimeDiff;      // Min signal separation (ps)
+
+  static const Float_t fgkRmin;        // Inner radius of the TOF (cm)
+  static const Float_t fgkRmax;        // Outer radius of the TOF (cm)
+  static const Float_t fgkZlenA;       // length (cm) of the A module
+  static const Float_t fgkZlenB;       // length (cm) of the B module
+  static const Float_t fgkZlenC;       // length (cm) of the C module
+  static const Float_t fgkXPad;        // Pad size in the x direction (cm)
+  static const Float_t fgkZPad;        // Pad size in the z direction (cm)
+  static const Float_t fgkMaxhZtof;    // Max half z-size of TOF (cm)
+  static const Float_t fgkStripLength; // Strip Length (rho X phi direction) (cm)
+  static const Float_t fgkDeadBndX;    // Dead Boundaries of a Strip along Z direction (width)
+  static const Float_t fgkDeadBndZ;    // Dead Boundaries of a Strip along X direction (length)
+  static const Float_t fgkOverSpc;     // Space available for sensitive layers in radial direction (cm)
 
   static const Float_t fgkxTOF;// Inner TOF Radius used in Reconstruction (cm)
 
index 12513235fdbd675a80785f8460025a39b4c9efe8..ece39a8b5675eaa780e20bcec361b81c0b352271 100644 (file)
@@ -262,24 +262,30 @@ Int_t AliTOFSDigit::GetTotPad() const
   // starting from the digits data.
   //
   
-  Int_t pad = fPadx+AliTOFGeometry::NpadX()*(fPadz-1);
+  Int_t pad = 2*fPadx + fPadz;
+  //Int_t pad = fPadx+AliTOFGeometry::NpadX()*fPadz;
   Int_t before=0;
   
   switch(fPlate){ 
-  case 1: before = 0;
+  case 0:
+    //before = 0;
     break;
-  case 2: before = AliTOFGeometry::NStripC();
+  case 1:
+    before = AliTOFGeometry::NStripC();
     break;
-  case 3: before = AliTOFGeometry::NStripB() + AliTOFGeometry::NStripC();
+  case 2:
+    before = AliTOFGeometry::NStripB() +   AliTOFGeometry::NStripC();
     break;
-  case 4: before = AliTOFGeometry::NStripA() + AliTOFGeometry::NStripB() + AliTOFGeometry::NStripC();
+  case 3:
+    before = AliTOFGeometry::NStripA() +   AliTOFGeometry::NStripB() + AliTOFGeometry::NStripC();
     break;
-  case 5: before = AliTOFGeometry::NStripA() + 2*AliTOFGeometry::NStripB() + AliTOFGeometry::NStripC();
+  case 4:
+    before = AliTOFGeometry::NStripA() + 2*AliTOFGeometry::NStripB() + AliTOFGeometry::NStripC();
     break;
   }
   
-  Int_t strip = fStrip+before;
-  Int_t padTot = AliTOFGeometry::NpadX()*AliTOFGeometry::NpadZ()*(strip-1)+pad;
+  Int_t strip = fStrip + before;
+  Int_t padTot = AliTOFGeometry::NpadXStrip()*strip + pad;
   return padTot;
 }
 
index f8c50a43715a3f235390dad92c00c877f7409183..676cf598b12649e0f63a09bba705215108ee826d 100644 (file)
@@ -136,8 +136,8 @@ void AliTOFSDigitizer::InitParameters()
 {
   // set parameters for detector simulation
   
-  fTimeResolution =0.120;
-  fpadefficiency  =0.99 ;
+  fTimeResolution = 0.080; //0.120; OLD
+  fpadefficiency  = 0.99 ;
   fEdgeEffect     = 2   ;
   fEdgeTails      = 0   ;
   fHparameter     = 0.4 ;
@@ -148,9 +148,12 @@ void AliTOFSDigitizer::InitParameters()
   fEffBoundary    = 0.65;
   fEff2Boundary   = 0.90;
   fEff3Boundary   = 0.08;
-  fResCenter      = 50. ;
+  fAddTRes        = 68. ; // \sqrt{2x20^2 + 15^2 + 2x10^2 + 30^2 + 50^2} (Pb-Pb)
+  //fAddTRes      = 48. ; // \sqrt{2x20^2 + 15^2 + 2x10^2 + 30^2 + 15^2} (p-p)
+  // 30^2+20^2+40^2+50^2+50^2+50^2 = 10400 ps^2 (very old value)
+  fResCenter      = 35. ; //50. ; // OLD
   fResBoundary    = 70. ;
-  fResSlope       = 40. ;
+  fResSlope       = 37. ; //40. ; // OLD
   fTimeWalkCenter = 0.  ;
   fTimeWalkBoundary=0.  ;
   fTimeWalkSlope  = 0.  ;
@@ -212,9 +215,9 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption) {
 
   fRunLoader->LoadKinematics();
   
-  AliTOF *TOF = (AliTOF *) gAlice->GetDetector("TOF");
+  AliTOF *tof = (AliTOF *) gAlice->GetDetector("TOF");
   
-  if (!TOF) {
+  if (!tof) {
     Error("AliTOFSDigitizer","TOF not found");
     return;
   }
@@ -228,24 +231,24 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption) {
 
     fRunLoader->GetEvent(iEvent);
 
-    TTree *TH = fTOFLoader->TreeH ();
-    if (!TH) return;
+    TTree *hitTree = fTOFLoader->TreeH ();
+    if (!hitTree) return;
 
     if (fTOFLoader->TreeS () == 0) fTOFLoader->MakeTree ("S");
     
     //Make branch for digits
-    TOF->MakeBranch("S");
+    tof->MakeBranch("S");
     
     // recreate TClonesArray fSDigits - for backward compatibility
-    if (TOF->SDigits() == 0) {
-      TOF->CreateSDigitsArray();
+    if (tof->SDigits() == 0) {
+      tof->CreateSDigitsArray();
     } else {
-      TOF->RecreateSDigitsArray();
+      tof->RecreateSDigitsArray();
     }
 
-    TOF->SetTreeAddress();
+    tof->SetTreeAddress();
 
-    Int_t version=TOF->IsVersion();
+    Int_t version=tof->IsVersion();
 
     Int_t nselectedHitsinEv=0;
     Int_t ntotalsdigitsinEv=0;
@@ -255,20 +258,20 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption) {
 
     TParticle *particle;
     //AliTOFhit *tofHit;
-    TClonesArray *TOFhits = TOF->Hits();
+    TClonesArray *tofHitArray = tof->Hits();
 
     // create hit map
-    AliTOFHitMap *hitMap = new AliTOFHitMap(TOF->SDigits());
+    AliTOFHitMap *hitMap = new AliTOFHitMap(tof->SDigits());
 
-    TBranch * tofHitsBranch = TH->GetBranch("TOF");
+    TBranch * tofHitsBranch = hitTree->GetBranch("TOF");
 
-    Int_t ntracks = static_cast<Int_t>(TH->GetEntries());
+    Int_t ntracks = static_cast<Int_t>(hitTree->GetEntries());
     for (Int_t track = 0; track < ntracks; track++)
     {
       gAlice->ResetHits();
       tofHitsBranch->GetEvent(track);
       particle = gAlice->GetMCApp()->Particle(track);
-      Int_t nhits = TOFhits->GetEntriesFast();
+      Int_t nhits = tofHitArray->GetEntriesFast();
       // cleaning all hits of the same track in the same pad volume
       // it is a rare event, however it happens
 
@@ -283,33 +286,33 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption) {
        Int_t    vol[5];       // location for a digit
        Float_t  digit[2];     // TOF digit variables
        Int_t tracknum;
-       Float_t Xpad;
-       Float_t Zpad;
+       Float_t dxPad;
+       Float_t dzPad;
        Float_t geantTime;
 
        // fp: really sorry for this, it is a temporary trick to have
        // track length too
        if(version!=6){
-         AliTOFhit *tofHit = (AliTOFhit *) TOFhits->UncheckedAt(hit);
+         AliTOFhit *tofHit = (AliTOFhit *) tofHitArray->UncheckedAt(hit);
          tracknum = tofHit->GetTrack();
          vol[0] = tofHit->GetSector();
          vol[1] = tofHit->GetPlate();
          vol[2] = tofHit->GetStrip();
          vol[3] = tofHit->GetPadx();
          vol[4] = tofHit->GetPadz();
-         Xpad = tofHit->GetDx();
-         Zpad = tofHit->GetDz();
+         dxPad = tofHit->GetDx();
+         dzPad = tofHit->GetDz();
          geantTime = tofHit->GetTof(); // unit [s]
        } else {
-         AliTOFhitT0 *tofHit = (AliTOFhitT0 *) TOFhits->UncheckedAt(hit);
+         AliTOFhitT0 *tofHit = (AliTOFhitT0 *) tofHitArray->UncheckedAt(hit);
          tracknum = tofHit->GetTrack();
          vol[0] = tofHit->GetSector();
          vol[1] = tofHit->GetPlate();
          vol[2] = tofHit->GetStrip();
          vol[3] = tofHit->GetPadx();
          vol[4] = tofHit->GetPadz();
-         Xpad = tofHit->GetDx();
-         Zpad = tofHit->GetDz();
+         dxPad = tofHit->GetDx();
+         dzPad = tofHit->GetDz();
          geantTime = tofHit->GetTof(); // unit [s]
        }
        
@@ -338,8 +341,8 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption) {
            nselectedHitsinEv++;
            if (particle->GetFirstMother() < 0) nHitsFromPrim++; // counts hits due to primary particles
            
-           Float_t xStrip=AliTOFGeometry::XPad()*(vol[3]+0.5-0.5*AliTOFGeometry::NpadX())+Xpad;
-           Float_t zStrip=AliTOFGeometry::ZPad()*(vol[4]+0.5-0.5*AliTOFGeometry::NpadZ())+Zpad;
+           Float_t xStrip=AliTOFGeometry::XPad()*(vol[3]+0.5-0.5*AliTOFGeometry::NpadX())+dxPad;
+           Float_t zStrip=AliTOFGeometry::ZPad()*(vol[4]+0.5-0.5*AliTOFGeometry::NpadZ())+dzPad;
 
            Int_t nActivatedPads = 0, nFiredPads = 0;
            Bool_t isFired[4] = {kFALSE, kFALSE, kFALSE, kFALSE};
@@ -376,7 +379,7 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption) {
                    ntotalupdates++;
                  } else {
                    
-                   TOF->AddSDigit(tracknum, vol, digit);
+                   tof->AddSDigit(tracknum, vol, digit);
                    
                    if(indexOfPad){
                      nnoisesdigits++;
@@ -403,7 +406,7 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption) {
     fTOFLoader->TreeS()->Fill();
     fTOFLoader->WriteSDigits("OVERWRITE");
     
-    if (TOF->SDigits()) TOF->ResetSDigits();
+    if (tof->SDigits()) tof->ResetSDigits();
     
     if (strstr(verboseOption,"all")) {
       cout << "---------------------------------------- \n";
@@ -548,7 +551,7 @@ void AliTOFSDigitizer::SimulateDetectorResponse(Float_t z0, Float_t x0, Float_t
     eff[nActivatedPads-1] = fEffCenter;
     if (gRandom->Rndm() < eff[nActivatedPads-1]) {
       nFiredPads = 1;
-      res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + fResCenter * fResCenter); // 10400=30^2+20^2+40^2+50^2+50^2+50^2  ns;
+      res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + fResCenter * fResCenter); // ns
       isFired[nActivatedPads-1] = kTRUE;
       tofTime[nActivatedPads-1] = gRandom->Gaus(geantTime + fTimeWalkCenter, res[0]);
       averageTime = tofTime[nActivatedPads-1];
@@ -586,7 +589,7 @@ void AliTOFSDigitizer::SimulateDetectorResponse(Float_t z0, Float_t x0, Float_t
     }
     
     (effZ<effX) ? eff[nActivatedPads-1] = effZ : eff[nActivatedPads-1] = effX;
-    (resZ<resX) ? res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resX * resX) : res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resZ * resZ); // 10400=30^2+20^2+40^2+50^2+50^2+50^2  ns
+    (resZ<resX) ? res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resX * resX) : res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resZ * resZ); // ns
     (timeWalkZ<timeWalkX) ? timeWalk[nActivatedPads-1] = 0.001 *  timeWalkZ : timeWalk[nActivatedPads-1] = 0.001 * timeWalkX; // ns
 
 
@@ -604,7 +607,7 @@ void AliTOFSDigitizer::SimulateDetectorResponse(Float_t z0, Float_t x0, Float_t
        nActivatedPads++;
        nPlace[nActivatedPads-1] = nPlace[0] + (3 - 2 * iz) * AliTOFGeometry::NpadX();
        eff[nActivatedPads-1] = effZ;
-       res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resZ * resZ); // 10400=30^2+20^2+40^2+50^2+50^2+50^2 ns 
+       res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resZ * resZ); // ns 
        timeWalk[nActivatedPads-1] = 0.001 * timeWalkZ; // ns
        nTail[nActivatedPads-1] = 2;
        if (fTimeDelayFlag) {
@@ -636,7 +639,7 @@ void AliTOFSDigitizer::SimulateDetectorResponse(Float_t z0, Float_t x0, Float_t
        nActivatedPads++;
        nPlace[nActivatedPads-1] = nPlace[0] - 1;
        eff[nActivatedPads-1] = effX;
-       res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resX * resX); // 10400=30^2+20^2+40^2+50^2+50^2+50^2 ns 
+       res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resX * resX); // ns 
        timeWalk[nActivatedPads-1] = 0.001 * timeWalkX; // ns
        nTail[nActivatedPads-1] = 2;
        if (fTimeDelayFlag) {
@@ -656,7 +659,7 @@ void AliTOFSDigitizer::SimulateDetectorResponse(Float_t z0, Float_t x0, Float_t
            nActivatedPads++;
            nPlace[nActivatedPads-1] = nPlace[0] + (3 - 2 * iz) * AliTOFGeometry::NpadX() - 1;
            eff[nActivatedPads-1] = effX * effZ;
-           (resZ<resX) ? res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resX * resX) : res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resZ * resZ); // 10400=30^2+20^2+40^2+50^2+50^2+50^2 ns
+           (resZ<resX) ? res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resX * resX) : res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resZ * resZ); // ns
            (timeWalkZ<timeWalkX) ? timeWalk[nActivatedPads-1] = 0.001 * timeWalkZ : timeWalk[nActivatedPads-1] = 0.001 * timeWalkX; // ns
            
            nTail[nActivatedPads-1] = 2;
@@ -686,7 +689,7 @@ void AliTOFSDigitizer::SimulateDetectorResponse(Float_t z0, Float_t x0, Float_t
        nActivatedPads++;
        nPlace[nActivatedPads-1] = nPlace[0] + 1;
        eff[nActivatedPads-1] = effX;
-       res[nActivatedPads-1] = 0.001 * (TMath::Sqrt(10400 + resX * resX)); // ns
+       res[nActivatedPads-1] = 0.001 * (TMath::Sqrt(fAddTRes*fAddTRes + resX * resX)); // ns
        timeWalk[nActivatedPads-1] = 0.001 * timeWalkX; // ns
        nTail[nActivatedPads-1] = 2;
        if (fTimeDelayFlag) {
@@ -707,7 +710,7 @@ void AliTOFSDigitizer::SimulateDetectorResponse(Float_t z0, Float_t x0, Float_t
            nActivatedPads++;
            nPlace[nActivatedPads - 1] = nPlace[0] + (3 - 2 * iz) * AliTOFGeometry::NpadX() + 1;
            eff[nActivatedPads - 1] = effX * effZ;
-           (resZ<resX) ? res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resX * resX) : res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resZ * resZ); // 10400=30^2+20^2+40^2+50^2+50^2+50^2 ns
+           (resZ<resX) ? res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resX * resX) : res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resZ * resZ); // ns
            (timeWalkZ<timeWalkX) ? timeWalk[nActivatedPads-1] = 0.001 * timeWalkZ : timeWalk[nActivatedPads-1] = 0.001*timeWalkX; // ns
            nTail[nActivatedPads-1] = 2;
            if (fTimeDelayFlag) {
index 7d484a17191363360bdd88c8a227dd9252fe1e7b..a3b86e7baf119313d988852ba0b3d0c47d169b27 100644 (file)
@@ -53,6 +53,7 @@ public:
   void  SetEffBoundary(Float_t effBoundary)          {fEffBoundary=effBoundary;}
   void  SetEff2Boundary(Float_t eff2Boundary)        {fEff2Boundary=eff2Boundary;}
   void  SetEff3Boundary(Float_t eff3Boundary)        {fEff3Boundary=eff3Boundary;}
+  void  SetAddTRes(Float_t addTRes)                  {fAddTRes=addTRes;}
   void  SetResCenter (Float_t resCenter)             {fResCenter=resCenter;}
   void  SetResBoundary(Float_t resBoundary)          {fResBoundary=resBoundary;}
   void  SetResSlope(Float_t resSlope)                {fResSlope=resSlope;}
@@ -84,6 +85,7 @@ public:
   Float_t  GetEffBoundary()      const {return fEffBoundary;}
   Float_t  GetEff2Boundary()     const {return fEff2Boundary;}
   Float_t  GetEff3Boundary()     const {return fEff3Boundary;}
+  Float_t  GetAddTRes ()         const {return fAddTRes;}
   Float_t  GetResCenter ()       const {return fResCenter;}
   Float_t  GetResBoundary()      const {return fResBoundary;}
   Float_t  GetResSlope()         const {return fResSlope;}
@@ -104,6 +106,9 @@ public:
   Float_t  GetAdcRms()           const {return fAdcRms;}
   
 
+protected:
+
+
 private:
   Int_t   fEvent1;          // lower bound for events to sdigitize
   Int_t   fEvent2;          // upper bound for events to sdigitize
@@ -133,6 +138,8 @@ private:
   Float_t fEffBoundary;     // efficiency at the boundary of the pad
   Float_t fEff2Boundary;    // efficiency value at H2parameter
   Float_t fEff3Boundary;    // efficiency value at K2parameter
+  Float_t fAddTRes;         // additional contribution to 
+                            // the intrinsic MRPC time resolution (ps)
   Float_t fResCenter;       // resolution (ps) in the central region of the pad
   Float_t fResBoundary;     // resolution (ps)  at the boundary of the pad
   Float_t fResSlope;        // slope (ps/K) for neighbouring pad
@@ -157,9 +164,6 @@ private:
   Float_t fAdcMean;     // mean value for the ADC spectrum [bins]
   Float_t fAdcRms;      // rms value for the ADC spectrum [bins]
 
- protected:
-
-
   ClassDef(AliTOFSDigitizer,2)  // creates TOF SDigits
 
 };
index 2994e40766714e213039ef3788e36cf02284772c..c8bbc091172befd9f079f7ce02f605ae23ca75ef 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "AliRun.h"
 #include "AliTOF.h"
+#include "AliTOFGeometry.h"
 #include "AliTOFdigit.h"
 
 ClassImp(AliTOFdigit)
@@ -48,8 +49,8 @@ AliTOFdigit::AliTOFdigit(Int_t *tracks, Int_t *vol,Float_t *digit)
   fSector = vol[0];
   fPlate  = vol[1];
   fStrip  = vol[2];
-  fPadx  = vol[3];
-  fPadz  = vol[4];
+  fPadx   = vol[3];
+  fPadz   = vol[4];
   fTdc    = digit[0];
   fAdc    = digit[1];
 }
@@ -114,33 +115,31 @@ Int_t AliTOFdigit::GetTotPad() const
 // starting from the digits data.
 //
 
-  AliTOF* tof;
-  
-  if(gAlice){
-     tof =(AliTOF*) gAlice->GetDetector("TOF");
-  }else{
-     printf("AliTOFdigit::GetTotPad - No AliRun object present, exiting");
-     return 0;
-  }
-  
-  Int_t pad = fPadx+tof->GetNpadX()*(fPadz-1);
   Int_t before=0;
 
   switch(fPlate){ 
-  case 1: before = 0;
-          break;
-  case 2: before = tof->GetNStripC();
-          break;
-  case 3: before = tof->GetNStripB() + tof->GetNStripC();
-          break;
-  case 4: before = tof->GetNStripA() + tof->GetNStripB() + tof->GetNStripC();
-          break;
-  case 5: before = tof->GetNStripA() + 2*tof->GetNStripB() + tof->GetNStripC();
-          break;
+  case 0:
+    //before = 0;
+    break;
+  case 1:
+    before = AliTOFGeometry::NStripC();
+    break;
+  case 2:
+    before = AliTOFGeometry::NStripC() +   AliTOFGeometry::NStripB();
+    break;
+  case 3:
+    before = AliTOFGeometry::NStripC() +   AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
+    break;
+  case 4:
+    before = AliTOFGeometry::NStripC() + 2*AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
+    break;
   }
   
-  Int_t strip = fStrip+before;
-  Int_t padTot = tof->GetPadXStr()*(strip-1)+pad;
+  Int_t pad = 2*fPadx + fPadz;
+  //Int_t pad = fPadx+AliTOFGeometry::NpadX()*fPadz;
+  Int_t strip  = fStrip + before;
+  Int_t padTot = AliTOFGeometry::NpadXStrip()*strip + pad;
+
   return padTot;
 }
 
@@ -210,4 +209,3 @@ out << "Padx" << digit.fPadx << ", Padz " << digit.fPadz << endl;
 out << "TDC " << digit.fTdc << ", ADC "<< digit.fAdc << endl;
 return out;
 }
-
index 077446894b4aba468fcd0a3cf74b5f49ab33d4c2..9f68bce356914b533bf571bd5fcb6b2f7753802d 100644 (file)
@@ -51,6 +51,7 @@
 #include "AliConst.h"
 #include "AliRun.h"
 #include "AliTOFv4T0.h"
+#include "AliTOFGeometry.h"
 #include "AliMC.h"
  
 ClassImp(AliTOFv4T0)
@@ -109,16 +110,16 @@ void AliTOFv4T0::BuildGeometry()
   top = gAlice->GetGeometry()->GetNode("alice");
   
   // Position the different copies
-  const Float_t krTof  =(fRmax+fRmin)/2;
-  const Float_t khTof  = fRmax-fRmin;
-  const Int_t   kNTof = fNTof;
-  const Float_t kPi   = TMath::Pi();
+  const Float_t krTof  =(AliTOFGeometry::Rmax()+AliTOFGeometry::Rmin())/2;
+  const Float_t khTof  = AliTOFGeometry::Rmax()-AliTOFGeometry::Rmin();
+  const Int_t   kNTof  = AliTOFGeometry::NSectors();
+  const Float_t kPi    = TMath::Pi();
   const Float_t kangle = 2*kPi/kNTof;
   Float_t ang;
   
   // define offset for nodes
-  Float_t zOffsetC = fZtof - fZlenC*0.5;
-  Float_t zOffsetB = fZtof - fZlenC - fZlenB*0.5;
+  Float_t zOffsetC = AliTOFGeometry::MaxhZtof() - AliTOFGeometry::ZlenC()*0.5;
+  Float_t zOffsetB = AliTOFGeometry::MaxhZtof() - AliTOFGeometry::ZlenC() - AliTOFGeometry::ZlenB()*0.5;
   Float_t zOffsetA = 0.;
   // Define TOF basic volume
   
@@ -126,11 +127,11 @@ void AliTOFv4T0::BuildGeometry()
   char nodeName3[7], nodeName4[7], rotMatNum[7];
   
   new TBRIK("S_TOF_C","TOF box","void",
-            fStripLn*0.5,khTof*0.5,fZlenC*0.5);
+            AliTOFGeometry::StripLength()*0.5,khTof*0.5,AliTOFGeometry::ZlenC()*0.5);
   new TBRIK("S_TOF_B","TOF box","void",
-            fStripLn*0.5,khTof*0.5,fZlenB*0.5);
+            AliTOFGeometry::StripLength()*0.5,khTof*0.5,AliTOFGeometry::ZlenB()*0.5);
   new TBRIK("S_TOF_A","TOF box","void",
-            fStripLn*0.5,khTof*0.5,fZlenA*0.5);
+            AliTOFGeometry::StripLength()*0.5,khTof*0.5,AliTOFGeometry::ZlenA()*0.5);
   
   for (Int_t nodeNum=1;nodeNum<19;nodeNum++){
     
@@ -215,7 +216,7 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   Int_t    idrotm[100];
   Int_t    nrot = 0;
 
-  Float_t radius = fRmin+2.;//cm
+  Float_t radius = AliTOFGeometry::Rmin()+2.;//cm
 
   
   par[0] =  xtof * 0.5;
@@ -256,20 +257,20 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   gMC->Gspos("FTOA", 0, "BTO3", 0, zcor3,  0, idrotm[0], "ONLY");
   
 
-  Float_t db = 0.5;//cm
+  Float_t db = 0.5; // cm
   Float_t xFLT, xFST, yFLT, zFLTA, zFLTB, zFLTC;
   
-  xFLT = fStripLn;
+  xFLT = AliTOFGeometry::StripLength();
   yFLT = ytof;
   zFLTA = zlenA;
   zFLTB = zlenB;
   zFLTC = zlenC;
   
-  xFST = xFLT-fDeadBndX*2;//cm
+  xFST = xFLT - AliTOFGeometry::DeadBndX()*2; // cm
   
   // Sizes of MRPC pads
   
-  Float_t yPad = 0.505;//cm 
+  Float_t yPad = 0.505; //cm
   
   // Large not sensitive volumes with Insensitive Freon
   par[0] = xFLT*0.5;
@@ -297,7 +298,7 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   // fp to be checked
   const Float_t khAlWall = 0.11;
   par[0] = xFLT*0.5;
-  par[1] = khAlWall/2.;//cm
+  par[1] = khAlWall/2.; // cm
   ycoor = -yFLT/2 + par[1];
   par[2] = (zFLTA *0.5);
   gMC->Gsvolu("FALA", "BOX ", idtmed[508], par, 3); // Alluminium
@@ -314,12 +315,12 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   
   ///////////////// Detector itself //////////////////////
   
-  const Float_t  kdeadBound  =  fDeadBndZ; //cm non-sensitive between the pad edge 
+  const Float_t  kdeadBound  =  AliTOFGeometry::DeadBndZ(); //cm non-sensitive between the pad edge 
   //and the boundary of the strip
-  const Int_t    knx    = fNpadX;          // number of pads along x
-  const Int_t    knz    = fNpadZ;          // number of pads along z
+  const Int_t    knx    = AliTOFGeometry::NpadX();  // number of pads along x
+  const Int_t    knz    = AliTOFGeometry::NpadZ();  // number of pads along z
   
-  Float_t zSenStrip  = fZpad*fNpadZ;//cm
+  Float_t zSenStrip  = AliTOFGeometry::ZPad() * AliTOFGeometry::NpadZ(); // cm
   Float_t stripWidth = zSenStrip + 2*kdeadBound;
   
   par[0] = xFLT*0.5;
@@ -333,7 +334,7 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   const Float_t khpcby = 0.08    ;   // heigth of PCB   Layer
   const Float_t khmyly = 0.035   ;   // heigth of MYLAR Layer
   const Float_t khgraphy = 0.02  ;   // heigth of GRAPHITE Layer
-  const Float_t khglasseiy = 0.135;   // 0.6 Ext. Glass + 1.1 i.e. (Int. Glass/2) (mm)
+  const Float_t khglasseiy = 0.135;  // 0.6 Ext. Glass + 1.1 i.e. (Int. Glass/2) (mm)
   const Float_t khsensmy = 0.11  ;   // heigth of Sensitive Freon Mixture
   const Float_t kwsensmz = 2*3.5 ;   // cm
   const Float_t klsensmx = 48*2.5;   // cm
@@ -348,7 +349,7 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   const Float_t klstripx = 122.;
   
   Float_t parfp[3]={klstripx*0.5,khstripy*0.5,kwstripz*0.5};
-  // Coordinates of the strip center in the strip reference frame; 
+  // Coordinates of the strip center in the strip reference frame;
   // used for positioninG internal strip volumes
   Float_t posfp[3]={0.,0.,0.};  
   
@@ -460,7 +461,7 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
     ang /= kRaddeg;
     Float_t zpos = tan(ang)*radius;
     Float_t ypos= fTOFGeometry->GetHeights(2,istrip);
-    gMC->Gspos("FSTR",fNStripA-istrip,"FLTA",0.,ypos, zpos,idrotm[0],  "ONLY");
+    gMC->Gspos("FSTR",AliTOFGeometry::NStripA()-istrip,"FLTA",0.,ypos, zpos,idrotm[0],  "ONLY");
     if(fDebug>=1) {
       printf("y = %f,  z = %f, , z coord = %f, Rot ang = %f, St. %2i \n",ypos,zpos,tan(ang)*radius ,ang*kRaddeg,istrip);
     }
@@ -501,7 +502,7 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   ////////// Layers after strips /////////////////
   // Al Layer thickness (2.3mm) factor 0.7
   
-  Float_t overSpace = fOverSpc;//cm
+  Float_t overSpace = AliTOFGeometry::OverSpc();//cm
   
   par[0] = xFLT*0.5;
   par[1] = 0.115*0.7; // factor 0.7
@@ -999,37 +1000,37 @@ void AliTOFv4T0::StepManager()
 
     plate = -1;  
 
-    if (TMath::Abs(z) <=  fZlenA*0.5)  plate = 2; //3; // AdC
-    if (z < (fZlenA*0.5+fZlenB) && 
-        z >  fZlenA*0.5)               plate = 1; //4; // AdC
-    if (z >-(fZlenA*0.5+fZlenB) &&
-        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 (TMath::Abs(z) <=  AliTOFGeometry::ZlenA()*0.5)  plate = 2;
+    if (z < (AliTOFGeometry::ZlenA()*0.5+AliTOFGeometry::ZlenB()) && 
+        z >  AliTOFGeometry::ZlenA()*0.5)               plate = 1;
+    if (z >-(AliTOFGeometry::ZlenA()*0.5+AliTOFGeometry::ZlenB()) &&
+        z < -AliTOFGeometry::ZlenA()*0.5)               plate = 3;
+    if (z > (AliTOFGeometry::ZlenA()*0.5+AliTOFGeometry::ZlenB()))     plate = 0;
+    if (z <-(AliTOFGeometry::ZlenA()*0.5+AliTOFGeometry::ZlenB()))     plate = 4;
 
 
-    if (plate==0) strip=fTOFGeometry->NStripC()-strip; // AdC
-    else if (plate==1) strip=fTOFGeometry->NStripB()-strip; // AdC
-    else strip--; // AdC
+    if (plate==0) strip=fTOFGeometry->NStripC()-strip;
+    else if (plate==1) strip=fTOFGeometry->NStripB()-strip;
+    else strip--;
  
-    //Apply ALICE conventions for volume numbering increasing with theta, phi 
+    //Apply ALICE conventions for volume numbering increasing with theta, phi
 
     if (plate==3 || plate==4){
-      padx=fTOFGeometry->NpadX()-padx; // SA
-      padz=fTOFGeometry->NpadZ()-padz; // AdC
+      padx=fTOFGeometry->NpadX()-padx;
+      padz=fTOFGeometry->NpadZ()-padz;
       xpad[0]=-xpad[0];      
       xpad[2]=-xpad[2];      
     }
     else {
-     padx--; // AdC
-     padz--; // AdC
+     padx--;
+     padz--;
     }
 
 
 
     phi = pos.Phi();
-    if (phi>=0.) phid = phi*kRaddeg; //+180.; // AdC
-    else phid = phi*kRaddeg + 360.; // AdC
+    if (phi>=0.) phid = phi*kRaddeg;
+    else phid = phi*kRaddeg + 360.;
 
     sector = Int_t (phid/20.);
 
index 7385144409b247620c9ece9436b3bf13de6f3fba..854af2208e1b1b0a99f20d5b82573c97f2526e76 100644 (file)
@@ -9,29 +9,32 @@
 #pragma link off all functions;
  
 #pragma link C++ class  AliTOF+;
-#pragma link C++ class  AliTOFT0+;
-#pragma link C++ class  AliTOFPID+;
-#pragma link C++ class  AliTOFProb+;
 #pragma link C++ class  AliTOFGeometry+;
 #pragma link C++ class  AliTOFv4T0+;
-
 #pragma link C++ class  AliTOFhit+;
 #pragma link C++ class  AliTOFhitT0+;
 
-#pragma link C++ class  AliTOFdigit+;
-#pragma link C++ class  AliTOFRoc+;
-#pragma link C++ class  AliTOFRawSector+;
-#pragma link C++ class  AliTOFRawDigit+;
-#pragma link C++ class  AliTOFDigitizer+;
+#pragma link C++ class  AliTOFT0+;
+
+#pragma link C++ class  AliTOFHitMap+;
+
+#pragma link C++ class  AliTOFSDigit+;
 #pragma link C++ class  AliTOFSDigitizer+;
+
 #pragma link C++ class  AliTOFMerger+;
-#pragma link C++ class  AliTOFSDigit+;
-#pragma link C++ class  AliTOFHitMap+;
-#pragma link C++ class  AliTOFtrack+;
 #pragma link C++ class  AliTOFDigitMap+;
 
-#pragma link C++ class  AliTOFpidESD+;
+#pragma link C++ class  AliTOFdigit+;
+#pragma link C++ class  AliTOFDigitizer+;
+
+#pragma link C++ class  AliTOFDDLRawData+;
+
+#pragma link C++ class  AliTOFtrack+;
 #pragma link C++ class  AliTOFtracker+;
 #pragma link C++ class  AliTOFReconstructor+;
+#pragma link C++ class  AliTOFpidESD+;
+
+#pragma link C++ class  AliTOFPID+;
+#pragma link C++ class  AliTOFProb+;
 
 #endif
index a57cb898335a5d0111916ef2012e6fabcb9a3c1e..5819ad19430e7763fd110479dbd545a70ec4aa3b 100644 (file)
@@ -1,12 +1,18 @@
-SRCS  = AliTOF.cxx  AliTOFGeometry.cxx  AliTOFv4T0.cxx  AliTOFhit.cxx  AliTOFhitT0.cxx  \
-        AliTOFPID.cxx  AliTOFT0.cxx  AliTOFdigit.cxx  AliTOFRawSector.cxx  AliTOFRoc.cxx  \
-        AliTOFRawDigit.cxx  AliTOFDigitizer.cxx  AliTOFSDigitizer.cxx  AliTOFMerger.cxx  \
-        AliTOFSDigit.cxx  AliTOFHitMap.cxx  AliTOFtrack.cxx  AliTOFProb.cxx  AliTOFDigitMap.cxx  \
-        AliTOFpidESD.cxx  AliTOFtracker.cxx  AliTOFReconstructor.cxx
+SRCS  = AliTOF.cxx  AliTOFGeometry.cxx  AliTOFv4T0.cxx  \
+       AliTOFhit.cxx  AliTOFhitT0.cxx  \
+       AliTOFT0.cxx  \
+       AliTOFHitMap.cxx  \
+       AliTOFSDigit.cxx  AliTOFSDigitizer.cxx  \
+       AliTOFMerger.cxx  AliTOFDigitMap.cxx  \
+       AliTOFdigit.cxx  AliTOFDigitizer.cxx  \
+       AliTOFDDLRawData.cxx  \
+        AliTOFtrack.cxx  AliTOFtracker.cxx  AliTOFReconstructor.cxx  \
+       AliTOFpidESD.cxx  \
+       AliTOFPID.cxx  AliTOFProb.cxx
 
 
 HDRS:= $(SRCS:.cxx=.h)
 
 DHDR=TOFLinkDef.h
 
-EINCLUDE:=$(ALICE)/geant3/TGeant3
+EINCLUDE:=$(ALICE)/geant3/TGeant3 RAW