// CFTPathBuilder_t.cpp #include "CFTPathBuilder.h" #include #include #include "trfutil/trfstream.h" #include "trfbase/ETrack.h" #include "trffind/Path.h" #include "trfcyl/SurfCylinder.h" #include "SimpleCFTDetector.h" using std::cout; using std::cerr; using std::endl; using std::string; using namespace trf; //********************************************************************** int main( ) { string component = "CFTPathBuilder"; 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 << "Create starting track." << endl; ETrack tre0( SurfacePtr(new SurfCylinder(10.)) ); //******************************************************************** cout << ok_prefix << "Create paths." << endl; SimpleCFTDetector det; CFTPathBuilder path_builder(det,tre0,2.0,0.5,3.0); MutablePathPtr phead( new Path ); path_builder.add_path_tree(phead); cout << *phead << endl; //******************************************************************** cout << ok_prefix << "Check 1st generation." << endl; assert( phead->get_children().size() == 1 ); assert( path_builder.get_stops().size() == 2 ); //******************************************************************** cout << ok_prefix << "Check descendants." << endl; PathPtr pchild = phead; int nlyr = 16; for ( int ilyr=1; ilyr<=nlyr; ++ilyr ) { assert( pchild->get_children().size() == 1 ); pchild = pchild->get_children().front(); cout << *pchild << endl; } assert( pchild->get_children().size() == 0 ); //******************************************************************** cout << ok_prefix << "------------- All tests passed. -------------" << endl; return 0; //******************************************************************** }