ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/LJMet/MultivariateAnalysis/standalone/main.cc
(Generate patch)

Comparing UserCode/LJMet/MultivariateAnalysis/standalone/main.cc (file contents):
Revision 1.1 by kukartse, Wed Jul 15 12:13:45 2009 UTC vs.
Revision 1.2 by kukartse, Tue Mar 9 13:37:30 2010 UTC

# Line 3 | Line 3
3   //#include <sstream>
4   //using namespace std;
5  
6
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   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines