//  
// Author: Soeren Stamm <mailto: stamm@physik.hu-berlin.de>
// Update: $Id: AtlSgTop_tChannelMemDiscr.h,v 1.5 2016/04/19 08:35:20 stamm Exp $
// Copyright: 2013 (C) Soeren Stamm
//
#ifndef SINGLETOP_AtlSgTop_tChannelMemDiscr
#define SINGLETOP_AtlSgTop_tChannelMemDiscr
#ifndef ROOT_TH2
#include "TH2.h"
#endif
#ifndef ATLAS_AtlSelector
#include <AtlSelector.h>
#endif
#ifndef ATLAS_AtlObjectsToolD3PDSgTop
#include <AtlObjectsToolD3PDSgTop.h>
#endif
#ifndef ATLAS_AtlObjRecoScaleFactorTool
#include <AtlObjRecoScaleFactorTool.h>
#endif
#ifndef ATLAS_AtlEvtReaderMem
#include <AtlEvtReaderMem.h>
#endif
#ifndef ATLAS_AtlPdfReweightingTool
#include <AtlPdfReweightingTool.h>
#endif

class AtlSgTop_tChannelMemDiscr : public AtlSelector {

  public:
    static const Int_t     fgNBins_tChannel4FSRatio = 20;
    static const Double_t  fgBinEdges_tChannel4FSRatio[fgNBins_tChannel4FSRatio+1];   // lower edges used for t-channel probability rebinning

    static const Int_t     fgNBins_tChannel5FSRatio = 20;
    static const Double_t  fgBinEdges_tChannel5FSRatio[fgNBins_tChannel5FSRatio+1];   // lower edges used for t-channel probability rebinning

    Bool_t fSchannelVeto;

    
  private:
    TList   *fLeptons;   // List of selected leptons
    TList   *fLooseLeptons;   // List of selected loose leptons
    TList   *fElectrons; // List of selected electron objects
    TList   *fMuons;     // List of selected muon objects
    TList   *fJets;      // List of selected jets
    TList   *fBJets;     // List of selected b-jets
    
    // Pointer to tools in event loop
    AtlObjectsToolD3PDSgTop   *fObjTool;
    AtlObjRecoScaleFactorTool *fSFTool;
    AtlPdfReweightingTool     *fPdfTool;

    // 
    // MEM likelihood ratio
    // 
    // a-priori probabilities
    Double_t fP_sChannel2j_ePlus;
    Double_t fP_sChannel2j_muPlus;
    Double_t fP_sChannel2j_eMinus;
    Double_t fP_sChannel2j_muMinus;
    
    Double_t fP_sChannel3j_ePlus;
    Double_t fP_sChannel3j_muPlus;
    Double_t fP_sChannel3j_eMinus;
    Double_t fP_sChannel3j_muMinus;
    
    Double_t fP_tChannel4FS_ePlus;
    Double_t fP_tChannel4FS_muPlus;
    Double_t fP_tChannel4FS_eMinus;
    Double_t fP_tChannel4FS_muMinus;
    
    Double_t fP_Wjj_ePlus;
    Double_t fP_Wjj_muPlus;
    Double_t fP_Wjj_eMinus;
    Double_t fP_Wjj_muMinus;
    
    Double_t fP_Wbb_ePlus;
    Double_t fP_Wbb_muPlus;
    Double_t fP_Wbb_eMinus;
    Double_t fP_Wbb_muMinus;
    
    Double_t fP_Wcj_ePlus;
    Double_t fP_Wcj_muPlus;
    Double_t fP_Wcj_eMinus;
    Double_t fP_Wcj_muMinus;
    
    Double_t fP_ttbarSL_ePlus;
    Double_t fP_ttbarSL_muPlus;
    Double_t fP_ttbarSL_eMinus;
    Double_t fP_ttbarSL_muMinus;
    
    Double_t fP_ttbarDL_ePlus;
    Double_t fP_ttbarDL_muPlus;
    Double_t fP_ttbarDL_eMinus;
    Double_t fP_ttbarDL_muMinus;

