DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Display.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 // Framework include files
15 #include <DDEve/View.h>
16 #include <DDEve/Display.h>
17 #include <DDEve/ViewMenu.h>
18 #include <DDEve/DD4hepMenu.h>
19 #include <DDEve/ElementList.h>
23 #include <DDEve/Utilities.h>
24 #include <DDEve/DDEveEventData.h>
25 #include <DDEve/HitActors.h>
26 #include <DDEve/ParticleActors.h>
27 
28 #include <DD4hep/Detector.h>
29 #include <DD4hep/DetectorData.h>
30 #include <DD4hep/Printout.h>
31 
32 // ROOT include files
33 #include <TROOT.h>
34 #include <TH2.h>
35 #include <TFile.h>
36 #include <TSystem.h>
37 #include <TGTab.h>
38 #include <TGMsgBox.h>
39 #include <TGClient.h>
40 #include <TGFileDialog.h>
41 #include <TEveScene.h>
42 #include <TEveBrowser.h>
43 #include <TEveManager.h>
44 #include <TEveCaloData.h>
45 #include <TEveCalo.h>
46 #include <TEveViewer.h>
47 #include <TEveCompound.h>
48 #include <TEveBoxSet.h>
49 #include <TEvePointSet.h>
50 #include <TEveGeoShape.h>
51 #include <TEveTrackPropagator.h>
52 #include <TGeoManager.h>
53 
54 // C/C++ include files
55 #include <stdexcept>
56 #include <climits>
57 
58 using namespace dd4hep;
59 using namespace dd4hep::detail;
60 
62 
63 namespace dd4hep {
64  void EveDisplay(const char* xmlConfig = 0, const char* eventFileName = 0) {
65  Display* display = new Display(TEveManager::Create(true,"VI"));
66  if ( xmlConfig != 0 ) {
67  char text[PATH_MAX];
68  ::snprintf(text,sizeof(text),"%s%s",strncmp(xmlConfig,"file:",5)==0 ? "file:" : "",xmlConfig);
69  display->LoadXML(text);
70  }
71  else {
72  display->MessageBox(INFO,"No DDEve setup given.\nYou need to choose now.....\n"
73  "If you need an example, open\n\n"
74  "examples/CLIDSid/eve/DDEve.xml\n"
75  "and the corresponding event data\n"
76  "examples/CLIDSid/eve/CLICSiD_Events.root\n\n\n",
77  "Need to choos setup file");
78  display->ChooseGeometry();
79  //display->LoadXML("file:../DD4hep/examples/CLICSiD/compact/DDEve.xml");
80  }
81  if (eventFileName != 0) {
82  display->eventHandler().Open(display->getEventHandlerName(),eventFileName);
83  }
84  }
85 }
86 
88 Display::Display(TEveManager* eve)
89  : m_eve(eve), m_detDesc(0), m_evtHandler(0), m_geoGlobal(0), m_eveGlobal(0),
90  m_viewMenu(0), m_dd4Menu(0), m_visLevel(7), m_loadLevel(1)
91 {
92  TEveBrowser* br = m_eve->GetBrowser();
93  TGMenuBar* menu = br->GetMenuBar();
98  TEveGeoShape::GetGeoMangeur()->AddNavigator();
99  TEveGeoShape::GetGeoMangeur()->SetCurrentNavigator(0);
101  m_evtHandler->Subscribe(this);
103  br->ShowCloseTab(kFALSE);
104  m_eve->GetViewers()->SwitchColorSet();
105  TFile::SetCacheFileDir(".");
106  BuildMenus(menu);
107  br->SetTabTitle("Global Scene",TRootBrowser::kRight,0);
108 }
109 
112  TRootBrowser* br = m_eve->GetBrowser();
114  m_viewConfigs.clear();
115  deletePtr(m_evtHandler);
116  deletePtr(m_eveGlobal);
117  deletePtr(m_geoGlobal);
118  br->CloseTabs();
119  deletePtr(m_dd4Menu);
120  deletePtr(m_viewMenu);
121  deletePtr(m_eve);
122  //br->ReallyDelete();
123  DetectorData* data = dynamic_cast<DetectorData*>(m_detDesc);
124  if ( data ) data->destroyData(false);
125  deletePtr(m_detDesc);
126  gGeoManager = 0;
127  gEve = 0;
128 }
129 
131 void Display::LoadXML(const char* xmlFile) {
132  TGeoManager& mgr = m_detDesc->manager();
133  bool has_geo = !m_geoTopics.empty();
134  m_detDesc->fromXML(xmlFile);
135  if ( !has_geo ) {
136  LoadGeoChildren(0,m_loadLevel,false);
137  mgr.SetVisLevel(m_visLevel);
138  }
139  if ( m_dd4Menu && !m_geoTopics.empty() ) {
141  }
142 
143  m_eve->FullRedraw3D(kTRUE); // Reset camera
144  BuildMenus(m_eve->GetBrowser()->GetMenuBar());
145 }
146 
148 void Display::LoadGeometryRoot(const char* /* rootFile */) {
149  throw std::runtime_error("This call is not implemented !");
150 }
151 
154  m_dd4Menu->OnLoadXML(0,0);
155 }
156 
159  return *m_detDesc;
160 }
161 
163 TGClient& Display::client() const {
164  return *gClient;
165 }
166 
169  if ( m_evtHandler ) {
170  return *m_evtHandler;
171  }
172  throw std::runtime_error("Invalid event handler");
173 }
174 
176 void Display::AddMenu(TGMenuBar* menubar, PopupMenu* menu, int hints) {
177  m_menus.insert(menu);
178  menu->Build(menubar, hints);
179  m_eve->FullRedraw3D(kTRUE); // Reset camera and redraw
180 }
181 
184  DisplayConfiguration::ViewConfigurations::const_iterator i;
185  for(i=config.views.begin(); i!=config.views.end(); ++i)
186  m_viewConfigs[(*i).name] = *i;
187 
188  DisplayConfiguration::Configurations::const_iterator j;
189  for(j=config.calodata.begin(); j!=config.calodata.end(); ++j)
190  m_calodataConfigs[(*j).name] = *j;
191  for(j=config.collections.begin(); j!=config.collections.end(); ++j)
192  m_collectionsConfigs[(*j).name] = *j;
193 }
194 
197  Calodata::iterator i = m_calodata.find(nam);
198  if ( i == m_calodata.end() ) {
199  DataConfigurations::const_iterator j = m_calodataConfigs.find(nam);
200  if ( j != m_calodataConfigs.end() ) {
201  CalodataContext ctx;
202  ctx.config = (*j).second;
203  std::string use = ctx.config.use;
204  std::string hits = ctx.config.hits;
205  if ( use.empty() ) {
206  const char* n = nam.c_str();
207  const DisplayConfiguration::Calodata& cd = (*j).second.data.calodata;
208  TH2F* h = new TH2F(n,n,cd.n_eta, cd.eta_min, cd.eta_max, cd.n_phi, cd.phi_min, cd.phi_max);
209  h->SetTitle(hits.c_str());
210  ctx.eveHist = new TEveCaloDataHist();
211  ctx.slice = ctx.eveHist->GetNSlices();
212  ctx.eveHist->AddHistogram(h);
213  ctx.eveHist->RefSliceInfo(0).Setup(n,cd.threshold,cd.color,101);
214  ctx.eveHist->GetEtaBins()->SetTitleFont(120);
215  ctx.eveHist->GetEtaBins()->SetTitle("h");
216  ctx.eveHist->GetPhiBins()->SetTitleFont(120);
217  ctx.eveHist->GetPhiBins()->SetTitle("f");
218  ctx.eveHist->IncDenyDestroy();
219 
220  ctx.calo3D = new TEveCalo3D(ctx.eveHist);
221  ctx.calo3D->SetName(n);
222  ctx.calo3D->SetBarrelRadius(cd.rmin);
223  ctx.calo3D->SetEndCapPos(cd.dz);
224  ctx.calo3D->SetAutoRange(kTRUE);
225  ctx.calo3D->SetMaxTowerH(cd.towerH);
226  ImportGeo(ctx.calo3D);
227  EtaPhiHistogramActor actor(h);
228  eventHandler().collectionLoop(hits,actor);
229  ctx.eveHist->DataChanged();
230  }
231  else {
233  ctx = c;
234  ctx.config.use = std::move(use);
235  ctx.config.hits = std::move(hits);
236  ctx.config.name = nam;
237  }
238  i = m_calodata.emplace(nam, ctx).first;
239  return (*i).second;
240  }
241  throw std::runtime_error("Cannot access calodata configuration " + nam);
242  }
243  return (*i).second;
244 }
245 
247 const Display::ViewConfig* Display::GetViewConfiguration(const std::string& nam) const {
248  ViewConfigurations::const_iterator i = m_viewConfigs.find(nam);
249  return (i == m_viewConfigs.end()) ? 0 : &((*i).second);
250 }
251 
253 const Display::DataConfig* Display::GetCalodataConfiguration(const std::string& nam) const {
254  DataConfigurations::const_iterator i = m_calodataConfigs.find(nam);
255  return (i == m_calodataConfigs.end()) ? 0 : &((*i).second);
256 }
257 
260  m_eveViews.insert(view);
261 }
262 
265  Views::iterator i = m_eveViews.find(view);
266  if ( i != m_eveViews.end() ) {
267  m_eveViews.erase(i);
268  }
269 }
270 
272 void Display::MessageBox(PrintLevel level, const std::string& text, const std::string& title) const {
273  std::string path = TString::Format("%s/", TROOT::GetIconPath().Data()).Data();
274  const TGPicture* pic = 0;
275  if ( level == VERBOSE )
276  pic = client().GetPicture((path+"mb_asterisk_s.xpm").c_str());
277  else if ( level == DEBUG )
278  pic = client().GetPicture((path+"mb_asterisk_s.xpm").c_str());
279  else if ( level == INFO )
280  pic = client().GetPicture((path+"mb_asterisk_s.xpm").c_str());
281  else if ( level == WARNING )
282  pic = client().GetPicture((path+"mb_excalamation_s.xpm").c_str());
283  else if ( level == ERROR )
284  pic = client().GetPicture((path+"mb_stop.xpm").c_str());
285  else if ( level == FATAL )
286  pic = client().GetPicture((path+"interrupt.xpm").c_str());
287  new TGMsgBox(gClient->GetRoot(),0,title.c_str(),text.c_str(),pic,
288  kMBDismiss,0,kVerticalFrame,kTextLeft|kTextCenterY);
289 }
290 
292 std::string Display::OpenXmlFileDialog(const std::string& default_dir) const {
293  static const char *evtFiletypes[] = {
294  "xml files", "*.xml",
295  "XML files", "*.XML",
296  "All files", "*",
297  0, 0
298  };
299  TGFileInfo fi;
300  fi.fFileTypes = evtFiletypes;
301  fi.fIniDir = StrDup(default_dir.c_str());
302  fi.fFilename = 0;
303  new TGFileDialog(client().GetRoot(), 0, kFDOpen, &fi);
304  if ( fi.fFilename ) {
305  std::string ret = fi.fFilename;
306  if ( ret.find("file:") != 0 ) return "file:"+ret;
307  return ret;
308  }
309  return "";
310 }
311 
313 std::string Display::OpenEventFileDialog(const std::string& default_dir) const {
314  static const char *evtFiletypes[] = {
315  "ROOT files", "*.root",
316  "SLCIO files", "*.slcio",
317  "LCIO files", "*.lcio",
318  "All files", "*",
319  0, 0
320  };
321  TGFileInfo fi;
322  fi.fFileTypes = evtFiletypes;
323  fi.fIniDir = StrDup(default_dir.c_str());
324  fi.fFilename = 0;
325  new TGFileDialog(client().GetRoot(), 0, kFDOpen, &fi);
326  if ( fi.fFilename ) {
327  return fi.fFilename;
328  }
329  return "";
330 }
331 
333 void Display::BuildMenus(TGMenuBar* menubar) {
334  if ( 0 == menubar ) {
335  menubar = m_eve->GetBrowser()->GetMenuBar();
336  }
337  if ( 0 == m_dd4Menu ) {
338  m_dd4Menu = new DD4hepMenu(this);
339  AddMenu(menubar, m_dd4Menu);
340  }
341  if ( 0 == m_viewMenu && !m_viewConfigs.empty() ) {
342  m_viewMenu = new ViewMenu(this,"&Views");
343  AddMenu(menubar, m_viewMenu, kLHintsRight);
344  }
345 }
346 
348 TFile* Display::Open(const char* name) const {
349  TFile* f = TFile::Open(name);
350  if ( f && !f->IsZombie() ) return f;
351  throw std::runtime_error("+++ Failed to open ROOT file:"+std::string(name));
352 }
353 
355 void Display::OnFileOpen(EventHandler& /* handler */ ) {
356 }
357 
361  typedef std::vector<EventHandler::Collection> Collections;
362  const Types& types = handler.data();
363  TEveElement* particles = 0;
364 
365  printout(ERROR,"EventHandler","+++ Display new event.....");
366  manager().GetEventScene()->DestroyElements();
367  for(Types::const_iterator ityp=types.begin(); ityp!=types.end(); ++ityp) {
368  const Collections& colls = (*ityp).second;
369  for(Collections::const_iterator j=colls.begin(); j!=colls.end(); ++j) {
370  std::size_t len = (*j).second;
371  if ( len > 0 ) {
372  const char* nam = (*j).first;
373  DataConfigurations::const_iterator icfg = m_collectionsConfigs.find(nam);
374  DataConfigurations::const_iterator cfgend = m_collectionsConfigs.end();
375  EventHandler::CollectionType typ = handler.collectionType(nam);
376  if ( typ == EventHandler::CALO_HIT_COLLECTION ||
378  if ( icfg != cfgend ) {
379  const DataConfig& cfg = (*icfg).second;
380  if ( ::toupper(cfg.use[0]) == 'T' || ::toupper(cfg.use[0]) == 'Y' ) {
381  if ( cfg.hits == "PointSet" ) {
382  PointsetCreator cr(nam,len,cfg);
383  handler.collectionLoop((*j).first, cr);
384  ImportEvent(cr.element());
385  }
386  else if ( cfg.hits == "BoxSet" ) {
387  BoxsetCreator cr(nam,len,cfg);
388  handler.collectionLoop((*j).first, cr);
389  ImportEvent(cr.element());
390  }
391  else if ( cfg.hits == "TowerSet" ) {
392  TowersetCreator cr(nam,len,cfg);
393  handler.collectionLoop((*j).first, cr);
394  ImportEvent(cr.element());
395  }
396  else { // Default is point set
397  PointsetCreator cr(nam,len);
398  handler.collectionLoop((*j).first, cr);
399  ImportEvent(cr.element());
400  }
401  }
402  }
403  else {
404  PointsetCreator cr(nam,len);
405  handler.collectionLoop((*j).first, cr);
406  ImportEvent(cr.element());
407  }
408  }
409  else if ( typ == EventHandler::PARTICLE_COLLECTION ) {
410  // We do not have to care about memory leaks here:
411  // TEveTrackPropagator is reference counted and will be destroyed if the
412  // last track is gone ie. when we re-initialize the event scene
413 
414  // $$$ Do not know exactly what the field parameters mean
415  if ( (icfg=m_collectionsConfigs.find("StartVertexPoints")) != cfgend ) {
416  StartVertexCreator cr("StartVertexPoints", len, (*icfg).second);
417  handler.collectionLoop((*j).first, cr);
418  printout(INFO,"Display","+++ StartVertexPoints: Filled %d start vertex points.....",cr.count);
419  ImportEvent(cr.element());
420  }
421  if ( (icfg=m_collectionsConfigs.find("MCParticles")) != cfgend ) {
422  MCParticleCreator cr(new TEveTrackPropagator("","",new TEveMagFieldDuo(350, -3.5, 2.0)),
423  new TEveCompound("MC_Particles","MC_Particles"),
424  icfg == cfgend ? 0 : &((*icfg).second));
425  handler.collectionLoop((*j).first, cr);
426  printout(INFO,"Display","+++ StartVertexPoints: Filled %d patricle tracks.....",cr.count);
427  cr.close();
428  particles = cr.particles;
429  }
430  }
431  }
432  }
433  }
434  for(Calodata::iterator i = m_calodata.begin(); i != m_calodata.end(); ++i)
435  (*i).second.eveHist->GetHist(0)->Reset();
436  for(Calodata::iterator i = m_calodata.begin(); i != m_calodata.end(); ++i) {
437  CalodataContext& ctx = (*i).second;
438  TH2F* h = ctx.eveHist->GetHist(0);
439  EtaPhiHistogramActor actor(h);
440  std::size_t n = eventHandler().collectionLoop(ctx.config.hits, actor);
441  ctx.eveHist->DataChanged();
442  printout(INFO,"FillEtaPhiHistogram","+++ %s: Filled %ld hits from %s....",
443  ctx.calo3D->GetName(), n, ctx.config.hits.c_str());
444  }
447  if ( particles ) {
448  ImportEvent(particles);
449  }
450  for(Views::iterator i = m_eveViews.begin(); i != m_eveViews.end(); ++i)
451  (*i)->ConfigureEventFromInfo();
452  manager().Redraw3D();
453 }
454 
457  if ( 0 == m_geoGlobal ) {
458  m_geoGlobal = new ElementList("Geo-Global","Geo-Global", true, true);
459  manager().AddGlobalElement(m_geoGlobal);
460  }
461  return *m_geoGlobal;
462 }
463 
465 TEveElementList& Display::GetGeoTopic(const std::string& name) {
466  Topics::iterator i=m_geoTopics.find(name);
467  if ( i == m_geoTopics.end() ) {
468  TEveElementList* topic = new ElementList(name.c_str(), name.c_str(), true, true);
469  m_geoTopics[name] = topic;
470  GetGeo().AddElement(topic);
471  return *topic;
472  }
473  return *((*i).second);
474 }
475 
477 TEveElementList& Display::GetGeoTopic(const std::string& name) const {
478  Topics::const_iterator i=m_geoTopics.find(name);
479  if ( i == m_geoTopics.end() ) {
480  throw std::runtime_error("Display: Attempt to access non-existing geometry topic:"+name);
481  }
482  return *((*i).second);
483 }
484 
486 TEveElementList& Display::GetEveTopic(const std::string& name) {
487  Topics::iterator i=m_eveTopics.find(name);
488  if ( i == m_eveTopics.end() ) {
489  TEveElementList* topic = new ElementList(name.c_str(), name.c_str(), true, true);
490  m_eveTopics[name] = topic;
491  manager().GetEventScene()->AddElement(topic);
492  return *topic;
493  }
494  return *((*i).second);
495 }
496 
498 TEveElementList& Display::GetEveTopic(const std::string& name) const {
499  Topics::const_iterator i=m_eveTopics.find(name);
500  if ( i == m_eveTopics.end() ) {
501  throw std::runtime_error("Display: Attempt to access non-existing event topic:"+name);
502  }
503  return *((*i).second);
504 }
505 
507 void Display::ImportGeo(TEveElement* el) {
508  GetGeo().AddElement(el);
509 }
510 
512 void Display::ImportGeo(const std::string& topic, TEveElement* el) {
513  GetGeoTopic(topic).AddElement(el);
514 }
515 
517 void Display::ImportEvent(const std::string& topic, TEveElement* el) {
518  GetEveTopic(topic).AddElement(el);
519 }
520 
522 void Display::ImportEvent(TEveElement* el) {
523  manager().GetEventScene()->AddElement(el);
524 }
525 
527 void Display::LoadGeoChildren(TEveElement* start, int levels, bool redraw) {
528  using namespace dd4hep::detail;
529  DetElement world = m_detDesc->world();
530  if ( world.children().size() == 0 ) {
531  MessageBox(INFO,"It looks like there is no\nGeometry loaded.\nNo event display availible.\n");
532  }
533  else if ( levels > 0 ) {
534  if ( 0 == start ) {
535  TEveElementList& sens = GetGeoTopic("Sensitive");
536  TEveElementList& struc = GetGeoTopic("Structure");
537  const DetElement::Children& c = world.children();
538 
539  printout(INFO,"Display","+++ Load children of %s to %d levels",
540  world.placement().name(), levels);
541  for (DetElement::Children::const_iterator i = c.begin(); i != c.end(); ++i) {
542  DetElement de = (*i).second;
544  TEveElementList& parent = sd.isValid() ? sens : struc;
545  std::pair<bool,TEveElement*> e = Utilities::LoadDetElement(de,levels,&parent);
546  if ( e.second && e.first ) {
547  parent.AddElement(e.second);
548  }
549  }
550  }
551  else {
552  TGeoNode* n = (TGeoNode*)start->GetUserData();
553  printout(INFO,"Display","+++ Load children of %s to %d levels",Utilities::GetName(start),levels);
554  if ( 0 != n ) {
555  TGeoHMatrix mat;
556  const char* node_name = n->GetName();
557  int level = Utilities::findNodeWithMatrix(detectorDescription().world().placement().ptr(),n,&mat);
558  if ( level > 0 ) {
559  std::pair<bool,TEveElement*> e(false,0);
560  const DetElement::Children& c = world.children();
561  for (DetElement::Children::const_iterator i = c.begin(); i != c.end(); ++i) {
562  DetElement de = (*i).second;
563  if ( de.placement().ptr() == n ) {
564  e = Utilities::createEveShape(0, levels, start, n, mat, de.name());
565  break;
566  }
567  }
568  if ( !e.first && !e.second ) {
569  e = Utilities::createEveShape(0, levels, start, n, mat, node_name);
570  }
571  if ( e.first ) { // newly created
572  start->AddElement(e.second);
573  }
574  printout(INFO,"Display","+++ Import geometry node %s with %d levels.",node_name, levels);
575  }
576  else {
577  printout(INFO,"Display","+++ FAILED to import geometry node %s with %d levels.",node_name, levels);
578  }
579  }
580  else {
581  LoadGeoChildren(0,levels,false);
582  }
583  }
584  }
585  if ( redraw ) {
586  manager().Redraw3D();
587  }
588 }
589 
591 void Display::MakeNodesVisible(TEveElement* e, bool visible, int level) {
592  printout(INFO,"Display","+++ %s element %s with a depth of %d.",
593  visible ? "Show" : "Hide",Utilities::GetName(e),level);
594  Utilities::MakeNodesVisible(e, visible, level);
595  manager().Redraw3D();
596 }
dd4hep::EventHandler::collectionType
virtual CollectionType collectionType(const std::string &collection) const =0
Access to the collection type by name.
ViewMenu.h
dd4hep::Display::GetCalodataConfiguration
const DataConfig * GetCalodataConfiguration(const std::string &name) const
Access a data filter by name. Data filters are used to customize views.
Definition: Display.cpp:253
dd4hep::DetElement::children
const Children & children() const
Access to the list of children.
Definition: DetElement.cpp:207
dd4hep::TowersetCreator
Fill a 3D tower set from a hit collection.
Definition: HitActors.h:94
dd4hep::Display::MakeNodesVisible
void MakeNodesVisible(TEveElement *e, bool visible, int level)
Make a set of nodes starting from a top element (in-)visible with a given depth.
Definition: Display.cpp:591
dd4hep::Detector::manager
virtual TGeoManager & manager() const =0
Access the geometry manager of this instance.
dd4hep::Display
The main class of the DDEve display.
Definition: Display.h:56
dd4hep::Detector::addExtension
IFACE * addExtension(CONCRETE *c)
Extend the sensitive detector element with an arbitrary structure accessible by the type.
Definition: Detector.h:331
dd4hep::Display::MessageBox
void MessageBox(PrintLevel level, const std::string &text, const std::string &title="") const
Open standard message box.
Definition: Display.cpp:272
dd4hep::MCParticleCreator::count
int count
Definition: ParticleActors.h:45
dd4hep::Detector::world
virtual DetElement world() const =0
Return reference to the top-most (world) detector element.
dd4hep::GenericEventHandler
Event handler base class. Interface to all DDEve I/O actions.
Definition: GenericEventHandler.h:30
dd4hep::Display::getEventHandlerName
std::string getEventHandlerName()
Get Event Handler Plugin name.
Definition: Display.h:139
dd4hep::Display::m_eveTopics
Topics m_eveTopics
Event data topics.
Definition: Display.h:102
dd4hep::Display::m_viewConfigs
ViewConfigurations m_viewConfigs
Container with view configurations.
Definition: Display.h:108
EvePgonSetProjectedContextMenu.h
dd4hep::SensitiveDetector
Handle class to hold the information of a sensitive detector.
Definition: DetElement.h:44
dd4hep::Display::CalodataContext::calo3D
TEveCalo3D * calo3D
Definition: Display.h:70
dd4hep::DisplayConfiguration::Calodata::rmin
float rmin
Definition: DisplayConfiguration.h:69
dd4hep::Display::m_menus
Menus m_menus
Container with top level menues.
Definition: Display.h:106
Detector.h
dd4hep::Utilities::findNodeWithMatrix
int findNodeWithMatrix(TGeoNode *p, TGeoNode *n, TGeoHMatrix *mat, std::string *sub_path=0)
Definition: Utilities.cpp:164
dd4hep::EventHandler
Event handler base class: Interface to all DDEve I/O actions.
Definition: EventHandler.h:67
dd4hep::Display::ImportGeo
void ImportGeo(TEveElement *el)
Call to import geometry elements.
Definition: Display.cpp:507
dd4hep::Display::m_viewMenu
ViewMenu * m_viewMenu
Reference to the view menu.
Definition: Display.h:96
dd4hep::GenericEventHandler::collectionLoop
virtual size_t collectionLoop(const std::string &collection, DDEveHitActor &actor) override
Loop over collection and extract data.
Definition: GenericEventHandler.cpp:84
dd4hep::EventHandler::TRACKER_HIT_COLLECTION
@ TRACKER_HIT_COLLECTION
Definition: EventHandler.h:74
dd4hep::DetElement::placement
PlacedVolume placement() const
Access to the physical volume of this detector element.
Definition: DetElement.cpp:321
dd4hep::StartVertexCreator::count
int count
Definition: ParticleActors.h:69
dd4hep::Display::GetGeoTopic
virtual TEveElementList & GetGeoTopic(const std::string &name)
Access/Create an geometry topic by name.
Definition: Display.cpp:465
dd4hep::PointsetCreator::element
TEveElement * element() const
Return eve element.
Definition: HitActors.cpp:60
dd4hep::Display::OpenEventFileDialog
std::string OpenEventFileDialog(const std::string &default_dir) const
Popup ROOT file chooser. returns chosen file name; empty on cancel.
Definition: Display.cpp:313
dd4hep::GenericEventHandler::Subscribe
virtual void Subscribe(EventConsumer *display)
Subscribe to notification of new data present.
Definition: GenericEventHandler.cpp:55
dd4hep::DisplayConfiguration::Calodata::eta_max
float eta_max
Definition: DisplayConfiguration.h:70
dd4hep::Display::LoadGeoChildren
void LoadGeoChildren(TEveElement *start, int levels, bool redraw)
Load 'levels' Children into the geometry scene.
Definition: Display.cpp:527
dd4hep::Handle::isValid
bool isValid() const
Check the validity of the object held by the handle.
Definition: Handle.h:128
dd4hep::Display::m_visLevel
int m_visLevel
TGeoManager visualisation level.
Definition: Display.h:116
GenericEventHandler.h
dd4hep::ElementList
Local implementation with overrides of the TEveElementList.
Definition: ElementList.h:35
dd4hep::ViewMenu
class ViewMenu ViewMenu.h DDEve/ViewMenu.h
Definition: ViewMenu.h:36
dd4hep::Handle::name
const char * name() const
Access the object name (or "" if not supported by the object)
dd4hep::DisplayConfiguration::Defaults::color
int color
Definition: DisplayConfiguration.h:58
dd4hep::Display::m_calodataConfigs
DataConfigurations m_calodataConfigs
Container with calorimeter data display configurations.
Definition: Display.h:110
Utilities.h
dd4hep::Display::GetViewConfiguration
const ViewConfig * GetViewConfiguration(const std::string &name) const
Access a data filter by name. Data filters are used to customize views.
Definition: Display.cpp:247
TEveElementList
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
Definition: ROOTClasses.h:13
dd4hep::Utilities::createEveShape
std::pair< bool, TEveElement * > createEveShape(int level, int max_level, TEveElement *p, TGeoNode *n, const TGeoHMatrix &mat, const std::string &node_name)
Definition: Utilities.cpp:75
ClassImp
ClassImp(Display) namespace dd4hep
Definition: Display.cpp:61
dd4hep::Display::m_eveViews
Views m_eveViews
Container with configured event views.
Definition: Display.h:104
dd4hep::Display::OpenXmlFileDialog
std::string OpenXmlFileDialog(const std::string &default_dir) const
Popup XML file chooser. returns chosen file name; empty on cancel.
Definition: Display.cpp:292
ParticleActors.h
dd4hep::PointsetCreator
Fill a 3D pointset from a hit collection.
Definition: HitActors.h:49
DDEveEventData.h
dd4hep::Display::CalodataContext::slice
int slice
Definition: Display.h:69
EveShapeContextMenu.h
dd4hep::DisplayConfiguration::Calodata::towerH
float towerH
Definition: DisplayConfiguration.h:69
dd4hep::Detector::getInstance
static Detector & getInstance(const std::string &name="default")
—Factory method----—
Definition: DetectorImp.cpp:150
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:188
dd4hep::Utilities::GetName
const char * GetName(T *p)
Definition: Utilities.h:45
dd4hep::Display::GetCaloHistogram
CalodataContext & GetCaloHistogram(const std::string &name)
Access to calo data histograms by name as defined in the configuration.
Definition: Display.cpp:196
dd4hep::Display::CalodataContext::eveHist
TEveCaloDataHist * eveHist
Definition: Display.h:72
dd4hep::detail
DD4hep internal namespace.
Definition: Alignments.h:32
dd4hep::EveDisplay
void EveDisplay(const char *xmlFile, const char *eventFileName)
dd4hep::DisplayConfiguration::Calodata::phi_min
float phi_min
Definition: DisplayConfiguration.h:71
dd4hep::DisplayConfiguration::views
ViewConfigurations views
Container with view configurations.
Definition: DisplayConfiguration.h:137
dd4hep::EtaPhiHistogramActor
Fill EtaPhi histograms from a hit collection.
Definition: HitActors.h:35
dd4hep::BoxsetCreator::element
TEveElement * element() const
Return eve element.
Definition: HitActors.cpp:119
dd4hep::Detector::sensitiveDetector
virtual SensitiveDetector sensitiveDetector(const std::string &name) const =0
Retrieve a sensitive detector by its name from the detector description.
dd4hep::EventHandler::CALO_HIT_COLLECTION
@ CALO_HIT_COLLECTION
Definition: EventHandler.h:73
dd4hep::Display::LoadXML
void LoadXML(const char *xmlFile)
Load geometry from compact xml file.
Definition: Display.cpp:131
Display.h
dd4hep::DD4hepMenu::OnLoadXML
void OnLoadXML(TGMenuEntry *entry, void *ptr)
Callback when loading the configuration.
Definition: DD4hepMenu.cpp:84
dd4hep::Display::m_eveGlobal
TEveElementList * m_eveGlobal
Event item element list.
Definition: Display.h:94
dd4hep::Display::detectorDescription
Detector & detectorDescription() const
Access to geometry hub.
Definition: Display.cpp:158
dd4hep::EventHandler::CollectionType
CollectionType
Definition: EventHandler.h:69
dd4hep::Display::client
TGClient & client() const
Access to X-client.
Definition: Display.cpp:163
dd4hep::DisplayConfiguration::Calodata::eta_min
float eta_min
Definition: DisplayConfiguration.h:70
dd4hep::DetectorData::destroyData
void destroyData(bool destroy_mgr=true)
Clear data content: releases all allocated resources.
Definition: DetectorData.cpp:209
dd4hep::Display::CalodataContext::config
DisplayConfiguration::Config config
Definition: Display.h:73
dd4hep::EveShapeContextMenu::install
static EveShapeContextMenu & install(Display *m)
Instantiator.
dd4hep::DisplayConfiguration::Calodata::n_eta
short n_eta
Definition: DisplayConfiguration.h:72
dd4hep::ElementListContextMenu::install
static ElementListContextMenu & install(Display *m)
Instantiator.
Definition: ElementList.cpp:57
dd4hep::Display::m_loadLevel
int m_loadLevel
Load level for the eve geometry.
Definition: Display.h:118
dd4hep::MCParticleCreator::particles
TEveCompound * particles
Definition: ParticleActors.h:42
dd4hep::DisplayConfiguration::Calodata::n_phi
short n_phi
Definition: DisplayConfiguration.h:73
dd4hep::Display::~Display
virtual ~Display()
Default destructor.
Definition: Display.cpp:111
dd4hep::Display::m_detDesc
Detector * m_detDesc
Reference to geometry hub.
Definition: Display.h:88
dd4hep::EvePgonSetProjectedContextMenu::install
static EvePgonSetProjectedContextMenu & install(Display *m)
Instantiator.
dd4hep::Display::m_evtHandler
GenericEventHandler * m_evtHandler
Reference to the event reader object.
Definition: Display.h:90
dd4hep::DisplayConfiguration::Config
Container with full display configuration.
Definition: DisplayConfiguration.h:92
dd4hep::Display::GetGeo
TEveElementList & GetGeo()
Access / Create global geometry element.
Definition: Display.cpp:456
DetectorData.h
dd4hep::Utilities::LoadDetElement
std::pair< bool, TEveElement * > LoadDetElement(DetElement element, int levels, TEveElement *parent)
Definition: Utilities.cpp:190
dd4hep::Display::m_calodata
Calodata m_calodata
Container with calorimeter data (projections)
Definition: Display.h:114
dd4hep::EventHandler::PARTICLE_COLLECTION
@ PARTICLE_COLLECTION
Definition: EventHandler.h:71
dd4hep::Display::Display
Display(TEveManager *eve)
Standard constructor.
Definition: Display.cpp:88
dd4hep::GenericEventHandler::Open
virtual bool Open(const std::string &type, const std::string &file_name) override
Open a new event data file.
Definition: GenericEventHandler.cpp:100
ElementList.h
dd4hep::StartVertexCreator
Fill a 3D pointset with particle start vertices.
Definition: ParticleActors.h:66
dd4hep::Display::LoadGeometryRoot
void LoadGeometryRoot(const char *rootFile)
Load geometry from compact xml file.
Definition: Display.cpp:148
dd4hep::DisplayConfiguration::Config::name
std::string name
Definition: DisplayConfiguration.h:103
dd4hep::DisplayConfiguration::ViewConfig
View configuration.
Definition: DisplayConfiguration.h:119
dd4hep::DetElement::Children
std::map< std::string, DetElement > Children
Definition: DetElement.h:206
dd4hep::MCParticleCreator::close
void close()
Close compounds.
Definition: ParticleActors.cpp:106
dd4hep::Display::GetEveTopic
virtual TEveElementList & GetEveTopic(const std::string &name)
Access/Create an event topic by name.
Definition: Display.cpp:486
dd4hep::DisplayConfiguration::Calodata::threshold
float threshold
Definition: DisplayConfiguration.h:69
dd4hep::Display::ChooseGeometry
void ChooseGeometry()
Load geometry with panel.
Definition: Display.cpp:153
dd4hep::PopupMenu
class PopupMenu PopupMenu.h DDEve/PopupMenu.h
Definition: PopupMenu.h:36
dd4hep::Handle::ptr
T * ptr() const
Access to the held object.
Definition: Handle.h:153
dd4hep::Display::eventHandler
GenericEventHandler & eventHandler() const
Access to the event reader.
Definition: Display.cpp:168
dd4hep::DisplayConfiguration::Calodata
Configuration class for 3D calorimeter data display.
Definition: DisplayConfiguration.h:68
dd4hep::Display::m_geoTopics
Topics m_geoTopics
Geometry data topics.
Definition: Display.h:100
dd4hep::DisplayConfiguration
Generic display configuration structure for DDEve.
Definition: DisplayConfiguration.h:40
dd4hep::Display::AddMenu
virtual void AddMenu(TGMenuBar *menuBar, PopupMenu *menu, int hints=kLHintsNormal)
Add new menu to the main menu bar.
Definition: Display.cpp:176
dd4hep::DD4hepMenu
dd4hep Menu for the ROOT browser
Definition: DD4hepMenu.h:37
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::Display::ImportEvent
void ImportEvent(TEveElement *el)
Call to import top level event elements.
Definition: Display.cpp:522
dd4hep::Display::OnFileOpen
virtual void OnFileOpen(EventHandler &handler) override
Consumer overload: open file.
Definition: Display.cpp:355
dd4hep::DetectorData
Data implementation class of the Detector interface.
Definition: DetectorData.h:38
dd4hep::EventHandler::collectionLoop
virtual size_t collectionLoop(const std::string &collection, DDEveHitActor &actor)=0
Loop over collection and extract hit data.
dd4hep::DD4hepMenu::OnGeometryLoaded
void OnGeometryLoaded()
Callback when the geometry was loaded.
Definition: DD4hepMenu.cpp:74
dd4hep::Display::Open
TFile * Open(const char *rootFile) const
Open ROOT file.
Definition: Display.cpp:348
dd4hep::PopupMenu::Build
virtual void Build(TGMenuBar *menuBar, int hints=kLHintsNormal)
Add the menu to the menu bar.
Definition: PopupMenu.cpp:41
dd4hep::Detector::fromXML
virtual void fromXML(const std::string &fname, DetectorBuildType type=BUILD_DEFAULT)=0
Read any geometry description or alignment file.
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90
dd4hep::DisplayConfiguration::Calodata::dz
float dz
Definition: DisplayConfiguration.h:69
dd4hep::Display::BuildMenus
virtual void BuildMenus(TGMenuBar *menuBar=0)
Build the DDEve specific menues. Default bar is the ROOT browser's bar.
Definition: Display.cpp:333
dd4hep::View
class View View.h DDEve/View.h
Definition: View.h:45
dd4hep::DisplayConfiguration::Config::hits
std::string hits
Definition: DisplayConfiguration.h:104
dd4hep::Display::CalodataContext
Calorimeter data context for the DDEve event display.
Definition: Display.h:68
dd4hep::Utilities::MakeNodesVisible
void MakeNodesVisible(TEveElement *e, bool visible, int level)
Make a set of nodes starting from a top element (in-)visible with a given depth.
Definition: Utilities.cpp:56
dd4hep::Display::UnregisterEvents
virtual void UnregisterEvents(View *view)
Unregister from the main event scene.
Definition: Display.cpp:264
dd4hep::DisplayConfiguration::calodata
Configurations calodata
Container with calorimeter data configurations.
Definition: DisplayConfiguration.h:139
DD4hepMenu.h
View.h
dd4hep::EventHandler::TypedEventCollections
std::map< std::string, std::vector< Collection > > TypedEventCollections
Types collection: collections are grouped by type (class name)
Definition: EventHandler.h:80
dd4hep::Display::RegisterEvents
virtual void RegisterEvents(View *view)
Register to the main event scene on new events.
Definition: Display.cpp:259
dd4hep::Display::ImportConfiguration
void ImportConfiguration(const DisplayConfiguration &config)
Import configuration parameters.
Definition: Display.cpp:183
dd4hep::MCParticleCreator
Fill eve particles from a MC particle collection.
Definition: ParticleActors.h:39
Printout.h
dd4hep::Display::m_dd4Menu
DD4hepMenu * m_dd4Menu
Reference to the specialized ddeve menu.
Definition: Display.h:98
dd4hep::StartVertexCreator::element
TEveElement * element() const
Return eve element.
Definition: ParticleActors.cpp:202
dd4hep::Display::OnNewEvent
virtual void OnNewEvent(EventHandler &handler) override
EventConsumer overload: Consumer event data.
Definition: Display.cpp:359
dd4hep::Display::manager
TEveManager & manager() const
Access to the EVE manager.
Definition: Display.h:131
dd4hep::EventHandler::data
virtual const TypedEventCollections & data() const =0
Access the map of simulation data collections.
dd4hep::Display::m_geoGlobal
TEveElementList * m_geoGlobal
Geometry item element list.
Definition: Display.h:92
dd4hep::BoxsetCreator
Fill a 3D box set from a hit collection.
Definition: HitActors.h:72
dd4hep::Detector::removeExtension
IFACE * removeExtension(bool destroy=true)
Remove an existing extension object from the Detector instance. If not destroyed, the instance is ret...
Definition: Detector.h:337
dd4hep::DisplayConfiguration::Config::use
std::string use
Definition: DisplayConfiguration.h:105
dd4hep::DisplayConfiguration::Calodata::phi_max
float phi_max
Definition: DisplayConfiguration.h:71
dd4hep::DisplayConfiguration::collections
Configurations collections
Container for data collection configurations.
Definition: DisplayConfiguration.h:141
HitActors.h
dd4hep::Display::m_eve
TEveManager * m_eve
Reference to TEve manager.
Definition: Display.h:86
dd4hep::Display::m_collectionsConfigs
DataConfigurations m_collectionsConfigs
Container with non-calorimeter data display configurations.
Definition: Display.h:112