TTTT Analysis  0.1
example2.cpp
1 #include <iostream>
2 #include <vector>
3 #include <utility>
4 
5 #include "TFile.h"
6 #include "TTree.h"
7 #include "TCanvas.h"
8 
9 #include "filval/filval.hpp"
10 
11 #include "MiniTreeDataSet.hpp"
12 
13 void test2(){
14  double x = 12;
15  ObservedValue<double> x_val("x", &x);
16  ContainerTH1D hist("h1", "Hist", &x_val, 20, 0, 20);
17  hist.fill();
18  hist.fill();
19  hist.fill();
20  x = 11;
21  hist.fill();
22  hist.fill();
23  hist.fill();
24  hist.fill();
25  hist.fill();
26  hist.fill();
27 
28  TH1D* h = (TH1D*) hist.get_container();
29  TCanvas can("c1");
30  h->Draw();
31  can.Draw();
32  can.SaveAs("outfile.png");
33 }
34 
35 void test3(){
36  TFile *f = TFile::Open("./data/TTTT_ext_treeProducerSusyMultilepton_tree.root");
37  TTree *tree = (TTree*) f->Get("tree");
38  MiniTreeDataSet mtds(tree);
39  mtds.process();
40  TCanvas can("c1");
41  can.Clear();
42  TH1* hist = ((ContainerTH1I*)mtds.get_container("nLepGood"))->get_container();
43  hist->Draw();
44  can.Draw();
45  can.SaveAs("outfile.png");
46 
47  can.Clear();
48  hist = ((ContainerTH1I*)mtds.get_container("nLepGood2"))->get_container();
49  hist->Draw();
50  can.Draw();
51  can.SaveAs("outfile2.png");
52 
53  can.Clear();
54  hist = ((ContainerTH1I*)mtds.get_container("nLepGood3"))->get_container();
55  hist->Draw();
56  can.Draw();
57  can.SaveAs("outfile3.png");
58 
59  can.Clear();
60  hist = ((ContainerTH1I*)mtds.get_container("avg_lepton_energy"))->get_container();
61  hist->Draw();
62  can.Draw();
63  can.SaveAs("lepton_energy.png");
64 
65  can.Clear();
66  TGraph* graph= ((ContainerTGraph*)mtds.get_container("nLepvsnJet"))->get_container();
67  graph->Draw("A*");
68  can.Draw();
69  can.SaveAs("outfileGraph.png");
70 
71  delete tree;
72  f->Close();
73  delete f;
74 }
A value supplied by the dataset, not derived.
Definition: value.hpp:450