//  
// Author: Felix Thomas <mailto: Felix.Thomas@mailbox.tu-dresden.de>
// Update: $Id: AtlTopPairDocumenter.h,v 1.5 2013/08/08 00:06:05 stamm Exp $
// Copyright: 2011 (C) Felix Thomas
//
#ifndef ATLAS_AtlTopPairDocumenter
#define ATLAS_AtlTopPairDocumenter
#ifndef ATLAS_AtlDocumenter
#include <AtlDocumenter.h>
#endif
#ifndef ATLAS_AtlEvent
#include <AtlEvent.h>
#endif
#ifndef ROOT_TVector2
#include <TVector2.h>
#endif
#ifndef ROOT_TObject
#include <TObject.h>
#endif



class AtlTopPairDocumenter : public AtlDocumenter {

    public:
      static const Int_t fgNSides    = 3;         // Number of sides (inclusive, leptonic, hadronic)
      static const Int_t fgNOrigins  = 2;         // calculated variables are either from fitted or original objects

    private:
      static const char* fgSideNames[];           // Names of sides
      static const char* fgHistSideNames[];       // Names of sides in histograms
      static const char* fgOriginNames[];         // Names of origins (see above fgNOrigins)
      static const char* fgHistOriginNames[];     // Names of origins in histograms (see above fgNOrigins)

      enum ESide { kInclusive = 0, kLeptonic, kHadronic};
      enum EOrigin { kOriginal = 0, kFitted};

    AtlTopPair* fTopPair;
    Float_t  fEtMissMag;  
    Float_t  fEtMissPhi;  
    
  // W reconstruction histograms
    TH1F *fHistWreco_M[fgNSides][fgNOrigins];           // Reconstructed invariant mass of the W
    TH1F *fHistWreco_phi[fgNSides][fgNOrigins];         // Reconstructed azimuth angle of the W 
    TH1F *fHistWreco_eta[fgNSides][fgNOrigins];         // Reconstructed Eta of the W
    TH1F *fHistWreco_pt[fgNSides][fgNOrigins];          // Reconstructed Pt of the W

  // top flavour reconstruction histograms
    TH1F *fHistTopReco_M[fgNSides][fgNOrigins];         // Reconstructed invariant transverse mass of the tops
    TH1F *fHistTopReco_phi[fgNSides][fgNOrigins];       // Reconstructed azimuth angle of the tops
    TH1F *fHistTopReco_eta[fgNSides][fgNOrigins];       // Reconstructed Eta of the tops
    TH1F *fHistTopReco_pt[fgNSides][fgNOrigins];        // Reconstructed Pt of the tops
                                   
    TH1F *fHistChi2[fgNSides];                          // Chi2 of the kinematic fits
    TH1F *fHistChi2Prob[fgNSides];                      // Chi2Prob of the kinematic fits
                                   
    TH2F *fHistTopMvsChi2[fgNSides][fgNOrigins];        // Mass of reconstructed top vs. Chi2
    TH2F *fHistTopMvsChi2prob[fgNSides][fgNOrigins];    // Mass of reconstructed top vs. Chi2prob
                                   
    TH2F *fHistTopPtvsChi2[fgNSides][fgNOrigins];       // Mass of reconstructed top vs. Chi2
    TH2F *fHistTopPtvsChi2prob[fgNSides][fgNOrigins];   // Mass of reconstructed top vs. Chi2prob
    
  // Leptonic decays
    TH1F *fHistLepNuReco_phi;
    TH1F *fHistLepNuReco_pt;
    TH1F *fHistLepNuReco_eta;
 
  // Hadronic decays

  // Pull distributions
    TH1F *fHistResidualLepton_pt;        // alteration of lepton pt by fit
    TH1F *fHistResidualLepton_eta;       // alteration of lepton eta by fit
    TH1F *fHistResidualLepton_phi;       // alteration of lepton phi by fit
    TH1F *fHistResidualLepBJet_Et;       // alteration of lep bjet Et by fit
    TH1F *fHistResidualLepBJet_pt;       // alteration of lep bjet pt by fit
    TH1F *fHistResidualLepBJet_eta;      // alteration of lep bjet eta by fit
    TH1F *fHistResidualLepBJet_phi;      // alteration of lep bjet phi by fit
    TH1F *fHistResidualEtmiss_Mag;       // alteration of met et by fit
    TH1F *fHistResidualEtmiss_phi;       // alteration of met phi by fit
                                      
