Public Member Functions | Private Member Functions | List of all members
gar::evd::RecoBaseDrawer Class Reference

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

#include <RecoBaseDrawer.h>

Public Member Functions

 RecoBaseDrawer ()
 
 ~RecoBaseDrawer ()
 
void Hit3D (art::Event const &evt, evdb::View3D *view)
 
void TPCCluster3D (art::Event const &evt, evdb::View3D *view)
 
void CaloCluster3D (art::Event const &evt, evdb::View3D *view)
 
void CaloHit3D (art::Event const &evt, evdb::View3D *view)
 
void Track3D (art::Event const &evt, evdb::View3D *view)
 
void VecHit3D (art::Event const &evt, evdb::View3D *view)
 
void Vertex3D (art::Event const &evt, evdb::View3D *view)
 
void DrawHit3D (std::vector< const rec::Hit * > const &hit, evdb::View3D *view, int color, int marker=2, int size=2)
 
void DrawTPCCluster3D (std::vector< const gar::rec::TPCCluster * > const &TPCClusters, evdb::View3D *view, int color, int marker=2, int size=2)
 
void DrawTrackPolyLine3D (std::vector< const gar::rec::TrackTrajectory * > const &trajectories, evdb::View3D *view, int color, int width=2)
 
void DrawCaloCluster3D (std::vector< const gar::rec::Cluster * > const &Clusters, evdb::View3D *view, int color)
 
void DrawCaloHit3D (std::vector< const gar::rec::CaloHit * > const &CaloHits, evdb::View3D *view)
 
void DrawTrack3D (rec::Track const &track, evdb::View3D *view, int color, int marker=1, int size=2)
 
void DrawHelix3D (const float *trackpar, const float xpar, const float xother, evdb::View3D *view, int color, int width)
 
void DrawVecHit3D (std::vector< const rec::VecHit * > const &vechits, evdb::View3D *view, int color=6, int marker=28, int size=2)
 
void DrawVertex3D (const float *pos, evdb::View3D *view, int color=5, int marker=20, int size=1)
 
void DrawArrow3D (const float *startpos, const float *arrowvec, evdb::View3D *view, int color, float lengthscale=1.0)
 

Private Member Functions

int GetHits (art::Event const &evt, std::string const &which, std::vector< const rec::Hit * > &hits)
 
int GetTPCClusters (art::Event const &evt, std::string const &which, std::vector< const rec::TPCCluster * > &TPCClusters)
 
int GetTracks (art::Event const &evt, std::string const &which, art::View< rec::Track > &track)
 
int GetVecHits (art::Event const &evt, std::string const &which, std::vector< const rec::VecHit * > &vechits)
 
int GetVertices (art::Event const &evt, std::string const &which, art::View< rec::Vertex > &vertex)
 
int GetShowers (art::Event const &evt, std::string const &which, art::View< rec::Shower > &shower)
 
int GetCaloClusters (art::Event const &evt, std::string const &which, std::vector< const rec::Cluster * > &Clusters)
 
int GetCaloHits (art::Event const &evt, std::string const &which, std::vector< const rec::CaloHit * > &CaloHits)
 

Detailed Description

Aid in the rendering of RecoBase objects.

Definition at line 65 of file RecoBaseDrawer.h.

Constructor & Destructor Documentation

gar::evd::RecoBaseDrawer::RecoBaseDrawer ( )

Definition at line 67 of file RecoBaseDrawer.cxx.

68  {
69  }
gar::evd::RecoBaseDrawer::~RecoBaseDrawer ( )

Definition at line 72 of file RecoBaseDrawer.cxx.

73  {
74  }

Member Function Documentation

void gar::evd::RecoBaseDrawer::CaloCluster3D ( art::Event const &  evt,
evdb::View3D *  view 
)

Render Calorimeter Cluster objects on a 2D viewing canvas

Parameters
evt: Event handle to get data objects from
view: Pointer to view to draw on

Definition at line 147 of file RecoBaseDrawer.cxx.

149  {
152 
153  if(recoOpt->fDrawCaloClusters == 0 ||
154  rawOpt->fDrawRawOrReco < 1 ) return;
155 
156  int h = 0;
157  for(auto const& which : recoOpt->fCaloClusterLabels) {
158 
159  std::vector<const gar::rec::Cluster*> Clusters;
160  this->GetCaloClusters(evt, which, Clusters);
161 
162  //this->DrawCaloCluster3D(Clusters, view, h%evd::kNCOLS);
163  this->DrawCaloCluster3D(Clusters, view, 3); // think about colors. currently just green
164  ++h;
165  }
166 
167  return;
168  }
int GetCaloClusters(art::Event const &evt, std::string const &which, std::vector< const rec::Cluster * > &Clusters)
void DrawCaloCluster3D(std::vector< const gar::rec::Cluster * > const &Clusters, evdb::View3D *view, int color)
TCEvent evt
Definition: DataStructs.cxx:7
void gar::evd::RecoBaseDrawer::CaloHit3D ( art::Event const &  evt,
evdb::View3D *  view 
)

