Xephyr  0.0
XePdfObjects.h
1 #ifndef XEPDFOBJECTS_H
2 #define XEPDFOBJECTS_H
3 
4 #include "XeStat.h"
5 #include <TString.h>
6 #include "TGraph2D.h"
7 #include "TNtuple.h"
8 #include <cmath>
9 #include <csignal>
10 #include <iostream>
11 #include <vector>
12 #include <utility> // std::pair, std::make_pair
13 #include "dataHandler.h"
14 #include "XeUtils.h"
15 #include "TColor.h"
16 
17 using namespace std;
18 
19 
26 class shapeSys : public LKParameter {
27 
28  public:
29 
34  shapeSys(TString name);
35 
36 
38  double getNearestLow();
39 
41  double getNearestHigh();
42 
43 };
44 
45 
46 class scaleSys : public LKParameter {
47 
48  public:
49  // relativeUncertainty = 1 sigma relative uncertainty (example 10% uncertainty would be 0.1)
50  scaleSys(TString name, double relativeUncertainty);
52 
53  // gives the Normalization scale factor according to t-valued uncertainty --> (1 + t_val * relativeUncertainty )
54  // Uses the current t-value which is automatically linked to its pdfLikelihood
55  double getNormModifier();
56 
57 
58  //this case return a sys that is centered in zero, half a gaussian, t-value strictly positive
59  //and for a tvalue=0 have zero events. Histo is supposed to be normalized to 1
60  void setNull(){ isNull = true; setMinimum(0.);};
61 
62  private:
63  double relUnc;
64  bool isNull;
65 
66 
67 };
68 
69 
70 class pdfComponent :public errorHandler{
71 
72  public:
74  pdfComponent(TString name, TString filename);
75 
77  pdfComponent(TString component_name, TString filename, TString hist_name);
78 
79  ~pdfComponent();
80 
85  void autoLoad(TString tag="",char dd='_') {myShapeUnc=(scanFile(tag,dd));};
86 
87  vector< shapeSys * > scanFile(TString tag="",char dd='_');
88 
89  void addScaleSys(scaleSys *addMe) { myScaleUnc.push_back(addMe); };
90 
91  void addShapeSys(shapeSys *addMe) { myShapeUnc.push_back(addMe); };
92 
94  void loadHistos();
95 
97  void loadDefaultHisto();
98 
100 
103  double getNormalizedDensity(double s1, double s2);
104 
106  double getDefaultDensity(double s1, double s2);
107 
109  double getNormalizedEvents();
110 
112  double getDefaultEvents();
113 
115 
119  TH2F getInterpolatedHisto();
120 
122  TH2F getDefaultHisto();
123 
125  TString getNearestHistoName(vector<bool> setOfVal);
126 
128  TString getDefaultHistoName();
129 
131  TString getParamValueString();
132 
133  TString getParamValueWritable();
134 
136 
140  double getDefaultPdfIntegral(double s1_min, double s1_max, double s2_min, double s2_max);
141 
143 
147  void plotInterpolatedSpace(bool doProjectionX, double min, double max, int Nsteps, bool legend_left = false, double y_max = 0.);
148 
150  /* getDefaultHisto, getInterpolatedHisto, getNormalizedDensity,
151  * getDefaultDensity, getNormalizedEvents, getDefaultEvents
152  */
153  void setScaleFactor(double val) {scaleFactor = val;};
154 
156  void setEvents(double nevents);
157 
158  scaleSys* getScaleSys(TString name);
159  shapeSys* getShapeSys(TString name);
160  void replaceUncertainty(TString name, scaleSys* newScale);
161  void replaceUncertainty(TString name, shapeSys* newShape);
162 
164  TString getName() {return pdf_name;};
165 
167  TString getComponentName() {return component_name;};
168 
169  vector<scaleSys*> myScaleUnc;
170  vector<shapeSys*> myShapeUnc;
171 
172  TString suffix;
173  bool doExtend;
174 
175  private:
176  TFile *file;
177  TH2F *defaultDistro;
178  vector<TH2F*> histos;
179  vector<double> InterpFactors;
180  TString pdf_name;
181  TString component_name;
182  vector<double> old_t_val;
183  double scaleFactor;
184 
185 
186  void extendHisto(TH2F &h);
187 
188 };
189 
190 
191 
200 class histoCompare : public errorHandler{
201 
202  public:
203 
204  histoCompare();
205  ~histoCompare();
206 
207  //---------OPTIONS-----------//
208  int rebinX;
209  int rebinY;
210  bool projectionX;
211  double projectionMin;
212  double projectionMax;
213  int binMin;
214  int binMax;
215  bool doStack;
216  TString titleX;
217  TString titleY;
218  //---------------------------//
219 
221  void setBaseHisto(TH2F b, TString n=""){base = b; names[0] = n;};
223  void addHistoToList(TH2F h, TString n ="") {compareList.push_back(h); names.push_back(n);};
225  void setNameofComponent(unsigned int i, TString n);
227  void compare();
228 
230  void printModels();
231 
233  void compareWithRatio();
234 
235  void drawLegend(TH1D *baseH, vector <TH1D*> list );
236 
237  //return a string of info
238  TString projectionInfo();
239 
240  //------ histo holders --------//
241  TH2F base;
242  vector <TString> names;
243  vector <TH2F> compareList;
244 
245  TH1D *projectedBase;
246  vector <TH1D*> projectedList;
247 
248  private:
249 
250  void setOptions(TH1D *h, bool dataLike = true, bool isBottom = false);
251  void project();
257 };
258 
259 
260 
261 
262 
263 
264 #endif
TString titleX
Definition: XePdfObjects.h:216
Definition: XeStat.h:312
int binMin
Definition: XePdfObjects.h:213
vector< shapeSys * > myShapeUnc
container of scale sys
Definition: XePdfObjects.h:170
void setBaseHisto(TH2F b, TString n="")
set histo with wich one one to compare the rest
Definition: XePdfObjects.h:221
it represents a Shape Systematic. It inherits from LKParameter. Here you can use the LKParameter func...
Definition: XePdfObjects.h:26
Helper Class to send consistently formatted messages. It allows different levels of severity for the ...
Definition: XeUtils.h:22
void autoLoad(TString tag="", char dd='_')
load automatically all histograms and associate them to shape uncertainty the "tag" is the histogram ...
Definition: XePdfObjects.h:85
int binMax
Definition: XePdfObjects.h:214
double projectionMax
Definition: XePdfObjects.h:212
void addHistoToList(TH2F h, TString n="")
set the comparison histos
Definition: XePdfObjects.h:223
void setScaleFactor(double val)
scale the pdf by VAL, this happend for the methods:
Definition: XePdfObjects.h:153
Definition: XePdfObjects.h:46
TString suffix
container of shape sys
Definition: XePdfObjects.h:172
TString getName()
Returns the histogram name.
Definition: XePdfObjects.h:164
This class is supposed to compare a "base" histo with a set of other histogram. One can choose for ra...
Definition: XePdfObjects.h:200
Definition: XePdfObjects.h:70
TString getComponentName()
Returns the component name.
Definition: XePdfObjects.h:167