20#include <G4LogicalVolume.hh>
21#include <G4Material.hh>
37 std::map<G4int, TG4Medium*>::const_iterator it;
38 for (it =
fIdMap.begin(); it !=
fIdMap.end(); ++it)
delete it->second;
55 TString text =
"Medium with given ID=";
57 text +=
" already exists.";
77 TString text =
"Medium with given ID=";
79 text +=
" not defined.";
102 "Logical volume " + TString(lvName) +
" not defined.");
115 G4cout <<
"Dump of TG4MediumMap - " <<
fIdMap.size()
116 <<
" entries:" << G4endl;
118 std::map<G4int, TG4Medium*>::const_iterator it;
120 G4cout <<
"Map element " << std::setw(3) << counter++ <<
" ";
140 std::map<G4int, TG4Medium*>::const_iterator it =
fIdMap.find(mediumID);
144 TString text =
"Medium with given ID=";
146 text +=
" not defined.";
160 std::map<G4int, TG4Medium*>::const_iterator it;
162 if (it->second->GetName() == name)
return it->second;
167 "Medium " + TString(name) +
" is not found.");
177 std::map<G4LogicalVolume*, TG4Medium*>::const_iterator it =
fLVMap.find(lv);
182 "Medium for LV " + TString(lv->GetName()) +
" is not found.");
192 const G4Material* material, G4bool warn)
const
196 std::map<const G4Material*, TG4Medium*>::const_iterator it =
202 "Medium for material " + TString(material->GetName()) +
213 std::vector<TG4Medium*>& media, G4bool warn)
const
219 std::string pattern = namePattern;
220 if (pattern.find(
"*") != std::string::npos) {
221 pattern.erase(pattern.find(
"*"));
224 G4bool found =
false;
225 std::map<G4int, TG4Medium*>::const_iterator it;
227 if (it->second->GetName().find(pattern) != std::string::npos) {
228 media.push_back(it->second);
234 if (warn && (!found)) {
236 "No medium with name pattern " + TString(namePattern) +
" was found.");
Definition of the TG4GeometryServices class.
Definition of the TG4Globals class and basic container types.
Definition of the TG4MediumMap class.
Definition of the TG4Medium class.
G4LogicalVolume * FindLogicalVolume(const G4String &name, G4bool silent=false) const
static TG4GeometryServices * Instance()
static void Warning(const TString &className, const TString &methodName, const TString &text)
void MapMedium(G4LogicalVolume *lv, G4int mediumID)
TG4Medium * AddMedium(G4int mediumID, G4bool warn=true)
std::map< G4int, TG4Medium * > fIdMap
map of medias to their IDs
G4int GetNofMedia() const
TG4Medium * GetMedium(G4int mediumID, G4bool warn=true) const
std::map< const G4Material *, TG4Medium * > fMaterialMap
map of materials to medias
std::map< G4LogicalVolume *, TG4Medium * > fLVMap
map of medias to the logical volumes
void GetMedia(const G4String &namePattern, std::vector< TG4Medium * > &media, G4bool warn=true) const
Helper class to keep medium data.