Render Calorimeter Hit objects on a 2D viewing canvas

Parameters
evt: Event handle to get data objects from
view: Pointer to view to draw on

Definition at line 178 of file RecoBaseDrawer.cxx.

180  {
183 
184  if(recoOpt->fDrawCaloHits == 0 ||
185  rawOpt->fDrawRawOrReco < 1 ) return;
186 
187  int h = 0;
188  for(auto const& which : recoOpt->fCaloHitLabels) {
189 
190  std::vector<const gar::rec::CaloHit*> CaloHits;
191  this->GetCaloHits(evt, which, CaloHits);
192 
193  this->DrawCaloHit3D(CaloHits, view);
194  ++h;
195  }
196 
197  return;
198  }
void DrawCaloHit3D(std::vector< const gar::rec::CaloHit * > const &CaloHits, evdb::View3D *view)
int GetCaloHits(art::Event const &evt, std::string const &which, std::vector< const rec::CaloHit * > &CaloHits)
TCEvent evt
Definition: DataStructs.cxx:7
void gar::evd::RecoBaseDrawer::DrawArrow3D ( const float *  startpos,
const float *  arrowvec,
evdb::View3D *  view,
int  color,
float  lengthscale = 1.0 
)

Definition at line 265 of file RecoBaseDrawer.cxx.

270  {
272  double xcent = geo->TPCXCent();
273  double ycent = geo->TPCYCent();
274  double zcent = geo->TPCZCent();
275  xcent = 0;
276  ycent = 0;
277  zcent = 0;
278  TVector3 cent(xcent,ycent,zcent);
279 
280  TPolyLine3D& tpoly = view->AddPolyLine3D(5,color,1,1);
281  TVector3 spv(startpos);
282  TVector3 spcv = startpos + cent;
283  TVector3 av(arrowvec);
284  TVector3 endpos = spcv + lengthscale*av;
285 
286  // nb. coordinates are so Y is up, but ROOT thinks Z is up, so report (z,x,y)
287  tpoly.SetPoint(0,spcv.Z(),spcv.X(),spcv.Y());
288  tpoly.SetPoint(1,endpos.Z(),endpos.X(),endpos.Y());
289 
290  TVector3 xhat(1,0,0);
291  TVector3 yhat(0,1,0);
292  TVector3 zhat(0,0,1);
293 
294  TVector3 perp1 = av.Cross(xhat);
295  if (perp1.Mag() == 0)
296  {
297  perp1 = av.Cross(yhat);
298  }
299  if (perp1.Mag() == 0)
300  {
301  perp1 = av.Cross(zhat);
302  }
303  if (perp1.Mag() == 0)
304  {
305  // nb. coordinates are so Y is up, but ROOT thinks Z is up, so report (z,x,y)
306  tpoly.SetPoint(2,endpos.Z(),endpos.X(),endpos.Y());
307  tpoly.SetPoint(3,endpos.Z(),endpos.X(),endpos.Y());
308  tpoly.SetPoint(4,endpos.Z(),endpos.X(),endpos.Y());
309  return;
310  }
311  perp1 = perp1*(1.0/perp1.Mag());
312 
313  TVector3 arpd1 = endpos -lengthscale*0.1*av + perp1*lengthscale*0.1*av.Mag();
314  TVector3 arpd2 = endpos -lengthscale*0.1*av - perp1*lengthscale*0.1*av.Mag();
315  // nb. coordinates are so Y is up, but ROOT thinks Z is up, so report (z,x,y)
316  tpoly.SetPoint(2,arpd1.Z(),arpd1.X(),arpd1.Y());
317  tpoly.SetPoint(3,endpos.Z(),endpos.X(),endpos.Y());
318  tpoly.SetPoint(4,arpd2.Z(),arpd2.X(),arpd2.Y());
319  }
std::size_t color(std::string const &procname)
LArSoft geometry interface.
Definition: ChannelGeo.h:16
void gar::evd::RecoBaseDrawer::DrawCaloCluster3D ( std::vector< const gar::rec::Cluster * > const &  Clusters,
evdb::View3D *  view,
int  color 
)

Definition at line 436 of file RecoBaseDrawer.cxx.

439  {
440  //auto const* detp = gar::providerFrom<detinfo::DetectorPropertiesService>();
441 
443  double xcent = geo->TPCXCent();
444  double ycent = geo->TPCYCent();
445  double zcent = geo->TPCZCent();
446  xcent = 0;
447  ycent = 0;
448  zcent = 0;
449 
451 
452  // Make and fill polylines
453 
454  for(auto itr : Clusters){
455  TPolyLine3D& pl = view->AddPolyLine3D(14, color, 1, 1);
456 
457  auto const* pos = itr->Position();
458  auto const* dir = itr->EigenVectors();
459  //auto const* shape = itr->Shape();
460  float length = itr->Energy()*recoOpt->fCaloClusterScale;
461 
462  // vertices of an octahedron
463  float poslist[6][3];
464  for (int i=0;i<3;++i)
465  {
466  poslist[0][i] = pos[i];
467  poslist[5][i] = pos[i]+dir[i]*length;
468  poslist[1][i] = pos[i]+(dir[i] + dir[3+i]*0.2)*length/2.0;
469  poslist[2][i] = pos[i]+(dir[i] + dir[6+i]*0.2)*length/2.0;
470  poslist[3][i] = pos[i]+(dir[i] - dir[3+i]*0.2)*length/2.0;
471  poslist[4][i] = pos[i]+(dir[i] - dir[6+i]*0.2)*length/2.0;
472  }
473  for (int j=0;j<6; ++j)
474  {
475  poslist[j][0] += xcent;
476  poslist[j][1] += ycent;
477  poslist[j][2] += zcent;
478  }
479  // nb. coordinates are so Y is up, but ROOT thinks Z is up, so report (z,x,y)
480  pl.SetPoint(0 , poslist[0][2], poslist[0][0], poslist[0][1]);
481  pl.SetPoint(1 , poslist[1][2], poslist[1][0], poslist[1][1]);
482  pl.SetPoint(2 , poslist[5][2], poslist[5][0], poslist[5][1]);
483  pl.SetPoint(3 , poslist[2][2], poslist[2][0], poslist[2][1]);
484  pl.SetPoint(4 , poslist[0][2], poslist[0][0], poslist[0][1]);
485  pl.SetPoint(5 , poslist[3][2], poslist[3][0], poslist[3][1]);
486  pl.SetPoint(6 , poslist[5][2], poslist[5][0], poslist[5][1]);
487  pl.SetPoint(7 , poslist[4][2], poslist[4][0], poslist[4][1]);
488  pl.SetPoint(8 , poslist[0][2], poslist[0][0], poslist[0][1]);
489  pl.SetPoint(9 , poslist[1][2], poslist[1][0], poslist[1][1]);
490  pl.SetPoint(10, poslist[2][2], poslist[2][0], poslist[2][1]);
491  pl.SetPoint(11, poslist[3][2], poslist[3][0], poslist[3][1]);
492  pl.SetPoint(12, poslist[4][2], poslist[4][0], poslist[4][1]);
493  pl.SetPoint(13, poslist[1][2], poslist[1][0], poslist[1][1]);
494  }
495 
496  return;
497  }
string dir
std::size_t color(std::string const &procname)
LArSoft geometry interface.
Definition: ChannelGeo.h:16
void gar::evd::RecoBaseDrawer::DrawCaloHit3D ( std::vector< const gar::rec::CaloHit * > const &  CaloHits,
evdb::View3D *  view 
)

Definition at line 502 of file RecoBaseDrawer.cxx.

504  {
505  //auto const* detp = gar::providerFrom<detinfo::DetectorPropertiesService>();
506 
507  const int colorheatindex[16] = { kBlue+2, kBlue+1, kBlue,
508  kCyan+2, kCyan+1, kCyan,
509  kGreen+2, kGreen+1, kGreen,
510  kRed-2, kRed+1, kRed,
511  kYellow+2, kYellow+1, kYellow,
512  kWhite };
513 
515  double xcent = geo->TPCXCent();
516  double ycent = geo->TPCYCent();
517  double zcent = geo->TPCZCent();
518  xcent = 0;
519  ycent = 0;
520  zcent = 0;
521 
523 
524  // Make and fill polylines -- cubes in this case
525 
526  for(auto itr : CaloHits){
527 
528  auto const* pos = itr->Position();
529  float energy=itr->Energy();
530  if (energy<=0) energy=1E-3;
531  energy = TMath::Log(energy);
532  float normenergy = (energy + recoOpt->fCaloHitScale)/recoOpt->fCaloHitScale;
533  if (normenergy < 0) normenergy = 0;
534  if (normenergy > 1) normenergy = 1;
535  int icolor = normenergy*16.0;
536  if (icolor>15) icolor = 15;
537  float halflength = 0.5; // in cm
538 
539  std::vector<int> pointlist = {0,1,5,6,2,3,7,4,0,3,7,6,2,1,5,4};
540  TPolyLine3D& pl = view->AddPolyLine3D(pointlist.size(), colorheatindex[icolor], 1, 1);
541 
542  //std::cout << "Drawing calo hit at : " << pos[0] << " " << pos[1] << " " << pos[2] << " " <<
543  // "with normenergy: " << normenergy << std::endl;
544 
545  // vertices of a cube
546 
547  float poslist[8][3];
548  std::set<int> bot = {0, 1, 2, 3};
549  std::set<int> left = {0, 3, 4, 7};
550  std::set<int> front = {0, 1, 5, 4};
551 
552  for (int i=0; i<8; ++i)
553  {
554  if (bot.find(i) == bot.end()) // we're on top
555  {
556  poslist[i][2] = pos[2] + halflength;
557  }
558  else
559  {
560  poslist[i][2] = pos[2] - halflength;
561  }
562  if (left.find(i) == left.end()) // we're on the right-hand side
563  {
564  poslist[i][0] = pos[0] + halflength;
565  }
566  else
567  {
568  poslist[i][0] = pos[0] - halflength;
569  }
570  if (front.find(i) == front.end()) // we're in back
571  {
572  poslist[i][1] = pos[1] + halflength;
573  }
574  else
575  {
576  poslist[i][1] = pos[1] - halflength;
577  }
578  }
579  // move the origin as needed
580  for (int j=0;j<8; ++j)
581  {
582  poslist[j][0] += xcent;
583  poslist[j][1] += ycent;
584  poslist[j][2] += zcent;
585  }
586 
587  for (size_t j=0; j<pointlist.size(); ++j)
588  {
589  // nb. coordinates are so Y is up, but ROOT thinks Z is up, so report (z,x,y)
590  pl.SetPoint(j,poslist[pointlist[j]][2],poslist[pointlist[j]][0],poslist[pointlist[j]][1]);
591  }
592 
593  }
594 
595  return;
596  }
if(!yymsg) yymsg
LArSoft geometry interface.
Definition: ChannelGeo.h:16
void gar::evd::RecoBaseDrawer::DrawHelix3D ( const float *  trackpar,
const float  xpar,
const float  xother,
evdb::View3D *  view,
int  color,
int  width 
)

Definition at line 218 of file RecoBaseDrawer.cxx.

224  {
226  double xcent = geo->TPCXCent();
227  double ycent = geo->TPCYCent();
228  double zcent = geo->TPCZCent();
229  xcent = 0;
230  ycent = 0;
231  zcent = 0;
232 
233  float r = 0;
234  if (trackpar[2] != 0) r=1.0/trackpar[2];
235  float si = TMath::Tan(trackpar[4]);
236 
237  float ycc = trackpar[0] + r*TMath::Cos(trackpar[3]);
238  float zcc = trackpar[1] - r*TMath::Sin(trackpar[3]);
239 
240  float dphimax = TMath::Pi();
241  float phi1 = 0;
242  float phi2 = (xother-xpar)*trackpar[2]/si;
243  if (phi2-phi1>dphimax) phi2 = phi1+dphimax;
244  if (phi2-phi1<-dphimax) phi2 = phi1-dphimax;
245  if (phi2-phi1==0) phi2=phi1+0.01;
246 
247  int nptshelix=100;
248  float dphihelix=(phi2-phi1)/((float) nptshelix);
249 
250  TPolyLine3D& tpoly = view->AddPolyLine3D(nptshelix,color,1,1);
251 
252  for (int ipoint=0;ipoint<nptshelix;++ipoint)
253  {
254  float philoc = phi1 + ipoint*dphihelix;
255  float xl = xpar + r*si*(philoc);
256  float yl = ycc - r*TMath::Cos(philoc + trackpar[3]);
257  float zl = zcc + r*TMath::Sin(philoc + trackpar[3]);
258  // nb. coordinates are so Y is up, but ROOT thinks Z is up, so report (z,x,y)
259  tpoly.SetPoint(ipoint,zcent+zl,xcent+xl,ycent+yl);
260  }
261  tpoly.SetLineWidth(width);
262  }
std::size_t color(std::string const &procname)
LArSoft geometry interface.
Definition: ChannelGeo.h:16
void gar::evd::RecoBaseDrawer::DrawHit3D ( std::vector< const rec::Hit * > const &  hit,
evdb::View3D *  view,
int  color,
int  marker = 2,
int  size = 2 
)

Definition at line 322 of file RecoBaseDrawer.cxx.

327  {
328  //auto const* detp = gar::providerFrom<detinfo::DetectorPropertiesService>();
329 
331  double xcent = geo->TPCXCent();
332  double ycent = geo->TPCYCent();
333  double zcent = geo->TPCZCent();
334  xcent = 0;
335  ycent = 0;
336  zcent = 0;
337 
338  // Make and fill a polymarker.
339  TPolyMarker3D& pm = view->AddPolyMarker3D(hits.size(), color, 1, 3);
340 
341  // Display all hits on the 3D view
342  size_t p = 0;
343  for(auto itr : hits){
344 
345  // Try to get the "best" charge measurement, ie. the one last in
346  // the calibration chain
347  //double dQdX = itr->Signal() / detp->ElectronsToADC();
348 
349  // Try to get the "best" charge measurement, ie. the one last in
350  // the calibration chain
351  auto const* pos = itr->Position();
352 
353  // nb. coordinates are so Y is up, but ROOT thinks Z is up, so report (z,x,y)
354  pm.SetPoint(p, zcent+pos[2], xcent+pos[0], ycent+pos[1]);
355  ++p;
356  }
357 
358  return;
359  }
p
Definition: test.py:223
std::size_t color(std::string const &procname)
LArSoft geometry interface.
Definition: ChannelGeo.h:16
void gar::evd::RecoBaseDrawer::DrawTPCCluster3D ( std::vector< const gar::rec::TPCCluster * > const &  TPCClusters,
evdb::View3D *  view,
int  color,
int  marker = 2,
int  size = 2 
)

Definition at line 363 of file RecoBaseDrawer.cxx.

368  {
369  //auto const* detp = gar::providerFrom<detinfo::DetectorPropertiesService>();
370 
372  double xcent = geo->TPCXCent();
373  double ycent = geo->TPCYCent();
374  double zcent = geo->TPCZCent();
375  xcent = 0;
376  ycent = 0;
377  zcent = 0;
378 
379  // Make and fill a polymarker.
380  TPolyMarker3D& pm = view->AddPolyMarker3D(TPCClusters.size(), color, marker, size);
381 
382  // Display all TPCClusters on the 3D view
383  size_t p = 0;
384  for(auto itr : TPCClusters){
385 
386  // Try to get the "best" charge measurement, ie. the one last in
387  // the calibration chain
388  //double dQdX = itr->Signal() / detp->ElectronsToADC();
389 
390  // Try to get the "best" charge measurement, ie. the one last in
391  // the calibration chain
392  auto const* pos = itr->Position();
393 
394  // nb. coordinates are so Y is up, but ROOT thinks Z is up, so report (z,x,y)
395  pm.SetPoint(p, zcent+pos[2], xcent+pos[0], ycent+pos[1]);
396  ++p;
397  }
398 
399  return;
400  }
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
p
Definition: test.py:223
std::size_t color(std::string const &procname)
LArSoft geometry interface.
Definition: ChannelGeo.h:16
void gar::evd::RecoBaseDrawer::DrawTrack3D ( rec::Track const &  track,
evdb::View3D *  view,
int  color,
int  marker = 1,
int  size = 2 
)
void gar::evd::RecoBaseDrawer::DrawTrackPolyLine3D ( std::vector< const gar::rec::TrackTrajectory * > const &  trajectories,
evdb::View3D *  view,
int  color,
int  width = 2 
)

Definition at line 405 of file RecoBaseDrawer.cxx.

409  {
410  //auto const* detp = gar::providerFrom<detinfo::DetectorPropertiesService>();
411 
413  double xcent = geo->TPCXCent();
414  double ycent = geo->TPCYCent();
415  double zcent = geo->TPCZCent();
416  xcent = 0;
417  ycent = 0;
418  zcent = 0;
419 
420  for (auto itr : trajectories) // there should only be one
421  {
422  std::vector<TVector3> ftraj = itr->getFWDTrajectory(); // later -- decide if we need the backward one too
423  TPolyLine3D& tpoly = view->AddPolyLine3D(ftraj.size(),color,1,1);
424  for (size_t i=0; i<ftraj.size(); ++i)
425  {
426  tpoly.SetPoint(i,zcent+ftraj.at(i).Z(),xcent+ftraj.at(i).X(),ycent+ftraj.at(i).Y());
427  }
428  tpoly.SetLineWidth(width);
429  }
430 
431  return;
432  }
std::size_t color(std::string const &procname)
LArSoft geometry interface.
Definition: ChannelGeo.h:16
void gar::evd::RecoBaseDrawer::DrawVecHit3D ( std::vector< const rec::VecHit * > const &  vechits,
evdb::View3D *  view,
int  color = 6,
int  marker = 28,
int  size = 2 
)

Definition at line 599 of file RecoBaseDrawer.cxx.

604  {
605  size_t p =0;
606  for(unsigned int idx = 0; idx < vechits.size(); ++idx){
607 
608  int colorloc = evd::kColor[idx%evd::kNCOLS];
609 
610  // Make and fill a polyline: the vechit extent in both directions
611  TPolyLine3D& pl = view->AddPolyLine3D(2, colorloc, 1, 1);
612  // Make and fill a polymarker: the vechit position
613  // TODO: Could add one but how best to display?
614  //TPolyMarker3D& pm = view->AddPolyMarker3D(1, 6, 33, 1);
615 
616  const float *pos = vechits[idx]->Position();
617  const float *dir = vechits[idx]->Direction();
618 
619  const double len = vechits[idx]->Length();
620 
621  //pm.SetPoint(0, pos[0], pos[1], pos[2]);
622  // nb. coordinates are so Y is up, but ROOT thinks Z is up, so report (z,x,y)
623 
624  pl.SetPoint(0,
625  pos[2] - dir[2]*(len/2),
626  pos[0] - dir[0]*(len/2),
627  pos[1] - dir[1]*(len/2)
628  );
629 
630  // This would be the center, but don't need to draw that
631  //pl.SetPoint(1, pos[0], pos[1], pos[2]);
632 
633  pl.SetPoint(1,
634  pos[2] + dir[2]*(len/2),
635  pos[0] + dir[0]*(len/2),
636  pos[1] + dir[1]*(len/2)
637  );
638  ++p;
639  }
640  }
string dir
static const int kNCOLS
Definition: eventdisplay.h:12
p
Definition: test.py:223
static const int kColor[kNCOLS]
Definition: eventdisplay.h:13
void gar::evd::RecoBaseDrawer::DrawVertex3D ( const float *  pos,
evdb::View3D *  view,
int  color = 5,
int  marker = 20,
int  size = 1 
)

Definition at line 200 of file RecoBaseDrawer.cxx.

205  {
207  double xcent = geo->TPCXCent();
208  double ycent = geo->TPCYCent();
209  double zcent = geo->TPCZCent();
210  xcent = 0;
211  ycent = 0;
212  zcent = 0;
213  TPolyMarker3D& pm = view->AddPolyMarker3D(1, color, marker, size);
214  // nb. coordinates are so Y is up, but ROOT thinks Z is up, so report (z,x,y)
215  pm.SetPoint(0, zcent + pos[2], xcent + pos[0], ycent + pos[1] );
216  }
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
std::size_t color(std::string const &procname)
LArSoft geometry interface.
Definition: ChannelGeo.h:16
int gar::evd::RecoBaseDrawer::GetCaloClusters ( art::Event const &  evt,
std::string const &  which,
std::vector< const rec::Cluster * > &  Clusters 
)
private

Definition at line 803 of file RecoBaseDrawer.cxx.

806  {
807  Clusters.clear();
808 
809  std::vector<const gar::rec::Cluster*> temp;
810 
811  try{
812  evt.getView(which, temp);
813  for(size_t t = 0; t < temp.size(); ++t){
814  Clusters.push_back(temp[t]);
815  }
816  }
817  catch(cet::exception& e){
818  writeErrMsg("GetCaloClusters", e);
819  }
820 
821  return Clusters.size();
822  }
const double e
TCEvent evt
Definition: DataStructs.cxx:7
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
int gar::evd::RecoBaseDrawer::GetCaloHits ( art::Event const &  evt,
std::string const &  which,
std::vector< const rec::CaloHit * > &  CaloHits 
)
private

Definition at line 826 of file RecoBaseDrawer.cxx.

829  {
830  CaloHits.clear();
831 
832  std::vector<const gar::rec::CaloHit*> temp;
833 
834  try{
835  evt.getView(which, temp);
836  for(size_t t = 0; t < temp.size(); ++t){
837  CaloHits.push_back(temp[t]);
838  }
839  }
840  catch(cet::exception& e){
841  writeErrMsg("GetCaloHits", e);
842  }
843 
844  return CaloHits.size();
845  }
const double e
TCEvent evt
Definition: DataStructs.cxx:7
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
int gar::evd::RecoBaseDrawer::GetHits ( art::Event const &  evt,
std::string const &  which,
std::vector< const rec::Hit * > &  hits 
)
private

Definition at line 758 of file RecoBaseDrawer.cxx.

761  {
762  hits.clear();
763 
764  std::vector<const gar::rec::Hit*> temp;
765 
766  try{
767  evt.getView(which, temp);
768  for(size_t t = 0; t < temp.size(); ++t){
769  hits.push_back(temp[t]);
770  }
771  }
772  catch(cet::exception& e){
773  writeErrMsg("GetHits", e);
774  }
775 
776  return hits.size();
777  }
const double e
TCEvent evt
Definition: DataStructs.cxx:7
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
int gar::evd::RecoBaseDrawer::GetShowers ( art::Event const &  evt,
std::string const &  which,
art::View< rec::Shower > &  shower 
)
private

Definition at line 895 of file RecoBaseDrawer.cxx.

898  {
899  try{
900  evt.getView(which, shower);
901  }
902  catch(cet::exception& e){
903  writeErrMsg("GetShowers", e);
904  }
905 
906  return shower.vals().size();
907  }
auto & vals() noexcept
Definition: View.h:68
const double e
TCEvent evt
Definition: DataStructs.cxx:7
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
int gar::evd::RecoBaseDrawer::GetTPCClusters ( art::Event const &  evt,
std::string const &  which,
std::vector< const rec::TPCCluster * > &  TPCClusters 
)
private

Definition at line 781 of file RecoBaseDrawer.cxx.

784  {
785  TPCClusters.clear();
786 
787  std::vector<const gar::rec::TPCCluster*> temp;
788 
789  try{
790  evt.getView(which, temp);
791  for(size_t t = 0; t < temp.size(); ++t){
792  TPCClusters.push_back(temp[t]);
793  }
794  }
795  catch(cet::exception& e){
796  writeErrMsg("GetTPCClusters", e);
797  }
798 
799  return TPCClusters.size();
800  }
const double e
TCEvent evt
Definition: DataStructs.cxx:7
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
int gar::evd::RecoBaseDrawer::GetTracks ( art::Event const &  evt,
std::string const &  which,
art::View< rec::Track > &  track 
)
private

Definition at line 848 of file RecoBaseDrawer.cxx.

851  {
852  try{
853  evt.getView(which, track);
854  }
855  catch(cet::exception& e){
856  writeErrMsg("GetTracks", e);
857  }
858 
859  return track.vals().size();
860  }
auto & vals() noexcept
Definition: View.h:68
const double e
TCEvent evt
Definition: DataStructs.cxx:7
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
int gar::evd::RecoBaseDrawer::GetVecHits ( art::Event const &  evt,
std::string const &  which,
std::vector< const rec::VecHit * > &  vechits 
)
private

Definition at line 863 of file RecoBaseDrawer.cxx.

866  {
867  std::vector<const gar::rec::VecHit*> temp(vechit);
868  try{
869  evt.getView(which, temp);
870  temp.swap(vechit);
871  }
872  catch(cet::exception& e){
873  writeErrMsg("GetVecHits", e);
874  }
875 
876  return vechit.size();
877  }
const double e
TCEvent evt
Definition: DataStructs.cxx:7
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
int gar::evd::RecoBaseDrawer::GetVertices ( art::Event const &  evt,
std::string const &  which,
art::View< rec::Vertex > &  vertex 
)
private

Definition at line 880 of file RecoBaseDrawer.cxx.

883  {
884  try{
885  evt.getView(which, vertex);
886  }
887  catch(cet::exception& e){
888  writeErrMsg("GetVertices", e);
889  }
890 
891  return vertex.vals().size();
892  }
auto & vals() noexcept
Definition: View.h:68
const double e
TCEvent evt
Definition: DataStructs.cxx:7
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void gar::evd::RecoBaseDrawer::Hit3D ( art::Event const &  evt,
evdb::View3D *  view 
)

Render Hit objects on a 2D viewing canvas

Parameters
evt: Event handle to get data objects from
view: Pointer to view to draw on
plane: plane number of view

Definition at line 84 of file RecoBaseDrawer.cxx.

86  {
89 
90  if(recoOpt->fDrawHits == 0 ||
91  rawOpt->fDrawRawOrReco < 1 ) return;
92 
93  int h = 0;
94  for(auto const& which : recoOpt->fHitLabels) {
95 
96  std::vector<const gar::rec::Hit*> hits;
97  this->GetHits(evt, which, hits);
98 
99  this->DrawHit3D(hits, view, h%evd::kNCOLS);
100  ++h;
101  } // loop on imod folders
102 
103  return;
104  }
static const int kNCOLS
Definition: eventdisplay.h:12
void DrawHit3D(std::vector< const rec::Hit * > const &hit, evdb::View3D *view, int color, int marker=2, int size=2)
int GetHits(art::Event const &evt, std::string const &which, std::vector< const rec::Hit * > &hits)
std::vector< art::InputTag > fHitLabels
module labels that produced hits
TCEvent evt
Definition: DataStructs.cxx:7
void gar::evd::RecoBaseDrawer::TPCCluster3D ( art::Event const &  evt,
evdb::View3D *  view 
)

Render TPCCluster objects on a 2D viewing canvas

Parameters
evt: Event handle to get data objects from
view: Pointer to view to draw on
plane: plane number of view

Definition at line 115 of file RecoBaseDrawer.cxx.

117  {
120 
121  if(recoOpt->fDrawTPCClusters == 0 ||
122  rawOpt->fDrawRawOrReco < 1 ) return;
123 
124  int h = 0;
125  for(auto const& which : recoOpt->fTPCClusterLabels) {
126 
127  std::vector<const gar::rec::TPCCluster*> TPCClusters;
128  this->GetTPCClusters(evt, which, TPCClusters);
129 
130  this->DrawTPCCluster3D(TPCClusters, view, h%evd::kNCOLS,
131  recoOpt->fTPCClusterMarker,
132  recoOpt->fTPCClusterMarkerSize);
133  ++h;
134  }
135 
136  return;
137  }
static const int kNCOLS
Definition: eventdisplay.h:12
int GetTPCClusters(art::Event const &evt, std::string const &which, std::vector< const rec::TPCCluster * > &TPCClusters)
void DrawTPCCluster3D(std::vector< const gar::rec::TPCCluster * > const &TPCClusters, evdb::View3D *view, int color, int marker=2, int size=2)
TCEvent evt
Definition: DataStructs.cxx:7
void gar::evd::RecoBaseDrawer::Track3D ( art::Event const &  evt,
evdb::View3D *  view 
)

