Public Member Functions | Private Member Functions | Private Attributes | List of all members
evd_tool::ICARUSDrawer Class Reference
Inheritance diagram for evd_tool::ICARUSDrawer:
evd_tool::IExperimentDrawer

Public Member Functions

 ICARUSDrawer (const fhicl::ParameterSet &pset)
 
void DetOutline3D (evdb::View3D *view) override
 
 ~ICARUSDrawer ()
 

Private Member Functions

void configure (const fhicl::ParameterSet &pset)
 
void DrawRectangularBox (evdb::View3D *view, double *coordsLo, double *coordsHi, int color=kGray, int width=1, int style=1)
 
void DrawGrids (evdb::View3D *view, double *coordsLo, double *coordsHi, bool verticalGrid, int color=kGray, int width=1, int style=1)
 
void DrawAxes (evdb::View3D *view, double *coordsLo, double *coordsHi, int color=kGray, int width=1, int style=1)
 
void DrawBadChannels (evdb::View3D *view, double *coords, int color, int width, int style)
 
- Private Member Functions inherited from evd_tool::IExperimentDrawer
virtual ~IExperimentDrawer () noexcept=default
 

Private Attributes

bool fDrawGrid
 true to draw backing grid More...
 
bool fDrawAxes
 true to draw coordinate axes More...
 
bool fDrawBadChannels
 true to draw bad channels More...
 

Detailed Description

Definition at line 21 of file ICARUSDrawer_tool.cc.

Constructor & Destructor Documentation

evd_tool::ICARUSDrawer::ICARUSDrawer ( const fhicl::ParameterSet pset)
explicit

Definition at line 45 of file ICARUSDrawer_tool.cc.

46 {
47  configure(pset);
48 }
void configure(const fhicl::ParameterSet &pset)
evd_tool::ICARUSDrawer::~ICARUSDrawer ( )
inline

Definition at line 28 of file ICARUSDrawer_tool.cc.

28 {}

Member Function Documentation

void evd_tool::ICARUSDrawer::configure ( const fhicl::ParameterSet pset)
private

Definition at line 50 of file ICARUSDrawer_tool.cc.

51 {
52  // Start by recovering the parameters
53  fDrawGrid = pset.get< bool >("DrawGrid", true);
54  fDrawAxes = pset.get< bool >("DrawAxes", true);
55  fDrawBadChannels = pset.get< bool >("DrawBadChannels", true);
56 
57  return;
58 }
bool fDrawBadChannels
true to draw bad channels
bool fDrawAxes
true to draw coordinate axes
T get(std::string const &key) const
Definition: ParameterSet.h:271
bool fDrawGrid
true to draw backing grid
void evd_tool::ICARUSDrawer::DetOutline3D ( evdb::View3D *  view)
overridevirtual

Implements evd_tool::IExperimentDrawer.

Definition at line 61 of file ICARUSDrawer_tool.cc.

