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
00042
00043 BCMTF();
00044 BCMTF(const char * name);
00045 ~BCMTF();
00046
00047
00048
00049
00050
00051
00052 int GetNChannels()
00053 { return fNChannels; };
00054
00055
00056 int GetNProcesses()
00057 { return fNProcesses; };
00058
00059
00060 int GetNSystematics()
00061 { return fNSystematics; };
00062
00063
00064 int GetChannelIndex(const char * name);
00065
00066
00067 int GetProcessIndex(const char * name);
00068
00069
00070 int GetSystematicIndex(const char * name);
00071
00072
00073 int GetParIndexProcess(int index)
00074 { return fProcessParIndexContainer.at(index); };
00075
00076
00077 int GetParIndexSystematic(int index)
00078 { return fSystematicParIndexContainer.at(index); };
00079
00080
00081 BCMTFChannel * GetChannel(int index)
00082 { return fChannelContainer.at(index); };
00083
00084
00085 BCMTFProcess * GetProcess(int index)
00086 { return fProcessContainer.at(index); };
00087
00088
00089 BCMTFSystematic * GetSystematic(int index)
00090 { return fSystematicContainer.at(index); };
00091
00092
00093
00094
00095 int AddChannel(const char * name);
00096
00097
00098 int AddProcess(const char * name, double nmin = 0., double nmax = 1.);
00099
00100
00101 int AddSystematic(const char * name, double min = -5., double max = 5.);
00102
00103
00104 int SetTemplate(const char * channelname, const char * processname, TH1D hist, double efficiency = 1.);
00105
00106
00107 int SetTemplate(const char * channelname, const char * processname, std::vector<TF1 *> * funccont, int nbins, double efficiency = 1.);
00108
00109
00110 int SetSystematicVariation(const char * channelname, const char * processname, const char * systematicname, double variation_up, double variation_down);
00111
00112
00113 int SetSystematicVariation(const char * channelname, const char * processname, const char * systematicname, TH1D hist_up, TH1D hist_down);
00114
00115
00116 int SetSystematicVariation(const char * channelname, const char * processname, const char * systematicname, TH1D hist, TH1D hist_up, TH1D hist_down);
00117
00118
00119 int SetData(const char * channelname, TH1D hist);
00120
00121
00122 void SetFlagEfficiencyConstraint(bool flag)
00123 { fFlagEfficiencyConstraint = flag; };
00124
00125
00126 void SetExpectationFunction(int parindex, TF1 * func)
00127 { fExpectationFunctionContainer[parindex] = func; };
00128
00129
00130 int PrintSummary(const char * filename = "summary.txt");
00131
00132
00133 double Expectation(int channelindex, int binindex, const std::vector<double> & parameters);
00134
00135
00136 double ExpectationFunction(int parindex, int channelindex, int processindex, const std::vector<double> & parameters);
00137
00138
00139 double Efficiency(int channelindex, int processindex, int binindex, const std::vector<double> & parameters);
00140
00141
00142 double Probability(int channelindex, int processindex, int binindex, const std::vector<double> & parameters);
00143
00144
00145 int PrintStack(int channelindex, const std::vector<double> & parameters, const char * filename = "stack.eps", const char * options = "");
00146
00147
00148 int PrintStack(const char * channelname, const std::vector<double> & parameters, const char * filename = "stack.eps", const char * options = "");
00149
00150
00151 double CalculateChi2(int channelindex, const std::vector<double> & parameters);
00152
00153
00154 double CalculateChi2(const std::vector<double> & parameters);
00155
00156
00157 double CalculateCash(int channelindex, const std::vector<double> & parameters);
00158
00159
00160 double CalculateCash(const std::vector<double> & parameters);
00161
00162
00163
00164
00165 double LogLikelihood(const std::vector<double> & parameters);
00166
00167
00168
00169 private:
00170
00171
00172 std::vector<BCMTFChannel *> fChannelContainer;
00173
00174
00175 std::vector<BCMTFProcess *> fProcessContainer;
00176
00177
00178 std::vector<BCMTFSystematic *> fSystematicContainer;
00179
00180
00181 int fNChannels;
00182
00183
00184 int fNProcesses;
00185
00186
00187 int fNSystematics;
00188
00189
00190 std::vector<int> fProcessParIndexContainer;
00191
00192
00193 std::vector<int> fSystematicParIndexContainer;
00194
00195
00196 bool fFlagEfficiencyConstraint;
00197
00198
00199 std::vector<TF1 *> fExpectationFunctionContainer;
00200
00201 };
00202
00203
00204 #endif
00205