9 #include "TMarker3DBox.h" 10 #include "TPolyLine.h" 11 #include "TPolyLine3D.h" 30 #include "NovaDAQConventions/DAQConventions.h" 45 double*
xhi,
double*
yhi,
double* zhi)
75 if (xyz[2]-c->
HalfW()<*zlo) *zlo = xyz[2]-c->
HalfD();
76 if (xyz[2]+c->
HalfW()>*zhi) *zhi = xyz[2]+c->
HalfD();
101 this->
GetBox(&xlo, &ylo, &zlo, &xhi, &yhi, &zhi);
110 l.SetPoint(0, zlo, xlo);
111 l.SetPoint(1, zhi, xlo);
112 l.SetPoint(2, zhi, xhi);
113 l.SetPoint(3, zlo, xhi);
114 l.SetPoint(4, zlo, xlo);
115 l.SetBit(kCannotPick);
119 l.SetPoint(0, zlo, ylo);
120 l.SetPoint(1, zhi, ylo);
121 l.SetPoint(2, zhi, yhi);
122 l.SetPoint(3, zlo, yhi);
123 l.SetPoint(4, zlo, ylo);
124 l.SetBit(kCannotPick);
136 this->
GetBox(&xlo, &ylo, &zlo, &xhi, &yhi, &zhi);
139 bool isBonW = (colors->
Foreground(0) == kBlack) ? 1 : 0;
141 int c = isBonW ? 1 : 0;
146 top.SetPoint(0, xlo, yhi, zlo);
147 top.SetPoint(1, xhi, yhi, zlo);
148 top.SetPoint(2, xhi, yhi, zhi);
149 top.SetPoint(3, xlo, yhi, zhi);
150 top.SetPoint(4, xlo, yhi, zlo);
162 front.SetPoint(0, xlo, yhi, zlo);
163 front.SetPoint(1, xlo, ylo, zlo);
164 front.SetPoint(2, xhi, ylo, zlo);
165 front.SetPoint(3, xhi, yhi, zlo);
166 front.SetPoint(4, xlo, yhi, zlo);
169 wside.SetPoint(0, xhi, yhi, zlo);
170 wside.SetPoint(1, xhi, ylo, zlo);
171 wside.SetPoint(2, xhi, ylo, zhi);
172 wside.SetPoint(3, xhi, yhi, zhi);
173 wside.SetPoint(4, xhi, yhi, zlo);
306 TVector3
lo( bounds[0], bounds[1], bounds[2]);
307 TVector3
hi( bounds[3], bounds[4], bounds[5]);
311 l.SetPoint(0, lo.Z(), lo.X());
312 l.SetPoint(1, hi.Z(), lo.X());
313 l.SetPoint(2, hi.Z(), hi.X());
314 l.SetPoint(3, lo.Z(), hi.X());
315 l.SetPoint(4, lo.Z(), lo.X());
316 l.SetBit(kCannotPick);
320 l.SetPoint(0, lo.Z(), lo.Y());
321 l.SetPoint(1, hi.Z(), lo.Y());
322 l.SetPoint(2, hi.Z(), hi.Y());
323 l.SetPoint(3, lo.Z(), hi.Y());
324 l.SetPoint(4, lo.Z(), lo.Y());
325 l.SetBit(kCannotPick);
337 double zlo,
double zhi)
344 if (!draw_cells && !label_cells)
return;
352 plane = geo->
Plane(ip);
355 if (view==
geo::kX && xzview==0)
continue;
356 if (view==
geo::kY && yzview==0)
continue;
359 if (view==
geo::kX && xzview) { v2d = xzview; }
360 if (view==
geo::kY && yzview) { v2d = yzview; }
361 if (v2d==0)
continue;
363 for (ic=0; ic<plane->
Ncells(); ++ic ) {
364 cell = plane->
Cell(ic);
376 if (pos[2]<zlo || pos[2]>zhi)
continue;
377 if (view==
geo::kX && pos[0]<xlo)
continue;
378 if (view==
geo::kX && pos[0]>xhi)
continue;
379 if (view==
geo::kY && pos[1]<ylo)
continue;
380 if (view==
geo::kY && pos[1]>yhi)
continue;
385 double halfw = cell->
HalfW();
386 double halfd = cell->
HalfD();
387 double x0 = pos[2]-halfd;
388 double x1 = pos[2]+halfd;
389 double y0 = pos[
view]-halfw;
390 double y1 = pos[
view]+halfw;
396 static const int kBox=1;
397 static const int kXed=2;
410 TBox&
b = v2d->
AddBox(x0, y0, x1, y1);
412 b.SetLineColor(color);
415 b.SetBit(kCannotPick);
419 TLine& l2 = v2d->
AddLine(x0,y1,x1,y0);
421 l1.SetLineColor(color);
424 l1.SetBit(kCannotPick);
426 l2.SetLineColor(color);
429 l2.SetBit(kCannotPick);
433 if (label_cells && (ip%5)==0) {
463 plane = geom->
Plane(planeId);
466 cell = plane->
Cell(cellId);
482 const double dx = cell->
HalfD();
483 const double dy = cell->
HalfW();
484 const double x0 = pos[2]-
dx;
485 const double x1 = pos[2]+
dx;
486 const double y0 = pos[
view]-
dy;
489 TBox&
b = v2d->
AddBox(x0, y0, x1, y1);
491 b.SetLineColor(
kRed);
494 b.SetBit(kCannotPick);
507 std::map<int, Box>
ret;
514 double pos[3], dpos[3];
515 geo->
CellInfo(ip, ic, &v, pos, dpos);
523 unsigned int dcmid = dcm+dib*1000;
525 double xylo = pos[
v]-dpos[
v];
526 double zlo = pos[2]-dpos[2];
528 double xyhi = pos[
v]+dpos[
v];
529 double zhi = pos[2]+dpos[2];
534 if (ret.find(dcmid)==ret.end()) {
535 ret[dcmid].xylo = 9E9;
536 ret[dcmid].zlo = 9E9;
537 ret[dcmid].xyhi = -9E9;
538 ret[dcmid].zhi = -9E9;
543 if (xylo < ret[dcmid].xylo) ret[dcmid].xylo = xylo;
544 if (zlo < ret[dcmid].zlo) ret[dcmid].zlo = zlo;
545 if (xyhi > ret[dcmid].xyhi) ret[dcmid].xyhi = xyhi;
546 if (zhi > ret[dcmid].zhi) ret[dcmid].zhi = zhi;
570 static std::map<int, Box> xboxes, yboxes;
572 static bool ifirst =
true;
602 TBox&
b = v2d->
AddBox(ll[2],ll[
view],ur[2],ur[view]);
606 b.SetBit(kCannotPick);
637 sprintf(buff,
"%d-",ic);
638 TText&
t1 = view->
AddText(z-1.1*dz,t, buff);
643 t1.SetBit(kCannotPick);
648 TText&
t1 = view->
AddText(z-1.1*dz,t, buff);
653 t1.SetBit(kCannotPick);
657 sprintf(buff,
"..%d..",ip);
658 TText&
t2 = view->
AddText(z+1.6*dz,t, buff);
659 t2.SetTextAngle(-90);
688 l.SetBit(kCannotPick);
699 l.SetBit(kCannotPick);
719 static std::map<int, Box> xboxes, yboxes;
721 static std::map<int, double> zavg[2];
723 static bool once =
true;
734 std::map<int, int> zcount;
737 const int dib =
it.first/1000;
738 const Box& box =
it.second;
745 for(
auto it: zcount) zavg[
view][
it.first] /=
it.second;
755 const int dcmid =
it.first;
756 const int dib = dcmid/1000;
757 const int dcm = dcmid%1000;
758 const Box box =
it.second;
772 if(boxes.find(dib*1000+dcm-updir) == boxes.end() ||
777 l.SetLineColor(color);
779 l.SetBit(kCannotPick);
783 if(boxes.find(dib*1000+dcm+updir) == boxes.end() ||
788 l.SetLineColor(color);
790 l.SetBit(kCannotPick);
794 if(boxes.find((dib-1)*1000+dcm) == boxes.end() ||
799 l.SetLineColor(color);
801 l.SetBit(kCannotPick);
805 if(boxes.find((dib+1)*1000+dcm) == boxes.end() ||
810 l.SetLineColor(color);
812 l.SetBit(kCannotPick);
double GetBadBoxCorner(bool view, int coord, int i)
Get the corner of a bad box (hook for evend display)
TSpline3 lo("lo", xlo, ylo, 12,"0")
int fLabel
Which labels to draw?
::xsd::cxx::tree::bounds< char > bounds
void GetCenter(double *xyz, double localz=0.0) const
void DrawCells2D(const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview, double xlo=-99E9, double xhi=99E9, double ylo=-99E9, double yhi=99E9, double zlo=-99E9, double zhi=99E9)
Float_t y1[n_points_granero]
TPolyLine & AddPolyLine(int n, int c, int w, int s)
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
void DrawDCMBoxes(const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
Float_t x1[n_points_granero]
void DetOutline3D(const art::Event &evt, evdb::View3D *view)
TLine & AddLine(double x1, double y1, double x2, double y2)
const CellGeo * Cell(int icell) const
void DrawBadBoxesExact(const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
Draw the exact boxes LiveGeometry uses internally.
Vertical planes which measure X.
int NumBadBoxesX()
Size of the vector of bad boxes in the XZ view.
unsigned int Ncells() const
Number of cells in this plane.
const daqchannelmap::DAQChannelMap * Map() const
A collection of drawable 2-D objects.
const PlaneGeo * Plane(unsigned int i) const
static const int kOUTLINE_CELLS
std::map< int, Box > GetDCMBoxes(geo::View_t view) const
lchan encodeLChan(int detId, plane_t plane, cell_t cell) const
std::vector< float > fFiducialBounds
Horizontal planes which measure Y.
void CellInfo(unsigned int ip, unsigned int ic, View_t *view=0, double *pos=0, double *dpos=0) const
void ShowCellAndPlaneNumbers(evdb::View2D *view, int ip, int ic, double z, double dz, double t, double dt)
TPolyLine3D & AddPolyLine3D(int n, int c, int w, int s)
TBox & AddBox(double x1, double y1, double x2, double y2)
View_t View() const
Which coordinate does this plane measure.
TSpline3 hi("hi", xhi, yhi, 18,"0")
void DrawBadBoxesPretty(const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
Draw the minimal outline of the bad regions.
void GetBox(double *xlo, double *xhi, double *ylo, double *yhi, double *zlo, double *zhi)
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Geometry information for a single readout plane.
TText & AddText(double x, double y, const char *text)
void FiducialVolumeUser2D(const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
void DrawHighlightCell(const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
static const int kLABEL_PLANECELL
static const int kOUTLINE_FIDUCIAL_USER
Class to aid in the rendering of Geometry objects.
static const int kOUTLINE_BADBOX
void DetOutline2D(const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
static const int kOUTLINE_DETECTOR
int DCMStatus(unsigned int dib, unsigned int dcm)
returns: 0: RH says is bad; 1: good; 2: bad, either BC or DCM drop
dcm_id_t getDCM(dchan daqchan) const
Decode the dcm ID from a dchan.
dchan encodeDChan(int detID, diblock_t diblock, dcm_id_t dcm, feb_t feb, pixel_t pixel) const
A collection of 3D drawable objects.
unsigned int NPlanes() const
uint32_t dchan
< DAQ Channel Map Package
Encapsulate the cell geometry.
bool IsBad(int plane, int cell)
diblock_t getDiBlock(dchan daqchan) const
Decode the diblock ID from a dchan.
int NumBadBoxesY()
Size of the vector of bad boxes in the YZ view.
int fDimDisabled
Dim disabled channels? What colors?
Encapsulate the geometry of one entire detector (near, far, ndos)
static const int kOUTLINE_DCMS
int fOutline
Which outlines to draw.
Global drawing options that apply to all displays.