62 {
64 
65  bool axesNotDrawn(true);
66 
67  double xl,xu,yl,yu,zl,zu;
68 
69  geo->WorldBox(&xl,&xu,&yl,&yu,&zl,&zu);
70 
71  std::cout << "--- building ICARUS 3D display, low coord: " << xl << ", " << yl << ", " << zl << ", hi coord: " << xu << ", " << yu << ", " << zu << std::endl;
72 
73  // Loop over the number of cryostats
74  for(geo::cryostat_iterator cryoItr = geo->begin_cryostat(); cryoItr != geo->end_cryostat(); cryoItr++)
75  {
76  const geo::CryostatGeo& cryoGeo = *cryoItr;
77 
78  double cryoCoordsLo[] = {cryoGeo.MinX(), cryoGeo.MinY(), cryoGeo.MinZ()};
79  double cryoCoordsHi[] = {cryoGeo.MaxX(), cryoGeo.MaxY(), cryoGeo.MaxZ()};
80 
81  std::cout << " - cryostat: " << cryoGeo.ID() << ", low coord: " << cryoCoordsLo[0] << ", " << cryoCoordsLo[1] << ", " << cryoCoordsLo[2] << ", hi coord: " << cryoCoordsHi[0] << ", " << cryoCoordsHi[1] << ", " << cryoCoordsHi[2] << std::endl;
82 
83  DrawRectangularBox(view, cryoCoordsLo, cryoCoordsHi, kWhite, 2, 1);
84 
85  if (fDrawAxes && axesNotDrawn)
86  {
87  DrawAxes(view, cryoCoordsLo, cryoCoordsHi, kBlue, 1, 1);
88  axesNotDrawn = true;
89  }
90 
91  // Now draw the TPC's associated to this cryostat
92  for(size_t tpcIdx = 0; tpcIdx < cryoGeo.NTPC(); tpcIdx++)
93  {
94  const geo::TPCGeo& tpcGeo = cryoGeo.TPC(tpcIdx);
95 
96  // Find the center of the current TPC
97  TVector3 tpcCenter = tpcGeo.GetCenter();
98 
99  // Now draw the standard volume
100  double coordsLo[] = {tpcCenter.X() - tpcGeo.HalfWidth(), tpcCenter.Y() - tpcGeo.HalfHeight(), tpcCenter.Z() - 0.5 * tpcGeo.Length()};
101  double coordsHi[] = {tpcCenter.X() + tpcGeo.HalfWidth(), tpcCenter.Y() + tpcGeo.HalfHeight(), tpcCenter.Z() + 0.5 * tpcGeo.Length()};
102 
103  std::cout << " - TPC: " << tpcGeo.ID() << ", low coord: " << coordsLo[0] << ", " << coordsLo[1] << ", " << coordsLo[2] << ", hi coord: " << coordsHi[0] << ", " << coordsHi[1] << ", " << coordsHi[2] << std::endl;
104 
105  DrawRectangularBox(view, coordsLo, coordsHi, kRed, 2, 1);
106 
107  // It could be that we don't want to see the grids
108  if (fDrawGrid) DrawGrids(view, coordsLo, coordsHi, tpcIdx > 0, kGray+2, 1, 1);
109 
110  if (fDrawBadChannels) DrawBadChannels(view, coordsHi, kGray, 1, 1);
111  }
112  }
113 
114  return;
115 }
geo::TPCID const & ID() const
Returns the identifier of this TPC.
Definition: TPCGeo.h:333
void WorldBox(double *xlo, double *xhi, double *ylo, double *yhi, double *zlo, double *zhi) const
Fills the arguments with the boundaries of the world.
double MinX() const
Returns the world x coordinate of the start of the box.
Definition: BoxBoundedGeo.h:88
cryostat_iterator end_cryostat() const
Returns an iterator pointing after the last cryostat.
Geometry information for a single TPC.
Definition: TPCGeo.h:38
double MaxX() const
Returns the world x coordinate of the end of the box.
Definition: BoxBoundedGeo.h:91
bool fDrawBadChannels
true to draw bad channels
Geometry information for a single cryostat.
Definition: CryostatGeo.h:43
bool fDrawAxes
true to draw coordinate axes
double Length() const
Length is associated with z coordinate [cm].
Definition: TPCGeo.h:115
void DrawGrids(evdb::View3D *view, double *coordsLo, double *coordsHi, bool verticalGrid, int color=kGray, int width=1, int style=1)
void DrawRectangularBox(evdb::View3D *view, double *coordsLo, double *coordsHi, int color=kGray, int width=1, int style=1)
void DrawBadChannels(evdb::View3D *view, double *coords, int color, int width, int style)
double MinZ() const
Returns the world z coordinate of the start of the box.
unsigned int NTPC() const
Number of TPCs in this cryostat.
Definition: CryostatGeo.h:181
bool fDrawGrid
true to draw backing grid
double MaxY() const
Returns the world y coordinate of the end of the box.
double HalfHeight() const
Height is associated with y coordinate [cm].
Definition: TPCGeo.h:111
cryostat_iterator begin_cryostat() const
Returns an iterator pointing to the first cryostat.
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc&#39;th TPC in the cryostat.
Definition: CryostatGeo.cxx:93
double MaxZ() const
Returns the world z coordinate of the end of the box.
void DrawAxes(evdb::View3D *view, double *coordsLo, double *coordsHi, int color=kGray, int width=1, int style=1)
Forward iterator browsing all geometry elements in the detector.
Definition: GeometryCore.h:719
LArSoft geometry interface.
Definition: ChannelGeo.h:16
double MinY() const
Returns the world y coordinate of the start of the box.
double HalfWidth() const
Width is associated with x coordinate [cm].
Definition: TPCGeo.h:107
QTextStream & endl(QTextStream &s)
geo::CryostatID const & ID() const
Returns the identifier of this cryostat.
Definition: CryostatGeo.h:132
Point GetCenter() const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.h:779
void evd_tool::ICARUSDrawer::DrawAxes ( evdb::View3D *  view,
double *  coordsLo,
double *  coordsHi,
int  color = kGray,
int  width = 1,
int  style = 1 
)
private

