18 #include "TVirtualPad.h"
32 #include "nuevdb/EventDisplayBase/EventHolder.h"
33 #include "nuevdb/EventDisplayBase/View2D.h"
35 #include "art/Framework/Principal/fwd.h"
36 #include "art/Framework/Services/Registry/ServiceHandle.h"
37 #include "messagefacility/MessageLogger/MessageLogger.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";
67 DumpPadsInCanvas(TVirtualPad* pPad, std::string caller, std::string
msg =
"")
69 mf::LogDebug log(caller);
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)
117 art::ServiceHandle<geo::Geometry const> geo;
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";
152 art::ServiceHandle<evd::RawDrawingOptions const> rawopt;
153 auto const signalType = geo->SignalType({rawopt->CurrentTPC(),
fPlane});
154 TString xtitle =
";Induction Wire;t (tdc)";
157 unsigned int const nWires = geo->Nwires(
fPlane);
160 fXLo = -0.005 * (nWires - 1);
161 fXHi = 1.005 * (nWires - 1);
165 fOri = rawopt->fAxisOrientation;
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();
215 MF_LOG_DEBUG(
"TWireProjPad") <<
"Started to draw plane " <<
fPlane;
218 int kSelectedColor = 4;
222 art::Event
const* evtPtr = evdb::EventHolder::Instance()->GetEvent();
224 auto const&
evt = *evtPtr;
225 auto const clockData =
226 art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(
evt);
228 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(
evt, clockData);
229 art::ServiceHandle<evd::RecoDrawingOptions const> recoOpt;
242 if (recoOpt->fUseHitSelector)
262 art::ServiceHandle<evd::RawDrawingOptions const> rawopt;
263 if (
fOri != rawopt->fAxisOrientation) {
264 fOri = rawopt->fAxisOrientation;
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(); }
289 MF_LOG_DEBUG(
"TWireProjPad") <<
"Started rendering plane " <<
fPlane;
293 MF_LOG_DEBUG(
"TWireProjPad") <<
"Drawing of plane " <<
fPlane <<
" completed";
300 art::ServiceHandle<evd::RecoDrawingOptions const> recoOpt;
301 if (recoOpt->fUseHitSelector) {
319 art::ServiceHandle<evd::EvdLayoutOptions const> evdlayoutopt;
320 art::ServiceHandle<evd::RawDrawingOptions const> rawopt;
324 if (rawopt->fDrawRawDataOrCalibWires == 0)
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());
391 MF_LOG_DEBUG(
"TWireProjPad") <<
"Zoom set to wires (" <<
fCurrentZoom[0] <<
"; "
405 const art::Event* evtPtr = evdb::EventHolder::Instance()->GetEvent();
407 auto const&
evt = *evtPtr;
408 art::ServiceHandle<evd::RecoDrawingOptions const> recoopt;
409 if (recoopt->fUseHitSelector) {
411 this->
Draw(zoom_opt);
423 const art::Event*
evt = evdb::EventHolder::Instance()->GetEvent();
425 art::ServiceHandle<evd::RecoDrawingOptions const> recoopt;
426 if (recoopt->fUseHitSelector)
429 return KineticEnergy;
437 const art::Event*
evt = evdb::EventHolder::Instance()->GetEvent();
439 art::ServiceHandle<evd::RecoDrawingOptions const> recoopt;
440 if (recoopt->fUseHitSelector) {
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)
double SaveSeedLines(const art::Event &evt, std::vector< util::PxLine > seedline, double distance)
process_name opflash particleana ie x
Drawing pad showing a single X-Z or Y-Z projection of an event.
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)
void SaveHits(const art::Event &evt, unsigned int plane, double x, double y, double x1, double y1, double distance, bool good_plane=true)
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)
void Prong2D(const art::Event &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
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)
process_name pandoraGausCryo1 vertexChargeCryo1 vertexStubCryo1 xmin
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 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)
process_name opflash particleana ie ie y
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
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)
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)
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()
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)
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 ClearHitList(unsigned int plane)
BEGIN_PROLOG hitmakerfive clustermakerfour pfparticlemakerthree showermakertwo END_PROLOG hitmakerfive clustermakerfour pfparticlemakerthree sequence::inline_paths sequence::inline_paths sequence::inline_paths showermakers test
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
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.