CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/Validation/RecoJets/bin/InspectSum_calib.cc

Go to the documentation of this file.
00001 #include <memory>
00002 #include <string>
00003 #include <cstdlib>
00004 #include <sstream>
00005 #include <fstream>
00006 #include <iostream>
00007 
00008 #include "Validation/RecoJets/interface/RootSystem.h"
00009 #include "Validation/RecoJets/interface/RootHistograms.h"
00010 #include "Validation/RecoJets/interface/RootPostScript.h"
00011 #include "Validation/RecoJets/interface/ManipHist.h"
00012 #include "Validation/RecoJets/bin/NiceStyle.cc"
00013 
00014 using namespace std;
00015 
00016 class TopInspectSum : public ManipHist {
00017  public:
00018   TopInspectSum(){};
00019   ~TopInspectSum(){};
00020   virtual void readConfig( std::string );
00021   void writeOutput(){CompHist::writeOutput(kLastOnly);};
00022 };
00023 
00024 void TopInspectSum::readConfig( std::string name )
00025 {
00026   ConfigFile cfg( name, "=", "$" );  
00027   configBlockIO  ( cfg );
00028   configBlockHist( cfg );
00029   configBlockSum ( cfg );
00030 }
00031 
00032 int main(int argc, char* argv[])
00033 {
00034   setNiceStyle();
00035   gStyle->SetOptStat( 0 );
00036 
00037   if( argc<2 ){
00038     std::cerr << "ERROR:" 
00039          << " Missing argument" << std::endl;
00040     return 1;
00041   }
00042 
00043   TopInspectSum plots;
00044   try{
00045     plots.readConfig( argv[1] );
00046     plots.loadHistograms();
00047 
00048     //histogram manipulations
00049     plots.sumHistograms();
00050 
00051     //depending on style draw ps/eps/jpg
00052     if( !strcmp(plots.writeAs().c_str(), "ps") ){
00053       plots.drawPs();
00054     } else if( !strcmp(plots.writeAs().c_str(), "eps") ){
00055       plots.drawEps();
00056     } else{
00057       std::cerr << "ERROR:"
00058            << " Unknown file format requested: "
00059            << plots.writeAs() << std::endl; 
00060       return -1;
00061     }
00062     plots.writeOutput();
00063   }
00064   catch(char* str){
00065     std::cerr << "ERROR: " << str << std::endl;
00066     return 1;
00067   }
00068   catch(...){
00069     std::cerr << "ERROR: this one is new...";
00070       return 1;
00071   }
00072   std::cout << "Thanx and GoodBye " << std::endl;
00073   return 0;
00074 }