From 48e6af28c3b8db8c25e365a081eddb45d241ef34 Mon Sep 17 00:00:00 2001 From: decaro Date: Mon, 19 Feb 2007 18:55:26 +0000 Subject: [PATCH] Added getter methods for volume path (for Event Display) --- TOF/AliTOFGeometry.cxx | 35 ++++++++++- TOF/AliTOFGeometry.h | 12 +++- TOF/AliTOFGeometryV5.cxx | 132 ++++++++++++++++++++++++++++++++++++++- TOF/AliTOFGeometryV5.h | 4 ++ 4 files changed, 178 insertions(+), 5 deletions(-) diff --git a/TOF/AliTOFGeometry.cxx b/TOF/AliTOFGeometry.cxx index c2819860473..f176104bb82 100644 --- a/TOF/AliTOFGeometry.cxx +++ b/TOF/AliTOFGeometry.cxx @@ -15,6 +15,13 @@ /* $Log$ +Revision 1.17.1 2006/12/15 + Added method DetToStripRF(...) to get + a pad corner coordinates in its strip reference frame + (A.De Caro, M.Di Stefano) +Revision 1.17 2006/08/22 13:30:02 arcelli +removal of effective c++ warnings (C.Zampolli) + Revision 1.16 2006/04/20 22:30:50 hristov Coding conventions (Annalisa) @@ -103,7 +110,8 @@ const Float_t AliTOFGeometry::fgkStripLength = 122.;// Strip Length (rho X phi d 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 -const Float_t AliTOFGeometry::fgkTdcBin = 24.4; // time-window for the TDC bins [ps] +const Float_t AliTOFGeometry::fgkTdcBin = 24.4; // time-of-flight bin width [ps] +const Float_t AliTOFGeometry::fgkToTBin = 48.8; // time-over-threshold bin width [ps] //_____________________________________________________________________________ AliTOFGeometry::AliTOFGeometry(): @@ -222,3 +230,28 @@ void AliTOFGeometry::GetDetID( Float_t *pos, Int_t *det) const } //_____________________________________________________________________________ + +void AliTOFGeometry::DetToStripRF(Int_t nPadX, Int_t nPadZ, Float_t &x, Float_t &z) const +{ + // + // Returns the local coordinates (x, z) in strip reference frame + // for the bottom corner of the pad number (nPadX, nPadZ) + // + /* + const Float_t xCenterStrip = kNpadX * fgkXPad / 2.; + const Float_t zCenterStrip = kNpadZ * fgkZPad / 2.; + + const Float_t xCenterPad = nPadX*fgkXPad + fgkXPad / 2.; + const Float_t zCenterPad = nPadZ*fgkZPad + fgkZPad / 2.; + + x = xCenterPad - xCenterStrip; + z = zCenterPad - zCenterStrip; + */ + + + x = (nPadX - kNpadX*0.5) * fgkXPad; + z = (nPadZ - kNpadZ*0.5) * fgkZPad; + + +} +//_____________________________________________________________________________ diff --git a/TOF/AliTOFGeometry.h b/TOF/AliTOFGeometry.h index 852e1ea3e36..0e7632ea11e 100644 --- a/TOF/AliTOFGeometry.h +++ b/TOF/AliTOFGeometry.h @@ -30,6 +30,8 @@ class AliTOFGeometry: public TObject{ static Int_t NpadXStrip() { return kNpadX*kNpadZ;}; static Int_t NSectors() { return kNSectors;}; static Int_t NPlates() { return kNPlates;}; + virtual Int_t NStripXSector() const { return (kNStripA + 2*kNStripB + + 2*fNStripC);}; virtual Int_t NPadXSector() const { return (kNStripA + 2*kNStripB + 2*fNStripC)*kNpadX*kNpadZ;}; @@ -63,7 +65,7 @@ class AliTOFGeometry: public TObject{ static Double_t GetAlpha() { return 2 * 3.14159265358979323846 / kNSectors; }; static Float_t TdcBinWidth() {return fgkTdcBin;}; - + static Float_t ToTBinWidth() {return fgkToTBin;}; virtual void Init(); virtual void ImportGeometry() {}; @@ -74,6 +76,8 @@ class AliTOFGeometry: public TObject{ virtual Bool_t IsInsideThePad(Int_t */*det*/,TGeoHMatrix /*mat*/, Float_t */*pos*/) const {return kFALSE;}; virtual Float_t DistanceToPad(Int_t */*det*/,TGeoHMatrix /*mat*/, Float_t */*pos*/, Float_t *dist3d=0) const {return dist3d[0];}; virtual void GetVolumePath(Int_t */*ind*/, Char_t */*path*/ ){}; + virtual void GetVolumePath(Int_t /*sector*/, Char_t */*path*/ ){}; + virtual void GetVolumePath(Int_t /*sector*/, Int_t /*plate*/, Int_t /*strip*/, Char_t */*path*/ ){}; virtual void GetPos(Int_t */*det*/,Float_t */*pos*/){}; virtual void GetPosPar(Int_t *det,Float_t *pos) const; virtual void GetDetID(Float_t *pos,Int_t *det) const; @@ -85,6 +89,9 @@ class AliTOFGeometry: public TObject{ virtual Float_t GetX(Int_t */*det*/) const {return -500.;}; virtual Float_t GetY(Int_t */*det*/) const {return -500.;}; virtual Float_t GetZ(Int_t */*det*/) const {return -500.;}; + virtual void DetToStripRF(Int_t nPadX, Int_t nPadZ, + Float_t &x, Float_t &z) const; + virtual void DetToSectorRF(Int_t /*vol*/[5], Double_t ** /*coord*/) { }; Float_t GetAngles(Int_t iplate, Int_t istrip) const {return fAngles[iplate][istrip];}; Float_t GetHeights(Int_t iplate, Int_t istrip) const {return fHeights[iplate][istrip];}; @@ -144,7 +151,8 @@ class AliTOFGeometry: public TObject{ Float_t fPhiSec; //sector Phi width (deg) - static const Float_t fgkTdcBin; // time-window for the TDC bins [ps] + static const Float_t fgkTdcBin; // time-of-flight bin width [ps] + static const Float_t fgkToTBin; // time-over-threshold bin width [ps] ClassDef(AliTOFGeometry,4) // TOF Geometry base class }; diff --git a/TOF/AliTOFGeometryV5.cxx b/TOF/AliTOFGeometryV5.cxx index f1b2b180b5a..1e62a114dcf 100644 --- a/TOF/AliTOFGeometryV5.cxx +++ b/TOF/AliTOFGeometryV5.cxx @@ -15,6 +15,18 @@ /* $Log$ +Revision 1.17.1 2006/12/15 + Added methods: + DetToSectorRF(...) to get pad corners + coordinates in its sector reference frame; + GetVolumePath(Int_t sector, Char_t *path) + to get the volume path for a sector + GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Char_t *path) + to get the volume path for a strip + (A.De Caro, M.Di Stefano) +Revision 1.7 2006/07/12 16:03:59 arcelli +updates to match the new numbering of the TOF/TRD mother volumes in FRAME (ALICE convention) + Revision 1.6 2006/05/04 19:41:42 hristov Possibility for partial TOF geometry (S.Arcelli) @@ -1280,7 +1292,7 @@ Float_t AliTOFGeometryV5::GetPadDx(Float_t *pos) Float_t AliTOFGeometryV5::GetPadDy(Float_t *pos) { // - // Returns the x coordinate in the Pad reference frame + // Returns the y coordinate in the Pad reference frame // Float_t ypad = -2.; @@ -1381,7 +1393,7 @@ Float_t AliTOFGeometryV5::GetPadDy(Float_t *pos) Float_t AliTOFGeometryV5::GetPadDz(Float_t *pos) { // - // Returns the x coordinate in the Pad reference frame + // Returns the z coordinate in the Pad reference frame // Float_t zpad = -2.; @@ -1596,6 +1608,57 @@ void AliTOFGeometryV5::GetVolumePath(Int_t *ind, Char_t *path ) { sprintf(string3,"FPCB_1/FSEN_1/FSEZ_%i/FPAD_%i",padz,padx); sprintf(path,"%s/%s/%s",string1,string2,string3); +} +//_____________________________________________________________________________ +void AliTOFGeometryV5::GetVolumePath(Int_t sector, Char_t *path ){ + //-------------------------------------------------------------------- + // This function returns the colume path of a given sector + //-------------------------------------------------------------------- + + Char_t string[100]; + + Int_t icopy = sector; + // Old 6h convention + // if(sector<13){ + // icopy=sector+5;} + // else{ icopy=sector-13;} + + sprintf(string,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy); + sprintf(path,"%s",string); + +} +//_____________________________________________________________________________ +void AliTOFGeometryV5::GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Char_t *path ) { + //-------------------------------------------------------------------- + // This function returns the colume path of a given strip + //-------------------------------------------------------------------- + + Char_t string1[100]; + Char_t string2[100]; + Char_t string3[100]; + + Int_t icopy = sector; + // Old 6h convention + // if(sector<13){ + // icopy=sector+5;} + // else{ icopy=sector-13;} + sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1/FTOA_0/FLTA_0",icopy,icopy); + + if(plate==0) icopy=strip; + if(plate==1) icopy=strip+NStripC(); + if(plate==2) icopy=strip+NStripC()+NStripB(); + if(plate==3) icopy=strip+NStripC()+NStripB()+NStripA(); + if(plate==4) icopy=strip+NStripC()+2*NStripB()+NStripA(); + icopy++; + sprintf(string2,"FSTR_%i",icopy); + if(fHoles && (sector==11 || sector==12)) { + if(plate<2) sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy); + if(plate>2) sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy); + } + + sprintf(string3,"FPCB_1/FSEN_1"); + sprintf(path,"%s/%s/%s",string1,string2,string3); + } //_____________________________________________________________________________ void AliTOFGeometryV5::GetPos(Int_t *det, Float_t *pos) @@ -1619,3 +1682,68 @@ void AliTOFGeometryV5::GetPos(Int_t *det, Float_t *pos) pos[2]=tr[2]; } //_____________________________________________________________________________ + +void AliTOFGeometryV5::DetToSectorRF(Int_t vol[5], Double_t **coord) +{ + // + // Returns the local coordinates (x, y, z) in sector reference frame + // for the 4 corners of each sector pad (vol[1], vol[2], vol[3], vol[4]) + // + + if (!gGeoManager) printf("ERROR: no TGeo\n"); + + // ALICE -> TOF Sector + Char_t path1[100]=""; + GetVolumePath(vol[0],path1); + gGeoManager->cd(path1); + TGeoHMatrix aliceToSector; + aliceToSector = *gGeoManager->GetCurrentMatrix(); + + // TOF Sector -> ALICE + //TGeoHMatrix sectorToALICE = aliceToSector.Inverse(); + + // ALICE -> TOF Pad + Char_t path2[100]=""; + GetVolumePath(vol,path2); + gGeoManager->cd(path2); + TGeoHMatrix aliceToPad; + aliceToPad = *gGeoManager->GetCurrentMatrix(); + + // TOF Pad -> ALICE + TGeoHMatrix padToALICE = aliceToPad.Inverse(); + + // TOF Pad -> TOF Sector + TGeoHMatrix padToSector = padToALICE*aliceToSector; + + // TOF Sector -> TOF Pad + //TGeoHMatrix sectorToPad = sectorToALICE*aliceToPad; + + // coordinates of the pad bottom corner + Double_t **cornerPad = new Double_t*[4]; + for (Int_t ii=0; ii<4; ii++) cornerPad[ii] = new Double_t[3]; + + cornerPad[0][0] = -fgkXPad/2.; + cornerPad[0][1] = 0.; + cornerPad[0][2] = -fgkZPad/2.; + + cornerPad[1][0] = fgkXPad/2.; + cornerPad[1][1] = 0.; + cornerPad[1][2] = -fgkZPad/2.; + + cornerPad[2][0] = fgkXPad/2.; + cornerPad[2][1] = 0.; + cornerPad[2][2] = fgkZPad/2.; + + cornerPad[3][0] = -fgkXPad/2.; + cornerPad[3][1] = 0.; + cornerPad[3][2] = fgkZPad/2.; + + for(Int_t aa=0; aa<4; aa++) for(Int_t bb=0; bb<3; bb++) coord[aa][bb]=0.; + + for (Int_t jj=0; jj<4; jj++) padToSector.MasterToLocal(&cornerPad[jj][0], &coord[jj][0]); + + delete cornerPad; + + //sectorToPad.LocalToMaster(cornerPad, coord); + +} diff --git a/TOF/AliTOFGeometryV5.h b/TOF/AliTOFGeometryV5.h index a76fbe9ff42..e3bfc42eae3 100644 --- a/TOF/AliTOFGeometryV5.h +++ b/TOF/AliTOFGeometryV5.h @@ -25,6 +25,8 @@ class AliTOFGeometryV5: public AliTOFGeometry { Bool_t IsInsideThePadPar(Int_t *det, Float_t *pos) const; Float_t DistanceToPadPar(Int_t *det, Float_t *pos, Float_t *dist3d=0) const; void GetVolumePath(Int_t *ind, Char_t *path ); + void GetVolumePath(Int_t sector, Char_t *path ); + void GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Char_t *path ); Int_t GetPlate(Float_t *pos) const; Int_t GetStrip(Float_t *pos) const; Int_t GetSector(Float_t *pos) const; @@ -55,6 +57,8 @@ class AliTOFGeometryV5: public AliTOFGeometry { void Rotation(Float_t *xyz, Double_t rotationAngles[6]) const; void InverseRotation(Float_t *xyz, Double_t rotationAngles[6]) const; + void DetToSectorRF(Int_t vol[5], Double_t **coord); + protected: enum { -- 2.43.0