    TH1F *fHistResidualHadBJet_Et;       // alteration of had bjet Et by fit
    TH1F *fHistResidualHadBJet_pt;       // alteration of had bjet pt by fit
    TH1F *fHistResidualHadBJet_eta;      // alteration of had bjet eta by fit
    TH1F *fHistResidualHadBJet_phi;      // alteration of had bjet phi by fit
    TH1F *fHistResidualHadJet1_Et;       // alteration of had jet1 Et by fit
    TH1F *fHistResidualHadJet1_pt;       // alteration of had jet1 pt by fit
    TH1F *fHistResidualHadJet1_eta;      // alteration of had jet1 eta by fit
    TH1F *fHistResidualHadJet1_phi;      // alteration of had jet1 phi by fit
    TH1F *fHistResidualHadJet2_Et;       // alteration of had jet2 Et by fit
    TH1F *fHistResidualHadJet2_pt;       // alteration of had jet2 pt by fit
    TH1F *fHistResidualHadJet2_eta;      // alteration of had jet2 eta by fit
    TH1F *fHistResidualHadJet2_phi;      // alteration of had jet2 phi by fit

    TH1F *fHistPullLepton_pt;        // pull of lepton pt by fit
    TH1F *fHistPullLepton_eta;       // pull of lepton eta by fit
    TH1F *fHistPullLepton_phi;       // pull of lepton phi by fit
    TH1F *fHistPullLepBJet_pt;       // pull of lep bjet pt by fit
    TH1F *fHistPullLepBJet_eta;      // pull of lep bjet eta by fit
    TH1F *fHistPullLepBJet_phi;      // pull of lep bjet phi by fit
    TH1F *fHistPullEtmiss_Mag;       // pull of met et by fit
    TH1F *fHistPullEtmiss_phi;       // pull of met phi by fit
                                      

    TH1F *fHistPullHadBJet_pt;       // pull of had bjet pt by fit
    TH1F *fHistPullHadBJet_eta;      // pull of had bjet eta by fit
    TH1F *fHistPullHadBJet_phi;      // pull of had bjet phi by fit
    TH1F *fHistPullHadJet1_pt;       // pull of had jet1 pt by fit
    TH1F *fHistPullHadJet1_eta;      // pull of had jet1 eta by fit
    TH1F *fHistPullHadJet1_phi;      // pull of had jet1 phi by fit
    TH1F *fHistPullHadJet2_pt;       // pull of had jet2 pt by fit
    TH1F *fHistPullHadJet2_eta;      // pull of had jet2 eta by fit
    TH1F *fHistPullHadJet2_phi;      // pull of had jet2 phi by fit


  public:
    AtlTopPairDocumenter(const char* name, const char* title, TFile* Output, const char* path);
    virtual ~AtlTopPairDocumenter();
    virtual void BookHistograms();
    virtual void FillHistograms();
    virtual void Clear() {;}
    virtual void Terminate() {;}
    virtual void Print() const {;}
    void Document(AtlTopPair *toppair, TVector2 *etmiss, Double_t weight);
    
  private:
    void BookHadHistograms();
    void BookLepHistograms();
    void BookResidualHistograms();
    void BookPullHistograms();  
    void FillHadHistograms();
    void FillLepHistograms();
    void FillResidualHistograms();
    void FillPullHistograms();
    
