CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
FWEveViewManager Class Reference

#include <Fireworks/Core/interface/FWEveViewManager.h>

Inheritance diagram for FWEveViewManager:
FWViewManagerBase

Classes

struct  BuilderInfo
 

Public Member Functions

void eventBegin () override
 
void eventEnd () override
 
 FWEveViewManager (FWGUIManager *)
 
void highlightAdded (TEveElement *)
 
void newItem (const FWEventItem *) override
 
virtual void removeItem (const FWEventItem *)
 
void selectionAdded (TEveElement *)
 
void selectionCleared ()
 
void selectionRemoved (TEveElement *)
 
void setContext (const fireworks::Context *) override
 
FWTypeToRepresentations supportedTypesAndRepresentations () const override
 
 ~FWEveViewManager () override
 
- Public Member Functions inherited from FWViewManagerBase
void colorsChangedSlot ()
 
const fireworks::Contextcontext () const
 
void modelChangesComingSlot ()
 
void modelChangesDoneSlot ()
 
void setChangeManager (FWModelChangeManager *iCM)
 
void setColorManager (FWColorManager *iCM)
 
virtual ~FWViewManagerBase ()
 

Static Public Member Functions

static void syncAllViews ()
 

Protected Member Functions

void colorsChanged () override
 
void modelChangesComing () override
 
void modelChangesDone () override
 
- Protected Member Functions inherited from FWViewManagerBase
FWModelChangeManagerchangeManager () const
 
FWColorManagercolorManager () const
 
void * createInstanceOf (const TClass *iBaseClass, const char *iNameOfClass)
 
 FWViewManagerBase ()
 

Private Types

typedef std::vector< std::shared_ptr< FWProxyBuilderBase > > BuilderVec
 
typedef BuilderVec::iterator BuilderVec_it
 
typedef std::vector< std::shared_ptr< FWEveView > >::iterator EveViewVec_it
 
typedef std::map< std::string, std::vector< BuilderInfo > > TypeToBuilder
 

Private Member Functions

void beingDestroyed (const FWViewBase *)
 
FWViewBasebuildView (TEveWindowSlot *iParent, const std::string &type)
 
void eventCenterChanged ()
 
FWEveViewfinishViewCreate (std::shared_ptr< FWEveView >)
 
 FWEveViewManager (const FWEveViewManager &)=delete
 
void globalEnergyScaleChanged ()
 
bool haveViewForBit (int) const
 
void itemChanged (const FWEventItem *)
 
void modelChanges (const FWModelIds &iIds)
 
const FWEveViewManageroperator= (const FWEveViewManager &)=delete
 

Private Attributes

std::map< int, BuilderVecm_builders
 
std::map< const FWEventItem *, FWInteractionList * > m_interactionLists
 
TypeToBuilder m_typeToBuilder
 
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views
 

Static Private Attributes

static bool s_syncAllViews = false
 

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 44 of file FWEveViewManager.h.

Member Typedef Documentation

◆ BuilderVec

typedef std::vector<std::shared_ptr<FWProxyBuilderBase> > FWEveViewManager::BuilderVec
private

Definition at line 100 of file FWEveViewManager.h.

◆ BuilderVec_it

typedef BuilderVec::iterator FWEveViewManager::BuilderVec_it
private

Definition at line 101 of file FWEveViewManager.h.

◆ EveViewVec_it

typedef std::vector<std::shared_ptr<FWEveView> >::iterator FWEveViewManager::EveViewVec_it
private

Definition at line 102 of file FWEveViewManager.h.

◆ TypeToBuilder

typedef std::map<std::string, std::vector<BuilderInfo> > FWEveViewManager::TypeToBuilder
private

Definition at line 99 of file FWEveViewManager.h.

Constructor & Destructor Documentation

◆ FWEveViewManager() [1/2]

FWEveViewManager::FWEveViewManager ( FWGUIManager iGUIMgr)

Definition at line 79 of file FWEveViewManager.cc.

79  : FWViewManagerBase() {
80  // builders
81  std::set<std::string> builders;
82 
83  std::vector<edmplugin::PluginInfo> available = FWProxyBuilderFactory::get()->available();
84  std::transform(available.begin(),
85  available.end(),
86  std::inserter(builders, builders.begin()),
87  boost::bind(&edmplugin::PluginInfo::name_, _1));
88 
91  available =
93  std::transform(available.begin(),
94  available.end(),
95  std::inserter(builders, builders.begin()),
96  boost::bind(&edmplugin::PluginInfo::name_, _1));
97  }
98 
99  for (std::set<std::string>::iterator it = builders.begin(), itEnd = builders.end(); it != itEnd; ++it) {
100  std::string::size_type first = it->find_first_of('@') + 1;
101  std::string purpose = it->substr(first, it->find_last_of('@') - first);
102 
103  first = it->find_last_of('@') + 1;
104  std::string view_str = it->substr(first, it->find_last_of('#') - first);
105  int viewTypes = atoi(view_str.c_str());
106  std::string fullName = *it;
107  m_typeToBuilder[purpose].push_back(BuilderInfo(*it, viewTypes));
108  }
109 
111 
112  // view construction called via GUI mng
113  FWGUIManager::ViewBuildFunctor f = boost::bind(&FWEveViewManager::buildView, this, _1, _2);
114  for (int i = 0; i < FWViewType::kTypeSize; i++) {
116  continue;
118  }
119 
120  // signal
121  gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_Master);
122  TEveSelection* eveSelection = gEve->GetSelection();
123  eveSelection->SetPickToSelect(TEveSelection::kPS_Master);
124  eveSelection->Connect("SelectionAdded(TEveElement*)", "FWEveViewManager", this, "selectionAdded(TEveElement*)");
125  eveSelection->Connect("SelectionRepeated(TEveElement*)", "FWEveViewManager", this, "selectionAdded(TEveElement*)");
126  eveSelection->Connect("SelectionRemoved(TEveElement*)", "FWEveViewManager", this, "selectionRemoved(TEveElement*)");
127  eveSelection->Connect("SelectionCleared()", "FWEveViewManager", this, "selectionCleared()");
128 
129  gEve->GetHighlight()->Connect(
130  "SelectionAdded(TEveElement*)", "FWEveViewManager", this, "highlightAdded(TEveElement*)");
131  gEve->GetHighlight()->Connect(
132  "SelectionRepeated(TEveElement*)", "FWEveViewManager", this, "highlightAdded(TEveElement*)");
133 
134  TGeoManager::SetVerboseLevel(0);
135 }

