18 #include "TVirtualPad.h" 32 #include "nuevdb/EventDisplayBase/EventHolder.h" 33 #include "nuevdb/EventDisplayBase/View2D.h" 41 template <
typename Stream>
43 DumpPad(Stream&& log, TVirtualPad* pPad)
46 log <<
"pad not available";
50 log << pPad->IsA()->GetName() <<
"[" << ((
void*)pPad) <<
"](\"" << pPad->GetName() <<
"\")";
51 TFrame
const* pFrame = pPad->GetFrame();
53 double const low_wire = pFrame->GetX1(), high_wire = pFrame->GetX2();
54 double const low_tdc = pFrame->GetY1(), high_tdc = pFrame->GetY2();
55 double const wire_pixels = pPad->XtoAbsPixel(high_wire) - pPad->XtoAbsPixel(low_wire);
56 double const tdc_pixels = -(pPad->YtoAbsPixel(high_tdc) - pPad->YtoAbsPixel(low_tdc));
57 log <<
" has frame spanning wires " << low_wire <<
"-" << high_wire <<
" and TDC " << low_tdc
58 <<
"-" << high_tdc <<
" in a window " << wire_pixels <<
"x" << tdc_pixels <<
" pixel big";
61 log <<
" has no frame";
70 if (!
msg.empty()) log <<
msg <<
": ";
72 log <<
"pad not available";
78 TCanvas
const* pCanvas = pPad->GetCanvas();
79 log <<
"\nCanvas is: (TCanvas*) (" << ((
void*)pPad->GetCanvas()) <<
") with " 80 << pCanvas->GetListOfPrimitives()->GetSize() <<
" primitives and the following pads:";
81 TIterator* pIter = pCanvas->GetListOfPrimitives()->MakeIterator();
82 TObject
const* pObject;
83 while ((pObject = pIter->Next())) {
84 if (!pObject->InheritsFrom(TVirtualPad::Class()))
continue;
85 log <<
"\n " << ((pObject == pPad) ?
'*' :
'-') <<
" ";
86 DumpPad(log, (TVirtualPad*)pObject);
113 :
DrawingPad(nm, ti, x1, x2, y1, y2), fPlane(plane)
121 this->
Pad()->SetLeftMargin(0.070);
122 this->
Pad()->SetRightMargin(0.010);
127 unsigned int planes = geo->
Nplanes();
128 this->
Pad()->SetTopMargin(0.005);
129 this->
Pad()->SetBottomMargin(0.110);
133 if (planes == 2 &&
fPlane > 0) {
134 this->
Pad()->SetTopMargin(0.110);
135 this->
Pad()->SetBottomMargin(0.005);
137 else if (planes > 2) {
139 this->
Pad()->SetTopMargin(0.055);
140 this->
Pad()->SetBottomMargin(0.055);
143 this->
Pad()->SetTopMargin(0.110);
144 this->
Pad()->SetBottomMargin(0.005);
148 TString planeNo =
"fTWirePlane";
154 TString xtitle =
";Induction Wire;t (tdc)";
160 fXLo = -0.005 * (nWires - 1);
161 fXHi = 1.005 * (nWires - 1);
167 fYLo = -0.005 * (nWires - 1);
168 fYHi = 1.005 * (nWires - 1);
171 fXLo = -0.005 * nTicks;
172 fXHi = 1.010 * nTicks;
173 xtitle =
";t (tdc);InductionWire";
183 fHisto =
new TH1F(*(
fPad->DrawFrame(min, min, max, max)));
185 fHisto->SetTitleOffset(0.5,
"Y");
186 fHisto->SetTitleOffset(0.75,
"X");
188 fHisto->GetYaxis()->SetLabelSize(0.05);
189 fHisto->GetYaxis()->CenterTitle();
190 fHisto->GetXaxis()->SetLabelSize(0.05);
191 fHisto->GetXaxis()->CenterTitle();
194 fView =
new evdb::View2D();
218 int kSelectedColor = 4;
222 art::Event const* evtPtr = evdb::EventHolder::Instance()->GetEvent();
224 auto const&
evt = *evtPtr;
225 auto const clockData =
274 TString xtitle =
fHisto->GetXaxis()->GetTitle();
275 fHisto->GetXaxis()->SetTitle(
fHisto->GetYaxis()->GetTitle());
276 fHisto->GetYaxis()->SetTitle(xtitle);
287 if (opt == 0 && evtPtr) { this->
ShowFull(); }
329 if (test != 0)
return;
340 *i1 =
fHisto->GetXaxis()->GetFirst();
341 *i2 =
fHisto->GetXaxis()->GetLast();
344 *i1 =
fHisto->GetYaxis()->GetFirst();
345 *i2 =
fHisto->GetYaxis()->GetLast();
355 if (
fOri < 1) {
fHisto->GetXaxis()->SetRange(i1, i2); }
357 fHisto->GetYaxis()->SetRange(i1, i2);
369 MF_LOG_DEBUG(
"TWireProjPad") <<
"SetZoomRange(" << i1 <<
", " << i2 <<
", " << y1 <<
", " << y2
370 <<
") on plane #" <<
fPlane;
372 fHisto->GetXaxis()->SetRangeUser(i1, i2);
373 fHisto->GetYaxis()->SetRangeUser(y1, y2);
386 TAxis
const& xaxis = *(
fHisto->GetXaxis());
387 fCurrentZoom[0] = xaxis.GetBinLowEdge(xaxis.GetFirst());
405 const art::Event* evtPtr = evdb::EventHolder::Instance()->GetEvent();
407 auto const&
evt = *evtPtr;
411 this->
Draw(zoom_opt);
423 const art::Event*
evt = evdb::EventHolder::Instance()->GetEvent();
429 return KineticEnergy;
437 const art::Event*
evt = evdb::EventHolder::Instance()->GetEvent();
442 this->
Draw(zoom_opt);
464 fPad->GetFrame()->SetBit(TPad::kCannotMove,
true);
465 fPad->SetBit(TPad::kCannotMove,
true);
479 this->
Draw(zoom_opt);
486 mf::LogVerbatim(
"TWireProjPad") <<
"Drawing " << lines.size() <<
" lines";
488 for (
size_t is = 0; is < lines.size(); ++is) {
489 if (
fPlane != lines[is].plane)
continue;
491 TLine&
l =
fView->AddLine(lines[is].w0, lines[is].
t0, lines[is].w1, lines[is].
t1);
int GetRegionOfInterest(int plane, int &minw, int &maxw, int &mint, int &maxt)
code to link reconstructed objects back to the MC truth information
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
void SaveHits(const art::Event &evt, unsigned int plane, double x, double y, double x1, double y1, double distance, bool good_plane=true)
void msg(const char *fmt,...)
Drawing pad showing a single X-Z or Y-Z projection of an event.
int fDrawRawDataOrCalibWires
0 for raw
unsigned int fPlane
Which plane in the detector.
double SaveSeedList(std::vector< util::PxLine > seedlines, double distance)
void Draw(const char *opt=0)
void ShowFull(int override=0)
double fXLo
Low value of x axis.
void RawDigit2D(art::Event const &evt, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane, bool bZoomToRoI=false)
Draws raw digit content in 2D wire plane representation.
static void FromPDG(TLine &line, int pdgcode)
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
void Prong2D(const art::Event &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
unsigned int Nwires(unsigned int p, unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wires in the specified plane.
art framework interface to geometry description
void Slice2D(const art::Event &evt, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
void Cluster2D(const art::Event &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
void DrawTrackVertexAssns2D(const art::Event &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
std::vector< double > const & GetCurrentZoom() const
void SaveHitList(double i1, double i2, double y1, double y2, double distance, const char *zoom_opt, bool good_plane=true)
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
void ClearHitList(unsigned int plane)
void Seed2D(const art::Event &evt, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
void SelectOneHit(double x, double y, const char *zoom_opt)
RawDataDrawer * RawDataDraw()
int fOri
Orientation of the axes - see RawDrawingOptions for values.
Class to perform operations needed to select hits and pass them to a cluster.
double fXHi
High value of x axis.
DrawOptions_t const & GetDrawOptions() const
Return the current draw options.
Base class for event display drawing pads.
RecoBaseDrawer * RecoBaseDraw()
int Hit2D(const art::Event &evt, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
geo::TPCID CurrentTPC() const
Returns the current TPC as a TPCID.
double TotalClockTicks() const
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
double fYLo
Low value of y axis.
static int max(int a, int b)
SimulationDrawer * SimulationDraw()
TH1F * fHisto
Histogram to draw object on.
void DrawLinesinView(std::vector< util::PxLine > lines, bool deleting=false, const char *zoom_opt=0)
void SetWireRange(int i1, int i2)
void ChangeHit(const art::Event &evt, unsigned int plane, double x, double y)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
void SetZoomRange(int i1, int i2, int y1, int y2)
void EndPoint2D(const art::Event &evt, evdb::View2D *view, unsigned int plane)
void Wire2D(const art::Event &evt, evdb::View2D *view, unsigned int plane)
HitSelector * HitSelectorGet()
int fAxisOrientation
0 = TDC values on y-axis, wire number on x-axis, 1 = swapped
static const char * zoom_opt
void OpFlash2D(const art::Event &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
double SaveSeedLines(const art::Event &evt, std::vector< util::PxLine > seedline, double distance)
int GetRegionOfInterest(int plane, int &minw, int &maxw, int &mint, int &maxt)
void MCTruthVectors2D(const art::Event &evt, evdb::View2D *view, unsigned int plane)
void Event2D(const art::Event &evt, evdb::View2D *view, unsigned int plane)
constexpr double kBogusD
obviously bogus double value
TPad * fPad
The ROOT graphics pad.
void SetZoomFromView()
Sets the zoom parameters from the current histogram view.
void Vertex2D(const art::Event &evt, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
void GetWireRange(int *i1, int *i2) const
std::vector< double > fCurrentZoom
LArSoft geometry interface.
double fYHi
High value of y axis.
evdb::View2D * fView
Collection of graphics objects to render.
Signal from collection planes.
TWireProjPad(const char *nm, const char *ti, double x1, double y1, double x2, double y2, unsigned int plane)
void ExtractRange(TVirtualPad *pPad, std::vector< double > const *zoom=nullptr)
Fills the viewport information from the specified pad.