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  std::bind(&edmplugin::PluginInfo::name_, std::placeholders::_1));
88 
91  available =
93  std::transform(available.begin(),
94  available.end(),
95  std::inserter(builders, builders.begin()),
96  std::bind(&edmplugin::PluginInfo::name_, std::placeholders::_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
114  std::bind(&FWEveViewManager::buildView, this, std::placeholders::_1, std::placeholders::_2);
115  for (int i = 0; i < FWViewType::kTypeSize; i++) {
117  continue;
119  }
120 
121  // signal
122  gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_Master);
123  TEveSelection* eveSelection = gEve->GetSelection();
124  eveSelection->SetPickToSelect(TEveSelection::kPS_Master);
125  eveSelection->Connect("SelectionAdded(TEveElement*)", "FWEveViewManager", this, "selectionAdded(TEveElement*)");
126  eveSelection->Connect("SelectionRepeated(TEveElement*)", "FWEveViewManager", this, "selectionAdded(TEveElement*)");
127  eveSelection->Connect("SelectionRemoved(TEveElement*)", "FWEveViewManager", this, "selectionRemoved(TEveElement*)");
128  eveSelection->Connect("SelectionCleared()", "FWEveViewManager", this, "selectionCleared()");
129 
130  gEve->GetHighlight()->Connect(
131  "SelectionAdded(TEveElement*)", "FWEveViewManager", this, "highlightAdded(TEveElement*)");
132  gEve->GetHighlight()->Connect(
133  "SelectionRepeated(TEveElement*)", "FWEveViewManager", this, "highlightAdded(TEveElement*)");
134 
135  TGeoManager::SetVerboseLevel(0);
136 }

References HLT_FULL_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 138 of file FWEveViewManager.cc.

138 {}

◆ FWEveViewManager() [2/2]

FWEveViewManager::FWEveViewManager ( const FWEveViewManager )
privatedelete

Member Function Documentation

◆ beingDestroyed()

void FWEveViewManager::beingDestroyed ( const FWViewBase vb)
private

Definition at line 374 of file FWEveViewManager.cc.

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

References 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 270 of file FWEveViewManager.cc.

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

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 531 of file FWEveViewManager.cc.

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

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

◆ eventBegin()

void FWEveViewManager::eventBegin ( )
overridevirtual

Reimplemented from FWViewManagerBase.

Definition at line 539 of file FWEveViewManager.cc.

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

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

◆ eventCenterChanged()

void FWEveViewManager::eventCenterChanged ( )
private

Definition at line 523 of file FWEveViewManager.cc.

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

References mps_fire::i, FWViewType::kTypeSize, m_views, and submitPVValidationJobs::t.

Referenced by setContext().

◆ eventEnd()

void FWEveViewManager::eventEnd ( )
overridevirtual

Reimplemented from FWViewManagerBase.

Definition at line 553 of file FWEveViewManager.cc.

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

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

◆ finishViewCreate()

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

Definition at line 310 of file FWEveViewManager.cc.

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

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 513 of file FWEveViewManager.cc.

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

References mps_fire::i, FWViewType::kTypeSize, m_views, and submitPVValidationJobs::t.

Referenced by setContext().

◆ haveViewForBit()

bool FWEveViewManager::haveViewForBit ( int  bit) const
private

Checks whether any of the views

Definition at line 696 of file FWEveViewManager.cc.

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

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

Referenced by beingDestroyed(), and newItem().

◆ highlightAdded()

void FWEveViewManager::highlightAdded ( TEveElement *  iElement)

Definition at line 725 of file FWEveViewManager.cc.

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

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 453 of file FWEveViewManager.cc.

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

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 419 of file FWEveViewManager.cc.

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

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 414 of file FWEveViewManager.cc.

414 { gEve->DisableRedraw(); }

◆ modelChangesDone()

void FWEveViewManager::modelChangesDone ( )
overrideprotectedvirtual

Implements FWViewManagerBase.

Definition at line 416 of file FWEveViewManager.cc.

416 { 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 175 of file FWEveViewManager.cc.

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

References addElements(), FWEventItem::changed_, HLT_FULL_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, submitPVValidationJobs::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 483 of file FWEveViewManager.cc.

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

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

Referenced by newItem().

◆ selectionAdded()

void FWEveViewManager::selectionAdded ( TEveElement *  iElement)

Definition at line 642 of file FWEveViewManager.cc.

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

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

◆ selectionCleared()

void FWEveViewManager::selectionCleared ( )

◆ selectionRemoved()

void FWEveViewManager::selectionRemoved ( TEveElement *  iElement)

Definition at line 648 of file FWEveViewManager.cc.

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

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

◆ setContext()

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

Reimplemented from FWViewManagerBase.

Definition at line 506 of file FWEveViewManager.cc.

506  {
508  x->commonPrefs()->getEnergyScale()->parameterChanged_.connect(
510  x->commonPrefs()->eventCenterChanged_.connect(std::bind(&FWEveViewManager::eventCenterChanged, this));
511 }

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

◆ supportedTypesAndRepresentations()

FWTypeToRepresentations FWEveViewManager::supportedTypesAndRepresentations ( ) const
overridevirtual

Implements FWViewManagerBase.

Definition at line 660 of file FWEveViewManager.cc.

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

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:2049
taus_updatedMVAIds_cff.category
category
Definition: taus_updatedMVAIds_cff.py:31
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
mps_fire.i
i
Definition: mps_fire.py:428
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:696
FWEveViewManager::globalEnergyScaleChanged
void globalEnergyScaleChanged()
Definition: FWEveViewManager.cc:513
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:4
HLT_FULL_cff.builders
builders
Definition: HLT_FULL_cff.py:32671
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:151
FWEveView::viewContext
FWViewContext * viewContext()
Definition: FWEveView.h:83
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
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:306
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:82
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:54
FWEveViewManager::itemChanged
void itemChanged(const FWEventItem *)
Definition: FWEveViewManager.cc:453
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:374
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
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
FWGUIManager::ViewBuildFunctor
std::function< FWViewBase *(TEveWindowSlot *, const std::string &)> ViewBuildFunctor
Definition: FWGUIManager.h:98
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:310
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
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:270
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:39
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:285
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
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
cms::cuda::be
int be
Definition: HistoContainer.h:126
FWEveViewManager::modelChanges
void modelChanges(const FWModelIds &iIds)
Definition: FWEveViewManager.cc:419
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:626
FWEveViewManager::eventCenterChanged
void eventCenterChanged()
Definition: FWEveViewManager.cc:523
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7796
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
crabWrapper.key
key
Definition: crabWrapper.py:19
FWEventItem::changed_
FWModelChangeSignal changed_
Definition: FWEventItem.h:178
FWViewType::kRhoPhi
Definition: FWViewType.h:32
FWEveViewManager::removeItem
virtual void removeItem(const FWEventItem *)
Definition: FWEveViewManager.cc:483
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