/*
$Log$
+Revision 1.16 2006/04/20 22:30:50 hristov
+Coding conventions (Annalisa)
+
+Revision 1.15 2006/04/16 22:29:05 hristov
+Coding conventions (Annalisa)
+
+Revision 1.14 2006/04/05 08:35:38 hristov
+Coding conventions (S.Arcelli, C.Zampolli)
+
+Revision 1.13 2006/03/12 14:37:54 arcelli
+ Changes for TOF Reconstruction using TGeo
+
+Revision 1.12 2006/02/28 10:38:00 decaro
+AliTOFGeometry::fAngles, AliTOFGeometry::fHeights, AliTOFGeometry::fDistances arrays: dimension definition in the right location
+
+Revision 1.11 2005/12/15 14:17:29 decaro
+Correction of some parameter values
+
+Revision 1.10 2005/12/15 08:55:32 decaro
+New TOF geometry description (V5) -G. Cara Romeo and A. De Caro
+
+Revision 1.9.1 2005/07/19 A. De Caro
+ Created daughter-classes AliTOFGeometryV4 and AliTOFGeometryV5
+ => moved global methods IsInsideThePad, DistanceToPad,
+ GetPlate, GetSector, GetStrip, GetPadX, GetPadZ,
+ GetX, GetY, GetZ, GetPadDx, GetPadDy and GetPadDz
+ in daughter-classes
+
+Revision 1.9 2005/10/20 12:41:35 hristov
+Implementation of parallel tracking. It is not the default version, one can use it passing option MI from AliReconstruction to TOF (M.Ivanov)
+
+Revision 1.8 2004/11/29 08:28:01 decaro
+Introduction of a new TOF constant (i.e. TDC bin width)
+
+Revision 1.7 2004/11/05 07:20:08 decaro
+TOF library splitting and conversion of some printout messages in AliLog schema (T.Kuhr)
+
+Revision 1.6 2004/06/15 15:27:59 decaro
+TOF raw data: preliminary implementation and style changes
+
+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
+
+Revision 1.3 2003/12/29 18:40:39 hristov
+Copy/paste error corrected
+
+Revision 1.2 2003/12/29 17:26:01 hristov
+Using enum to initaialize static ints in the header file, the initialization of static floats moved to the implementation file
+
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.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>
-#include <Riostream.h>
///////////////////////////////////////////////////////////////////////////////
// //
// TOF Geometry class //
// //
///////////////////////////////////////////////////////////////////////////////
-#include "AliConst.h"
#include "AliTOFGeometry.h"
ClassImp(AliTOFGeometry)
-static const Int_t fgkTimeDiff = 25000;// Min signal separation (ps)
-
-static const Float_t fgkRmin = 370.; // Inner radius of the TOF (cm)
-static const Float_t fgkRmax = 399; // Outer radius of the TOF (cm)
-static const Float_t fgkZlenA = 106.0;// length (cm) of the A module
-static const Float_t fgkZlenB = 141.0;// length (cm) of the B module
-static const Float_t fgkZlenC = 177.5;// length (cm) of the C module
-static const Float_t fgkXPad = 2.5; // Pad size in the x direction (cm)
-static const Float_t fgkZPad = 3.5; // Pad size in the z direction (cm)
-static const Float_t fgkMaxhZtof = 371.5;// Max half z-size of TOF (cm)
+const Int_t AliTOFGeometry::fgkTimeDiff = 25000; // Min signal separation (ps)
+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)
-static const Float_t fgkSigmaForTail1= 2.;//Sig1 for simulation of TDC tails
-static const Float_t fgkSigmaForTail2= 0.5;//Sig2 for simulation of TDC tails
-static const Float_t fgkSpeedOfLight = 0.299792458;// c (10^9 m/s)
-static const Float_t fgkPionMass = 0.13957;// pion mass (Gev/c^2)
-static const Float_t fgkKaonMass = 0.49368;// kaon mass (Gev/c^2)
-static const Float_t fgkProtonMass = 0.93827;// proton mass (Gev/c^2)
-static const Float_t fgkElectronMass = 0.00051;// electron mass (Gev/c^2)
-static const Float_t fgkMuonMass = 0.10566;// muon mass (Gev/c^2)
+const Float_t AliTOFGeometry::fgkStripLength = 122.;// Strip Length (rho X phi direction) (cm)
+const Float_t AliTOFGeometry::fgkSigmaForTail1= 2.; //Sig1 for simulation of TDC tails
+const Float_t AliTOFGeometry::fgkSigmaForTail2= 0.5;//Sig2 for simulation of TDC tails
-static const Float_t fgkDprecMin = 0.0000075;//num.prec.tolerance on Thmin
-static const Float_t fgkDprecMax = 0.0000100;//num.prec.tolerance on Thma
-static const Float_t fgkDprecCen = 0.0000005;//num.prec.tolerance on <Theta>
+const Float_t AliTOFGeometry::fgkTdcBin = 24.4; // time-window for the TDC bins [ps]
//_____________________________________________________________________________
-AliTOFGeometry::AliTOFGeometry()
+AliTOFGeometry::AliTOFGeometry():
+ fNStripC(19), // number of strips in C type module
+ fZlenA(106.0), // length (cm) of the A module
+ fZlenB(141.0), // length (cm) of the B module
+ fZlenC(177.5), // length (cm) of the C module
+ fMaxhZtof(371.5), // Max half z-size of TOF (cm)
+ fRmin(370.), // Inner radius of the TOF (cm)
+ fRmax(399.), // Outer radius of the TOF (cm)
+ fxTOF(371.), // Inner radius of the TOF for Reconstruction (cm)
+ fHoles(0), // Flag for Holes
+ fPhiSec(20.) // sector Phi width (deg)
{
//
// AliTOFGeometry default constructor
//
// Initialize strip Tilt Angles and Heights
//
- // Strips Tilt Angles
- const Float_t angles[fgkNPlates][fgkMaxNstrip] ={
+ fPhiSec = 360./kNSectors;
+
+ Float_t const kangles[kNPlates][kMaxNstrip] ={
{44.494, 43.725, 42.946, 42.156, 41.357, 40.548, 39.729, 38.899,
38.060, 37.211, 36.353, 35.484, 34.606, 33.719, 32.822, 31.916,
//Strips Heights
- const Float_t heights[fgkNPlates][fgkMaxNstrip]= {
+ Float_t const kheights[kNPlates][kMaxNstrip]= {
{-5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5,
-5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5 },
{-5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5,
-5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5, -5.5 }};
+ for (Int_t iplate = 0; iplate < kNPlates; iplate++) {
+ for (Int_t istrip = 0; istrip < kMaxNstrip; istrip++) {
+ fAngles[iplate][istrip] = kangles[iplate][istrip];
+ fHeights[iplate][istrip] = kheights[iplate][istrip];
+ }
+ }
- // Deposit in fAngles, fHeights
-
- for (Int_t iplate = 0; iplate < fgkNPlates; iplate++) {
- for (Int_t istrip = 0; istrip < fgkMaxNstrip; istrip++) {
- fAngles[iplate][istrip] = angles[iplate][istrip];
- fHeights[iplate][istrip] = heights[iplate][istrip];
- }
- }
-
- fPhiSec = 360./fgkNSectors;
}
//_____________________________________________________________________________
-void AliTOFGeometry::GetPos(Int_t *det, Float_t *pos)
+void AliTOFGeometry::GetPosPar(Int_t *det, Float_t *pos) const
{
//
// Returns space point coor (x,y,z) (cm) for Detector
}
//_____________________________________________________________________________
-void AliTOFGeometry::GetDetID( Float_t *pos, Int_t *det)
+void AliTOFGeometry::GetDetID( Float_t *pos, Int_t *det) const
{
//
// Returns Detector Indices (iSect,iPlate,iStrip,iPadX,iPadZ)
}
//_____________________________________________________________________________
-Float_t AliTOFGeometry::GetX(Int_t *det)
-{
- //
- // Returns X coordinate (cm)
- //
-
- Int_t isector = det[0];
- Int_t iplate = det[1];
- Int_t istrip = det[2];
- Int_t ipadz = det[3];
- Int_t ipadx = det[4];
-
- // Find out distance d on the plane wrt median phi:
- Float_t d = (ipadx+0.5)*fgkXPad-(fgkNpadX*fgkXPad)*0.5;
-
- // The radius r in xy plane:
- Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+
- (ipadz-0.5)*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25;
-
- // local azimuthal angle in the sector philoc
- Float_t philoc = TMath:: ATan(d/r);
-
- // azimuthal angle in the global frame phi
- Float_t phi = philoc*kRaddeg+(isector+0.5 )*fPhiSec;
-
- Float_t xCoor = r/TMath::Cos(philoc)*TMath::Cos(phi/kRaddeg);
- return xCoor;
-
-}
-//_____________________________________________________________________________
-Float_t AliTOFGeometry::GetY(Int_t *det)
-{
- //
- // Returns Y coordinate (cm)
- //
-
- Int_t isector = det[0];
- Int_t iplate = det[1];
- Int_t istrip = det[2];
- Int_t ipadz = det[3];
- Int_t ipadx = det[4];
-
- // Find out distance d on the plane wrt median phi:
- Float_t d = (ipadx+0.5)*fgkXPad-(fgkNpadX*fgkXPad)*0.5;
-
- // The radius r in xy plane:
- Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+
- (ipadz-0.5)*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25;
-
- // local azimuthal angle in the sector philoc
- Float_t philoc = TMath:: ATan(d/r);
-
- // azimuthal angle in the global frame phi
- Float_t phi = philoc*kRaddeg+(isector+0.5 )*fPhiSec;
-
- Float_t yCoor = r/TMath::Cos(philoc)*TMath::Sin(phi/kRaddeg);
- return yCoor;
-
-}
-
-//_____________________________________________________________________________
-Float_t AliTOFGeometry::GetZ(Int_t *det)
-{
- //
- // Returns Z coordinate (cm)
- //
-
- Int_t iplate = det[1];
- Int_t istrip = det[2];
- Int_t ipadz = det[3];
-
-
- // The radius r in xy plane:
- Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip];
-
- Float_t zCoor = r*TMath::Tan(0.5*TMath::Pi()-GetStripTheta(iplate, istrip))-
- (ipadz-0.5)*fgkZPad*TMath::Cos(fAngles[iplate][istrip]/kRaddeg);
- return zCoor;
-
-}
-//_____________________________________________________________________________
-Int_t AliTOFGeometry::GetSector(Float_t *pos)
-{
- //
- // Returns the Sector index
- //
-
- Int_t iSect = -1;
-
- Float_t x = pos[0];
- Float_t y = pos[1];
-
- Float_t phi = TMath::ATan2(y,x);
- if(phi<0.) phi=2.*TMath::Pi()+phi;
- iSect = (Int_t) (phi*kRaddeg/fPhiSec);
-
- return iSect;
-
-}
-//_____________________________________________________________________________
-Int_t AliTOFGeometry::GetPadX(Float_t *pos)
-{
- //
- // Returns the Pad index along X
- //
-
- Int_t iPadX = -1;
-
- Float_t x = pos[0];
- Float_t y = pos[1];
- Float_t z = pos[2];
-
- Int_t isector = GetSector(pos);
- if(isector == -1){
- cout << "Detector Index could not be determined" << endl;
- return iPadX;}
- Int_t iplate = GetPlate(pos);
- if(iplate == -1){
- cout << "Detector Index could not be determined" << endl;
- return iPadX;}
- Int_t istrip = GetStrip(pos);
- if(istrip == -1){
- cout << "Detector Index could not be determined" << endl;
- return iPadX;}
-
-
- Float_t rho=TMath::Sqrt(x*x+y*y);
- Float_t phi = TMath::ATan2(y,x);
- if(phi<0.) phi=2.*TMath::Pi()+phi;
-
- // Get the local angle in the sector philoc
- Float_t philoc = phi*kRaddeg-(isector+0.5)*fPhiSec;
- philoc*=TMath::Pi()/180.;
- // theta projected on the median of the sector
- Float_t theta = TMath::ATan2(rho*TMath::Cos(philoc),z);
- // The radius r in xy plane:
- Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+
- (theta-GetStripTheta(iplate, istrip))/
- (GetMaxStripTheta(iplate, istrip)-GetMinStripTheta(iplate, istrip))
- * 2.*fgkZPad*TMath::Sin(fAngles[iplate][istrip]/kRaddeg)-0.25;
-
- // Find out distance projected onto the strip plane
- Float_t d = (r*TMath::Tan(philoc)+(fgkNpadX*fgkXPad)*0.5);
-
- iPadX = (Int_t) ( d/fgkXPad);
- return iPadX;
-
-}
-//_____________________________________________________________________________
-Int_t AliTOFGeometry::GetPlate(Float_t *pos)
-{
- //
- // Returns the Plate index
- //
- Int_t iPlate=-1;
-
- Int_t isector = GetSector(pos);
- if(isector == -1){
- cout << "Detector Index could not be determined" << endl;
- return iPlate;}
-
- Float_t x = pos[0];
- Float_t y = pos[1];
- Float_t z = pos[2];
-
- Float_t rho=TMath::Sqrt(x*x+y*y);
- Float_t phi=TMath::ATan2(y,x);
- if(phi<0) phi=2.*TMath::Pi()+phi;
- // Get the local angle in the sector philoc
- Float_t philoc = phi*kRaddeg-(isector+0.5)*fPhiSec;
- philoc*=TMath::Pi()/180.;
- // theta projected on the median of the sector
- Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z);
-
- for (Int_t i=0; i<fgkNPlates; i++){
- if ( GetMaxPlateTheta(i) >= theta &&
- GetMinPlateTheta(i) <= theta)iPlate=i;
- }
-
- return iPlate;
-
-}
-//_____________________________________________________________________________
-Int_t AliTOFGeometry::GetStrip(Float_t *pos)
-{
- //
- // Returns the Strip index
- //
-
- Int_t iStrip=-1;
-
-
- Int_t isector = GetSector(pos);
- if(isector == -1){
- cout << "Detector Index could not be determined" << endl;
- return iStrip;}
- Int_t iplate = GetPlate(pos);
- if(iplate == -1){
- cout << "Detector Index could not be determined" << endl;
- return iStrip;}
-
-
- Float_t x = pos[0];
- Float_t y = pos[1];
- Float_t z = pos[2];
-
- Int_t nstrips=0;
- if(iplate==0 || iplate == 4)nstrips=fgkNStripC;
- if(iplate==1 || iplate == 3)nstrips=fgkNStripB;
- if(iplate==2) nstrips=fgkNStripA;
-
- Float_t rho=TMath::Sqrt(x*x+y*y);
- Float_t phi=TMath::ATan2(y,x);
- if(phi<0) phi=2.*TMath::Pi()+phi;
- // Get the local angle in the sector philoc
- Float_t philoc = phi*kRaddeg-(isector+0.5)*fPhiSec;
- philoc*=TMath::Pi()/180.;
- // theta projected on the median of the sector
- Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z);
-
- for (Int_t istrip=0; istrip<nstrips; istrip++){
-
- if(
- GetMaxStripTheta(iplate,istrip) >= theta
- &&
- GetMinStripTheta(iplate,istrip) <= theta ) iStrip = istrip;
-
- }
-
- return iStrip;
-}
-//_____________________________________________________________________________
-Int_t AliTOFGeometry::GetPadZ(Float_t *pos)
-{
- //
- // Returns the Pad index along Z
- //
- Int_t iPadZ = -1;
-
- Int_t isector = GetSector(pos);
- if(isector == -1){
- cout << "Detector Index could not be determined" << endl;
- return iPadZ;}
- Int_t iplate = GetPlate(pos);
- if(iplate == -1){
- cout << "Detector Index could not be determined" << endl;
- return iPadZ;}
- Int_t istrip = GetStrip(pos);
- if(istrip == -1){
- cout << "Detector Index could not be determined" << endl;
- return iPadZ;}
-
-
- Float_t x = pos[0];
- Float_t y = pos[1];
- Float_t z = pos[2];
-
- Float_t rho=TMath::Sqrt(x*x+y*y);
- Float_t phi=TMath::ATan2(y,x);
- if(phi<0) phi=2.*TMath::Pi()+phi;
- Float_t philoc = phi*kRaddeg-(isector+0.5)*fPhiSec;
- philoc*=TMath::Pi()/180.;
- Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z);
-
- if (theta >= GetStripTheta(iplate, istrip))iPadZ=1;
- else iPadZ=0;
-
- return iPadZ;
-}
-//_____________________________________________________________________________
-Float_t AliTOFGeometry::GetMinPlateTheta(Int_t iPlate)
-{
- //
- // Returns the minimum theta angle of a given plate iPlate (rad)
- //
-
-
- Int_t index=0;
-
- Float_t delta =0.;
- if(iPlate==0)delta = -1. ;
- if(iPlate==1)delta = -0.5;
- if(iPlate==3)delta = +0.5;
- if(iPlate==4)delta = +1. ;
-
- Float_t z=(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][index]/kRaddeg)+delta;
- Float_t r=(fgkRmin+fgkRmax)/2.+fHeights[iPlate][index];
- z =z+fgkZPad*TMath::Cos(fAngles[iPlate][index]/kRaddeg);
- r =r-fgkZPad*TMath::Sin(fAngles[iPlate][index]/kRaddeg);
-
- Float_t thmin = 0.5*TMath::Pi()-TMath::ATan(z/r)-fgkDprecMin;
- return thmin;
-
-}
-//_____________________________________________________________________________
-Float_t AliTOFGeometry::GetMaxPlateTheta(Int_t iPlate)
-{
- //
- // Returns the maximum theta angle of a given plate iPlate (rad)
-
- Int_t index=0;
- if(iPlate==0 ||iPlate == 4)index=fgkNStripC-1;
- if(iPlate==1 ||iPlate == 3)index=fgkNStripB-1;
- if(iPlate==2) index=fgkNStripA-1;
-
- Float_t delta =0.;
- if(iPlate==0)delta = -1. ;
- if(iPlate==1)delta = -0.5;
- if(iPlate==3)delta = +0.5;
- if(iPlate==4)delta = +1. ;
-
- Float_t z=(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][index]/kRaddeg)+delta;
- Float_t r=(fgkRmin+fgkRmax)/2.+fHeights[iPlate][index];
- z =z-fgkZPad*TMath::Cos(fAngles[iPlate][index]/kRaddeg);
- r= r+fgkZPad*TMath::Sin(fAngles[iPlate][index]/kRaddeg);
-
- Float_t thmax = 0.5*TMath::Pi()-TMath::ATan(z/r)+fgkDprecMax;
- return thmax;
-
-}
-//_____________________________________________________________________________
-Float_t AliTOFGeometry::GetMaxStripTheta(Int_t iPlate, Int_t iStrip)
-{
- //
- // Returns the maximum theta angle of a given strip iStrip (rad)
- //
-
-
- Float_t delta =0.;
- if(iPlate==0)delta = -1. ;
- if(iPlate==1)delta = -0.5;
- if(iPlate==3)delta = +0.5;
- if(iPlate==4)delta = +1. ;
-
- Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip];
- Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta;
- z = z-fgkZPad*TMath::Cos(fAngles[iPlate][iStrip]/kRaddeg);
- r = r+fgkZPad*TMath::Sin(fAngles[iPlate][iStrip]/kRaddeg);
- Float_t thmax =0.5*TMath::Pi()-TMath::ATan(z/r)+fgkDprecMax;
- return thmax;
-
-}
-
-//_____________________________________________________________________________
-Float_t AliTOFGeometry::GetMinStripTheta(Int_t iPlate, Int_t iStrip)
-{
- //
- // Returns the minimum theta angle of a given Strip iStrip (rad)
- //
-
-
- Float_t delta =0.;
- if(iPlate==0)delta = -1. ;
- if(iPlate==1)delta = -0.5;
- if(iPlate==3)delta = +0.5;
- if(iPlate==4)delta = +1. ;
-
-
- Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip];
- Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta;
- z =z+fgkZPad*TMath::Cos(fAngles[iPlate][iStrip]/kRaddeg);
- r =r-fgkZPad*TMath::Sin(fAngles[iPlate][iStrip]/kRaddeg);
- Float_t thmin =0.5*TMath::Pi()-TMath::ATan(z/r)-fgkDprecMin;
-
- return thmin;
-
-}
-
-
-//_____________________________________________________________________________
-Float_t AliTOFGeometry::GetStripTheta(Int_t iPlate, Int_t iStrip)
-{
- //
- // returns the median theta angle of a given strip iStrip (rad)
- //
-
-
- Float_t delta =0.;
- if(iPlate==0)delta = -1. ;
- if(iPlate==1)delta = -0.5;
- if(iPlate==3)delta = +0.5;
- if(iPlate==4)delta = +1. ;
-
- Float_t r =(fgkRmin+fgkRmax)/2.+fHeights[iPlate][iStrip];
- Float_t z =(fgkRmin+2.)*TMath::Tan(fAngles[iPlate][iStrip]/kRaddeg)+delta;
- Float_t theta =0.5*TMath::Pi()-TMath::ATan(z/r);
- if(iPlate != 2){
- if(theta > 0.5*TMath::Pi() )theta+=fgkDprecCen;
- if(theta < 0.5*TMath::Pi() )theta-=fgkDprecCen;
- }
- return theta;
-}
-
-
-