CMS 3D CMS Logo

SprAbsClassifier.cc

Go to the documentation of this file.
00001 //$Id: SprAbsClassifier.cc,v 1.2 2007/09/21 22:32:08 narsky Exp $
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   // 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 variables
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   // exit
00041   return true;
00042 }

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