]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TFluka/TFluka.h
Clean-up. (E. Futo)
[u/mrichter/AliRoot.git] / TFluka / TFluka.h
index ce72dd9608c15a972733a77f6b54fc017db6d972..c8dec479c8654acc80f9dbc59a7623938b7c8036 100644 (file)
@@ -8,7 +8,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
 //                                                                           //
-// FLUKA implementation of the AliMC Interface                               //
+// FLUKA implementation of the VirtualMC Interface                           //
 //                                                                           //
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 //Forward declaration
 class TG4GeometryManager;
 class TG4DetConstruction;
+class TClonesArray;
+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();
   
@@ -100,40 +103,32 @@ 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)
+  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  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
   virtual void  WriteEuclid(const char*, const char*, Int_t, Int_t);
   
   // get methods
-  virtual Int_t VolId(const Text_t* volName) const
-    {printf("WARNING: VolId not yet implemented !\n"); return -1;}
-  virtual const char* VolName(Int_t id) const
-    {printf("WARNING: VolName not yet implemented !\n"); return "void";}
-  virtual Int_t NofVolumes() const
-    {printf("WARNING: NofVolumes not yet implemented !\n"); return -1;}
-  virtual Int_t VolId2Mate(Int_t id) const
-    {printf("WARNING: VolId2Mate not yet implemented !\n"); return -1;}
-  
+  virtual Int_t VolId(const Text_t* volName) const;
+  virtual const char* VolName(Int_t id) const;
+  virtual Int_t NofVolumes() const {return fNVolumes;}
+  virtual Int_t VolId2Mate(Int_t id) const;
   //
   // methods for physics management
   // ------------------------------------------------
   //
   
   // 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 void     SetProcess(const char* flagName, Int_t flagValue);
+  virtual void     SetCut(const char* cutName, Double_t cutValue);
+  virtual Double_t Xsec(char*, Double_t, Int_t, Int_t);
   
   // particle table usage         
   virtual Int_t   IdFromPDG(Int_t id) const;
