]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TFluka/TFlukaMCGeometry.h
Automatic generation of .peg and .pemf files. (A. Gheata)
[u/mrichter/AliRoot.git] / TFluka / TFlukaMCGeometry.h
1 #ifndef TFLUKAMCGEOMETRY_H
2 #define TFLUKAMCGEOMETRY_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 //
7 // Class TFlukaMCGeometry
8 // --------------------
9 // Implementation of the TVirtualMCGeometry interface
10 // for defining and using TGeo geometry with FLUKA.
11 //
12 // Author: Andrei Gheata 10/07/2003
13
14 #ifndef ROOT_TNamed
15 #include "TNamed.h"
16 #endif
17
18 #ifndef ROOT_Riostream
19 #include "Riostream.h"
20 #endif
21
22 class TFlukaMCGeometry :public TNamed {
23
24   public:
25     enum EFlukaLatticeTypes {
26        kLttcOutside = 999999999,
27        kLttcVirtual = 1000000000
28     };   
29   
30     TFlukaMCGeometry();
31     TFlukaMCGeometry(const char* name, const char* title);
32     virtual ~TFlukaMCGeometry();
33   
34     // get methods
35     Int_t         GetMedium() const;
36     Int_t        *GetRegionList(Int_t imed, Int_t &nreg);
37     Int_t        *GetMaterialList(Int_t imat, Int_t &nreg);
38     Int_t         GetFlukaMaterial(Int_t imed) const;
39     Int_t         GetLastMaterialIndex() const {return fLastMaterial;}
40     virtual Int_t NofVolumes() const;
41
42    // FLUKA specific methods
43     void          CreateFlukaMatFile(const char *fname=0);
44     void          PrintHeader(ofstream &out, const char *text) const;
45     Bool_t        IsDebugging() const {return fDebug;}
46     void          SetDebugMode(Bool_t flag=kTRUE) {fDebug = flag;}
47     void          SetMreg(Int_t mreg);
48     void          SetCurrentRegion(Int_t mreg, Int_t latt);
49     void          GetCurrentRegion(Int_t &mreg, Int_t &latt) const {mreg=fCurrentRegion; latt=fCurrentLattice;}
50     void          SetNextRegion(Int_t mreg, Int_t latt);
51     void          GetNextRegion(Int_t &mreg, Int_t &latt) const {mreg=fNextRegion; latt=fNextLattice;}
52     TGeoMaterial *GetMakeWrongMaterial(Double_t z);
53     TObjArray    *GetMatList() {return fMatList;}
54     TObjArray    *GetMatNames() {return fMatNames;}
55     Int_t         GetElementIndex(Int_t z) const;
56     Int_t         RegionId() const; 
57     void          ToFlukaString(TString &str) const;
58     void          FlukaMatName(TString &str) const;
59     void          WritePegFile(Int_t imat) const;
60
61     Double_t* CreateDoubleArray(Float_t* array, Int_t size) const;
62     void     Vname(const char *name, char *vname) const;
63    
64   private:
65     TFlukaMCGeometry(const TFlukaMCGeometry& rhs);
66     TFlukaMCGeometry& operator=(const TFlukaMCGeometry& rhs) {return (*this);}
67
68     static TFlukaMCGeometry*  fgInstance; // singleton instance
69     Bool_t       fDebug;                  // debug flag
70     Int_t        fLastMaterial;           // last FLUKA material index
71     Int_t        fCurrentRegion;          // current region number
72     Int_t        fCurrentLattice;         // current lattice history
73     Int_t        fNextRegion;             // next region number
74     Int_t        fNextLattice;            // next lattice history
75     Int_t       *fRegionList;             //! region list matching a given medium number
76     TObjArray   *fMatList;                //! material list as known by FLUKA
77     TObjArray   *fMatNames;               //! list of FLUKA material names
78   ClassDef(TFlukaMCGeometry,1)  //Virtual MonteCarlo Interface
79 };
80
81 #endif //ROOT_TFlukaMCGeometry