Public Member Functions | Private Member Functions | Private Attributes | List of all members
gar::evd3d::EventDisplay3D Class Reference
Inheritance diagram for gar::evd3d::EventDisplay3D:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 EventDisplay3D (fhicl::ParameterSet const &pset)
 
virtual ~EventDisplay3D ()
 
void beginJob () override
 
void endJob () override
 
void beginRun (const art::Run &run) override
 
void analyze (const art::Event &event) override
 
void reconfigure (fhicl::ParameterSet const &pset)
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

void makeNavPanel ()
 
void PickVolumes (TEveElementList *&list)
 
void UpdateHeader (const art::Event &event)
 
void DrawMCTruth (const art::Event &event)
 
void DrawMCTPCTruth (const art::Event &event)
 
void DrawMCCaloTruth (const art::Event &event)
 
void DrawRawHits (const art::Event &event)
 
void DrawRecoHits (const art::Event &event)
 
void DrawHighLevelReco (const art::Event &event)
 
void DrawTrack (const gar::rec::Track *trk, TEveElementList *&eve_list, int counter, bool forward)
 
void DrawTrackPolyLine3D (std::vector< const gar::rec::TrackTrajectory * > const &trajectories, TEveElementList *&eve_list, int counter)
 
void DrawTPCCluster3D (std::vector< const gar::rec::TPCCluster * > const &TPCClusters, TEveElementList *&eve_list)
 
void DrawIntersections (const gar::rec::Track *trk, TEveElementList *&fTrackList, int counter)
 
void DrawHelix3D (const float *trackpar, const float xpar, const float xother, TEveLine *&eve_track, int color)
 
void DrawArrow3D (const float *fVertex, const float *fDir, int color, TEveArrow *&arrow)
 
void GetSimTPCHits (std::vector< const sdp::EnergyDeposit * > &simTPC, const art::Event &event)
 
void GetSimCaloHits (std::vector< const sdp::CaloDeposit * > &simCalo, const art::Event &event)
 
void GetRawCaloHits (std::vector< const raw::CaloRawDigit * > &digitCalo, const art::Event &event)
 
void GetRecoCaloHits (std::vector< const rec::CaloHit * > &recoCalo, const art::Event &event)
 
void GetRecoMuIDHits (std::vector< const rec::CaloHit * > &recoMuID, const art::Event &event)
 
void GetCaloClusters (std::vector< const rec::Cluster * > &caloCluster, const art::Event &event)
 
void GetTracks (art::View< gar::rec::Track > &track, const art::Event &event)
 
void GetVertices (std::vector< const rec::Vertex * > &vertex, const art::Event &event)
 
void GetMCTruth (std::vector< const simb::MCTruth * > &mcvec, const art::Event &event)
 
void GetParticle (std::vector< const simb::MCParticle * > &plist, const art::Event &event)
 
void cleanEvt ()
 

Private Attributes

const fhicl::ParameterSet fParamSet
 
const gar::geo::GeometryCorefGeometry = gar::providerFrom<geo::GeometryGAr>()
 
const gar::detinfo::DetectorClocksfTime = gar::providerFrom<detinfo::DetectorClocksServiceGAr>()
 
const gar::detinfo::DetectorPropertiesfDetProp = gar::providerFrom<detinfo::DetectorPropertiesService>()
 
std::unique_ptr< evd3d::EventDisplay3DUtilsfEvtDisplayUtil
 
bool fDrawMCTPC
 
bool fDrawMCCaloTruth
 
bool fDrawECALRawHits
 
bool fDrawECALRecoHits
 
bool fDrawECALClusters
 
bool fDrawMuIDRecoHits
 
bool fDrawTracks
 
bool fDrawVertices
 
bool fDrawTPCClusters
 
bool fDrawMCTruth
 
bool fDrawNeutronTraj
 
std::string fG4Label
 module label that produced G4 hits More...
 
std::vector< std::stringfInstanceName
 
std::vector< std::stringfSimHitLabels
 module labels that produced sim hits More...
 
std::vector< std::stringfRawHitLabels
 module labels that produced raw hits More...
 
std::vector< std::stringfRecoECALHitLabels
 module labels that produced reco hits ecal More...
 
std::vector< std::stringfRecoMuIDHitLabels
 module labels that produced reco hits muid More...
 
std::vector< std::stringfCaloClusterLabels
 module labels that produced Calorimeter Clusters More...
 
std::vector< std::stringfTrackLabels
 module labels that produced tracks More...
 
std::vector< std::stringfVertexLabels
 module labels that produced vertices More...
 
std::vector< std::stringfVolumesToShow
 list of volumes to show in the Eve display More...
 
TGeoManager * fGeoManager
 
TEveManager * fEve
 
TGLViewer * glViewer
 
TGLAnnotation * ann
 
double origin [3] = {0., 0., 0.}
 
TGTextEntry * fTeRun
 
TGTextEntry * fTeEvt
 
TGLabel * fTlRun
 
TGLabel * fTlEvt
 
TEveElementList * fTPCSimHitList
 
TEveElementList * fTPCClusterList
 
TEveElementList * fCaloSimHitList
 
TEveElementList * fCaloRawHitList
 
TEveElementList * fCaloRecoHitList
 
TEveElementList * fCaloMuIDHitList
 
TEveElementList * fCaloClusterList
 
TEveElementList * fTrackList
 
TEveElementList * fVertexList
 
TEveElementList * fMCTrajectoryList
 
float fScalingfactor
 
bool fDrawIntersection
 
gar::geo::BitFieldCoderfFieldDecoder
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 125 of file EVD3D_module.cc.

Constructor & Destructor Documentation

gar::evd3d::EventDisplay3D::EventDisplay3D ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 279 of file EVD3D_module.cc.

279  :
280  art::EDAnalyzer(pset),
281  fEve(0),
282  fTeRun(0),
283  fTeEvt(0),
284  fTlRun(0),
285  fTlEvt(0),
286  fTPCSimHitList(0),
287  fTPCClusterList(0),
288  fCaloSimHitList(0),
289  fCaloRawHitList(0),
290  fCaloRecoHitList(0),
291  fCaloMuIDHitList(0),
292  fCaloClusterList(0),
293  fTrackList(0),
294  fVertexList(0),
296  fScalingfactor(1.0)
297  {
298  this->reconfigure(pset);
299 
300  fEvtDisplayUtil = std::make_unique<evd3d::EventDisplay3DUtils>();
301 
303  fGeoManager->DefaultColors();
304  }
std::unique_ptr< evd3d::EventDisplay3DUtils > fEvtDisplayUtil
TEveElementList * fMCTrajectoryList
TEveElementList * fCaloRawHitList
TEveElementList * fTPCClusterList
const gar::geo::GeometryCore * fGeometry
TGeoManager * ROOTGeoManager() const
Access to the ROOT geometry description manager.
TEveElementList * fCaloMuIDHitList
TEveElementList * fVertexList
void reconfigure(fhicl::ParameterSet const &pset)
TEveElementList * fCaloRecoHitList
TEveElementList * fTrackList
TEveElementList * fCaloSimHitList
TEveElementList * fCaloClusterList
TEveElementList * fTPCSimHitList
gar::evd3d::EventDisplay3D::~EventDisplay3D ( )
virtual

Definition at line 340 of file EVD3D_module.cc.

341  {
342  }

Member Function Documentation

void gar::evd3d::EventDisplay3D::analyze ( const art::Event event)
override

Definition at line 465 of file EVD3D_module.cc.

466  {
467  this->cleanEvt();
468 
469  this->UpdateHeader(event);
470 
471  // ... Update the run and event numbers in the TGTextEntry widgets in the Navigation panel
472  std::ostringstream sstr;
473  sstr << event.id().run();
474 
475  fEvtDisplayUtil->fTbRun->Clear();
476  fEvtDisplayUtil->fTbRun->AddText(0, sstr.str().c_str());
477  gClient->NeedRedraw(fTeRun);
478 
479  sstr.str("");
480  sstr << event.id().event();
481  fEvtDisplayUtil->fTbEvt->Clear();
482  fEvtDisplayUtil->fTbEvt->AddText(0, sstr.str().c_str());
483  gClient->NeedRedraw(fTeEvt);
484 
485  //Draw MCTruth
486  if(fDrawMCTruth)
487  this->DrawMCTruth(event);
488 
489  if(fDrawMCTPC)
490  this->DrawMCTPCTruth(event);
491 
492  //Draw MCTruth
493  if(fDrawMCCaloTruth)
494  this->DrawMCCaloTruth(event);
495 
496  //Draw raw hits
497  if(fDrawECALRawHits)
498  this->DrawRawHits(event);
499 
500  //Draw reco hits
502  this->DrawRecoHits(event);
503 
504  //Draw high level reco
505  // if(fDrawECALClusters || fDrawTracks || fDrawVertices)
506  this->DrawHighLevelReco(event);
507 
508  return;
509  } // end EventDisplay3D::EventDisplay3D::analyze
std::unique_ptr< evd3d::EventDisplay3DUtils > fEvtDisplayUtil
void DrawHighLevelReco(const art::Event &event)
void DrawRecoHits(const art::Event &event)
void DrawRawHits(const art::Event &event)
void DrawMCTPCTruth(const art::Event &event)
void UpdateHeader(const art::Event &event)
void DrawMCCaloTruth(const art::Event &event)
void DrawMCTruth(const art::Event &event)
void gar::evd3d::EventDisplay3D::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 415 of file EVD3D_module.cc.

416  {
417  // Initialize global Eve application manager (return gEve)
418  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
419  gROOT->SetBatch(kFALSE);
420  fEve = TEveManager::Create();
421 
422  TEveElementList* simple = new TEveElementList("simplifiedGeometry");
423  this->PickVolumes(simple);
424 
425  //Add the simplifiedGeometry
426  fEve->AddGlobalElement(simple);
427 
428  //Create the navigation panel
429  makeNavPanel();
430 
431  //Sets the GL viewer parameters
432  glViewer = fEve->GetDefaultGLViewer();
433  origin[0] = fGeometry->GetOriginX();
434  origin[1] = fGeometry->GetOriginY();
435  origin[2] = fGeometry->GetOriginZ();
436 
437  glViewer->ColorSet().Background().SetColor(kWhite);
438  glViewer->SetCurrentCamera(TGLViewer::kCameraPerspXOZ);
439  glViewer->SetGuideState(TGLUtil::kAxesEdge, kTRUE, kTRUE, origin);
440  glViewer->SetDrawCameraCenter(kTRUE);
441 
442  std::cout << "Drawing at reference (" << origin[0] << ", " << origin[1] << ", " << origin[2] << ")" << std::endl;
443 
444  ann = new TGLAnnotation(glViewer, "", 0.75, 0.85);
445  ann->SetRole(TGLOverlayElement::kViewer);
446  ann->SetUseColorSet(true);
447  ann->SetTextSize(0.04);// % of window diagonal
448  ann->SetTextAlign(TGLFont::kLeft);
449  ann->SetAllowClose(false);
450  ann->SetTextColor(kBlack);
451 
452  //Draw the display
453  fEve->Redraw3D(kTRUE);
454 
455  return;
456  }
float GetOriginX() const
Definition: GeometryCore.h:548
float GetOriginZ() const
Definition: GeometryCore.h:552
const gar::geo::GeometryCore * fGeometry
float GetOriginY() const
Definition: GeometryCore.h:550
QTextStream & endl(QTextStream &s)
void PickVolumes(TEveElementList *&list)
void gar::evd3d::EventDisplay3D::beginRun ( const art::Run run)
override