References HLT_2018_cff::builders, buildView(), taus_updatedMVAIds_cff::category, edmplugin::PluginManager::categoryToInfos(), f, dqmdumpme::first, newFWLiteAna::fullName, edmplugin::PluginManager::get(), get, mps_fire::i, FWViewType::idToName(), FWViewType::kTable, FWViewType::kTableHLT, FWViewType::kTableL1, FWViewType::kTypeSize, m_typeToBuilder, m_views, edmplugin::PluginInfo::name_, hgcalPlots::purpose, FWGUIManager::registerViewBuilder(), AlCaHLTBitMon_QueryRunRegistry::string, and HcalDetIdTransform::transform().

◆ ~FWEveViewManager()

FWEveViewManager::~FWEveViewManager ( )
override

Definition at line 137 of file FWEveViewManager.cc.

137 {}

◆ FWEveViewManager() [2/2]

FWEveViewManager::FWEveViewManager ( const FWEveViewManager )
privatedelete

Member Function Documentation

◆ beingDestroyed()

void FWEveViewManager::beingDestroyed ( const FWViewBase vb)
private

Definition at line 373 of file FWEveViewManager.cc.

373  {
374  FWEveView* view = (FWEveView*)vb;
375  int typeId = view->typeId();
376 
377  int viewerBit = 1 << typeId;
378  int nviews = m_views[typeId].size();
379  for (std::map<int, BuilderVec>::iterator i = m_builders.begin(); i != m_builders.end(); ++i) {
380  int builderBit = i->first;
381  if (viewerBit == (builderBit & viewerBit)) // check only in case if connected
382  {
383  BuilderVec& bv = i->second;
384 
385  // remove view-owned product
386  if (viewerBit == (builderBit & viewerBit)) {
387  for (BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt)
388  (*bIt)->removePerViewProduct(view->typeId(), view->viewContext());
389  }
390 
391  // and setup proxy builders have-a-window flag
392  if (nviews == 1) {
393  if (!haveViewForBit(builderBit)) {
394  if (viewerBit == (builderBit & viewerBit)) {
395  for (BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt)
396  (*bIt)->setHaveWindow(false);
397  }
398  }
399  }
400  }
401  }
402 
403  for (EveViewVec_it i = m_views[typeId].begin(); i != m_views[typeId].end(); ++i) {
404  if (i->get() == vb) {
405  m_views[typeId].erase(i);
406  break;
407  }
408  }
409 }

References begin, haveViewForBit(), mps_fire::i, m_builders, m_views, FWViewBase::typeId(), and FWEveView::viewContext().

Referenced by finishViewCreate().

◆ buildView()

FWViewBase * FWEveViewManager::buildView ( TEveWindowSlot *  iParent,
const std::string &  type 
)
private

Definition at line 269 of file FWEveViewManager.cc.

269  {
271  for (int i = 0; i < FWViewType::kTypeSize; ++i) {
272  if (viewName == FWViewType::idToName(i)) {
274  break;
275  }
276  }
277 
278  std::shared_ptr<FWEveView> view;
279  switch (type) {
280  case FWViewType::k3D:
281  view.reset(new FW3DView(iParent, type));
282  break;
283  case FWViewType::kISpy:
284  view.reset(new FWISpyView(iParent, type));
285  break;
286  case FWViewType::kRhoPhi:
287  case FWViewType::kRhoZ:
289  view.reset(new FWRPZView(iParent, type));
290  break;
291  case FWViewType::kLego:
293  view.reset(new FWEveLegoView(iParent, type));
294  break;
295  case FWViewType::kLegoHF:
296  view.reset(new FWHFView(iParent, type));
297  break;
299  view.reset(new FWGlimpseView(iParent, type));
300  break;
301  default:
302  break;
303  }
304 
305  m_views[type].push_back(std::shared_ptr<FWEveView>(view));
306  return finishViewCreate(m_views[type].back());
307 }

References finishViewCreate(), mps_fire::i, FWViewType::idToName(), FWViewType::k3D, FWViewType::kGlimpse, FWViewType::kISpy, FWViewType::kLego, FWViewType::kLegoHF, FWViewType::kLegoPFECAL, FWViewType::kRhoPhi, FWViewType::kRhoPhiPF, FWViewType::kRhoZ, FWViewType::kTypeSize, and m_views.

Referenced by FWEveViewManager().

◆ colorsChanged()

void FWEveViewManager::colorsChanged ( )
overrideprotectedvirtual

Implements FWViewManagerBase.

Definition at line 530 of file FWEveViewManager.cc.

530  {
531  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
532  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
533  (*i)->setBackgroundColor(colorManager().background());
534  }
535 }

References begin, FWViewManagerBase::colorManager(), mps_fire::i, FWViewType::kTypeSize, m_views, and OrderedSet::t.

◆ eventBegin()

void FWEveViewManager::eventBegin ( )
overridevirtual

Reimplemented from FWViewManagerBase.

Definition at line 538 of file FWEveViewManager.cc.

538  {
539  // Prevent registration of redraw timer, full redraw is done in
540  // FWEveViewManager::eventEnd().
541  gEve->EnforceTimerActive(kTRUE);
542  gEve->DisableRedraw();
543 
545 
546  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
547  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
548  (*i)->eventBegin();
549  }
550 }

