CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
CalibClosureTest Class Reference
Inheritance diagram for CalibClosureTest:
ManipHist FitHist CompHist

Public Member Functions

 CalibClosureTest ()
 
void configBlockSpecific (ConfigFile &)
 
void drawCorrel ()
 
void drawEff ()
 
TString output (const char *, std::string &, const char *)
 
TString output (const char *, std::string &, std::string &, const char *)
 
virtual void readConfig (std::string)
 
 ~CalibClosureTest ()
 
- Public Member Functions inherited from ManipHist
void divideAndDrawEps ()
 
void divideAndDrawPs ()
 
 ManipHist ()
 
void sumHistograms ()
 
virtual ~ManipHist ()
 
- Public Member Functions inherited from FitHist
void fillTargetHistograms ()
 
void fitAndDrawEps ()
 
void fitAndDrawPs ()
 
 FitHist ()
 
 FitHist (bool verbose)
 
void writeFitOutput ()
 
virtual ~FitHist ()
 
- Public Member Functions inherited from CompHist
 CompHist ()
 
 CompHist (bool verbose)
 
void draw (TCanvas &, TLegend &, int &, int &)
 
void drawEps ()
 
void drawPs ()
 
bool histFilter (TString &, std::vector< std::string > &)
 
bool histFilter (TString &, std::vector< std::string > &, CompHist::HistFilter)
 
void loadHistograms (std::vector< std::string > &, std::vector< TObjArray > &)
 
void loadHistograms ()
 
void setVerbose (bool val)
 
bool verbose ()
 
std::string writeAs ()
 
void writeOutput (CompHist::RootOutput)
 
void writeOutput ()
 
virtual ~CompHist ()
 

Private Attributes

std::vector< std::string > cmpObjLabelList_
 
std::vector< std::string > corrAxesLabelList_
 
std::vector< std::string > corrHistNameList_
 
std::vector< std::string > effAxesLabelList_
 
std::vector< std::string > effHistNameList_
 

Additional Inherited Members

- Public Types inherited from FitHist
enum  EvalType { kStabilizedGauss, kHistogramMean, kMaximalValue, kQuantile }
 
- Public Types inherited from CompHist
enum  HistFilter { kBeginsWith, kEndsWith, kContains }
 
enum  RootOutput { kFirstOnly, kLastOnly, kAll }
 
- Protected Member Functions inherited from ManipHist
void configBlockDivide (ConfigFile &)
 
void configBlockSum (ConfigFile &)
 
TH1F & divideHistograms (TH1F &, TH1F &, int)
 
double ratioCorrelatedError (double &, double &, double &, double &)
 
double ratioUncorrelatedError (double &, double &, double &, double &)
 
- Protected Member Functions inherited from FitHist
void addBinLabelToFitHist (const TObjArray &, int &, TString &, TString &)
 
void addParLabelToFitHist (const TH1F &)
 
bool checkTargetHistList ()
 
void configBlockFit (ConfigFile &)
 
void fillTargetHistogram (std::string &)
 
void fillTargetHistogramBin (TH1F &, TH1F &, int)
 
void fillTargetHistogramBin (TH1F &, TH1F &, int, TString &, Quantile &)
 
void fillTargetHistogramBin (TH1F &, TH1F &, int, TString &, MaximalValue &)
 
void fillTargetHistogramBin (TH1F &, TH1F &, int, TString &, HistogramMean &)
 
void fillTargetHistogramBin (TH1F &, TH1F &, int, TString &, StabilizedGauss &)
 
TH1F & findFitHistogram (const TObjArray &, TString &, TString &, int &)
 
TH1F & findTargetHistogram (const TObjArray &, TString &, TString &, TString &)
 
bool isInFitTargetList (std::string &)
 
double normalize (TString &, double)
 
void setFitHistogramAxes (TH1F &, int)
 
- Protected Member Functions inherited from CompHist
void configBlockHist (ConfigFile &)
 
void configBlockIO (ConfigFile &)
 
double findMaximum (int)
 
bool isOutputRequested ()
 
std::string legend (int)
 
void readHistogramList ()
 
void readLabels (std::string, std::vector< std::string > &)
 
void setAxesStyle (TH1 &, const char *, const char *)
 
void setCanvasStyle (TCanvas &)
 
void setCanvGrid (TCanvas &, int)
 
void setCanvLog (TCanvas &, int)
 
void setFillColor (TH1F &, int)
 
void setFillStyle (TH1F &, int)
 
void setHistLabels (TH1F &, int)
 
void setHistMax (TH1F &, int)
 
void setHistMin (TH1F &, int)
 
void setHistScale (TH1F &, int)
 
void setHistStyles (TH1F &, int, int)
 
void setLegendStyle (TLegend &)
 
void setLineColor (TH1F &, int)
 
