+Int_t TFluka::VolId2Mate(Int_t id) const
+{
+//
+// Returns the material number for a given volume ID
+//
+ printf("VolId2Mate %d %d\n", id, fMediaByRegion[id]);
+ return fMediaByRegion[id-1];
+}
+
+const char* TFluka::VolName(Int_t id) const
+{
+//
+// Returns the volume name for a given volume ID
+//
+ FlukaVolume* vol = dynamic_cast<FlukaVolume*>((*fVolumeMediaMap)[id-1]);
+ const char* name = vol->GetName();
+ printf("VolName %d %s \n", id, name);
+ return name;
+}
+
+Int_t TFluka::VolId(const Text_t* volName) const
+{
+//
+// Converts from volume name to volume ID.
+// Time consuming. (Only used during set-up)
+// Could be replaced by hash-table
+//
+ char tmp[5];
+ Int_t i =0;
+ for (i = 0; i < fNVolumes; i++)
+ {
+ FlukaVolume* vol = dynamic_cast<FlukaVolume*>((*fVolumeMediaMap)[i]);
+ TString name = vol->GetName();
+ strcpy(tmp, name.Data());
+ tmp[4] = '\0';
+ if (!strcmp(tmp, volName)) break;
+ }
+ i++;
+
+ return i;
+}
+
+
+Int_t TFluka::CurrentVolID(Int_t& copyNo) const
+{
+//
+// Return the logical id and copy number corresponding to the current fluka region
+//
+ int ir = fCurrentFlukaRegion;
+ int id = (FGeometryInit::GetInstance())->CurrentVolID(ir, copyNo);
+ printf("CurrentVolID: %d %d %d \n", ir, id, copyNo);
+ return id;
+
+}
+
+Int_t TFluka::CurrentVolOffID(Int_t off, Int_t& copyNo) const
+{
+//
+// Return the logical id and copy number of off'th mother
+// corresponding to the current fluka region
+//
+ if (off == 0)
+ return CurrentVolID(copyNo);
+
+ int ir = fCurrentFlukaRegion;
+ int id = (FGeometryInit::GetInstance())->CurrentVolOffID(ir, off, copyNo);
+
+ printf("CurrentVolOffID: %d %d %d \n", ir, id, copyNo);
+ if (id == -1)
+ printf("CurrentVolOffID: Warning Mother not found !!!\n");
+ return id;
+}
+
+
+const char* TFluka::CurrentVolName() const
+{
+//
+// Return the current volume name
+//
+ Int_t copy;
+ Int_t id = TFluka::CurrentVolID(copy);
+ const char* name = TFluka::VolName(id);
+ printf("CurrentVolumeName: %d %s \n", fCurrentFlukaRegion, name);
+ return name;
+}
+
+const char* TFluka::CurrentVolOffName(Int_t off) const
+{
+//
+// Return the volume name of the off'th mother of the current volume
+//
+ Int_t copy;
+ Int_t id = TFluka::CurrentVolOffID(off, copy);
+ const char* name = TFluka::VolName(id);
+ printf("CurrentVolumeOffName: %d %s \n", fCurrentFlukaRegion, name);
+ return name;
+}
+
+Int_t TFluka::CurrentMaterial(Float_t &a, Float_t &z,
+ Float_t &dens, Float_t &radl, Float_t &absl) const
+{
+//
+// Return the current medium number
+//
+ Int_t copy;
+ Int_t id = TFluka::CurrentVolID(copy);
+ Int_t med = TFluka::VolId2Mate(id);
+ printf("CurrentMaterial: %d %d \n", fCurrentFlukaRegion, med);
+ return med;
+}
+
+