]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Included the geometry through geant4_vmc/FLUGG
authoriglez2 <iglez2@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 7 Nov 2002 17:59:10 +0000 (17:59 +0000)
committeriglez2 <iglez2@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 7 Nov 2002 17:59:10 +0000 (17:59 +0000)
TFluka/TFluka.cxx
TFluka/TFluka.h

index dbf5e1ff5ab1e70d4fcab3f6914c03389178f278..2eda454fd564ca3150060a9997c39b7d0c144098 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.4  2002/11/04 16:00:46  iglez2
+The conversion between ID and PDG now uses Fluka routines and arrays which is more consistent.
+
 Revision 1.3  2002/10/22 15:12:14  alibrary
 Introducing Riostream.h
 
@@ -62,6 +65,11 @@ First commit of Fluka interface.
 #include "Fpart.h"         //(PART)   fluka common
 #include "TVirtualMC.h"
 
+#include "TG4GeometryManager.h" //For the geometry management
+#include "TG4DetConstruction.h" //For the detector construction
+
+#include "FGeometryInit.hh"
+
 // Fluka methods that may be needed.
 #ifndef WIN32 
 # define flukam  flukam_
@@ -95,31 +103,63 @@ extern "C"
 ClassImp(TFluka)
 
 //
-// TFluka methods.
+//----------------------------------------------------------------------------
+// TFluka constructors and destructors.
 //____________________________________________________________________________ 
 TFluka::TFluka()
   :TVirtualMC(),
    fVerbosityLevel(0),
-   fInputFileName("")
+   fInputFileName(""),
+   fDetector(0)
 { 
   //
   // Default constructor
   //
 } 
  
-//____________________________________________________________________________ 
 TFluka::TFluka(const char *title, Int_t verbosity)
   :TVirtualMC("TFluka",title),
    fVerbosityLevel(verbosity),
-   fInputFileName("")
+   fInputFileName(""),
+   fDetector(0)
 {
   if (fVerbosityLevel >=3)
     cout << "==> TFluka::TFluka(" << title << ") constructor called." << endl;
 
+  
+  // create geometry manager
+  if (fVerbosityLevel >=2)
+    cout << "\t* Creating G4 Geometry manager..." << endl;
+  fGeometryManager = new TG4GeometryManager();
+  if (fVerbosityLevel >=2)
+    cout << "\t* Creating G4 Detector..." << endl;
+  fDetector = new TG4DetConstruction();
+  FGeometryInit* geominit = FGeometryInit::GetInstance();
+  if (geominit)
+    geominit->setDetConstruction(fDetector);
+  else {
+    cerr << "ERROR: Could not create FGeometryInit!" << endl;
+    cerr << "       Exiting!!!" << endl;
+    abort();
+  }
+
   if (fVerbosityLevel >=3)
     cout << "<== TFluka::TFluka(" << title << ") constructor called." << endl;
 }
 
