LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
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 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 36 of file ICARUSDrawer_tool.cc.

Constructor & Destructor Documentation

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

Definition at line 60 of file ICARUSDrawer_tool.cc.

References configure().

61 {
62  configure(pset);
63 }
void configure(const fhicl::ParameterSet &pset)
evd_tool::ICARUSDrawer::~ICARUSDrawer ( )
inline

Member Function Documentation

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

Definition at line 65 of file ICARUSDrawer_tool.cc.

References fDrawAxes, fDrawBadChannels, fDrawGrid, and fhicl::ParameterSet::get().

Referenced by ICARUSDrawer(), and ~ICARUSDrawer().

66 {
67  // Start by recovering the parameters
68  fDrawGrid = pset.get< bool >("DrawGrid", true);
69  fDrawAxes = pset.get< bool >("DrawAxes", true);
70  fDrawBadChannels = pset.get< bool >("DrawBadChannels", true);
71 
72  return;
73 }
bool fDrawBadChannels
true to draw bad channels
bool fDrawAxes
true to draw coordinate axes
T get(std::string const &key) const
Definition: ParameterSet.h:231
bool fDrawGrid
true to draw backing grid
void evd_tool::ICARUSDrawer::DetOutline3D ( evdb::View3D view)
overridevirtual

Implements evd_tool::IExperimentDrawer.

Definition at line 76 of file ICARUSDrawer_tool.cc.

References geo::GeometryCore::begin_cryostat(), DrawAxes(), DrawBadChannels(), DrawGrids(), DrawRectangularBox(), geo::GeometryCore::end_cryostat(), fDrawAxes, fDrawBadChannels, fDrawGrid, geo::TPCGeo::GetCenter(), geo::TPCGeo::HalfHeight(), geo::TPCGeo::HalfWidth(), geo::CryostatGeo::ID(), geo::TPCGeo::ID(), geo::TPCGeo::Length(), geo::BoxBoundedGeo::MaxX(), geo::BoxBoundedGeo::MaxY(), geo::BoxBoundedGeo::MaxZ(), geo::BoxBoundedGeo::MinX(), geo::BoxBoundedGeo::MinY(), geo::BoxBoundedGeo::MinZ(), geo::CryostatGeo::NTPC(), geo::CryostatGeo::TPC(), and geo::GeometryCore::WorldBox().

77 {
79 
80  bool axesNotDrawn(true);
81 
82  double xl,xu,yl,yu,zl,zu;
83 
84  geo->WorldBox(&xl,&xu,&yl,&yu,&zl,&zu);
85 
86  std::cout << "--- building ICARUS 3D display, low coord: " << xl << ", " << yl << ", " << zl << ", hi coord: " << xu << ", " << yu << ", " << zu << std::endl;
87 
88  // Loop over the number of cryostats
89  for(geo::cryostat_iterator cryoItr = geo->begin_cryostat(); cryoItr != geo->end_cryostat(); cryoItr++)
90  {
91  const geo::CryostatGeo& cryoGeo = *cryoItr;
92 
93  double cryoCoordsLo[] = {cryoGeo.MinX(), cryoGeo.MinY(), cryoGeo.MinZ()};
94  double cryoCoordsHi[] = {cryoGeo.MaxX(), cryoGeo.MaxY(), cryoGeo.MaxZ()};
95 
96  std::cout << " - cryostat: " << cryoGeo.ID() << ", low coord: " << cryoCoordsLo[0] << ", " << cryoCoordsLo[1] << ", " << cryoCoordsLo[2] << ", hi coord: " << cryoCoordsHi[0] << ", " << cryoCoordsHi[1] << ", " << cryoCoordsHi[2] << std::endl;
97 
98  DrawRectangularBox(view, cryoCoordsLo, cryoCoordsHi, kWhite, 2, 1);
99 
100  if (fDrawAxes && axesNotDrawn)
101  {
102  DrawAxes(view, cryoCoordsLo, cryoCoordsHi, kBlue, 1, 1);
103  axesNotDrawn = true;
104  }
105 
106  // Now draw the TPC's associated to this cryostat
107  for(size_t tpcIdx = 0; tpcIdx < cryoGeo.NTPC(); tpcIdx++)
108  {
109  const geo::TPCGeo& tpcGeo = cryoGeo.TPC(tpcIdx);
110 
111  // Find the center of the current TPC
112  TVector3 tpcCenter = tpcGeo.GetCenter();
113 
114  // Now draw the standard volume
115  double coordsLo[] = {tpcCenter.X() - tpcGeo.HalfWidth(), tpcCenter.Y() - tpcGeo.HalfHeight(), tpcCenter.Z() - 0.5 * tpcGeo.Length()};
116  double coordsHi[] = {tpcCenter.X() + tpcGeo.HalfWidth(), tpcCenter.Y() + tpcGeo.HalfHeight(), tpcCenter.Z() + 0.5 * tpcGeo.Length()};
117 
118  std::cout << " - TPC: " << tpcGeo.ID() << ", low coord: " << coordsLo[0] << ", " << coordsLo[1] << ", " << coordsLo[2] << ", hi coord: " << coordsHi[0] << ", " << coordsHi[1] << ", " << coordsHi[2] << std::endl;
119 
120  DrawRectangularBox(view, coordsLo, coordsHi, kRed, 2, 1);
121 
122  // It could be that we don't want to see the grids
123  if (fDrawGrid) DrawGrids(view, coordsLo, coordsHi, tpcIdx > 0, kGray+2, 1, 1);
124 
125  if (fDrawBadChannels) DrawBadChannels(view, coordsHi, kGray, 1, 1);
126  }
127  }
128 
129  return;
130 }
geo::TPCID const & ID() const
Returns the identifier of this TPC.
Definition: TPCGeo.h:278
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:90
cryostat_iterator end_cryostat() const
Returns an iterator pointing after the last cryostat.
Geometry information for a single TPC.
Definition: TPCGeo.h:37
double MaxX() const
Returns the world x coordinate of the end of the box.
Definition: BoxBoundedGeo.h:93
bool fDrawBadChannels
true to draw bad channels
Geometry information for a single cryostat.
Definition: CryostatGeo.h:36
bool fDrawAxes
true to draw coordinate axes
double Length() const
Length is associated with z coordinate [cm].
Definition: TPCGeo.h:107
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:155
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:103
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.
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:688
Namespace collecting geometry-related classes utilities.
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:99
geo::CryostatID const & ID() const
Returns the identifier of this cryostat.
Definition: CryostatGeo.h:116
Point GetCenter() const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.h:693
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 214 of file ICARUSDrawer_tool.cc.

References evdb::View3D::AddPolyLine3D(), and xaxis.

Referenced by DetOutline3D(), and ~ICARUSDrawer().

215 {
216 
217  // Indicate coordinate system
218  double x0 = -0.20; // Center location of the key
219  double y0 = 1.10*coordsLo[1]; // Center location of the key
220  double z0 = -0.10*coordsHi[2]; // Center location of the key
221  double sz = 0.20*coordsHi[2]; // Scale size of the key in z direction
222 
223  TPolyLine3D& xaxis = view->AddPolyLine3D(2, color, style, width);
224  TPolyLine3D& yaxis = view->AddPolyLine3D(2, color, style, width);
225  TPolyLine3D& zaxis = view->AddPolyLine3D(2, color, style, width);
226  xaxis.SetPoint(0, x0, y0, z0);
227  xaxis.SetPoint(1, sz+x0, y0, z0);
228 
229  yaxis.SetPoint(0, x0, y0, z0);
230  yaxis.SetPoint(1, x0, y0+sz, z0);
231 
232  zaxis.SetPoint(0, x0, y0, z0);
233  zaxis.SetPoint(1, x0, y0, z0+sz);
234 
235  TPolyLine3D& xpoint = view->AddPolyLine3D(3, color, style, width);
236  TPolyLine3D& ypoint = view->AddPolyLine3D(3, color, style, width);
237  TPolyLine3D& zpoint = view->AddPolyLine3D(3, color, style, width);
238 
239  xpoint.SetPoint(0, 0.95*sz+x0, y0, z0-0.05*sz);
240  xpoint.SetPoint(1, 1.00*sz+x0, y0, z0);
241  xpoint.SetPoint(2, 0.95*sz+x0, y0, z0+0.05*sz);
242 
243  ypoint.SetPoint(0, x0, 0.95*sz+y0, z0-0.05*sz);
244  ypoint.SetPoint(1, x0, 1.00*sz+y0, z0);
245  ypoint.SetPoint(2, x0, 0.95*sz+y0, z0+0.05*sz);
246 
247  zpoint.SetPoint(0, x0-0.05*sz, y0, 0.95*sz+z0);
248  zpoint.SetPoint(1, x0+0.00*sz, y0, 1.00*sz+z0);
249  zpoint.SetPoint(2, x0+0.05*sz, y0, 0.95*sz+z0);
250 
251  TPolyLine3D& zleg = view->AddPolyLine3D(4, color, style, width);
252  zleg.SetPoint(0, x0-0.05*sz, y0+0.05*sz, z0+1.05*sz);
253  zleg.SetPoint(1, x0+0.05*sz, y0+0.05*sz, z0+1.05*sz);
254  zleg.SetPoint(2, x0-0.05*sz, y0-0.05*sz, z0+1.05*sz);
255  zleg.SetPoint(3, x0+0.05*sz, y0-0.05*sz, z0+1.05*sz);
256 
257  TPolyLine3D& yleg = view->AddPolyLine3D(5, color, style, width);
258  yleg.SetPoint(0, x0-0.05*sz, y0+1.15*sz, z0);
259  yleg.SetPoint(1, x0+0.00*sz, y0+1.10*sz, z0);
260  yleg.SetPoint(2, x0+0.00*sz, y0+1.05*sz, z0);
261  yleg.SetPoint(3, x0+0.00*sz, y0+1.10*sz, z0);
262  yleg.SetPoint(4, x0+0.05*sz, y0+1.15*sz, z0);
263 
264  TPolyLine3D& xleg = view->AddPolyLine3D(7, color, style, width);
265  xleg.SetPoint(0, x0+1.05*sz, y0+0.05*sz, z0-0.05*sz);
266  xleg.SetPoint(1, x0+1.05*sz, y0+0.00*sz, z0-0.00*sz);
267  xleg.SetPoint(2, x0+1.05*sz, y0+0.05*sz, z0+0.05*sz);
268  xleg.SetPoint(3, x0+1.05*sz, y0+0.00*sz, z0-0.00*sz);
269  xleg.SetPoint(4, x0+1.05*sz, y0-0.05*sz, z0-0.05*sz);
270  xleg.SetPoint(5, x0+1.05*sz, y0+0.00*sz, z0-0.00*sz);
271  xleg.SetPoint(6, x0+1.05*sz, y0-0.05*sz, z0+0.05*sz);
272 
273  return;
274 }
TGaxis * xaxis
Definition: plot_hist.C:61
TPolyLine3D & AddPolyLine3D(int n, int c, int w, int s)
Definition: View3D.cxx:105
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 276 of file ICARUSDrawer_tool.cc.

References evdb::View3D::AddPolyLine3D(), DEFINE_ART_CLASS_TOOL, evd::RawDrawingOptions::fCryostat, evd::RawDrawingOptions::fTPC, geo::WireGeo::GetEnd(), geo::WireGeo::GetStart(), geo::GeometryCore::Nviews(), geo::GeometryCore::Nwires(), geo::GeometryCore::PlaneWireToChannel(), and geo::GeometryCore::WirePtr().

Referenced by DetOutline3D(), and ~ICARUSDrawer().

277 {
280 
281  lariov::ChannelStatusProvider const& channelStatus
283 
284  // We want to translate the wire position to the opposite side of the TPC...
285  for(size_t viewNo = 0; viewNo < geo->Nviews(); viewNo++)
286  {
287  for(size_t wireNo = 0; wireNo < geo->Nwires(viewNo); wireNo++)
288  {
289  geo::WireID wireID = geo::WireID(rawOpt->fCryostat, rawOpt->fTPC, viewNo, wireNo);
290 
291  raw::ChannelID_t channel = geo->PlaneWireToChannel(wireID);
292 
293  if (channelStatus.IsBad(channel))
294  {
295  const geo::WireGeo* wireGeo = geo->WirePtr(wireID);
296 
297  double wireStart[3];
298  double wireEnd[3];
299 
300  wireGeo->GetStart(wireStart);
301  wireGeo->GetEnd(wireEnd);
302 
303  TPolyLine3D& pl = view->AddPolyLine3D(2, color, style, width);
304  pl.SetPoint(0, coords[0]-0.5, wireStart[1], wireStart[2]);
305  pl.SetPoint(1, coords[0]-0.5, wireEnd[1], wireEnd[2]);
306  }
307  }
308  }
309 
310  return;
311 }
void GetStart(double *xyz) const
Definition: WireGeo.h:129
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
Definition: WireGeo.h:61
unsigned int fTPC
TPC number to draw, typically set by TWQProjectionView.
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.
TPolyLine3D & AddPolyLine3D(int n, int c, int w, int s)
Definition: View3D.cxx:105
unsigned int fCryostat
Cryostat number to draw, typically set by TWQProjectionView.
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:133
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:27
Namespace collecting geometry-related classes utilities.
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 165 of file ICARUSDrawer_tool.cc.

References evdb::View3D::AddPolyLine3D(), x, y, and z.

Referenced by DetOutline3D(), and ~ICARUSDrawer().

166 {
167  double z = coordsLo[2];
168  // Grid running along x and y at constant z
169  while(1)
170  {
171  TPolyLine3D& gridt = view->AddPolyLine3D(2, color, style, width);
172  gridt.SetPoint(0, coordsLo[0], coordsLo[1], z);
173  gridt.SetPoint(1, coordsHi[0], coordsLo[1], z);
174 
175  if (verticalGrid)
176  {
177  TPolyLine3D& grids = view->AddPolyLine3D(2, color, style, width);
178  grids.SetPoint(0, coordsHi[0], coordsLo[1], z);
179  grids.SetPoint(1, coordsHi[0], coordsHi[1], z);
180  }
181 
182  z += 10.0;
183  if (z>coordsHi[2]) break;
184  }
185 
186  // Grid running along z at constant x
187  double x = coordsLo[0];
188  while(1)
189  {
190  TPolyLine3D& gridt = view->AddPolyLine3D(2, color, style, width);
191  gridt.SetPoint(0, x, coordsLo[1], coordsLo[2]);
192  gridt.SetPoint(1, x, coordsLo[1], coordsHi[2]);
193  x += 10.0;
194  if (x>coordsHi[0]) break;
195  }
196 
197  // Grid running along z at constant y
198  if (verticalGrid)
199  {
200  double y = coordsLo[1];
201  while(1)
202  {
203  TPolyLine3D& grids = view->AddPolyLine3D(2, color, style, width);
204  grids.SetPoint(0, coordsHi[0], y, coordsLo[2]);
205  grids.SetPoint(1, coordsHi[0], y, coordsHi[2]);
206  y += 10.0;
207  if (y>coordsHi[1]) break;
208  }
209  }
210 
211  return;
212 }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:279
TPolyLine3D & AddPolyLine3D(int n, int c, int w, int s)
Definition: View3D.cxx:105
std::size_t color(std::string const &procname)
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 132 of file ICARUSDrawer_tool.cc.

References evdb::View3D::AddPolyLine3D().

Referenced by DetOutline3D(), and ~ICARUSDrawer().

133 {
134  TPolyLine3D& top = view->AddPolyLine3D(5, color, width, style);
135  top.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
136  top.SetPoint(1, coordsHi[0], coordsHi[1], coordsLo[2]);
137  top.SetPoint(2, coordsHi[0], coordsHi[1], coordsHi[2]);
138  top.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
139  top.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
140 
141  TPolyLine3D& side = view->AddPolyLine3D(5, color, width, style);
142  side.SetPoint(0, coordsHi[0], coordsHi[1], coordsLo[2]);
143  side.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
144  side.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
145  side.SetPoint(3, coordsHi[0], coordsHi[1], coordsHi[2]);
146  side.SetPoint(4, coordsHi[0], coordsHi[1], coordsLo[2]);
147 
148  TPolyLine3D& side2 = view->AddPolyLine3D(5, color, width, style);
149  side2.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
150  side2.SetPoint(1, coordsLo[0], coordsLo[1], coordsLo[2]);
151  side2.SetPoint(2, coordsLo[0], coordsLo[1], coordsHi[2]);
152  side2.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
153  side2.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
154 
155  TPolyLine3D& bottom = view->AddPolyLine3D(5, color, width, style);
156  bottom.SetPoint(0, coordsLo[0], coordsLo[1], coordsLo[2]);
157  bottom.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
158  bottom.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
159  bottom.SetPoint(3, coordsLo[0], coordsLo[1], coordsHi[2]);
160  bottom.SetPoint(4, coordsLo[0], coordsLo[1], coordsLo[2]);
161 
162  return;
163 }
TPolyLine3D & AddPolyLine3D(int n, int c, int w, int s)
Definition: View3D.cxx:105
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 54 of file ICARUSDrawer_tool.cc.

Referenced by configure(), and DetOutline3D().

bool evd_tool::ICARUSDrawer::fDrawBadChannels
private

true to draw bad channels

Definition at line 55 of file ICARUSDrawer_tool.cc.

Referenced by configure(), and DetOutline3D().

bool evd_tool::ICARUSDrawer::fDrawGrid
private

true to draw backing grid

Definition at line 53 of file ICARUSDrawer_tool.cc.

Referenced by configure(), and DetOutline3D().


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