ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/LJMet/MultivariateAnalysis/standalone/main.cc
Revision: 1.2
Committed: Tue Mar 9 13:37:30 2010 UTC (15 years, 1 month ago) by kukartse
Content type: text/plain
Branch: MAIN
CVS Tags: V00-03-01, ZMorph_BASE_20100408, gak040610_morphing, V00-02-02, HEAD
Branch point for: ZMorph-V00-03-01
Changes since 1.1: +46 -1 lines
Log Message:
standalone topo vars calculation

File Contents

# Content
1 #include <iostream>
2 //#include <fstream>
3 //#include <sstream>
4 //using namespace std;
5
6 //#include "TROOT.h"
7 //#include "TApplication.h"
8
9 #include "TChain.h"
10 #include "TFile.h"
11 #include "TTree.h"
12 #include "LJetsTopoVars.hh"
13
14 int main(int argc, char **argv){
15 std::cout << "\nTest application for the LJetsTopoVars class\n" << std::endl;
16
17 TFile * out_file = new TFile("./sampleTopoVars.root", "RECREATE");
18
19 // Define some mock jets, lepton and MET
20 std::vector<TLorentzVector> jets;
21 TLorentzVector jet;
22 jet.SetPtEtaPhiM(80, 0.1, -2, 0);
23 jets.push_back(jet);
24 jet.SetPtEtaPhiM(70, -0.2, 1, 0);
25 jets.push_back(jet);
26 jet.SetPtEtaPhiM(60, 0.03, 2, 0);
27 jets.push_back(jet);
28 jet.SetPtEtaPhiM(50, -0.04, -3, 0);
29 jets.push_back(jet);
30
31 TLorentzVector lepton;
32 lepton.SetPtEtaPhiM(50, 0.7, 1.5, 0.105);
33
34 TLorentzVector met;
35 met.SetPtEtaPhiM(20, 0.0, 1.0, 0);
36
37 // Instantiate the topovars calculator
38 LJetsTopoVars vars(jets, lepton, met, true);
39
40 // Can reuse the same instance
41 // vars.setEvent(jets, lepton, met, true);
42
43 // compute variables of interest
44 double _aplanarity = vars.aplanarity();
45
46 // create new TTree and fill the varibales in it
47 TTree * oTree = new TTree("topovars", "topovars");
48 oTree->Branch("aplanarity", &_aplanarity, "aplanarity/D");
49 oTree->Fill();
50
51 // Write tree to a file and file to disk
52 out_file->cd();
53 oTree->Write();
54 out_file->Write();
55 delete out_file;
56
57 return 0;
58 }