00001
00002
00003 #include "PhysicsTools/StatPatternRecognition/interface/SprExperiment.hh"
00004 #include "PhysicsTools/StatPatternRecognition/interface/SprAbsVarTransformer.hh"
00005
00006 #include <stdio.h>
00007 #include <string>
00008 #include <fstream>
00009 #include <sstream>
00010
00011 using namespace std;
00012
00013
00014 bool SprAbsVarTransformer::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 os << "==================================================" << endl;
00029 os << "Old Variables:" << endl;
00030 for( int i=0;i<oldVars_.size();i++ ) {
00031 char s [200];
00032 sprintf(s,"%5i %40s",i,oldVars_[i].c_str());
00033 os << s << endl;
00034 }
00035 os << "==================================================" << endl;
00036
00037
00038 os << "==================================================" << endl;
00039 os << "New Variables:" << endl;
00040 for( int i=0;i<newVars_.size();i++ ) {
00041 char s [200];
00042 sprintf(s,"%5i %40s",i,newVars_[i].c_str());
00043 os << s << endl;
00044 }
00045 os << "==================================================" << endl;
00046
00047
00048 return true;
00049 }