    // Likelihood ratio Histogram
    TH1F *fHist_llh_tChannel_ratio_4FS;       // t-channel probability, rebinned
    TH1F *fHist_llh_tChannel_ratio_4FS_even;  // t-channel probability, even evt numbers
    TH1F *fHist_llh_tChannel_ratio_4FS_odd;   // t-channel probability, odd evt numbers
    TH1F *fHist_llh_tChannel_ratio_4FS_raw;   // t-channel probability, original binning
    TH1F *fHist_llh_tChannel_ratio2_4FS;      // t-channel probability, const bin width
    TH1F *fHist_llh_Wjets_ratio_4FS;          // Wjets probability
    TH1F *fHist_llh_Wbb_ratio_4FS;            // Wbb probability
    TH1F *fHist_llh_Wcj_ratio_4FS;            // Wcj probability
    TH1F *fHist_llh_Wjj_ratio_4FS;            // Wjj probability
    TH1F *fHist_llh_ttbar_ratio_4FS;          // ttbar probability
    TH2F *fHist_2D_tChannel_4FS_vs_5FS;       // t-channel 4FS vs t-channel 5FS
    TH2F *fHist_2D_tChannel_4FS_vs_Wbb;       // t-channel 4FS vs Wbb
    TH2F *fHist_2D_tChannel_4FS_vs_Wcj;       // t-channel 4FS vs Wcj
    TH2F *fHist_2D_tChannel_4FS_vs_Wjets;     // t-channel 4FS vs wjets
    TH2F *fHist_2D_tChannel_4FS_vs_ttbar;     // t-channel 4FS vs ttbar
    TH1F *fHist_comb_llh_tChannel_ratio_4FS;  // t-channel probability, rebinned, (veto s-channel events)

    TH1F *fHist_llh_tChannel_ratio_5FS;       // t-channel probability, rebinned
    TH1F *fHist_llh_tChannel_ratio_5FS_even;  // t-channel probability, even evt numbers
    TH1F *fHist_llh_tChannel_ratio_5FS_odd;   // t-channel probability, odd evt numbers
    TH1F *fHist_llh_tChannel_ratio_5FS_raw;   // t-channel probability, original binning
    TH1F *fHist_llh_tChannel_ratio2_5FS;      // t-channel probability, const bin width
    TH1F *fHist_llh_Wjets_ratio_5FS;          // Wjets probability
    TH1F *fHist_llh_ttbar_ratio_5FS;          // ttbar probability

    TH1F *fHist_logllh_sChannel2j;
    TH1F *fHist_logllh_sChannel3j;
    TH1F *fHist_logllh_tChannel4FS;
    TH1F *fHist_logllh_tChannel5FS;
    TH1F *fHist_logllh_ttbarSL;
    TH1F *fHist_logllh_ttbarDL;
    TH1F *fHist_logllh_Wjj;
    TH1F *fHist_logllh_Wcj;
    TH1F *fHist_logllh_Wbb;

  public:
    AtlSgTop_tChannelMemDiscr(const char* OutputFilename);
    virtual ~AtlSgTop_tChannelMemDiscr();
    
    virtual void   SetBranchStatus();
    virtual void   Clear( Option_t *option = "");
    virtual void   Begin(TTree *tree);
    virtual void   BookHistograms();
    virtual void   FillHistograms();
    virtual Bool_t ProcessPreCut();
    virtual Bool_t ProcessCut();
    virtual void   SetCutDefaults();
    virtual void   Print(Option_t *option) const;
    virtual void   Terminate();

  protected:
    void InitEvent();
	
    AtlEvtReaderMem* GetEvtReader() { return (AtlEvtReaderMem*) fEvtReader; }
    
