• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

BCMTF.h

Go to the documentation of this file.
00001 #ifndef __BCMTF__H
00002 #define __BCMTF__H
00003 
00018 /*
00019  * Copyright (C) 2008-2012, Daniel Kollar and Kevin Kroeninger.
00020  * All rights reserved.
00021  *
00022  * For the licensing terms see doc/COPYING.
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       // Constructors and destructor
00043       BCMTF();
00044       BCMTF(const char * name);
00045       ~BCMTF();
00046 
00047       // setters
00048 
00049       // getters
00050 
00051       // return number of channels
00052       int GetNChannels()
00053          { return fNChannels; };
00054 
00055       // return number of processes
00056       int GetNProcesses()
00057          { return fNProcesses; };
00058 
00059       // return number of systematics
00060       int GetNSystematics()
00061          { return fNSystematics; };
00062 
00063       // return channel index
00064       int GetChannelIndex(const char * name);
00065 
00066       // return process index
00067       int GetProcessIndex(const char * name);
00068 
00069       // return systematic index
00070       int GetSystematicIndex(const char * name);
00071 
00072       // return parameter index of process
00073       int GetParIndexProcess(int index)
00074          { return fProcessParIndexContainer.at(index); };
00075 
00076       // return parameter index of systematic
00077       int GetParIndexSystematic(int index)
00078          { return fSystematicParIndexContainer.at(index); };
00079 
00080       // return a channel
00081       BCMTFChannel * GetChannel(int index)
00082          { return fChannelContainer.at(index); };
00083 
00084       // return a process
00085       BCMTFProcess * GetProcess(int index)
00086          { return fProcessContainer.at(index); };
00087 
00088       // return a systematic
00089       BCMTFSystematic * GetSystematic(int index)
00090          { return fSystematicContainer.at(index); };
00091 
00092       // misc
00093 
00094       // add a channel
00095       int AddChannel(const char * name);
00096 
00097       // add a process
00098       int AddProcess(const char * name, double nmin = 0., double nmax = 1.);
00099 
00100       // add a systematic uncertainty
00101       int AddSystematic(const char * name, double min = -5., double max = 5.);
00102 
00103       // set template
00104       int SetTemplate(const char * channelname, const char * processname, TH1D hist, double efficiency = 1.);
00105 
00106       // set template
00107       int SetTemplate(const char * channelname, const char * processname, std::vector<TF1 *> * funccont, int nbins, double efficiency = 1.);
00108 
00109       // set systematic variation
00110       int SetSystematicVariation(const char * channelname, const char * processname,  const char * systematicname, double variation_up, double variation_down);
00111 
00112       // set systematic variation
00113       int SetSystematicVariation(const char * channelname, const char * processname,  const char * systematicname, TH1D hist_up, TH1D hist_down);
00114 
00115       // set systematic variation
00116       int SetSystematicVariation(const char * channelname, const char * processname,  const char * systematicname, TH1D hist, TH1D hist_up, TH1D hist_down);
00117 
00118       // set data
00119       int SetData(const char * channelname, TH1D hist);
00120 
00121       // set flag (efficiency constraint on (true) or off (false)
00122       void SetFlagEfficiencyConstraint(bool flag)
00123          { fFlagEfficiencyConstraint = flag; };
00124 
00125       // set a function for the expectation
00126       void SetExpectationFunction(int parindex, TF1 * func)
00127          { fExpectationFunctionContainer[parindex] = func; };
00128 
00129       // print summary
00130       int PrintSummary(const char * filename = "summary.txt");
00131 
00132       // return expectation value for a channel and bin
00133       double Expectation(int channelindex, int binindex, const std::vector<double> & parameters);
00134 
00135       // return a function for the expecation
00136       double ExpectationFunction(int parindex, int channelindex, int processindex, const std::vector<double> & parameters);
00137 
00138       // return efficiency for a channel, process and bin
00139       double Efficiency(int channelindex, int processindex, int binindex, const std::vector<double> & parameters);
00140 
00141       // return probability for a channel, process and bin
00142       double Probability(int channelindex, int processindex, int binindex, const std::vector<double> & parameters);
00143 
00144       // print stack
00145       int PrintStack(int channelindex, const std::vector<double> & parameters, const char * filename = "stack.eps", const char * options = "");
00146 
00147       // print stack
00148       int PrintStack(const char * channelname, const std::vector<double> & parameters, const char * filename = "stack.eps", const char * options = "");
00149 
00150       // calculate chi2 for single channel
00151       double CalculateChi2(int channelindex, const std::vector<double> & parameters);
00152 
00153       // calculate chi2 for all channels
00154       double CalculateChi2(const std::vector<double> & parameters);
00155 
00156       // calculate Cash statistics for single channel
00157       double CalculateCash(int channelindex, const std::vector<double> & parameters);
00158 
00159       // calculate Cash statistics for all channels
00160       double CalculateCash(const std::vector<double> & parameters);
00161 
00162       // BAT
00163 
00164       // the log likelihood
00165       double LogLikelihood(const std::vector<double> & parameters);
00166 
00167     // void MCMCIterationInterface();
00168 
00169  private:
00170 
00171       // a container of channels
00172       std::vector<BCMTFChannel *> fChannelContainer;
00173 
00174       // a container of processes
00175       std::vector<BCMTFProcess *> fProcessContainer;
00176 
00177       // a container of systematic sources
00178       std::vector<BCMTFSystematic *> fSystematicContainer;
00179 
00180       // number of channels
00181       int fNChannels;
00182 
00183       // number of processes
00184       int fNProcesses;
00185 
00186       // number of systematics
00187       int fNSystematics;
00188 
00189       // a container of parameter indeces for the process normalization
00190       std::vector<int> fProcessParIndexContainer;
00191 
00192       // a container of parameter indeces for the systematics
00193       std::vector<int> fSystematicParIndexContainer;
00194 
00195       // flag: efficiency within 0 and 1 (true) or not (false)
00196       bool fFlagEfficiencyConstraint;
00197 
00198       // a container of functions for the expectation
00199       std::vector<TF1 *> fExpectationFunctionContainer;
00200 
00201 };
00202 // ---------------------------------------------------------
00203 
00204 #endif
00205 

Generated by  doxygen 1.7.1