16 #include "TPolyLine.h" 18 #include "TVirtualPad.h" 44 template <
typename Stream>
45 void DumpPad(Stream&& log, TVirtualPad* pPad) {
47 log <<
"pad not available";
51 log << pPad->IsA()->GetName() <<
"[" << ((
void*) pPad) <<
"](\"" << pPad->GetName() <<
"\")";
52 TFrame
const* pFrame = pPad->GetFrame();
54 double const low_wire = pFrame->GetX1(), high_wire = pFrame->GetX2();
55 double const low_tdc = pFrame->GetY1(), high_tdc = pFrame->GetY2();
56 double const wire_pixels = pPad->XtoAbsPixel(high_wire) - pPad->XtoAbsPixel(low_wire);
57 double const tdc_pixels = -(pPad->YtoAbsPixel(high_tdc) - pPad->YtoAbsPixel(low_tdc));
58 log <<
" has frame spanning wires " 59 << low_wire <<
"-" << high_wire <<
" and TDC " << low_tdc <<
"-" << high_tdc
60 <<
" in a window " << wire_pixels <<
"x" << tdc_pixels <<
" pixel big";
63 log <<
" has no frame";
69 [[gnu::unused]]
void DumpPadsInCanvas
70 (TVirtualPad* pPad, std::string caller, std::string msg =
"")
73 if (!msg.empty()) log << msg <<
": ";
75 log <<
"pad not available";
81 TCanvas
const* pCanvas = pPad->GetCanvas();
82 log <<
"\nCanvas is: (TCanvas*) (" << ((
void*)pPad->GetCanvas())
83 <<
") with " << pCanvas->GetListOfPrimitives()->GetSize() <<
" primitives and the following pads:";
84 TIterator* pIter = pCanvas->GetListOfPrimitives()->MakeIterator();
85 TObject
const* pObject;
86 while ((pObject = pIter->Next())) {
87 if (!pObject->InheritsFrom(TVirtualPad::Class()))
continue;
88 log <<
"\n " << ((pObject == pPad)?
'*':
'-') <<
" ";
89 DumpPad(log, (TVirtualPad*) pObject);
111 double x1,
double x2,
112 double y1,
double y2,
126 this->
Pad()->SetLeftMargin (0.070);
127 this->
Pad()->SetRightMargin (0.010);
132 unsigned int planes = geo->
Nplanes();
133 this->
Pad()->SetTopMargin (0.005);
134 this->
Pad()->SetBottomMargin(0.110);
138 if(planes == 2 &&
fPlane > 0){
139 this->
Pad()->SetTopMargin (0.110);
140 this->
Pad()->SetBottomMargin(0.005);
144 this->
Pad()->SetTopMargin (0.055);
145 this->
Pad()->SetBottomMargin(0.055);
148 this->
Pad()->SetTopMargin (0.110);
149 this->
Pad()->SetBottomMargin(0.005);
153 TString planeNo =
"fTWirePlane";
159 TString xtitle =
";Induction Wire;t (tdc)";
165 fXLo = -0.005 * (nWires - 1);
166 fXHi = 1.005 * (nWires - 1);
172 fYLo = -0.005 * (nWires - 1);
173 fYHi = 1.005 * (nWires - 1);
176 fXLo = -0.005 * nTicks;
177 fXHi = 1.010 * nTicks;
178 xtitle =
";t (tdc);InductionWire";
188 fHisto =
new TH1F(*(
fPad->DrawFrame(min, min, max, max)));
190 fHisto->SetTitleOffset(0.5,
"Y");
191 fHisto->SetTitleOffset(0.75,
"X");
193 fHisto->GetYaxis()->SetLabelSize(0.05);
194 fHisto->GetYaxis()->CenterTitle();
195 fHisto->GetXaxis()->SetLabelSize(0.05);
196 fHisto->GetXaxis()->CenterTitle();
216 int kSelectedColor = 4;
272 TString xtitle =
fHisto->GetXaxis()->GetTitle();
273 fHisto->GetXaxis()->SetTitle(
fHisto->GetYaxis()->GetTitle());
274 fHisto->GetYaxis()->SetTitle(xtitle);
294 LOG_DEBUG(
"TWireProjPad") <<
"Drawing of plane " <<
fPlane <<
" completed";
364 if(test != 0)
return;
376 *i1 =
fHisto->GetXaxis()->GetFirst();
377 *i2 =
fHisto->GetXaxis()->GetLast();
380 *i1 =
fHisto->GetYaxis()->GetFirst();
381 *i2 =
fHisto->GetYaxis()->GetLast();
393 fHisto->GetXaxis()->SetRange(i1,i2);
396 fHisto->GetYaxis()->SetRange(i1,i2);
410 <<
"SetZoomRange(" << i1 <<
", " << i2 <<
", " << y1 <<
", " << y2
411 <<
") on plane #" <<
fPlane;
413 fHisto->GetXaxis()->SetRangeUser(i1,i2);
414 fHisto->GetYaxis()->SetRangeUser(y1,y2);
425 fCurrentZoom[0] = xaxis.GetBinLowEdge(xaxis.GetFirst());
429 LOG_DEBUG(
"TWireProjPad") <<
"Zoom set to wires (" 448 this->
Draw(zoom_opt);
468 return KineticEnergy;
482 this->
Draw(zoom_opt);
503 fPad->GetFrame()->SetBit(TPad::kCannotMove,
true);
504 fPad->SetBit(TPad::kCannotMove,
true);
521 this->
Draw(zoom_opt);
528 mf::LogVerbatim(
"TWireProjPad") <<
"Drawing " << lines.size() <<
" lines";
530 for(
size_t is = 0; is < lines.size(); ++is){
531 if(
fPlane!=lines[is].plane)
534 TLine& l =
fView->
AddLine(lines[is].w0,lines[is].
t0,lines[is].w1,lines[is].
t1);
541 if( ( (lines.size()%3)==0 ) ||
542 ( is < ( lines.size()-(lines.size()%3) ) )) {
543 l.SetLineColor(kGreen);
546 l.SetLineColor(kRed);
557 lg1.SetLineStyle(kDashed);
558 lg0.SetLineStyle(kDashed);
561 lg0.SetLineColor(kGray);
562 lg1.SetLineColor(kGray);
563 lg0.SetBit(kCannotPick);
564 lg1.SetBit(kCannotPick);
566 if((lines.size()%3)==1){
605 mf::LogVerbatim(
"TWireProjPad") <<
"running updateseedcurve for plane " << plane;
622 if(SeedVec.size() > 1){
628 for(
int i = 0; i != N; ++i){
638 double x = projpt[plane];
639 double y = ticks[plane];
642 if(LastGoodValue!=i){
644 mrk.SetMarkerColor(3);
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
double t1
defined to be the ending t-position (of line or seed depending)
yes & test(std::ostream &)
Float_t y1[n_points_granero]
TPolyLine & AddPolyLine(int n, int c, int w, int s)
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.
A collection of drawable 2-D objects.
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.
Singleton to hold the current art::Event for the event display.
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.
Float_t y2[n_points_geant4]
virtual double ConvertXToTicks(double X, int p, int t, int c) const =0
int fMakeSeeds
Draw two lines to make clusters if clicked.
std::vector< double > const & GetCurrentZoom() const
void SaveHits(const art::Event &evt, evdb::View2D *view, unsigned int plane, double x, double y, double x1, double y1, double distance, bool good_plane=true)
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 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, evdb::View2D *view, unsigned int plane)
geo::TPCID CurrentTPC() const
Returns the current TPC as a TPCID.
double TotalClockTicks() const
void GetProjectedPointUVWT(double s, double *uvw, double *ticks, int c, int t) 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)
virtual double ConvertTicksToX(double ticks, int p, int t, int c) const =0
double SaveSeedLines(const art::Event &evt, evdb::View2D *view, std::vector< util::PxLine > seedline, double distance)
Encapsulate the construction of a single detector plane.
void SetZoomRange(int i1, int i2, int y1, int y2)
Render the objects from the Simulation package.
HitSelector * HitSelectorGet()
int fAxisOrientation
0 = TDC values on y-axis, wire number on x-axis, 1 = swapped
static const char * zoom_opt
int GetRegionOfInterest(int plane, int &minw, int &maxw, int &mint, int &maxt)
void MCTruthVectors2D(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 GetWireRange(int *i1, int *i2) const
Float_t x2[n_points_geant4]
double UpdateSeedCurve(std::vector< recob::Seed > SeedVec, int plane)
std::vector< double > fCurrentZoom
Namespace collecting geometry-related classes utilities.
TMarker & AddMarker(double x, double y, int c, int st, double sz)
double fYHi
High value of y axis.
double t0
defined to be the vertex t-position
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception
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 ChangeHit(const art::Event &evt, evdb::View2D *view, unsigned int plane, double x, double y)