+TFluka::~TFluka() {
+  if (fVerbosityLevel >=3)
+    cout << "==> TFluka::~TFluka() destructor called." << endl;
+
+  delete fGeometryManager;
+
+  if (fVerbosityLevel >=3)
+    cout << "<== TFluka::~TFluka() destructor called." << endl;
+}
+
+//
+//_____________________________________________________________________________
+// TFluka control methods
 //____________________________________________________________________________ 
 void TFluka::Init() {
   if (fVerbosityLevel >=3)
@@ -137,7 +177,7 @@ void TFluka::Init() {
 
   if (fVerbosityLevel >=2)
     cout << "\t* Calling flukam..." << endl;
-  flukam(0);
+  flukam(1);
 
   if (fVerbosityLevel >=2)
     cout << "\t* Closing file " << fInputFileName << endl;
@@ -147,7 +187,25 @@ void TFluka::Init() {
     cout << "<== TFluka::Init() called." << endl;
 }
 
-//____________________________________________________________________________ 
+void TFluka::FinishGeometry() {
+  if (fVerbosityLevel >=3)
+    cout << "==> TFluka::FinishGeometry() called." << endl;
+
+  fGeometryManager->Ggclos();
+
+  if (fVerbosityLevel >=3)
+    cout << "<== TFluka::FinishGeometry() called." << endl;
+} 
+
+void TFluka::BuildPhysics() {
+  if (fVerbosityLevel >=3)
+    cout << "==> TFluka::BuildPhysics() called." << endl;
+
+
+  if (fVerbosityLevel >=3)
+    cout << "<== TFluka::BuildPhysics() called." << endl;
+}  
+
 void TFluka::ProcessEvent() {
   if (fVerbosityLevel >=3)
     cout << "==> TFluka::ProcessEvent() called." << endl;
@@ -156,7 +214,7 @@ void TFluka::ProcessEvent() {
     cout << "<== TFluka::ProcessEvent() called." << endl;
 }
 
-//____________________________________________________________________________ 
+
 void TFluka::ProcessRun(Int_t nevent) {
   if (fVerbosityLevel >=3)
     cout << "==> TFluka::ProcessRun(" << nevent << ") called." 
@@ -168,13 +226,183 @@ void TFluka::ProcessRun(Int_t nevent) {
   }
   fApplication->GeneratePrimaries();
   EPISOR.lsouit = true;
-  flukam(0);
+  flukam(1);
 
   if (fVerbosityLevel >=3)
     cout << "<== TFluka::ProcessRun(" << nevent << ") called." 
         << endl;
 }
 
+//_____________________________________________________________________________
+// methods for building/management of geometry
+//____________________________________________________________________________ 
+// functions from GCONS 
+void TFluka::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,  
+                   Float_t &dens, Float_t &radl, Float_t &absl,
+                   Float_t* ubuf, Int_t& nbuf) {
+//
+  fGeometryManager->Gfmate(imat, name, a, z, dens, radl, absl, ubuf, nbuf);
+} 
+
+void TFluka::Gfmate(Int_t imat, char *name, Double_t &a, Double_t &z,  
+                   Double_t &dens, Double_t &radl, Double_t &absl,
+                   Double_t* ubuf, Int_t& nbuf) {
+//
+  fGeometryManager->Gfmate(imat, name, a, z, dens, radl, absl, ubuf, nbuf);
+} 
+
+// detector composition
+void TFluka::Material(Int_t& kmat, const char* name, Double_t a, 
+                     Double_t z, Double_t dens, Double_t radl, Double_t absl,
+                     Float_t* buf, Int_t nwbuf) {
+//
+  fGeometryManager
+    ->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf); 
+} 
+void TFluka::Material(Int_t& kmat, const char* name, Double_t a, 
+                     Double_t z, Double_t dens, Double_t radl, Double_t absl,
+                     Double_t* buf, Int_t nwbuf) {
+//
+  fGeometryManager
+    ->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf); 
+} 
+
+void TFluka::Mixture(Int_t& kmat, const char *name, Float_t *a, 
+                    Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat) {
+//
+   fGeometryManager
+     ->Mixture(kmat, name, a, z, dens, nlmat, wmat); 
+} 
+void TFluka::Mixture(Int_t& kmat, const char *name, Double_t *a, 
+                    Double_t *z, Double_t dens, Int_t nlmat, Double_t *wmat) {
+//
+   fGeometryManager
+     ->Mixture(kmat, name, a, z, dens, nlmat, wmat); 
+} 
+
+void TFluka::Medium(Int_t& kmed, const char *name, Int_t nmat, 
+                   Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd, 
+                   Double_t stemax, Double_t deemax, Double_t epsil, 
+                   Double_t stmin, Float_t* ubuf, Int_t nbuf) { 
+  //
+  fGeometryManager
+    ->Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax, 
+            epsil, stmin, ubuf, nbuf);
+} 
+void TFluka::Medium(Int_t& kmed, const char *name, Int_t nmat, 
+                   Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd, 
+                   Double_t stemax, Double_t deemax, Double_t epsil, 
+                   Double_t stmin, Double_t* ubuf, Int_t nbuf) { 
+  //
+  fGeometryManager
+    ->Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax, 
+            epsil, stmin, ubuf, nbuf);
+} 
+
+void TFluka::Matrix(Int_t& krot, Double_t thetaX, Double_t phiX, 
+                   Double_t thetaY, Double_t phiY, Double_t thetaZ, 
+                   Double_t phiZ) {
+//                  
+  fGeometryManager
+    ->Matrix(krot, thetaX, phiX, thetaY, phiY, thetaZ, phiZ); 
+} 
+
+void TFluka::Gstpar(Int_t itmed, const char *param, Double_t parval) {
+//
+  fGeometryManager->Gstpar(itmed, param, parval); 
+}    
+
+// functions from GGEOM 
+Int_t TFluka::Gsvolu(const char *name, const char *shape, Int_t nmed,  
+                    Float_t *upar, Int_t np)  {
+//
+  return fGeometryManager->Gsvolu(name, shape, nmed, upar, np); 
+}
+Int_t TFluka::Gsvolu(const char *name, const char *shape, Int_t nmed,  
+                    Double_t *upar, Int_t np)  {
+//
+  return fGeometryManager->Gsvolu(name, shape, nmed, upar, np); 
+}
+void TFluka::Gsdvn(const char *name, const char *mother, Int_t ndiv, 
+                  Int_t iaxis) {
+//
+  fGeometryManager->Gsdvn(name, mother, ndiv, iaxis); 
+} 
+
+void TFluka::Gsdvn2(const char *name, const char *mother, Int_t ndiv, 
+                   Int_t iaxis, Double_t c0i, Int_t numed) {
+//
+  fGeometryManager->Gsdvn2(name, mother, ndiv, iaxis, c0i, numed); 
+} 
+
+void TFluka::Gsdvt(const char *name, const char *mother, Double_t step, 
+                  Int_t iaxis, Int_t numed, Int_t ndvmx) {
+//                     
+  fGeometryManager->Gsdvt(name, mother, step, iaxis, numed, ndvmx); 
+} 
+
+void TFluka::Gsdvt2(const char *name, const char *mother, Double_t step, 
+                   Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx) { 
+//
+  fGeometryManager->Gsdvt2(name, mother, step, iaxis, c0, numed, ndvmx); 
+} 
+
+void TFluka::Gsord(const char *name, Int_t iax) {
+//
+  fGeometryManager->Gsord(name, iax); 
+} 
+
+void TFluka::Gspos(const char *name, Int_t nr, const char *mother,  
+                  Double_t x, Double_t y, Double_t z, Int_t irot, 
+                  const char *konly) {
+//
+  fGeometryManager->Gspos(name, nr, mother, x, y, z, irot, konly); 
+} 
+
+void TFluka::Gsposp(const char *name, Int_t nr, const char *mother,  
+                   Double_t x, Double_t y, Double_t z, Int_t irot,
+                   const char *konly, Float_t *upar, Int_t np)  {
+  //
+  fGeometryManager->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np); 
+} 
+void TFluka::Gsposp(const char *name, Int_t nr, const char *mother,  
+                   Double_t x, Double_t y, Double_t z, Int_t irot,
+                   const char *konly, Double_t *upar, Int_t np)  {
+  //
+  fGeometryManager->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np); 
+} 
+
+void TFluka::Gsbool(const char* onlyVolName, const char* manyVolName) {
+//
+  fGeometryManager->Gsbool(onlyVolName, manyVolName);
+}
+
+void TFluka::SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov,
+                        Float_t *absco, Float_t *effic, Float_t *rindex) {
+//
+  fGeometryManager->SetCerenkov(itmed, npckov, ppckov, absco, effic, rindex);
+}  
+void TFluka::SetCerenkov(Int_t itmed, Int_t npckov, Double_t *ppckov,
+                        Double_t *absco, Double_t *effic, Double_t *rindex) {
+//
+  fGeometryManager->SetCerenkov(itmed, npckov, ppckov, absco, effic, rindex);
+}  
+    
+// Euclid
+void TFluka::WriteEuclid(const char* fileName, const char* topVol, 
+                          Int_t number, Int_t nlevel) {
+//
+  fGeometryManager->WriteEuclid(fileName, topVol, number, nlevel); 
+} 
+
+
+
+
+
+
+//____________________________________________________________________________ 
+// ID <--> PDG transformations
 //_____________________________________________________________________________
 Int_t TFluka::IdFromPDG(Int_t pdg) const 
 {
@@ -187,7 +415,6 @@ Int_t TFluka::IdFromPDG(Int_t pdg) const
   return GetFlukaKPTOIP(intfluka);
 }
 