References begin, FWViewManagerBase::context(), mps_fire::i, FWViewType::kTypeSize, m_views, fireworks::Context::resetMaxEtAndEnergy(), and OrderedSet::t.

◆ eventCenterChanged()

void FWEveViewManager::eventCenterChanged ( )
private

Definition at line 522 of file FWEveViewManager.cc.

522  {
523  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
524  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i) {
525  (*i)->setupEventCenter();
526  }
527  }
528 }

References begin, mps_fire::i, FWViewType::kTypeSize, m_views, and OrderedSet::t.

Referenced by setContext().

◆ eventEnd()

void FWEveViewManager::eventEnd ( )
overridevirtual

Reimplemented from FWViewManagerBase.

Definition at line 552 of file FWEveViewManager.cc.

552  {
553  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
554  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
555  (*i)->eventEnd();
556  }
557 
558  // What follows is a copy of TEveManager::DoRedraw3D() with the difference that
559  // we have full control over execution of GL view rendering. In particular:
560  // - optionally delay buffer swapping so they can all be swapped together;
561  // - we could render into FBO once and then use this to be put on screen
562  // and saved into an image file.
563 
564  {
565  TEveElement::List_t scenes;
566  Long64_t key, value;
567  TExMapIter stamped_elements(gEve->PtrToStampedElements());
568  while (stamped_elements.Next(key, value)) {
569  TEveElement* el = reinterpret_cast<TEveElement*>(key);
570  if (el->GetChangeBits() & TEveElement::kCBVisibility) {
571  el->CollectSceneParents(scenes);
572  }
573  }
574  gEve->ScenesChanged(scenes);
575  }
576 
577  // Process changes in scenes.
578  gEve->GetScenes()->ProcessSceneChanges(kFALSE, gEve->PtrToStampedElements());
579 
580  // To synchronize buffer swapping set swap_on_render to false.
581  // Note that this costs 25-40% extra time with 4 views, depending on V-sync settings.
582  // Tested with NVIDIA 343.22.
583  const bool swap_on_render = !s_syncAllViews;
584 
585  // Loop over viewers, swap buffers if swap_on_render is true.
586  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
587  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
588  (*i)->fwViewerGL()->DrawHiLod(swap_on_render);
589  }
590 
591  // Swap buffers if they were not swapped before.
592  if (!swap_on_render) {
593  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
594  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
595  (*i)->fwViewerGL()->JustSwap();
596  }
597  }
598 
599  gEve->GetViewers()->RepaintChangedViewers(kFALSE, kFALSE);
600 
601  {
602  Long64_t key, value;
603  TExMapIter stamped_elements(gEve->PtrToStampedElements());
604  while (stamped_elements.Next(key, value)) {
605  TEveElement* el = reinterpret_cast<TEveElement*>(key);
606  if (gEve->GetEditor()->GetModel() == el->GetEditorObject("FWEveViewManager::eventEnd"))
607  gEve->EditElement(el);
608  TEveGedEditor::ElementChanged(el);
609 
610  el->ClearStamps();
611  }
612  }
613  gEve->PtrToStampedElements()->Delete();
614 
615  gEve->GetListTree()->ClearViewPort(); // Fix this when several list-trees can be added.
616 
617  gEve->EnableRedraw();
618  gEve->EnforceTimerActive(kFALSE);
619 }

References begin, mps_fire::i, crabWrapper::key, FWViewType::kTypeSize, m_views, s_syncAllViews, OrderedSet::t, and relativeConstraints::value.

◆ finishViewCreate()

FWEveView * FWEveViewManager::finishViewCreate ( std::shared_ptr< FWEveView view)
private

Definition at line 309 of file FWEveViewManager.cc.

309  {
310  // printf("new view %s added \n", view->typeName().c_str());
311  gEve->DisableRedraw();
312 
313  // set geometry and calo data
314  view->setContext(context());
315 
317 
318  // set proxies have a window falg
319  int viewerBit = 1 << view->typeId();
320  if (m_views[view->typeId()].size() == 1) {
321  for (std::map<int, BuilderVec>::iterator i = m_builders.begin(); i != m_builders.end(); ++i) {
322  int builderViewBit = i->first;
323  BuilderVec& bv = i->second;
324  if (viewerBit == (builderViewBit & viewerBit)) {
325  for (BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt) {
326  (*bIt)->setHaveWindow(true);
327  }
328  }
329  }
330  }
331 
332  FWRPZView* rpzView = dynamic_cast<FWRPZView*>(view.get());
333  for (std::map<int, BuilderVec>::iterator i = m_builders.begin(); i != m_builders.end(); ++i) {
334  int builderViewBit = i->first;
335  BuilderVec& bv = i->second;
336  if (viewerBit == (builderViewBit & viewerBit)) {
337  for (BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt) {
338  // it is ok to call create even for shared productsm since
339  // builder map key garanties that
340  TEveElementList* product = (*bIt)->createProduct(view->typeId(), view->viewContext());
341 
342  if ((*bIt)->havePerViewProduct((FWViewType::EType)view->typeId())) {
343  // view owned
344  (*bIt)->build();
345  if (rpzView) {
346  rpzView->importElements(product, (*bIt)->item()->layer(), rpzView->ownedProducts());
347  } else {
348  view->ownedProducts()->AddElement(product);
349  }
350  } else {
351  // shared
352  if (rpzView) {
353  rpzView->importElements(product, (*bIt)->item()->layer(), rpzView->eventScene());
354  } else {
355  view->eventScene()->AddElement(product);
356  }
357  }
358  }
359  }
360  }
361 
362  view->beingDestroyed_.connect(boost::bind(&FWEveViewManager::beingDestroyed, this, _1));
363 
364  view->setupEnergyScale(); // notify PB for energy scale
365 
366  gEve->EnableRedraw();
367  view->viewerGL()->UpdateScene();
368  gEve->Redraw3D();
369 
370  return view.get();
371 }

