Gmtod and Gdtom added.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 18 Feb 2003 12:47:59 +0000 (12:47 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 18 Feb 2003 12:47:59 +0000 (12:47 +0000)
Flugg/FGeometryInit.cxx
Flugg/FGeometryInit.hh
TFluka/TFluka.cxx
TFluka/TFluka.h

index c469adefad9b581dda48a4d5bcb73b9c280ad2aa..1149069b36f5c5950b33c58b8eaee913ad72605a 100644 (file)
@@ -829,3 +829,76 @@ int FGeometryInit::CurrentVolOffID(int ir, int off, int& copyNo)
     }
     return id;
 }
     }
     return id;
 }
+
+void  FGeometryInit::Gmtod(double* xm, double* xd, int iflag)
+{
+// Transforms a position from the world reference frame
+// to the current volume reference frame.
+//
+//  Geant3 desription:
+//  ==================
+//       Computes coordinates XD (in DRS) 
+//       from known coordinates XM in MRS 
+//       The local reference system can be initialized by
+//         - the tracking routines and GMTOD used in GUSTEP
+//         - a call to GMEDIA(XM,NUMED)
+//         - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER) 
+//             (inverse routine is GDTOM) 
+//
+//        If IFLAG=1  convert coordinates 
+//           IFLAG=2  convert direction cosinus
+//
+// ---
+    FluggNavigator        * ptrNavig     = getNavigatorForTracking();
+    //setting variables (and dimension: Fluka uses cm.!)
+    G4ThreeVector pGlob(xm[0],xm[1],xm[2]);
+    pGlob *= 10.0; // in millimeters
+    G4ThreeVector pLoc;
+    
+    if (iflag == 1) {
+       pLoc = 
+           ptrNavig->ComputeLocalPoint(pGlob);
+    } else if (iflag == 2) {
+       pLoc = 
+           ptrNavig->ComputeLocalAxis(pGlob);  
+    } else {
+       G4cout << "Flugg FGeometryInit::Gmtod called with undefined flag" << G4endl;
+    }
+    
+    xd[0] = pLoc[0]; xd[1] = pLoc[1]; xd[2] = pLoc[2];
+}
+
+void  FGeometryInit::Gdtom(double* xd, double* xm, int iflag)
+{
+// Transforms a position from the current volume reference frame
+// to the world reference frame.
+//
+//  Geant3 desription:
+//  ==================
+//  Computes coordinates XM (Master Reference System
+//  knowing the coordinates XD (Detector Ref System)
+//  The local reference system can be initialized by
+//    - the tracking routines and GDTOM used in GUSTEP
+//    - a call to GSCMED(NLEVEL,NAMES,NUMBER)
+//        (inverse routine is GMTOD)
+// 
+//   If IFLAG=1  convert coordinates
+//      IFLAG=2  convert direction cosinus
+//
+// ---
+
+    FluggNavigator        * ptrNavig     = getNavigatorForTracking();
+    G4ThreeVector pLoc(xd[0],xd[1],xd[2]);
+    G4ThreeVector pGlob;
+     if (iflag == 1) {
+        pGlob = ptrNavig->GetLocalToGlobalTransform().
+            TransformPoint(pLoc);
+     } else if (iflag == 2) {
+        pGlob = ptrNavig->GetLocalToGlobalTransform().
+            TransformAxis(pLoc);
+     } else {
+        G4cout << "Flugg FGeometryInit::Gdtom called with undefined flag" << G4endl;
+     }
+     
+     xm[0] = pGlob[0]; xm[1] = pGlob[1]; xm[2] = pGlob[2];
+}
index 80993fcaf6ef4644294f8ef1c5847827db9f093c..832ab6df16c882188b70aeee6335509f5d6e921d 100644 (file)
@@ -74,7 +74,8 @@ public:
   G4int GetMedium(int) const;
   int CurrentVolID(int ir, int& copyNo);
   int CurrentVolOffID(int ir, int off, int& copyNo);
   G4int GetMedium(int) const;
   int CurrentVolID(int ir, int& copyNo);
   int CurrentVolOffID(int ir, int off, int& copyNo);
-    
+  void Gmtod(double* xm, double* xd, int iflag);
+  void Gdtom(double* xd, double* xm, int iflag);    
 
 protected:
   void BuildRegionsMap();
 
 protected:
   void BuildRegionsMap();
