Xephyr  0.0
dataHandler.h
1 #ifndef DATAHANDLER
2 #define DATAHANDLER
3 #include "XeStat.h"
4 
5 #include "XeUtils.h"
6 #include <TString.h>
7 #include "TGraph2D.h"
8 #include "TNtuple.h"
9 #include "TParameter.h"
10 #include <cmath>
11 #include <csignal>
12 #include <iostream>
13 #include <vector>
14 #include <utility> // std::pair, std::make_pair
15 
16 enum DATA_TYPE {
17 
18  UNSPECIFIED_DATA = - 1
19  , AM_BE_DATA
20  , E_GAMMA_DATA
21  , DM_DATA
22  , ER_BACKGROUND
23  , ER_LEAKAGE
24  , NR_BACKGROUND
25  , ALL_BACKGROUNDS
26  , DM_SIMULATED_DATA
28  , ASIMOV_DATA
29  } ;
30 
31 using namespace std;
32 
33 
34 
35 
36 class dataHandler : public errorHandler{
37 
38  public:
39  dataHandler( TString name, TString fileName, TString dmTree);
40 
41  // if you just want to run Sensitivity
42  dataHandler( TString name);
43 
44  //If you want to run with asimov as data
45  dataHandler( TString name, TH2F *h2pdf);
46 
47  // if you want ro run with fake data as data.
48  dataHandler( TString name, TH2F *h2pdf, int N);
49 
50  ~dataHandler();
51 
52  TTree *DMdata;
53 
54 
55  // TH2F *asimovData;
56 
57  TFile *file;
58 
59  TString Name;
60 
61  TString TreePrefix;
62 
63  TH2F *grid;
64 
65  TString FirstVarName;
66  TString SecondVarName;
67 
68 
69  float s1;
70  float s2;
71  float weight;
72 
73  int dataType;
74 
75  void drawS1S2(TString opt="");
76 
77  TGraph2D *gs1s2w;
78 
79  double sumOfWeights;
80 
81  vector<int> getSimulatedInfo(unsigned int size);
82 
83  double getS1(int N) { if (N>gs1s2w->GetN()) {printf ("ERROR %d larger than Entries (%d) \n",N,gs1s2w->GetN()); return 0;} else return (gs1s2w->GetX()[N]); }
84  double getS2(int N) { if (N>gs1s2w->GetN()) {printf ("ERROR %d larger than Entries (%d) \n",N,gs1s2w->GetN()); return 0;} else return (gs1s2w->GetY()[N]); }
85  double getW(int N) { if (N>gs1s2w->GetN()) {printf ("ERROR %d larger than Entries (%d) \n",N,gs1s2w->GetN()); return 0;} else return (gs1s2w->GetZ()[N]); }
86 
87  TGraph getS1S2();
88 
89  Long64_t getEntries();
90 
91  double getSumOfWeights();
92 
93  void printSummary();
94 
95  void getEntry(Long64_t entry);
96 
97  void generateAsimov( TH2F *background);
98 
99  void generateDataSet(TH2F *h2pdf, int N);
100 
101  static double integrate(TH2F *histo, double s1_min, double s1_max, double s2_min, double s2_max);
102  void setData(int Type) {dataType = Type; };
103 
104 
105 
106  void fillDataHisto(TH2F *hist);
107 
108  double getValFromPdf( TH2F &histo );
109 
110  //change the tree pointer to data, assumed to be in same file.
111  void setDataTree(TString nameTree);
112 
114  void setDataTree(TTree *tree);
115 
116  //change the file.
117  void setFile(TString PathtoFile);
118 
120  void setPrefixTree( TString prefix ) { TreePrefix = prefix ; } ;
121 
123  void setTreeIndex( int index );
124 
125  //change the file and tree in one go.
126  void setFileAndTree(TString PathtoFile, TString nameTree);
127 
128  void addToDataSet(TH2F *h2pdf, int N);
129 
131  vector<string> getTrueParamsNames();
132 
134  vector<double> getTrueParams();
135 
136 
137 };
138 
139 
140 
141 
142 
143 #endif
Definition: dataHandler.h:36
Helper Class to send consistently formatted messages. It allows different levels of severity for the ...
Definition: XeUtils.h:22
void setPrefixTree(TString prefix)
set the prefix for the name of the tree collection to iterate on, usefull for neyman construction...
Definition: dataHandler.h:120