1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- #include <iostream>
- #include <vector>
- #include <utility>
- #include "TFile.h"
- #include "TTree.h"
- #include "TCanvas.h"
- #include "filval/filval.hpp"
- #include "filval_root/filval_root.hpp"
- #include "MiniTreeDataSet.hpp"
- using namespace std;
- using namespace filval;
- using namespace filval::root;
- void print_pair(DerivedPair<double, double> dp){
- pair<double, double> p = dp.get_value();
- cout << "(" << p.first << ", " << p.second << ")\n";
- }
- void test1(){
- double x = 12;
- double y = 12;
- ObservedValue<double> x_val(&x);
- ObservedValue<double> y_val(&y);
- DerivedPair<double, double> dp(&x_val, &y_val);
- print_pair(dp);
- x = 2;
- y = 2;
- print_pair(dp);
- ContainerVector<double> cont(&x_val, "cont");
- x = 12;
- cont.fill();
- x = 2;
- cont.fill();
- auto *container = cont.get_container();
- for( auto v: *container )
- cout << v << ", ";
- cout << endl;
- }
- void test2(){
- double x = 12;
- ObservedValue<double> x_val(&x);
- ContainerTH1D hist("h1", "Hist", 20, 0, 20, &x_val);
- hist.fill();
- hist.fill();
- hist.fill();
- x = 11;
- hist.fill();
- hist.fill();
- hist.fill();
- hist.fill();
- hist.fill();
- hist.fill();
- TH1D* h = (TH1D*) hist.get_container();
- TCanvas can("c1");
- h->Draw();
- can.Draw();
- can.SaveAs("outfile.png");
- }
- void test3(){
- TFile *f = TFile::Open("./data/TTTT_ext_treeProducerSusyMultilepton_tree.root");
- TTree *tree = (TTree*) f->Get("tree");
- MiniTreeDataSet mtds(tree);
- mtds.process();
- TH1* hist = ((ContainerTH1I*)mtds.get_container("nLepGood"))->get_container();
- TCanvas can("c1");
- hist->Draw();
- can.Draw();
- can.SaveAs("outfile.png");
- can.Clear();
- TGraph* graph= ((ContainerTGraph*)mtds.get_container("nLepvsnJet"))->get_container();
- graph->Draw("A*");
- can.Draw();
- can.SaveAs("outfile3.png");
- delete tree;
- f->Close();
- delete f;
- }
- int main(int argc, const char* argv[]){
- test3();
- }
|