3 |
|
#include "TFile.h" |
4 |
|
#include "TTree.h" |
5 |
|
#include "TString.h" |
6 |
– |
#include "TLorentzVector.h" |
6 |
|
|
7 |
|
#include "SusyEvent.h" |
8 |
+ |
#include "TreeObjects.h" |
9 |
|
|
10 |
|
|
11 |
– |
namespace tree { |
12 |
– |
// In this namespace classes for the trees are defined. |
13 |
– |
|
14 |
– |
class Particle { |
15 |
– |
public: |
16 |
– |
float pt, eta, phi; |
17 |
– |
}; |
18 |
– |
|
19 |
– |
class Photon : public Particle { |
20 |
– |
public: |
21 |
– |
float r9, sigmaIetaIeta, hadTowOverEm, pixelseed; |
22 |
– |
float chargedIso, neutralIso, photonIso; |
23 |
– |
}; |
24 |
– |
|
25 |
– |
class Jet : public Particle{ |
26 |
– |
public: |
27 |
– |
float pt, eta; |
28 |
– |
}; |
29 |
– |
|
30 |
– |
bool EtGreater(const tree::Particle p1, const tree::Particle p2) { |
31 |
– |
return p1.pt > p2.pt; |
32 |
– |
} |
33 |
– |
|
34 |
– |
} // end namespace definition |
35 |
– |
|
11 |
|
class TreeWriter { |
12 |
|
public : |
13 |
|
TreeWriter(TString inputName, TString outputName ); |
35 |
|
float met; |
36 |
|
int nVertex; |
37 |
|
float weight; |
38 |
+ |
float leadingPhotonPt; |
39 |
|
}; |
40 |
|
|
41 |
|
|
82 |
|
tree->Branch("met", &met, "met/F"); |
83 |
|
tree->Branch("nVertex", &nVertex, "nVertex/I"); |
84 |
|
tree->Branch("weigth", &weight, "weight/F"); |
85 |
+ |
tree->Branch("photonPt", &leadingPhotonPt, "photonPt/F"); |
86 |
|
|
87 |
|
|
88 |
|
for (long jentry=0; jentry < processNEvents; jentry++) { |
117 |
|
if( photon.size() == 0 ) |
118 |
|
continue; |
119 |
|
std::sort( photon.begin(), photon.end(), tree::EtGreater); |
120 |
+ |
//leadingPhotonPt = photon.at(0)->pt; |
121 |
|
|
122 |
|
|
123 |
|
// jets |
169 |
|
outFile->Write(); |
170 |
|
outFile->Close(); |
171 |
|
} |
172 |
< |
/* |
172 |
> |
|
173 |
|
int main(int argc, char** argv) { |
174 |
|
TreeWriter *tw = new TreeWriter("qcd-1000-nTuple-test.root", "myQCDTree.root"); |
175 |
|
tw->SetProcessNEvents(10); |
176 |
|
tw->Loop(); |
177 |
|
} |
178 |
< |
*/ |
178 |
> |
|