CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
InspectFit_calib.cc
Go to the documentation of this file.
1 #include <memory>
2 #include <string>
3 #include <fstream>
4 #include <iostream>
5 
11 
12 using namespace std;
13 
14 class TopInspectFit : public FitHist {
15  public:
18  virtual void readConfig( std::string );
19 };
20 
21 
22 void TopInspectFit::readConfig( std::string name )
23 {
24  ConfigFile cfg( name, "=", "$" );
25  configBlockIO ( cfg );
26  configBlockHist( cfg );
27  configBlockFit ( cfg );
28 }
29 
30 int main(int argc, char* argv[])
31 {
32  setNiceStyle();
33  gStyle->SetOptStat( 0 );
34  gStyle->SetOptFit ( 0 );
35 
36  gStyle->SetStatColor(0);
37  gStyle->SetStatBorderSize(0);
38  gStyle->SetStatX(0.93);
39  gStyle->SetStatY(0.93);
40  gStyle->SetStatW(0.18);
41  gStyle->SetStatH(0.18);
42 
43  if( argc<2 ){
44  std::cerr << "ERROR:"
45  << " Missing argument" << std::endl;
46  return 1;
47  }
48 
49  TopInspectFit plots;
50  try{
51  plots.readConfig( argv[1] );
52  plots.loadHistograms();
53 
54  //depending on style draw ps/eps/jpg
55  if( !strcmp(plots.writeAs().c_str(), "ps") ){
56  plots.fitAndDrawPs();
57  } else if( !strcmp(plots.writeAs().c_str(), "eps") ){
58  plots.fitAndDrawEps();
59  } else{
60  std::cerr << "ERROR:"
61  << " Unknown file format requested: "
62  << plots.writeAs() << std::endl;
63  return -1;
64  }
65  plots.fillTargetHistograms();
66  plots.writeFitOutput();
67  }
68  catch(char* str){
69  std::cerr << "ERROR: " << str << std::endl;
70  return 1;
71  }
72  catch(...){
73  std::cerr << "ERROR: this one is new...";
74  return 1;
75  }
76  std::cout << "works " << "thanx and GoodBye " << std::endl;
77  return 0;
78 }
void fitAndDrawPs()
Definition: FitHist.cc:314
Definition: FitHist.h:8
void fitAndDrawEps()
Definition: FitHist.cc:414
void writeFitOutput()
Definition: FitHist.cc:562
int main(int argc, char **argv)
virtual void readConfig(std::string)
boost::shared_ptr< ParameterSet > readConfig(std::string const &config)
void fillTargetHistograms()
Definition: FitHist.cc:512
void loadHistograms(std::vector< std::string > &, std::vector< TObjArray > &)
Definition: CompHist.cc:159
std::string writeAs()
Definition: CompHist.h:50
tuple cout
Definition: gather_cfg.py:41
void setNiceStyle()
Definition: NiceStyle.cc:3