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