Functions | Variables
show_event.C File Reference
#include "TBox.h"
#include "TCanvas.h"
#include "TFile.h"
#include "TH2.h"
#include "TSystem.h"
#include "LEM/func/Library.h"
#include <iostream>

Go to the source code of this file.

Functions

void refresh ()
 
void show_event (TString libPath, int idx=0, bool flipEven=false, bool flipOdd=false, bool idxs=false)
 
void next ()
 
void n ()
 
void prev ()
 
void p ()
 
void go (int idx)
 

Variables

int gIdx = 0
 
bool gFlipEven = false
 
bool gFlipOdd = false
 
bool gIdxs = false
 
LibrarygLib = 0
 
TTree * gTree = 0
 
TCanvas * gCanv = 0
 

Function Documentation

void go ( int  idx)

Definition at line 103 of file show_event.C.

References gIdx, compare_h5_caf::idx, and refresh().

104 {
105  gIdx = idx;
106  refresh();
107 }
int gIdx
Definition: show_event.C:12
void refresh()
Definition: show_event.C:21
void n ( )

Definition at line 89 of file show_event.C.

References next().

89 {next();}
void next()
Definition: show_event.C:84
void next ( )

Definition at line 84 of file show_event.C.

References gIdx, and refresh().

Referenced by PandAna.core.filesource.listsource::__call__(), PandAna.core.filesource.globsource::__call__(), generic.models.PlotInfo.CanvasSummary._MethodWrapper::__call__(), PandAna.core.filesource.samprojectsource::__call__(), ana::AutoPlaceLegend(), caf_numu_sensitivity(), caf_numu_sensitivity_no_tau(), ana::CalculateFluxAndNoCorrelatedErrorBand(), DrawDataMC(), DrawPlots(), FindContours(), train_latest_snapshot::findLatest(), findNames(), FindUniverseContours(), FindUniverseSpectra(), FormatCanvas(), ana::GetCAFMetadata(), GetContour(), ana::CovMxSurface::GetContours(), GetDefaultAxis(), genie::flux::GDk2NuFlux::GetFileList(), genie::flux::GSimpleNtpFlux::GetFileList(), genie::flux::GNuMIFlux::GetFileList(), om::HistoFile::GetHistogramList(), TMVA::TMVAGlob::GetListOfJobs(), GetMatrices(), TMVA::TMVAGlob::GetNumberOfInputVariables(), TMVA::TMVAGlob::GetNumberOfTargets(), getPadAxisHist(), getPadHists(), getPadMax(), GetSystsFromFile(), hits(), isystrename(), ana::NumuSyst::LoadFrom(), ana::NCSyst::LoadFrom(), ana::NueSyst::LoadFrom(), ana::SystMakerShift::LoadFrom(), ana::SystematicsMaker::LoadFrom(), LoadISysts(), ana::CovMxManager::LoadSyst(), LoadSystsFromFile(), main(), trk::WindowTrackingAlg::Make3DTrack(), make_dataMC(), MakeISysts(), fhicl::detail::MaybeDisplayParent::MaybeDisplayParent(), n(), bp::ProcessImages(), lem::MakeLibrary::produce(), daq2raw::TestBeamRawInputDriver::readBeamline(), genie::geometry::ROOTGeomAnalyzer::SetTopVolName(), setup(), TestPred(), lem::dec::Forest::TrainSingleTransformed(), regression::validate(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

85 {
86  ++gIdx;
87  refresh();
88 }
int gIdx
Definition: show_event.C:12
void refresh()
Definition: show_event.C:21
void p ( )

Definition at line 101 of file show_event.C.

References prev().

101 {prev();}
void prev()
Definition: show_event.C:91
void prev ( )
void refresh ( )

Definition at line 21 of file show_event.C.

References b, om::cout, allTimeWatchdog::endl, lem::Library::Event(), lem::EventSummary::FillHists(), lem::EventSummary::FromTree(), gCanv, gFlipEven, gFlipOdd, gIdx, gIdxs, gTree, make_syst_table_plots::h, lem::kVertexCell, lem::kVertexPlane, sum, lem::EventSummary::trueVtxCell, lem::EventSummary::trueVtxCellOther, lem::EventSummary::trueVtxPlane, and registry_explorer::v.

Referenced by stan::test::performance::command(), go(), next(), prev(), show_event(), TEST(), and TEST_F().

22 {
23  std::cout << "Displaying event " << gIdx << std::endl;
24 
25  TH2* h[2] = {new TH2F("", ";plane;cell", 128, 0, 128, 128, 64, 192),
26  new TH2F("", ";plane;cell", 128, 0, 128, 128, 64, 192)};
27 
28  // even view first then odd view
29  const MatchableEvent& sum = gLib ? gLib->Event(gIdx) : MatchableEvent(EventSummary::FromTree(gTree, gIdx, false));
30  sum.FillHists(h[0], h[1], gFlipEven, gFlipOdd, gIdxs);
31 
32  // printf("Total PE: %2.2f\n", sum.totalPE);
33 
34  for(int v = 0; v < 2; ++v){
35  gCanv->cd(v+1);
36  h[v]->Draw("colz");
37 
38  TBox* b = new TBox(lem::kVertexPlane, lem::kVertexCell,
40  b->SetLineColor(kRed);
41  b->SetFillStyle(0);
42  b->SetLineWidth(2);
43  b->SetLineStyle(7);
44  b->Draw();
45 
46  const int trueCell = (sum.trueVtxPlane%2 == v) ? sum.trueVtxCellOther : sum.trueVtxCell;
47  TBox* b2 = new TBox(sum.trueVtxPlane, trueCell,
48  sum.trueVtxPlane+1, trueCell+1);
49  b2->SetLineColor(kGreen+2);
50  b2->SetFillStyle(0);
51  b2->SetLineWidth(2);
52  b2->SetLineStyle(7);
53  b2->Draw();
54  }
55 }
TTree * gTree
Definition: show_event.C:18
Attach some information used in matching to an EventSummary.
const int kVertexPlane
Definition: EventSummary.h:22
int gIdx
Definition: show_event.C:12
Library * gLib
Definition: show_event.C:17
bool gIdxs
Definition: show_event.C:15
const int kVertexCell
Definition: EventSummary.h:23
OStream cout
Definition: OStream.cxx:6
bool gFlipEven
Definition: show_event.C:13
TCanvas * gCanv
Definition: show_event.C:19
const MatchableEvent & Event(int i) const
Definition: Library.h:32
const hit & b
Definition: hits.cxx:21
bool gFlipOdd
Definition: show_event.C:14
Double_t sum
Definition: plot.C:31
void FillHists(TH2 *h1, TH2 *h2, bool flipEven=false, bool flipOdd=false, bool idxs=false) const
void show_event ( TString  libPath,
int  idx = 0,
bool  flipEven = false,
bool  flipOdd = false,
bool  idxs = false 
)

Definition at line 57 of file show_event.C.

References ana::assert(), om::cout, allTimeWatchdog::endl, MakeMiniprodValidationCuts::f, lem::Library::FromMMap(), gCanv, gFlipEven, gFlipOdd, gIdx, gIdxs, gTree, compare_h5_caf::idx, lem::EventSummary::InitFromTree(), and refresh().

58 {
59  gIdx = idx;
60  gFlipEven = flipEven;
61  gFlipOdd = flipOdd;
62  gIdxs = idxs;
63 
64  if(libPath.EndsWith(".root")){
65  TFile* f = new TFile(libPath);
66  gTree = (TTree*)f->Get("makelib/tree");
67  assert(gTree);
68  EventSummary::InitFromTree(gTree);
69  }
70  else{
71  gLib = Library::FromMMap(libPath.Data(), false);
72  }
73 
74  gCanv = new TCanvas("a", "LEM", 1200, 600);
75  gCanv->Divide(2, 1);
76 
77  std::cout << "next() or n() for the next event" << std::endl;
78  std::cout << "prev() or p() for the prev event" << std::endl;
79  std::cout << "go(idx) to jump to a specific event" << std::endl;
80 
81  refresh();
82 }
TTree * gTree
Definition: show_event.C:18
int gIdx
Definition: show_event.C:12
Library * gLib
Definition: show_event.C:17
bool gIdxs
Definition: show_event.C:15
OStream cout
Definition: OStream.cxx:6
bool gFlipEven
Definition: show_event.C:13
TCanvas * gCanv
Definition: show_event.C:19
assert(nhit_max >=nhit_nbins)
bool gFlipOdd
Definition: show_event.C:14
void refresh()
Definition: show_event.C:21

Variable Documentation

TCanvas* gCanv = 0

Definition at line 19 of file show_event.C.

Referenced by refresh(), and show_event().

bool gFlipEven = false

Definition at line 13 of file show_event.C.

Referenced by refresh(), and show_event().

bool gFlipOdd = false

Definition at line 14 of file show_event.C.

Referenced by refresh(), and show_event().

int gIdx = 0
bool gIdxs = false

Definition at line 15 of file show_event.C.

Referenced by refresh(), and show_event().

Library* gLib = 0

Definition at line 17 of file show_event.C.

TTree* gTree = 0

Definition at line 18 of file show_event.C.

Referenced by refresh(), and show_event().