-//_____________________________________________________________________________
 Int_t TFluka::PDGFromId(Int_t id) const 
 {
   //
index 99106e0471535c024dcb816afb90507be55071bf..a9e2521e577e4f8f0512e6fe6c7b7eed2e3da0d2 100644 (file)
 #include "TVirtualMC.h"
 #include "TMCProcess.h" 
 
+//Forward declaration
+class TG4GeometryManager;
+class TG4DetConstruction;
 
 class TFluka : public TVirtualMC {
   
  public:
   TFluka(const char *title, Int_t verbosity = 0);
   TFluka();
-  virtual ~TFluka() {}
+  virtual ~TFluka();
   
   //
   // methods for building/management of geometry
@@ -33,87 +36,64 @@ class TFluka : public TVirtualMC {
   // functions from GCONS 
   virtual void  Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,  
                       Float_t &dens, Float_t &radl, Float_t &absl,
-                      Float_t* ubuf, Int_t& nbuf)
-    {printf("WARNING: Gfmate not yet implemented !\n");}
+                      Float_t* ubuf, Int_t& nbuf);
   virtual void  Gfmate(Int_t imat, char *name, Double_t &a, Double_t &z,  
                       Double_t &dens, Double_t &radl, Double_t &absl,
-                      Double_t* ubuf, Int_t& nbuf)
-    {printf("WARNING: Gfmate not yet implemented !\n");}
+                      Double_t* ubuf, Int_t& nbuf);
   
   // detector composition
   virtual void  Material(Int_t& kmat, const char* name, Double_t a, 
                         Double_t z, Double_t dens, Double_t radl, Double_t absl,
-                        Float_t* buf, Int_t nwbuf)
-    {printf("WARNING: Material not yet implemented !\n");}
+                        Float_t* buf, Int_t nwbuf);
   virtual void  Material(Int_t& kmat, const char* name, Double_t a, 
                         Double_t z, Double_t dens, Double_t radl, Double_t absl,
-                        Double_t* buf, Int_t nwbuf)
-    {printf("WARNING: Material not yet implemented !\n");}
+                        Double_t* buf, Int_t nwbuf);
   virtual void  Mixture(Int_t& kmat, const char *name, Float_t *a, 
-                       Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat)
-    {printf("WARNING: Mixture not yet implemented !\n");}
+                       Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat);
   virtual void  Mixture(Int_t& kmat, const char *name, Double_t *a, 
-                       Double_t *z, Double_t dens, Int_t nlmat, Double_t *wmat)
-    {printf("WARNING: Mixture not yet implemented !\n");}
+                       Double_t *z, Double_t dens, Int_t nlmat, Double_t *wmat);
   virtual void  Medium(Int_t& kmed, const char *name, Int_t nmat, 
                       Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd, 
                       Double_t stemax, Double_t deemax, Double_t epsil, 
-                      Double_t stmin, Float_t* ubuf, Int_t nbuf)
-    {printf("WARNING: Medium not yet implemented !\n");}
+                      Double_t stmin, Float_t* ubuf, Int_t nbuf);
   virtual void  Medium(Int_t& kmed, const char *name, Int_t nmat, 
                       Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd, 
                       Double_t stemax, Double_t deemax, Double_t epsil, 
-                      Double_t stmin, Double_t* ubuf, Int_t nbuf)
-    {printf("WARNING: Medium not yet implemented !\n");}
+                      Double_t stmin, Double_t* ubuf, Int_t nbuf);
   virtual void  Matrix(Int_t& krot, Double_t thetaX, Double_t phiX, 
                       Double_t thetaY, Double_t phiY, Double_t thetaZ, 
-                      Double_t phiZ)
-    {printf("WARNING: Matrix not yet implemented !\n");}
-  virtual void  Gstpar(Int_t itmed, const char *param, Double_t parval)
-    {printf("WARNING: Gstpar not yet implemented !\n");}
+                      Double_t phiZ);
+  virtual void  Gstpar(Int_t itmed, const char *param, Double_t parval);
   
   // functions from GGEOM 
   virtual Int_t  Gsvolu(const char *name, const char *shape, Int_t nmed,  
-                          Float_t *upar, Int_t np)
-    {printf("WARNING: Gsvolu not yet implemented !\n"); return -1;}
+                       Float_t *upar, Int_t np);
   virtual Int_t  Gsvolu(const char *name, const char *shape, Int_t nmed,  
-                       Double_t *upar, Int_t np)
-    {printf("WARNING: Gsvolu not yet implemented !\n"); return -1;}
+                       Double_t *upar, Int_t np);
   virtual void  Gsdvn(const char *name, const char *mother, Int_t ndiv, 
-                     Int_t iaxis)
-    {printf("WARNING: Gsdvn not yet implemented !\n");}
+                     Int_t iaxis);
   virtual void  Gsdvn2(const char *name, const char *mother, Int_t ndiv, 
-                      Int_t iaxis, Double_t c0i, Int_t numed)
-    {printf("WARNING: Gsdvn2 not yet implemented !\n");}
+                      Int_t iaxis, Double_t c0i, Int_t numed);
   virtual void  Gsdvt(const char *name, const char *mother, Double_t step, 
-                     Int_t iaxis, Int_t numed, Int_t ndvmx)
-    {printf("WARNING: Gsdvt not yet implemented !\n");}
+                     Int_t iaxis, Int_t numed, Int_t ndvmx);
   virtual void  Gsdvt2(const char *name, const char *mother, Double_t step, 
-                      Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx)
-    {printf("WARNING: Gsdvt2 not yet implemented !\n");}
-  virtual void  Gsord(const char *name, Int_t iax)
-    {printf("WARNING: Gsord not yet implemented !\n");}
+                      Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx);
+  virtual void  Gsord(const char *name, Int_t iax);
   virtual void  Gspos(const char *name, Int_t nr, const char *mother,  
                      Double_t x, Double_t y, Double_t z, Int_t irot, 
-                     const char *konly="ONLY")
-    {printf("WARNING: Gspos not yet implemented !\n");}
+                     const char *konly="ONLY");
   virtual void  Gsposp(const char *name, Int_t nr, const char *mother,  
                       Double_t x, Double_t y, Double_t z, Int_t irot,
-                      const char *konly, Float_t *upar, Int_t np)
-    {printf("WARNING: Gsposp not yet implemented !\n");}
+                      const char *konly, Float_t *upar, Int_t np);
   virtual void  Gsposp(const char *name, Int_t nr, const char *mother,  
                       Double_t x, Double_t y, Double_t z, Int_t irot,
-                      const char *konly, Double_t *upar, Int_t np)
-    {printf("WARNING: Gsposp not yet implemented !\n");}
-  virtual void  Gsbool(const char* onlyVolName, const char* manyVolName)
-    {printf("WARNING: Gsbool not yet implemented !\n");}
+                      const char *konly, Double_t *upar, Int_t np);
+  virtual void  Gsbool(const char* onlyVolName, const char* manyVolName);
   
   virtual void  SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov,
