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 *)
 
 FWEveViewManager (const FWEveViewManager &)=delete
 
void highlightAdded (TEveElement *)
 
void newItem (const FWEventItem *) override
 
const FWEveViewManageroperator= (const FWEveViewManager &)=delete
 
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
 
 FWViewManagerBase (const FWViewManagerBase &)=delete
 
void modelChangesComingSlot ()
 
void modelChangesDoneSlot ()
 
const FWViewManagerBaseoperator= (const FWViewManagerBase &)=delete
 
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 >)
 
void globalEnergyScaleChanged ()
 
bool haveViewForBit (int) const
 
void itemChanged (const FWEventItem *)
 
void modelChanges (const FWModelIds &iIds)
 

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 101 of file FWEveViewManager.h.

◆ BuilderVec_it

typedef BuilderVec::iterator FWEveViewManager::BuilderVec_it
private

Definition at line 102 of file FWEveViewManager.h.

◆ EveViewVec_it

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

Definition at line 103 of file FWEveViewManager.h.

◆ TypeToBuilder

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

Definition at line 100 of file FWEveViewManager.h.

Constructor & Destructor Documentation

◆ FWEveViewManager() [1/2]

FWEveViewManager::FWEveViewManager ( FWGUIManager iGUIMgr)

Definition at line 79 of file FWEveViewManager.cc.

References HLT_2023v12_cff::builders, buildView(), validateAlignments::category, edmplugin::PluginManager::categoryToInfos(), f, dqmdumpme::first, 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().

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  m_typeToBuilder[purpose].push_back(BuilderInfo(*it, viewTypes));
107  }
108 
110 
111  // view construction called via GUI mng
113  std::bind(&FWEveViewManager::buildView, this, std::placeholders::_1, std::placeholders::_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 }
const CategoryToInfos & categoryToInfos() const
Definition: PluginManager.h:82
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views
TypeToBuilder m_typeToBuilder
uint16_t size_type
void registerViewBuilder(const std::string &iName, ViewBuildFunctor &iBuilder)
double f[11][100]
std::function< FWViewBase *(TEveWindowSlot *, const std::string &)> ViewBuildFunctor
Definition: FWGUIManager.h:98
FWViewBase * buildView(TEveWindowSlot *iParent, const std::string &type)
static const std::string & idToName(int)
Definition: FWViewType.cc:72
std::string name_
Definition: PluginInfo.h:29
#define get
static PluginManager * get()
unsigned transform(const HcalDetId &id, unsigned transformCode)

◆ ~FWEveViewManager()

FWEveViewManager::~FWEveViewManager ( )
override

Definition at line 137 of file FWEveViewManager.cc.

137 {}

◆ FWEveViewManager() [2/2]

FWEveViewManager::FWEveViewManager ( const FWEveViewManager )
delete

Member Function Documentation

◆ beingDestroyed()

void FWEveViewManager::beingDestroyed ( const FWViewBase vb)
private

Definition at line 373 of file FWEveViewManager.cc.

References haveViewForBit(), mps_fire::i, m_builders, and m_views.

Referenced by finishViewCreate().

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 }
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views
std::vector< std::shared_ptr< FWEveView > >::iterator EveViewVec_it
bool haveViewForBit(int) const
std::map< int, BuilderVec > m_builders
BuilderVec::iterator BuilderVec_it
std::vector< std::shared_ptr< FWProxyBuilderBase > > BuilderVec

◆ buildView()

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

Definition at line 269 of file FWEveViewManager.cc.

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().

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 }
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views
FWEveView * finishViewCreate(std::shared_ptr< FWEveView >)
static const std::string & idToName(int)
Definition: FWViewType.cc:72

◆ colorsChanged()

void FWEveViewManager::colorsChanged ( )
overrideprotectedvirtual

Implements FWViewManagerBase.

Definition at line 530 of file FWEveViewManager.cc.

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

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 }
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views
std::vector< std::shared_ptr< FWEveView > >::iterator EveViewVec_it
FWColorManager & colorManager() const

◆ eventBegin()

void FWEveViewManager::eventBegin ( )
overridevirtual

