ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/algomez/FourTop/TreeAnalyzer/test/Analyzer.h
Revision: 1.4
Committed: Tue Mar 20 19:57:52 2012 UTC (13 years, 1 month ago) by algomez
Content type: text/plain
Branch: MAIN
Changes since 1.3: +59 -29 lines
Log Message:
new version

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 algomez 1.2 #define STANDALONE
12    
13 algomez 1.1 #include <TROOT.h>
14     #include <TH1F.h>
15     #include <TH1D.h>
16 algomez 1.4 #include <TH2D.h>
17     #include <TH2.h>
18     #include <TH3.h>
19     #include <TProofOutputFile.h>
20 algomez 1.1 #include <TChain.h>
21     #include <TFile.h>
22 algomez 1.4 #include <TString.h>
23 algomez 1.1 #include <TSelector.h>
24 algomez 1.4 #include <TSystem.h>
25     #include <TProfile.h>
26     #include <fstream>
27     #include <iostream>
28     #include "BTagSFUtil_lite.h"
29 algomez 1.1
30     #include "Yumiceva/Top7TeV/interface/TopEventNtuple.h"
31     #include "Yumiceva/TreeAnalyzer/interface/MuonSelector.h"
32     #include "Yumiceva/TreeAnalyzer/interface/ElectronSelector.h"
33     #include "Yumiceva/TreeAnalyzer/interface/StoreTreeVariable.h"
34     #include "Yumiceva/TreeAnalyzer/interface/METzCalculator.h"
35     #include "CondFormats/JetMETObjects/interface/JetCorrectionUncertainty.h"
36 algomez 1.2 #include "PhysicsTools/Utilities/interface/Lumi3DReWeighting.h"
37 algomez 1.3
38 algomez 1.1
39     #include <map>
40     #include <string>
41     #include <vector>
42    
43 algomez 1.2 #include "LOTable.h"
44    
45 algomez 1.1 class Analyzer : public TSelector {
46    
47     private:
48     void ParseInput();
49     TString fMyOpt;
50     int fChannel;
51     bool fVerbose;
52     bool fIsMC;
53     bool fdoQCD1SideBand;
54     bool fdoQCD2SideBand;
55     bool fdoJECunc;
56     bool fdoJECup;
57     bool fdoMtopCut;
58 algomez 1.2 bool fdoJERunc;
59     bool fdoJERup;
60     bool fdoJERdown;
61     bool fpu_up;
62     bool fpu_down;
63    
64 algomez 1.1 //HistoManager *fHist;
65     TString fSample;
66     TString fOutdir;
67     TH1F *h1test;
68     TH1D *hcutflow;
69     map< string, TH1*> hmuons;
70 algomez 1.4 map< string, TH1*> hbtageff;
71 algomez 1.1 map< string, TH1*> helectrons;
72     map< string, TH1*> hjets;
73     map< string, TH1*> hPVs;
74     map< string, TH1*> hMET;
75     map< string, TH1*> hM;
76     vector< string > fCutLabels;
77     vector< double > fpu_weights_vec;
78 algomez 1.2 edm::Lumi3DReWeighting LumiWeights_;
79     edm::Lumi3DReWeighting LumiWeightsdown_;
80     edm::Lumi3DReWeighting LumiWeightsup_;
81 algomez 1.4
82     TFile* scfactorfile;
83     TH2D* f2Delecsc;
84     TH2D* f2Djetsc;
85     TH2D* f2Djetasysc;
86     TH1D* f1Dpfmhtsc;
87     TFile* efffile;
88     TH2D* f2Djetdataeff;
89     TH2D* f2Djetmceff;
90     TFile* btagefffile;
91     TH2D* f2Dttbarbtag;
92     TH2D* f2Dttbarctag;
93     TH2D* f2Dttbarlighttag;
94     TH2D* f2Dwprimebtag;
95     TH2D* f2Dwprimectag;
96     TH2D* f2Dwprimelighttag;
97     //Medium
98     LOTable bSF_table;
99     LOTable bSF_table_error;
100     LOTable lSF_table;
101     LOTable lSF_table_error_down;
102     LOTable lSF_table_error_up;
103     LOTable leff_table;
104     //Loose
105     LOTable bSF_table_loose;
106     LOTable bSF_table_error_loose;
107     LOTable lSF_table_loose;
108     LOTable lSF_table_error_down_loose;
109     LOTable lSF_table_error_up_loose;
110     LOTable leff_table_loose;
111     //Tight
112     LOTable bSF_table_tight;
113     LOTable bSF_table_error_tight;
114     LOTable lSF_table_tight;
115     LOTable lSF_table_error_down_tight;
116     LOTable lSF_table_error_up_tight;
117     LOTable leff_table_tight;
118     //LOTableHeavy bSF_table_loose;
119     //LOTableHeavy bSF_table_medium;
120     //LOTableHeavy bSF_table_tight;
121     //LOTableLight leff_SF_table_loose;
122     //LOTableLight leff_SF_table_medium;
123     //LOTableLight leff_SF_table_tight;
124    
125     map<string, TH1*> jethist;
126     map<string, TH2*> btageff;
127 algomez 1.1
128     public :
129    
130 algomez 1.4 JetCorrectionUncertainty *fJECunc;
131 algomez 1.1 TTree *fChain; //!pointer to the analyzed TTree or TChain
132     TopEventNtuple *ntuple;
133     StoreTreeVariable *MyStoreTree; // My Storing Tree
134     TFile *fFile;
135     TProofOutputFile *fProofFile; // For optimized merging of the ntuple
136     MuonSelector fMuSelector;
137     ElectronSelector fEleSelector;
138 algomez 1.4 METzCalculator fzCalculator;
139 algomez 1.1 map< string, double > cutmap;
140    
141 algomez 1.2 Analyzer(TTree * /*tree*/ =0):h1test(0),fChain(0),ntuple(),fFile(0),fProofFile(0),fMuSelector(),fEleSelector()
142 algomez 1.1 {
143     fChannel = 1; //default mu+jets
144     fVerbose = false;
145     fIsMC = true;
146     fSample = "";
147     fOutdir = "";
148     fdoQCD1SideBand = false;
149     fdoQCD2SideBand = false;
150     fdoJECunc = false;
151     fdoJECup = true;
152 algomez 1.2 fdoJERunc = true;
153     fdoJERup = false;
154     fdoJERdown = false;
155 algomez 1.1 fdoMtopCut = true;
156 algomez 1.2 fpu_up = false;
157     fpu_down = false;
158 algomez 1.1 }
159     virtual ~Analyzer() { }
160     virtual Int_t Version() const { return 2; }
161     virtual void Begin(TTree *tree);
162     virtual void SlaveBegin(TTree *tree);
163     virtual void Init(TTree *tree);
164     virtual Bool_t Notify();
165     virtual Bool_t Process(Long64_t entry);
166     virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0) { return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0; }
167     virtual void SetOption(const char *option) { fOption = option; }
168     virtual void SetObject(TObject *obj) { fObject = obj; }
169     virtual void SetInputList(TList *input) { fInput = input; }
170     virtual TList *GetOutputList() const { return fOutput; }
171     virtual void SlaveTerminate();
172     virtual void Terminate();
173    
174     ClassDef(Analyzer,0);
175     };
176    
177     #endif
178    
179    
180     //#ifdef Analyzer_cxx
181     void Analyzer::Init(TTree *tree)
182     {
183     // The Init() function is called when the selector needs to initialize
184     // a new tree or chain. Typically here the branch addresses and branch
185     // pointers of the tree will be set.
186     // It is normally not necessary to make changes to the generated
187     // code, but the routine can be extended by the user if needed.
188     // Init() will be called many times when running on PROOF
189     // (once per file to be processed).
190    
191     Info("Init","tree: %p", tree);
192    
193     // Set branch addresses and branch pointers
194     if (!tree) return;
195    
196     fChain = tree;
197     fChain->SetBranchAddress("top.", &ntuple);
198     }
199    
200     Bool_t Analyzer::Notify()
201     {
202     // The Notify() function is called when a new file is opened. This
203     // can be either for a new TTree in a TChain or when when a new TTree
204     // is started when using PROOF. It is normally not necessary to make changes
205     // to the generated code, but the routine can be extended by the
206     // user if needed. The return value is currently not used.
207    
208     return kTRUE;
209     }
210    
211     //#endif // #ifdef Analyzer_cxx