]>
Commit | Line | Data |
---|---|---|
26d97e06 | 1 | #ifndef FLUKACOMPOUND_HH |
2 | #define FLUKACOMPOUND_HH 1 | |
3 | ||
4 | #include "G4String.hh" | |
5 | #include "FlukaMaterial.hh" | |
6 | ||
7 | #include <map> | |
8 | ||
9 | class FlukaCompound; | |
10 | typedef G4std::map<G4String, FlukaCompound*, G4std::less<G4String> > FlukaCompoundsTable; | |
11 | typedef G4std::map<G4String, FlukaCompound*, G4std::less<G4String> >::const_iterator FlukaCompoundsIterator; | |
12 | ||
13 | class FlukaCompound { | |
14 | public: | |
15 | ||
16 | //Constructor | |
17 | FlukaCompound(const G4String& name, G4double density, G4int nElem); | |
18 | virtual ~FlukaCompound(); | |
19 | ||
20 | //Getters | |
21 | // * Fluka name | |
22 | G4String GetName() const {return fFlukaMaterial->GetName();} | |
23 | // * Real name if the fluka name is duplicated | |
24 | G4String GetRealName() const {return fFlukaMaterial->GetRealName();} | |
25 | // * Density | |
26 | G4double GetDensity() const {return fFlukaMaterial->GetDensity();} | |
27 | // * Index (it comes from the material) | |
28 | G4int GetIndex() const {return fFlukaMaterial->GetIndex();} | |
29 | // * Number of materials, and index and fraction for each material | |
30 | G4int GetNMaterials() const {return fNMaterials;} | |
31 | G4int GetMaterialIndex(G4int i) const {return fElIndex[i];} | |
32 | G4double GetMaterialFraction(G4int i) const {return fFraction[i];} | |
33 | ||
34 | // * Associated material | |
35 | const FlukaMaterial* GetFlukaMaterial() const {return fFlukaMaterial;} | |
36 | FlukaMaterial* GetFlukaMaterial() {return fFlukaMaterial;} | |
37 | ||
38 | //Setters | |
39 | void SetName(const G4String& n) {fFlukaMaterial->SetName(n);} | |
40 | void SetDensity(G4double d) {fFlukaMaterial->SetDensity(d);} | |
41 | ||
42 | //Other | |
43 | void AddElement(G4int index, G4double fraction); | |
44 | ||
45 | //Static | |
46 | static inline const FlukaCompoundsTable* GetCompoundTable(); | |
47 | static inline const FlukaCompound* GetFlukaCompound(const G4String& name); | |
48 | static G4std::ostream& PrintCompounds(G4std::ostream& os); | |
49 | ||
50 | public: | |
51 | G4int fNMaterials; //Number of elements in total | |
52 | G4int fNAdded; //Number of elements added | |
53 | G4int* fElIndex; //Array of element indices | |
54 | G4double* fFraction; //Array of element fracions | |
55 | ||
56 | FlukaMaterial* fFlukaMaterial; //Each compound has a "dummy" mat associated | |
57 | ||
58 | static FlukaCompoundsTable fFlukaCompounds; | |
59 | ||
60 | }; | |
61 | ||
62 | inline const FlukaCompoundsTable* FlukaCompound::GetCompoundTable() { | |
63 | return &fFlukaCompounds; | |
64 | } | |
65 | ||
66 | inline const FlukaCompound* FlukaCompound::GetFlukaCompound(const G4String& name) { | |
67 | return fFlukaCompounds[name]; | |
68 | } | |
69 | ||
70 | ||
71 | //Ostream operator | |
72 | G4std::ostream& operator<<(G4std::ostream& os, const FlukaCompound& flucomp); | |
73 | ||
74 | #endif | |
75 |