show_potential.C
Go to the documentation of this file.
1 #include "TBox.h"
2 #include "TCanvas.h"
3 #include "TFile.h"
4 #include "TH2.h"
5 #include "TSystem.h"
6 
7 #include "func/Library.h"
8 #include "func/FindMatches.h"
9 using namespace lem;
10 
11 #include <iostream>
12 
13 void show_potential(TString libPath, int idx = 0, bool flipEven = false, bool flipOdd = false)
14 {
15  Library* lib = Library::FromMMap(libPath.Data(), false);
16 
17  TCanvas* c = new TCanvas("a", "b", 1200, 600);
18  c->Divide(2, 1);
19 
20  TH2* h[2] = {new TH2F("", ";plane;cell", 64, 0, 128, 128, 64, 192),
21  new TH2F("", ";plane;cell", 64, 0, 128, 128, 64, 192)};
22 
23  const MatchableEvent& sum = lib->Event(idx);
25  FillPotential(sum, Vs);
26 
27  for(int plane = 0; plane < 256; ++plane){
28  for(int cell = 0; cell < 256; ++cell){
29  const double p = Vs.V[flipEven][flipOdd].V[256*plane+cell];
30  h[plane%2]->Fill(plane, cell, p);
31  }
32  }
33 
34  for(int v = 0; v < 2; ++v){
35  c->cd(v+1);
36  h[v]->Draw("colz");
37  TBox* b = new TBox(lem::kVertexPlane, lem::kVertexCell,
39  b->SetLineColor(kRed);
40  b->SetFillStyle(0);
41  b->SetLineWidth(2);
42  b->SetLineStyle(7);
43  b->Draw();
44  }
45 }
enum BeamMode kRed
Attach some information used in matching to an EventSummary.
Collection of events for matching.
Collection of events for matching.
Definition: Library.h:18
const char * p
Definition: xmltok.h:285
const int kVertexPlane
Definition: EventSummary.h:22
Definition: __init__.py:1
PID
Definition: FillPIDs.h:14
Core of the LEM match-finding algorithm.
Potential V[2][2]
Definition: FindMatches.h:23
const int kVertexCell
Definition: EventSummary.h:23
void FillPotential(const EventSummary &trial, Potential &V, bool flipEven, bool flipOdd)
Definition: FindMatches.cxx:76
const MatchableEvent & Event(int i) const
Definition: Library.h:32
const hit & b
Definition: hits.cxx:21
Collection of Potential objects with odd and/or even view flipped.
Definition: FindMatches.h:21
static Library * FromMMap(const std::string &libPath, bool touchAll)
Definition: Library.cxx:62
Double_t sum
Definition: plot.C:31
void show_potential(TString libPath, int idx=0, bool flipEven=false, bool flipOdd=false)
float V[256 *256]
Definition: Potential.h:18