Reimplemented from FWViewManagerBase.

Definition at line 538 of file FWEveViewManager.cc.

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

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 }
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views
void resetMaxEtAndEnergy() const
Definition: Context.cc:174
std::vector< std::shared_ptr< FWEveView > >::iterator EveViewVec_it
const fireworks::Context & context() const

◆ eventCenterChanged()

void FWEveViewManager::eventCenterChanged ( )
private

Definition at line 522 of file FWEveViewManager.cc.

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

Referenced by setContext().

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 }
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views
std::vector< std::shared_ptr< FWEveView > >::iterator EveViewVec_it

◆ eventEnd()

void FWEveViewManager::eventEnd ( )
overridevirtual

Reimplemented from FWViewManagerBase.

Definition at line 552 of file FWEveViewManager.cc.

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

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 }
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views
std::vector< std::shared_ptr< FWEveView > >::iterator EveViewVec_it
static bool s_syncAllViews
Definition: value.py:1

◆ finishViewCreate()

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

Definition at line 309 of file FWEveViewManager.cc.

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

Referenced by buildView().

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(std::bind(&FWEveViewManager::beingDestroyed, this, std::placeholders::_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 }
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views
TEveScene * eventScene()
Definition: FWEveView.h:79
Color_t background() const
void beingDestroyed(const FWViewBase *)
std::map< int, BuilderVec > m_builders
void importElements(TEveElement *iProjectableChild, float layer, TEveElement *iProjectedParent=nullptr)
Definition: FWRPZView.cc:290
BuilderVec::iterator BuilderVec_it
std::vector< std::shared_ptr< FWProxyBuilderBase > > BuilderVec
TEveElement * ownedProducts()
Definition: FWEveView.h:82
static Bool_t setColorSetViewer(TGLViewer *, Color_t)
FWColorManager * colorManager() const
Definition: Context.h:58
const fireworks::Context & context() const

◆ globalEnergyScaleChanged()

void FWEveViewManager::globalEnergyScaleChanged ( )
private

Definition at line 512 of file FWEveViewManager.cc.

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

Referenced by setContext().

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 }
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views
std::vector< std::shared_ptr< FWEveView > >::iterator EveViewVec_it

◆ haveViewForBit()

bool FWEveViewManager::haveViewForBit ( int  bit) const
private

Checks whether any of the views

Definition at line 695 of file FWEveViewManager.cc.

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

Referenced by beingDestroyed(), and newItem().

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 }
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views

◆ highlightAdded()

void FWEveViewManager::highlightAdded ( TEveElement *  iElement)

Definition at line 724 of file FWEveViewManager.cc.

References FWViewManagerBase::context(), muonRecoAnalyzer_cfi::etaBin, fireworks::Context::getCaloData(), compareTotals::hist, mps_fire::i, BeamMonitor_cff::phiBin, l1tHGCalTowerProducer_cfi::tower, and w().

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 }
T w() const
TEveCaloDataHist * getCaloData() const
Definition: Context.h:69
const fireworks::Context & context() const

◆ 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.

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

Referenced by newItem().

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 }
bool getHaveWindow() const
std::map< int, BuilderVec > m_builders
std::map< const FWEventItem *, FWInteractionList * > m_interactionLists
const FWEventItem * item() const
void itemChanged(const FWEventItem *)

◆ modelChanges()

void FWEveViewManager::modelChanges ( const FWModelIds iIds)
private

Callback of event item changed_ signal.

Definition at line 418 of file FWEveViewManager.cc.

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

Referenced by newItem().

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 }
bool getHaveWindow() const
std::map< int, BuilderVec > m_builders
std::map< const FWEventItem *, FWInteractionList * > m_interactionLists
const FWEventItem * item() const
void modelChanges(const FWModelIds &)

◆ 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.

