X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=TOF%2FAliTOFGeometry.cxx;h=f86d1ea16c494151fd0da3d30fb2ee9f6f8db9cd;hp=ff6fe1f1898ad94ece5fd6a8d71118897e1d800d;hb=43f77f2d7836b7921aaf368c77475099ef3b2a6d;hpb=fb9747d46ea88ae011c29b99d41a3ed3699aac27 diff --git a/TOF/AliTOFGeometry.cxx b/TOF/AliTOFGeometry.cxx index ff6fe1f1898..f86d1ea16c4 100644 --- a/TOF/AliTOFGeometry.cxx +++ b/TOF/AliTOFGeometry.cxx @@ -15,17 +15,38 @@ /* $Log$ +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 @@ -36,21 +57,27 @@ Revision 0.03 2003/12/14 S.Arcelli // // /////////////////////////////////////////////////////////////////////////////// +#include "AliLog.h" #include "AliConst.h" #include "AliTOFGeometry.h" ClassImp(AliTOFGeometry) -const Int_t AliTOFGeometry::fgkTimeDiff = 25000;// Min signal separation (ps) +const Int_t AliTOFGeometry::fgkTimeDiff = 25000; // Min signal separation (ps) -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::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 @@ -67,6 +94,8 @@ const Float_t AliTOFGeometry::fgkDprecMin = 0.0000075;//num.prec.tolerance on Th const Float_t AliTOFGeometry::fgkDprecMax = 0.0000100;//num.prec.tolerance on Thma const Float_t AliTOFGeometry::fgkDprecCen = 0.0000005;//num.prec.tolerance on +const Float_t AliTOFGeometry::fgkTdcBin = 24.4; // time-window for the TDC bins [ps] + //_____________________________________________________________________________ AliTOFGeometry::AliTOFGeometry() { @@ -93,7 +122,7 @@ void AliTOFGeometry::Init() // // Strips Tilt Angles - const Float_t angles[fgkNPlates][fgkMaxNstrip] ={ + 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, @@ -118,7 +147,7 @@ void AliTOFGeometry::Init() //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 }, @@ -138,14 +167,127 @@ void AliTOFGeometry::Init() // 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]; + 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]; } } - fPhiSec = 360./fgkNSectors; + fPhiSec = 360./kNSectors; +} + +//_____________________________________________________________________________ +Float_t AliTOFGeometry::DistanceToPad(Int_t *det, Float_t *pos) +{ +// +// Returns distance of space point with coor pos (x,y,z) (cm) wrt +// pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ) +// + + //Transform pos into Sector Frame + + Float_t x = pos[0]; + Float_t y = pos[1]; + Float_t z = pos[2]; + + Float_t radius = 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 angle = phi*kRaddeg-( Int_t (kRaddeg*phi/20.) + 0.5)*fPhiSec; + Float_t xs = radius*TMath::Cos(angle/kRaddeg); + Float_t ys = radius*TMath::Sin(angle/kRaddeg); + Float_t zs = z; + + // Do the same for the selected pad + + Float_t g[3]; + GetPos(det,g); + + Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]); + Float_t padPhi=TMath::ATan2(g[1],g[0]); + if(padPhi<0) padPhi=2.*TMath::Pi()+padPhi; + // Get the local angle in the sector philoc + Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/20.)+ 0.5) * fPhiSec; + Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg); + Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg); + Float_t padzs = g[2]; + + //Now move to local pad coordinate frame. Translate: + + Float_t xt = xs-padxs; + Float_t yt = ys-padys; + Float_t zt = zs-padzs; + //Now Rotate: + + Float_t alpha = GetAngles(det[1],det[2]); + Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg); + Float_t yr = yt; + Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg); + + Float_t dist = TMath::Sqrt(xr*xr+yr*yr+zr*zr); + return dist; + +} + + +//_____________________________________________________________________________ +Bool_t AliTOFGeometry::IsInsideThePad(Int_t *det, Float_t *pos) +{ +// +// Returns true if space point with coor pos (x,y,z) (cm) falls +// inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ) +// + + Bool_t isInside=false; + + + //Transform pos into Sector Frame + + Float_t x = pos[0]; + Float_t y = pos[1]; + Float_t z = pos[2]; + + Float_t radius = 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 angle = phi*kRaddeg-( Int_t (kRaddeg*phi/20.) + 0.5) *fPhiSec; + Float_t xs = radius*TMath::Cos(angle/kRaddeg); + Float_t ys = radius*TMath::Sin(angle/kRaddeg); + Float_t zs = z; + + // Do the same for the selected pad + + Float_t g[3]; + GetPos(det,g); + + Float_t padRadius = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]); + Float_t padPhi=TMath::ATan2(g[1],g[0]); + if(padPhi<0) padPhi=2.*TMath::Pi()+padPhi; + // Get the local angle in the sector philoc + Float_t padAngle = padPhi*kRaddeg-( Int_t (padPhi*kRaddeg/20.)+ 0.5) * fPhiSec; + Float_t padxs = padRadius*TMath::Cos(padAngle/kRaddeg); + Float_t padys = padRadius*TMath::Sin(padAngle/kRaddeg); + Float_t padzs = g[2]; + + //Now move to local pad coordinate frame. Translate: + + Float_t xt = xs-padxs; + Float_t yt = ys-padys; + Float_t zt = zs-padzs; + //Now Rotate: + + Float_t alpha = GetAngles(det[1],det[2]); + Float_t xr = xt*TMath::Cos(alpha/kRaddeg)+zt*TMath::Sin(alpha/kRaddeg); + Float_t yr = yt; + Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg); + + if(TMath::Abs(xr)<=0.75 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5)) + isInside=true; + return isInside; + } //_____________________________________________________________________________ @@ -190,7 +332,7 @@ Float_t AliTOFGeometry::GetX(Int_t *det) 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; + Float_t d = (ipadx+0.5)*fgkXPad-(kNpadX*fgkXPad)*0.5; // The radius r in xy plane: Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+ @@ -220,7 +362,7 @@ Float_t AliTOFGeometry::GetY(Int_t *det) 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; + Float_t d = (ipadx+0.5)*fgkXPad-(kNpadX*fgkXPad)*0.5; // The radius r in xy plane: Float_t r = (fgkRmin+fgkRmax)/2.+fHeights[iplate][istrip]+ @@ -252,7 +394,7 @@ Float_t AliTOFGeometry::GetZ(Int_t *det) // 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))- + 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; @@ -291,15 +433,15 @@ Int_t AliTOFGeometry::GetPadX(Float_t *pos) Int_t isector = GetSector(pos); if(isector == -1){ - cout << "Detector Index could not be determined" << endl; + AliError("Detector Index could not be determined"); return iPadX;} Int_t iplate = GetPlate(pos); if(iplate == -1){ - cout << "Detector Index could not be determined" << endl; + AliError("Detector Index could not be determined"); return iPadX;} Int_t istrip = GetStrip(pos); if(istrip == -1){ - cout << "Detector Index could not be determined" << endl; + AliError("Detector Index could not be determined"); return iPadX;} @@ -319,7 +461,7 @@ Int_t AliTOFGeometry::GetPadX(Float_t *pos) * 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); + Float_t d = (r*TMath::Tan(philoc)+(kNpadX*fgkXPad)*0.5); iPadX = (Int_t) ( d/fgkXPad); return iPadX; @@ -335,7 +477,7 @@ Int_t AliTOFGeometry::GetPlate(Float_t *pos) Int_t isector = GetSector(pos); if(isector == -1){ - cout << "Detector Index could not be determined" << endl; + AliError("Detector Index could not be determined"); return iPlate;} Float_t x = pos[0]; @@ -351,7 +493,7 @@ Int_t AliTOFGeometry::GetPlate(Float_t *pos) // theta projected on the median of the sector Float_t theta=TMath::ATan2(rho*TMath::Cos(philoc),z); - for (Int_t i=0; i= theta && GetMinPlateTheta(i) <= theta)iPlate=i; } @@ -371,11 +513,11 @@ Int_t AliTOFGeometry::GetStrip(Float_t *pos) Int_t isector = GetSector(pos); if(isector == -1){ - cout << "Detector Index could not be determined" << endl; + AliError("Detector Index could not be determined"); return iStrip;} Int_t iplate = GetPlate(pos); if(iplate == -1){ - cout << "Detector Index could not be determined" << endl; + AliError("Detector Index could not be determined"); return iStrip;} @@ -384,9 +526,9 @@ Int_t AliTOFGeometry::GetStrip(Float_t *pos) 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; + if(iplate==0 || iplate == 4)nstrips=kNStripC; + if(iplate==1 || iplate == 3)nstrips=kNStripB; + if(iplate==2) nstrips=kNStripA; Float_t rho=TMath::Sqrt(x*x+y*y); Float_t phi=TMath::ATan2(y,x); @@ -418,15 +560,15 @@ Int_t AliTOFGeometry::GetPadZ(Float_t *pos) Int_t isector = GetSector(pos); if(isector == -1){ - cout << "Detector Index could not be determined" << endl; + AliError("Detector Index could not be determined"); return iPadZ;} Int_t iplate = GetPlate(pos); if(iplate == -1){ - cout << "Detector Index could not be determined" << endl; + AliError("Detector Index could not be determined"); return iPadZ;} Int_t istrip = GetStrip(pos); if(istrip == -1){ - cout << "Detector Index could not be determined" << endl; + AliError("Detector Index could not be determined"); return iPadZ;} @@ -478,9 +620,9 @@ 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; + if(iPlate==0 ||iPlate == 4)index=kNStripC-1; + if(iPlate==1 ||iPlate == 3)index=kNStripB-1; + if(iPlate==2) index=kNStripA-1; Float_t delta =0.; if(iPlate==0)delta = -1. ;