#ifndef HGEOMEDIA_H #define HGEOMEDIA_H #include "geantdef.h" // Linked list of elements HGeoMedium called by the name of the medium. // The names of the materials and the media are identical. // There are no predefined materials. // WARNING: The Geant-routine GMATE is not!!! called. // The programm will crash if you would call it. // // If a detector is read from database, the media of this detector are also read // the database. // If a detector is read from file, you have to read the media for this // detector from file, at least these media not already read from database // and stored in list. // #include #include #include "hstring.h" #include "hgeoinfo.h" #include "hgeomedium.h" #include "hnamedlist.h" #if defined (WITHGEANT) || (WITHFORTRAN) #include "cfortran.h" #endif #ifdef WITHGEANT #include "geant321.h" #endif class HGeoMedia : public HNamedList { public: HGeoMedia() : HNamedList() { noDefMed=0; currentSensFlag=0; } ~HGeoMedia(){} // reads a list of media from file // returns HSUCCESS or HFAILURE // Before the keyword AUTONULL is found in the file, it does not read // the parameters madfld, maxstep, maxde, minstep. In this case defauld // values are used. The other parameters are read in the same order as // they are defined in hgeomedium.h. // After the keyword AUTONULL all media have to contain these additional // 4 parameters at the end. // The sensitivity fag currentSensFlag is set to 1 if the parameter // sensflag > 0 int readFileMedia(HGeoInfo & geoInfo); // reads the medium of a volume and stores it in the list if not yet // stored // returns HSUCCESS or HFAILURE int readMediumDb(HGeoInfo & geoInfo, HString & medName); // creates a material via the Geant-routines GSMATE, GSMIXT and GSTMED // returns medno, the internal geantnumber for the medium int createMedium(HString & medName, HGeoInfo & geoInfo); // returns the number of media already defined in geant int getNoDefMed() {return noDefMed;} // returns the sensitivity fag of a medium int getCurrentSensFlag() {return currentSensFlag;} // shows the whole list (names and parameters) int showAll(); // writes the whole list (names and parameters) to file int writeToFile(HGeoInfo & geoInfo); protected: // number of media already defined in geant // starts with 0 and is incremented every time before a medium is created int noDefMed; // sensitivity fag of a medium // ==1 for the medium of a sentive volume int currentSensFlag; }; #endif