Definition at line 459 of file EVD3D_module.cc.

460  {
461  return;
462  }
void gar::evd3d::EventDisplay3D::cleanEvt ( )
private

Definition at line 512 of file EVD3D_module.cc.

513  {
514  //check if any element is present in the event and remove it
515  if(fEve->GetCurrentEvent() != nullptr)
516  fEve->GetCurrentEvent()->DestroyElements();
517  }
void gar::evd3d::EventDisplay3D::DrawArrow3D ( const float *  fVertex,
const float *  fDir,
int  color,
TEveArrow *&  arrow 
)
private

Definition at line 1400 of file EVD3D_module.cc.

1401  {
1402  //Draw arraw
1403  TVector3 cent(fGeometry->GetOriginX(), fGeometry->GetOriginY(), fGeometry->GetOriginZ());
1404  TVector3 spv(fVertex);
1405  TVector3 spcv = spv + cent;
1406  TVector3 av(fDir);
1407 
1408  arrow->SetOrigin(spcv.X(), spcv.Y(), spcv.Z());
1409  arrow->SetVector(av.X()*10, av.Y()*10, av.Z()*10);
1410  arrow->SetMainColor(color);
1411  arrow->SetTubeR(0.1);
1412  arrow->SetConeL(0.5);
1413  arrow->SetConeR(0.2);
1414 
1415  return;
1416  }
float GetOriginX() const
Definition: GeometryCore.h:548
float GetOriginZ() const
Definition: GeometryCore.h:552
const gar::geo::GeometryCore * fGeometry
float GetOriginY() const
Definition: GeometryCore.h:550
std::size_t color(std::string const &procname)
void gar::evd3d::EventDisplay3D::DrawHelix3D ( const float *  trackpar,
const float  xpar,
const float  xother,
TEveLine *&  eve_track,
int  color 
)
private

Definition at line 1362 of file EVD3D_module.cc.

1363  {
1364  float r = 0;
1365  if (trackpar[2] != 0) r=1.0/trackpar[2];
1366 
1367  float si = TMath::Tan(trackpar[4]);
1368  float ycc = trackpar[0] + r*TMath::Cos(trackpar[3]);
1369  float zcc = trackpar[1] - r*TMath::Sin(trackpar[3]);
1370  float dphimax = TMath::Pi();
1371  float phi1 = 0;
1372  float phi2 = (xother-xpar)*trackpar[2]/si;
1373 
1374  if (phi2-phi1>dphimax) phi2 = phi1+dphimax;
1375  if (phi2-phi1<-dphimax) phi2 = phi1-dphimax;
1376  if (phi2-phi1==0) phi2=phi1+0.01;
1377 
1378  int nptshelix=100;
1379  float dphihelix=(phi2-phi1)/((float) nptshelix);
1380 
1381  for (int ipoint=0;ipoint<nptshelix;++ipoint)
1382  {
1383  float philoc = phi1 + ipoint*dphihelix;
1384  float xl = xpar + r*si*(philoc);
1385  float yl = ycc - r*TMath::Cos(philoc + trackpar[3]);
1386  float zl = zcc + r*TMath::Sin(philoc + trackpar[3]);
1387 
1388  TVector3 point(xl, yl, zl);
1389  if(!fGeometry->PointInGArTPC(point)) continue;
1390 
1391  eve_track->SetPoint(ipoint, xl, yl, zl);
1392  }
1393 
1394  eve_track->SetLineWidth(2);
1395  eve_track->SetLineStyle(1);
1396  eve_track->SetLineColor(color);
1397  }
bool PointInGArTPC(TVector3 const &point) const
const gar::geo::GeometryCore * fGeometry
std::size_t color(std::string const &procname)
void gar::evd3d::EventDisplay3D::DrawHighLevelReco ( const art::Event event)
private

Definition at line 1038 of file EVD3D_module.cc.

1039  {
1040  if(fDrawECALClusters)
1041  {
1042  std::vector<const gar::rec::Cluster*> clusters;
1043  this->GetCaloClusters(clusters, event);
1044 
1045  fCaloClusterList = new TEveElementList("ECAL Clusters", "Clustered ECAL hits");
1046  fCaloClusterList->SetMainColor(kRed);
1047  fCaloClusterList->SetMainAlpha(1.0);
1048 
1049  for(unsigned int p = 0; p < clusters.size(); ++p)
1050  {
1051  const rec::Cluster* clus = clusters[p];
1052 
1053  auto const* pos = clus->Position();
1054  auto const* shape = clus->Shape();
1055  auto const* dir = clus->EigenVectors();
1056  // float length = clus->Energy(); // todo -- make the scale factor a fcl parameter
1057 
1058  //position of the 6 hit of that define the outline of the cluster in x, y, z
1059  float poslist[6][3];
1060 
1061  for (int i = 0; i < 3; ++i)
1062  {
1063  poslist[0][i] = pos[i] + (shape[0] * dir[i]) * fScalingfactor;
1064  poslist[1][i] = pos[i] - (shape[1] * dir[i]) * fScalingfactor;
1065 
1066  poslist[2][i] = pos[i] + (shape[2] * dir[3+i]) * fScalingfactor;
1067  poslist[3][i] = pos[i] - (shape[2] * dir[3+i]) * fScalingfactor;
1068 
1069  poslist[4][i] = pos[i] + (shape[3] * dir[6+i]) * fScalingfactor;
1070  poslist[5][i] = pos[i] - (shape[3] * dir[6+i]) * fScalingfactor;
1071  }
1072 
1073  std::ostringstream label;
1074  label << "Cluster " << p << "\n";
1075  label << "PID " << clus->ParticleID() << "\n";
1076  label << "Energy: " << clus->Energy() * 1000 << " MeV\n";
1077  label << "Position (" << clus->Position()[0] << ", " << clus->Position()[1] << ", " << clus->Position()[2] << " ) cm\n";
1078  label << "Shape: r_forw " << shape[0] << ", r_bck " << shape[1] << ", r2 " << shape[2] << ", r3 " << shape[3] << ", vol " << shape[4] << ", width " << shape[5];
1079 
1080  TEveLine *eve_r1cluster = new TEveLine(6);
1081  eve_r1cluster->SetName(TString::Format("ECAL cluster %i", p));
1082  eve_r1cluster->SetTitle(label.str().c_str());
1083  eve_r1cluster->SetLineWidth(2);
1084  eve_r1cluster->SetLineStyle(1);
1085  eve_r1cluster->SetLineColor(p%evd::kNCOLS);
1086  eve_r1cluster->SetPoint(0, poslist[0][0], poslist[0][1], poslist[0][2]);
1087  eve_r1cluster->SetPoint(1, poslist[1][0], poslist[1][1], poslist[1][2]);
1088  eve_r1cluster->SetPoint(2, poslist[2][0], poslist[2][1], poslist[2][2]);
1089  eve_r1cluster->SetPoint(3, poslist[3][0], poslist[3][1], poslist[3][2]);
1090  eve_r1cluster->SetPoint(4, poslist[4][0], poslist[4][1], poslist[4][2]);
1091  eve_r1cluster->SetPoint(5, poslist[5][0], poslist[5][1], poslist[5][2]);
1092 
1093  fCaloClusterList->AddElement(eve_r1cluster);
1094  }
1095 
1096  fEve->AddElement(fCaloClusterList);
1097  }
1098 
1099 
1100  art::View<gar::rec::Track> trackView;
1101  this->GetTracks(trackView, event);
1102  if(!trackView.isValid()) return;
1103 
1104  art::FindMany<gar::rec::TPCCluster> fmc(trackView, event, fTrackLabels.at(0));
1105  if(!fmc.isValid()) return;
1106 
1107  art::FindMany<gar::rec::TrackTrajectory> fmt(trackView, event, fTrackLabels.at(0));
1108 
1109  if(fDrawTPCClusters) {
1110 
1111  fTPCClusterList = new TEveElementList("TPC Clusters", "Reconstructed TPC Clusters");
1112  fTPCClusterList->SetMainColor(kRed);
1113  fTPCClusterList->SetMainAlpha(1.0);
1114 
1115  for(size_t t = 0; t < trackView.size(); ++t) {
1116  // Draw track using only embedded information.
1117  auto const& TPCClusters = fmc.at(t);
1118  this->DrawTPCCluster3D(TPCClusters, fTPCClusterList);
1119  }
1120 
1121  fEve->AddElement(fTPCClusterList);
1122  }
1123 
1124  if(fDrawTracks)
1125  {
1126  fTrackList = new TEveElementList("Fitted Tracks", "Tracks in the TPC");
1127  fTrackList->SetMainColor(kRed);
1128  fTrackList->SetMainAlpha(1.0);
1129 
1130  unsigned int icounter = 0;
1131  for (auto tv = trackView.begin(); tv != trackView.end(); ++tv)
1132  {
1133  if(!fmt.isValid()) {
1134  //Forward
1135  this->DrawTrack((*tv), fTrackList, icounter, true);
1136  //Backward
1137  this->DrawTrack((*tv), fTrackList, icounter, false);
1138  }
1139  else
1140  {
1141  this->DrawTrackPolyLine3D(fmt.at(icounter), fTrackList, icounter);
1142  }
1143 
1144  if(fDrawIntersection)
1145  this->DrawIntersections((*tv), fTrackList, icounter);
1146 
1147  ++icounter;
1148  }
1149 
1150  fEve->AddElement(fTrackList);
1151  }
1152 
1153  if(fDrawVertices)
1154  {
1155  std::vector<const gar::rec::Vertex*> vertexs;
1156  this->GetVertices(vertexs, event);
1157 
1158  fVertexList = new TEveElementList("Reconstructed vertex", "Reconstructed vertex");
1159  fVertexList->SetMainColor(kRed);
1160  fVertexList->SetMainAlpha(1.0);
1161 
1162  for(unsigned int p = 0; p < vertexs.size(); ++p)
1163  {
1164  const rec::Vertex* vx = vertexs[p];
1165 
1166  auto const* pos = vx->Position();
1167 
1168  TEvePointSet *evevx = new TEvePointSet(1);
1169  evevx->SetMarkerSize(1);
1170  evevx->SetMarkerStyle(20);
1171  evevx->SetMarkerColor(5);
1172  evevx->SetPoint(0, pos[0], pos[1], pos[2]);
1173 
1174  fVertexList->AddElement(evevx);
1175  }
1176 
1177  fEve->AddElement(fVertexList);
1178  }
1179  }
void DrawTrack(const gar::rec::Track *trk, TEveElementList *&eve_list, int counter, bool forward)
Format
Definition: utils.h:7
auto end() noexcept
Definition: View.h:89
void GetVertices(std::vector< const rec::Vertex * > &vertex, const art::Event &event)
string dir
TEveElementList * fTPCClusterList
static const int kNCOLS
Definition: eventdisplay.h:12
std::vector< std::string > fTrackLabels
module labels that produced tracks
auto begin() noexcept
Definition: View.h:83
void DrawIntersections(const gar::rec::Track *trk, TEveElementList *&fTrackList, int counter)
void GetCaloClusters(std::vector< const rec::Cluster * > &caloCluster, const art::Event &event)
p
Definition: test.py:223
Definition: fwd.h:46
TEveElementList * fVertexList
void DrawTrackPolyLine3D(std::vector< const gar::rec::TrackTrajectory * > const &trajectories, TEveElementList *&eve_list, int counter)
auto size() const noexcept
Definition: View.h:119
auto isValid() const noexcept
Definition: View.h:52
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
void DrawTPCCluster3D(std::vector< const gar::rec::TPCCluster * > const &TPCClusters, TEveElementList *&eve_list)
TEveElementList * fTrackList
void GetTracks(art::View< gar::rec::Track > &track, const art::Event &event)
TEveElementList * fCaloClusterList
void gar::evd3d::EventDisplay3D::DrawIntersections ( const gar::rec::Track trk,
TEveElementList *&  fTrackList,
int  counter 
)
private

