CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/Validation/RecoJets/bin/InspectFit_calib.cc

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