#ifndef HGEOINFO_H #define HGEOINFO_H #include "geantdef.h" // // class to hold information used in various parts of the programm. // // Searches the filename with the substring "set" ( keyword for the // set which should be read ) in the array geoFiles in geantInput // ( see hgeantinput.h) and Connects the input-source, a file or the // database Oracle depending on the extention. // If the file has the extension .db or .DB or no extension the // geometrical information will be read from database // The information which input-source is actually used is stored in the // element inputFlag as 'f' for file and 'd' for database. It's used // in the further programm the select the read-routines. // // ns is the number of sectors. It is set to 6 in the constructor. // WARNING: If ns is changing, there might be some problems when reading // and creating the geometry. To avoid these problems one should // use the inout-flag in the geometry_file of the sectors to // create only the desired sectors. // The array nsSet stores the inout-flag of the sectors. // ( If (nsSet[i]==1) sector i is actually created. The array is filled // in the routines readDet(...) in hgeosect.cc. // #include #include "hstring.h" #ifdef WITHORACLE #include "oraconn.h" // class oraConnection containes all functions to establish // the connection to database #include "hgeooraread.h" // class HGeoOraRead containes the functions to read the geometry // information from the database #endif class HGeoInfo { public: HGeoInfo() { #ifdef WITHORACLE geoDb=0; dbConn=0; #endif ns=6; for(int i=7;i--;nsSet[i]=0); } ~HGeoInfo() { #ifdef WITHORACLE delete geoDb; delete dbConn; #endif closeFile(); } // searches the filename with the substring "set" and connects the // input-source depending on the file-extension int connectInput(const HString &set); // returns flag for input-source char getinputFlag() {return inputFlag;} //closes file void closeFile(); // returns the number of sectors int getNs() {return ns;} // stores inout-flag of sector i void setnsSet(int value, int i) {if (i>=0 && i<7) nsSet[i]=value;} // returns inout-flag of sector i int getnsSet(int i) {return nsSet[i];} // sets name of outout directory void setOutputDir(const HString & dirName) { outputDir=dirName; return; } // returns name of outout directory HString & getOutputDir() {return outputDir;} #ifdef WITHORACLE HGeoOraRead *geoDb; oraConnection *dbConn; #endif ifstream fin; protected: // opens file with actual filename int openFile(); // connect database int connectDb(); //actual filename HString filename; // flag for input-source char inputFlag; // Number of sectors, initialized to 6 by the constructor int ns; // array to store inout-flag of sectors int nsSet[7]; // name of directory for output files (for media and geometry) HString outputDir; }; #endif