    ClassDef(AtlSgTop_tChannelMemDiscr,0) // Single-top 8 TeV t-Channel MemDiscriminant analysis
};
#endif
 AtlSgTop_tChannelMemDiscr.h:1
 AtlSgTop_tChannelMemDiscr.h:2
 AtlSgTop_tChannelMemDiscr.h:3
 AtlSgTop_tChannelMemDiscr.h:4
 AtlSgTop_tChannelMemDiscr.h:5
 AtlSgTop_tChannelMemDiscr.h:6
 AtlSgTop_tChannelMemDiscr.h:7
 AtlSgTop_tChannelMemDiscr.h:8
 AtlSgTop_tChannelMemDiscr.h:9
 AtlSgTop_tChannelMemDiscr.h:10
 AtlSgTop_tChannelMemDiscr.h:11
 AtlSgTop_tChannelMemDiscr.h:12
 AtlSgTop_tChannelMemDiscr.h:13
 AtlSgTop_tChannelMemDiscr.h:14
 AtlSgTop_tChannelMemDiscr.h:15
 AtlSgTop_tChannelMemDiscr.h:16
 AtlSgTop_tChannelMemDiscr.h:17
 AtlSgTop_tChannelMemDiscr.h:18
 AtlSgTop_tChannelMemDiscr.h:19
 AtlSgTop_tChannelMemDiscr.h:20
 AtlSgTop_tChannelMemDiscr.h:21
 AtlSgTop_tChannelMemDiscr.h:22
 AtlSgTop_tChannelMemDiscr.h:23
 AtlSgTop_tChannelMemDiscr.h:24
 AtlSgTop_tChannelMemDiscr.h:25
 AtlSgTop_tChannelMemDiscr.h:26
 AtlSgTop_tChannelMemDiscr.h:27
 AtlSgTop_tChannelMemDiscr.h:28
 AtlSgTop_tChannelMemDiscr.h:29
 AtlSgTop_tChannelMemDiscr.h:30
 AtlSgTop_tChannelMemDiscr.h:31
 AtlSgTop_tChannelMemDiscr.h:32
 AtlSgTop_tChannelMemDiscr.h:33
 AtlSgTop_tChannelMemDiscr.h:34
 AtlSgTop_tChannelMemDiscr.h:35
 AtlSgTop_tChannelMemDiscr.h:36
 AtlSgTop_tChannelMemDiscr.h:37
 AtlSgTop_tChannelMemDiscr.h:38
 AtlSgTop_tChannelMemDiscr.h:39
 AtlSgTop_tChannelMemDiscr.h:40
 AtlSgTop_tChannelMemDiscr.h:41
 AtlSgTop_tChannelMemDiscr.h:42
 AtlSgTop_tChannelMemDiscr.h:43
 AtlSgTop_tChannelMemDiscr.h:44
 AtlSgTop_tChannelMemDiscr.h:45
 AtlSgTop_tChannelMemDiscr.h:46
 AtlSgTop_tChannelMemDiscr.h:47
 AtlSgTop_tChannelMemDiscr.h:48
 AtlSgTop_tChannelMemDiscr.h:49
 AtlSgTop_tChannelMemDiscr.h:50
 AtlSgTop_tChannelMemDiscr.h:51
 AtlSgTop_tChannelMemDiscr.h:52
 AtlSgTop_tChannelMemDiscr.h:53
 AtlSgTop_tChannelMemDiscr.h:54
 AtlSgTop_tChannelMemDiscr.h:55
 AtlSgTop_tChannelMemDiscr.h:56
 AtlSgTop_tChannelMemDiscr.h:57
 AtlSgTop_tChannelMemDiscr.h:58
 AtlSgTop_tChannelMemDiscr.h:59
 AtlSgTop_tChannelMemDiscr.h:60
 AtlSgTop_tChannelMemDiscr.h:61
 AtlSgTop_tChannelMemDiscr.h:62
 AtlSgTop_tChannelMemDiscr.h:63
 AtlSgTop_tChannelMemDiscr.h:64
 AtlSgTop_tChannelMemDiscr.h:65
 AtlSgTop_tChannelMemDiscr.h:66
 AtlSgTop_tChannelMemDiscr.h:67
 AtlSgTop_tChannelMemDiscr.h:68
 AtlSgTop_tChannelMemDiscr.h:69
 AtlSgTop_tChannelMemDiscr.h:70
 AtlSgTop_tChannelMemDiscr.h:71
 AtlSgTop_tChannelMemDiscr.h:72
 AtlSgTop_tChannelMemDiscr.h:73
 AtlSgTop_tChannelMemDiscr.h:74
 AtlSgTop_tChannelMemDiscr.h:75
 AtlSgTop_tChannelMemDiscr.h:76
 AtlSgTop_tChannelMemDiscr.h:77
 AtlSgTop_tChannelMemDiscr.h:78
 AtlSgTop_tChannelMemDiscr.h:79
 AtlSgTop_tChannelMemDiscr.h:80
 AtlSgTop_tChannelMemDiscr.h:81
 AtlSgTop_tChannelMemDiscr.h:82
 AtlSgTop_tChannelMemDiscr.h:83
 AtlSgTop_tChannelMemDiscr.h:84
 AtlSgTop_tChannelMemDiscr.h:85
 AtlSgTop_tChannelMemDiscr.h:86
 AtlSgTop_tChannelMemDiscr.h:87
 AtlSgTop_tChannelMemDiscr.h:88
 AtlSgTop_tChannelMemDiscr.h:89
 AtlSgTop_tChannelMemDiscr.h:90
 AtlSgTop_tChannelMemDiscr.h:91
 AtlSgTop_tChannelMemDiscr.h:92
 AtlSgTop_tChannelMemDiscr.h:93
 AtlSgTop_tChannelMemDiscr.h:94
 AtlSgTop_tChannelMemDiscr.h:95
 AtlSgTop_tChannelMemDiscr.h:96
 AtlSgTop_tChannelMemDiscr.h:97
 AtlSgTop_tChannelMemDiscr.h:98
 AtlSgTop_tChannelMemDiscr.h:99
 AtlSgTop_tChannelMemDiscr.h:100
 AtlSgTop_tChannelMemDiscr.h:101
 AtlSgTop_tChannelMemDiscr.h:102
 AtlSgTop_tChannelMemDiscr.h:103
 AtlSgTop_tChannelMemDiscr.h:104
 AtlSgTop_tChannelMemDiscr.h:105
 AtlSgTop_tChannelMemDiscr.h:106
 AtlSgTop_tChannelMemDiscr.h:107
 AtlSgTop_tChannelMemDiscr.h:108
 AtlSgTop_tChannelMemDiscr.h:109
 AtlSgTop_tChannelMemDiscr.h:110
 AtlSgTop_tChannelMemDiscr.h:111
 AtlSgTop_tChannelMemDiscr.h:112
 AtlSgTop_tChannelMemDiscr.h:113
 AtlSgTop_tChannelMemDiscr.h:114
 AtlSgTop_tChannelMemDiscr.h:115
 AtlSgTop_tChannelMemDiscr.h:116
 AtlSgTop_tChannelMemDiscr.h:117
 AtlSgTop_tChannelMemDiscr.h:118
 AtlSgTop_tChannelMemDiscr.h:119
 AtlSgTop_tChannelMemDiscr.h:120
 AtlSgTop_tChannelMemDiscr.h:121
 AtlSgTop_tChannelMemDiscr.h:122
 AtlSgTop_tChannelMemDiscr.h:123
 AtlSgTop_tChannelMemDiscr.h:124
 AtlSgTop_tChannelMemDiscr.h:125
 AtlSgTop_tChannelMemDiscr.h:126
 AtlSgTop_tChannelMemDiscr.h:127
 AtlSgTop_tChannelMemDiscr.h:128
 AtlSgTop_tChannelMemDiscr.h:129
 AtlSgTop_tChannelMemDiscr.h:130
 AtlSgTop_tChannelMemDiscr.h:131
 AtlSgTop_tChannelMemDiscr.h:132
 AtlSgTop_tChannelMemDiscr.h:133
 AtlSgTop_tChannelMemDiscr.h:134
 AtlSgTop_tChannelMemDiscr.h:135
 AtlSgTop_tChannelMemDiscr.h:136
 AtlSgTop_tChannelMemDiscr.h:137
 AtlSgTop_tChannelMemDiscr.h:138
 AtlSgTop_tChannelMemDiscr.h:139
 AtlSgTop_tChannelMemDiscr.h:140
 AtlSgTop_tChannelMemDiscr.h:141
 AtlSgTop_tChannelMemDiscr.h:142
 AtlSgTop_tChannelMemDiscr.h:143
 AtlSgTop_tChannelMemDiscr.h:144
 AtlSgTop_tChannelMemDiscr.h:145
 AtlSgTop_tChannelMemDiscr.h:146
 AtlSgTop_tChannelMemDiscr.h:147
 AtlSgTop_tChannelMemDiscr.h:148
 AtlSgTop_tChannelMemDiscr.h:149
 AtlSgTop_tChannelMemDiscr.h:150
 AtlSgTop_tChannelMemDiscr.h:151
 AtlSgTop_tChannelMemDiscr.h:152
 AtlSgTop_tChannelMemDiscr.h:153
 AtlSgTop_tChannelMemDiscr.h:154