ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/Angles/src/makeMELATree.cc
Revision: 1.1
Committed: Sun May 20 19:31:17 2012 UTC (13 years ago) by khahn
Content type: text/plain
Branch: MAIN
CVS Tags: synced_FSR_2, synced_FSR, synched2
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 khahn 1.1 #include "TFile.h"
2     #include "TTree.h"
3    
4     #include "KinematicsStruct.h"
5     #include "WeightStruct.h"
6     #include "Angles.h"
7    
8     #include <iostream>
9     #include <assert.h>
10    
11     using namespace std;
12    
13     int main(int argc, char ** argv) {
14    
15     assert(argc == 3);
16     const char * ifname = argv[1];
17     const char * ofname = argv[2];
18    
19     TFile * f = new TFile(ifname);
20     TTree * t = (TTree*)(f->Get("zznt"));
21     KinematicsStruct kin;
22     WeightStruct weights;
23     Angles angles;
24     float bdt;
25     t->SetBranchAddress("kinematics", &kin);
26     t->SetBranchAddress("weights", &weights);
27     t->SetBranchAddress("angles", &angles);
28     t->SetBranchAddress("BDT", &bdt );
29    
30     TFile * ff = new TFile(ofname, "RECREATE");
31     TTree * nt = new TTree("angles", "angles");
32    
33     unsigned channel;
34     double d_ZZpt, d_ZZy;
35     double d_mZ1, d_mZ2, d_m4l;
36     double d_costheta1, d_costheta2, d_costhetastar;
37     double d_Phi, d_Phi1;
38     double d_w, d_won, d_woff;
39    
40     nt->Branch("channel", &channel);
41     nt->Branch("ZZpt", &d_ZZpt);
42     nt->Branch("ZZrapidity", &d_ZZy);
43     nt->Branch("Z1Mass", &d_mZ1);
44     nt->Branch("Z2Mass", &d_mZ2);
45     nt->Branch("ZZMass", &d_m4l);
46     nt->Branch("costheta1", &d_costheta1);
47     nt->Branch("costheta2", &d_costheta2);
48     nt->Branch("costhetastar", &d_costhetastar);
49     nt->Branch("phi", &d_Phi);
50     nt->Branch("phistar1", &d_Phi1);
51     nt->Branch("BDT", &bdt);
52     nt->Branch("w", &d_w);
53     nt->Branch("won", &d_won);
54     nt->Branch("woff", &d_woff);
55    
56     for( int i=0; i<t->GetEntries(); i++ ) {
57    
58     if( !(i%10000) ) cout << "processed: " << i << endl;
59     t->GetEntry(i);
60    
61     channel = kin.channel;
62     d_mZ1 = kin.mZ1;
63     d_mZ2 = kin.mZ2;
64     d_m4l = kin.m4l;
65     d_ZZpt = kin.ZZpt;
66     d_ZZy = kin.ZZy;
67     d_costheta1 = angles.costheta1;
68     d_costheta2 = angles.costheta2;
69     d_costhetastar = angles.costhetastar;
70     d_Phi = angles.Phi;
71     d_Phi1 = angles.Phi1;
72     d_w = weights.w;
73     d_won = weights.won;
74     d_woff = weights.woff;
75     nt->Fill();
76     }
77    
78     nt->Write();
79     ff->Close();
80    
81     }