ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/algomez/FourTop/TreeAnalyzer/test/Analyzer.h
Revision: 1.1
Committed: Wed Jan 4 00:59:44 2012 UTC (13 years, 4 months ago) by algomez
Content type: text/plain
Branch: MAIN
Log Message:
adding Tree

File Contents

# User Rev Content
1 algomez 1.1 //////////////////////////////////////////////////////////
2     // This class has been automatically generated on
3     // Wed May 25 13:10:09 2011 by ROOT version 5.27/06b
4     // from TTree top/top
5     // found on file: /uscms_data/d3/ttmuj/Documents/NtupleMaker/Data/2011/41x/v2/SingleMu2011A_v1.root
6     //////////////////////////////////////////////////////////
7    
8     #ifndef Analyzer_h
9     #define Analyzer_h
10    
11     #include <TROOT.h>
12     #include <TH1F.h>
13     #include <TH2F.h>
14     #include <TH1D.h>
15     #include <TChain.h>
16     #include <TFile.h>
17     #include <TSelector.h>
18     #include <TProofOutputFile.h>
19     const Int_t kMaxtop = 1;
20    
21     #include "Yumiceva/Top7TeV/interface/TopEventNtuple.h"
22     #include "Yumiceva/TreeAnalyzer/interface/MuonSelector.h"
23     #include "Yumiceva/TreeAnalyzer/interface/ElectronSelector.h"
24     //#include "Yumiceva/TreeAnalyzer/interface/HistoManager.h"
25     #include "Yumiceva/TreeAnalyzer/interface/StoreTreeVariable.h"
26     #include "Yumiceva/TreeAnalyzer/interface/METzCalculator.h"
27     #include "CondFormats/JetMETObjects/interface/JetCorrectionUncertainty.h"
28    
29     #include <map>
30     #include <string>
31     #include <vector>
32    
33     class Analyzer : public TSelector {
34    
35     private:
36     void ParseInput();
37     TString fMyOpt;
38     TString fpuhistogram;
39     int fChannel;
40     bool fVerbose;
41     bool fIsMC;
42     bool fdoQCD1SideBand;
43     bool fdoQCD2SideBand;
44     bool fdoJECunc;
45     bool fdoJECup;
46     bool fdoMtopCut;
47     //HistoManager *fHist;
48     TString fSample;
49     TString fOutdir;
50     TH1F *h1test;
51     TH1D *hcutflow;
52     TH2F *h2_pt_Wprime;
53     map< string, TH1*> hmuons;
54     map< string, TH1*> helectrons;
55     map< string, TH1*> hjets;
56     map< string, TH1*> hPVs;
57     map< string, TH1*> hMET;
58     map< string, TH1*> hM;
59     vector< string > fCutLabels;
60     vector< double > fpu_weights_vec;
61     METzCalculator fzCalculator;
62     JetCorrectionUncertainty *fJECunc;
63     TFile *fweightfile;
64     TH1D *f3Dweight;
65    
66     public :
67    
68     TTree *fChain; //!pointer to the analyzed TTree or TChain
69     TopEventNtuple *ntuple;
70     StoreTreeVariable *MyStoreTree; // My Storing Tree
71     TFile *fFile;
72     TProofOutputFile *fProofFile; // For optimized merging of the ntuple
73     MuonSelector fMuSelector;
74     ElectronSelector fEleSelector;
75     map< string, double > cutmap;
76    
77     Analyzer(TTree * /*tree*/ =0):h1test(0),fChain(0),ntuple(),fFile(0),fweightfile(0),fProofFile(0),f3Dweight(0),fMuSelector(),fEleSelector()
78     {
79     fpuhistogram = "WHist";
80     fChannel = 1; //default mu+jets
81     fVerbose = false;
82     fIsMC = true;
83     fSample = "";
84     fOutdir = "";
85     fdoQCD1SideBand = false;
86     fdoQCD2SideBand = false;
87     fdoJECunc = false;
88     fdoJECup = true;
89     fdoMtopCut = true;
90     }
91     virtual ~Analyzer() { }
92     virtual Int_t Version() const { return 2; }
93     virtual void Begin(TTree *tree);
94     virtual void SlaveBegin(TTree *tree);
95     virtual void Init(TTree *tree);
96     virtual Bool_t Notify();
97     virtual Bool_t Process(Long64_t entry);
98     virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0) { return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0; }
99     virtual void SetOption(const char *option) { fOption = option; }
100     virtual void SetObject(TObject *obj) { fObject = obj; }
101     virtual void SetInputList(TList *input) { fInput = input; }
102     virtual TList *GetOutputList() const { return fOutput; }
103     virtual void SlaveTerminate();
104     virtual void Terminate();
105    
106     ClassDef(Analyzer,0);
107     };
108    
109     #endif
110    
111    
112     //#ifdef Analyzer_cxx
113     void Analyzer::Init(TTree *tree)
114     {
115     // The Init() function is called when the selector needs to initialize
116     // a new tree or chain. Typically here the branch addresses and branch
117     // pointers of the tree will be set.
118     // It is normally not necessary to make changes to the generated
119     // code, but the routine can be extended by the user if needed.
120     // Init() will be called many times when running on PROOF
121     // (once per file to be processed).
122    
123     Info("Init","tree: %p", tree);
124    
125     // Set branch addresses and branch pointers
126     if (!tree) return;
127    
128     fChain = tree;
129     fChain->SetBranchAddress("top.", &ntuple);
130     }
131    
132     Bool_t Analyzer::Notify()
133     {
134     // The Notify() function is called when a new file is opened. This
135     // can be either for a new TTree in a TChain or when when a new TTree
136     // is started when using PROOF. It is normally not necessary to make changes
137     // to the generated code, but the routine can be extended by the
138     // user if needed. The return value is currently not used.
139    
140     return kTRUE;
141     }
142    
143     //#endif // #ifdef Analyzer_cxx