00001 #ifndef __BCTEMPLATEENSEMBLETEST__H 00002 #define __BCTEMPLATEENSEMBLETEST__H 00003 00016 /* 00017 * Copyright (C) 2008-2011, Daniel Kollar and Kevin Kroeninger. 00018 * All rights reserved. 00019 * 00020 * For the licensing terms see doc/COPYING. 00021 */ 00022 00023 // -------------------------------------------------------------------------------------------- 00024 00025 #include <vector> 00026 #include <TH1D.h> 00027 00028 class TFile; 00029 class TTree; 00030 class TRandom3; 00031 00032 class BCTemplateFitter; 00033 00034 // -------------------------------------------------------------------------------------------- 00035 00036 class BCTemplateEnsembleTest 00037 { 00038 public: 00039 00043 BCTemplateEnsembleTest(); 00044 00048 ~BCTemplateEnsembleTest(); 00049 00053 int SetEnsembleTemplate(TH1D hist); 00054 00058 void SetTemplateFitter(BCTemplateFitter * model) 00059 { fTemplateFitter = model; }; 00060 00065 void SetTemplateParameters(std::vector<double> parameters) 00066 { fTemplateParameters = parameters; }; 00067 00074 int PerformEnsembleTest(TTree* tree = 0); 00075 00079 void SetEnsembleExpectation(double expectation) 00080 { fEnsembleExpectation = expectation; }; 00081 00085 void SetNEnsembles(int n) 00086 { fNEnsembles = n; }; 00087 00091 void SetFlagMCMC(bool flag) 00092 { fFlagMCMC = flag; } 00093 00097 int Write(const char * filename); 00098 00102 int PrepareTree(); 00103 00107 void PrintPulls(const char* filename); 00108 00109 private: 00110 00115 TH1D * BuildEnsemble(); 00116 00117 protected: 00118 00122 TH1D fEnsembleTemplate; 00123 00127 BCTemplateFitter * fTemplateFitter; 00128 00132 TFile * fFile; 00133 00137 TTree * fTree; 00138 00142 std::vector<double> fTemplateParameters; 00143 00147 int fEnsembleCounter; 00148 00152 double fEnsembleExpectation; 00153 00157 int fNEnsembles; 00158 00162 bool fFlagMCMC; 00163 00167 TRandom3 * fRandom; 00168 00172 std::vector<double> fOutParValue; 00173 00177 std::vector<double> fOutParModeGlobal; 00178 00182 std::vector<double> fOutParErrorUpGlobal; 00183 00187 std::vector<double> fOutParErrorDownGlobal; 00188 00192 std::vector<double> fOutParPullGlobal; 00193 00197 std::vector<double> fOutParModeMarg; 00198 00202 std::vector<double> fOutParMedianMarg; 00203 00207 std::vector<double> fOutParMeanMarg; 00208 00212 std::vector<double> fOutParRMSMarg; 00213 00217 std::vector<double> fOutParErrorUpMarg; 00218 00222 std::vector<double> fOutParErrorDownMarg; 00223 00227 std::vector<double> fOutParPullMarg; 00228 00232 std::vector<double> fOutParQuantile5Marg; 00233 00237 std::vector<double> fOutParQuantile10Marg; 00238 00242 std::vector<double> fOutParQuantile90Marg; 00243 00247 std::vector<double> fOutParQuantile95Marg; 00248 00252 std::vector<double> fOutRatioModeMarg; 00253 00257 std::vector<double> fOutRatioMedianMarg; 00258 00262 std::vector<double> fOutRatioMeanMarg; 00263 00267 std::vector<double> fOutRatioRMSMarg; 00268 00272 std::vector<double> fOutRatioErrorUpMarg; 00273 00277 std::vector<double> fOutRatioErrorDownMarg; 00278 00282 std::vector<double> fOutRatioQuantile5Marg; 00283 00287 std::vector<double> fOutRatioQuantile10Marg; 00288 00292 std::vector<double> fOutRatioQuantile90Marg; 00293 00297 std::vector<double> fOutRatioQuantile95Marg; 00298 00302 double fOutChi2Global; 00303 00308 double fOutChi2Marg; 00309 00313 int fOutNDF; 00314 00319 double fOutChi2ProbGlobal; 00320 00325 double fOutChi2ProbMarg; 00326 00330 double fOutKSProb; 00331 00335 double fOutPValue; 00336 00340 int fOutNEvents; 00341 }; 00342 00343 #endif