X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSgeomTGeo.cxx;h=5c3a94931e8af5bdc61fa7057d6340cf5b1b42f3;hb=29e1d5d808bb99127d490b3570afab87ca511e75;hp=44bec7084629aabf53cd6ed7d276fc1a4d9fe660;hpb=6ddbe5ad882841e95f74315ab0f4ea096c4bad9a;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSgeomTGeo.cxx b/ITS/AliITSgeomTGeo.cxx index 44bec708462..5c3a94931e8 100644 --- a/ITS/AliITSgeomTGeo.cxx +++ b/ITS/AliITSgeomTGeo.cxx @@ -22,6 +22,7 @@ // 15/02/2007 // /////////////////////////////////////////////////////////////////////////// +#include #include #include #include @@ -165,7 +166,7 @@ const char* AliITSgeomTGeo::GetSymName(Int_t index) Int_t lay, index2; if (!GetLayer(index,lay,index2)) return NULL; - return AliAlignObj::SymName((AliAlignObj::ELayerID)((lay-1)+AliAlignObj::kSPD1),index2); + return AliGeomManager::SymName((AliGeomManager::ELayerID)((lay-1)+AliGeomManager::kSPD1),index2); } //______________________________________________________________________ @@ -177,13 +178,14 @@ TGeoHMatrix* AliITSgeomTGeo::GetMatrix(Int_t index) TGeoPNEntry *pne = GetPNEntry(index); if (!pne) return NULL; - const char* path = pne->GetTitle(); + TGeoPhysicalNode *pnode = pne->GetPhysicalNode(); + if (pnode) return pnode->GetMatrix(); + const char* path = pne->GetTitle(); if (!gGeoManager->cd(path)) { AliErrorClass(Form("Volume path %s not valid!",path)); return NULL; } - return gGeoManager->GetCurrentMatrix(); } @@ -230,7 +232,7 @@ Bool_t AliITSgeomTGeo::GetOrigMatrix(Int_t index, TGeoHMatrix &m) const char *symname = GetSymName(index); if (!symname) return kFALSE; - return AliAlignObj::GetOrigGlobalMatrix(symname,m); + return AliGeomManager::GetOrigGlobalMatrix(symname,m); } //______________________________________________________________________ @@ -325,3 +327,77 @@ TGeoPNEntry* AliITSgeomTGeo::GetPNEntry(Int_t index) return pne; } + +//______________________________________________________________________ +Bool_t AliITSgeomTGeo::LocalToGlobal(Int_t index, + const Double_t *loc, Double_t *glob) +{ + // Make the conversion from the local sensitive reference system to the global + // reference system, for an arbitrary local position. The input is the pointer + // to the array of local coordinates, the result is sent to the glob pointer. + // + // Please don't use this method to get the global coordinates of clusters, use + // the direct method of AliCluster instead. + + const TGeoHMatrix *m2 = GetTracking2LocalMatrix(index); + if (!m2) return kFALSE; + + // The shift (in local y only) between alignable and sensitive volume + // is extracted directly from the Tracking2Local matrix + Double_t locSens[] = {loc[0], loc[1]+m2->GetTranslation()[1], loc[2]}; + + TGeoHMatrix *ml = GetMatrix(index); + if (!ml) return kFALSE; + ml->LocalToMaster(locSens,glob); + return kTRUE; +} + +//______________________________________________________________________ +Bool_t AliITSgeomTGeo::GlobalToLocal(Int_t index, + const Double_t *glob, Double_t *loc) +{ + // Make the conversion from the global reference system to the sensitive local + // reference system, for an arbitrary global position. The input is the pointer + // to the array of global coordinates, the result is sent to the loc pointer. + + TGeoHMatrix *ml = GetMatrix(index); + if (!ml) return kFALSE; + + const TGeoHMatrix *m2 = GetTracking2LocalMatrix(index); + if (!m2) return kFALSE; + ml->MasterToLocal(glob,loc); + // The shift (in local y only) between alignable and sensitive volume + // is extracted directly from the Tracking2Local matrix + loc[1] -= m2->GetTranslation()[1]; + + return kTRUE; +} + +//______________________________________________________________________ +Bool_t AliITSgeomTGeo::LocalToGlobalVect(Int_t index, + const Double_t *loc, Double_t *glob) +{ + // Make the conversion from the local sensitive reference system to the global + // reference system, for an arbitrary vector. The input is the pointer to the + // array of local coordinates, the result is sent to the glob pointer. + + TGeoHMatrix *ml = GetMatrix(index); + if (!ml) return kFALSE; + ml->LocalToMasterVect(loc,glob); + return kTRUE; +} + +//______________________________________________________________________ +Bool_t AliITSgeomTGeo::GlobalToLocalVect(Int_t index, + const Double_t *glob, Double_t *loc) +{ + // Make the conversion from the global reference system to the sensitive local + // reference system, for an arbitrary vector. The input is the pointer to the + // array of global coordinates, the result is sent to the loc pointer. + + TGeoHMatrix *ml = GetMatrix(index); + if (!ml) return kFALSE; + ml->MasterToLocalVect(glob,loc); + + return kTRUE; +}