#include #include #include #include #include #include using namespace std; #include #include #include #include #include #include #include #include void Usage(void); void ParseCommandLineArguments(int narg, char *argv[]); bool USE_XML = false; bool SHOW_ANCESTORY=true; double X_LAB = 20.0; double Y_LAB = 20.0; double Z_LAB = 650.0; static void *dlgeom_handle=NULL; string HDDS_XML = "$HDDS_HOME/main_HDDS.xml"; void init_runtime_xml(void); void MakeSharedObjectFromXML(void); TGeoManager* hddsroot_runtime(void); const char* GetMD5Geom(void); const char* md5geom_runtime(void); const char* md5geom_xml(void); //------------------ // main //------------------ int main(int narg, char *argv[]) { ParseCommandLineArguments(narg, argv); double pos[3]; pos[0] = X_LAB; pos[1] = Y_LAB; pos[2] = Z_LAB; if(!gGeoManager){ #if ROOT_MAJOR>=5 && ROOT_MINOR>=28 new TGeoManager(); cout<<"Created TGeoManager :"<FindNode(X_LAB, Y_LAB, Z_LAB); if(!cnode){ cerr<<"Can't get node object from TGeoManager!"<GetVolume(); if(!vol){ cerr<<"Can't get volume object from TGeoNode!"<GetMedium()->GetMaterial(); if(!mat){ cerr<<"Can't get material object from TGeoVolume!"<GetDensity(); double RadLen=mat->GetRadLen(); double A=mat->GetA(); double Z=mat->GetZ(); cout<GetName()<GetName()<GetCurrentNavigator()->SetCurrentPoint(pos); cout<<" ancestory: "; for(int i=0; i<1000; i++){ TGeoNode *node = gGeoManager->GetCurrentNavigator()->GetMother(i); if(!node)break; if(i>0) cout << " -> "; cout << node->GetVolume()->GetName(); } cout<0){ cout<<"found existing shared object"<"<"<"<"<"<"<"<"<> tmp_hddsroot.cc"; cout << cmd << endl; system(cmd.c_str()); // Close off file with externally accessible md5geom wrapper ofs.open("tmp_hddsroot.cc", ios_base::app); ofs << "const char* md5geom_ext(void){return md5geom();}"< " + fname; system(cmd.c_str()); ifstream ifs(fname.c_str()); if(ifs.is_open()){ string str; while(ifs.good())ifs >> str; if(str.length()>=32)md5_xml = str.substr(str.length()-32); ifs.close(); } unlink(fname.c_str()); return md5_xml.c_str(); } //------------------ // GetMD5Geom //------------------ const char* GetMD5Geom(void) { // Get the MD5 checksum of the geometry that will be // used for the simulation. This will retrieve the // geometry checksum from either what has been statically // linked in, or dynamically, whichever is being used. if(USE_XML){ // Grab version from shared object return md5geom_runtime(); }else{ // Use compiled in version return md5geom(); } return NULL; } //------------------ // ParseCommandLineArguments //------------------ void ParseCommandLineArguments(int narg, char *argv[]) { vector vals; bool print_xml_md5_checksum = false; for(int i=1; i