@@ -153,36 +148,28 @@ class TFluka : public TVirtualMC {
     {printf("WARNING: StopEvent not yet implemented !\n");}   
   
   // set methods
-  virtual void SetMaxStep(Double_t)
-    {printf("WARNING: SetMaxStep not yet implemented !\n");}
-  virtual void SetMaxNStep(Int_t)
-    {printf("WARNING: SetMaxNStep not yet implemented !\n");}
-  virtual void SetUserDecay(Int_t)
-    {printf("WARNING: SetUserDecay not yet implemented !\n");}  
+  virtual void SetMaxStep(Double_t);
+  virtual void SetMaxNStep(Int_t);
+  virtual void SetUserDecay(Int_t);
   
   // get methods
   // tracking volume(s) 
-  virtual Int_t    CurrentVolID(Int_t& copyNo) const
-    {printf("WARNING: CurrentVolID not yet implemented !\n"); return -1;}
-  virtual Int_t    CurrentVolOffID(Int_t off, Int_t& copyNo) const
-    {printf("WARNING: CurrentVolOffID not yet implemented !\n"); return -1;}
-  virtual const char* CurrentVolName() const
-    {printf("WARNING: CurrentVolName not yet implemented !\n"); return "void";}
-  virtual const char* CurrentVolOffName(Int_t off) const
-    {printf("WARNING: CurrentVolOffName not yet implemented !\n"); return "void";}
+  virtual Int_t    CurrentVolID(Int_t& copyNo) const;
+  virtual Int_t    CurrentVolOffID(Int_t off, Int_t& copyNo) const;
+  virtual const char* CurrentVolName() const;
+  virtual const char* CurrentVolOffName(Int_t off) const;
   virtual Int_t    CurrentMaterial(Float_t &a, Float_t &z, 
-                                  Float_t &dens, Float_t &radl, Float_t &absl) const
-    {printf("WARNING: CurrentMaterial 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");}
+      {printf("WARNING: CurrentEvent not yet implemented !\n"); return -1;} 
+  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
@@ -191,55 +178,35 @@ class TFluka : public TVirtualMC {
   
   // tracking particle 
   // dynamic properties
-  virtual void     TrackPosition(TLorentzVector& position) const
-    {printf("WARNING: TrackPosition not yet implemented !\n");}
-  virtual void     TrackMomentum(TLorentzVector& momentum) const
-    {printf("WARNING: TrackMomentum not yet implemented !\n");}
-  virtual Double_t TrackStep() const
-    {printf("WARNING: TrackStep not yet implemented !\n"); return -1.;}
-  virtual Double_t TrackLength() const
-    {printf("WARNING: TrackLength not yet implemented !\n"); return -1.;} 
-  virtual Double_t TrackTime() const
-    {printf("WARNING: TrackTime not yet implemented !\n"); return -1.;}
-  virtual Double_t Edep() const
-    {printf("WARNING: Edep not yet implemented !\n"); return -1.;}
+  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;
+  virtual Double_t Edep() const;
   // static properties
-  virtual Int_t    TrackPid() const
-    {printf("WARNING: TrackPid not yet implemented !\n"); return -1;}
-  virtual Double_t TrackCharge() const
-    {printf("WARNING: TrackCharge not yet implemented !\n"); return -1.;}
-  virtual Double_t TrackMass() const
-    {printf("WARNING: TrackMass not yet implemented !\n"); return -1.;}
-  virtual Double_t Etot() const
-    {printf("WARNING: Etot not yet implemented !\n"); return -1.;}
-  
+  virtual Int_t    TrackPid() const;
+  virtual Double_t TrackCharge() const;
+  virtual Double_t TrackMass() const;
+  virtual Double_t Etot() const;
   // track status
-  virtual Bool_t   IsNewTrack() const
-    {printf("WARNING: IsNewTrack not yet implemented !\n"); return 0;}
-  virtual Bool_t   IsTrackInside() const
-    {printf("WARNING: IsTrackInside not yet implemented !\n"); return 0;}
-  virtual Bool_t   IsTrackEntering() const
-    {printf("WARNING: IsTrackEntering not yet implemented !\n"); return 0;}
-  virtual Bool_t   IsTrackExiting() const
-    {printf("WARNING: IsTrackExiting not yet implemented !\n"); return 0;}
-  virtual Bool_t   IsTrackOut() const
-    {printf("WARNING: IsTrackOut not yet implemented !\n"); return 0;}
-  virtual Bool_t   IsTrackDisappeared() const
-    {printf("WARNING: IsTrackDisappeared not yet implemented !\n"); return 0;}
-  virtual Bool_t   IsTrackStop() const
-    {printf("WARNING: IsTrackStop not yet implemented !\n"); return 0;}
-  virtual Bool_t   IsTrackAlive() const
-    {printf("WARNING: IsTrackAlive not yet implemented !\n"); return 0;}
+  virtual Bool_t   IsNewTrack() const;
+  virtual Bool_t   IsTrackInside() const;
+  virtual Bool_t   IsTrackEntering() const;
+  virtual Bool_t   IsTrackExiting() const;
+  virtual Bool_t   IsTrackOut() const;
+  virtual Bool_t   IsTrackDisappeared() const;
+  virtual Bool_t   IsTrackStop() const;
+  virtual Bool_t   IsTrackAlive() const;
  
   // secondaries
-  virtual Int_t    NSecondaries() const
-    {printf("WARNING: NSecondaries not yet implemented !\n"); return -1;}
+  virtual Int_t    NSecondaries() const ;
   virtual void     GetSecondary(Int_t isec, Int_t& particleId, 
-                               TLorentzVector& position, TLorentzVector& momentum)
-    {printf("WARNING: GetSecondary not yet implemented !\n");}
-  virtual TMCProcess ProdProcess(Int_t isec) const
-    {printf("WARNING: StepProcesses not yet implemented !\n"); return kPNoProcess;} 
-  virtual Int_t    StepProcesses(TArrayI &proc) const
+                       TLorentzVector& position, TLorentzVector& momentum);
+  virtual TMCProcess ProdProcess(Int_t iproc) const ;
+  virtual Int_t    StepProcesses(TArrayI &/*proc*/) const
     {printf("WARNING: StepProcesses not yet implemented !\n"); return -1;}
   
   
@@ -273,12 +240,23 @@ 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 void DefineParticle(int, const char*, TMCParticleType, double, double, double){;}
+    virtual void DefineIon(const char*, int, int, int, double, double){;}
+    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;}
+    void   SetDummyBoundary(Int_t mode) {fDummyBoundary = mode;}
+    Int_t  GetDummyBoundary() const {return fDummyBoundary;}
   //
   // control methods
   // ------------------------------------------------
   //
   
   virtual void Init();
