// // $Id: D0MaterialGeometer_t.cpp,v 1.8 2000/05/12 20:29:54 hobbs Exp $ // // File: D0MaterialGeometer_t.cc // Purpose: Test MaterialGeometer which includes beampipe and solenoid // Created: 30-MAR-1999 Abid Patwa, John Hobbs // // $Revision: 1.8 $ // // // Include files #include #include #include #include #include #include #include #include #include #include using namespace std; using edm::RCPManager; using edm::RCP; using namespace dgs; using namespace D0Material; int main() { cout << "Testing MaterialGeometer class (i.e. beampipe, solenoid)..." << endl; //////////////////////////////////////////////////////////////////////// // // Make sure assert is enabled. // //////////////////////////////////////////////////////////////////////// bool assert_flag = false; assert ( ( assert_flag = true, assert_flag ) ); if ( ! assert_flag ) { cerr << "Assert is disabled" << endl; return 1; } try { //////////////////////////////////////////////////////////////////////// // // Get D0MaterialGeometer and build geometry // //////////////////////////////////////////////////////////////////////// MaterialGeometer* MatGM = MaterialGeometer::get_instance(); assert ( MatGM != NULL ); cout << "MaterialGeometer::get_instance() successful." << endl; RCPManager* rcpman = RCPManager::instance(); RCP rcpMat = rcpman->extract("d0_geometry","MaterialGeometry"); // Instantiate an empty detector for these tests BaseGeometry d0Base; MatGM->build(&rcpMat,&d0Base); // Exercise access methods: beampipe cout << " Exercise access methods: beampipe:" << endl; const CylindricalShell* bpshell = MatGM->get_beampipe(); const Material* bpmat = bpshell->get_Material(); float bpfrac = bpshell->get_X0_frac(); float bpthick = bpshell->get_Thickness(); cout << " get_Material() = " << *bpmat << endl; cout << " get_X0_frac() = " << bpfrac << endl; cout << " get_Thickness() = " << bpthick << endl; // Exercise access methods: solenoid cout << " Exercise access methods: solenoid:" << endl; const CylindricalShell* solndshell = MatGM->get_solenoid(); const Material* solndmat = solndshell->get_Material(); float solndfrac = solndshell->get_X0_frac(); float solndthick = solndshell->get_Thickness(); cout << " get_Material() = " << *solndmat << endl; cout << " get_X0_frac() = " << solndfrac << endl; cout << " get_Thickness() = " << solndthick << endl; } catch( runtime_error mistake ) { cerr << "*** Caught exception " << mistake.what() << endl; return 1; } catch(const edm::XRCP& x) { cerr << "Caught error: " << x.logMessage() << endl; return 1; } return 0; }