CMS 3D CMS Logo

SprAbsVarTransformer.cc

Go to the documentation of this file.
00001 // $Id: SprAbsVarTransformer.cc,v 1.1 2007/11/12 06:19:18 narsky Exp $
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   // open file for output
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   // store into file
00025   this->print(os);
00026 
00027   // store old variables
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   // store new variables
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   // exit
00048   return true;
00049 }

Generated on Tue Jun 9 17:41:59 2009 for CMSSW by  doxygen 1.5.4