1 #ifndef FLUKACOMPOUND_HH
2 #define FLUKACOMPOUND_HH 1
5 #include "FlukaMaterial.hh"
10 typedef std::map<G4String, FlukaCompound*, std::less<G4String> > FlukaCompoundsTable;
11 typedef std::map<G4String, FlukaCompound*, std::less<G4String> >::const_iterator FlukaCompoundsIterator;
17 FlukaCompound(const G4String& name, G4double density, G4int nElem);
18 virtual ~FlukaCompound();
22 G4String GetName() const {return fFlukaMaterial->GetName();}
23 // * Real name if the fluka name is duplicated
24 G4String GetRealName() const {return fFlukaMaterial->GetRealName();}
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];}
34 // * Associated material
35 const FlukaMaterial* GetFlukaMaterial() const {return fFlukaMaterial;}
36 FlukaMaterial* GetFlukaMaterial() {return fFlukaMaterial;}
39 void SetName(const G4String& n) {fFlukaMaterial->SetName(n);}
40 void SetDensity(G4double d) {fFlukaMaterial->SetDensity(d);}
43 void AddElement(G4int index, G4double fraction);
46 static inline const FlukaCompoundsTable* GetCompoundTable();
47 static inline const FlukaCompound* GetFlukaCompound(const G4String& name);
48 static std::ostream& PrintCompounds(std::ostream& os);
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
56 FlukaMaterial* fFlukaMaterial; //Each compound has a "dummy" mat associated
58 static FlukaCompoundsTable fFlukaCompounds;
62 inline const FlukaCompoundsTable* FlukaCompound::GetCompoundTable() {
63 return &fFlukaCompounds;
66 inline const FlukaCompound* FlukaCompound::GetFlukaCompound(const G4String& name) {
67 return fFlukaCompounds[name];
72 std::ostream& operator<<(std::ostream& os, const FlukaCompound& flucomp);