00001 #ifndef __BCMTF__H
00002 #define __BCMTF__H
00003
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "../../BAT/BCModel.h"
00028
00029 #include <TH1D.h>
00030
00031 class BCMTFChannel;
00032 class BCMTFProcess;
00033 class BCMTFSystematic;
00034 class TF1;
00035
00036
00037 class BCMTF : public BCModel
00038 {
00039
00040 public:
00041
00047 BCMTF();
00048
00052 BCMTF(const char * name);
00053
00056 ~BCMTF();
00057
00064 int GetNChannels()
00065 { return fNChannels; };
00066
00069 int GetNProcesses()
00070 { return fNProcesses; };
00071
00074 int GetNSystematics()
00075 { return fNSystematics; };
00076
00080 int GetChannelIndex(const char * name);
00081
00085 int GetProcessIndex(const char * name);
00086
00090 int GetSystematicIndex(const char * name);
00091
00095 int GetParIndexProcess(int index)
00096 { return fProcessParIndexContainer.at(index); };
00097
00101 int GetParIndexSystematic(int index)
00102 { return fSystematicParIndexContainer.at(index); };
00103
00107 BCMTFChannel * GetChannel(int index)
00108 { return fChannelContainer.at(index); };
00109
00113 BCMTFProcess * GetProcess(int index)
00114 { return fProcessContainer.at(index); };
00115
00119 BCMTFSystematic * GetSystematic(int index)
00120 { return fSystematicContainer.at(index); };
00121
00134 int SetData(const char * channelname, TH1D hist, double minimum=-1, double maximum=-1);
00135
00143 int SetTemplate(const char * channelname, const char * processname, TH1D hist, double efficiency = 1.);
00144
00159 int SetTemplate(const char * channelname, const char * processname, std::vector<TF1 *> * funccont, int nbins, double efficiency = 1.);
00160
00166 void SetExpectationFunction(int parindex, TF1 * func)
00167 { fExpectationFunctionContainer[parindex] = func; };
00168
00183 int SetSystematicVariation(const char * channelname, const char * processname, const char * systematicname, double variation_up, double variation_down);
00184
00197 int SetSystematicVariation(const char * channelname, const char * processname, const char * systematicname, TH1D hist_up, TH1D hist_down);
00198
00213 int SetSystematicVariation(const char * channelname, const char * processname, const char * systematicname, TH1D hist, TH1D hist_up, TH1D hist_down);
00214
00221 void SetFlagEfficiencyConstraint(bool flag)
00222 { fFlagEfficiencyConstraint = flag; };
00223
00233 int AddChannel(const char * name);
00234
00241 int AddProcess(const char * name, double nmin = 0., double nmax = 1.);
00242
00249 int AddSystematic(const char * name, double min = -5., double max = 5.);
00250
00257 double Expectation(int channelindex, int binindex, const std::vector<double> & parameters);
00258
00267 double ExpectationFunction(int parindex, int channelindex, int processindex, const std::vector<double> & parameters);
00268
00276
00277 double Efficiency(int channelindex, int processindex, int binindex, const std::vector<double> & parameters);
00278
00288 double Probability(int channelindex, int processindex, int binindex, const std::vector<double> & parameters);
00289
00296 double CalculateChi2(int channelindex, const std::vector<double> & parameters);
00297
00303 double CalculateChi2(const std::vector<double> & parameters);
00304
00311 double CalculateCash(int channelindex, const std::vector<double> & parameters);
00312
00318 double CalculateCash(const std::vector<double> & parameters);
00319
00329 int PrintSummary(const char * filename = "summary.txt");
00330
00347 int PrintStack(int channelindex, const std::vector<double> & parameters, const char * filename = "stack.eps", const char * options = "e1b0stack");
00348
00357 int PrintStack(const char * channelname, const std::vector<double> & parameters, const char * filename = "stack.eps", const char * options = "e1b0stack");
00358
00369 double LogLikelihood(const std::vector<double> & parameters);
00370
00374 void MCMCUserIterationInterface();
00375
00378 private:
00379
00382 std::vector<BCMTFChannel *> fChannelContainer;
00383
00386 std::vector<BCMTFProcess *> fProcessContainer;
00387
00390 std::vector<BCMTFSystematic *> fSystematicContainer;
00391
00394 int fNChannels;
00395
00398 int fNProcesses;
00399
00402 int fNSystematics;
00403
00407 std::vector<int> fProcessParIndexContainer;
00408
00411 std::vector<int> fSystematicParIndexContainer;
00412
00416 bool fFlagEfficiencyConstraint;
00417
00420 std::vector<TF1 *> fExpectationFunctionContainer;
00421
00422 };
00423
00424
00425 #endif
00426