00001
00002
00003 #include "PhysicsTools/StatPatternRecognition/interface/SprExperiment.hh"
00004 #include "PhysicsTools/StatPatternRecognition/interface/SprAbsClassifier.hh"
00005 #include "PhysicsTools/StatPatternRecognition/interface/SprAbsFilter.hh"
00006
00007 #include <fstream>
00008 #include <string>
00009 #include <vector>
00010
00011 using namespace std;
00012
00013
00014 bool SprAbsClassifier::store(const char* filename) const
00015 {
00016
00017 string fname = filename;
00018 ofstream os(fname.c_str());
00019 if( !os ) {
00020 cerr << "Unable to open file " << fname.c_str() << endl;
00021 return false;
00022 }
00023
00024
00025 this->print(os);
00026
00027
00028 vector<string> vars;
00029 data_->vars(vars);
00030 assert( vars.size() == data_->dim() );
00031 os << "==================================================" << endl;
00032 os << "Dimensions:" << endl;
00033 for( int i=0;i<vars.size();i++ ) {
00034 char s [200];
00035 sprintf(s,"%5i %40s",i,vars[i].c_str());
00036 os << s << endl;
00037 }
00038 os << "==================================================" << endl;
00039
00040
00041 return true;
00042 }