Definition at line 199 of file ICARUSDrawer_tool.cc.

200 {
201 
202  // Indicate coordinate system
203  double x0 = -0.20; // Center location of the key
204  double y0 = 1.10*coordsLo[1]; // Center location of the key
205  double z0 = -0.10*coordsHi[2]; // Center location of the key
206  double sz = 0.20*coordsHi[2]; // Scale size of the key in z direction
207 
208  TPolyLine3D& xaxis = view->AddPolyLine3D(2, color, style, width);
209  TPolyLine3D& yaxis = view->AddPolyLine3D(2, color, style, width);
210  TPolyLine3D& zaxis = view->AddPolyLine3D(2, color, style, width);
211  xaxis.SetPoint(0, x0, y0, z0);
212  xaxis.SetPoint(1, sz+x0, y0, z0);
213 
214  yaxis.SetPoint(0, x0, y0, z0);
215  yaxis.SetPoint(1, x0, y0+sz, z0);
216 
217  zaxis.SetPoint(0, x0, y0, z0);
218  zaxis.SetPoint(1, x0, y0, z0+sz);
219 
220  TPolyLine3D& xpoint = view->AddPolyLine3D(3, color, style, width);
221  TPolyLine3D& ypoint = view->AddPolyLine3D(3, color, style, width);
222  TPolyLine3D& zpoint = view->AddPolyLine3D(3, color, style, width);
223 
224  xpoint.SetPoint(0, 0.95*sz+x0, y0, z0-0.05*sz);
225  xpoint.SetPoint(1, 1.00*sz+x0, y0, z0);
226  xpoint.SetPoint(2, 0.95*sz+x0, y0, z0+0.05*sz);
227 
228  ypoint.SetPoint(0, x0, 0.95*sz+y0, z0-0.05*sz);
229  ypoint.SetPoint(1, x0, 1.00*sz+y0, z0);
230  ypoint.SetPoint(2, x0, 0.95*sz+y0, z0+0.05*sz);
231 
232  zpoint.SetPoint(0, x0-0.05*sz, y0, 0.95*sz+z0);
233  zpoint.SetPoint(1, x0+0.00*sz, y0, 1.00*sz+z0);
234  zpoint.SetPoint(2, x0+0.05*sz, y0, 0.95*sz+z0);
235 
236  TPolyLine3D& zleg = view->AddPolyLine3D(4, color, style, width);
237  zleg.SetPoint(0, x0-0.05*sz, y0+0.05*sz, z0+1.05*sz);
238  zleg.SetPoint(1, x0+0.05*sz, y0+0.05*sz, z0+1.05*sz);
239  zleg.SetPoint(2, x0-0.05*sz, y0-0.05*sz, z0+1.05*sz);
240  zleg.SetPoint(3, x0+0.05*sz, y0-0.05*sz, z0+1.05*sz);
241 
242  TPolyLine3D& yleg = view->AddPolyLine3D(5, color, style, width);
243  yleg.SetPoint(0, x0-0.05*sz, y0+1.15*sz, z0);
244  yleg.SetPoint(1, x0+0.00*sz, y0+1.10*sz, z0);
245  yleg.SetPoint(2, x0+0.00*sz, y0+1.05*sz, z0);
246  yleg.SetPoint(3, x0+0.00*sz, y0+1.10*sz, z0);
247  yleg.SetPoint(4, x0+0.05*sz, y0+1.15*sz, z0);
248 
249  TPolyLine3D& xleg = view->AddPolyLine3D(7, color, style, width);
250  xleg.SetPoint(0, x0+1.05*sz, y0+0.05*sz, z0-0.05*sz);
251  xleg.SetPoint(1, x0+1.05*sz, y0+0.00*sz, z0-0.00*sz);
252  xleg.SetPoint(2, x0+1.05*sz, y0+0.05*sz, z0+0.05*sz);
253  xleg.SetPoint(3, x0+1.05*sz, y0+0.00*sz, z0-0.00*sz);
254  xleg.SetPoint(4, x0+1.05*sz, y0-0.05*sz, z0-0.05*sz);
255  xleg.SetPoint(5, x0+1.05*sz, y0+0.00*sz, z0-0.00*sz);
256  xleg.SetPoint(6, x0+1.05*sz, y0-0.05*sz, z0+0.05*sz);
257 
258  return;
259 }
std::size_t color(std::string const &procname)
void evd_tool::ICARUSDrawer::DrawBadChannels ( evdb::View3D *  view,
double *  coords,
int  color,
int  width,
int  style 
)
private

Definition at line 261 of file ICARUSDrawer_tool.cc.

262 {
265 
266  lariov::ChannelStatusProvider const& channelStatus
268 
269  // We want to translate the wire position to the opposite side of the TPC...
270  for(size_t viewNo = 0; viewNo < geo->Nviews(); viewNo++)
271  {
272  for(size_t wireNo = 0; wireNo < geo->Nwires(viewNo); wireNo++)
273  {
274  geo::WireID wireID = geo::WireID(rawOpt->fCryostat, rawOpt->fTPC, viewNo, wireNo);
275 
277 
278  if (channelStatus.IsBad(channel))
279  {
280  const geo::WireGeo* wireGeo = geo->WirePtr(wireID);
281 
282  double wireStart[3];
283  double wireEnd[3];
284 
285  wireGeo->GetStart(wireStart);
286  wireGeo->GetEnd(wireEnd);
287 
288  TPolyLine3D& pl = view->AddPolyLine3D(2, color, style, width);
289  pl.SetPoint(0, coords[0]-0.5, wireStart[1], wireStart[2]);
290  pl.SetPoint(1, coords[0]-0.5, wireEnd[1], wireEnd[2]);
291  }
292  }
293  }
294 
295  return;
296 }
virtual bool IsBad(raw::ChannelID_t channel) const =0
Returns whether the specified channel is bad in the current run.
void GetStart(double *xyz) const
Definition: WireGeo.h:157
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
Definition: WireGeo.h:65
unsigned int fTPC
TPC number to draw, typically set by TWQProjectionView.
uint8_t channel
Definition: CRTFragment.hh:201
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.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
unsigned int fCryostat
Cryostat number to draw, typically set by TWQProjectionView.
Class providing information about the quality of channels.
std::size_t color(std::string const &procname)
raw::ChannelID_t PlaneWireToChannel(WireID const &wireid) const
Returns the ID of the TPC channel connected to the specified wire.
void GetEnd(double *xyz) const
Definition: WireGeo.h:163
unsigned int Nviews() const
Returns the number of views (different wire orientations)
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
LArSoft geometry interface.
Definition: ChannelGeo.h:16
WireGeo const * WirePtr(geo::WireID const &wireid) const
Returns the specified wire.
void evd_tool::ICARUSDrawer::DrawGrids ( evdb::View3D *  view,
double *  coordsLo,
double *  coordsHi,
bool  verticalGrid,
int  color = kGray,
int  width = 1,
int  style = 1 
)
private

Definition at line 150 of file ICARUSDrawer_tool.cc.

151 {
152  double z = coordsLo[2];
153  // Grid running along x and y at constant z
154  while(1)
155  {
156  TPolyLine3D& gridt = view->AddPolyLine3D(2, color, style, width);
157  gridt.SetPoint(0, coordsLo[0], coordsLo[1], z);
158  gridt.SetPoint(1, coordsHi[0], coordsLo[1], z);
159 
160  if (verticalGrid)
161  {
162  TPolyLine3D& grids = view->AddPolyLine3D(2, color, style, width);
163  grids.SetPoint(0, coordsHi[0], coordsLo[1], z);
164  grids.SetPoint(1, coordsHi[0], coordsHi[1], z);
165  }
166 
167  z += 10.0;
168  if (z>coordsHi[2]) break;
169  }
170 
171  // Grid running along z at constant x
172  double x = coordsLo[0];
173  while(1)
174  {
175  TPolyLine3D& gridt = view->AddPolyLine3D(2, color, style, width);
176  gridt.SetPoint(0, x, coordsLo[1], coordsLo[2]);
177  gridt.SetPoint(1, x, coordsLo[1], coordsHi[2]);
178  x += 10.0;
179  if (x>coordsHi[0]) break;
180  }
181 
182  // Grid running along z at constant y
183  if (verticalGrid)
184  {
185  double y = coordsLo[1];
186  while(1)
187  {
188  TPolyLine3D& grids = view->AddPolyLine3D(2, color, style, width);
189  grids.SetPoint(0, coordsHi[0], y, coordsLo[2]);
190  grids.SetPoint(1, coordsHi[0], y, coordsHi[2]);
191  y += 10.0;
192  if (y>coordsHi[1]) break;
193  }
194  }
195 
196  return;
197 }
std::size_t color(std::string const &procname)
list x
Definition: train.py:276
void evd_tool::ICARUSDrawer::DrawRectangularBox ( evdb::View3D *  view,
double *  coordsLo,
double *  coordsHi,
int  color = kGray,
int  width = 1,
int  style = 1 
)
private

Definition at line 117 of file ICARUSDrawer_tool.cc.

118 {
119  TPolyLine3D& top = view->AddPolyLine3D(5, color, width, style);
120  top.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
121  top.SetPoint(1, coordsHi[0], coordsHi[1], coordsLo[2]);
122  top.SetPoint(2, coordsHi[0], coordsHi[1], coordsHi[2]);
123  top.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
124  top.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
125 
126  TPolyLine3D& side = view->AddPolyLine3D(5, color, width, style);
127  side.SetPoint(0, coordsHi[0], coordsHi[1], coordsLo[2]);
128  side.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
129  side.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
130  side.SetPoint(3, coordsHi[0], coordsHi[1], coordsHi[2]);
131  side.SetPoint(4, coordsHi[0], coordsHi[1], coordsLo[2]);
132 
133  TPolyLine3D& side2 = view->AddPolyLine3D(5, color, width, style);
134  side2.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
135  side2.SetPoint(1, coordsLo[0], coordsLo[1], coordsLo[2]);
136  side2.SetPoint(2, coordsLo[0], coordsLo[1], coordsHi[2]);
137  side2.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
138  side2.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
139 
140  TPolyLine3D& bottom = view->AddPolyLine3D(5, color, width, style);
141  bottom.SetPoint(0, coordsLo[0], coordsLo[1], coordsLo[2]);
142  bottom.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
143  bottom.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
144  bottom.SetPoint(3, coordsLo[0], coordsLo[1], coordsHi[2]);
145  bottom.SetPoint(4, coordsLo[0], coordsLo[1], coordsLo[2]);
146 
147  return;
148 }
std::size_t color(std::string const &procname)

Member Data Documentation

bool evd_tool::ICARUSDrawer::fDrawAxes
private

true to draw coordinate axes

Definition at line 39 of file ICARUSDrawer_tool.cc.

bool evd_tool::ICARUSDrawer::fDrawBadChannels
private

true to draw bad channels

Definition at line 40 of file ICARUSDrawer_tool.cc.

bool evd_tool::ICARUSDrawer::fDrawGrid
private

true to draw backing grid

Definition at line 38 of file ICARUSDrawer_tool.cc.


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