// D0DetectorSimulator_t.cpp #include "D0Detector.h" #include "D0DetectorSimulator.h" #include #include #include #include "trfutil/trfstream.h" using std::cout; using std::cerr; using std::endl; using std::string; using std::list; using namespace trf; //********************************************************************** int main( ) { string component = "D0DetectorSimulator."; string ok_prefix = component + " (I): "; string error_prefix = component + " test (E): "; cout << ok_prefix << "-------- Testing component " + component + ". --------" << 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; } //******************************************************************** cout << trf_format; cout << ok_prefix << "Construct." << endl; DetectorPtr pdet; pdet = new D0Detector; const Detector& det = *pdet; cout << det << endl; D0DetectorSimulator detsim(pdet); cout << detsim << endl; //******************************************************************** cout << ok_prefix << "Check the layers." << endl; int nlayer = 16; assert( det.get_layer_names().size() == nlayer ); //******************************************************************** cout << ok_prefix << "Check the simulator." << endl; assert( detsim.get_generators().size() == nlayer ); //******************************************************************** cout << ok_prefix << "------------- All tests passed. -------------" << endl; return 0; //******************************************************************** }