Definition at line 1266 of file EVD3D_module.cc.

1267  {
1269  //Check the intersection with the ECAL Barrel
1270  float xyz_intersection[3] = {0., 0., 0.};
1271  float xyz_otherintersect[3];
1272 
1273  //Forward case. It is possible that one wants the 2nd intersection; that isn't coded up yet.
1275  fGeometry->TPCYCent(),fGeometry->TPCZCent(), xyz_intersection,xyz_otherintersect,
1277  std::ostringstream label;
1278 
1279  if(result == 0)
1280  {
1281  TEvePointSet *intersection1 = new TEvePointSet(1);
1282  intersection1->SetName(TString::Format("Track forward Calo Intersection Barrel %i", counter).Data());
1283  label << "Barrel Intersection forward - Track " << counter << "\n";
1284  label << "Position (" << xyz_intersection[0] << ", " << xyz_intersection[1] << ", " << xyz_intersection[2] << ") cm";
1285  intersection1->SetTitle(label.str().c_str());
1286  intersection1->SetMarkerSize(1.3);
1287  intersection1->SetMarkerStyle(22);
1288  intersection1->SetMarkerColor(color);
1289  intersection1->SetPoint(0, xyz_intersection[0], xyz_intersection[1], xyz_intersection[2]);//cm
1290  fTrackList_local->AddElement(intersection1);
1291  }
1292  else{
1293  //Try Endcap
1294  result = util::TrackPropagator::PropagateToX( trk->TrackParEnd(), trk->End(),
1295  (trk->End()[0] > 0) ? fGeometry->GetECALEndcapStartX() : -fGeometry->GetECALEndcapStartX(),
1296  xyz_intersection, fGeometry->GetECALOuterBarrelRadius() );
1297 
1298  if(result == 0)
1299  {
1300  TEvePointSet *intersection3 = new TEvePointSet(1);
1301  intersection3->SetName(TString::Format("Track forward Calo Intersection Endcap %i", counter).Data());
1302  label.str("");
1303  label.clear();
1304  label << "Endcap Intersection forward - Track " << counter << "\n";
1305  label << "Position (" << xyz_intersection[0] << ", " << xyz_intersection[1] << ", " << xyz_intersection[2] << ") cm";
1306  intersection3->SetTitle(label.str().c_str());
1307  intersection3->SetMarkerSize(1.3);
1308  intersection3->SetMarkerStyle(29);
1309  intersection3->SetMarkerColor(color);
1310  intersection3->SetPoint(0, xyz_intersection[0], xyz_intersection[1], xyz_intersection[2]);//cm
1311  fTrackList_local->AddElement(intersection3);
1312  }
1313  }
1314 
1315  //Backward case
1317  fGeometry->TPCYCent(),fGeometry->TPCZCent(), xyz_intersection,xyz_otherintersect,
1319 
1320  if(result == 0)
1321  {
1322  TEvePointSet *intersection2 = new TEvePointSet(1);
1323  intersection2->SetName(TString::Format("Track backward Calo Intersection Barrel %i", counter).Data());
1324  label.str("");
1325  label.clear();
1326  label << "Barrel Intersection backward - Track " << counter << "\n";
1327  label << "Position (" << xyz_intersection[0] << ", " << xyz_intersection[1] << ", " << xyz_intersection[2] << ") cm";
1328  intersection2->SetTitle(label.str().c_str());
1329  intersection2->SetMarkerSize(1.3);
1330  intersection2->SetMarkerStyle(23);
1331  intersection2->SetMarkerColor(color);
1332  intersection2->SetPoint(0, xyz_intersection[0], xyz_intersection[1], xyz_intersection[2]);//cm
1333  fTrackList_local->AddElement(intersection2);
1334  }
1335  else{
1336  //Try Endcap
1337  result = util::TrackPropagator::PropagateToX( trk->TrackParBeg(), trk->Vertex(),
1339  xyz_intersection, fGeometry->GetECALOuterBarrelRadius() );
1340 
1341  if(result == 0)
1342  {
1343  TEvePointSet *intersection4 = new TEvePointSet(1);
1344  intersection4->SetName(TString::Format("Track backward Calo Intersection Endcap %i", counter).Data());
1345  label.str("");
1346  label.clear();
1347  label << "Endcap Intersection backward - Track " << counter << "\n";
1348  label << "Position (" << xyz_intersection[0] << ", " << xyz_intersection[1] << ", " << xyz_intersection[2] << ") cm";
1349  intersection4->SetTitle(label.str().c_str());
1350  intersection4->SetMarkerSize(1.3);
1351  intersection4->SetMarkerStyle(29);
1352  intersection4->SetMarkerColor(color);
1353  intersection4->SetPoint(0, xyz_intersection[0], xyz_intersection[1], xyz_intersection[2]);//cm
1354  fTrackList_local->AddElement(intersection4);
1355  }
1356  }
1357 
1358  return;
1359  }
Format
Definition: utils.h:7
static QCString result
const float * TrackParBeg() const
Definition: Track.h:151
static const int kNCOLS
Definition: eventdisplay.h:12
const gar::geo::GeometryCore * fGeometry
const float * Vertex() const
Definition: Track.h:139
static int PropagateToX(const float *trackpar, const float *Xpoint, const float x, float *retXYZ, const float Rmax=0.0)
const float * TrackParEnd() const
Definition: Track.h:152
float TPCZCent() const
Returns the Z location of the center of the TPC in cm.
Definition: GeometryCore.h:792
static int PropagateToCylinder(const float *trackpar, const float *Xpoint, const float rCyl, const float yCyl, const float zCyl, float *retXYZ1, float *retXYZ2, const float Xmax=0.0, const float epsilon=2.0e-5)
const float * End() const
Definition: Track.h:140
float GetECALEndcapStartX() const
Definition: GeometryCore.h:975
float GetECALOuterBarrelRadius() const
Definition: GeometryCore.h:945
std::size_t color(std::string const &procname)
Fw2dFFT::Data Data
float TPCYCent() const
Returns the Y location of the center of the TPC in cm.
Definition: GeometryCore.h:785
float GetECALInnerBarrelRadius() const
Definition: GeometryCore.h:942
static const int kColor[kNCOLS]
Definition: eventdisplay.h:13
void gar::evd3d::EventDisplay3D::DrawMCCaloTruth ( const art::Event event)
private

Definition at line 878 of file EVD3D_module.cc.

879  {
880  std::vector<const sdp::CaloDeposit*> simlist;
881  this->GetSimCaloHits(simlist, event);
882 
883  fCaloSimHitList = new TEveElementList("ECAL Sim Calo Hits", "Simulated ECAL hits");
884  fCaloSimHitList->SetMainColor(kRed);
885  fCaloSimHitList->SetMainAlpha(1.0);
886 
887  for(unsigned int p = 0; p < simlist.size(); ++p)
888  {
889  const sdp::CaloDeposit* simHit = simlist[p];
890 
891  std::ostringstream label;
892  label << "ECAL/MuID Sim Hit " << p << "\n";
893  label << "Energy: " << simHit->Energy() << " GeV\n";
894  label << "Position (" << simHit->X() << ", " << simHit->Y() << ", " << simHit->Z() << " ) cm\n";
895  label << "CellID: " << simHit->CellID() << "\n";
896  // label << "isTile: " << fGeometry->isTile(simHit->CellID()) << "\n";
897  // label << "DetID: " << fFieldDecoder->get(simHit->CellID(), "system") << "\n";
898  // label << "Stave: " << fFieldDecoder->get(simHit->CellID(), "stave") << "\n";
899  // label << "Module: " << fFieldDecoder->get(simHit->CellID(), "module") << "\n";
900  // label << "Layer: " << fFieldDecoder->get(simHit->CellID(), "layer") << "\n";
901  // label << "Slice: " << fFieldDecoder->get(simHit->CellID(), "slice");
902 
903  TEvePointSet *evehit = new TEvePointSet(1);
904  evehit->SetName(TString::Format("ECAL sim hit %i", p).Data());
905  evehit->SetTitle(label.str().c_str());
906  evehit->SetMarkerSize(1);
907  evehit->SetMarkerStyle(20);
908  evehit->SetMarkerColor(fEvtDisplayUtil->LogColor(simHit->Energy(), 0, 1., 5));
909  evehit->SetPoint(0, simHit->X(), simHit->Y(), simHit->Z());//cm
910  fCaloSimHitList->AddElement(evehit);
911  }
912 
913  fEve->AddElement(fCaloSimHitList);
914  }
std::unique_ptr< evd3d::EventDisplay3DUtils > fEvtDisplayUtil
Format
Definition: utils.h:7
p
Definition: test.py:223
Fw2dFFT::Data Data
void GetSimCaloHits(std::vector< const sdp::CaloDeposit * > &simCalo, const art::Event &event)
TEveElementList * fCaloSimHitList
void gar::evd3d::EventDisplay3D::DrawMCTPCTruth ( const art::Event event)
private

Definition at line 846 of file EVD3D_module.cc.

847  {
848  std::vector<const sdp::EnergyDeposit*> simlist;
849  this->GetSimTPCHits(simlist, event);
850 
851  fTPCSimHitList = new TEveElementList("TPC Hits", "Simulated TPC hits");
852  fTPCSimHitList->SetMainColor(kRed);
853  fTPCSimHitList->SetMainAlpha(1.0);
854 
855  for(unsigned int p = 0; p < simlist.size(); ++p)
856  {
857  const sdp::EnergyDeposit* simHit = simlist[p];
858 
859  std::ostringstream label;
860  label << "TPC Sim Hit " << p << "\n";
861  label << "Energy: " << simHit->Energy() << " GeV\n";
862  label << "Position (" << simHit->X() << ", " << simHit->Y() << ", " << simHit->Z() << " ) cm\n";
863 
864  TEvePointSet *evehit = new TEvePointSet(1);
865  evehit->SetName(TString::Format("TPC sim hit %i", p).Data());
866  evehit->SetTitle(label.str().c_str());
867  evehit->SetMarkerSize(1);
868  evehit->SetMarkerStyle(1);
869  evehit->SetMarkerColor(fEvtDisplayUtil->LogColor(simHit->Energy(), 0, 1., 5));
870  evehit->SetPoint(0, simHit->X(), simHit->Y(), simHit->Z());//cm
871  fTPCSimHitList->AddElement(evehit);
872  }
873 
874  fEve->AddElement(fTPCSimHitList);
875  }
std::unique_ptr< evd3d::EventDisplay3DUtils > fEvtDisplayUtil
Format
Definition: utils.h:7
p
Definition: test.py:223
Fw2dFFT::Data Data
void GetSimTPCHits(std::vector< const sdp::EnergyDeposit * > &simTPC, const art::Event &event)
TEveElementList * fTPCSimHitList
void gar::evd3d::EventDisplay3D::DrawMCTruth ( const art::Event event)
private

Definition at line 726 of file EVD3D_module.cc.

727  {
728  // Define a couple of colors for neutrals and if we gray it out...
729  int neutralColor(12);
730  int neutrinoColor(38);
731 
732  std::vector<const simb::MCParticle*> plist;
733  this->GetParticle(plist, event);
734 
735  fMCTrajectoryList = new TEveElementList("g4Trajectories", "Geant4 Trajectories");
736  fMCTrajectoryList->SetMainColor(kRed);
737  fMCTrajectoryList->SetMainAlpha(1.0);
738 
739  double minPartEnergy(0.01);
740 
741  for(unsigned int p = 0; p < plist.size(); ++p)
742  {
743  // Is there an associated McTrajectory?
744  const simb::MCParticle* mcPart = plist[p];
745  const simb::MCTrajectory& mcTraj = mcPart->Trajectory();
746 
747  int pdgCode(mcPart->PdgCode());
748  int colorIdx(evd::Style::ColorFromPDG(mcPart->PdgCode()));
749  TParticlePDG* partPDG(TDatabasePDG::Instance()->GetParticle(pdgCode));
750  double partCharge = partPDG ? partPDG->Charge() : 0.;
751  double partEnergy = mcPart->E();
752 
753  if(nullptr == partPDG) continue;
754  if(pdgCode == 2112 && not fDrawNeutronTraj) continue;
755 
756  if (!mcTraj.empty() && partEnergy > minPartEnergy)
757  {
758  // collect the points from this particle
759  int numTrajPoints = mcTraj.size();
760 
761  std::ostringstream label;
762  label << "Particle pdg " << pdgCode << "\n";
763  label << "Charge: " << partCharge << "\n";
764  label << "Energy: " << partEnergy << " GeV\n";
765  label << "Momentum (" << mcPart->Px() << ", " << mcPart->Py() << ", " << mcPart->Pz() << " )";
766 
767  TEveLine *MCtrack = new TEveLine(numTrajPoints);
768  MCtrack->SetName("MC trajectory");
769  MCtrack->SetTitle(label.str().c_str());
770  if (partCharge == 0.){
771  MCtrack->SetLineColor(neutralColor);
772  MCtrack->SetLineWidth(2);
773  MCtrack->SetLineStyle(3);
774  }
775  else{
776  MCtrack->SetLineColor(colorIdx);
777  MCtrack->SetLineWidth(2);
778  MCtrack->SetLineStyle(1);
779  }
780 
781  for(int hitIdx = 0; hitIdx < numTrajPoints; hitIdx++)
782  {
783  double xPos = mcTraj.X(hitIdx);
784  double yPos = mcTraj.Y(hitIdx);
785  double zPos = mcTraj.Z(hitIdx);
786 
787  // If the original simulated hit did not occur in the enclosure volume then don't draw it
788  TVector3 point(xPos, yPos, zPos);
789  // if (!fGeometry->PointInMPD(point)) continue;
790 
791  MCtrack->SetPoint(hitIdx, xPos, yPos, zPos);
792  }
793 
794  fMCTrajectoryList->AddElement(MCtrack);
795  }
796  }
797 
798  // Finally, let's see if we can draw the incoming particle from the MCTruth information
799  std::vector<const simb::MCTruth*> mctruth;
800  this->GetMCTruth(mctruth, event);
801 
802  // Loop through the MCTruth vector
803  for (unsigned int idx = 0; idx < mctruth.size(); idx++)
804  {
805  // Go through each MCTruth object in the list
806  for (int particleIdx = 0; particleIdx < mctruth[idx]->NParticles(); particleIdx++)
807  {
808  const simb::MCParticle& mcPart = mctruth[idx]->GetParticle(particleIdx);
809 
810  // A negative mother id indicates the "primary" particle
811  if(mcPart.Mother() == -1 && mcPart.StatusCode() == 0)
812  {
813  mf::LogDebug("EVD3D") << mcPart << std::endl;
814 
815  // Get position vector
816  TVector3 particlePosition(mcPart.Vx(), mcPart.Vy(), mcPart.Vz());
817 
818  // Get direction vector (in opposite direction)
819  TVector3 oppPartDir(-mcPart.Px(), -mcPart.Py(), -mcPart.Pz());
820 
821  if (oppPartDir.Mag2() > 0.) oppPartDir.SetMag(1.);
822 
823  double arcLenToDraw = 50.0; // always draw 50 cm of neutrinos
824 
825  // Draw the line, use an off color to be unique
826  TEveLine *motherPart = new TEveLine(2);
827  motherPart->SetLineColor(neutrinoColor);
828  motherPart->SetLineWidth(2);
829  motherPart->SetLineStyle(2);
830 
831  motherPart->SetPoint(0, particlePosition.X(), particlePosition.Y(), particlePosition.Z());
832  particlePosition += std::min(arcLenToDraw + 10., 1000.) * oppPartDir;
833  motherPart->SetPoint(1,particlePosition.X(), particlePosition.Y(), particlePosition.Z());
834 
835  fMCTrajectoryList->AddElement(motherPart);
836  }
837  // The particles we want to draw will be early in the list so break out if we didn't find them
838  else break;
839  } // loop on particles in list
840  }
841 
842  fEve->AddElement(fMCTrajectoryList);
843  }
double E(const int i=0) const
Definition: MCParticle.h:233
double Z(const size_type i) const
Definition: MCTrajectory.h:151
double X(const size_type i) const
Definition: MCTrajectory.h:149
int PdgCode() const
Definition: MCParticle.h:212
double Py(const int i=0) const
Definition: MCParticle.h:231
TEveElementList * fMCTrajectoryList
const simb::MCTrajectory & Trajectory() const
Definition: MCParticle.h:253
int Mother() const
Definition: MCParticle.h:213
double Px(const int i=0) const
Definition: MCParticle.h:230
int StatusCode() const
Definition: MCParticle.h:211
bool empty() const
Definition: MCTrajectory.h:167
void GetMCTruth(std::vector< const simb::MCTruth * > &mcvec, const art::Event &event)
double Y(const size_type i) const
Definition: MCTrajectory.h:150
static int ColorFromPDG(int pdgcode)
Definition: Style.cxx:67
void GetParticle(std::vector< const simb::MCParticle * > &plist, const art::Event &event)
p
Definition: test.py:223
double Vx(const int i=0) const
Definition: MCParticle.h:221
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
size_type size() const
Definition: MCTrajectory.h:166
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
double Pz(const int i=0) const
Definition: MCParticle.h:232
double Vz(const int i=0) const
Definition: MCParticle.h:223
double Vy(const int i=0) const
Definition: MCParticle.h:222
QTextStream & endl(QTextStream &s)
void gar::evd3d::EventDisplay3D::DrawRawHits ( const art::Event event)
private

Definition at line 917 of file EVD3D_module.cc.

918  {
919  std::vector<const raw::CaloRawDigit*> rawlist;
920  this->GetRawCaloHits(rawlist, event);
921 
922  fCaloRawHitList = new TEveElementList("ECAL Raw Calo Hits", "Digitized ECAL hits");
923  fCaloRawHitList->SetMainColor(kRed);
924  fCaloRawHitList->SetMainAlpha(1.0);
925 
926  for(unsigned int p = 0; p < rawlist.size(); ++p)
927  {
928  const raw::CaloRawDigit* rawHit = rawlist[p];
929  const std::array<double, 3> point = { rawHit->X(), rawHit->Y(), rawHit->Z() };
930 
931  std::ostringstream label;
932  label << "ECAL/MuID Digi Hit " << p << "\n";
933  label << "Energy: " << rawHit->ADC().first << " ADC\n";
934  label << "Position (" << rawHit->X() << ", " << rawHit->Y() << ", " << rawHit->Z() << " ) cm\n";
935  label << "CellID: " << rawHit->CellID() << "\n";
936  label << "isTile: " << fGeometry->isTile(point, rawHit->CellID()) << "\n";
937  label << "DetID: " << fFieldDecoder->get(rawHit->CellID(), "system") << "\n";
938  label << "Stave: " << fFieldDecoder->get(rawHit->CellID(), "stave") << "\n";
939  label << "Module: " << fFieldDecoder->get(rawHit->CellID(), "module") << "\n";
940  label << "Layer: " << fFieldDecoder->get(rawHit->CellID(), "layer") << "\n";
941  label << "Slice: " << fFieldDecoder->get(rawHit->CellID(), "slice");
942 
943  TEvePointSet *evehit = new TEvePointSet(1);
944  evehit->SetName(TString::Format("ECAL digi hit %i", p).Data());
945  evehit->SetTitle(label.str().c_str());
946  evehit->SetMarkerSize(1);
947  evehit->SetMarkerStyle(20);
948  evehit->SetMarkerColor(fEvtDisplayUtil->LogColor(rawHit->ADC().first, 0, 4096, 5));
949  evehit->SetPoint(0, rawHit->X(), rawHit->Y(), rawHit->Z());//cm
950  fCaloRawHitList->AddElement(evehit);
951  }
952 
953  fEve->AddElement(fCaloRawHitList);
954  }
std::unique_ptr< evd3d::EventDisplay3DUtils > fEvtDisplayUtil
Format
Definition: utils.h:7
gar::geo::BitFieldCoder * fFieldDecoder
TEveElementList * fCaloRawHitList
bool isTile(const std::array< double, 3 > &point, const gar::raw::CellID_t &cID) const
const gar::geo::GeometryCore * fGeometry
void GetRawCaloHits(std::vector< const raw::CaloRawDigit * > &digitCalo, const art::Event &event)
p
Definition: test.py:223
Fw2dFFT::Data Data
long64 get(long64 bitfield, size_t index) const
void gar::evd3d::EventDisplay3D::DrawRecoHits ( const art::Event event)
private

Definition at line 957 of file EVD3D_module.cc.

