18 #include "TVirtualPad.h" 41 template <
typename Stream>
42 void DumpPad(Stream&& log, TVirtualPad* pPad)
45 log <<
"pad not available";
49 log << pPad->IsA()->GetName() <<
"[" << ((
void*)pPad) <<
"](\"" << pPad->GetName() <<
"\")";
50 TFrame
const* pFrame = pPad->GetFrame();
52 double const low_wire = pFrame->GetX1(), high_wire = pFrame->GetX2();
53 double const low_tdc = pFrame->GetY1(), high_tdc = pFrame->GetY2();
54 double const wire_pixels = pPad->XtoAbsPixel(high_wire) - pPad->XtoAbsPixel(low_wire);
55 double const tdc_pixels = -(pPad->YtoAbsPixel(high_tdc) - pPad->YtoAbsPixel(low_tdc));
56 log <<
" has frame spanning wires " << low_wire <<
"-" << high_wire <<
" and TDC " << low_tdc
57 <<
"-" << high_tdc <<
" in a window " << wire_pixels <<
"x" << tdc_pixels <<
" pixel big";
60 log <<
" has no frame";
65 [[maybe_unused]]
void DumpPadsInCanvas(TVirtualPad* pPad,
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);
163 fYHi = 1.005 * std::min((
unsigned int)(this->
RawDataDraw()->StartTick() + nTicks), nTicks);
167 fYLo = -0.005 * (nWires - 1);
168 fYHi = 1.005 * (nWires - 1);
170 fYHi = 1.005 * std::min((
unsigned int)(this->
RawDataDraw()->StartTick() + nTicks), nTicks);
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();
217 int kSelectedColor = 4;
223 auto const&
evt = *evtPtr;
224 auto const clockData =
273 TString xtitle =
fHisto->GetXaxis()->GetTitle();
274 fHisto->GetXaxis()->SetTitle(
fHisto->GetYaxis()->GetTitle());
275 fHisto->GetYaxis()->SetTitle(xtitle);
286 if (opt == 0 && evtPtr) { this->
ShowFull(); }
326 if (test != 0)
return;
336 *i1 =
fHisto->GetXaxis()->GetFirst();
337 *i2 =
fHisto->GetXaxis()->GetLast();
340 *i1 =
fHisto->GetYaxis()->GetFirst();
341 *i2 =
fHisto->GetYaxis()->GetLast();
350 if (
fOri < 1) {
fHisto->GetXaxis()->SetRange(i1, i2); }
352 fHisto->GetYaxis()->SetRange(i1, i2);
363 MF_LOG_DEBUG(
"TWireProjPad") <<
"SetZoomRange(" << i1 <<
", " << i2 <<
", " << y1 <<
", " << y2
364 <<
") on plane #" <<
fPlane;
366 fHisto->GetXaxis()->SetRangeUser(i1, i2);
367 fHisto->GetYaxis()->SetRangeUser(y1, y2);
380 fCurrentZoom[0] = xaxis.GetBinLowEdge(xaxis.GetFirst());
399 auto const&
evt = *evtPtr;
403 this->
Draw(zoom_opt);
420 return KineticEnergy;
432 this->
Draw(zoom_opt);
452 fPad->GetFrame()->SetBit(TPad::kCannotMove,
true);
453 fPad->SetBit(TPad::kCannotMove,
true);
466 this->
Draw(zoom_opt);
473 mf::LogVerbatim(
"TWireProjPad") <<
"Drawing " << lines.size() <<
" lines";
475 for (
size_t is = 0; is < lines.size(); ++is) {
476 if (
fPlane != lines[is].plane)
continue;
478 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
const art::Event * GetEvent() const
void SaveHits(const art::Event &evt, unsigned int plane, double x, double y, double x1, double y1, double distance, bool good_plane=true)
Float_t y1[n_points_granero]
Drawing pad showing a single X-Z or Y-Z projection of an event.
int fDrawRawDataOrCalibWires
0 for raw
Float_t x1[n_points_granero]
TLine & AddLine(double x1, double y1, double x2, double y2)
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.
A collection of drawable 2-D objects.
static void FromPDG(TLine &line, int pdgcode)
void Prong2D(const art::Event &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
Singleton to hold the current art::Event for the event display.
Float_t y2[n_points_geant4]
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)
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.
static EventHolder * Instance()
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 fYLo
Low value of y axis.
SimulationDrawer * SimulationDraw()
Class to aid in the rendering of RecoBase objects.
TH1F * fHisto
Histogram to draw object on.
Class to aid in the rendering of RawData objects.
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)
SigType_t SignalType(PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
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)
Render the objects from the Simulation package.
HitSelector * HitSelectorGet()
unsigned int Nwires(PlaneID const &planeid) const
Returns the total number of wires in the specified plane.
int fAxisOrientation
0 = TDC values on y-axis, wire number on x-axis, 1 = swapped
static const char * zoom_opt
unsigned int Nplanes(TPCID const &tpcid=tpc_zero) const
Returns the total number of planes in the specified TPC.
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
Float_t x2[n_points_geant4]
std::vector< double > fCurrentZoom
Namespace collecting geometry-related classes utilities.
double fYHi
High value of y axis.
art framework interface to geometry description
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.