]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Methods for conversion global <--> local reference frames (L. Gaudichet)
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 24 Apr 2007 16:31:49 +0000 (16:31 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 24 Apr 2007 16:31:49 +0000 (16:31 +0000)
ITS/AliITSgeomTGeo.cxx
ITS/AliITSgeomTGeo.h

index e74077ae0a963c8dc1c181b98392c63345ce31ed..8f379e37cbd3a80ef66a9f16c5ad89e74f3ff28a 100644 (file)
@@ -327,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;
+}
index fae8c4834338e5befc2ffbf146c1e486f98f3c9e..29770beb605bbd1e278df648c1a7b8943f13fb00 100644 (file)
@@ -77,6 +77,19 @@ class AliITSgeomTGeo : public TObject {
   static Bool_t GetTrackingMatrix(Int_t lay,Int_t lad,Int_t det, TGeoHMatrix &m)
     { return GetTrackingMatrix(GetModuleIndex(lay,lad,det),m); }
 
+  static Bool_t LocalToGlobal(Int_t index, const Double_t *loc, Double_t *glob);
+  static Bool_t LocalToGlobal(Int_t lay, Int_t lad, Int_t det,
+                             const Double_t *loc, Double_t *glob)
+    { return LocalToGlobal(GetModuleIndex(lay,lad,det), loc, glob);}
+
+  static Bool_t GlobalToLocal(Int_t index, const Double_t *glob, Double_t *loc);
+  static Bool_t GlobalToLocal(Int_t lay, Int_t lad, Int_t det,
+                             const Double_t *glob, Double_t *loc)
+    { return GlobalToLocal(GetModuleIndex(lay,lad,det), glob, loc);}
+
+  static Bool_t LocalToGlobalVect(Int_t index, const Double_t *loc, Double_t *glob);
+  static Bool_t GlobalToLocalVect(Int_t index, const Double_t *glob, Double_t *loc);
+
  private:
 
   enum {kNLayers = 6}; // The number of layers.