index be1a1e98213b2b81835bfd92116cd05688810643..ac2fe364ec075437576304b2f556924945fe9460 100644 (file)
 
 /*
 $Log$
 
 /*
 $Log$
+Revision 1.13  2003/01/31 14:01:51  morsch
+Major update on
+- Getters related to geometry.
+- Communication with run manager (event steering)
+
 Revision 1.12  2003/01/31 12:18:53  morsch
 Corrected indices. (E. Futo)
 
 Revision 1.12  2003/01/31 12:18:53  morsch
 Corrected indices. (E. Futo)
 
@@ -1036,6 +1041,99 @@ Int_t TFluka::CurrentMaterial(Float_t &a, Float_t &z,
     return med;
 }
 
     return med;
 }
 
+void TFluka::Gmtod(Float_t* xm, Float_t* xd, Int_t iflag)
+    {
+// Transforms a position from the world reference frame
+// to the current volume reference frame.
+//
+//  Geant3 desription:
+//  ==================
+//       Computes coordinates XD (in DRS) 
+//       from known coordinates XM in MRS 
+//       The local reference system can be initialized by
+//         - the tracking routines and GMTOD used in GUSTEP
+//         - a call to GMEDIA(XM,NUMED)
+//         - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER) 
+//             (inverse routine is GDTOM) 
+//
+//        If IFLAG=1  convert coordinates 
+//           IFLAG=2  convert direction cosinus
+//
+// ---
+       Double_t xmD[3], xdD[3];        
+       xmD[0] = xm[0]; xmD[1] = xm[1]; xmD[2] = xm[2]; 
+       (FGeometryInit::GetInstance())->Gmtod(xmD, xdD, iflag);
+       xd[0] = xdD[0]; xd[1] = xdD[1]; xd[2] = xdD[2]; 
+    }
+
+  
+void TFluka::Gmtod(Double_t* xm, Double_t* xd, Int_t iflag)
+    {
+// Transforms a position from the world reference frame
+// to the current volume reference frame.
+//
+//  Geant3 desription:
+//  ==================
+//       Computes coordinates XD (in DRS) 
+//       from known coordinates XM in MRS 
+//       The local reference system can be initialized by
+//         - the tracking routines and GMTOD used in GUSTEP
+//         - a call to GMEDIA(XM,NUMED)
+//         - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER) 
+//             (inverse routine is GDTOM) 
+//
+//        If IFLAG=1  convert coordinates 
+//           IFLAG=2  convert direction cosinus
+//
+// ---
+       Double_t xmD[3], xdD[3];        
+       xdD[0] = xd[0]; xdD[1] = xd[1]; xdD[2] = xd[2]; 
+       (FGeometryInit::GetInstance())->Gdtom(xmD, xdD, iflag);
+       xm[0] = xmD[0]; xm[1] = xmD[1]; xm[2] = xmD[2]; 
+    }
+
+void TFluka::Gdtom(Float_t* xd, Float_t* xm, Int_t iflag)
+    {
+// Transforms a position from the current volume reference frame
+// to the world reference frame.
+//
+//  Geant3 desription:
+//  ==================
+//  Computes coordinates XM (Master Reference System
+//  knowing the coordinates XD (Detector Ref System)
+//  The local reference system can be initialized by
+//    - the tracking routines and GDTOM used in GUSTEP
+//    - a call to GSCMED(NLEVEL,NAMES,NUMBER)
+//        (inverse routine is GMTOD)
+// 
+//   If IFLAG=1  convert coordinates
+//      IFLAG=2  convert direction cosinus
+//
+// ---
+
+
+    }
+void TFluka::Gdtom(Double_t* xd, Double_t* xm, Int_t iflag)
+    {
+// Transforms a position from the current volume reference frame
+// to the world reference frame.
+//
+//  Geant3 desription:
+//  ==================
+//  Computes coordinates XM (Master Reference System
+//  knowing the coordinates XD (Detector Ref System)
+//  The local reference system can be initialized by
+//    - the tracking routines and GDTOM used in GUSTEP
+//    - a call to GSCMED(NLEVEL,NAMES,NUMBER)
+//        (inverse routine is GMTOD)
+// 
+//   If IFLAG=1  convert coordinates
+//      IFLAG=2  convert direction cosinus
+//
+// ---
+
+       (FGeometryInit::GetInstance())->Gdtom(xm, xd, iflag);
+    }
 
 // ===============================================================
 void TFluka::FutoTest() 
 
 // ===============================================================
 void TFluka::FutoTest() 
index 1b88c3ea68c938ce7cc4828fea03b5027adc6d7f..bc67b95a143e52cd63f351abb8cf93bf54279a1a 100644 (file)
@@ -165,14 +165,14 @@ class TFluka : public TVirtualMC {
                                   Float_t &dens, Float_t &radl, Float_t &absl) const;
   virtual Int_t    CurrentEvent() const
       {printf("WARNING: CurrentEvent not yet implemented !\n"); return -1;} 
                                   Float_t &dens, Float_t &radl, Float_t &absl) const;
   virtual Int_t    CurrentEvent() const
       {printf("WARNING: CurrentEvent not yet implemented !\n"); return -1;} 
-  virtual void     Gmtod(Float_t* xm, Float_t* xd, Int_t iflag)
-    {printf("WARNING: Gmtod not yet implemented !\n");}
-  virtual void     Gmtod(Double_t* xm, Double_t* xd, Int_t iflag)
-    {printf("WARNING: Gmtod not yet implemented !\n");}
-  virtual void     Gdtom(Float_t* xd, Float_t* xm, Int_t iflag)
-    {printf("WARNING: Gdtom not yet implemented !\n");}
-  virtual void     Gdtom(Double_t* xd, Double_t* xm, Int_t iflag)
-    {printf("WARNING: Gdtom not yet implemented !\n");}
+  virtual void     Gmtod(Float_t* xm, Float_t* xd, Int_t iflag);
+  
+  virtual void     Gmtod(Double_t* xm, Double_t* xd, Int_t iflag);
+  
+  virtual void     Gdtom(Float_t* xd, Float_t* xm, Int_t iflag);
+  
+  virtual void     Gdtom(Double_t* xd, Double_t* xm, Int_t iflag);
+  
   virtual Double_t MaxStep() const
     {printf("WARNING: MaxStep not yet implemented !\n"); return -1.;}
   virtual Int_t    GetMaxNStep() const
   virtual Double_t MaxStep() const
     {printf("WARNING: MaxStep not yet implemented !\n"); return -1.;}
   virtual Int_t    GetMaxNStep() const