From 0bc73b6c454cdccfe58bf914009925c2861ce8e4 Mon Sep 17 00:00:00 2001 From: morsch Date: Thu, 8 Apr 2004 10:07:46 +0000 Subject: [PATCH] GetFlukaMaterial method added. (A. Gheata) --- TFluka/TFlukaMCGeometry.cxx | 15 ++++++++++++++- TFluka/TFlukaMCGeometry.h | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/TFluka/TFlukaMCGeometry.cxx b/TFluka/TFlukaMCGeometry.cxx index 98ad23f0a45..0fe69f803c7 100644 --- a/TFluka/TFlukaMCGeometry.cxx +++ b/TFluka/TFlukaMCGeometry.cxx @@ -345,6 +345,19 @@ Int_t TFlukaMCGeometry::GetMedium() const return imed; } +//_____________________________________________________________________________ +Int_t TFlukaMCGeometry::GetFlukaMaterial(Int_t imed) const +{ +// Returns FLUKA material index for medium IMED + TGeoMedium *med = (TGeoMedium*)gGeoManager->GetListOfMedia()->At(imed-1); + if (!med) { + Error("GetFlukaMaterial", "MEDIUM %i nor found", imed); + return -1; + } + Int_t imatfl = med->GetMaterial()->GetIndex(); + return imatfl; +} + //_____________________________________________________________________________ void TFlukaMCGeometry::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd, @@ -400,7 +413,7 @@ void TFlukaMCGeometry::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t i // performed with g3helix; ifield = 3 if tracking performed with g3helx3. // - kmed = gGeoManager->GetListOfMedia()->GetSize()+3; // !!! in FLUKA they start with 3 + kmed = gGeoManager->GetListOfMedia()->GetSize()+1; gGeoManager->Medium(name,kmed,nmat, isvol, ifield, fieldm, tmaxfd, stemax,deemax, epsil, stmin); printf("Medium %s: kmed=%i, nmat=%i, isvol=%i\n", name, kmed, nmat,isvol); } diff --git a/TFluka/TFlukaMCGeometry.h b/TFluka/TFlukaMCGeometry.h index f9ec8a11934..b390a625193 100644 --- a/TFluka/TFlukaMCGeometry.h +++ b/TFluka/TFlukaMCGeometry.h @@ -109,6 +109,7 @@ class TFlukaMCGeometry : public TVirtualMCGeometry { const char* CurrentVolName() const; const char* CurrentVolOffName(Int_t off) const; Int_t GetMedium() const; + Int_t GetFlukaMaterial(Int_t imed) const; Int_t GetLastMaterialIndex() const {return fLastMaterial;} virtual Int_t VolId(const Text_t* volName) const; virtual const char* VolName(Int_t id) const; -- 2.43.0