958  {
959  std::vector<const rec::CaloHit*> recolist;
960  this->GetRecoCaloHits(recolist, event);
961 
962  fCaloRecoHitList = new TEveElementList("ECAL Reco Calo Hits", "Reconstructed ECAL hits");
963  fCaloRecoHitList->SetMainColor(kRed);
964  fCaloRecoHitList->SetMainAlpha(1.0);
965 
966  for(unsigned int p = 0; p < recolist.size(); ++p)
967  {
968  const rec::CaloHit* recoHit = recolist[p];
969  const std::array<double, 3> point = { recoHit->Position()[0], recoHit->Position()[1], recoHit->Position()[2] };
970 
971  std::ostringstream label;
972  label << "ECAL Reco Hit " << p << "\n";
973  label << "Energy: " << recoHit->Energy() * 1000 << " MeV\n";
974  label << "Position (" << recoHit->Position()[0] << ", " << recoHit->Position()[1] << ", " << recoHit->Position()[2] << " ) cm\n";
975  label << "CellID: " << recoHit->CellID() << "\n";
976  label << "isTile: " << fGeometry->isTile(point, recoHit->CellID()) << "\n";
977  label << "DetID: " << fFieldDecoder->get(recoHit->CellID(), "system") << "\n";
978  label << "Stave: " << fFieldDecoder->get(recoHit->CellID(), "stave") << "\n";
979  label << "Module: " << fFieldDecoder->get(recoHit->CellID(), "module") << "\n";
980  label << "Layer: " << fFieldDecoder->get(recoHit->CellID(), "layer") << "\n";
981  label << "Slice: " << fFieldDecoder->get(recoHit->CellID(), "slice");
982 
983  TEvePointSet *evehit = new TEvePointSet(1);
984  evehit->SetName(TString::Format("ECAL reco hit %i", p));
985  evehit->SetTitle(label.str().c_str());
986  evehit->SetMarkerSize(1);
987  evehit->SetMarkerStyle(20);
988  evehit->SetMarkerColor(fEvtDisplayUtil->LogColor(recoHit->Energy() * 1000, 0, 1000, 5));
989  evehit->SetPoint(0, recoHit->Position()[0], recoHit->Position()[1], recoHit->Position()[2]);//cm
990 
991  fCaloRecoHitList->AddElement(evehit);
992  }
993 
994  fEve->AddElement(fCaloRecoHitList);
995 
996  //MuID hits
997  if(fGeometry->HasMuonDetector()) {
998  recolist.clear();
999  this->GetRecoMuIDHits(recolist, event);
1000 
1001  fCaloMuIDHitList = new TEveElementList("MuID Reco Hits", "Reconstructed MuID hits");
1002  fCaloMuIDHitList->SetMainColor(kRed);
1003  fCaloMuIDHitList->SetMainAlpha(1.0);
1004 
1005  for(unsigned int p = 0; p < recolist.size(); ++p)
1006  {
1007  const rec::CaloHit* recoHit = recolist[p];
1008  const std::array<double, 3> point = { recoHit->Position()[0], recoHit->Position()[1], recoHit->Position()[2] };
1009 
1010  std::ostringstream label;
1011  label << "MuID Reco Hit " << p << "\n";
1012  label << "Energy: " << recoHit->Energy() * 1000 << " MeV\n";
1013  label << "Position (" << recoHit->Position()[0] << ", " << recoHit->Position()[1] << ", " << recoHit->Position()[2] << " ) cm\n";
1014  label << "CellID: " << recoHit->CellID() << "\n";
1015  label << "isTile: " << fGeometry->isTile(point, recoHit->CellID()) << "\n";
1016  label << "DetID: " << fFieldDecoder->get(recoHit->CellID(), "system") << "\n";
1017  label << "Stave: " << fFieldDecoder->get(recoHit->CellID(), "stave") << "\n";
1018  label << "Module: " << fFieldDecoder->get(recoHit->CellID(), "module") << "\n";
1019  label << "Layer: " << fFieldDecoder->get(recoHit->CellID(), "layer") << "\n";
1020  label << "Slice: " << fFieldDecoder->get(recoHit->CellID(), "slice");
1021 
1022  TEvePointSet *evehit = new TEvePointSet(1);
1023  evehit->SetName(TString::Format("MuID reco hit %i", p));
1024  evehit->SetTitle(label.str().c_str());
1025  evehit->SetMarkerSize(1);
1026  evehit->SetMarkerStyle(20);
1027  evehit->SetMarkerColor(fEvtDisplayUtil->LogColor(recoHit->Energy() * 1000, 0, 1000, 5));
1028  evehit->SetPoint(0, recoHit->Position()[0], recoHit->Position()[1], recoHit->Position()[2]);//cm
1029 
1030  fCaloMuIDHitList->AddElement(evehit);
1031  }
1032 
1033  fEve->AddElement(fCaloMuIDHitList);
1034  }
1035  }
std::unique_ptr< evd3d::EventDisplay3DUtils > fEvtDisplayUtil
Format
Definition: utils.h:7
gar::geo::BitFieldCoder * fFieldDecoder
bool isTile(const std::array< double, 3 > &point, const gar::raw::CellID_t &cID) const
void GetRecoCaloHits(std::vector< const rec::CaloHit * > &recoCalo, const art::Event &event)
const gar::geo::GeometryCore * fGeometry
p
Definition: test.py:223
TEveElementList * fCaloMuIDHitList
TEveElementList * fCaloRecoHitList
long64 get(long64 bitfield, size_t index) const
bool HasMuonDetector() const
Definition: GeometryCore.h:999
void GetRecoMuIDHits(std::vector< const rec::CaloHit * > &recoMuID, const art::Event &event)
void gar::evd3d::EventDisplay3D::DrawTPCCluster3D ( std::vector< const gar::rec::TPCCluster * > const &  TPCClusters,
TEveElementList *&  eve_list 
)
private

Definition at line 1242 of file EVD3D_module.cc.

1243  {
1244  unsigned int idx = 0;
1245  for(auto itr : TPCClusters)
1246  {
1247  std::ostringstream label;
1248  label << "TPC Cluster " << idx << "\n";
1249  label << "Energy: " << itr->Signal() << " pe\n";
1250  label << "Position (" << itr->Position()[0] << ", " << itr->Position()[1] << ", " << itr->Position()[2] << " ) cm";
1251 
1252  TEvePointSet *evehit = new TEvePointSet(1);
1253  evehit->SetName(TString::Format("TPC Cluster %i", idx));
1254  evehit->SetTitle(label.str().c_str());
1255  evehit->SetMarkerSize(1);
1256  evehit->SetMarkerStyle(20);
1257  evehit->SetMarkerColor(fEvtDisplayUtil->LogColor(itr->Signal(), 0, 1000, 5));
1258  evehit->SetPoint(0, itr->Position()[0], itr->Position()[1], itr->Position()[2]);//cm
1259 
1260  eve_list->AddElement(evehit);
1261  idx++;
1262  }
1263  }
std::unique_ptr< evd3d::EventDisplay3DUtils > fEvtDisplayUtil
Format
Definition: utils.h:7
void gar::evd3d::EventDisplay3D::DrawTrack ( const gar::rec::Track trk,
TEveElementList *&  eve_list,
int  counter,
bool  forward 
)
private

Definition at line 1182 of file EVD3D_module.cc.

1183  {
1185 
1186  const float *fTrackpar = (forward == true) ? trk->TrackParBeg() : trk->TrackParEnd();
1187  const float fStartX = (forward == true) ? trk->Vertex()[0] : trk->End()[0];
1188  const float fEndX = (forward == true) ? trk->End()[0] : trk->Vertex()[0];
1189  const float fMomentum = (forward == true) ? trk->Momentum_beg() : trk->Momentum_end();
1190  TString trackname = (forward == true) ? TString::Format("Track Fit forward %i", counter) : TString::Format("Track Fit backward %i", counter);
1191 
1192  TEveLine *eve_track = new TEveLine();
1193  this->DrawHelix3D(fTrackpar, fStartX, fEndX, eve_track, color);
1194 
1195  eve_track->SetName(trackname.Data());
1196  std::ostringstream label;
1197  label << "Track " << counter << "\n";
1198  label << "Vertex (" << trk->Vertex()[0] << ", " << trk->Vertex()[1] << ", " << trk->Vertex()[2] << ") cm\n";
1199  label << "End (" << trk->End()[0] << ", " << trk->End()[1] << ", " << trk->End()[2] << ") cm\n";
1200  label << "Omega " << fTrackpar[2] << "\n";
1201  label << "phi " << fTrackpar[3] << "\n";
1202  label << "TanLambda " << std::tan(fTrackpar[4]) << "\n";
1203  label << "Momentum " << fMomentum << " GeV\n";
1204  label << "Charge " << fTrackpar[2] / std::fabs(fTrackpar[2]);
1205  eve_track->SetTitle(label.str().c_str());
1206 
1207  const float *fVertex = (forward == true) ? trk->Vertex() : trk->End();
1208  const float *fDir = (forward == true) ? trk->VtxDir() : trk->EndDir();
1209 
1210  TEveArrow *arrow = new TEveArrow();
1211  this->DrawArrow3D(fVertex, fDir, color, arrow);
1212 
1213  eve_list->AddElement(eve_track);
1214  eve_list->AddElement(arrow);
1215 
1216  return;
1217  }
float const & Momentum_beg() const
Definition: Track.h:146
Format
Definition: utils.h:7
const float * TrackParBeg() const
Definition: Track.h:151
void DrawHelix3D(const float *trackpar, const float xpar, const float xother, TEveLine *&eve_track, int color)
const float * VtxDir() const
Definition: Track.h:141
static const int kNCOLS
Definition: eventdisplay.h:12
const float * Vertex() const
Definition: Track.h:139
const float * TrackParEnd() const
Definition: Track.h:152
void DrawArrow3D(const float *fVertex, const float *fDir, int color, TEveArrow *&arrow)
const float * End() const
Definition: Track.h:140
std::size_t color(std::string const &procname)
float const & Momentum_end() const
Definition: Track.h:147
static const int kColor[kNCOLS]
Definition: eventdisplay.h:13
const float * EndDir() const
Definition: Track.h:142
void gar::evd3d::EventDisplay3D::DrawTrackPolyLine3D ( std::vector< const gar::rec::TrackTrajectory * > const &  trajectories,
TEveElementList *&  eve_list,
int  counter 
)
private

Definition at line 1220 of file EVD3D_module.cc.

1221  {
1223 
1224  for (auto itr : trajectories) // there should only be one
1225  {
1226  std::vector<TVector3> ftraj = itr->getFWDTrajectory(); // later -- decide if we need the backward one too
1227  TEveLine* tpoly = new TEveLine();
1228  tpoly->SetLineColor(color);
1229  tpoly->SetLineWidth(2);
1230  tpoly->SetLineStyle(1);
1231 
1232  for (size_t i=0; i<ftraj.size(); ++i)
1233  tpoly->SetPoint(i, ftraj.at(i).X(), ftraj.at(i).Y(), ftraj.at(i).Z());
1234 
1235  eve_list->AddElement(tpoly);
1236  }
1237 
1238  return;
1239  }
static const int kNCOLS
Definition: eventdisplay.h:12
std::size_t color(std::string const &procname)
static const int kColor[kNCOLS]
Definition: eventdisplay.h:13
void gar::evd3d::EventDisplay3D::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 520 of file EVD3D_module.cc.

520  {
521 
522  }
void gar::evd3d::EventDisplay3D::GetCaloClusters ( std::vector< const rec::Cluster * > &  caloCluster,
const art::Event event 
)
private

Definition at line 1508 of file EVD3D_module.cc.

1509  {
1510  caloCluster.clear();
1511 
1512  std::vector<const gar::rec::Cluster*> temp;
1513 
1514  try{
1515  event.getView(fCaloClusterLabels.at(0), temp);
1516  for(size_t t = 0; t < temp.size(); ++t){
1517  caloCluster.push_back(temp[t]);
1518  }
1519  }
1520  catch(cet::exception& e){
1521  writeErrMsg("GetCaloClusters", e);
1522  }
1523 
1524  return;
1525  }
std::vector< std::string > fCaloClusterLabels
module labels that produced Calorimeter Clusters
const double e
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void gar::evd3d::EventDisplay3D::GetMCTruth ( std::vector< const simb::MCTruth * > &  mcvec,
const art::Event event 
)
private