+  virtual void InitPhysics();
   virtual void FinishGeometry();
   virtual void BuildPhysics();
   virtual void ProcessEvent();
@@ -289,37 +267,106 @@ class TFluka : public TVirtualMC {
   //New Getter and Setters
   // ------------------------------------------------
   //
+  // - Core input file name
+  TString GetCoreInputFileName() const {return sCoreInputFileName;}
+  void SetCoreInputFileName(const char* n) {sCoreInputFileName = n;}
+
   // - Input file name
-  TString GetInputFileName() const {return fInputFileName;}
-  void SetInputFileName(const char* n) {fInputFileName = n;}
+  TString GetInputFileName() const {return sInputFileName;}
+  void SetInputFileName(const char* n) {sInputFileName = n;}
+
+  // - SetProcess and SetCut
+  Int_t GetProcessNb() const {return iNbOfProc;}
+  void SetProcessNb(Int_t l) {iNbOfProc = l;}
+  Int_t GetCutNb() const {return iNbOfProc;}
+  void SetCutNb(Int_t l) {iNbOfCut = 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;}
+
+  Int_t GetNewreg() const {return iNewreg;}
+  void SetNewreg(Int_t l) {iNewreg = l;}
+
+  Double_t GetRull() const {return fRull;}
+  void SetRull(Double_t r) {fRull = r;}
+
+  Double_t GetXsco() const {return fXsco;}
+  void SetXsco(Double_t x) {fXsco = x;}
+
+  Double_t GetYsco() const {return fYsco;}
+  void SetYsco(Double_t y) {fYsco = y;}
+
+  Double_t GetZsco() const {return fZsco;}
+  void SetZsco(Double_t z) {fZsco = z;}
+
   void SetCurrentFlukaRegion(Int_t reg) {fCurrentFlukaRegion=reg;}
   Int_t GetCurrentFlukaRegion() const {return fCurrentFlukaRegion;}
 
+  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;}
+
  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. alice.inp)
+                                                                                
+  TString sInputFileName;     //Name of the real input file (e.g. alice.inp)
+  TString sCoreInputFileName; //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    iNewreg; //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
+                                                                                
+  //variables for SetProcess and SetCut
+  Int_t    iNbOfProc;
+  Int_t    iProcessValue[100];
+  Char_t   sProcessFlag[100][5];
+  Int_t    iNbOfCut;
+  Double_t fCutValue[100];
+  Char_t   sCutFlag[100][7];
+  Int_t    fDummyBoundary;
   
-
-
   //Geometry through Geant4 for the time being!!!
-  TG4GeometryManager*  fGeometryManager; //geometry manager
+  TG4GeometryManager*  fGeometryManager; //Geometry manager
   TG4DetConstruction*  fDetector;        //Detector
+                                                                                
+  TClonesArray*        fVolumeMediaMap;  //!Transient list of volumes
 
-  //Index of fluka region at each step
-  Int_t fCurrentFlukaRegion;
-  //Map between volume name and media indices
-  std::map<TString, Int_t, std::less<TString> > fVolumeMediaMap;
-  //Map between region and media indices
-  std::vector<Int_t> fMediaByRegion;
-
-
+  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
 };