BAT  0.9.4
The Bayesian analysis toolkit
 All Classes Namespaces Functions Variables Enumerations
BCMTF.h
1 #ifndef __BCMTF__H
2 #define __BCMTF__H
3 
18 /*
19  * Copyright (C) 2007-2014, 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 
417  int fNChannels;
418 
421  int fNProcesses;
422 
425  int fNSystematics;
426 
430  std::vector<int> fProcessParIndexContainer;
431 
434  std::vector<int> fSystematicParIndexContainer;
435 
439  bool fFlagEfficiencyConstraint;
440 
443  std::vector<TF1 *> fExpectationFunctionContainer;
444 
445 };
446 // ---------------------------------------------------------
447 
448 #endif
449 
int SetSystematicVariation(const char *channelname, const char *processname, const char *systematicname, double variation_up, double variation_down)
Definition: BCMTF.cxx:442
int AddChannel(const char *name)
Definition: BCMTF.cxx:282
int SetData(const char *channelname, TH1D hist, double minimum=-1, double maximum=-1)
Definition: BCMTF.cxx:207
double CalculatePValue(int channelindex, const std::vector< double > &parameters)
Definition: BCMTF.cxx:1162
int GetNChannels()
Definition: BCMTF.h:65
int SetTemplate(const char *channelname, const char *processname, TH1D hist, double efficiency=1., double norm=1.)
Definition: BCMTF.cxx:112
int GetProcessIndex(const char *name)
Definition: BCMTF.cxx:78
double ExpectationFunction(int parindex, int channelindex, int processindex, const std::vector< double > &parameters)
Definition: BCMTF.cxx:671
The base class for all user-defined models.
Definition: BCModel.h:50
int AddSystematic(const char *name, double min=-5., double max=5.)
Definition: BCMTF.cxx:395
~BCMTF()
Definition: BCMTF.cxx:53
int GetChannelIndex(const char *name)
Definition: BCMTF.cxx:61
void MCMCUserIterationInterface()
Definition: BCMTF.cxx:1289
double Expectation(int channelindex, int binindex, const std::vector< double > &parameters)
Definition: BCMTF.cxx:642
int GetSystematicIndex(const char *name)
Definition: BCMTF.cxx:95
int GetNSystematics()
Definition: BCMTF.h:75
double Efficiency(int channelindex, int processindex, int binindex, const std::vector< double > &parameters)
Definition: BCMTF.cxx:689
A class describing a process.
Definition: BCMTFProcess.h:27
double Probability(int channelindex, int processindex, int binindex, const std::vector< double > &parameters)
Definition: BCMTF.cxx:737
int PrintStack(int channelindex, const std::vector< double > &parameters, const char *filename="stack.pdf", const char *options="e1b0stack")
Definition: BCMTF.cxx:766
double CalculateCash(int channelindex, const std::vector< double > &parameters)
Definition: BCMTF.cxx:1098
int GetNProcesses()
Definition: BCMTF.h:70
void SetFlagEfficiencyConstraint(bool flag)
Definition: BCMTF.h:222
A class describing a physics channel.
Definition: BCMTFChannel.h:33
void PrintSummary()
Definition: BCModel.cxx:772
int AddProcess(const char *name, double nmin=0., double nmax=1., int color=-1, int fillstyle=-1, int linestyle=-1)
Definition: BCMTF.cxx:337
int GetParIndexSystematic(int index)
Definition: BCMTF.h:102
BCMTF()
Definition: BCMTF.cxx:35
BCMTFSystematic * GetSystematic(int index)
Definition: BCMTF.h:120
void SetExpectationFunction(int parindex, TF1 *func)
Definition: BCMTF.h:167
int GetParIndexProcess(int index)
Definition: BCMTF.h:96
BCMTFChannel * GetChannel(int index)
Definition: BCMTF.h:108
BCMTFProcess * GetProcess(int index)
Definition: BCMTF.h:114
double CalculateChi2(int channelindex, const std::vector< double > &parameters)
Definition: BCMTF.cxx:1039
double LogLikelihood(const std::vector< double > &parameters)
Definition: BCMTF.cxx:1244
A class for fitting several templates to a data set.
Definition: BCMTF.h:38
A class desribing a systematic uncertainty.