Definition at line 1561 of file EVD3D_module.cc.

1562  {
1563  mcvec.clear();
1564 
1565  if( event.isRealData() ) return;
1566 
1567  std::vector<const simb::MCTruth*> temp;
1568  // use get by Type because there should only be one collection of these in the event
1569  try
1570  {
1571  auto mctcol = event.getMany<std::vector<simb::MCTruth> >();
1572  for(size_t mctc = 0; mctc < mctcol.size(); ++mctc)
1573  {
1574  art::Handle< std::vector<simb::MCTruth> > mclistHandle = mctcol[mctc];
1575  for(size_t i = 0; i < mclistHandle->size(); ++i)
1576  temp.push_back(&(mclistHandle->at(i)));
1577  }
1578 
1579  temp.swap(mcvec);
1580  }
1581  catch(cet::exception& e){
1582  writeErrMsg("GetMCTruth", e);
1583  }
1584 
1585  return;
1586  }
bool isRealData() const
const double e
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void gar::evd3d::EventDisplay3D::GetParticle ( std::vector< const simb::MCParticle * > &  plist,
const art::Event event 
)
private

Definition at line 1589 of file EVD3D_module.cc.

1590  {
1591  plist.clear();
1592 
1593  if( event.isRealData() ) return;
1594 
1595  std::vector<const simb::MCParticle*> temp;
1597  // use get by Type because there should only be one collection of these in the event
1598  try
1599  {
1600  event.getView(fG4Label, plcol);
1601  for(unsigned int i = 0; i < plcol.vals().size(); ++i)
1602  temp.push_back(plcol.vals().at(i));
1603 
1604  temp.swap(plist);
1605  }
1606  catch(cet::exception& e){
1607  writeErrMsg("GetParticle", e);
1608  }
1609 
1610  return;
1611  }
auto & vals() noexcept
Definition: View.h:68
bool isRealData() const
const double e
Definition: fwd.h:46
std::string fG4Label
module label that produced G4 hits
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void gar::evd3d::EventDisplay3D::GetRawCaloHits ( std::vector< const raw::CaloRawDigit * > &  digitCalo,
const art::Event event 
)
private

Definition at line 1455 of file EVD3D_module.cc.

1456  {
1457  digitCalo.clear();
1458  std::vector<const raw::CaloRawDigit*> tempCalo;
1459 
1460  try
1461  {
1462  for(unsigned int i = 0; i < fInstanceName.size(); i++) {
1463  event.getView(fRawHitLabels.at(0), fInstanceName.at(i), tempCalo);
1464  for(size_t t = 0; t < tempCalo.size(); ++t)
1465  digitCalo.push_back(tempCalo[t]);
1466  }
1467  }
1468  catch(cet::exception& e){
1469  writeErrMsg("GetDigits Calo", e);
1470  }
1471  }
std::vector< std::string > fRawHitLabels
module labels that produced raw hits
const double e
std::vector< std::string > fInstanceName
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void gar::evd3d::EventDisplay3D::GetRecoCaloHits ( std::vector< const rec::CaloHit * > &  recoCalo,
const art::Event event 
)
private

Definition at line 1474 of file EVD3D_module.cc.

1475  {
1476  recoCalo.clear();
1477  std::vector<const rec::CaloHit*> tempCalo;
1478 
1479  try
1480  {
1481  event.getView(fRecoECALHitLabels.at(0), "ECAL", tempCalo);
1482  for(size_t t = 0; t < tempCalo.size(); ++t)
1483  recoCalo.push_back(tempCalo[t]);
1484  }
1485  catch(cet::exception& e){
1486  writeErrMsg("GetHits Calo", e);
1487  }
1488  }
std::vector< std::string > fRecoECALHitLabels
module labels that produced reco hits ecal
const double e
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void gar::evd3d::EventDisplay3D::GetRecoMuIDHits ( std::vector< const rec::CaloHit * > &  recoMuID,
const art::Event event 
)
private

Definition at line 1491 of file EVD3D_module.cc.

1492  {
1493  recoMuID.clear();
1494  std::vector<const rec::CaloHit*> tempMuID;
1495 
1496  try
1497  {
1498  event.getView(fRecoMuIDHitLabels.at(0), "MuID", tempMuID);
1499  for(size_t t = 0; t < tempMuID.size(); ++t)
1500  recoMuID.push_back(tempMuID[t]);
1501  }
1502  catch(cet::exception& e){
1503  writeErrMsg("GetHits MuID", e);
1504  }
1505  }
const double e
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::vector< std::string > fRecoMuIDHitLabels
module labels that produced reco hits muid
void gar::evd3d::EventDisplay3D::GetSimCaloHits ( std::vector< const sdp::CaloDeposit * > &  simCalo,
const art::Event event 
)
private

Definition at line 1436 of file EVD3D_module.cc.

1437  {
1438  simCalo.clear();
1439  std::vector<const sdp::CaloDeposit*> tempCalo;
1440 
1441  try
1442  {
1443  for(unsigned int i = 0; i < fInstanceName.size(); i++) {
1444  event.getView(fG4Label, fInstanceName.at(i), tempCalo);
1445  for(size_t t = 0; t < tempCalo.size(); ++t)
1446  simCalo.push_back(tempCalo[t]);
1447  }
1448  }
1449  catch(cet::exception& e){
1450  writeErrMsg("GetSim Calo", e);
1451  }
1452  }
const double e
std::vector< std::string > fInstanceName
std::string fG4Label
module label that produced G4 hits
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void gar::evd3d::EventDisplay3D::GetSimTPCHits ( std::vector< const sdp::EnergyDeposit * > &  simTPC,
const art::Event event 
)
private

Definition at line 1419 of file EVD3D_module.cc.

1420  {
1421  simTPC.clear();
1422  std::vector<const sdp::EnergyDeposit*> tempTPC;
1423 
1424  try
1425  {
1426  event.getView(fG4Label, tempTPC);
1427  for(size_t t = 0; t < tempTPC.size(); ++t)
1428  simTPC.push_back(tempTPC[t]);
1429  }
1430  catch(cet::exception& e){
1431  writeErrMsg("GetSim TPC", e);
1432  }
1433  }
const double e
std::string fG4Label
module label that produced G4 hits
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void gar::evd3d::EventDisplay3D::GetTracks ( art::View< gar::rec::Track > &  track,
const art::Event event 
)
private

Definition at line 1528 of file EVD3D_module.cc.

1529  {
1530  try{
1531  event.getView(fTrackLabels.at(0), track);
1532  }
1533  catch(cet::exception& e){
1534  writeErrMsg("GetTracks", e);
1535  }
1536 
1537  return;
1538  }
std::vector< std::string > fTrackLabels
module labels that produced tracks
const double e
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void gar::evd3d::EventDisplay3D::GetVertices ( std::vector< const rec::Vertex * > &  vertex,
const art::Event event 
)
private

Definition at line 1541 of file EVD3D_module.cc.

1542  {
1543  vertex.clear();
1544 
1545  std::vector<const gar::rec::Vertex*> temp;
1546 
1547  try{
1548  event.getView(fVertexLabels.at(0), temp);
1549  for(size_t t = 0; t < temp.size(); ++t){
1550  vertex.push_back(temp[t]);
1551  }
1552  }
1553  catch(cet::exception& e){
1554  writeErrMsg("GetVertices", e);
1555  }
1556 
1557  return;
1558  }
const double e
std::vector< std::string > fVertexLabels
module labels that produced vertices
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void gar::evd3d::EventDisplay3D::makeNavPanel ( )
private

Definition at line 345 of file EVD3D_module.cc.

346  {
347  // Create control panel for event navigation
348  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
349  TEveBrowser* browser = fEve->GetBrowser();
350  browser->StartEmbedding(TRootBrowser::kLeft); // insert nav frame as new tab in left pane
351 
352  TGMainFrame* frmMain = new TGMainFrame(gClient->GetRoot(), 800, 600);
353  frmMain->SetWindowName("EVT NAV");
354  frmMain->SetCleanup(kDeepCleanup);
355 
356  TGHorizontalFrame* navFrame = new TGHorizontalFrame(frmMain);
357  TGVerticalFrame* evtidFrame = new TGVerticalFrame(frmMain);
358 
359  TString icondir(TString::Format("%s/icons/", gSystem->Getenv("ROOTSYS")) );
360  TGPictureButton* b = 0;
361 
362  // ... Create back button and connect to "PrevEvent" rcvr in visutils
363  b = new TGPictureButton(navFrame, gClient->GetPicture(icondir + "GoBack.gif"));
364  navFrame->AddFrame(b);
365  b->Connect("Clicked()", "gar::evd3d::EventDisplay3DUtils", fEvtDisplayUtil.get(), "PrevEvent()");
366 
367  // ... Create forward button and connect to "NextEvent" rcvr in visutils
368  b = new TGPictureButton(navFrame, gClient->GetPicture(icondir + "GoForward.gif"));
369  navFrame->AddFrame(b);
370  b->Connect("Clicked()", "gar::evd3d::EventDisplay3DUtils", fEvtDisplayUtil.get(), "NextEvent()");
371 
372  // ... Create run num text entry widget and connect to "GotoEvent" rcvr in visutils
373  TGHorizontalFrame* runoFrame = new TGHorizontalFrame(evtidFrame);
374  fTlRun = new TGLabel(runoFrame,"Run Number");
375  fTlRun->SetTextJustify(kTextLeft);
376  fTlRun->SetMargins(5,5,5,0);
377  runoFrame->AddFrame(fTlRun);
378 
379  fTeRun = new TGTextEntry(runoFrame, fEvtDisplayUtil->fTbRun = new TGTextBuffer(5), 1);
380  fEvtDisplayUtil->fTbRun->AddText(0, "1");
381  fTeRun->Connect("ReturnPressed()","gar::evd3d::EventDisplay3DUtils", fEvtDisplayUtil.get(),"GotoEvent()");
382  runoFrame->AddFrame(fTeRun,new TGLayoutHints(kLHintsExpandX));
383 
384  // ... Create evt num text entry widget and connect to "GotoEvent" rcvr in visutils
385  TGHorizontalFrame* evnoFrame = new TGHorizontalFrame(evtidFrame);
386  fTlEvt = new TGLabel(evnoFrame,"Evt Number");
387  fTlEvt->SetTextJustify(kTextLeft);
388  fTlEvt->SetMargins(5,5,5,0);
389  evnoFrame->AddFrame(fTlEvt);
390 
391  fTeEvt = new TGTextEntry(evnoFrame, fEvtDisplayUtil->fTbEvt = new TGTextBuffer(5), 1);
392  fEvtDisplayUtil->fTbEvt->AddText(0, "1");
393  fTeEvt->Connect("ReturnPressed()","gar::evd3d::EventDisplay3DUtils", fEvtDisplayUtil.get(),"GotoEvent()");
394  evnoFrame->AddFrame(fTeEvt,new TGLayoutHints(kLHintsExpandX));
395 
396  // ... Add horizontal run & event number subframes to vertical evtidFrame
397  evtidFrame->AddFrame(runoFrame,new TGLayoutHints(kLHintsExpandX));
398  evtidFrame->AddFrame(evnoFrame,new TGLayoutHints(kLHintsExpandX));
399 
400  // ... Add navFrame and evtidFrame to MainFrame
401  frmMain->AddFrame(navFrame);
402  TGHorizontal3DLine *separator = new TGHorizontal3DLine(frmMain);
403  frmMain->AddFrame(separator, new TGLayoutHints(kLHintsExpandX));
404  frmMain->AddFrame(evtidFrame);
405 
406  frmMain->MapSubwindows();
407  frmMain->Resize();
408  frmMain->MapWindow();
409 
410  browser->StopEmbedding();
411  browser->SetTabTitle("Event Nav", 0);
412  }
std::unique_ptr< evd3d::EventDisplay3DUtils > fEvtDisplayUtil
Format
Definition: utils.h:7
static bool * b
Definition: config.cpp:1043
void gar::evd3d::EventDisplay3D::PickVolumes ( TEveElementList *&  list)
private