References FWColorManager::background(), beingDestroyed(), fireworks::Context::colorManager(), FWViewManagerBase::context(), FWEveView::eventScene(), mps_fire::i, FWRPZView::importElements(), m_builders, m_views, FWEveView::ownedProducts(), FWColorManager::setColorSetViewer(), and FWEveView::setContext().

Referenced by buildView().

◆ globalEnergyScaleChanged()

void FWEveViewManager::globalEnergyScaleChanged ( )
private

Definition at line 512 of file FWEveViewManager.cc.

512  {
513  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
514  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i) {
515  if ((*i)->isEnergyScaleGlobal()) {
516  (*i)->setupEnergyScale();
517  }
518  }
519  }
520 }

References begin, mps_fire::i, FWViewType::kTypeSize, m_views, and OrderedSet::t.

Referenced by setContext().

◆ haveViewForBit()

bool FWEveViewManager::haveViewForBit ( int  bit) const
private

Checks whether any of the views

Definition at line 695 of file FWEveViewManager.cc.

695  {
696  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
697  if ((bit & (1 << t)) && !m_views[t].empty())
698  return true;
699  }
700  // printf("have %d view for bit %d \n", haveView, bit);
701  return false;
702 }

References relativeConstraints::empty, FWViewType::kTypeSize, m_views, and OrderedSet::t.

Referenced by beingDestroyed(), and newItem().

◆ highlightAdded()

void FWEveViewManager::highlightAdded ( TEveElement *  iElement)

Definition at line 724 of file FWEveViewManager.cc.

724  {
725  bool blocked = gEve->GetHighlight()->BlockSignals(true);
726 
727  if (iElement == context().getCaloData()) {
728  TEveCaloData::vCellId_t& hlist = context().getCaloData()->GetCellsHighlighted();
729  std::set<TEveCaloData::CellId_t> hset;
730 
731  int etaBin, phiBin, w, newPhiBin, tower;
732  TH2F* hist = context().getCaloData()->GetHist(0);
733  TAxis* etaAxis = hist->GetXaxis();
734  int nBinsX = etaAxis->GetNbins() + 2;
735 
736  for (TEveCaloData::vCellId_i i = hlist.begin(); i != hlist.end(); ++i) {
737  hist->GetBinXYZ((*i).fTower, etaBin, phiBin, w);
738  if (TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 4.71475) {
739  newPhiBin = ((phiBin + 1) / 4) * 4 - 1;
740  if (newPhiBin <= 0)
741  newPhiBin = 71;
742 
743  tower = etaBin + newPhiBin * nBinsX;
744  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
745  tower += nBinsX;
746  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
747  tower += nBinsX;
748 
749  if (newPhiBin == 71)
750  tower = etaBin + 1 * nBinsX;
751 
752  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
753  tower += nBinsX;
754  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
755  } else if (TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 1.747650) {
756  newPhiBin = ((phiBin + 1) / 2) * 2 - 1;
757  tower = etaBin + newPhiBin * nBinsX;
758  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
759  tower += nBinsX;
760  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
761  } else {
762  hset.insert(*i);
763  }
764  }
765 
766  // edit calo data list
767  hlist.clear();
768  for (std::set<TEveCaloData::CellId_t>::iterator it = hset.begin(); it != hset.end(); ++it) {
769  hlist.push_back(*it);
770  }
771  context().getCaloData()->CellSelectionChanged();
772  }
773 
774  gEve->GetHighlight()->BlockSignals(blocked);
775 }

References Abs(), FWViewManagerBase::context(), etaBin(), fireworks::Context::getCaloData(), compare::hist, mps_fire::i, BeamMonitor_cff::phiBin, hgcalTowerProducer_cfi::tower, and w.

◆ itemChanged()

void FWEveViewManager::itemChanged ( const FWEventItem item)
private

Callback of itemChanged_ signal. Iterate over all the builders for all the views and call itemChanged for any of the builders. If any of the builder also has at least one view, also update the interaction list.

Definition at line 452 of file FWEveViewManager.cc.

452  {
453  if (!item)
454  return;
455 
456  bool itemHaveWindow = false;
457 
458  for (std::map<int, BuilderVec>::iterator i = m_builders.begin(); i != m_builders.end(); ++i) {
459  for (size_t bi = 0, be = i->second.size(); bi != be; ++bi) {
460  FWProxyBuilderBase* builder = i->second[bi].get();
461 
462  if (builder->item() != item)
463  continue;
464 
465  builder->itemChanged(item);
466  itemHaveWindow |= builder->getHaveWindow();
467  }
468  }
469 
470  if (!itemHaveWindow)
471  return;
472 
473  std::map<const FWEventItem*, FWInteractionList*>::iterator it = m_interactionLists.find(item);
474  if (it != m_interactionLists.end()) {
475  if (!it->second->empty())
476  it->second->itemChanged();
477  }
478 }

References cms::cuda::be, FWProxyBuilderBase::getHaveWindow(), mps_fire::i, FWProxyBuilderBase::item(), B2GTnPMonitor_cfi::item, FWProxyBuilderBase::itemChanged(), m_builders, and m_interactionLists.

Referenced by newItem().

◆ modelChanges()

void FWEveViewManager::modelChanges ( const FWModelIds iIds)
private

Callback of event item changed_ signal.

Definition at line 418 of file FWEveViewManager.cc.

418  {
419  FWModelId id = *(iIds.begin());
420  const FWEventItem* item = id.item();
421 
422  // in standard case new elements can be build in case of change of visibility
423  // and in non-standard case (e.g. calo towers) PB's modelChages handles all changes
424  bool itemHaveWindow = false;
425  for (std::map<int, BuilderVec>::iterator i = m_builders.begin(); i != m_builders.end(); ++i) {
426  for (size_t bi = 0, be = i->second.size(); bi != be; ++bi) {
427  FWProxyBuilderBase* builder = i->second[bi].get();
428  if (builder->getHaveWindow() && builder->item() == item) {
429  builder->modelChanges(iIds);
430  itemHaveWindow = true;
431  }
432  }
433  }
434 
435  if (!itemHaveWindow)
436  return;
437 
439 
440  std::map<const FWEventItem*, FWInteractionList*>::iterator it = m_interactionLists.find(item);
441  if (it != m_interactionLists.end()) {
442  if (!it->second->empty())
443  it->second->modelChanges(iIds);
444  }
445 }

References cms::cuda::be, FWProxyBuilderBase::getHaveWindow(), mps_fire::i, FWProxyBuilderBase::item(), B2GTnPMonitor_cfi::item, m_builders, m_interactionLists, and FWProxyBuilderBase::modelChanges().

Referenced by newItem().

◆ modelChangesComing()

void FWEveViewManager::modelChangesComing ( )
overrideprotectedvirtual

called when models have changed and so the display must be updated

Implements FWViewManagerBase.

Definition at line 413 of file FWEveViewManager.cc.

413 { gEve->DisableRedraw(); }

◆ modelChangesDone()

void FWEveViewManager::modelChangesDone ( )
overrideprotectedvirtual

Implements FWViewManagerBase.

Definition at line 415 of file FWEveViewManager.cc.

415 { gEve->EnableRedraw(); }

◆ newItem()

void FWEveViewManager::newItem ( const FWEventItem iItem)
overridevirtual

This is invoked when a new item is created by the FWEventItemsManager. The workflow is the following

  1. First we check if we have a builder info for the given purpose of the item. We return simply if we don't.
  2. We iterate over all the proxy builder registered for the given purpose and create a new one for this given item.
  3. Interaction lists are set up in case the proxy builder does not handle interaction by itself.
  4. We then iterate on the various supported views and add elements to them, making sure that we handle the case in which those elements are not unique among all the views.

Implements FWViewManagerBase.

Definition at line 174 of file FWEveViewManager.cc.

174  {
175  TypeToBuilder::iterator itFind = m_typeToBuilder.find(iItem->purpose());
176 
177  if (itFind == m_typeToBuilder.end())
178  return;
179 
180  std::vector<BuilderInfo>& blist = itFind->second;
181 
182  std::string bType;
183  bool bIsSimple;
184  for (size_t bii = 0, bie = blist.size(); bii != bie; ++bii) {
185  // 1.
186  BuilderInfo& info = blist[bii];
187  info.classType(bType, bIsSimple);
188  if (bIsSimple) {
189  unsigned int distance = 1;
190  edm::TypeWithDict modelType(*(iItem->modelType()->GetTypeInfo()));
191  if (!FWSimpleRepresentationChecker::inheritsFrom(modelType, bType, distance)) {
192  // printf("PB does not matche itemType (%s) !!! EDproduct %s %s\n", info.m_name.c_str(), iItem->modelType()->GetTypeInfo()->name(), bType.c_str() );
193  continue;
194  }
195  } else {
196  std::string itype = iItem->type()->GetTypeInfo()->name();
197  if (itype != bType) {
198  // printf("PB does not match modeType (%s)!!! EDproduct %s %s\n", info.m_name.c_str(), itype.c_str(), bType.c_str() );
199  continue;
200  }
201  }
202 
203  std::string builderName = info.m_name;
204  int builderViewBit = info.m_viewBit;
205 
206  std::shared_ptr<FWProxyBuilderBase> builder;
207  try {
208  builder = std::shared_ptr<FWProxyBuilderBase>{FWProxyBuilderFactory::get()->create(builderName)};
209 
210  } catch (std::exception& exc) {
212  << "FWEveViewManager::newItem ignoring the following exception (probably edmplugincache mismatch):"
213  << std::endl
214  << exc.what();
215  }
216  if (!builder)
217  continue;
218 
219  // 2.
220  // printf("FWEveViewManager::makeProxyBuilderFor NEW builder %s \n", builderName.c_str());
221 
222  builder->setItem(iItem);
223  iItem->changed_.connect(boost::bind(&FWEveViewManager::modelChanges, this, _1));
224  iItem->goingToBeDestroyed_.connect(boost::bind(&FWEveViewManager::removeItem, this, _1));
225  iItem->itemChanged_.connect(boost::bind(&FWEveViewManager::itemChanged, this, _1));
226 
227  // 3.
228  // This calud be opaque to the user. I would pass a reference to the m_interactionLists to
229  // FWProxyBuilderBase::setInteractionList and handle different case differently.
230  if (builder->willHandleInteraction() == false) {
231  typedef std::map<const FWEventItem*, FWInteractionList*>::iterator Iterator;
232  std::pair<Iterator, bool> t = m_interactionLists.insert(std::make_pair(iItem, (FWInteractionList*)nullptr));
233 
234  if (t.second == true)
235  t.first->second = new FWInteractionList(iItem);
236  // printf(">>> builder %s add list %p \n", iItem->name().c_str(), il); fflush(stdout);
237  builder->setInteractionList(t.first->second, iItem->purpose());
238  }
239 
240  builder->setHaveWindow(haveViewForBit(builderViewBit));
241 
242  // 4.
243  for (size_t viewType = 0; viewType < FWViewType::kTypeSize; ++viewType) {
244  if (((1 << viewType) & builderViewBit) == 0)
245  continue;
246 
248 
249  // printf("%s builder %s supportsd view %s \n", iItem->name().c_str(), builderName.c_str(), FWViewType::idToName(viewType).c_str());
250  if (builder->havePerViewProduct((FWViewType::EType)viewType)) {
251  for (size_t i = 0, e = m_views[viewType].size(); i != e; ++i) {
252  FWEveView* view = m_views[viewType][i].get();
253  TEveElementList* product = builder->createProduct(type, view->viewContext());
254  addElements(iItem, view, viewType, product);
255  }
256  } else {
257  TEveElementList* product = builder->createProduct(type, nullptr);
258 
259  for (size_t i = 0, e = m_views[viewType].size(); i != e; ++i)
260  addElements(iItem, m_views[viewType][i].get(), viewType, product);
261  }
262  }
263 
264  m_builders[builderViewBit].emplace_back(std::move(builder));
265  } // loop views
266 }

