// // $Id: smt_build_default.cpp,v 1.4 2001/02/02 02:53:19 hobbs Exp $ // // File: build_default.cpp // Purpose: Return a pointer to the default silicon geometry. Should be // used within test programs only... // Created: 02-JUN-1998 John Hobbs // // $Revision: 1.4 $ // // // Include files #include #include #include #include #include "rcp/RCP.hpp" #include "rcp/RCPManager.hpp" static SiGeometer* theGeometer=0; d0_Ref smt_build_default(std::string rcpname/*SiBaseGeometry"*/) // // Purpose: Wrap all necessary code to call the silicon geometry virtual // constructor using an RCP to instantiate if it doesn't exist. // Returns: d0_Ref to the silicon base geometry // { if( !theGeometer ) { // Get the geometer and see if the geometry exists theGeometer = SiGeometer::get_instance(); d0_Ref theDetector = theGeometer->get_silicon(); // If not, do something sensible if( !theDetector ) { std::cout << "Instantiating the silicon default detector" << std::endl; // Instantiate an RCP manager and read the silicon geometry RCP... edm::RCPManager* rcpman = edm::RCPManager::instance(); edm::RCP SiDefaultRCP = rcpman->extract("silicon_geometry",rcpname); // Instantiate a copy of the base geometry and hand it to the geometer. d0_Ref tmpDetector; tmpDetector = SiBaseGeometry::build_default(&SiDefaultRCP); theDetector = (D0_CONST_REFCONV((SiBaseGeometry))(tmpDetector)); theGeometer->refresh(theDetector); } } // The geometry exists in the geometer, get it. return theGeometer->get_silicon(); }