Definition at line 643 of file RecoBaseDrawer.cxx.

645  {
648 
649  if(rawOpt->fDrawRawOrReco < 1 ) return;
650  bool drawTracks = (recoOpt->fDrawTracks != 0);
651 
652  if(drawTracks){
653  for(auto const& which : recoOpt->fTrackLabels){
654  art::View<gar::rec::Track> trackView;
655  this->GetTracks(evt, which, trackView);
656  if(!trackView.isValid()) continue;
657 
658  art::FindMany<gar::rec::TPCCluster> fmc(trackView, evt, which);
659  if(!fmc.isValid()) continue;
660 
661  art::FindMany<gar::rec::TrackTrajectory> fmt(trackView, evt, which);
662  //if(!fmt.isValid()) continue;
663 
664  for(size_t t = 0; t < trackView.size(); ++t){
665 
667 
668  // Draw track using only embedded information.
669  auto const& TPCClusters = fmc.at(t);
670 
671  DrawTPCCluster3D(TPCClusters, view, color, recoOpt->fTPCClusterMarker,
672  recoOpt->fTPCClusterMarkerSize);
673 
674  }
675 
676  int width = recoOpt->fTrackWidth;
677 
678  size_t icounter=0;
679  for (auto tv = trackView.begin(); tv != trackView.end(); ++tv)
680  {
681  int color = evd::kColor[icounter%evd::kNCOLS];
682 
683  // draw helices for 1, track trajectory points for 2
684 
685  if (recoOpt->fDrawTracks == 1 || ! fmt.isValid())
686  {
687  DrawHelix3D((*tv)->TrackParBeg(), (*tv)->Vertex()[0], (*tv)->End()[0], view, color, width);
688  DrawHelix3D((*tv)->TrackParEnd(), (*tv)->End()[0], (*tv)->Vertex()[0], view, color, width);
689  }
690  else if (recoOpt->fDrawTracks == 2)
691  {
692  DrawTrackPolyLine3D(fmt.at(icounter),view,color,width);
693  }
694 
695  DrawArrow3D((*tv)->Vertex(),(*tv)->VtxDir(),view,0);
696  DrawArrow3D((*tv)->End(),(*tv)->EndDir(),view,0);
697 
698  ++icounter;
699  }
700  }
701  }
702  return;
703  }
std::vector< art::InputTag > fTrackLabels
module labels that produced tracks
int GetTracks(art::Event const &evt, std::string const &which, art::View< rec::Track > &track)
auto end() noexcept
Definition: View.h:89
void DrawArrow3D(const float *startpos, const float *arrowvec, evdb::View3D *view, int color, float lengthscale=1.0)
void DrawTrackPolyLine3D(std::vector< const gar::rec::TrackTrajectory * > const &trajectories, evdb::View3D *view, int color, int width=2)
static const int kNCOLS
Definition: eventdisplay.h:12
auto begin() noexcept
Definition: View.h:83
void DrawTPCCluster3D(std::vector< const gar::rec::TPCCluster * > const &TPCClusters, evdb::View3D *view, int color, int marker=2, int size=2)
Definition: fwd.h:46
std::size_t color(std::string const &procname)
void DrawHelix3D(const float *trackpar, const float xpar, const float xother, evdb::View3D *view, int color, int width)
auto size() const noexcept
Definition: View.h:119
auto isValid() const noexcept
Definition: View.h:52
TCEvent evt
Definition: DataStructs.cxx:7
static const int kColor[kNCOLS]
Definition: eventdisplay.h:13
void gar::evd::RecoBaseDrawer::VecHit3D ( art::Event const &  evt,
evdb::View3D *  view 
)

Definition at line 738 of file RecoBaseDrawer.cxx.

740  {
743 
744  if(rawOpt->fDrawRawOrReco < 1) return;
745 
746  bool drawVecHit = (recoOpt->fDrawVecHits != 0);
747 
748  if(drawVecHit){
749  for(auto const& which : recoOpt->fVecHitLabels){
750  std::vector<const gar::rec::VecHit*> vhit;
751  this->GetVecHits(evt, which, vhit);
752  DrawVecHit3D(vhit, view);
753  } // loop on imod folders
754  }
755  }
int GetVecHits(art::Event const &evt, std::string const &which, std::vector< const rec::VecHit * > &vechits)
void DrawVecHit3D(std::vector< const rec::VecHit * > const &vechits, evdb::View3D *view, int color=6, int marker=28, int size=2)
TCEvent evt
Definition: DataStructs.cxx:7
void gar::evd::RecoBaseDrawer::Vertex3D ( art::Event const &  evt,
evdb::View3D *  view 
)

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