#include "L1AlgoInputSettings.h" #include #include using namespace std; using std::ios; L1AlgoInputSettings::L1AlgoInputSettings( const L1AlgoInputSettings& a) { SetSettings( a.GetSettings() ); } const L1AlgoInputSettings& L1AlgoInputSettings::operator=( const L1AlgoInputSettings& a) { SetSettings( a.GetSettings() ); return a; } void L1AlgoInputSettings::SetSettings( const fscal* geo ) { for ( int iGeo = 0; iGeo < 10000; iGeo++ ) { fGeo[iGeo] = geo[iGeo]; } } istream& L1AlgoInputSettings::eatwhite(istream& is) // skip spaces { char c; while (is.get(c)) { if (isspace(c)==0) { is.putback(c); break; } } return is; } bool L1AlgoInputSettings::ReadSettingsFromFile(const char work_dir[100], const int iVerbose) { int size; char fname[100]; strcpy (fname,work_dir); strcat (fname, "geo_algo.txt"); ifstream GeoFile(fname); if ( !GeoFile.is_open() ) return 0; if ( iVerbose > 0 ) cout << " -I- Read geometry from " << fname << endl; int i; for (i = 0; !GeoFile.eof(); i++){ fscal tmp; GeoFile >> tmp >> eatwhite; fGeo[i] = tmp; }; size = i; GeoFile.close(); if ( iVerbose > 0 ) cout << " -I- geometry has been read successfully." << endl; return 1; }