References addElements(), FWEventItem::changed_, HLT_2018_cff::distance, MillePedeFileConverter_cfg::e, cppFunctionSkipper::exception, fwLog, get, FWEventItem::goingToBeDestroyed_, haveViewForBit(), mps_fire::i, info(), FWSimpleRepresentationChecker::inheritsFrom(), itemChanged(), FWEventItem::itemChanged_, FWViewType::kTypeSize, fwlog::kWarning, m_builders, m_interactionLists, m_typeToBuilder, m_views, modelChanges(), FWEventItem::modelType(), eostools::move(), FWEventItem::purpose(), removeItem(), findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, OrderedSet::t, FWEventItem::type(), and FWEveView::viewContext().

◆ operator=()

const FWEveViewManager& FWEveViewManager::operator= ( const FWEveViewManager )
privatedelete

◆ removeItem()

void FWEveViewManager::removeItem ( const FWEventItem item)
virtual

Remove an item from the given view.

Definition at line 482 of file FWEveViewManager.cc.

482  {
484 
485  std::map<const FWEventItem*, FWInteractionList*>::iterator it = m_interactionLists.find(item);
486  if (it != m_interactionLists.end()) {
487  delete it->second;
488  m_interactionLists.erase(it);
489  }
490 
491  for (std::map<int, BuilderVec>::iterator i = m_builders.begin(); i != m_builders.end(); ++i) {
492  BuilderVec_it bIt = i->second.begin();
493  while (bIt != i->second.end()) {
494  if ((*bIt)->item() == item) {
495  // TODO caching of proxy builders
496  (*bIt)->itemBeingDestroyed(item);
497  bIt = i->second.erase(bIt);
498  } else {
499  ++bIt;
500  }
501  }
502  }
503 }

References mps_fire::i, B2GTnPMonitor_cfi::item, m_builders, and m_interactionLists.

Referenced by newItem().

◆ selectionAdded()

void FWEveViewManager::selectionAdded ( TEveElement *  iElement)

Definition at line 641 of file FWEveViewManager.cc.

641  {
642  FWFromEveSelectorBase* selector = getSelector(iElement);
643  if (selector)
644  selector->doSelect();
645 }

References FWFromEveSelectorBase::doSelect(), and getSelector().

◆ selectionCleared()

void FWEveViewManager::selectionCleared ( )

◆ selectionRemoved()

void FWEveViewManager::selectionRemoved ( TEveElement *  iElement)

Definition at line 647 of file FWEveViewManager.cc.

647  {
648  FWFromEveSelectorBase* selector = getSelector(iElement);
649  if (selector)
650  selector->doUnselect();
651 }

References FWFromEveSelectorBase::doUnselect(), and getSelector().

◆ setContext()

void FWEveViewManager::setContext ( const fireworks::Context x)
overridevirtual

Reimplemented from FWViewManagerBase.

Definition at line 505 of file FWEveViewManager.cc.

505  {
507  x->commonPrefs()->getEnergyScale()->parameterChanged_.connect(
508  boost::bind(&FWEveViewManager::globalEnergyScaleChanged, this));
509  x->commonPrefs()->eventCenterChanged_.connect(boost::bind(&FWEveViewManager::eventCenterChanged, this));
510 }

References eventCenterChanged(), globalEnergyScaleChanged(), FWViewManagerBase::setContext(), and x.

◆ supportedTypesAndRepresentations()

FWTypeToRepresentations FWEveViewManager::supportedTypesAndRepresentations ( ) const
overridevirtual

Implements FWViewManagerBase.

Definition at line 659 of file FWEveViewManager.cc.

659  {
660  // needed for add collection GUI
661  FWTypeToRepresentations returnValue;
662  const static std::string kFullFrameWorkPBExtension = "FullFramework";
663  for (TypeToBuilder::const_iterator it = m_typeToBuilder.begin(), itEnd = m_typeToBuilder.end(); it != itEnd; ++it) {
664  std::vector<BuilderInfo> blist = it->second;
665  for (size_t bii = 0, bie = blist.size(); bii != bie; ++bii) {
666  BuilderInfo& info = blist[bii];
667 
668  if (context().getHidePFBuilders()) {
669  const static std::string pfExt = "PF ";
670  if (std::string::npos != info.m_name.find(pfExt))
671  continue;
672  }
673 
674  unsigned int bitPackedViews = info.m_viewBit;
675  bool representsSubPart = (info.m_name.substr(info.m_name.find_first_of('@') - 1, 1) == "!");
676  size_t extp = info.m_name.rfind(kFullFrameWorkPBExtension);
677  bool FFOnly = (extp != std::string::npos);
678 
680  bool isSimple;
681  info.classType(name, isSimple);
682  if (isSimple) {
683  returnValue.add(std::make_shared<FWSimpleRepresentationChecker>(
684  name, it->first, bitPackedViews, representsSubPart, FFOnly));
685  } else {
686  returnValue.add(std::make_shared<FWEDProductRepresentationChecker>(
687  name, it->first, bitPackedViews, representsSubPart, FFOnly));
688  }
689  }
690  }
691  return returnValue;
692 }

References FWTypeToRepresentations::add(), FWViewManagerBase::context(), fireworks::Context::getHidePFBuilders(), info(), m_typeToBuilder, Skims_PA_cff::name, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ syncAllViews()