void setLineStyle (TH1F &, int)
 
void setLineWidth (TH1F &, int)
 
void setMarkerColor (TH1F &, int)
 
void setMarkerSize (TH1F &, int)
 
void setMarkerStyle (TH1F &, int)
 
- Protected Attributes inherited from ManipHist
int errorType_
 
std::vector< double > weights_
 
- Protected Attributes inherited from FitHist
std::vector< int > axesIndex_
 
int evalType_
 
double fitFuncLowerBound_
 
std::string fitFuncName_
 
std::string fitFuncTitle_
 
int fitFuncType_
 
double fitFuncUpperBound_
 
std::vector< std::string > targetHistList_
 
std::vector< std::string > xAxesFit_
 
std::vector< std::string > yAxesFit_
 
- Protected Attributes inherited from CompHist
std::vector< short int > commonStyle_
 
std::vector< short int > commonWidth_
 
std::vector< std::string > dirNameList_
 
std::vector< short int > errors_
 
std::vector< TFile * > fileList_
 
std::vector< std::string > fileNameList_
 
std::string filterOpt_
 
std::vector< short int > gridX_
 
std::vector< short int > gridY_
 
std::vector< short int > histColor_
 
std::string histFile_
 
std::vector< std::string > histFilterList_
 
std::vector< std::string > histList_
 
std::vector< short int > histStyle_
 
std::vector< std::string > legendEntries_
 
double legXLeft_
 
double legXRight_
 
double legYLower_
 
double legYUpper_
 
std::vector< short int > logX_
 
std::vector< short int > logY_
 
std::vector< double > markerSize_
 
std::vector< short int > markerStyle_
 
std::vector< double > max_
 
std::vector< double > min_
 
std::string output_
 
std::vector< std::string > outputLabelList_
 
std::vector< std::string > plotFilterList_
 
std::string rootOutDir_
 
std::vector< TObjArray > sampleList_
 
std::vector< double > scale_
 
bool verbose_
 
std::string writeAs_
 
std::string writeTo_
 
std::vector< std::string > xAxes_
 
std::vector< std::string > yAxes_
 

Detailed Description

Definition at line 14 of file CalibClosureTest.cc.

Constructor & Destructor Documentation

CalibClosureTest::CalibClosureTest ( )
inline

Definition at line 16 of file CalibClosureTest.cc.

16 {};
CalibClosureTest::~CalibClosureTest ( )
inline

Definition at line 17 of file CalibClosureTest.cc.

17 {};

Member Function Documentation

void CalibClosureTest::configBlockSpecific ( ConfigFile cfg)

Definition at line 48 of file CalibClosureTest.cc.

References benchmark_cfg::cerr, cmsRelvalreport::exit, ConfigFile::read(), and readVector().

49 {
50  //-----------------------------------------------
51  // read all configurables defined in CompHisto-
52  // grams from config file. Throw human readable
53  // exception when misspellings occure
54  //-----------------------------------------------
55  try{
56  //-----------------------------------------------
57  // input/output files
58  //-----------------------------------------------
59  readVector ( cfg.read<std::string>( "corrHistNames" ), corrHistNameList_ );
60  readLabels ( cfg.read<std::string>( "corrAxesLabels"), corrAxesLabelList_);
61  readVector ( cfg.read<std::string>( "effHistNames" ), effHistNameList_ );
62  readLabels ( cfg.read<std::string>( "effAxesLabels" ), effAxesLabelList_ );
63  readVector ( cfg.read<std::string>( "cmpObjectLabels"), cmpObjLabelList_ );
64  }
65  catch(...){
66  std::cerr << "ERROR during reading of config file" << std::endl;
67  std::cerr << " misspelled variables in cfg ?" << std::endl;
68  std::cerr << " [--called in configBlockSpecific--]" << std::endl;
69  std::exit(1);
70  }
71 }
T read(const std::string &key) const
Definition: ConfigFile.h:173
std::vector< std::string > effHistNameList_
void readVector(std::string s, std::vector< T > &vec)
Definition: CompHist.h:23
std::vector< std::string > effAxesLabelList_
std::vector< std::string > corrHistNameList_
void readLabels(std::string, std::vector< std::string > &)
Definition: CompHist.cc:9
std::vector< std::string > corrAxesLabelList_
std::vector< std::string > cmpObjLabelList_
void CalibClosureTest::drawCorrel ( )

Definition at line 162 of file CalibClosureTest.cc.

References estimatePileup::hist, MultipleCompare::legend, and convertSQLitetoXML_cfg::output.

Referenced by main().

