EVD3D_module.cc
Go to the documentation of this file.
1 //
2 // - ROOT-based 3D event display for ART toy experiment. Requires
3 // EvtDisplayUtils, NavState, and EvtDisplayService.
4 //
5 
6 // art includes
13 #include "canvas/Persistency/Common/FindMany.h"
14 
15 // Framework includes
17 
18 #include "nuevdb/EventDisplayBase/NavState.h"
19 #include "Geometry/GeometryGAr.h"
20 #include "Geometry/BitFieldCoder.h"
21 
22 #include "EventDisplay3DUtils.h"
23 #include "EventDisplay/EVD/Style.h"
25 
26 #include "CoreUtils/ServiceUtil.h"
31 
33 
36 
39 #include "RawDataProducts/raw.h"
40 
43 
49 
52 
53 #include "cetlib_except/demangle.h"
56 
57 // ROOT includes
58 #include <TApplication.h>
59 #include <TString.h>
60 #include <TSystem.h>
61 #include <TROOT.h>
62 #include <TFile.h>
63 #include <TGString.h>
64 #include <TGLabel.h>
65 #include <TGButton.h>
66 #include <TGButtonGroup.h>
67 #include <TGTextEntry.h>
68 #include <TGTextView.h>
69 #include <TGLayout.h>
70 #include <TGTab.h>
71 #include <TG3DLine.h>
72 #include <TGeoManager.h>
73 #include <TGeoNode.h>
74 #include <TGeoTube.h>
75 #include <TGeoCompositeShape.h>
76 #include <TGeoBoolNode.h>
77 #include <TEveGeoNode.h>
78 #include <TEvePointSet.h>
79 #include <TEveLine.h>
80 #include "TEveTrack.h"
81 #include "TEveTrackPropagator.h"
82 #include "TEvePathMark.h"
83 #include "TTimeStamp.h"
84 #include "TEveManager.h"
85 #include "TEveEventManager.h"
86 #include "TEveScene.h"
87 #include "TEveViewer.h"
88 #include "TEveBrowser.h"
89 #include "TEveRGBAPaletteOverlay.h"
90 #include "TEveFrameBox.h"
91 #include "TEveQuadSet.h"
92 #include "TEveTrans.h"
93 #include "TEveProjectionAxes.h"
94 #include "TEveProjectionManager.h"
95 #include "TEveWindow.h"
96 #include "TGLViewer.h"
97 #include "TGLCameraOverlay.h"
98 #include "TGTab.h"
99 #include "TRandom.h"
100 #include "TEveArrow.h"
101 #include "TGLAnnotation.h"
102 #include "TGLFontManager.h"
103 #include "TPolyLine3D.h"
104 #include "TDatabasePDG.h"
105 #include "TParticle.h"
106 
107 #include <sstream>
108 #include <iostream>
109 #include <iomanip>
110 
111 namespace {
112  // Utility function to make uniform error messages.
113  void writeErrMsg(const char* fcn,
114  cet::exception const& e)
115  {
116  mf::LogWarning("EventDisplay3D") << "EventDisplay3D::" << fcn
117  << " failed with message:\n"
118  << e;
119  }
120 }
121 
122 namespace gar{
123  namespace evd3d
124  {
126  {
127  public:
128 
129  explicit EventDisplay3D(fhicl::ParameterSet const& pset);
130  virtual ~EventDisplay3D();
131 
132  void beginJob() override;
133  void endJob() override;
134  void beginRun(const art::Run& run) override;
135  void analyze(const art::Event& event) override;
136 
137  void reconfigure(fhicl::ParameterSet const& pset);
138 
139  private:
140 
141  // Keep track of fhicl parameter set
143 
144  const gar::geo::GeometryCore* fGeometry = gar::providerFrom<geo::GeometryGAr>();
145  const gar::detinfo::DetectorClocks* fTime = gar::providerFrom<detinfo::DetectorClocksServiceGAr>();
146  const gar::detinfo::DetectorProperties* fDetProp = gar::providerFrom<detinfo::DetectorPropertiesService>();
147 
148  //Event display 3D pointer
149  std::unique_ptr<evd3d::EventDisplay3DUtils> fEvtDisplayUtil;
150 
151  // Set by parameter set variables.
163 
164  std::string fG4Label; ///< module label that produced G4 hits
165  std::vector<std::string> fInstanceName;
166  std::vector<std::string> fSimHitLabels; ///< module labels that produced sim hits
167  std::vector<std::string> fRawHitLabels; ///< module labels that produced raw hits
168  std::vector<std::string> fRecoECALHitLabels; ///< module labels that produced reco hits ecal
169  std::vector<std::string> fRecoMuIDHitLabels; ///< module labels that produced reco hits muid
170  std::vector<std::string> fCaloClusterLabels; ///< module labels that produced Calorimeter Clusters
171  std::vector<std::string> fTrackLabels; ///< module labels that produced tracks
172  std::vector<std::string> fVertexLabels; ///< module labels that produced vertices
173 
174  std::vector<std::string> fVolumesToShow; ///< list of volumes to show in the Eve display
175 
176  TGeoManager* fGeoManager;
177  TEveManager* fEve;
178  TGLViewer* glViewer;
179  TGLAnnotation* ann;
180  double origin[3] = {0., 0., 0.};
181 
182  TGTextEntry *fTeRun, *fTeEvt;
183  TGLabel *fTlRun, *fTlEvt;
184 
185  //TPC
186  TEveElementList* fTPCSimHitList;
187  TEveElementList* fTPCClusterList;
188 
189  //Calo specific
190  TEveElementList* fCaloSimHitList;
191  TEveElementList* fCaloRawHitList;
192  TEveElementList* fCaloRecoHitList;
193 
194  //MuID
195  TEveElementList* fCaloMuIDHitList;
196 
197  //High level reco (clusters and tracks)
198  TEveElementList* fCaloClusterList;
199  TEveElementList* fTrackList;
200  TEveElementList* fVertexList;
201 
202  //MC Track and incoming particle
203  TEveElementList* fMCTrajectoryList;
204 
205  //scaling factor for cluster axis
207  //draw track calo intersections
209 
210  //CellIDDecoder
212 
213  //Create the navigation panel
214  void makeNavPanel();
215 
216  void PickVolumes(TEveElementList* &list);
217 
218  void UpdateHeader(const art::Event& event);
219 
220  void DrawMCTruth(const art::Event& event);
221 
222  void DrawMCTPCTruth(const art::Event& event);
223 
224  void DrawMCCaloTruth(const art::Event& event);
225 
226  void DrawRawHits(const art::Event& event);
227 
228  void DrawRecoHits(const art::Event& event);
229 
230  void DrawHighLevelReco(const art::Event& event);
231 
232  void DrawTrack(const gar::rec::Track* trk, TEveElementList* &eve_list, int counter, bool forward);
233 
234  void DrawTrackPolyLine3D(std::vector<const gar::rec::TrackTrajectory*> const& trajectories, TEveElementList* &eve_list, int counter);
235 
236  void DrawTPCCluster3D(std::vector<const gar::rec::TPCCluster*> const& TPCClusters, TEveElementList* &eve_list);
237 
238  void DrawIntersections(const gar::rec::Track* trk, TEveElementList* &fTrackList, int counter);
239 
240  void DrawHelix3D(const float *trackpar, const float xpar, const float xother, TEveLine* &eve_track, int color);
241 
242  void DrawArrow3D(const float *fVertex, const float *fDir, int color, TEveArrow* &arrow);
243 
244  //get sim hits from the event handle
245  void GetSimTPCHits(std::vector<const sdp::EnergyDeposit*> &simTPC, const art::Event& event);
246 
247  //get sim hits from the event handle
248  void GetSimCaloHits(std::vector<const sdp::CaloDeposit*> &simCalo, const art::Event& event);
249 
250  //get raw hits from the event handle
251  void GetRawCaloHits(std::vector<const raw::CaloRawDigit*> &digitCalo, const art::Event& event);
252 
253  //get reco hits from the event handle
254  void GetRecoCaloHits(std::vector<const rec::CaloHit*> &recoCalo, const art::Event& event);
255 
256  //get muid reco hits from the event handle
257  void GetRecoMuIDHits(std::vector<const rec::CaloHit*> &recoMuID, const art::Event& event);
258 
259  //get calo clusters
260  void GetCaloClusters(std::vector<const rec::Cluster*> &caloCluster, const art::Event& event);
261 
262  //get tracks clusters
263  void GetTracks(art::View<gar::rec::Track> &track, const art::Event& event);
264 
265  //get reco vertexes
266  void GetVertices(std::vector<const rec::Vertex*> &vertex, const art::Event& event);
267 
268  //get mc truth from the event handle
269  void GetMCTruth(std::vector<const simb::MCTruth*>& mcvec, const art::Event& event);
270 
271  //get particle list from the event handle
272  void GetParticle(std::vector<const simb::MCParticle*>& plist, const art::Event& event);
273 
274  //clean the event before going to next
275  void cleanEvt();
276  };
277 
278  //......................................................................
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  }
305 
306  //......................................................................
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  }
338 
339  //----------------------------------------------------
341  {
342  }
343 
344  //----------------------------------------------------
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  }
413 
414  //----------------------------------------------------
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  }
457 
458  //----------------------------------------------------
459  void EventDisplay3D::beginRun(const art::Run& /* run */)
460  {
461  return;
462  }
463 
464  //----------------------------------------------------
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
510 
511  //----------------------------------------------------
513  {
514  //check if any element is present in the event and remove it
515  if(fEve->GetCurrentEvent() != nullptr)
516  fEve->GetCurrentEvent()->DestroyElements();
517  }
518 
519  //----------------------------------------------------
521 
522  }
523 
524  //----------------------------------------------------
525  void EventDisplay3D::PickVolumes(TEveElementList* &list)
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  }
724 
725  //----------------------------------------------------
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  }
844 
845  //----------------------------------------------------
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  }
876 
877  //----------------------------------------------------
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  }
915 
916  //----------------------------------------------------
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  }
955 
956  //----------------------------------------------------
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  }
1036 
1037  //----------------------------------------------------
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  }
1180 
1181  //----------------------------------------------------
1182  void EventDisplay3D::DrawTrack(const gar::rec::Track* trk, TEveElementList* &eve_list, int counter, bool forward)
1183  {
1184  int color = evd::kColor[counter%evd::kNCOLS];
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  }
1218 
1219  //----------------------------------------------------
1220  void EventDisplay3D::DrawTrackPolyLine3D(std::vector<const gar::rec::TrackTrajectory*> const& trajectories, TEveElementList* &eve_list, int counter)
1221  {
1222  int color = evd::kColor[counter%evd::kNCOLS];
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  }
1240 
1241  //----------------------------------------------------
1242  void EventDisplay3D::DrawTPCCluster3D(std::vector<const gar::rec::TPCCluster*> const& TPCClusters, TEveElementList* &eve_list)
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  }
1264 
1265  //----------------------------------------------------
1266  void EventDisplay3D::DrawIntersections(const gar::rec::Track* trk, TEveElementList* &fTrackList_local, int counter)
1267  {
1268  int color = evd::kColor[counter%evd::kNCOLS];
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  }
1360 
1361  //----------------------------------------------------
1362  void EventDisplay3D::DrawHelix3D(const float *trackpar, const float xpar, const float xother, TEveLine* &eve_track, int color)
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  }
1398 
1399  //----------------------------------------------------
1400  void EventDisplay3D::DrawArrow3D(const float *fVertex, const float *fDir, int color, TEveArrow* &arrow)
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  }
1417 
1418  //----------------------------------------------------
1419  void EventDisplay3D::GetSimTPCHits(std::vector<const sdp::EnergyDeposit*> &simTPC, const art::Event& event)
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  }
1434 
1435  //----------------------------------------------------
1436  void EventDisplay3D::GetSimCaloHits(std::vector<const sdp::CaloDeposit*> &simCalo, const art::Event& event)
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  }
1453 
1454  //----------------------------------------------------
1455  void EventDisplay3D::GetRawCaloHits(std::vector<const raw::CaloRawDigit*> &digitCalo, const art::Event& event)
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  }
1472 
1473  //----------------------------------------------------
1474  void EventDisplay3D::GetRecoCaloHits(std::vector<const rec::CaloHit*> &recoCalo, const art::Event& event)
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  }
1489 
1490  //----------------------------------------------------
1491  void EventDisplay3D::GetRecoMuIDHits(std::vector<const rec::CaloHit*> &recoMuID, const art::Event& event)
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  }
1506 
1507  //----------------------------------------------------
1508  void EventDisplay3D::GetCaloClusters(std::vector<const rec::Cluster*> &caloCluster, const art::Event& event)
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  }
1526 
1527  //----------------------------------------------------
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  }
1539 
1540  //----------------------------------------------------
1541  void EventDisplay3D::GetVertices(std::vector<const rec::Vertex*> &vertex, const art::Event& event)
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  }
1559 
1560  //----------------------------------------------------
1561  void EventDisplay3D::GetMCTruth(std::vector<const simb::MCTruth*>& mcvec, const art::Event& event)
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  }
1587 
1588  //----------------------------------------------------
1589  void EventDisplay3D::GetParticle(std::vector<const simb::MCParticle*>& plist, const art::Event& event)
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  }
1612 
1613  //----------------------------------------------------
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  }
1659 
1661 
1662  }//end namespace evd3d
1663  }//end namespace gar
double E(const int i=0) const
Definition: MCParticle.h:233
float const & Momentum_beg() const
Definition: Track.h:146
std::vector< std::string > fSimHitLabels
module labels that produced sim hits
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
std::vector< std::string > fCaloClusterLabels
module labels that produced Calorimeter Clusters
std::vector< std::string > fRawHitLabels
module labels that produced raw hits
std::unique_ptr< evd3d::EventDisplay3DUtils > fEvtDisplayUtil
unsigned int event
Definition: DataStructs.h:636
float Y() const
Y position.
Definition: CaloRawDigit.h:81
double Py(const int i=0) const
Definition: MCParticle.h:231
std::pair< unsigned int, unsigned int > ADC() const
Reference to the compressed ADC count vector.
Definition: CaloRawDigit.h:78
void DrawTrack(const gar::rec::Track *trk, TEveElementList *&eve_list, int counter, bool forward)
Format
Definition: utils.h:7
TEveElementList * fMCTrajectoryList
static QCString result
const float * TrackParBeg() const
Definition: Track.h:151
raw::CellID_t CellID() const
Definition: CaloHit.h:72
std::string string
Definition: nybbler.cc:12
std::vector< std::string > fVolumesToShow
list of volumes to show in the Eve display
const simb::MCTrajectory & Trajectory() const
Definition: MCParticle.h:253
gar::geo::BitFieldCoder * fFieldDecoder
int Mother() const
Definition: MCParticle.h:213
auto end() noexcept
Definition: View.h:89
float const & Energy() const
Definition: EnergyDeposit.h:42
bool PointInGArTPC(TVector3 const &point) const
float GetOriginX() const
Definition: GeometryCore.h:548
float X() const
X position.
Definition: CaloRawDigit.h:80
double Px(const int i=0) const
Definition: MCParticle.h:230
TEveElementList * fCaloRawHitList
float const & Z() const
Definition: EnergyDeposit.h:45
float const & Y() const
Definition: EnergyDeposit.h:44
void GetVertices(std::vector< const rec::Vertex * > &vertex, const art::Event &event)
std::vector< TGeoNode const * > FindVolumePath(std::string const &vol_name) const
Returns all the nodes with volumes with any of the specified names.
double const & Z() const
Definition: CaloDeposit.h:75
int StatusCode() const
Definition: MCParticle.h:211
Description of geometry of one entire detector.
Definition: GeometryCore.h:436
string dir
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
void beginRun(const art::Run &run) override
Particle class.
void DrawHelix3D(const float *trackpar, const float xpar, const float xother, TEveLine *&eve_track, int color)
TEveElementList * fTPCClusterList
bool empty() const
Definition: MCTrajectory.h:167
Definition: Run.h:17
const float * VtxDir() const
Definition: Track.h:141
float GetOriginZ() const
Definition: GeometryCore.h:552
std::vector< std::string > fRecoECALHitLabels
module labels that produced reco hits ecal
float const & Energy() const
Definition: CaloDeposit.h:72
auto & vals() noexcept
Definition: View.h:68
static const int kNCOLS
Definition: eventdisplay.h:12
std::vector< std::string > fTrackLabels
module labels that produced tracks
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)
bool isRealData() const
void GetMCTruth(std::vector< const simb::MCTruth * > &mcvec, const art::Event &event)
const gar::detinfo::DetectorProperties * fDetProp
const gar::geo::GeometryCore * fGeometry
const double e
std::vector< std::string > fInstanceName
const float * Vertex() const
Definition: Track.h:139
double Y(const size_type i) const
Definition: MCTrajectory.h:150
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
auto begin() noexcept
Definition: View.h:83
void GetRawCaloHits(std::vector< const raw::CaloRawDigit * > &digitCalo, const art::Event &event)
const gar::detinfo::DetectorClocks * fTime
CellID_t CellID() const
cellID
Definition: CaloRawDigit.h:83
Helper class for decoding and encoding a bit field of 64bits for convenient declaration.
EventDisplay3D(fhicl::ParameterSet const &pset)
void DrawHighLevelReco(const art::Event &event)
void DrawIntersections(const gar::rec::Track *trk, TEveElementList *&fTrackList, int counter)
T get(std::string const &key) const
Definition: ParameterSet.h:271
static int ColorFromPDG(int pdgcode)
Definition: Style.cxx:67
void DrawRecoHits(const art::Event &event)
TGeoManager * ROOTGeoManager() const
Access to the ROOT geometry description manager.
static int PropagateToX(const float *trackpar, const float *Xpoint, const float x, float *retXYZ, const float Rmax=0.0)
float Energy() const
Definition: CaloHit.h:69
void GetCaloClusters(std::vector< const rec::Cluster * > &caloCluster, const art::Event &event)
void GetParticle(std::vector< const simb::MCParticle * > &plist, const art::Event &event)
int ParticleID() const
Definition: Cluster.h:101
p
Definition: test.py:223
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
Definition: fwd.h:46
const fhicl::ParameterSet fParamSet
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)
float GetOriginY() const
Definition: GeometryCore.h:550
void DrawArrow3D(const float *fVertex, const float *fDir, int color, TEveArrow *&arrow)
Definition of basic calo raw digits.
const float * EigenVectors() const
Definition: Cluster.h:99
TEveElementList * fCaloMuIDHitList
double const & Y() const
Definition: CaloDeposit.h:74
raw::CellID_t const & CellID() const
Definition: CaloDeposit.h:76
const float * End() const
Definition: Track.h:140
TEveElementList * fVertexList
const float * Position() const
Definition: Vertex.h:56
float GetECALEndcapStartX() const
Definition: GeometryCore.h:975
Interface to propagate a Track to the specific point.
const float * Position() const
Definition: Cluster.h:96
void DrawRawHits(const art::Event &event)
void DrawTrackPolyLine3D(std::vector< const gar::rec::TrackTrajectory * > const &trajectories, TEveElementList *&eve_list, int counter)
float GetECALOuterBarrelRadius() const
Definition: GeometryCore.h:945
void reconfigure(fhicl::ParameterSet const &pset)
std::size_t color(std::string const &procname)
Fw2dFFT::Data Data
TEveElementList * fCaloRecoHitList
void DrawMCTPCTruth(const art::Event &event)
General GArSoft Utilities.
double Vx(const int i=0) const
Definition: MCParticle.h:221
double const & X() const
Definition: CaloDeposit.h:73
std::string fG4Label
module label that produced G4 hits
long64 get(long64 bitfield, size_t index) const
const float * Position() const
Definition: CaloHit.h:70
void UpdateHeader(const art::Event &event)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
auto size() const noexcept
Definition: View.h:119
size_type size() const
Definition: MCTrajectory.h:166
auto isValid() const noexcept
Definition: View.h:52
float TPCYCent() const
Returns the Y location of the center of the TPC in cm.
Definition: GeometryCore.h:785
void DrawMCCaloTruth(const art::Event &event)
std::vector< std::string > fVertexLabels
module labels that produced vertices
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
float const & X() const
Definition: EnergyDeposit.h:43
bool HasMuonDetector() const
Definition: GeometryCore.h:999
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
const std::string GetECALCellIDEncoding() const
void DrawMCTruth(const art::Event &event)
double Pz(const int i=0) const
Definition: MCParticle.h:232
double Vz(const int i=0) const
Definition: MCParticle.h:223
void GetSimTPCHits(std::vector< const sdp::EnergyDeposit * > &simTPC, const art::Event &event)
static bool * b
Definition: config.cpp:1043
float const & Momentum_end() const
Definition: Track.h:147
float GetECALInnerBarrelRadius() const
Definition: GeometryCore.h:942
void analyze(const art::Event &event) override
void DrawTPCCluster3D(std::vector< const gar::rec::TPCCluster * > const &TPCClusters, TEveElementList *&eve_list)
void GetSimCaloHits(std::vector< const sdp::CaloDeposit * > &simCalo, const art::Event &event)
TCEvent evt
Definition: DataStructs.cxx:7
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:85
TEveElementList * fTrackList
art framework interface to geometry description
const float * Shape() const
Definition: Cluster.h:100
float Energy() const
Definition: Cluster.h:92
float Z() const
Z position.
Definition: CaloRawDigit.h:82
TEveElementList * fCaloSimHitList
static const int kColor[kNCOLS]
Definition: eventdisplay.h:13
double Vy(const int i=0) const
Definition: MCParticle.h:222
void GetTracks(art::View< gar::rec::Track > &track, const art::Event &event)
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
Event finding and building.
void GetRecoMuIDHits(std::vector< const rec::CaloHit * > &recoMuID, const art::Event &event)
TEveElementList * fCaloClusterList
std::vector< std::string > fRecoMuIDHitLabels
module labels that produced reco hits muid
const float * EndDir() const
Definition: Track.h:142
TEveElementList * fTPCSimHitList
void PickVolumes(TEveElementList *&list)
vertex reconstruction