Mapping between fluka regions and VirtualMC media improved.
[u/mrichter/AliRoot.git] / Flugg / FGeometryInit.hh
1
2 // Flugg tag 
3
4 // modified 10/IX/99 for including preStepPoint
5 // modified 28/IX/99 for delating allocated memory
6 // modified 4/X/99 function FreeMemory
7 // modified 2/III/00 base class G4TransportationManager included   
8 // modified 20/III/00 PrintHistories() included
9
10  
11 #ifndef FGeometryInit_h
12 #define FGeometryInit_h 1
13
14 //#include "g4std/fstream"
15 //#include "g4std/iomanip"
16 //#include "g4rw/cstring.h"
17 #include "globals.hh"
18
19 #include "G4LogicalVolume.hh"
20 #include "G4PhysicalVolumeStore.hh"
21 #include "G4VPhysicalVolume.hh"
22 #include "G4Material.hh"
23 #include "G4MaterialTable.hh"
24 #include "G4Isotope.hh"
25 #include "G4VUserDetectorConstruction.hh"
26 #include "G4TouchableHistory.hh"
27 #include "G4GeometryManager.hh"
28 #include "G4FieldManager.hh"
29 #include "G4UniformMagField.hh"
30 #include "G4TransportationManager.hh"
31
32
33 #include <map>
34
35 class FluggNavigator;
36 class FlukaMaterial;
37 class FlukaCompound;
38
39 class FGeometryInit : public G4TransportationManager {
40
41 public:
42   ~FGeometryInit();     //destructor
43   static FGeometryInit *GetInstance();
44   inline FluggNavigator *getNavigatorForTracking();
45   inline G4FieldManager * getFieldManager();
46   inline void setDetConstruction(G4VUserDetectorConstruction* detector);
47   inline void setDetector();
48   inline void setMotherVolume();
49   void createFlukaMatFile();
50   void closeGeometry();
51   
52   void PrintHistories();
53   void InitHistories();
54   void DeleteHistories();
55   void UpdateHistories(const G4NavigationHistory *, G4int);
56   inline G4TouchableHistory * GetTouchableHistory();
57   inline G4TouchableHistory * GetOldNavHist();
58   inline G4TouchableHistory * GetTempNavHist();
59   
60   void InitHistArray();
61   inline void DelHistArray();
62   inline G4int * GetHistArray();
63   
64   void InitJrLtGeantArray();
65   inline G4int * GetJrLtGeantArray();
66   inline G4int GetLttcFlagGeant();
67   void SetLttcFlagGeant(G4int);
68   void PrintJrLtGeant();
69
70   //Map access methods
71   void  BuildMediaMap();
72   void  SetMediumFromName(const char* volName, int med);
73     //G4int GetRegionFromName(const char* volName) const;
74   G4int GetMedium(int) const;
75     
76
77 protected:
78   void BuildRegionsMap();
79   void PrintRegionsMap(G4std::ostream& os);
80   void BuildMaterialTables();
81   FlukaMaterial* BuildFlukaMaterialFromElement(const G4Element* element, 
82                                                G4double matDensity);
83   FlukaMaterial* BuildFlukaMaterialFromIsotope(const G4Isotope* isotope,
84                                                G4double matDensity);
85   FlukaCompound* BuildFlukaCompoundFromMaterial(const G4Material* material); 
86   FlukaCompound* BuildFlukaCompoundFromElement(const G4Element* element,
87                                                G4double matDensity);
88   void PrintMaterialTables(G4std::ostream& os);
89   void PrintAssignmat(G4std::ostream& os);
90   void PrintMagneticField(G4std::ostream& os);
91
92 private:    
93   FGeometryInit();      //costructor
94
95 private:
96   G4VUserDetectorConstruction * fDetector;
97   G4FieldManager * fFieldManager; 
98   G4TransportationManager * fTransportationManager;
99   static FGeometryInit *flagInstance;
100   G4VPhysicalVolume * myTopNode;
101   G4GeometryManager * ptrGeoMan;
102   G4int * ptrArray;
103   G4TouchableHistory * ptrTouchHist;
104   G4TouchableHistory * ptrOldNavHist;
105   G4TouchableHistory * ptrTempNavHist;
106   G4int * ptrJrLtGeant;
107   G4int flagLttcGeant;
108   G4int  fNRegions;
109   int* fRegionMediumMap;
110     
111   G4std::map<G4VPhysicalVolume*, int, G4std::less<G4VPhysicalVolume*> > fRegionVolumeMap;
112   G4std::map<G4VPhysicalVolume*, int, G4std::less<G4VPhysicalVolume*> > fMediumVolumeMap;
113
114   G4std::map<G4Material*, FlukaMaterial*, G4std::less<G4Material*> > G4FlukaMaterialMap;
115   G4std::map<G4Material*, FlukaCompound*, G4std::less<G4Material*> > G4FlukaCompoundMap;
116   //G4int NOfMaterials;
117 };
118
119 typedef  G4std::map<G4VPhysicalVolume*, int, G4std::less<G4VPhysicalVolume*> >::const_iterator RegionIterator;
120 typedef  G4std::vector<G4Material*>::const_iterator MatTableIterator;
121
122
123 //Include the file with the inline methods
124 #include "FGeometryInit.icc"
125
126 #endif