Definition at line 525 of file EVD3D_module.cc.

526  {
527  //Check if top volume is rock hall
528  bool hasHall = false;
529  std::vector<const TGeoNode*> topnodes = fGeometry->FindVolumePath("rockBox_lv");
530  TGeoScale nullmatgm;
531  TGeoMatrix* topHall = &nullmatgm;
532  if(topnodes.size() != 0) hasHall = true;
533 
534  std::cout << "Has the hall in the list of volumes? " << hasHall << std::endl;
535 
536  //Matrix Enclosure
537  if(hasHall)
538  {
539  for(unsigned int i = 0; i < topnodes.size(); i++)
540  {
541  std::string nodename(topnodes.at(i)->GetName());
542  if(nodename.find("rockBox_lv") == std::string::npos) continue;
543 
544  const TGeoNode *top = topnodes.at(i);
545  topHall = top->GetMatrix();
546  }
547  }
548 
549  //Check if the top volume is Enclosure or ND
550  bool hasEnclosure = false;
551  topnodes = fGeometry->FindVolumePath("volDetEnclosure");
552  TGeoMatrix* topEnclosure = &nullmatgm;
553  if(topnodes.size() != 0) hasEnclosure = true;
554 
555  std::cout << "Has the Enclosure in the list of volumes? " << hasEnclosure << std::endl;
556 
557  //Matrix Enclosure
558  if(hasEnclosure)
559  {
560  for(unsigned int i = 0; i < topnodes.size(); i++)
561  {
562  std::string nodename(topnodes.at(i)->GetName());
563  if(nodename.find("volDetEnclosure") == std::string::npos) continue;
564 
565  const TGeoNode *top = topnodes.at(i);
566  topEnclosure = top->GetMatrix();
567  }
568  }
569 
570  //Get the matrix of the top volume (rotation of the full ND)
571  topnodes = fGeometry->FindVolumePath("volMPD");
572  //Matrix ND
573  TGeoMatrix* topND = &nullmatgm;
574  for(unsigned int i = 0; i < topnodes.size(); i++)
575  {
576  std::string nodename(topnodes.at(i)->GetName());
577  if(nodename.find("volMPD_0") == std::string::npos) continue;
578 
579  const TGeoNode *top = topnodes.at(i);
580  topND = top->GetMatrix();
581  }
582 
583  // //Get the matrix of the top volume (rotation of the full ND)
584  // topnodes = fGeometry->FindVolumePath("volNDHPgTPC");
585  // //Matrix ND
586  // TGeoMatrix* topND2 = &nullmatgm;
587  // for(unsigned int i = 0; i < topnodes.size(); i++)
588  // {
589  // std::string nodename(topnodes.at(i)->GetName());
590  // if(nodename.find("volNDHPgTPC") == std::string::npos) continue;
591  //
592  // const TGeoNode *top = topnodes.at(i);
593  // topND2 = top->GetMatrix();
594  // }
595 
596  for(auto volname : fVolumesToShow)
597  {
598  std::vector<const TGeoNode*> nodevec = fGeometry->FindVolumePath(volname);
599 
600  for(unsigned int i = 0; i < nodevec.size(); i++)
601  {
602  std::string nodename(nodevec.at(i)->GetName());
603  if(nodename.find(volname) == std::string::npos) continue;
604 
605  const TGeoNode *node = nodevec.at(i);
606 
607  //If Barrel or Endcap -> show daughters
608  if(nodename.find("BarrelECal") != std::string::npos || nodename.find("EndcapECal") != std::string::npos)
609  {
610  TGeoScale nullmatgm_local;
611  TGeoMatrix* topECal = &nullmatgm_local;
612  topECal = node->GetMatrix();
613 
614  for(int idaugh = 0; idaugh < node->GetNdaughters(); idaugh++)
615  {
616  const TGeoNode *daugh_node = node->GetDaughter(idaugh);
617  TGeoShape *daugh_shape = daugh_node->GetVolume()->GetShape();
618  TGeoShape* daugh_clonedShape = dynamic_cast<TGeoShape*> (daugh_shape->Clone("fakeShape"));
619  TEveGeoShape *daugh_fakeShape = new TEveGeoShape(daugh_shape->GetName());
620  daugh_fakeShape->SetShape(daugh_clonedShape);
621 
622  if(nodename.find("BarrelECal") != std::string::npos)
623  {
624  daugh_fakeShape->SetMainColor(kOrange+10);
625  daugh_fakeShape->SetMainTransparency(80);
626  }
627  else if(nodename.find("EndcapECal") != std::string::npos)
628  {
629  daugh_fakeShape->SetMainColor(kGreen+1);
630  daugh_fakeShape->SetMainTransparency(80);
631  }
632 
633  TGeoMatrix* currMat = daugh_node->GetMatrix();
634  TGeoMatrix* mat = currMat->MakeClone();
635  TGeoHMatrix *m = new TGeoHMatrix(*mat);
636  m->MultiplyLeft(topECal);
637  // m->MultiplyLeft(topND2);
638  m->MultiplyLeft(topND);
639  if(hasEnclosure) m->MultiplyLeft(topEnclosure);
640  if(hasHall) m->MultiplyLeft(topHall);
641  daugh_fakeShape->SetTransMatrix(*m);
642 
643  list->AddElement(daugh_fakeShape);
644  }
645  }
646  else{
647  TGeoShape *shape = node->GetVolume()->GetShape();
648  TGeoShape* clonedShape = dynamic_cast<TGeoShape*> (shape->Clone("fakeShape"));
649 
650  TEveGeoShape *fakeShape = new TEveGeoShape(shape->GetName());
651  fakeShape->SetShape(clonedShape);
652 
653  if(nodename.find("TPC") != std::string::npos)
654  {
655  fakeShape->SetMainColor(kBlue+8);
656  fakeShape->SetMainTransparency(80);
657  }
658  else if(nodename.find("PV") != std::string::npos)
659  {
660  fakeShape->SetMainColor(kGray+1);
661  fakeShape->SetMainTransparency(70);
662  }
663  else{
664  fakeShape->SetMainColor(node->GetVolume()->GetLineColor());
665  fakeShape->SetMainTransparency(70);
666  }
667 
668  TGeoMatrix* currMat = node->GetMatrix();
669  TGeoMatrix* mat = currMat->MakeClone();
670  TGeoHMatrix *m = new TGeoHMatrix(*mat);
671  m->MultiplyLeft(topND);
672  if(hasEnclosure) m->MultiplyLeft(topEnclosure);
673  if(hasHall) m->MultiplyLeft(topHall);
674  fakeShape->SetTransMatrix(*m);
675  // fakeShape->SetTransMatrix(*mat);
676 
677  list->AddElement(fakeShape);
678  }
679  }
680  nodevec.clear();
681  }
682 
683  //Add the LAr if present
684  bool hasLAr = false;
685  topnodes = fGeometry->FindVolumePath("volArgonCubeDetector");
686  if(topnodes.size() != 0) hasLAr = true;
687 
688  if(hasLAr) {
689  for(unsigned int i = 0; i < topnodes.size(); i++)
690  {
691  std::string nodename(topnodes.at(i)->GetName());
692  if(nodename.find("volArgonCubeDetector") == std::string::npos) continue;
693 
694  const TGeoNode *node = topnodes.at(i);
695 
696  TGeoScale nullmatgm_local;
697  TGeoMatrix* topLAr = &nullmatgm_local;
698  topLAr = node->GetMatrix();
699 
700  for(int idaugh = 0; idaugh < node->GetNdaughters(); idaugh++)
701  {
702  const TGeoNode *daugh_node = node->GetDaughter(idaugh);
703  TGeoShape *daugh_shape = daugh_node->GetVolume()->GetShape();
704  TGeoShape* daugh_clonedShape = dynamic_cast<TGeoShape*> (daugh_shape->Clone("fakeShape"));
705  TEveGeoShape *daugh_fakeShape = new TEveGeoShape(daugh_shape->GetName());
706  daugh_fakeShape->SetShape(daugh_clonedShape);
707  daugh_fakeShape->SetMainColor(kGreen+1);
708  daugh_fakeShape->SetMainTransparency(80);
709  TGeoMatrix* currMat = daugh_node->GetMatrix();
710  TGeoMatrix* mat = currMat->MakeClone();
711  TGeoHMatrix *m = new TGeoHMatrix(*mat);
712  m->MultiplyLeft(topLAr);
713  if(hasEnclosure) m->MultiplyLeft(topEnclosure);
714  if(hasHall) m->MultiplyLeft(topHall);
715  daugh_fakeShape->SetTransMatrix(*m);
716 
717  list->AddElement(daugh_fakeShape);
718  }
719  }
720  }
721 
722  return;
723  }
std::string string
Definition: nybbler.cc:12
std::vector< std::string > fVolumesToShow
list of volumes to show in the Eve display
std::vector< TGeoNode const * > FindVolumePath(std::string const &vol_name) const
Returns all the nodes with volumes with any of the specified names.
const gar::geo::GeometryCore * fGeometry
QTextStream & endl(QTextStream &s)
void gar::evd3d::EventDisplay3D::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 307 of file EVD3D_module.cc.

