1 |
csander |
1.1 |
#define MyAnalysis_cxx
|
2 |
|
|
// The class definition in MyAnalysis.h has been generated automatically
|
3 |
|
|
// by the ROOT utility TTree::MakeSelector(). This class is derived
|
4 |
|
|
// from the ROOT class TSelector. For more information on the TSelector
|
5 |
|
|
// framework see $ROOTSYS/README/README.SELECTOR or the ROOT User Manual.
|
6 |
|
|
|
7 |
|
|
// The following methods are defined in this file:
|
8 |
|
|
// Begin(): called every time a loop on the tree starts,
|
9 |
|
|
// a convenient place to create your histograms.
|
10 |
|
|
// SlaveBegin(): called after Begin(), when on PROOF called only on the
|
11 |
|
|
// slave servers.
|
12 |
|
|
// Process(): called for each event, in this function you decide what
|
13 |
|
|
// to read and fill your histograms.
|
14 |
|
|
// SlaveTerminate: called at the end of the loop on the tree, when on PROOF
|
15 |
|
|
// called only on the slave servers.
|
16 |
|
|
// Terminate(): called at the end of the loop on the tree,
|
17 |
|
|
// a convenient place to draw/fit your histograms.
|
18 |
|
|
//
|
19 |
|
|
// To use this file, try the following session on your Tree T:
|
20 |
|
|
//
|
21 |
|
|
// Root > T->Process("MyAnalysis.C")
|
22 |
|
|
// Root > T->Process("MyAnalysis.C","some options")
|
23 |
|
|
// Root > T->Process("MyAnalysis.C+")
|
24 |
|
|
//
|
25 |
|
|
|
26 |
|
|
#include "MyAnalysis.h"
|
27 |
csander |
1.3 |
#include <iostream>
|
28 |
csander |
1.2 |
#include <TH1F.h>
|
29 |
csander |
1.1 |
#include <TStyle.h>
|
30 |
csander |
1.4 |
#include <TCanvas.h>
|
31 |
csander |
1.1 |
|
32 |
csander |
1.3 |
using namespace std;
|
33 |
|
|
|
34 |
|
|
void MyAnalysis::BuildEvent() {
|
35 |
|
|
Jets.clear();
|
36 |
|
|
for (int i = 0; i < NJet; ++i) {
|
37 |
|
|
MyJet jet(Jet_Px[i], Jet_Py[i], Jet_Pz[i], Jet_E[i]);
|
38 |
|
|
jet.SetBTagDiscriminator(Jet_btag[i]);
|
39 |
|
|
Jets.push_back(jet);
|
40 |
|
|
}
|
41 |
|
|
Muons.clear();
|
42 |
|
|
for (int i = 0; i < NMuon; ++i) {
|
43 |
|
|
MyMuon muon(Muon_Px[i], Muon_Py[i], Muon_Pz[i], Muon_E[i]);
|
44 |
|
|
muon.SetIsolation(Muon_Iso[i]);
|
45 |
csander |
1.4 |
muon.SetCharge(Muon_Charge[i]);
|
46 |
csander |
1.3 |
Muons.push_back(muon);
|
47 |
|
|
}
|
48 |
csander |
1.4 |
Electrons.clear();
|
49 |
|
|
for (int i = 0; i < NElectron; ++i) {
|
50 |
|
|
MyElectron electron(Electron_Px[i], Electron_Py[i], Electron_Pz[i], Electron_E[i]);
|
51 |
|
|
electron.SetIsolation(Electron_Iso[i]);
|
52 |
|
|
electron.SetCharge(Electron_Charge[i]);
|
53 |
|
|
Electrons.push_back(electron);
|
54 |
|
|
}
|
55 |
|
|
Photons.clear();
|
56 |
|
|
for (int i = 0; i < NPhoton; ++i) {
|
57 |
|
|
MyPhoton photon(Photon_Px[i], Photon_Py[i], Photon_Pz[i], Photon_E[i]);
|
58 |
|
|
photon.SetIsolation(Photon_Iso[i]);
|
59 |
|
|
Photons.push_back(photon);
|
60 |
|
|
}
|
61 |
csander |
1.3 |
}
|
62 |
|
|
|
63 |
csander |
1.2 |
void MyAnalysis::Begin(TTree * /*tree*/) {
|
64 |
csander |
1.1 |
// The Begin() function is called at the start of the query.
|
65 |
|
|
// When running with PROOF Begin() is only called on the client.
|
66 |
|
|
// The tree argument is deprecated (on PROOF 0 is passed).
|
67 |
|
|
|
68 |
|
|
TString option = GetOption();
|
69 |
|
|
|
70 |
|
|
}
|
71 |
|
|
|
72 |
csander |
1.2 |
void MyAnalysis::SlaveBegin(TTree * /*tree*/) {
|
73 |
csander |
1.1 |
// The SlaveBegin() function is called after the Begin() function.
|
74 |
|
|
// When running with PROOF SlaveBegin() is called on each slave server.
|
75 |
|
|
// The tree argument is deprecated (on PROOF 0 is passed).
|
76 |
|
|
|
77 |
|
|
TString option = GetOption();
|
78 |
|
|
|
79 |
csander |
1.4 |
h_Mmumu = new TH1F("Mmumu", "Invariant di-muon mass", 100, 0, 200);
|
80 |
|
|
h_Mmumu->SetXTitle("m_{#mu#mu}");
|
81 |
|
|
h_Mmumu->SetYTitle("a.u.");
|
82 |
|
|
h_Mmumu->Sumw2();
|
83 |
|
|
|
84 |
csander |
1.1 |
}
|
85 |
|
|
|
86 |
csander |
1.2 |
Bool_t MyAnalysis::Process(Long64_t entry) {
|
87 |
csander |
1.1 |
// The Process() function is called for each entry in the tree (or possibly
|
88 |
|
|
// keyed object in the case of PROOF) to be processed. The entry argument
|
89 |
|
|
// specifies which entry in the currently loaded tree is to be processed.
|
90 |
|
|
// It can be passed to either MyAnalysis::GetEntry() or TBranch::GetEntry()
|
91 |
|
|
// to read either all or the required parts of the data. When processing
|
92 |
|
|
// keyed objects with PROOF, the object is already loaded and is available
|
93 |
|
|
// via the fObject pointer.
|
94 |
|
|
//
|
95 |
|
|
// This function should contain the "body" of the analysis. It can contain
|
96 |
|
|
// simple or elaborate selection criteria, run algorithms on the data
|
97 |
|
|
// of the event and typically fill histograms.
|
98 |
|
|
//
|
99 |
|
|
// The processing can be stopped by calling Abort().
|
100 |
|
|
//
|
101 |
|
|
// Use fStatus to set the return value of TTree::Process().
|
102 |
|
|
//
|
103 |
|
|
// The return value is currently not used.
|
104 |
|
|
|
105 |
csander |
1.3 |
++TotalEvents;
|
106 |
|
|
|
107 |
|
|
GetEntry(entry);
|
108 |
|
|
|
109 |
csander |
1.4 |
if (TotalEvents % 10000 == 0)
|
110 |
|
|
cout << "Next event -----> " << TotalEvents << endl;
|
111 |
|
|
|
112 |
csander |
1.3 |
BuildEvent();
|
113 |
|
|
|
114 |
csander |
1.5 |
cout << "Jets: " << endl;
|
115 |
|
|
for (vector<MyJet>::iterator it = Jets.begin(); it != Jets.end(); ++it) {
|
116 |
|
|
cout << "pt, eta, phi, btag: " << it->Pt() << ", " << it->Eta() << ", " << it->Phi() << ", " << it->IsBTagged()
|
117 |
|
|
<< endl;
|
118 |
|
|
}
|
119 |
|
|
cout << "Muons: " << endl;
|
120 |
|
|
for (vector<MyMuon>::iterator it = Muons.begin(); it != Muons.end(); ++it) {
|
121 |
|
|
cout << "pt, eta, phi, iso, charge: " << it->Pt() << ", " << it->Eta() << ", " << it->Phi() << ", "
|
122 |
|
|
<< it->GetIsolation() << ", " << it->GetCharge() << endl;
|
123 |
|
|
}
|
124 |
|
|
cout << "Electrons: " << endl;
|
125 |
|
|
for (vector<MyElectron>::iterator it = Electrons.begin(); it != Electrons.end(); ++it) {
|
126 |
|
|
cout << "pt, eta, phi, iso, charge: " << it->Pt() << ", " << it->Eta() << ", " << it->Phi() << ", "
|
127 |
|
|
<< it->GetIsolation() << ", " << it->GetCharge() << endl;
|
128 |
|
|
}
|
129 |
|
|
cout << "Photons: " << endl;
|
130 |
|
|
for (vector<MyPhoton>::iterator it = Photons.begin(); it != Photons.end(); ++it) {
|
131 |
|
|
cout << "pt, eta, phi, iso: " << it->Pt() << ", " << it->Eta() << ", " << it->Phi() << ", " << it->GetIsolation()
|
132 |
|
|
<< endl;
|
133 |
|
|
}
|
134 |
csander |
1.4 |
|
135 |
|
|
if (NMuon > 1 && Muons.at(0).GetCharge() * Muons.at(1).GetCharge() < 1) {
|
136 |
|
|
h_Mmumu->Fill((Muons.at(0) + Muons.at(1)).M());
|
137 |
csander |
1.3 |
}
|
138 |
csander |
1.1 |
|
139 |
|
|
return kTRUE;
|
140 |
|
|
}
|
141 |
|
|
|
142 |
csander |
1.2 |
void MyAnalysis::SlaveTerminate() {
|
143 |
csander |
1.1 |
// The SlaveTerminate() function is called after all entries or objects
|
144 |
|
|
// have been processed. When running with PROOF SlaveTerminate() is called
|
145 |
|
|
// on each slave server.
|
146 |
|
|
|
147 |
|
|
}
|
148 |
|
|
|
149 |
csander |
1.2 |
void MyAnalysis::Terminate() {
|
150 |
csander |
1.1 |
// The Terminate() function is the last function to be called during
|
151 |
|
|
// a query. It always runs on the client, it can be used to present
|
152 |
|
|
// the results graphically or save the results to file.
|
153 |
|
|
|
154 |
csander |
1.4 |
TCanvas *c = new TCanvas("c", "c", 600, 600);
|
155 |
|
|
h_Mmumu->Draw("");
|
156 |
|
|
c->Print("Mmumu.pdf");
|
157 |
|
|
|
158 |
csander |
1.1 |
}
|