#endif
}
+////////////////////////////////////////////////////////////////////////
+//
+void FGeometryInit::BuildMediaMap()
+{
+ fRegionMediumMap = new int[fNRegions+1];
+ for (RegionIterator i = fRegionVolumeMap.begin();
+ i != fRegionVolumeMap.end();
+ i++) {
+ //Get info in the map
+ G4VPhysicalVolume* ptrVol = (*i).first;
+ int region = (*i).second;
+ G4int imed = fMediumVolumeMap[ptrVol];
+ fRegionMediumMap[region] = imed;
+ printf("BuildMediaMap %s %d %d\n",(ptrVol->GetName()).data(), region, imed);
+
+ }
+}
+
+G4int FGeometryInit::GetMedium(int region) const
+{
+ return fRegionMediumMap[region];
+}
+
+
+void FGeometryInit::SetMediumFromName(const char* volName, int medium, int volid)
+ {
+ char name4[5];
+ char tmp[5];
+ strncpy(tmp, volName, 4);
+ tmp[4]='\0';
+ fNRegions = 0;
+
+ for (RegionIterator i = fRegionVolumeMap.begin();
+ i != fRegionVolumeMap.end();
+ i++) {
+ fNRegions++;
+ //Get info in the map
+ G4VPhysicalVolume* ptrVol = (*i).first;
+ strncpy(name4, (ptrVol->GetName()).data(), 4);
+ name4[4]='\0';
+ for (int j = 0; j < 4; j++) {
+ if (name4[j] == '\0') {
+ for (int k = j; k < 4; k++) {
+ name4[k] = ' ';
+ }
+ break;
+ }
+ }
+ if (! strncmp(name4, tmp, 4)) {
+ fMediumVolumeMap[ptrVol] = medium;
+ fVolIdVolumeMap[ptrVol] = volid;
+ }
+ }
+}
+
+
+
////////////////////////////////////////////////////////////////////////
//
void FGeometryInit::BuildMaterialTables() {
size_t nElements = G4Element::GetNumberOfElements();
size_t nMaterials = G4Material::GetNumberOfMaterials();
- os << "* In Geant4 there are " << nMaterials << " materials" << endl;
- os << "* In Geant4 there are " << nElements << " elements" << endl;
- os << "* In Geant4 there are " << nIsotopes << " isotopes" << endl;
+ os << "* In Geant4 there are " << nMaterials << " materials" << G4endl;
+ os << "* In Geant4 there are " << nElements << " elements" << G4endl;
+ os << "* In Geant4 there are " << nIsotopes << " isotopes" << G4endl;
//Materials
G4cout << "\t* Printing FLUKA materials..." << G4endl;
G4cout << "<== Flugg FGeometryInit::PrintMagneticField()" << G4endl;
#endif
}
+
+int FGeometryInit::CurrentVolID(int ir, int& copyNo)
+{
+ G4PhysicalVolumeStore * pVolStore = G4PhysicalVolumeStore::GetInstance();
+ G4VPhysicalVolume * physicalvol = (*pVolStore)[ir- 1];
+ copyNo = physicalvol->GetCopyNo();
+ int id = fVolIdVolumeMap[physicalvol];
+ return id;
+}
+
+int FGeometryInit::CurrentVolOffID(int ir, int off, int& copyNo)
+{
+ if (off == 0) return CurrentVolID(ir, copyNo);
+
+ G4PhysicalVolumeStore* pVolStore = G4PhysicalVolumeStore::GetInstance();
+ G4VPhysicalVolume* physicalvol = (*pVolStore)[ir- 1];
+ G4VPhysicalVolume* mother = physicalvol;
+
+ int level = off;
+ while (level > 0) {
+ if (mother) mother = mother->GetMother();
+ level--;
+ }
+
+ int id;
+
+ if (!mother) {
+ G4cout << "Flugg FGeometryInit::CurrentVolOffID mother not found" << G4endl;
+ id = -1;
+ copyNo = -1;
+ } else {
+ copyNo = mother ->GetCopyNo();
+ id = fVolIdVolumeMap[mother];
+ }
+ return id;
+}