// Standard constructor
//
fLastMaterial = 0;
- fNextRegion = 0;
- fNextLattice = 0;
+ fNextRegion = 0;
+ fNextLattice = 0;
+ fRegionList = 0;
fluka = (TFluka*)gMC;
mcgeom = this;
}
// Default constructor
//
fLastMaterial = 0;
- fNextRegion = 0;
- fNextLattice = 0;
+ fNextRegion = 0;
+ fNextLattice = 0;
+ fRegionList = 0;
fluka = (TFluka*)gMC;
mcgeom = this;
}
// Destructor
//
fgInstance=0;
+ if (fRegionList) delete [] fRegionList;
if (gGeoManager) delete gGeoManager;
}
return imatfl;
}
+//_____________________________________________________________________________
+Int_t *TFlukaMCGeometry::GetRegionList(Int_t imed, Int_t &nreg)
+{
+// Get an ordered list of regions matching a given medium number
+ nreg = 0;
+ if (!fRegionList) fRegionList = new Int_t[NofVolumes()+1];
+ TIter next(gGeoManager->GetListOfUVolumes());
+ TGeoVolume *vol;
+ Int_t imedium, ireg;
+ while ((vol = (TGeoVolume*)next())) {
+ imedium = vol->GetMedium()->GetId();
+ if (imedium == imed) {
+ ireg = vol->GetNumber();
+ fRegionList[nreg++] = ireg;
+ }
+ }
+ return fRegionList;
+}
+
+//_____________________________________________________________________________
+Int_t *TFlukaMCGeometry::GetMaterialList(Int_t imat, Int_t &nreg)
+{
+// Get an ordered list of regions matching a given medium number
+ nreg = 0;
+ if (!fRegionList) fRegionList = new Int_t[NofVolumes()+1];
+ TIter next(gGeoManager->GetListOfUVolumes());
+ TGeoVolume *vol;
+ Int_t imaterial, ireg;
+ while ((vol = (TGeoVolume*)next())) {
+ imaterial = vol->GetMedium()->GetMaterial()->GetIndex();
+ if (imaterial == imat) {
+ ireg = vol->GetNumber();
+ fRegionList[nreg++] = ireg;
+ }
+ }
+ return fRegionList;
+}
//_____________________________________________________________________________
void TFlukaMCGeometry::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
Int_t ifield, Double_t fieldm, Double_t tmaxfd,
const char* CurrentVolName() const;
const char* CurrentVolOffName(Int_t off) const;
Int_t GetMedium() const;
+ Int_t *GetRegionList(Int_t imed, Int_t &nreg);
+ Int_t *GetMaterialList(Int_t imat, Int_t &nreg);
Int_t GetFlukaMaterial(Int_t imed) const;
Int_t GetLastMaterialIndex() const {return fLastMaterial;}
virtual Int_t VolId(const Text_t* volName) const;
Int_t fLastMaterial; // last FLUKA material index
Int_t fNextRegion; // next region number
Int_t fNextLattice; // next lattice history
+ Int_t *fRegionList; //! region list matching a given medium number
ClassDef(TFlukaMCGeometry,1) //Virtual MonteCarlo Interface
};