-                           Float_t *absco, Float_t *effic, Float_t *rindex)
-    {printf("WARNING: SetCerenkov not yet implemented !\n");}
+                           Float_t *absco, Float_t *effic, Float_t *rindex);
   virtual void  SetCerenkov(Int_t itmed, Int_t npckov, Double_t *ppckov,
-                           Double_t *absco, Double_t *effic, Double_t *rindex)
-    {printf("WARNING: SetCerenkov not yet implemented !\n");}
+                           Double_t *absco, Double_t *effic, Double_t *rindex);
   
   
   // functions for drawing
@@ -127,8 +107,7 @@ class TFluka : public TVirtualMC {
     {printf("WARNING: Gdraw not yet implemented !\n");}
   
   // Euclid
-  virtual void  WriteEuclid(const char*, const char*, Int_t, Int_t)
-    {printf("WARNING: WriteEuclid not yet implemented !\n");}
+  virtual void  WriteEuclid(const char*, const char*, Int_t, Int_t);
   
   // get methods
   virtual Int_t VolId(const Text_t* volName) const
@@ -298,10 +277,8 @@ class TFluka : public TVirtualMC {
   //
   
   virtual void Init();
-  virtual void FinishGeometry()
-    {printf("WARNING: FinishGeometry not yet implemented !\n");}
-  virtual void BuildPhysics()
-    {printf("WARNING: BuildPhysics not yet implemented !\n");}
+  virtual void FinishGeometry();
+  virtual void BuildPhysics();
   virtual void ProcessEvent();
   virtual void ProcessRun(Int_t nevent);
   
@@ -327,10 +304,9 @@ class TFluka : public TVirtualMC {
   
 
 
-
-  enum {kMaxParticles = 100};
-  Int_t fNPDGCodes;               // Number of PDG codes known by FLUKA
-  Int_t fPDGCode[kMaxParticles];  // Translation table of PDG codes
+  //Geometry through Geant4 for the time being!!!
+  TG4GeometryManager*  fGeometryManager; //geometry manager
+  TG4DetConstruction*  fDetector;        //Detector
 
 
   ClassDef(TFluka,1)  //C++ interface to Fluka montecarlo