163 {
164  std::vector<TObjArray> corrSampleList;
165  loadHistograms(corrHistNameList_, corrSampleList);
166 
167  TCanvas *canv = new TCanvas("canv", "histograms", 600, 600);
168  setCanvasStyle( *canv );
169  canv->SetGridx( 1 );
170  canv->SetGridy( 1 );
171 
172  //---------------------------------------------
173  // loop histograms via the list of histogram
174  // names stored in corrHistNameList_, open a
175  // new file for each histogram and each sample
176  //---------------------------------------------
177  for(unsigned int jdx=0; jdx<corrHistNameList_.size(); ++jdx){
178  //---------------------------------------------
179  // loop all available samples, open a new file
180  // for each sample
181  //---------------------------------------------
182  std::vector<TObjArray>::const_iterator hist = corrSampleList.begin();
183  for(unsigned int idx=0; hist!=corrSampleList.end(); ++hist, ++idx){
184  TLegend* leg = new TLegend(legXLeft_,legYLower_,legXRight_,legYUpper_);
185  setLegendStyle( *leg );
186 
187  TPostScript psFile(output("/inspectCorrel_", corrHistNameList_[jdx], outputLabelList_[idx], "eps"), 113);
188  psFile.NewPage();
189 
190  TH2F& hcmp = *((TH2F*)(*hist)[jdx]);
191  hcmp.SetLineColor ( histColor_[idx] );
192  hcmp.SetFillColor ( histColor_[idx] );
193  hcmp.SetMarkerColor( histColor_[idx] );
194  char xstring[100], ystring[100];
195  if( jdx<corrAxesLabelList_.size() ){
196  sprintf(xstring, corrAxesLabelList_[jdx].c_str(), cmpObjLabelList_[0].c_str() );
197  sprintf(ystring, corrAxesLabelList_[jdx].c_str(), cmpObjLabelList_[1].c_str() );
198  }
199  setAxesStyle( hcmp, xstring, ystring );
200  leg->AddEntry( &hcmp, legend( idx ).c_str(), "FL" );
201  hcmp.Draw("box");
202  leg->Draw( "same" );
203  canv->RedrawAxis( );
204  canv->Update( );
205  psFile.Close();
206  delete leg;
207  }
208  }
209  canv->Close();
210  delete canv;
211 }
void setLegendStyle(TLegend &)
Definition: CompHist.cc:480
void setAxesStyle(TH1 &, const char *, const char *)
Definition: CompHist.cc:532
TString output(const char *, std::string &, const char *)
std::vector< short int > histColor_
Definition: CompHist.h:118
std::string legend(int)
Definition: CompHist.cc:457
std::vector< std::string > corrHistNameList_
std::vector< std::string > outputLabelList_
Definition: CompHist.h:112
void setCanvasStyle(TCanvas &)
Definition: CompHist.cc:488
double legXRight_
Definition: CompHist.h:129
double legXLeft_
Definition: CompHist.h:129
std::vector< std::string > corrAxesLabelList_
double legYUpper_
Definition: CompHist.h:130
void loadHistograms()
Definition: CompHist.cc:216
double legYLower_
Definition: CompHist.h:130
std::vector< std::string > cmpObjLabelList_
void CalibClosureTest::drawEff ( )

Definition at line 101 of file CalibClosureTest.cc.

References estimatePileup::hist, MultipleCompare::legend, and convertSQLitetoXML_cfg::output.

Referenced by main().