    ClassDef(AtlTopPairDocumenter,0) // Abstract base class for ATLAS histogramming tools
};
#endif

 AtlTopPairDocumenter.h:1
 AtlTopPairDocumenter.h:2
 AtlTopPairDocumenter.h:3
 AtlTopPairDocumenter.h:4
 AtlTopPairDocumenter.h:5
 AtlTopPairDocumenter.h:6
 AtlTopPairDocumenter.h:7
 AtlTopPairDocumenter.h:8
 AtlTopPairDocumenter.h:9
 AtlTopPairDocumenter.h:10
 AtlTopPairDocumenter.h:11
 AtlTopPairDocumenter.h:12
 AtlTopPairDocumenter.h:13
 AtlTopPairDocumenter.h:14
 AtlTopPairDocumenter.h:15
 AtlTopPairDocumenter.h:16
 AtlTopPairDocumenter.h:17
 AtlTopPairDocumenter.h:18
 AtlTopPairDocumenter.h:19
 AtlTopPairDocumenter.h:20
 AtlTopPairDocumenter.h:21
 AtlTopPairDocumenter.h:22
 AtlTopPairDocumenter.h:23
 AtlTopPairDocumenter.h:24
 AtlTopPairDocumenter.h:25
 AtlTopPairDocumenter.h:26
 AtlTopPairDocumenter.h:27
 AtlTopPairDocumenter.h:28
 AtlTopPairDocumenter.h:29
 AtlTopPairDocumenter.h:30
 AtlTopPairDocumenter.h:31
 AtlTopPairDocumenter.h:32
 AtlTopPairDocumenter.h:33
 AtlTopPairDocumenter.h:34
 AtlTopPairDocumenter.h:35
 AtlTopPairDocumenter.h:36
 AtlTopPairDocumenter.h:37
 AtlTopPairDocumenter.h:38
 AtlTopPairDocumenter.h:39
 AtlTopPairDocumenter.h:40
 AtlTopPairDocumenter.h:41
 AtlTopPairDocumenter.h:42
 AtlTopPairDocumenter.h:43
 AtlTopPairDocumenter.h:44
 AtlTopPairDocumenter.h:45
 AtlTopPairDocumenter.h:46
 AtlTopPairDocumenter.h:47
 AtlTopPairDocumenter.h:48
 AtlTopPairDocumenter.h:49
 AtlTopPairDocumenter.h:50
 AtlTopPairDocumenter.h:51
 AtlTopPairDocumenter.h:52
 AtlTopPairDocumenter.h:53
 AtlTopPairDocumenter.h:54
 AtlTopPairDocumenter.h:55
 AtlTopPairDocumenter.h:56
 AtlTopPairDocumenter.h:57
 AtlTopPairDocumenter.h:58
 AtlTopPairDocumenter.h:59
 AtlTopPairDocumenter.h:60
 AtlTopPairDocumenter.h:61
 AtlTopPairDocumenter.h:62
 AtlTopPairDocumenter.h:63
 AtlTopPairDocumenter.h:64
 AtlTopPairDocumenter.h:65
 AtlTopPairDocumenter.h:66
 AtlTopPairDocumenter.h:67
 AtlTopPairDocumenter.h:68
 AtlTopPairDocumenter.h:69
 AtlTopPairDocumenter.h:70
 AtlTopPairDocumenter.h:71
 AtlTopPairDocumenter.h:72
 AtlTopPairDocumenter.h:73
 AtlTopPairDocumenter.h:74
 AtlTopPairDocumenter.h:75
 AtlTopPairDocumenter.h:76
 AtlTopPairDocumenter.h:77
 AtlTopPairDocumenter.h:78
 AtlTopPairDocumenter.h:79
 AtlTopPairDocumenter.h:80
 AtlTopPairDocumenter.h:81
 AtlTopPairDocumenter.h:82
 AtlTopPairDocumenter.h:83
 AtlTopPairDocumenter.h:84
 AtlTopPairDocumenter.h:85
 AtlTopPairDocumenter.h:86
 AtlTopPairDocumenter.h:87
 AtlTopPairDocumenter.h:88
 AtlTopPairDocumenter.h:89
 AtlTopPairDocumenter.h:90
 AtlTopPairDocumenter.h:91
 AtlTopPairDocumenter.h:92
 AtlTopPairDocumenter.h:93
 AtlTopPairDocumenter.h:94
 AtlTopPairDocumenter.h:95
 AtlTopPairDocumenter.h:96
 AtlTopPairDocumenter.h:97
 AtlTopPairDocumenter.h:98
 AtlTopPairDocumenter.h:99
 AtlTopPairDocumenter.h:100
 AtlTopPairDocumenter.h:101
 AtlTopPairDocumenter.h:102
 AtlTopPairDocumenter.h:103
 AtlTopPairDocumenter.h:104
 AtlTopPairDocumenter.h:105
 AtlTopPairDocumenter.h:106
 AtlTopPairDocumenter.h:107
 AtlTopPairDocumenter.h:108
 AtlTopPairDocumenter.h:109
 AtlTopPairDocumenter.h:110
 AtlTopPairDocumenter.h:111
 AtlTopPairDocumenter.h:112
 AtlTopPairDocumenter.h:113
 AtlTopPairDocumenter.h:114
 AtlTopPairDocumenter.h:115
 AtlTopPairDocumenter.h:116
 AtlTopPairDocumenter.h:117
 AtlTopPairDocumenter.h:118
 AtlTopPairDocumenter.h:119
 AtlTopPairDocumenter.h:120
 AtlTopPairDocumenter.h:121
 AtlTopPairDocumenter.h:122
 AtlTopPairDocumenter.h:123
 AtlTopPairDocumenter.h:124
 AtlTopPairDocumenter.h:125
 AtlTopPairDocumenter.h:126
 AtlTopPairDocumenter.h:127
 AtlTopPairDocumenter.h:128
 AtlTopPairDocumenter.h:129
 AtlTopPairDocumenter.h:130
 AtlTopPairDocumenter.h:131
 AtlTopPairDocumenter.h:132
 AtlTopPairDocumenter.h:133
 AtlTopPairDocumenter.h:134
 AtlTopPairDocumenter.h:135
 AtlTopPairDocumenter.h:136
 AtlTopPairDocumenter.h:137
 AtlTopPairDocumenter.h:138