Classes | Public Member Functions | Protected Member Functions | List of all members
evd::GeometryDrawer Class Reference

Aid in the rendering of Geometry objects. More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-10-28/EventDisplay/GeometryDrawer.h"

Classes

struct  Box
 

Public Member Functions

 GeometryDrawer ()
 
 ~GeometryDrawer ()
 
void GetBox (double *xlo, double *xhi, double *ylo, double *yhi, double *zlo, double *zhi)
 
void DetOutline2D (const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
 
void DetOutline3D (const art::Event &evt, evdb::View3D *view)
 
void FiducialVolumeUser2D (const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
 
void DrawDCMBoxes (const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
 
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)
 
void DrawHighlightCell (const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
 
void ShowCellAndPlaneNumbers (evdb::View2D *view, int ip, int ic, double z, double dz, double t, double dt)
 
void DrawBadBoxesExact (const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
 Draw the exact boxes LiveGeometry uses internally. More...
 
void DrawBadBoxesPretty (const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
 Draw the minimal outline of the bad regions. More...
 

Protected Member Functions

std::map< int, BoxGetDCMBoxes (geo::View_t view) const
 

Detailed Description

Aid in the rendering of Geometry objects.

Definition at line 21 of file GeometryDrawer.h.

Constructor & Destructor Documentation

GeometryDrawer::GeometryDrawer ( )

Definition at line 36 of file GeometryDrawer.cxx.

36 { }
GeometryDrawer::~GeometryDrawer ( )

Definition at line 40 of file GeometryDrawer.cxx.

40 { }

Member Function Documentation

void GeometryDrawer::DetOutline2D ( const art::Event evt,
evdb::View2D xzview,
evdb::View2D yzview 
)

Definition at line 90 of file GeometryDrawer.cxx.

References evdb::View2D::AddPolyLine(), plot_validation_datamc::c, evd::GeometryDrawingOptions::fOutline, GetBox(), evd::GeometryDrawingOptions::kOUTLINE_DETECTOR, submit_hadd::l, w, xhi, make_syst_table_plots::xlo, evd::GeoTransform::XYZ(), yhi, and ylo.

93 {
95  if ( (drawopt->fOutline &
97  return;
98  }
99 
100  double xlo, ylo, zlo, xhi, yhi, zhi;
101  this->GetBox(&xlo, &ylo, &zlo, &xhi, &yhi, &zhi);
102  GeoTransform::XYZ(&xlo, &ylo, &zlo);
103  GeoTransform::XYZ(&xhi, &yhi, &zhi);
104 
105  int c = 16;
106  int s = 1;
107  int w = 1;
108  if (xzview) {
109  TPolyLine& l = xzview->AddPolyLine(5, c, w, s);
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);
116  }
117  if (yzview) {
118  TPolyLine& l = yzview->AddPolyLine(5, c, w, s);
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);
125  }
126 }
TPolyLine & AddPolyLine(int n, int c, int w, int s)
Definition: View2D.cxx:210
const XML_Char * s
Definition: expat.h:262
void GetBox(double *xlo, double *xhi, double *ylo, double *yhi, double *zlo, double *zhi)
Float_t w
Definition: plot.C:20
static void XYZ(double *xyz)
int fOutline
Which outlines to draw.
void GeometryDrawer::DetOutline3D ( const art::Event evt,
evdb::View3D view 
)

Definition at line 130 of file GeometryDrawer.cxx.

References evdb::View3D::AddPolyLine3D(), plot_validation_datamc::c, colors, evdb::Colors::Foreground(), GetBox(), top, w, xhi, make_syst_table_plots::xlo, yhi, and ylo.

132 {
134 
135  double xlo, ylo, zlo, xhi, yhi, zhi;
136  this->GetBox(&xlo, &ylo, &zlo, &xhi, &yhi, &zhi);
137 
139  bool isBonW = (colors->Foreground(0) == kBlack) ? 1 : 0;
140 
141  int c = isBonW ? 1 : 0;
142  int s = 1;
143  int w = 1;
144 
145  TPolyLine3D& top = view->AddPolyLine3D(5, c, w, s);
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);
151 
152  /*
153  TPolyLine3D& bottom = view->AddPolyLine3D(5, 10, w, s);
154  bottom.SetPoint(0, xlo, ylo, zlo);
155  bottom.SetPoint(1, xhi, ylo, zlo);
156  bottom.SetPoint(2, xhi, ylo, zhi);
157  bottom.SetPoint(3, xlo, ylo, zhi);
158  bottom.SetPoint(4, xlo, ylo, zlo);
159  */
160 
161  TPolyLine3D& front = view->AddPolyLine3D(3, c, w, s);
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);
167 
168  TPolyLine3D& wside = view->AddPolyLine3D(5, c, w, s);
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);
174 
175  /*
176  TPolyLine3D& eside = view->AddPolyLine3D(5, 10, w, s);
177  eside.SetPoint(0, xlo, yhi, zlo);
178  eside.SetPoint(1, xlo, ylo, zlo);
179  eside.SetPoint(2, xlo, ylo, zhi);
180  eside.SetPoint(3, xlo, yhi, zhi);
181  eside.SetPoint(4, xlo, yhi, zlo);
182  */
183 
184  /*
185  c = 15;
186  s = 1;
187  w = 1;
188  double z = zlo;
189  // Grid running along x and y at constant z
190  for (;;) {
191  TPolyLine3D& gridt = view->AddPolyLine3D(2, c, s, w);
192  gridt.SetPoint(0, xlo, ylo, z);
193  gridt.SetPoint(1, xhi, ylo, z);
194 
195  TPolyLine3D& grids = view->AddPolyLine3D(2, c, s, w);
196  grids.SetPoint(0, xhi, ylo, z);
197  grids.SetPoint(1, xhi, yhi, z);
198 
199  z += 100.0;
200  if (z>zhi) break;
201  }
202 
203  // Grid running along z at constant x
204  double x = 0.0;
205  for (;;) {
206  TPolyLine3D& gridt = view->AddPolyLine3D(2, c, s, w);
207  gridt.SetPoint(0, x, ylo, zlo);
208  gridt.SetPoint(1, x, ylo, zhi);
209  x += 100.0;
210  if (x>xhi) break;
211  }
212  x = -100.0;
213  for (;;) {
214  TPolyLine3D& gridt = view->AddPolyLine3D(2, c, s, w);
215  gridt.SetPoint(0, x, ylo, zlo);
216  gridt.SetPoint(1, x, ylo, zhi);
217  x -= 100.0;
218  if (x<xlo) break;
219  }
220 
221  // Grid running along z at constant y
222  double y = 0.0;
223  for (;;) {
224  TPolyLine3D& grids = view->AddPolyLine3D(2, c, s, w);
225  grids.SetPoint(0, xhi, y, zlo);
226  grids.SetPoint(1, xhi, y, zhi);
227  y += 100.0;
228  if (y>yhi) break;
229  }
230  y = -100.0;
231  for (;;) {
232  TPolyLine3D& grids = view->AddPolyLine3D(2, c, s, w);
233  grids.SetPoint(0, xhi, y, zlo);
234  grids.SetPoint(1, xhi, y, zhi);
235  y -= 100.0;
236  if (y<ylo) break;
237  }
238  */
239 
240  /*
241  // Indicate north and an arrow
242  double x0 = 1.5*xhi; // Center location of the key
243  double z0 = (4.0*zlo+zhi)/5.0; // Center location of the key
244  double sz = 0.02*zhi; // Scale size of the key in z direction
245  double sx = 0.75*sz; // Scale size of the key in z direction
246 
247  TPolyLine3D& arrow1 = view->AddPolyLine3D(2, c, s, w);
248  TPolyLine3D& arrow2 = view->AddPolyLine3D(3, c, s, w);
249  arrow1.SetPoint(0, x0, ylo, z0-0.5*sz);
250  arrow1.SetPoint(1, x0, ylo, z0+0.5*sz);
251 
252  arrow2.SetPoint(0, x0-0.5*sx, ylo, z0+0.5*sz-0.5*sx);
253  arrow2.SetPoint(1, x0, ylo, z0+0.5*sz);
254  arrow2.SetPoint(2, x0+0.5*sx, ylo, z0+0.5*sz-0.5*sx);
255 
256  TPolyLine3D& north = view->AddPolyLine3D(4, c, s, w);
257  north.SetPoint(0, x0+0.5*sx, ylo, z0+0.5*sz);
258  north.SetPoint(1, x0+0.5*sx, ylo, z0+1.5*sz);
259  north.SetPoint(2, x0-0.5*sx, ylo, z0+0.5*sz);
260  north.SetPoint(3, x0-0.5*sx, ylo, z0+1.5*sz);
261 
262  TPolyLine3D& south = view->AddPolyLine3D(6, c, s, w);
263  south.SetPoint(0, x0-0.5*sx, ylo, z0-0.75*sz);
264  south.SetPoint(1, x0, ylo, z0-0.50*sz);
265  south.SetPoint(2, x0+0.5*sx, ylo, z0-0.75*sz);
266  south.SetPoint(3, x0-0.5*sx, ylo, z0-1.25*sz);
267  south.SetPoint(4, x0, ylo, z0-1.50*sz);
268  south.SetPoint(5, x0+0.5*sx, ylo, z0-1.25*sz);
269 
270  TPolyLine3D& west = view->AddPolyLine3D(5, c, s, w);
271  x0 += sz;
272  west.SetPoint(0, x0+0.5*sx, ylo, z0+0.5*sz);
273  west.SetPoint(1, x0+0.5*sx, ylo, z0-0.5*sz);
274  west.SetPoint(2, x0, ylo, z0);
275  west.SetPoint(3, x0-0.5*sx, ylo, z0-0.5*sz);
276  west.SetPoint(4, x0-0.5*sx, ylo, z0+0.5*sz);
277 
278  TPolyLine3D& east = view->AddPolyLine3D(7, c, s, w);
279  x0 -= 2.0*sz;
280  east.SetPoint(0, x0-0.5*sx, ylo, z0+0.5*sz);
281  east.SetPoint(1, x0+0.5*sx, ylo, z0+0.5*sz);
282  east.SetPoint(2, x0+0.5*sx, ylo, z0);
283  east.SetPoint(3, x0, ylo, z0);
284  east.SetPoint(4, x0+0.5*sx, ylo, z0);
285  east.SetPoint(5, x0+0.5*sx, ylo, z0-0.5*sz);
286  east.SetPoint(6, x0-0.5*sx, ylo, z0-0.5*sz);
287  */
288 }
TPolyLine3D & AddPolyLine3D(int n, int c, int w, int s)
Definition: View3D.cxx:105
const XML_Char * s
Definition: expat.h:262
int colors[6]
Definition: tools.h:1
void GetBox(double *xlo, double *xhi, double *ylo, double *yhi, double *zlo, double *zhi)
int Foreground(int i=0)
Helper for AttenCurve.
Definition: Path.h:10
Float_t w
Definition: plot.C:20
TGeoVolume * top
Definition: make_fe_box.C:9
void GeometryDrawer::DrawBadBoxesExact ( const art::Event evt,
evdb::View2D xzview,
evdb::View2D yzview 
)

Draw the exact boxes LiveGeometry uses internally.

Definition at line 668 of file GeometryDrawer.cxx.

References evdb::View2D::AddPolyLine(), evd::GeometryDrawingOptions::fOutline, geo::LiveGeometry::GetBadBoxCorner(), MECModelEnuComparisons::i, evd::GeometryDrawingOptions::kOUTLINE_BADBOX, submit_hadd::l, geo::LiveGeometry::NumBadBoxesX(), and geo::LiveGeometry::NumBadBoxesY().

671 {
673  if ( (drawopt->fOutline &
675  return;
676  }
677 
679 
680  if(xzview){
681  for(int i=0; i < livegeom->NumBadBoxesX(); i++) {
682  TPolyLine& l = xzview->AddPolyLine(5, kRed, 2, 0);
683  l.SetPoint(0, livegeom->GetBadBoxCorner(false,3,i), livegeom->GetBadBoxCorner(false,1,i));
684  l.SetPoint(1, livegeom->GetBadBoxCorner(false,4,i), livegeom->GetBadBoxCorner(false,1,i));
685  l.SetPoint(2, livegeom->GetBadBoxCorner(false,4,i), livegeom->GetBadBoxCorner(false,2,i));
686  l.SetPoint(3, livegeom->GetBadBoxCorner(false,3,i), livegeom->GetBadBoxCorner(false,2,i));
687  l.SetPoint(4, livegeom->GetBadBoxCorner(false,3,i), livegeom->GetBadBoxCorner(false,1,i));
688  l.SetBit(kCannotPick);
689  }
690  }
691  if(yzview){
692  for(int i=0; i < livegeom->NumBadBoxesY(); i++) {
693  TPolyLine& l = yzview->AddPolyLine(5, kRed, 2, 0);
694  l.SetPoint(0, livegeom->GetBadBoxCorner(true,3,i), livegeom->GetBadBoxCorner(true,1,i));
695  l.SetPoint(1, livegeom->GetBadBoxCorner(true,4,i), livegeom->GetBadBoxCorner(true,1,i));
696  l.SetPoint(2, livegeom->GetBadBoxCorner(true,4,i), livegeom->GetBadBoxCorner(true,2,i));
697  l.SetPoint(3, livegeom->GetBadBoxCorner(true,3,i), livegeom->GetBadBoxCorner(true,2,i));
698  l.SetPoint(4, livegeom->GetBadBoxCorner(true,3,i), livegeom->GetBadBoxCorner(true,1,i));
699  l.SetBit(kCannotPick);
700  }
701  }
702 }
double GetBadBoxCorner(bool view, int coord, int i)
Get the corner of a bad box (hook for evend display)
TPolyLine & AddPolyLine(int n, int c, int w, int s)
Definition: View2D.cxx:210
int NumBadBoxesX()
Size of the vector of bad boxes in the XZ view.
int NumBadBoxesY()
Size of the vector of bad boxes in the YZ view.
int fOutline
Which outlines to draw.
void GeometryDrawer::DrawBadBoxesPretty ( const art::Event evt,
evdb::View2D xzview,
evdb::View2D yzview 
)

Draw the minimal outline of the bad regions.

Definition at line 706 of file GeometryDrawer.cxx.

References evdb::View2D::AddLine(), make_syst_table_plots::boxes, plot_validation_datamc_2018::color, febshutoff_auto::dcm, geo::LiveGeometry::DCMStatus(), evd::GeometryDrawingOptions::fOutline, geom(), GetDCMBoxes(), it, evd::GeometryDrawingOptions::kOUTLINE_BADBOX, geo::kX, geo::kY, submit_hadd::l, fabricate::status, POTSpillRate::view, evd::GeometryDrawer::Box::xyhi, evd::GeometryDrawer::Box::xylo, evd::GeometryDrawer::Box::zhi, and evd::GeometryDrawer::Box::zlo.

709 {
711  if ( (drawopt->fOutline &
713  return;
714  }
715 
718 
719  static std::map<int, Box> xboxes, yboxes;
720 
721  static std::map<int, double> zavg[2]; // [view][dib] -> lower Z
722 
723  static bool once = true;
724  if(once){
725  once = false;
726 
727  xboxes = GetDCMBoxes(geo::kX);
728  yboxes = GetDCMBoxes(geo::kY);
729 
730  // Lines drawn to literal box edges don't join up due to intervening plane
731  // in the other view and also tilt of planes. Calculate an average z for
732  // each diblock boundary and use that instead.
733  for(geo::View_t view: {geo::kX, geo::kY}){
734  std::map<int, int> zcount;
735  const std::map<int, Box>& boxes = (view == geo::kX) ? xboxes : yboxes;
736  for(auto it: boxes){
737  const int dib = it.first/1000;
738  const Box& box = it.second;
739  zavg[view][dib] += box.zlo;
740  zavg[view][dib+1] += box.zhi;
741  ++zcount[dib];
742  ++zcount[dib+1];
743  }
744  // Divide by the counts to get the average
745  for(auto it: zcount) zavg[view][it.first] /= it.second;
746  } // end for view
747  } // end if once
748 
749  for(geo::View_t view: {geo::kX, geo::kY}){
750  evdb::View2D* v2d = (view == geo::kX) ? xzview : yzview;
751  if(!v2d) continue;
752 
753  const std::map<int, Box>& boxes = (view == geo::kX) ? xboxes : yboxes;
754  for(auto it: boxes){
755  const int dcmid = it.first;
756  const int dib = dcmid/1000;
757  const int dcm = dcmid%1000;
758  const Box box = it.second;
759 
760  for(int status: {0, 2}){
761  if(livegeom->DCMStatus(dib, dcm) != status) continue;
762  const int color = (status == 0) ? kViolet : kRed;
763 
764  // What delta in DCM number is "up" on the screen?
765  const int updir = (view == geo::kX) ? +1 : -1;
766 
767  // For each DCM of the correct state, if the neighbouring DCM is a
768  // different state, or is off the edge of the detector, then draw a
769  // line there. Together these form the outline of the region.
770 
771  // Lower edge
772  if(boxes.find(dib*1000+dcm-updir) == boxes.end() ||
773  livegeom->DCMStatus(dib, dcm-updir) != status){
774 
775  TLine& l = v2d->AddLine(zavg[view][dib], box.xylo,
776  zavg[view][dib+1], box.xylo);
777  l.SetLineColor(color);
778  l.SetLineWidth(1);
779  l.SetBit(kCannotPick);
780  }
781 
782  // Upper edge
783  if(boxes.find(dib*1000+dcm+updir) == boxes.end() ||
784  livegeom->DCMStatus(dib, dcm+updir) != status){
785 
786  TLine& l = v2d->AddLine(zavg[view][dib], box.xyhi,
787  zavg[view][dib+1], box.xyhi);
788  l.SetLineColor(color);
789  l.SetLineWidth(1);
790  l.SetBit(kCannotPick);
791  }
792 
793  // Upstream
794  if(boxes.find((dib-1)*1000+dcm) == boxes.end() ||
795  livegeom->DCMStatus(dib-1, dcm) != status){
796 
797  TLine& l = v2d->AddLine(zavg[view][dib], box.xylo,
798  zavg[view][dib], box.xyhi);
799  l.SetLineColor(color);
800  l.SetLineWidth(1);
801  l.SetBit(kCannotPick);
802  }
803 
804  // Downstream
805  if(boxes.find((dib+1)*1000+dcm) == boxes.end() ||
806  livegeom->DCMStatus(dib+1, dcm) != status){
807 
808  TLine& l = v2d->AddLine(zavg[view][dib+1], box.xylo,
809  zavg[view][dib+1], box.xyhi);
810  l.SetLineColor(color);
811  l.SetLineWidth(1);
812  l.SetBit(kCannotPick);
813  }
814  } // end for status
815  } // end for it (boxes)
816  } // end for view
817 }
int status
Definition: fabricate.py:1613
set< int >::iterator it
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
TLine & AddLine(double x1, double y1, double x2, double y2)
Definition: View2D.cxx:187
Vertical planes which measure X.
Definition: PlaneGeo.h:28
std::map< int, Box > GetDCMBoxes(geo::View_t view) const
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
void geom(int which=0)
Definition: geom.C:163
int DCMStatus(unsigned int dib, unsigned int dcm)
returns: 0: RH says is bad; 1: good; 2: bad, either BC or DCM drop
int fOutline
Which outlines to draw.
void GeometryDrawer::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 
)

Definition at line 332 of file GeometryDrawer.cxx.

References evdb::View2D::AddBox(), evdb::View2D::AddLine(), b, getBrightness::cell, geo::PlaneGeo::Cell(), plot_validation_datamc_2018::color, geo::GeometryBase::DetId(), evd::GeometryDrawingOptions::fDimDisabled, evd::GeometryDrawingOptions::fDisabledColor, evd::GeometryDrawingOptions::fEnabledColor, evd::GeometryDrawingOptions::fLabel, evd::GeometryDrawingOptions::fOutline, geo::CellGeo::GetCenter(), geo::CellGeo::HalfD(), geo::CellGeo::HalfW(), ip, chaninfo::BadChanList::IsBad(), evd::GeometryDrawingOptions::kLABEL_PLANECELL, evd::GeometryDrawingOptions::kOUTLINE_CELLS, novadaq::cnv::kTESTBEAM, geo::kX, geo::kY, central_limit::l1, geo::PlaneGeo::Ncells(), geo::GeometryBase::NPlanes(), geo::GeometryBase::Plane(), NDAPDHVSetting::plane, elec2geo::pos, ShowCellAndPlaneNumbers(), POTSpillRate::view, geo::PlaneGeo::View(), x1, evd::GeoTransform::XYZ(), and y1.

338 {
340  bool draw_cells =
342  bool label_cells =
344  if (!draw_cells && !label_cells) return;
345 
347 
348  unsigned int ip, ic;
349  const geo::PlaneGeo* plane;
350  const geo::CellGeo* cell;
351  for (ip=0; ip<geo->NPlanes(); ++ip) {
352  plane = geo->Plane(ip);
353 
354  geo::View_t view = plane->View();
355  if (view==geo::kX && xzview==0) continue;
356  if (view==geo::kY && yzview==0) continue;
357 
358  evdb::View2D* v2d = 0;
359  if (view==geo::kX && xzview) { v2d = xzview; }
360  if (view==geo::kY && yzview) { v2d = yzview; }
361  if (v2d==0) continue;
362 
363  for (ic=0; ic<plane->Ncells(); ++ic ) {
364  cell = plane->Cell(ic);
365 
366  //
367  // Cell location and size
368  //
369  double pos[3];
370  cell->GetCenter(pos);
371  GeoTransform::XYZ(pos);
372 
373  //
374  // Skip channels that are out of view range
375  //
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;
381 
382  //
383  // Corner locations
384  //
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;
391 
392  if (draw_cells) {
393  //
394  // Change style for bad channels
395  //
396  static const int kBox=1;
397  static const int kXed=2;
398  int style = kBox;
399  int color = drawopt->fEnabledColor;
400 
401  // We don't have bad channels for TB (yet?)
402  if (geo->DetId() != novadaq::cnv::kTESTBEAM) {
404  if (drawopt->fDimDisabled && bcl->IsBad(ip, ic) ) {
405  style = kXed;
406  color = drawopt->fDisabledColor;
407  }
408  }
409  if (style==kBox) {
410  TBox& b = v2d->AddBox(x0, y0, x1, y1);
411  b.SetFillStyle(0);
412  b.SetLineColor(color);
413  b.SetLineStyle(1);
414  b.SetLineWidth(1);
415  b.SetBit(kCannotPick);
416  }
417  if (style==kXed) {
418  TLine& l1 = v2d->AddLine(x0,y0,x1,y1);
419  TLine& l2 = v2d->AddLine(x0,y1,x1,y0);
420 
421  l1.SetLineColor(color);
422  l1.SetLineStyle(1);
423  l1.SetLineWidth(1);
424  l1.SetBit(kCannotPick);
425 
426  l2.SetLineColor(color);
427  l2.SetLineStyle(1);
428  l2.SetLineWidth(1);
429  l2.SetBit(kCannotPick);
430  }
431  } // if (draw_cells) ...
432 
433  if (label_cells && (ip%5)==0) {
434  this->ShowCellAndPlaneNumbers(v2d,
435  ip,
436  ic,
437  0.5*(x1+x0),
438  0.5*(x1-x0),
439  0.5*(y1+y0),
440  0.5*(y1-y0));
441  }
442  } // loop on cells
443  } // loop on planes
444 }
int fLabel
Which labels to draw?
double HalfD() const
Definition: CellGeo.cxx:205
void GetCenter(double *xyz, double localz=0.0) const
Definition: CellGeo.cxx:159
Float_t y1[n_points_granero]
Definition: compare.C:5
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Float_t x1[n_points_granero]
Definition: compare.C:5
TLine & AddLine(double x1, double y1, double x2, double y2)
Definition: View2D.cxx:187
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
Vertical planes which measure X.
Definition: PlaneGeo.h:28
unsigned int Ncells() const
Number of cells in this plane.
Definition: PlaneGeo.h:43
double HalfW() const
Definition: CellGeo.cxx:191
TString ip
Definition: loadincs.C:5
const PlaneGeo * Plane(unsigned int i) const
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
void ShowCellAndPlaneNumbers(evdb::View2D *view, int ip, int ic, double z, double dz, double t, double dt)
TBox & AddBox(double x1, double y1, double x2, double y2)
Definition: View2D.cxx:263
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:53
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
Geometry information for a single readout plane.
Definition: PlaneGeo.h:36
const hit & b
Definition: hits.cxx:21
unsigned int NPlanes() const
Encapsulate the cell geometry.
Definition: CellGeo.h:25
bool IsBad(int plane, int cell)
Helper for AttenCurve.
Definition: Path.h:10
int fDimDisabled
Dim disabled channels? What colors?
static void XYZ(double *xyz)
int fOutline
Which outlines to draw.
void GeometryDrawer::DrawDCMBoxes ( const art::Event evt,
evdb::View2D xzview,
evdb::View2D yzview 
)

Definition at line 555 of file GeometryDrawer.cxx.

References evdb::View2D::AddBox(), b, evd::GeometryDrawingOptions::fOutline, GetDCMBoxes(), it, evd::GeometryDrawingOptions::kOUTLINE_DCMS, geo::kX, geo::kY, POTSpillRate::view, evd::GeometryDrawer::Box::xyhi, evd::GeometryDrawer::Box::xylo, evd::GeoTransform::XYZ(), evd::GeometryDrawer::Box::zhi, and evd::GeometryDrawer::Box::zlo.

558 {
560  if ( (drawopt->fOutline &
562  return;
563  }
564 
566 
567  //
568  // These maps will hold the geographic extent of each DCM
569  //
570  static std::map<int, Box> xboxes, yboxes;
571 
572  static bool ifirst = true;
573 
574  //
575  // First time through, discover the extent of each DCM
576  //
577  if (ifirst) {
578  xboxes = GetDCMBoxes(geo::kX);
579  yboxes = GetDCMBoxes(geo::kY);
580 
581  ifirst = false;
582  }
583 
584  for(geo::View_t view: {geo::kX, geo::kY}){
585  evdb::View2D* v2d = (view == geo::kX) ? xzview : yzview;
586  if(!v2d) continue;
587 
588  for(auto it: (view == geo::kX) ? xboxes : yboxes){
589  Box box = it.second;
590 
591  double ll[3]; // Box position, lower left
592  double ur[3]; // Box position, upper right
593 
594  ll[view] = box.xylo;
595  ur[view] = box.xyhi;
596  ll[2] = box.zlo;
597  ur[2] = box.zhi;
598 
599  GeoTransform::XYZ(ll);
600  GeoTransform::XYZ(ur);
601 
602  TBox& b = v2d->AddBox(ll[2],ll[view],ur[2],ur[view]);
603 
604  b.SetFillStyle(0);
605  b.SetLineColor(kGreen-8);
606  b.SetBit(kCannotPick);
607  }
608  }
609 }
set< int >::iterator it
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Vertical planes which measure X.
Definition: PlaneGeo.h:28
std::map< int, Box > GetDCMBoxes(geo::View_t view) const
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
TBox & AddBox(double x1, double y1, double x2, double y2)
Definition: View2D.cxx:263
const hit & b
Definition: hits.cxx:21
Helper for AttenCurve.
Definition: Path.h:10
static void XYZ(double *xyz)
int fOutline
Which outlines to draw.
void GeometryDrawer::DrawHighlightCell ( const art::Event evt,
evdb::View2D xzview,
evdb::View2D yzview 
)

Definition at line 450 of file GeometryDrawer.cxx.

References evdb::View2D::AddBox(), b, getBrightness::cell, geo::PlaneGeo::Cell(), dx, dy, evd::GeometryDrawingOptions::fHighlightCell, evd::GeometryDrawingOptions::fHighlightPlane, geom(), geo::CellGeo::GetCenter(), GetDCMBoxes(), geo::CellGeo::HalfD(), geo::CellGeo::HalfW(), geo::kX, geo::GeometryBase::Plane(), NDAPDHVSetting::plane, elec2geo::pos, POTSpillRate::view, geo::PlaneGeo::View(), x1, evd::GeoTransform::XYZ(), and y1.

453 {
455  const int planeId = drawopt->fHighlightPlane;
456  const int cellId = drawopt->fHighlightCell;
457 
459 
460  const geo::PlaneGeo* plane;
461  const geo::CellGeo* cell;
462  try{
463  plane = geom->Plane(planeId);
464  if(!plane) return;
465 
466  cell = plane->Cell(cellId);
467  if(!cell) return;
468  }
469  catch(...){
470  return;
471  }
472 
473  const geo::View_t view = plane->View();
474  evdb::View2D* v2d = view == geo::kX ? xzview : yzview;
475  if(!v2d) return;
476 
477  // Cell location and size
478  double pos[3];
479  cell->GetCenter(pos);
480  GeoTransform::XYZ(pos);
481 
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;
487  const double y1 = pos[view]+dy;
488 
489  TBox& b = v2d->AddBox(x0, y0, x1, y1);
490  b.SetFillStyle(0);
491  b.SetLineColor(kRed);
492  b.SetLineStyle(1);
493  b.SetLineWidth(1);
494  b.SetBit(kCannotPick);
495 }
double HalfD() const
Definition: CellGeo.cxx:205
void GetCenter(double *xyz, double localz=0.0) const
Definition: CellGeo.cxx:159
Float_t y1[n_points_granero]
Definition: compare.C:5
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Float_t x1[n_points_granero]
Definition: compare.C:5
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
Vertical planes which measure X.
Definition: PlaneGeo.h:28
double HalfW() const
Definition: CellGeo.cxx:191
const PlaneGeo * Plane(unsigned int i) const
TBox & AddBox(double x1, double y1, double x2, double y2)
Definition: View2D.cxx:263
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:53
double dy[NP][NC]
double dx[NP][NC]
Geometry information for a single readout plane.
Definition: PlaneGeo.h:36
void geom(int which=0)
Definition: geom.C:163
const hit & b
Definition: hits.cxx:21
Encapsulate the cell geometry.
Definition: CellGeo.h:25
static void XYZ(double *xyz)
void GeometryDrawer::FiducialVolumeUser2D ( const art::Event evt,
evdb::View2D xzview,
evdb::View2D yzview 
)

Definition at line 293 of file GeometryDrawer.cxx.

References evdb::View2D::AddPolyLine(), evd::GeometryDrawingOptions::fFiducialBounds, evd::GeometryDrawingOptions::fOutline, geom(), hi(), evd::GeometryDrawingOptions::kOUTLINE_FIDUCIAL_USER, submit_hadd::l, and lo().

296 {
298  if ( (drawopt->fOutline &
300  (drawopt->fFiducialBounds).size() !=6 ) {
301  return;
302  }
303 
305  std::vector< float > bounds = drawopt->fFiducialBounds;
306  TVector3 lo( bounds[0], bounds[1], bounds[2]);
307  TVector3 hi( bounds[3], bounds[4], bounds[5]);
308 
309  if(xzview){
310  TPolyLine& l = xzview->AddPolyLine(5, kBlue-9, 2, 0);
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);
317  }
318  if(yzview){
319  TPolyLine& l = yzview->AddPolyLine(5, kBlue-9, 2, 0);
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);
326  }
327 }
TSpline3 lo("lo", xlo, ylo, 12,"0")
::xsd::cxx::tree::bounds< char > bounds
Definition: Database.h:226
TPolyLine & AddPolyLine(int n, int c, int w, int s)
Definition: View2D.cxx:210
std::vector< float > fFiducialBounds
TSpline3 hi("hi", xhi, yhi, 18,"0")
void geom(int which=0)
Definition: geom.C:163
int fOutline
Which outlines to draw.
void GeometryDrawer::GetBox ( double *  xlo,
double *  xhi,
double *  ylo,
double *  yhi,
double *  zlo,
double *  zhi 
)

Definition at line 44 of file GeometryDrawer.cxx.

References plot_validation_datamc::c, geo::PlaneGeo::Cell(), geo::CellGeo::GetCenter(), geo::CellGeo::HalfD(), geo::CellGeo::HalfW(), MECModelEnuComparisons::i, calib::j, geo::kX, geo::kY, geo::PlaneGeo::Ncells(), geo::GeometryBase::NPlanes(), geo::GeometryBase::Plane(), geo::PlaneGeo::View(), xhi, make_syst_table_plots::xlo, yhi, and ylo.

Referenced by DetOutline2D(), and DetOutline3D().

46 {
48 
49  //
50  // Explore the cell locations to find the smallest box that contains
51  // them all in the x-z and y-z views
52  //
53  unsigned int i, j;
54  *xlo = 1e9;
55  *ylo = 1e9;
56  *zlo = 1e9;
57  *xhi = -1e9;
58  *yhi = -1e9;
59  *zhi = -1e9;
60  for (i=0; i<geo->NPlanes(); ++i) {
61  const geo::PlaneGeo* p = geo->Plane(i);
62  for (j=0; j<p->Ncells(); ++j) {
63  const geo::CellGeo* c = p->Cell(j);
64  if (c==0) continue;
65  double xyz[3];
66  c->GetCenter(xyz);
67  if (p->View()==geo::kX) {
68  if (xyz[0]-c->HalfW()<*xlo) *xlo = xyz[0]-c->HalfW();
69  if (xyz[0]+c->HalfW()>*xhi) *xhi = xyz[0]+c->HalfW();
70  }
71  else if (p->View()==geo::kY) {
72  if (xyz[1]-c->HalfW()<*ylo) *ylo = xyz[1]-c->HalfW();
73  if (xyz[1]+c->HalfW()>*yhi) *yhi = xyz[1]+c->HalfW();
74  }
75  if (xyz[2]-c->HalfW()<*zlo) *zlo = xyz[2]-c->HalfD();
76  if (xyz[2]+c->HalfW()>*zhi) *zhi = xyz[2]+c->HalfD();
77  }
78  }
79  double wallt = 0.3; // PVC wall thickness in cm
80  *xlo -= wallt;
81  *ylo -= wallt;
82  *zlo -= wallt;
83  *xhi += wallt;
84  *yhi += wallt;
85  *zhi += wallt;
86 }
double HalfD() const
Definition: CellGeo.cxx:205
void GetCenter(double *xyz, double localz=0.0) const
Definition: CellGeo.cxx:159
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
const char * p
Definition: xmltok.h:285
Vertical planes which measure X.
Definition: PlaneGeo.h:28
unsigned int Ncells() const
Number of cells in this plane.
Definition: PlaneGeo.h:43
double HalfW() const
Definition: CellGeo.cxx:191
const PlaneGeo * Plane(unsigned int i) const
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:53
Geometry information for a single readout plane.
Definition: PlaneGeo.h:36
const double j
Definition: BetheBloch.cxx:29
unsigned int NPlanes() const
Encapsulate the cell geometry.
Definition: CellGeo.h:25
Helper for AttenCurve.
Definition: Path.h:10
std::map< int, GeometryDrawer::Box > GeometryDrawer::GetDCMBoxes ( geo::View_t  view) const
protected

Definition at line 499 of file GeometryDrawer.cxx.

References geo::GeometryBase::CellInfo(), visualisationForPaperMasterPlot::cmap, febshutoff_auto::dcm, geo::GeometryBase::DetId(), daqchannelmap::DAQChannelMap::encodeDChan(), daqchannelmap::DAQChannelMap::encodeLChan(), daqchannelmap::DAQChannelMap::getDCM(), daqchannelmap::DAQChannelMap::getDiBlock(), ip, g4zmq::lc(), cmap::dataprov::CMap::Map(), geo::PlaneGeo::Ncells(), geo::GeometryBase::NPlanes(), geo::GeometryBase::Plane(), elec2geo::pos, runNovaSAM::ret, registry_explorer::v, POTSpillRate::view, and geo::PlaneGeo::View().

Referenced by DrawBadBoxesPretty(), DrawDCMBoxes(), and DrawHighlightCell().

500 {
503 
504  //
505  // This map will hold the geographic extent of each DCM
506  //
507  std::map<int, Box> ret;
508 
509  unsigned int ip, ic;
510  for (ip=0; ip<geo->NPlanes(); ++ip) {
511  if(geo->Plane(ip)->View() != view) continue;
512  for (ic=0; ic<geo->Plane(ip)->Ncells(); ++ic) {
513  geo::View_t v;
514  double pos[3], dpos[3];
515  geo->CellInfo(ip, ic, &v, pos, dpos);
516 
517  const daqchannelmap::lchan lc = cmap->Map()->encodeLChan(geo->DetId(),ip,ic);
518  const daqchannelmap::dchan dc = cmap->Map()->encodeDChan(lc);
519  const uint32_t dib = cmap->Map()->getDiBlock(dc);
520  const uint32_t dcm = cmap->Map()->getDCM(dc);
521 
522  // Create a unique identifier for this DCM
523  unsigned int dcmid = dcm+dib*1000;
524 
525  double xylo = pos[v]-dpos[v];
526  double zlo = pos[2]-dpos[2];
527 
528  double xyhi = pos[v]+dpos[v];
529  double zhi = pos[2]+dpos[2];
530 
531  //
532  // If we've never seen this DCM before, initialize its values
533  //
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;
539  }
540  //
541  // Record the minimum and maximum spatial extent of this DCM
542  //
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;
547  }
548  }
549 
550  return ret;
551 }
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
unsigned int Ncells() const
Number of cells in this plane.
Definition: PlaneGeo.h:43
const daqchannelmap::DAQChannelMap * Map() const
Definition: CMap.h:57
TString ip
Definition: loadincs.C:5
const PlaneGeo * Plane(unsigned int i) const
lchan encodeLChan(int detId, plane_t plane, cell_t cell) const
void CellInfo(unsigned int ip, unsigned int ic, View_t *view=0, double *pos=0, double *dpos=0) const
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:53
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
def lc(target="")
Definition: g4zmq.py:63
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
unsigned int NPlanes() const
uint32_t dchan
< DAQ Channel Map Package
Helper for AttenCurve.
Definition: Path.h:10
diblock_t getDiBlock(dchan daqchan) const
Decode the diblock ID from a dchan.
void GeometryDrawer::ShowCellAndPlaneNumbers ( evdb::View2D view,
int  ip,
int  ic,
double  z,
double  dz,
double  t,
double  dt 
)

Draw text indicating the plane and cell numbers on the display

Parameters
view- A 2D drawing view
ip- Plane number
ic- Cell number
z- z center of the cell (cm)
dz- z width of the cell (cm)
t- transverse location (x or y) of the cell (cm)
dt- transverse width of the cell (cm)

Definition at line 623 of file GeometryDrawer.cxx.

References evdb::View2D::AddText(), plot_validation_datamc::c, MakeMiniprodValidationCuts::f, getGoodRuns4SAM::t1, and t2.

Referenced by DrawCells2D().

630 {
631  int f = 42; // Font style
632  int c = 33; // Text color
633  double s = 0.035; // Text size
634 
635  if (ic%4==0) {
636  char buff[256];
637  sprintf(buff,"%d-",ic);
638  TText& t1 = view->AddText(z-1.1*dz,t, buff);
639  t1.SetTextAlign(32);
640  t1.SetTextSize(s);
641  t1.SetTextFont(f);
642  t1.SetTextColor(c);
643  t1.SetBit(kCannotPick);
644  }
645  if ((ic+5)%4==0) {
646  char buff[256];
647  sprintf(buff," -");
648  TText& t1 = view->AddText(z-1.1*dz,t, buff);
649  t1.SetTextAlign(32);
650  t1.SetTextSize(s);
651  t1.SetTextFont(f);
652  t1.SetTextColor(c);
653  t1.SetBit(kCannotPick);
654  }
655  if ((ic+5)%4==0) {
656  char buff[256];
657  sprintf(buff,"..%d..",ip);
658  TText& t2 = view->AddText(z+1.6*dz,t, buff);
659  t2.SetTextAngle(-90);
660  t2.SetTextAlign(22);
661  t2.SetTextSize(s);
662  t2.SetTextFont(f);
663  t2.SetTextColor(c);
664  }
665 }
TString ip
Definition: loadincs.C:5
const XML_Char * s
Definition: expat.h:262
double dz[NP][NC]
TText & AddText(double x, double y, const char *text)
Definition: View2D.cxx:286
double t2
z
Definition: test.py:28

The documentation for this class was generated from the following files: