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_2022v12_cff::builders, buildView(), taus_updatedMVAIds_cff::category, edmplugin::PluginManager::categoryToInfos(), f, 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().

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

138 {}

◆ FWEveViewManager() [2/2]

FWEveViewManager::FWEveViewManager ( const FWEveViewManager )
delete

Member Function Documentation

◆ beingDestroyed()

void FWEveViewManager::beingDestroyed ( const FWViewBase vb)
private

Definition at line 374 of file FWEveViewManager.cc.

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

Referenced by finishViewCreate().

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 }
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
FWViewContext * viewContext()
Definition: FWEveView.h:83
BuilderVec::iterator BuilderVec_it
std::vector< std::shared_ptr< FWProxyBuilderBase > > BuilderVec
FWViewType::EType typeId() const
Definition: FWViewBase.h:42

◆ buildView()

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

Definition at line 270 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().

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

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

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

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

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

◆ eventCenterChanged()

void FWEveViewManager::eventCenterChanged ( )
private

Definition at line 523 of file FWEveViewManager.cc.

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

Referenced by setContext().

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

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

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 }
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 310 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(), FWColorManager::setColorSetViewer(), and FWEveView::setContext().

Referenced by buildView().

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

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

Referenced by setContext().

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

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

Referenced by beingDestroyed(), and newItem().

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

◆ highlightAdded()

void FWEveViewManager::highlightAdded ( TEveElement *  iElement)

Definition at line 725 of file FWEveViewManager.cc.

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

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 }
T w() const
TEveCaloDataHist * getCaloData() const
Definition: Context.h:69
__shared__ Hist hist
int etaBin(const l1t::HGCalMulticluster *cl)
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 453 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().

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

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

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

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 }
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
FWViewContext * viewContext()
Definition: FWEveView.h:83
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 483 of file FWEveViewManager.cc.

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

Referenced by newItem().

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

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

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

◆ selectionCleared()

void FWEveViewManager::selectionCleared ( )

Definition at line 654 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 648 of file FWEveViewManager.cc.

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

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

◆ setContext()

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

Reimplemented from FWViewManagerBase.

Definition at line 506 of file FWEveViewManager.cc.

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

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

◆ supportedTypesAndRepresentations()

FWTypeToRepresentations FWEveViewManager::supportedTypesAndRepresentations ( ) const
overridevirtual

Implements FWViewManagerBase.

Definition at line 660 of file FWEveViewManager.cc.

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

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