//  
// Author: Soeren Stamm <mailto: stamm@physik.hu-berlin.de>
// Update: $Id: AtlHistFactorySample.h,v 1.7 2016/04/19 07:47:49 stamm Exp $
// Copyright: 2015 (C) Soeren Stamm
//
#ifndef ATLAS_AtlHistFactorySample
#define ATLAS_AtlHistFactorySample
#ifndef ROOT_TNamed
#include <TNamed.h>
#endif
#ifndef ROOT_TStyle
#include <TStyle.h>
#endif

class AtlHistFactorySystematic;
class TList;
class TH1F;
class TFile;

class AtlHistFactorySample : public TNamed {

protected:
    TString  fNormFactor;      // Name of the norm factor parameter

    Double_t fNormUncertainty; // Relative normalization uncertainty
    Double_t fSignalLow;       // Lower bound of signal parameter
    Double_t fSignalHigh;      // Upper bound of signal parameter

    Bool_t fIsSignal;          // Is signal sample?
    Bool_t fIsData;            // Is this a data sample? (e.g. data or QCD)
    Bool_t fUseLogNormal;      // Use log normal constraint for normalization parameter
    Bool_t fUseStatError;      // Use statistical error (default: true)

    TList *fListOfSystematics; // List of systematics for this sample

    TH1F *fHist_ShapeTest_pValue;   // Histogram for Shape test results (Chi2)
    TH1F *fHist_ShapeTest_KStest;   // Histogram for Shape test results (KS)

    Color_t fLineColor;
    Style_t fLineStyle;
    Color_t fFillColor;
    Style_t fFillStyle;
    
public:
    AtlHistFactorySample(const char* name, const char* title,
			 const char* normfactor,
			 Double_t norm_unc, Bool_t isSignal = kFALSE);
    virtual ~AtlHistFactorySample();

    void AddSystematic(AtlHistFactorySystematic *syst);
    void AddShapeSystematic(const char *name, TList *systs);
    void AddSystematics(TList *list);
    void BookHistograms(const char* channel);
    void FillHistograms(const char* syst,
			Double_t pval, Double_t kstest);
    void WriteHistograms(TFile *fout);
    void SetSignalRange(Double_t low, Double_t high);

    inline TList* GetListOfSystematics() const { return fListOfSystematics; }
    inline const char* GetNormFactorName() const { return fNormFactor.Data(); }
    inline Double_t GetNormUncertainty() const { return fNormUncertainty; }
    inline Double_t GetSignalHigh() const { return fSignalHigh; }
    inline Double_t GetSignalLow() const { return fSignalLow; }

    inline Color_t GetLineColor() const { return fLineColor; }
    inline Style_t GetLineStyle() const { return fLineStyle; }
    inline Color_t GetFillColor() const { return fFillColor; }
    inline Style_t GetFillStyle() const { return fFillStyle; }
    
    inline Bool_t IsSignal() const { return fIsSignal; }
    inline Bool_t IsData() const { return fIsData; }
    inline Bool_t UseLogNormal() const { return fUseLogNormal; }
    inline Bool_t UseStatError() const { return fUseStatError; }

    inline void SetIsData(Bool_t flag = kTRUE) { fIsData = flag; }
    inline void SetUseLogNormal(Bool_t flag = kTRUE) { fUseLogNormal = flag; }
    inline void SetUseStatError(Bool_t flag = kTRUE) { fUseStatError = flag; }
    inline void SetDrawOptions(Color_t fill_color, Style_t fill_style,
			       Color_t line_color, Style_t line_style) {
	fFillColor = fill_color; fFillStyle = fill_style;
	fLineColor = line_color; fLineStyle = line_style;
    }

    ClassDef(AtlHistFactorySample,0) // DOCUMENT ME
};
#endif

 AtlHistFactorySample.h:1
 AtlHistFactorySample.h:2
 AtlHistFactorySample.h:3
 AtlHistFactorySample.h:4
 AtlHistFactorySample.h:5
 AtlHistFactorySample.h:6
 AtlHistFactorySample.h:7
 AtlHistFactorySample.h:8
 AtlHistFactorySample.h:9
 AtlHistFactorySample.h:10
 AtlHistFactorySample.h:11
 AtlHistFactorySample.h:12
 AtlHistFactorySample.h:13
 AtlHistFactorySample.h:14
 AtlHistFactorySample.h:15
 AtlHistFactorySample.h:16
 AtlHistFactorySample.h:17
 AtlHistFactorySample.h:18
 AtlHistFactorySample.h:19
 AtlHistFactorySample.h:20
 AtlHistFactorySample.h:21
 AtlHistFactorySample.h:22
 AtlHistFactorySample.h:23
 AtlHistFactorySample.h:24
 AtlHistFactorySample.h:25
 AtlHistFactorySample.h:26
 AtlHistFactorySample.h:27
 AtlHistFactorySample.h:28
 AtlHistFactorySample.h:29
 AtlHistFactorySample.h:30
 AtlHistFactorySample.h:31
 AtlHistFactorySample.h:32
 AtlHistFactorySample.h:33
 AtlHistFactorySample.h:34
 AtlHistFactorySample.h:35
 AtlHistFactorySample.h:36
 AtlHistFactorySample.h:37
 AtlHistFactorySample.h:38
 AtlHistFactorySample.h:39
 AtlHistFactorySample.h:40
 AtlHistFactorySample.h:41
 AtlHistFactorySample.h:42
 AtlHistFactorySample.h:43
 AtlHistFactorySample.h:44
 AtlHistFactorySample.h:45
 AtlHistFactorySample.h:46
 AtlHistFactorySample.h:47
 AtlHistFactorySample.h:48
 AtlHistFactorySample.h:49
 AtlHistFactorySample.h:50
 AtlHistFactorySample.h:51
 AtlHistFactorySample.h:52
 AtlHistFactorySample.h:53
 AtlHistFactorySample.h:54
 AtlHistFactorySample.h:55
 AtlHistFactorySample.h:56
 AtlHistFactorySample.h:57
 AtlHistFactorySample.h:58
 AtlHistFactorySample.h:59
 AtlHistFactorySample.h:60
 AtlHistFactorySample.h:61
 AtlHistFactorySample.h:62
 AtlHistFactorySample.h:63
 AtlHistFactorySample.h:64
 AtlHistFactorySample.h:65
 AtlHistFactorySample.h:66
 AtlHistFactorySample.h:67
 AtlHistFactorySample.h:68
 AtlHistFactorySample.h:69
 AtlHistFactorySample.h:70
 AtlHistFactorySample.h:71
 AtlHistFactorySample.h:72
 AtlHistFactorySample.h:73
 AtlHistFactorySample.h:74
 AtlHistFactorySample.h:75
 AtlHistFactorySample.h:76
 AtlHistFactorySample.h:77
 AtlHistFactorySample.h:78
 AtlHistFactorySample.h:79
 AtlHistFactorySample.h:80
 AtlHistFactorySample.h:81
 AtlHistFactorySample.h:82
 AtlHistFactorySample.h:83
 AtlHistFactorySample.h:84
 AtlHistFactorySample.h:85
 AtlHistFactorySample.h:86
 AtlHistFactorySample.h:87