00001 #ifndef __BCTEMPLATEENSEMBLETEST__H 00002 #define __BCTEMPLATEENSEMBLETEST__H 00003 00019 /* 00020 * Copyright (C) 2008-2012, Daniel Kollar and Kevin Kroeninger. 00021 * All rights reserved. 00022 * 00023 * For the licensing terms see doc/COPYING. 00024 */ 00025 00026 // -------------------------------------------------------------------------------------------- 00027 00028 #include <vector> 00029 #include <TH1D.h> 00030 00031 class TFile; 00032 class TTree; 00033 class TRandom3; 00034 00035 class BCTemplateFitter; 00036 00037 // -------------------------------------------------------------------------------------------- 00038 00039 class BCTemplateEnsembleTest 00040 { 00041 public: 00042 00046 BCTemplateEnsembleTest(); 00047 00051 ~BCTemplateEnsembleTest(); 00052 00056 int SetEnsembleTemplate(TH1D hist); 00057 00061 void SetTemplateFitter(BCTemplateFitter * model) 00062 { fTemplateFitter = model; }; 00063 00068 void SetTemplateParameters(std::vector<double> parameters) 00069 { fTemplateParameters = parameters; }; 00070 00077 int PerformEnsembleTest(TTree* tree = 0); 00078 00082 void SetEnsembleExpectation(double expectation) 00083 { fEnsembleExpectation = expectation; }; 00084 00088 void SetNEnsembles(int n) 00089 { fNEnsembles = n; }; 00090 00094 void SetFlagMCMC(bool flag) 00095 { fFlagMCMC = flag; } 00096 00100 int Write(const char * filename); 00101 00105 int PrepareTree(); 00106 00110 void PrintPulls(const char* filename); 00111 00112 private: 00113 00118 TH1D * BuildEnsemble(); 00119 00120 protected: 00121 00125 TH1D fEnsembleTemplate; 00126 00130 BCTemplateFitter * fTemplateFitter; 00131 00135 TFile * fFile; 00136 00140 TTree * fTree; 00141 00145 std::vector<double> fTemplateParameters; 00146 00150 int fEnsembleCounter; 00151 00155 double fEnsembleExpectation; 00156 00160 int fNEnsembles; 00161 00165 bool fFlagMCMC; 00166 00170 TRandom3 * fRandom; 00171 00175 std::vector<double> fOutParValue; 00176 00180 std::vector<double> fOutParModeGlobal; 00181 00185 std::vector<double> fOutParErrorUpGlobal; 00186 00190 std::vector<double> fOutParErrorDownGlobal; 00191 00195 std::vector<double> fOutParPullGlobal; 00196 00200 std::vector<double> fOutParModeMarg; 00201 00205 std::vector<double> fOutParMedianMarg; 00206 00210 std::vector<double> fOutParMeanMarg; 00211 00215 std::vector<double> fOutParRMSMarg; 00216 00220 std::vector<double> fOutParErrorUpMarg; 00221 00225 std::vector<double> fOutParErrorDownMarg; 00226 00230 std::vector<double> fOutParPullMarg; 00231 00235 std::vector<double> fOutParQuantile5Marg; 00236 00240 std::vector<double> fOutParQuantile10Marg; 00241 00245 std::vector<double> fOutParQuantile90Marg; 00246 00250 std::vector<double> fOutParQuantile95Marg; 00251 00255 std::vector<double> fOutRatioModeMarg; 00256 00260 std::vector<double> fOutRatioMedianMarg; 00261 00265 std::vector<double> fOutRatioMeanMarg; 00266 00270 std::vector<double> fOutRatioRMSMarg; 00271 00275 std::vector<double> fOutRatioErrorUpMarg; 00276 00280 std::vector<double> fOutRatioErrorDownMarg; 00281 00285 std::vector<double> fOutRatioQuantile5Marg; 00286 00290 std::vector<double> fOutRatioQuantile10Marg; 00291 00295 std::vector<double> fOutRatioQuantile90Marg; 00296 00300 std::vector<double> fOutRatioQuantile95Marg; 00301 00305 double fOutChi2Global; 00306 00311 double fOutChi2Marg; 00312 00316 int fOutNDF; 00317 00322 double fOutChi2ProbGlobal; 00323 00328 double fOutChi2ProbMarg; 00329 00333 double fOutKSProb; 00334 00338 double fOutPValue; 00339 00343 int fOutNEvents; 00344 }; 00345 00346 #endif