BayesianAnalysisToolkit  0.9.3
BCMTF.h
Go to the documentation of this file.
1 #ifndef __BCMTF__H
2 #define __BCMTF__H
3 
18 /*
19  * Copyright (C) 2007-2013, the BAT core developer team
20  * All rights reserved.
21  *
22  * For the licensing terms see doc/COPYING.
23  * For documentation see http://mpp.mpg.de/bat
24  */
25 
26 // ---------------------------------------------------------
27 
28 #include "../../BAT/BCModel.h"
29 
30 #include <TH1D.h>
31 
32 class BCMTFChannel;
33 class BCMTFProcess;
34 class BCMTFSystematic;
35 class TF1;
36 
37 // ---------------------------------------------------------
38 class BCMTF : public BCModel
39 {
40 
41 public:
42 
48  BCMTF();
49 
53  BCMTF(const char * name);
54 
57  ~BCMTF();
58 
66  { return fNChannels; };
67 
71  { return fNProcesses; };
72 
76  { return fNSystematics; };
77 
81  int GetChannelIndex(const char * name);
82 
86  int GetProcessIndex(const char * name);
87 
91  int GetSystematicIndex(const char * name);
92 
96  int GetParIndexProcess(int index)
97  { return fProcessParIndexContainer.at(index); };
98 
102  int GetParIndexSystematic(int index)
103  { return fSystematicParIndexContainer.at(index); };
104 
109  { return fChannelContainer.at(index); };
110 
115  { return fProcessContainer.at(index); };
116 
121  { return fSystematicContainer.at(index); };
122 
135  int SetData(const char * channelname, TH1D hist, double minimum=-1, double maximum=-1);
136 
144  int SetTemplate(const char * channelname, const char * processname, TH1D hist, double efficiency = 1., double norm = 1.);
145 
160  int SetTemplate(const char * channelname, const char * processname, std::vector<TF1 *> * funccont, int nbins, double efficiency = 1.);
161 
167  void SetExpectationFunction(int parindex, TF1 * func)
168  { fExpectationFunctionContainer[parindex] = func; };
169 
184  int SetSystematicVariation(const char * channelname, const char * processname, const char * systematicname, double variation_up, double variation_down);
185 
198  int SetSystematicVariation(const char * channelname, const char * processname, const char * systematicname, TH1D hist_up, TH1D hist_down);
199 
214  int SetSystematicVariation(const char * channelname, const char * processname, const char * systematicname, TH1D hist, TH1D hist_up, TH1D hist_down);
215 
223  { fFlagEfficiencyConstraint = flag; };
224 
234  int AddChannel(const char * name);
235 
245  int AddProcess(const char * name, double nmin = 0., double nmax = 1., int color = -1, int fillstyle = -1, int linestyle = -1);
246 
253  int AddSystematic(const char * name, double min = -5., double max = 5.);
254 
261  double Expectation(int channelindex, int binindex, const std::vector<double> & parameters);
262 
271  double ExpectationFunction(int parindex, int channelindex, int processindex, const std::vector<double> & parameters);
272 
280  // return efficiency for a channel, process and bin
281  double Efficiency(int channelindex, int processindex, int binindex, const std::vector<double> & parameters);
282 
292  double Probability(int channelindex, int processindex, int binindex, const std::vector<double> & parameters);
293 
300  double CalculateChi2(int channelindex, const std::vector<double> & parameters);
301 
307  double CalculateChi2(const std::vector<double> & parameters);
308 
315  double CalculateCash(int channelindex, const std::vector<double> & parameters);
316 
322  double CalculateCash(const std::vector<double> & parameters);
323 
331  double CalculatePValue(int channelindex, const std::vector<double> & parameters);
332 
341  double CalculatePValue(const std::vector<double> & parameters);
342 
352  int PrintSummary(const char * filename = "summary.txt");
353 
370  int PrintStack(int channelindex, const std::vector<double> & parameters, const char * filename = "stack.pdf", const char * options = "e1b0stack");
371 
380  int PrintStack(const char * channelname, const std::vector<double> & parameters, const char * filename = "stack.pdf", const char * options = "e1b0stack");
381 
392  double LogLikelihood(const std::vector<double> & parameters);
393 
398 
401 private:
402 
405  std::vector<BCMTFChannel *> fChannelContainer;
406 
409  std::vector<BCMTFProcess *> fProcessContainer;
410 
413  std::vector<BCMTFSystematic *> fSystematicContainer;
414 
418 
422 
426 
430  std::vector<int> fProcessParIndexContainer;
431 
435 
440 
443  std::vector<TF1 *> fExpectationFunctionContainer;
444 
445 };
446 // ---------------------------------------------------------
447 
448 #endif
449