308  {
309  fDrawECALRawHits = pset.get<bool > ("drawECALRawHits" , false);
310  fDrawECALRecoHits = pset.get<bool > ("drawECALRecoHits" , false);
311  fDrawECALClusters = pset.get<bool > ("drawECALClusters" , false);
312  fDrawMuIDRecoHits = pset.get<bool > ("drawMuIDRecoHits" , false);
313  fDrawTracks = pset.get<bool > ("drawTracks" , false);
314  fDrawVertices = pset.get<bool > ("drawVertices" , false);
315  fDrawTPCClusters = pset.get<bool > ("drawTPCClusters" , false);
316  fDrawMCTruth = pset.get<bool > ("drawMCTruth" , true);
317  fDrawMCTPC = pset.get<bool > ("drawMCTPCTruth" , true);
318  fDrawMCCaloTruth = pset.get<bool > ("drawMCCaloTruth" , true);
319  fVolumesToShow = pset.get< std::vector<std::string> > ("VolumesToShow" );
320 
321  fG4Label = pset.get< std::string > ("G4ModuleLabel" );
322  fInstanceName = pset.get< std::vector<std::string> > ("InstanceName" );
323  fRawHitLabels = pset.get< std::vector<std::string> > ("RawHitModuleLabels" );
324  fRecoECALHitLabels = pset.get< std::vector<std::string> > ("RecoECALHitModuleLabels" );
325  fRecoMuIDHitLabels = pset.get< std::vector<std::string> > ("RecoMuIDHitModuleLabels" );
326 
327  fCaloClusterLabels = pset.get< std::vector<std::string> > ("CaloClusterModuleLabels" );
328  fTrackLabels = pset.get< std::vector<std::string> > ("TrackModuleLabels" );
329  fVertexLabels = pset.get< std::vector<std::string> > ("VertexModuleLabels" );
330 
331  fScalingfactor = pset.get<float > ("Scalingfactor", 1.0);
332  fDrawIntersection = pset.get<bool > ("drawIntersection" , false);
333  fDrawNeutronTraj = pset.get<bool > ("drawNeutronTrajectories", false);
334 
336  fFieldDecoder = new gar::geo::BitFieldCoder( fEncoding );
337  }
std::vector< std::string > fCaloClusterLabels
module labels that produced Calorimeter Clusters
std::vector< std::string > fRawHitLabels
module labels that produced raw hits
std::string string
Definition: nybbler.cc:12
std::vector< std::string > fVolumesToShow
list of volumes to show in the Eve display
gar::geo::BitFieldCoder * fFieldDecoder
std::vector< std::string > fRecoECALHitLabels
module labels that produced reco hits ecal
std::vector< std::string > fTrackLabels
module labels that produced tracks
const gar::geo::GeometryCore * fGeometry
std::vector< std::string > fInstanceName
Helper class for decoding and encoding a bit field of 64bits for convenient declaration.
std::string fG4Label
module label that produced G4 hits
std::vector< std::string > fVertexLabels
module labels that produced vertices
const std::string GetECALCellIDEncoding() const
std::vector< std::string > fRecoMuIDHitLabels
module labels that produced reco hits muid
void gar::evd3d::EventDisplay3D::UpdateHeader ( const art::Event event)
private

Definition at line 1614 of file EVD3D_module.cc.

1615  {
1616  unsigned long long int tsval = event.time().value();
1617  int run = event.run();
1618  int srun = event.subRun();
1619  int evt = event.id().event();
1620 
1621  unsigned int year, month, day, dayofweek;
1622  unsigned int hour, minute, second;
1623  int nano;
1624 
1625  const unsigned long int mask32 = 0xFFFFFFFFUL;
1626  unsigned long int lup = ( tsval >> 32 ) & mask32;
1627  unsigned long int llo = tsval & mask32;
1628  TTimeStamp ts(lup, (int)llo);
1629 
1630  ts.GetDate(kTRUE,0,&year,&month,&day);
1631  ts.GetTime(kTRUE,0,&hour,&minute,&second);
1632  nano = ts.GetNanoSec();
1633  dayofweek = ts.GetDayOfWeek();
1634  char eventbuff[256];
1635  char runbuff[256];
1636  char datebuff[256];
1637  char timebuff[256];
1638 
1639  // Skip first one since ROOT returns these numbers starting from 1 not 0
1640  static const char* days[] = {"","Mon","Tue","Wed","Thu","Fri","Sat","Sun"};
1641  static const char* months[] = {"","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
1642 
1643  sprintf(runbuff, "Run: %d/%d\n", run, srun);
1644  sprintf(eventbuff,"Event: %d\n", evt);
1645  sprintf(datebuff, "UTC %s %s %u, %u\n", days[dayofweek], months[month], day, year);
1646  sprintf(timebuff, "%.2u:%.2u:%2.9f\n", hour, minute, (float)second+(float)nano/1.0E9);
1647 
1648  //Final char
1649  char annotation[2560];
1650  sprintf(annotation, "DUNE ND HPgTPC\n%s%s%s%s", runbuff, eventbuff, datebuff, timebuff);
1651  ann->SetText(annotation);
1652  ann->SetRole(TGLOverlayElement::kViewer);
1653  ann->SetUseColorSet(true);
1654  ann->SetTextSize(0.04);// % of window diagonal
1655  ann->SetTextAlign(TGLFont::kLeft);
1656  ann->SetAllowClose(false);
1657  ann->SetTextColor(kBlack);
1658  }
unsigned int event
Definition: DataStructs.h:636
TCEvent evt
Definition: DataStructs.cxx:7
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:85

Member Data Documentation

TGLAnnotation* gar::evd3d::EventDisplay3D::ann
private

Definition at line 179 of file EVD3D_module.cc.

std::vector<std::string> gar::evd3d::EventDisplay3D::fCaloClusterLabels
private

module labels that produced Calorimeter Clusters

Definition at line 170 of file EVD3D_module.cc.

TEveElementList* gar::evd3d::EventDisplay3D::fCaloClusterList
private

Definition at line 198 of file EVD3D_module.cc.

TEveElementList* gar::evd3d::EventDisplay3D::fCaloMuIDHitList
private

Definition at line 195 of file EVD3D_module.cc.

TEveElementList* gar::evd3d::EventDisplay3D::fCaloRawHitList
private

Definition at line 191 of file EVD3D_module.cc.

TEveElementList* gar::evd3d::EventDisplay3D::fCaloRecoHitList
private

Definition at line 192 of file EVD3D_module.cc.

TEveElementList* gar::evd3d::EventDisplay3D::fCaloSimHitList
private

Definition at line 190 of file EVD3D_module.cc.

const gar::detinfo::DetectorProperties* gar::evd3d::EventDisplay3D::fDetProp = gar::providerFrom<detinfo::DetectorPropertiesService>()
private

Definition at line 146 of file EVD3D_module.cc.

bool gar::evd3d::EventDisplay3D::fDrawECALClusters
private

Definition at line 156 of file EVD3D_module.cc.

bool gar::evd3d::EventDisplay3D::fDrawECALRawHits
private

Definition at line 154 of file EVD3D_module.cc.

bool gar::evd3d::EventDisplay3D::fDrawECALRecoHits
private

Definition at line 155 of file EVD3D_module.cc.

bool gar::evd3d::EventDisplay3D::fDrawIntersection
private

Definition at line 208 of file EVD3D_module.cc.

bool gar::evd3d::EventDisplay3D::fDrawMCCaloTruth
private

Definition at line 153 of file EVD3D_module.cc.

bool gar::evd3d::EventDisplay3D::fDrawMCTPC
private

Definition at line 152 of file EVD3D_module.cc.

bool gar::evd3d::EventDisplay3D::fDrawMCTruth
private

Definition at line 161 of file EVD3D_module.cc.

bool gar::evd3d::EventDisplay3D::fDrawMuIDRecoHits
private

Definition at line 157 of file EVD3D_module.cc.

bool gar::evd3d::EventDisplay3D::fDrawNeutronTraj
private

Definition at line 162 of file EVD3D_module.cc.

bool gar::evd3d::EventDisplay3D::fDrawTPCClusters
private

Definition at line 160 of file EVD3D_module.cc.

bool gar::evd3d::EventDisplay3D::fDrawTracks
private

Definition at line 158 of file EVD3D_module.cc.

bool gar::evd3d::EventDisplay3D::fDrawVertices
private

Definition at line 159 of file EVD3D_module.cc.

TEveManager* gar::evd3d::EventDisplay3D::fEve
private

Definition at line 177 of file EVD3D_module.cc.

std::unique_ptr<evd3d::EventDisplay3DUtils> gar::evd3d::EventDisplay3D::fEvtDisplayUtil
private

Definition at line 149 of file EVD3D_module.cc.

gar::geo::BitFieldCoder* gar::evd3d::EventDisplay3D::fFieldDecoder
private

Definition at line 211 of file EVD3D_module.cc.

std::string gar::evd3d::EventDisplay3D::fG4Label
private

module label that produced G4 hits

Definition at line 164 of file EVD3D_module.cc.

TGeoManager* gar::evd3d::EventDisplay3D::fGeoManager
private

Definition at line 176 of file EVD3D_module.cc.

const gar::geo::GeometryCore* gar::evd3d::EventDisplay3D::fGeometry = gar::providerFrom<geo::GeometryGAr>()
private

Definition at line 144 of file EVD3D_module.cc.

std::vector<std::string> gar::evd3d::EventDisplay3D::fInstanceName
private

Definition at line 165 of file EVD3D_module.cc.

TEveElementList* gar::evd3d::EventDisplay3D::fMCTrajectoryList
private

Definition at line 203 of file EVD3D_module.cc.

const fhicl::ParameterSet gar::evd3d::EventDisplay3D::fParamSet
private

Definition at line 142 of file EVD3D_module.cc.

std::vector<std::string> gar::evd3d::EventDisplay3D::fRawHitLabels
private

module labels that produced raw hits

Definition at line 167 of file EVD3D_module.cc.

std::vector<std::string> gar::evd3d::EventDisplay3D::fRecoECALHitLabels
private

module labels that produced reco hits ecal

Definition at line 168 of file EVD3D_module.cc.

std::vector<std::string> gar::evd3d::EventDisplay3D::fRecoMuIDHitLabels
private

module labels that produced reco hits muid

Definition at line 169 of file EVD3D_module.cc.

float gar::evd3d::EventDisplay3D::fScalingfactor
private

Definition at line 206 of file EVD3D_module.cc.

std::vector<std::string> gar::evd3d::EventDisplay3D::fSimHitLabels
private

module labels that produced sim hits

Definition at line 166 of file EVD3D_module.cc.

TGTextEntry * gar::evd3d::EventDisplay3D::fTeEvt
private

Definition at line 182 of file EVD3D_module.cc.

TGTextEntry* gar::evd3d::EventDisplay3D::fTeRun
private

Definition at line 182 of file EVD3D_module.cc.

const gar::detinfo::DetectorClocks* gar::evd3d::EventDisplay3D::fTime = gar::providerFrom<detinfo::DetectorClocksServiceGAr>()
private

Definition at line 145 of file EVD3D_module.cc.

TGLabel * gar::evd3d::EventDisplay3D::fTlEvt
private

Definition at line 183 of file EVD3D_module.cc.

TGLabel* gar::evd3d::EventDisplay3D::fTlRun
private

Definition at line 183 of file EVD3D_module.cc.

TEveElementList* gar::evd3d::EventDisplay3D::fTPCClusterList
private

Definition at line 187 of file EVD3D_module.cc.

TEveElementList* gar::evd3d::EventDisplay3D::fTPCSimHitList
private

Definition at line 186 of file EVD3D_module.cc.

std::vector<std::string> gar::evd3d::EventDisplay3D::fTrackLabels
private

module labels that produced tracks

Definition at line 171 of file EVD3D_module.cc.

TEveElementList* gar::evd3d::EventDisplay3D::fTrackList
private

Definition at line 199 of file EVD3D_module.cc.

std::vector<std::string> gar::evd3d::EventDisplay3D::fVertexLabels
private

module labels that produced vertices

Definition at line 172 of file EVD3D_module.cc.

TEveElementList* gar::evd3d::EventDisplay3D::fVertexList
private

Definition at line 200 of file EVD3D_module.cc.

std::vector<std::string> gar::evd3d::EventDisplay3D::fVolumesToShow
private

list of volumes to show in the Eve display

Definition at line 174 of file EVD3D_module.cc.

TGLViewer* gar::evd3d::EventDisplay3D::glViewer
private

Definition at line 178 of file EVD3D_module.cc.

double gar::evd3d::EventDisplay3D::origin[3] = {0., 0., 0.}
private

Definition at line 180 of file EVD3D_module.cc.


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