]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TFluka/TFluka.h
Stopping introduced.
[u/mrichter/AliRoot.git] / TFluka / TFluka.h
index 1b88c3ea68c938ce7cc4828fea03b5027adc6d7f..d7d85468a0742f6ced5d6f9cd879a1b4e2b7a393 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef TFLUKA
-#define TFLUKA
+#ifndef TFLUKA_H
+#define TFLUKA_H
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
@@ -8,28 +8,23 @@
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
 //                                                                           //
-// FLUKA implementation of the AliMC Interface                               //
+// FLUKA implementation of the VirtualMC Interface                           //
 //                                                                           //
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
 
 #include "TVirtualMC.h"
-#include "TMCProcess.h" 
-
-#include <map>
-#include <vector>
 
 //Forward declaration
-class TG4GeometryManager;
-class TG4DetConstruction;
-class TClonesArray;
-
+class TGeoMCGeometry;
+class TFlukaMCGeometry;
+class TGeoMaterial;
 
 class TFluka : public TVirtualMC {
   
  public:
-  TFluka(const char *title, Int_t verbosity = 0);
+  TFluka(const char *title, Int_t verbosity = 0,  Bool_t isRootGeometrySupported = 0);
   TFluka();
   virtual ~TFluka();
   
@@ -102,13 +97,12 @@ class TFluka : public TVirtualMC {
   
   
   // functions for drawing
-  virtual void  DrawOneSpec(const char* name)
+  virtual void  DrawOneSpec(const char* /*name*/)
     {printf("WARNING: DrawOneSpec not yet implemented !\n");}
-  virtual void  Gsatt(const char* name, const char* att, Int_t val)
-    {printf("WARNING: Gsatt not yet implemented !\n");}
-  virtual void  Gdraw(const char*,Double_t theta = 30, Double_t phi = 30,
-                     Double_t psi = 0, Double_t u0 = 10, Double_t v0 = 10,
-                     Double_t ul = 0.01, Double_t vl = 0.01)
+  virtual void  Gsatt(const char* name, const char* att, Int_t val);
+  virtual void  Gdraw(const char*,Double_t /*theta = 30*/, Double_t /*phi = 30*/,
+                     Double_t /*psi = 0*/, Double_t /*u0 = 10*/, Double_t /*v0 = 10*/,
+                     Double_t /*ul = 0.01*/, Double_t /*vl = 0.01*/)
     {printf("WARNING: Gdraw not yet implemented !\n");}
   
   // Euclid
@@ -117,8 +111,7 @@ class TFluka : public TVirtualMC {
   // get methods
   virtual Int_t VolId(const Text_t* volName) const;
   virtual const char* VolName(Int_t id) const;
-  virtual Int_t NofVolumes() const
-    {printf("NofVolumes %d\n", fNVolumes); return fNVolumes;}
+  virtual Int_t NofVolumes() const {return fNVolumes;}
   virtual Int_t VolId2Mate(Int_t id) const;
   //
   // methods for physics management
@@ -126,12 +119,11 @@ class TFluka : public TVirtualMC {
   //
   
   // set methods
-  virtual void     SetCut(const char* cutName, Double_t cutValue)
-    {printf("WARNING: SetCut not yet implemented !\n");}
-  virtual void     SetProcess(const char* flagName, Int_t flagValue)
-    {printf("WARNING: SetProcess not yet implemented !\n");}
-  virtual Double_t Xsec(char*, Double_t, Int_t, Int_t)
-    {printf("WARNING: Xsec not yet implemented !\n"); return -1.;}
+  virtual Bool_t   SetProcess(const char* flagName, Int_t flagValue);
+  virtual void     SetProcess(const char* flagName, Int_t flagValue, Int_t imed);
+  virtual Bool_t   SetCut(const char* cutName, Double_t cutValue);
+  virtual void     SetCut(const char* cutName, Double_t cutValue, Int_t imed);
+  virtual Double_t Xsec(char*, Double_t, Int_t, Int_t);
   
   // particle table usage         
   virtual Int_t   IdFromPDG(Int_t id) const;
@@ -145,10 +137,14 @@ class TFluka : public TVirtualMC {
   //
   
   // action methods
-  virtual void StopTrack()
-    {printf("WARNING: StopTrack not yet implemented !\n");}
+  virtual void   StopTrack();
+  virtual void   ResetStoppingCondition() {fStopped = kFALSE;}
+  virtual Bool_t GetStoppingCondition()   {return fStopped;}
+
   virtual void StopEvent()
     {printf("WARNING: StopEvent not yet implemented !\n");}   
+  virtual void StopRun()
+    {printf("WARNING: StopRun not yet implemented !\n");}
   
   // set methods
   virtual void SetMaxStep(Double_t);
@@ -165,14 +161,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;} 
-  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
@@ -182,7 +178,9 @@ class TFluka : public TVirtualMC {
   // tracking particle 
   // dynamic properties
   virtual void     TrackPosition(TLorentzVector& position) const;
+  virtual void     TrackPosition(Double_t& x, Double_t& y, Double_t& z) const;
   virtual void     TrackMomentum(TLorentzVector& momentum) const;
+  virtual void     TrackMomentum(Double_t& px, Double_t& py, Double_t& pz, Double_t& e) const;
   virtual Double_t TrackStep() const;
   virtual Double_t TrackLength() const;
   virtual Double_t TrackTime() const;
@@ -206,8 +204,9 @@ class TFluka : public TVirtualMC {
   virtual Int_t    NSecondaries() const ;
   virtual void     GetSecondary(Int_t isec, Int_t& particleId, 
                        TLorentzVector& position, TLorentzVector& momentum);
-  virtual TMCProcess ProdProcess(Int_t isec) const ;
-  virtual Int_t    StepProcesses(TArrayI &proc) const
+  virtual Bool_t   SecondariesAreOrdered() const {return kFALSE;}
+  virtual TMCProcess ProdProcess(Int_t iproc) const ;
+  virtual Int_t    StepProcesses(TArrayI &/*proc*/) const
     {printf("WARNING: StepProcesses not yet implemented !\n"); return -1;}
   
   
@@ -241,38 +240,70 @@ class TFluka : public TVirtualMC {
   virtual void Gspart(Int_t, const char*, Int_t, Double_t, Double_t, Double_t)
     {printf("WARNING: Gspart not yet implemented !\n");}
   
+    // Dummy methods 
+    virtual Bool_t DefineParticle(int, const char*, TMCParticleType, double, double, double) {return kTRUE;}
+    virtual Bool_t DefineIon(const char*, int, int, int, double, double) {return kTRUE;}
+    virtual TString  ParticleName(int) const {return "";}
+    virtual Double_t ParticleMass(int) const {return 0.;}
+    virtual Double_t ParticleCharge(int) const {return 0.;}
+    virtual Double_t ParticleLifeTime(int) const {return 0.;}
+    virtual TMCParticleType ParticleMCType(int) const {return (TMCParticleType) 0;}
   //
   // control methods
   // ------------------------------------------------
   //
   
   virtual void Init();
+  virtual void InitPhysics();
   virtual void FinishGeometry();
   virtual void BuildPhysics();
   virtual void ProcessEvent();
-  virtual void ProcessRun(Int_t nevent);
-  
+  virtual Bool_t ProcessRun(Int_t nevent);
 
   //
   //New Getter and Setters
   // ------------------------------------------------
   //
+  // - Core input file name
+  TString GetCoreInputFileName() const {return fCoreInputFileName;}
+  void SetCoreInputFileName(const char* n) {fCoreInputFileName = n;}
+
   // - Input file name
   TString GetInputFileName() const {return fInputFileName;}
   void SetInputFileName(const char* n) {fInputFileName = n;}
+
+  // - SetProcess and SetCut
+  Int_t GetProcessNb() const {return fNbOfProc;}
+  void SetProcessNb(Int_t l) {fNbOfProc = l;}
+  Int_t GetCutNb() const {return fNbOfProc;}
+  void SetCutNb(Int_t l) {fNbOfCut = l;}
+
   // - Verbosity level
   Int_t GetVerbosityLevel() const {return fVerbosityLevel;}
   void SetVerbosityLevel(Int_t l) {fVerbosityLevel = l;}
 
+  // - Fluka Draw procedures identifiers
+  // bxdraw = 1  inside
+  // bxdraw = 11 entering
+  // bxdraw = 12 exiting
+  // eedraw = 2
+  // endraw = 3
+  // mgdraw = 4
+  // sodraw = 5
+  // usdraw = 6
+  Int_t GetCaller() const {return fCaller;}
+  void SetCaller(Int_t l) {fCaller = l;}
+  
   // - Fluka Draw procedures formal parameters
   Int_t GetIcode() const {return fIcode;}
   void SetIcode(Int_t l) {fIcode = l;}
+  // in the case of sodraw fIcode=0
 
   Int_t GetMreg() const {return fCurrentFlukaRegion;}
-  void SetMreg(Int_t l) {fCurrentFlukaRegion = l;}
+  void SetMreg(Int_t l);
 
-  Int_t GetNewreg() const {return fNewreg;}
-  void SetNewreg(Int_t l) {fNewreg = l;}
+  Int_t GetNewreg() const {return fNewReg;}
+  void SetNewreg(Int_t l) {fNewReg = l;}
 
   Double_t GetRull() const {return fRull;}
   void SetRull(Double_t r) {fRull = r;}
@@ -288,40 +319,66 @@ class TFluka : public TVirtualMC {
 
   void SetCurrentFlukaRegion(Int_t reg) {fCurrentFlukaRegion=reg;}
   Int_t GetCurrentFlukaRegion() const {return fCurrentFlukaRegion;}
-  //
-  // test
-  // ------------------------------------------------
-  //
-  virtual void     FutoTest() ;
 
+  void   SetDummyBoundary(Int_t mode) {fDummyBoundary = mode;}
+  Int_t  GetDummyBoundary() const {return fDummyBoundary;}
+  Bool_t IsDummyBoundary() const {return (fDummyBoundary==0)?kFALSE:kTRUE;}
+  
+  void   SetGeneratePemf(Bool_t flag=kTRUE) {fGeneratePemf = flag;}
+  Bool_t IsGeneratePemf() const {return fGeneratePemf;}
+  
+  void   EnableField(Bool_t flag=kTRUE) {fFieldFlag = flag;}
+  Bool_t IsFieldEnabled() const {return fFieldFlag;}
+  void SetTrackIsEntering(){fTrackIsEntering = kTRUE; fTrackIsExiting = kFALSE;}
+  void SetTrackIsExiting() {fTrackIsExiting  = kTRUE; fTrackIsEntering = kFALSE;}
+  void SetTrackIsInside()  {fTrackIsExiting  = kFALSE; fTrackIsEntering = kFALSE;}
+  void SetTrackIsNew(Bool_t flag=kTRUE) {fTrackIsNew = flag;}
+  Int_t GetMaterialIndex(Int_t idmat) const {return fMaterials[idmat];}
+  TObjArray *GetFlukaMaterials();
+
+      
  private:
-  TFluka(const TFluka &mc){}
+  TFluka(const TFluka &mc): TVirtualMC(mc) {;}
   TFluka & operator=(const TFluka &) {return (*this);}
 
- protected:
+  
   Int_t   fVerbosityLevel; //Verbosity level (0 lowest - 3 highest)
 
-  TString fInputFileName; //Name of the input file (f.e. mu.inp)
+  TString fInputFileName;     //Name of the real input file (e.g. alice.inp)
+  TString fCoreInputFileName; //Name of the input file (e.g. corealice.inp)
 
+  Int_t    fCaller; //Parameter to indicate who is the caller of the Fluka Draw
   Int_t    fIcode;  //Fluka Draw procedures formal parameter 
-  Int_t    fNewreg; //Fluka Draw procedures formal parameter
+  Int_t    fNewReg; //Fluka Draw procedures formal parameter
   Double_t fRull;   //Fluka Draw procedures formal parameter
   Double_t fXsco;   //Fluka Draw procedures formal parameter
   Double_t fYsco;   //Fluka Draw procedures formal parameter
   Double_t fZsco;   //Fluka Draw procedures formal parameter
+  Bool_t   fTrackIsEntering;  // Flag for track entering
+  Bool_t   fTrackIsExiting;   // Flag for track exiting  
+  Bool_t   fTrackIsNew;       // Flag for new track
+  Bool_t   fFieldFlag;        // Flag for magnetic field
+  Bool_t   fGeneratePemf;     // Flag for automatic .pemf generation
+  Int_t    fDummyBoundary;    // Flag for crossing dummy boundaries
+  Bool_t   fStopped;          // Flag for stopping 
+  
+  //variables for SetProcess and SetCut
+  Int_t    fNbOfProc;                // Current number of processes 
+  Int_t    fProcessValue[10000];     // User values assigned to processes
+  Int_t    fProcessMaterial[10000];  // Materials assigned to user settings
+  Char_t   fProcessFlag[10000][5];   // User flags assigned to processes
+  Int_t    fNbOfCut;                 // Current number of cuts
+  Double_t fCutValue[10000];         // User values assigned to cuts
+  Char_t   fCutFlag[10000][7];       // User flags assigned to cuts
+  Int_t    fCutMaterial[10000];      // Materials assigned to cuts
 
+  //Geometry through TGeo
+  Int_t*               fMaterials;         //!Array of indices
+  Int_t                fNVolumes;           //!Current number of volumes
+  Int_t                fCurrentFlukaRegion; //Index of fluka region at each step
+  TFlukaMCGeometry    *fGeom;               // TGeo-FLUKA interface
+  TGeoMCGeometry      *fMCGeo;              // Interface to TGeo builder
 
-
-  //Geometry through Geant4 for the time being!!!
-  TG4GeometryManager*  fGeometryManager; //Geometry manager
-  TG4DetConstruction*  fDetector;        //Detector
-
-  TClonesArray*        fVolumeMediaMap;  //!Transient list of volumes
-  Int_t                fNVolumes;        //!Current number of volumes
-  Int_t*               fMediaByRegion;   //!Media by Fluka region
-
-  
-  Int_t fCurrentFlukaRegion; //Index of fluka region at each step
   ClassDef(TFluka,1)  //C++ interface to Fluka montecarlo
 };