// // $Id: BaseGeometry_t.cpp,v 1.7 2000/03/06 15:45:29 mayorov Exp $ // // File: test_base.cc // Purpose: Test CFT Base Geometry // Created: 10-OCT-1997 Harry L. Melanson // // $Revision: 1.7 $ // // // Include files #include #include #include "rcp/RCPManager.hpp" #include "rcp/RCP.hpp" #include "geometry_system/management/HandleSystem.hpp" #include "cft_geometry/base/CftGeometerDecoupler.hpp" #include "cft_geometry/base/CftGeometer.hpp" #include "cft_geometry/base/CftBaseGeometry.hpp" #include "cft_geometry/base/CftBarrelSurface.hpp" #include "cft_geometry/base/CftDoubletSurface.hpp" using namespace std; using edm::RCPManager; using edm::RCP; using namespace dgs; /** Base Geometry test program This program tests the base geometry classes. */ int main() { cout << "Testing CFT base geometry classes..." << endl; d0_Ref cft; // The geometry... // // RCP stuff // cout << "Get RCP manager" << endl; RCPManager* rcpman = RCPManager::instance(); try { cout << "Extract RCP parameters from file" << endl; RCP rcp = rcpman->extract("cft_geometry","CftBaseGeometry"); cft = CftBaseGeometry::build_default(&rcp); // Build default using RCP } catch(runtime_error mistake) { cerr << "ERROR: " << mistake.what() << endl; exit(1); } // // Build default detector // cout << endl << endl << "Default geometry follows..." << endl; cout << *cft << endl; // // Make a const version for Geometer tests // d0_Ref const_cft; const_cft = D0_CONST_REFCONV((CftBaseGeometry)) (cft); // // Test geometer // cout << endl << endl << "Inform CftGeometer of this geometry." << endl; CftGeometer* cftgm = CftGeometer::get_instance(); cftgm->refresh(const_cft); // ... test doublet access cout << endl << endl << "Test doublet access through CftGeometer" << endl; cout << endl << endl << "... first using direct pointers" << endl; for (int i = 1; i <= cftgm->get_doublet_count(); i++) { float radius = (cftgm->get_doublet(i))->nominal_radius(); float inner_radius = (cftgm->get_doublet(i))->inner_radius(); float outer_radius = (cftgm->get_doublet(i))->outer_radius(); cout << "Doublet " << i << " nominal radius = " << radius << endl; cout << " " << " " << " inner radius = " << inner_radius << endl; cout << " " << " " << " outer radius = " << outer_radius << endl; } // ... including Handles cout << endl << endl << "... and then using Handles" << endl; typedef Handle CftDHandle; vector_doublet; for (int i = 0; i < cftgm->get_doublet_count(); i++) { _doublet.push_back(cftgm->get_doublet_handle(i+1)); float radius = (*_doublet[i]).nominal_radius(); float minz = (*_doublet[i]).zmin(); float maxz = (*_doublet[i]).zmax(); float inner_radius = (*_doublet[i]).inner_radius(); float outer_radius = (*_doublet[i]).outer_radius(); cout << "Doublet " << i << " nominal radius = " << radius << endl; cout << " " << " " << " minimum z = " << minz << endl; cout << " " << " " << " maximum z = " << maxz << endl; cout << " " << " " << " inner radius = " << inner_radius << endl; cout << " " << " " << " outer radius = " << outer_radius << endl; } // // Test alignment interfaces // cout << endl << endl << "Test alignment interfaces" << endl; cout << endl << endl << "First move main reference point (1,2,3)" << endl; cout << endl << "New geometry follows..." << endl; const GeometryXform xform1(1.0,2.0,3.0,0.0,0.0,0.0); // Create transform cft->move(xform1); // Apply d0_Ref cft2 = cft; // Make new geometry cout << *cft2 << endl; cout << " Barrel count = " << cft2->get_barrel_count(); // // Test decoupler // cout << endl << endl << "Inform CftGeometer of new geometry..." << endl; d0_Ref const_cft2; const_cft2 = D0_CONST_REFCONV((CftBaseGeometry)) (cft2); CftGeometerDecoupler* proxy = new CftGeometerDecoupler(); proxy->refresh(const_cft2); cout << endl << "Delete old geometries" << endl; #ifndef NT_MSVCPP // This should really work under NT, but thinks both are d0_Ref cft.clear(); const_cft.clear(); #endif // // Check that movement worked, and that proxy updated the geometry // cout << endl << "Check that geometry has been moved by (1,2,3)" << endl; cout << "Also test handle refresh" << endl; cout << " Doublet count = " << cftgm->get_doublet_count() << endl; for (int i = 0; i < cftgm->get_doublet_count(); i++) { cout << "Doublet " << i << " position: " << (*_doublet[i]).get_position() << endl; } return 0; }