References addElements(), FWEventItem::changed_, HLT_2023v12_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, and FWEventItem::type().

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(std::bind(&FWEveViewManager::modelChanges, this, std::placeholders::_1));
224  iItem->goingToBeDestroyed_.connect(std::bind(&FWEveViewManager::removeItem, this, std::placeholders::_1));
225  iItem->itemChanged_.connect(std::bind(&FWEveViewManager::itemChanged, this, std::placeholders::_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 }
size
Write out results.
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views
static const TGPicture * info(bool iBackgroundIsBlack)
void itemChanged(const FWEventItem *)
bool haveViewForBit(int) const
FWItemChangeSignal goingToBeDestroyed_
Definition: FWEventItem.h:197
TypeToBuilder m_typeToBuilder
TGeoIterator Iterator
const TClass * modelType() const
Definition: FWEventItem.cc:464
static bool inheritsFrom(const edm::TypeWithDict &iChild, const std::string &iParentTypeName, unsigned int &distance)
FWItemChangeSignal itemChanged_
Definition: FWEventItem.h:181
void addElements(const FWEventItem *item, FWEveView *view, int viewType, TEveElementList *product)
void modelChanges(const FWModelIds &iIds)
std::map< int, BuilderVec > m_builders
#define fwLog(_level_)
Definition: fwLog.h:45
const TClass * type() const
Definition: FWEventItem.cc:437
std::map< const FWEventItem *, FWInteractionList * > m_interactionLists
FWModelChangeSignal changed_
Definition: FWEventItem.h:178
virtual void removeItem(const FWEventItem *)
const std::string & purpose() const
Definition: FWEventItem.cc:439
#define get
def move(src, dest)
Definition: eostools.py:511

◆ operator=()

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

◆ removeItem()

void FWEveViewManager::removeItem ( const FWEventItem item)
virtual

Remove an item from the given view.

Definition at line 482 of file FWEveViewManager.cc.

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

Referenced by newItem().

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 }
std::map< int, BuilderVec > m_builders
std::map< const FWEventItem *, FWInteractionList * > m_interactionLists
BuilderVec::iterator BuilderVec_it

◆ selectionAdded()

void FWEveViewManager::selectionAdded ( TEveElement *  iElement)

Definition at line 641 of file FWEveViewManager.cc.

References getSelector(), and collectionMerger::selector.

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

◆ selectionCleared()

void FWEveViewManager::selectionCleared ( )

Definition at line 653 of file FWEveViewManager.cc.

References FWSelectionManager::clearSelection(), FWViewManagerBase::context(), and fireworks::Context::selectionManager().

FWSelectionManager * selectionManager() const
Definition: Context.h:54
const fireworks::Context & context() const

◆ selectionRemoved()

void FWEveViewManager::selectionRemoved ( TEveElement *  iElement)

Definition at line 647 of file FWEveViewManager.cc.

References getSelector(), and collectionMerger::selector.

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

◆ setContext()

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

Reimplemented from FWViewManagerBase.

Definition at line 505 of file FWEveViewManager.cc.

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

505  {
507  x->commonPrefs()->getEnergyScale()->parameterChanged_.connect(
509  x->commonPrefs()->eventCenterChanged_.connect(std::bind(&FWEveViewManager::eventCenterChanged, this));
510 }
virtual void setContext(const fireworks::Context *x)

◆ supportedTypesAndRepresentations()

FWTypeToRepresentations FWEveViewManager::supportedTypesAndRepresentations ( ) const
overridevirtual

Implements FWViewManagerBase.

Definition at line 659 of file FWEveViewManager.cc.

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

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 }
static const TGPicture * info(bool iBackgroundIsBlack)
TypeToBuilder m_typeToBuilder
void add(std::shared_ptr< FWRepresentationCheckerBase > iChecker)
bool getHidePFBuilders() const
Definition: Context.h:80
const fireworks::Context & context() const

◆ syncAllViews()

static void FWEveViewManager::syncAllViews ( )
inlinestatic

Definition at line 76 of file FWEveViewManager.h.

References s_syncAllViews.

Referenced by CmsShowMain::CmsShowMain().

76 { s_syncAllViews = true; }
static bool s_syncAllViews

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 113 of file FWEveViewManager.h.

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

◆ m_typeToBuilder

TypeToBuilder FWEveViewManager::m_typeToBuilder
private

Definition at line 105 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 107 of file FWEveViewManager.h.

Referenced by eventEnd(), and syncAllViews().