102 {
103  std::vector<TObjArray> effSampleList;
104  loadHistograms(effHistNameList_, effSampleList);
105 
106  TCanvas *canv = new TCanvas("canv", "histograms", 600, 600);
107  setCanvasStyle( *canv );
108  canv->SetGridx( 1 );
109  canv->SetGridy( 1 );
110 
111  //---------------------------------------------
112  // loop histograms via the list of histogram
113  // names stored in effHistNameList_, open a
114  // new page for each histogram; histograms are
115  // expected in order ref(0)/sample(1),...
116  //---------------------------------------------
117  for(unsigned int jdx=0; jdx<effHistNameList_.size()/2; ++jdx){
118  TPostScript psFile(output("/inspectMatch_", effHistNameList_[2*jdx], "eps"), 113);
119  psFile.NewPage();
120 
121  TLegend* leg = new TLegend(legXLeft_,legYLower_,legXRight_,legYUpper_);
122  setLegendStyle( *leg );
123  //-----------------------------------------------
124  // loop each sample, draw all sample for a given
125  // histogram name in one plot
126  //-----------------------------------------------
127  std::vector<TObjArray>::const_iterator hist = effSampleList.begin();
128  for(unsigned int idx=0; hist!=effSampleList.end(); ++hist, ++idx){
129  TH1F& href = *((TH1F*)(*hist)[2*jdx]); //recieve histograms
130  TH1F& hcmp = *((TH1F*)(*hist)[2*jdx+1]);
131  setHistStyles( hcmp, jdx, idx );
132 
133  if(idx==0){
134  // prepare axes labels
135  char xstring[100], ystring[100];
136  if( idx<effAxesLabelList_.size() )
137  sprintf(xstring, effAxesLabelList_[jdx].c_str(), cmpObjLabelList_[1].c_str());
138  sprintf(ystring, "match^{%s}/match^{%s}", cmpObjLabelList_[0].c_str(), cmpObjLabelList_[1].c_str());
139  hcmp.GetXaxis()->SetTitle( xstring );
140  hcmp.GetYaxis()->SetTitle( ystring );
141  hcmp.SetMinimum(0.85*hcmp.GetMinimum());
142  hcmp.SetMaximum(1.25*hcmp.GetMaximum());
143  divideHistograms(hcmp, href, 1);
144  hcmp.Draw();
145  }
146  else{
147  divideHistograms(hcmp, href, 1);
148  hcmp.Draw("same");
149  }
150  leg->AddEntry( &hcmp, legend( idx ).c_str(), "PL" );
151  }
152  leg->Draw( "same" );
153  canv->RedrawAxis( );
154  canv->Update( );
155  psFile.Close();
156  delete leg;
157  }
158  canv->Close();
159  delete canv;
160 }
void setLegendStyle(TLegend &)
Definition: CompHist.cc:480
std::vector< std::string > effHistNameList_
TH1F & divideHistograms(TH1F &, TH1F &, int)
Definition: ManipHist.cc:194
std::vector< std::string > effAxesLabelList_
TString output(const char *, std::string &, const char *)
std::string legend(int)
Definition: CompHist.cc:457
void setHistStyles(TH1F &, int, int)
Definition: CompHist.cc:556
void setCanvasStyle(TCanvas &)
Definition: CompHist.cc:488
double legXRight_
Definition: CompHist.h:129
double legXLeft_
Definition: CompHist.h:129
double legYUpper_
Definition: CompHist.h:130
void loadHistograms()
Definition: CompHist.cc:216
double legYLower_
Definition: CompHist.h:130
std::vector< std::string > cmpObjLabelList_
TString CalibClosureTest::output ( const char *  pre,
std::string &  name,
const char *  post 
)

Definition at line 86 of file CalibClosureTest.cc.

References convertSQLitetoXML_cfg::output.

87 {
88  // prepare name of the output file
89  TString buffer( name );
90  if( ((TString)buffer(buffer.Last('_')+1, buffer.Length())).IsDigit() )
91  buffer.Remove(buffer.Last('_'), buffer.Length()); // chop off everything before the
92  buffer.Remove(0, buffer.Last ('_')+1); // second to last and last '_'
93  TString output( writeTo_.c_str() );
94  output+=pre;
95  output+=buffer;
96  output+= ".";
97  output+=post;
98  return output;
99 }
std::string writeTo_
Definition: CompHist.h:111
TString output(const char *, std::string &, const char *)
TString CalibClosureTest::output ( const char *  pre,
std::string &  name,
std::string &  label,
const char *  post 
)

Definition at line 74 of file CalibClosureTest.cc.

References label, and convertSQLitetoXML_cfg::output.

75 {
76  TString buffer( output(pre, name, post) );
77  buffer.Remove(buffer.Last('.'), buffer.Length());
78  buffer+="_";
79  buffer+=label;
80  buffer+=".";
81  buffer+=post;
82  return buffer;
83 }
const std::string & label
Definition: MVAComputer.cc:186
TString output(const char *, std::string &, const char *)
void CalibClosureTest::readConfig ( std::string  name)
virtual

Implements CompHist.

Definition at line 38 of file CalibClosureTest.cc.

Referenced by main().

39 {
40  ConfigFile cfg( name, "=", "$" );
41  configBlockIO ( cfg );
42  configBlockHist( cfg );
43  configBlockFit ( cfg );
44  configBlockSpecific( cfg );
45 }
void configBlockSpecific(ConfigFile &)
void configBlockHist(ConfigFile &)
Definition: CompHist.cc:72
void configBlockFit(ConfigFile &)
Definition: FitHist.cc:9
void configBlockIO(ConfigFile &)
Definition: CompHist.cc:40

Member Data Documentation

std::vector<std::string> CalibClosureTest::cmpObjLabelList_
private

Definition at line 32 of file CalibClosureTest.cc.

std::vector<std::string> CalibClosureTest::corrAxesLabelList_
private

Definition at line 31 of file CalibClosureTest.cc.

std::vector<std::string> CalibClosureTest::corrHistNameList_
private

Definition at line 30 of file CalibClosureTest.cc.

std::vector<std::string> CalibClosureTest::effAxesLabelList_
private

Definition at line 34 of file CalibClosureTest.cc.

std::vector<std::string> CalibClosureTest::effHistNameList_
private

Definition at line 33 of file CalibClosureTest.cc.