ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/algomez/FourTop/TreeAnalyzer/test/Analyzer.h
Revision: 1.6
Committed: Mon Nov 5 01:11:34 2012 UTC (12 years, 6 months ago) by algomez
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +25 -6 lines
Log Message:
*** empty log message ***

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