static void FWEveViewManager::syncAllViews ( )
inlinestatic

Definition at line 76 of file FWEveViewManager.h.

76 { s_syncAllViews = true; }

References s_syncAllViews.

Referenced by CmsShowMain::CmsShowMain().

Member Data Documentation

◆ m_builders

std::map<int, BuilderVec> FWEveViewManager::m_builders
private

◆ m_interactionLists

std::map<const FWEventItem*, FWInteractionList*> FWEveViewManager::m_interactionLists
private

Definition at line 112 of file FWEveViewManager.h.

Referenced by itemChanged(), modelChanges(), newItem(), and removeItem().

◆ m_typeToBuilder

TypeToBuilder FWEveViewManager::m_typeToBuilder
private

Definition at line 104 of file FWEveViewManager.h.

Referenced by FWEveViewManager(), newItem(), and supportedTypesAndRepresentations().

◆ m_views

std::vector<std::vector<std::shared_ptr<FWEveView> > > FWEveViewManager::m_views
private

◆ s_syncAllViews

bool FWEveViewManager::s_syncAllViews = false
staticprivate

Definition at line 106 of file FWEveViewManager.h.

Referenced by eventEnd(), and syncAllViews().

FWRPZView
Definition: FWRPZView.h:40
hgcalPlots.purpose
purpose
Definition: hgcalPlots.py:1786
HLT_2018_cff.builders
builders
Definition: HLT_2018_cff.py:31156
taus_updatedMVAIds_cff.category
category
Definition: taus_updatedMVAIds_cff.py:30
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
mps_fire.i
i
Definition: mps_fire.py:355
FWEveViewManager::EveViewVec_it
std::vector< std::shared_ptr< FWEveView > >::iterator EveViewVec_it
Definition: FWEveViewManager.h:102
FWViewType::idToName
static const std::string & idToName(int)
Definition: FWViewType.cc:72
fireworks::Context::resetMaxEtAndEnergy
void resetMaxEtAndEnergy() const
Definition: Context.cc:167
etaBin
int etaBin(const l1t::HGCalMulticluster *cl)
Definition: L1EGammaEEProducer.cc:19
FWViewType::EType
EType
Definition: FWViewType.h:31
FWGUIManager::registerViewBuilder
void registerViewBuilder(const std::string &iName, ViewBuildFunctor &iBuilder)
Definition: FWGUIManager.cc:273
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
FWEveViewManager::haveViewForBit
bool haveViewForBit(int) const
Definition: FWEveViewManager.cc:695
FWEveViewManager::globalEnergyScaleChanged
void globalEnergyScaleChanged()
Definition: FWEveViewManager.cc:512
FWProxyBuilderBase::itemChanged
void itemChanged(const FWEventItem *)
Definition: FWProxyBuilderBase.cc:217
fireworks::Context::colorManager
FWColorManager * colorManager() const
Definition: Context.h:58
BeamMonitor_cff.phiBin
phiBin
Definition: BeamMonitor_cff.py:75
FWViewManagerBase::colorManager
FWColorManager & colorManager() const
Definition: FWViewManagerBase.cc:123
EveSelectionSentry
Definition: FWEveViewManager.cc:63
FWFromEveSelectorBase::doSelect
virtual void doSelect()=0
FWModelId
Definition: FWModelId.h:28
FWViewType::kRhoZ
Definition: FWViewType.h:33
FWEveLegoView
Definition: FWEveLegoView.h:25
FWEventItem::goingToBeDestroyed_
FWItemChangeSignal goingToBeDestroyed_
Definition: FWEventItem.h:197
FWViewType::kTypeSize
Definition: FWViewType.h:46
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:3
FWTypeToRepresentations::add
void add(std::shared_ptr< FWRepresentationCheckerBase > iChecker)
Definition: FWTypeToRepresentations.cc:55
addElements
void addElements(const FWEventItem *item, FWEveView *view, int viewType, TEveElementList *product)
Definition: FWEveViewManager.cc:150
FWEveView::viewContext
FWViewContext * viewContext()
Definition: FWEveView.h:83
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:152
FWInteractionList
Definition: FWInteractionList.h:33
DDAxes::x
FWSimpleRepresentationChecker::inheritsFrom
static bool inheritsFrom(const edm::TypeWithDict &iChild, const std::string &iParentTypeName, unsigned int &distance)
Definition: FWSimpleRepresentationChecker.cc:71
FWSelectionManager::clearSelection
void clearSelection()
Definition: FWSelectionManager.cc:63
dqmdumpme.first
first
Definition: dqmdumpme.py:55
edmplugin::PluginManager::get
static PluginManager * get()
Definition: PluginManager.cc:307
FW3DView
Definition: FW3DView.h:29
FWHFView
Definition: FWHFView.h:28
FWGlimpseView
Definition: FWGlimpseView.h:35
edmplugin::PluginManager::categoryToInfos
const CategoryToInfos & categoryToInfos() const
Definition: PluginManager.h:80
FWViewType::kTableL1
Definition: FWViewType.h:40
FWEveView::eventScene
TEveScene * eventScene()
Definition: FWEveView.h:79
FWViewBase::typeId
FWViewType::EType typeId() const
Definition: FWViewBase.h:42
cms::Iterator
TGeoIterator Iterator
Definition: DDFilteredView.h:49
FWEveViewManager::itemChanged
void itemChanged(const FWEventItem *)
Definition: FWEveViewManager.cc:452
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
FWEveView
Definition: FWEveView.h:53
Abs
T Abs(T a)
Definition: MathUtil.h:49
compare.hist
hist
Definition: compare.py:376
w
const double w
Definition: UKUtility.cc:23
FWViewType::kLego
Definition: FWViewType.h:36
FWEveViewManager::beingDestroyed
void beingDestroyed(const FWViewBase *)
Definition: FWEveViewManager.cc:373
FWViewType::kLegoPFECAL
Definition: FWViewType.h:43
FWEventItem::modelType
const TClass * modelType() const
Definition: FWEventItem.cc:464
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
FWEveViewManager::BuilderVec
std::vector< std::shared_ptr< FWProxyBuilderBase > > BuilderVec
Definition: FWEveViewManager.h:100
FWISpyView
Definition: FWISpyView.h:28
FWEveView::ownedProducts
TEveElement * ownedProducts()
Definition: FWEveView.h:82
OrderedSet.t
t
Definition: OrderedSet.py:90
edmplugin::PluginInfo::name_
std::string name_
Definition: PluginInfo.h:29
FWViewManagerBase::FWViewManagerBase
FWViewManagerBase()
Definition: FWViewManagerBase.cc:36
FWViewType::kGlimpse
Definition: FWViewType.h:38
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FWEveViewManager::s_syncAllViews
static bool s_syncAllViews
Definition: FWEveViewManager.h:106
List_t
std::list< Particle > List_t
Definition: Particle.h:174
newFWLiteAna.fullName
fullName
Definition: newFWLiteAna.py:122
FWEveViewManager::BuilderVec_it
BuilderVec::iterator BuilderVec_it
Definition: FWEveViewManager.h:101
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
edm::TypeWithDict
Definition: TypeWithDict.h:38
FWEventItem::itemChanged_
FWItemChangeSignal itemChanged_
Definition: FWEventItem.h:181
FWEveViewManager::finishViewCreate
FWEveView * finishViewCreate(std::shared_ptr< FWEveView >)
Definition: FWEveViewManager.cc:309
FWViewManagerBase::setContext
virtual void setContext(const fireworks::Context *x)
Definition: FWViewManagerBase.h:56
FWEveViewManager::buildView
FWViewBase * buildView(TEveWindowSlot *iParent, const std::string &type)
Definition: FWEveViewManager.cc:269
FWFromEveSelectorBase::doUnselect
virtual void doUnselect()=0
value
Definition: value.py:1
fireworks::Context::getHidePFBuilders
bool getHidePFBuilders() const
Definition: Context.h:80
FWFromEveSelectorBase
Definition: FWFromEveSelectorBase.h:27
FWEventItem::type
const TClass * type() const
Definition: FWEventItem.cc:437
fwlog::kWarning
Definition: fwLog.h:35
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
FWViewType::kLegoHF
Definition: FWViewType.h:37
FWViewType::kTableHLT
Definition: FWViewType.h:41
FWRPZView::importElements
void importElements(TEveElement *iProjectableChild, float layer, TEveElement *iProjectedParent=nullptr)
Definition: FWRPZView.cc:281
get
#define get
FWEventItem::purpose
const std::string & purpose() const
Definition: FWEventItem.cc:439
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
FWEventItem
Definition: FWEventItem.h:56
type
type
Definition: HCALResponse.h:21
eostools.move
def move(src, dest)
Definition: eostools.py:511
FWEveViewManager::m_interactionLists
std::map< const FWEventItem *, FWInteractionList * > m_interactionLists
Definition: FWEveViewManager.h:112
FWProxyBuilderBase::modelChanges
void modelChanges(const FWModelIds &)
Definition: FWProxyBuilderBase.cc:205
FWViewType::kISpy
Definition: FWViewType.h:35
FWProxyBuilderBase
Definition: FWProxyBuilderBase.h:46
FWColorManager::setColorSetViewer
static Bool_t setColorSetViewer(TGLViewer *, Color_t)
Definition: FWColorManager.cc:224
FWTypeToRepresentations
Definition: FWTypeToRepresentations.h:33
FWEveViewManager::m_builders
std::map< int, BuilderVec > m_builders
Definition: FWEveViewManager.h:108
relativeConstraints.value
value
Definition: relativeConstraints.py:53
FWEveViewManager::m_typeToBuilder
TypeToBuilder m_typeToBuilder
Definition: FWEveViewManager.h:104
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
fireworks::Context::getCaloData
TEveCaloDataHist * getCaloData() const
Definition: Context.h:69
FWViewType::k3D
Definition: FWViewType.h:34
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
FWGUIManager::ViewBuildFunctor
boost::function2< FWViewBase *, TEveWindowSlot *, const std::string & > ViewBuildFunctor
Definition: FWGUIManager.h:97
cms::cuda::be
int be
Definition: HistoContainer.h:126
FWEveViewManager::modelChanges
void modelChanges(const FWModelIds &iIds)
Definition: FWEveViewManager.cc:418
FWProxyBuilderBase::getHaveWindow
bool getHaveWindow() const
Definition: FWProxyBuilderBase.h:95
FWViewType::kRhoPhiPF
Definition: FWViewType.h:42
FWEveViewManager::m_views
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views
Definition: FWEveViewManager.h:110
FWViewManagerBase::context
const fireworks::Context & context() const
Definition: FWViewManagerBase.h:69
getSelector
FWFromEveSelectorBase * getSelector(TEveElement *iElement)
Definition: FWEveViewManager.cc:625
FWEveViewManager::eventCenterChanged
void eventCenterChanged()
Definition: FWEveViewManager.cc:522
crabWrapper.key
key
Definition: crabWrapper.py:19
FWEventItem::changed_
FWModelChangeSignal changed_
Definition: FWEventItem.h:178
begin
#define begin
Definition: vmac.h:32
FWViewType::kRhoPhi
Definition: FWViewType.h:32
FWEveViewManager::removeItem
virtual void removeItem(const FWEventItem *)
Definition: FWEveViewManager.cc:482
FWColorManager::background
Color_t background() const
Definition: FWColorManager.h:55
fireworks::Context::selectionManager
FWSelectionManager * selectionManager() const
Definition: Context.h:54
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
FWViewType::kTable
Definition: FWViewType.h:39