example3.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #include <iostream>
  2. #include <vector>
  3. #include <utility>
  4. #include "TFile.h"
  5. #include "TTree.h"
  6. #include "TCanvas.h"
  7. #include "filval/filval.hpp"
  8. #include "MiniTreeDataSet.hpp"
  9. void test3(){
  10. TFile *f = TFile::Open("./data/TTTT_ext_treeProducerSusyMultilepton_tree.root");
  11. TTree *tree = (TTree*) f->Get("tree");
  12. MiniTreeDataSet mtds(tree);
  13. mtds.process();
  14. TCanvas can("c1");
  15. can.Clear();
  16. TH1* hist = ((ContainerTH1I*)mtds.get_container("nLepGood"))->get_container();
  17. hist->Draw();
  18. can.Draw();
  19. can.SaveAs("outfile.png");
  20. can.Clear();
  21. hist = ((ContainerTH1I*)mtds.get_container("nLepGood2"))->get_container();
  22. hist->Draw();
  23. can.Draw();
  24. can.SaveAs("outfile2.png");
  25. can.Clear();
  26. hist = ((ContainerTH1I*)mtds.get_container("nLepGood3"))->get_container();
  27. hist->Draw();
  28. can.Draw();
  29. can.SaveAs("outfile3.png");
  30. can.Clear();
  31. hist = ((ContainerTH1I*)mtds.get_container("avg_lepton_energy"))->get_container();
  32. hist->Draw();
  33. can.Draw();
  34. can.SaveAs("lepton_energy.png");
  35. can.Clear();
  36. TGraph* graph= ((ContainerTGraph*)mtds.get_container("nLepvsnJet"))->get_container();
  37. graph->Draw("A*");
  38. can.Draw();
  39. can.SaveAs("outfileGraph.png");
  40. delete tree;
  41. f->Close();
  42. delete f;
  43. }