ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Jeng/scripts/qcd.h
Revision: 1.2
Committed: Wed Apr 15 04:15:54 2009 UTC (16 years ago) by jengbou
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +88 -230 lines
Log Message:
Update

File Contents

# Content
1 //////////////////////////////////////////////////////////
2 // This class has been automatically generated on
3 // Tue Apr 7 16:30:17 2009
4 // from TTree top/top
5 // found on file: nominal/ABCD_TTJets_all.root
6 //////////////////////////////////////////////////////////
7
8 #ifndef qcd_h
9 #define qcd_h
10
11 #include <vector>
12 using namespace std;
13
14 #include <TROOT.h>
15 #include <TChain.h>
16 #include <TFile.h>
17 #include <TH1.h>
18 const Int_t kMaxtop = 1;
19
20 class qcd {
21 public :
22 TTree *fChain; //!pointer to the analyzed TTree or TChain
23 Int_t fCurrent; //!current Tree number in a TChain
24
25 // Declaration of leaf types
26 //BooEventNtuple *top.;
27 Int_t top_njets;
28 vector<float> top_muon_d0;
29 vector<float> top_muon_d0Error;
30 vector<float> top_muon_old_reliso;
31 vector<float> top_muon_new_reliso;
32 vector<float> top_muon_ptrel;
33
34 // List of branches
35 TBranch *b_top_njets;
36 TBranch *b_top_muon_d0;
37 TBranch *b_top_muon_d0Error;
38 TBranch *b_top_muon_old_reliso;
39 TBranch *b_top_muon_new_reliso;
40
41 qcd(TTree *tree=0);
42 virtual ~qcd();
43 virtual Int_t Cut(Long64_t entry);
44 virtual Int_t GetEntry(Long64_t entry);
45 virtual Long64_t LoadTree(Long64_t entry);
46 virtual void Init(TTree *tree);
47 virtual void Loop();
48 virtual void FitBKG(TString,TH1D*,TH1D*,double, double,double,double,double);
49 virtual Bool_t Notify();
50 virtual void Show(Long64_t entry = -1);
51 };
52
53 #endif
54
55 #ifdef qcd_cxx
56 qcd::qcd(TTree *tree)
57 {
58 TChain * chain = new TChain("top","");
59 chain->Add("nominal/ABCD_TTJets_all.root/top");
60 chain->Add("nominal/ABCD_MuPt15_all.root/top");
61 chain->Add("nominal/ABCD_WJets_all.root/top");
62 chain->Add("nominal/ABCD_ZJets_all.root/top");
63
64 tree = chain;
65 Init(tree);
66 }
67
68 qcd::~qcd()
69 {
70 if (!fChain) return;
71 delete fChain->GetCurrentFile();
72 }
73
74 Int_t qcd::GetEntry(Long64_t entry)
75 {
76 // Read contents of entry.
77 if (!fChain) return 0;
78 return fChain->GetEntry(entry);
79 }
80 Long64_t qcd::LoadTree(Long64_t entry)
81 {
82 // Set the environment to read one entry
83 if (!fChain) return -5;
84 Long64_t centry = fChain->LoadTree(entry);
85 if (centry < 0) return centry;
86 if (!fChain->InheritsFrom(TChain::Class())) return centry;
87 TChain *chain = (TChain*)fChain;
88 if (chain->GetTreeNumber() != fCurrent) {
89 fCurrent = chain->GetTreeNumber();
90 Notify();
91 }
92 return centry;
93 }
94
95 void qcd::Init(TTree *tree)
96 {
97 // The Init() function is called when the selector needs to initialize
98 // a new tree or chain. Typically here the branch addresses and branch
99 // pointers of the tree will be set.
100 // It is normally not necessary to make changes to the generated
101 // code, but the routine can be extended by the user if needed.
102 // Init() will be called many times when running on PROOF
103 // (once per file to be processed).
104
105 // Set branch addresses and branch pointers
106 if (!tree) return;
107 fChain = tree;
108 fCurrent = -1;
109 fChain->SetMakeClass(1);
110
111 fChain->SetBranchAddress("top.njets", &top_njets, &b_top_njets);
112 fChain->SetBranchAddress("top.muon_d0", &top_muon_d0, &b_top_muon_d0);
113 fChain->SetBranchAddress("top.muon_d0Error", &top_muon_d0Error, &b_top_muon_d0Error);
114 fChain->SetBranchAddress("top.muon_old_reliso", &top_muon_old_reliso, &b_top_muon_old_reliso);
115 fChain->SetBranchAddress("top.muon_new_reliso", &top_muon_new_reliso, &b_top_muon_new_reliso);
116 Notify();
117 }
118
119 Bool_t qcd::Notify()
120 {
121 // The Notify() function is called when a new file is opened. This
122 // can be either for a new TTree in a TChain or when when a new TTree
123 // is started when using PROOF. It is normally not necessary to make changes
124 // to the generated code, but the routine can be extended by the
125 // user if needed. The return value is currently not used.
126
127 return kTRUE;
128 }
129
130 void qcd::Show(Long64_t entry)
131 {
132 // Print contents of entry.
133 // If entry is not specified, print current entry
134 if (!fChain) return;
135 fChain->Show(entry);
136 }
137
138 Int_t qcd::Cut(Long64_t entry)
139 {
140 // This function may be called from Loop.
141 // returns 1 if entry is accepted.
142 // returns -1 otherwise.
143 return 1;
144 }
145
146 #endif // #ifdef qcd_cxx