CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes
FWEveViewManager Class Reference

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

Inheritance diagram for FWEveViewManager:
FWViewManagerBase

Classes

struct  BuilderInfo
 

Public Member Functions

virtual void eventBegin ()
 
virtual void eventEnd ()
 
 FWEveViewManager (FWGUIManager *)
 
void highlightAdded (TEveElement *)
 
virtual void newItem (const FWEventItem *)
 
virtual void removeItem (const FWEventItem *)
 
void selectionAdded (TEveElement *)
 
void selectionCleared ()
 
void selectionRemoved (TEveElement *)
 
virtual void setContext (const fireworks::Context *)
 
FWTypeToRepresentations supportedTypesAndRepresentations () const
 
virtual ~FWEveViewManager ()
 
- 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 ()
 

Protected Member Functions

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

Private Types

typedef std::vector
< boost::shared_ptr
< FWProxyBuilderBase > > 
BuilderVec
 
typedef BuilderVec::iterator BuilderVec_it
 
typedef std::vector
< boost::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)
 
FWEveViewfinishViewCreate (boost::shared_ptr< FWEveView >)
 
 FWEveViewManager (const FWEveViewManager &)
 
void globalEnergyScaleChanged ()
 
bool haveViewForBit (int) const
 
void itemChanged (const FWEventItem *)
 
void modelChanges (const FWModelIds &iIds)
 
const FWEveViewManageroperator= (const FWEveViewManager &)
 

Private Attributes

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

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 44 of file FWEveViewManager.h.

Member Typedef Documentation

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

Definition at line 101 of file FWEveViewManager.h.

typedef BuilderVec::iterator FWEveViewManager::BuilderVec_it
private

Definition at line 102 of file FWEveViewManager.h.

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

Definition at line 103 of file FWEveViewManager.h.

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

Definition at line 100 of file FWEveViewManager.h.

Constructor & Destructor Documentation

FWEveViewManager::FWEveViewManager ( FWGUIManager iGUIMgr)

Definition at line 76 of file FWEveViewManager.cc.

References buildView(), python.rootplot.argparse::category, edmplugin::PluginManager::categoryToInfos(), f, first, newFWLiteAna::fullName, reco::get(), edmplugin::PluginManager::get(), i, FWViewType::idToName(), FWViewType::kTable, FWViewType::kTableHLT, FWViewType::kTableL1, FWViewType::kTypeSize, m_typeToBuilder, m_views, edmplugin::PluginInfo::name_, FWGUIManager::registerViewBuilder(), AlCaHLTBitMon_QueryRunRegistry::string, and create_public_pileup_plots::transform.

76  :
78 {
79 
80  // builders
81  std::set<std::string> builders;
82 
83  std::vector<edmplugin::PluginInfo> available = FWProxyBuilderFactory::get()->available();
84  std::transform(available.begin(),
85  available.end(),
86  std::inserter(builders,builders.begin()),
87  boost::bind(&edmplugin::PluginInfo::name_,_1));
88 
91  std::transform(available.begin(),
92  available.end(),
93  std::inserter(builders,builders.begin()),
94  boost::bind(&edmplugin::PluginInfo::name_,_1));
95  }
96 
97 
98  for(std::set<std::string>::iterator it = builders.begin(), itEnd=builders.end();
99  it!=itEnd;
100  ++it) {
101  std::string::size_type first = it->find_first_of('@')+1;
102  std::string purpose = it->substr(first,it->find_last_of('@')-first);
103 
104  first = it->find_last_of('@')+1;
105  std::string view_str = it->substr(first,it->find_last_of('#')-first);
106  int viewTypes = atoi(view_str.c_str());
107  std::string fullName = *it;
108  m_typeToBuilder[purpose].push_back(BuilderInfo(*it, viewTypes));
109  }
110 
111 
113 
114 
115  // view construction called via GUI mng
116  FWGUIManager::ViewBuildFunctor f = boost::bind(&FWEveViewManager::buildView, this, _1, _2);
117  for (int i = 0; i < FWViewType::kTypeSize; i++)
118  {
120  continue;
122  }
123 
124  // signal
125  gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_Master);
126  TEveSelection* eveSelection = gEve->GetSelection();
127  eveSelection->SetPickToSelect(TEveSelection::kPS_Master);
128  eveSelection->Connect("SelectionAdded(TEveElement*)","FWEveViewManager",this,"selectionAdded(TEveElement*)");
129  eveSelection->Connect("SelectionRepeated(TEveElement*)","FWEveViewManager",this,"selectionAdded(TEveElement*)");
130  eveSelection->Connect("SelectionRemoved(TEveElement*)","FWEveViewManager",this,"selectionRemoved(TEveElement*)");
131  eveSelection->Connect("SelectionCleared()","FWEveViewManager",this,"selectionCleared()");
132 
133  gEve->GetHighlight()->Connect("SelectionAdded(TEveElement*)","FWEveViewManager",this,"highlightAdded(TEveElement*)");
134  gEve->GetHighlight()->Connect("SelectionRepeated(TEveElement*)","FWEveViewManager",this,"highlightAdded(TEveElement*)");
135 }
const CategoryToInfos & categoryToInfos() const
Definition: PluginManager.h:71
int i
Definition: DBlmapReader.cc:9
TypeToBuilder m_typeToBuilder
uint16_t size_type
boost::function2< FWViewBase *, TEveWindowSlot *, const std::string & > ViewBuildFunctor
Definition: FWGUIManager.h:100
void registerViewBuilder(const std::string &iName, ViewBuildFunctor &iBuilder)
double f[11][100]
bool first
Definition: L1TdeRCT.cc:94
FWViewBase * buildView(TEveWindowSlot *iParent, const std::string &type)
string fullName
static const std::string & idToName(int)
Definition: FWViewType.cc:90
std::string name_
Definition: PluginInfo.h:30
static PluginManager * get()
T get(const Candidate &c)
Definition: component.h:56
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
FWEveViewManager::~FWEveViewManager ( )
virtual

Definition at line 137 of file FWEveViewManager.cc.

138 {
139 }
FWEveViewManager::FWEveViewManager ( const FWEveViewManager )
private

Member Function Documentation

void FWEveViewManager::beingDestroyed ( const FWViewBase vb)
private

Definition at line 400 of file FWEveViewManager.cc.

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

Referenced by finishViewCreate().

401 {
402  FWEveView* view = (FWEveView*) vb;
403  int typeId = view->typeId();
404 
405  int viewerBit = 1 << typeId;
406  int nviews = m_views[typeId].size();
407  for ( std::map<int, BuilderVec>::iterator i = m_builders.begin(); i!= m_builders.end(); ++i)
408  {
409  int builderBit = i->first;
410  if (viewerBit == (builderBit & viewerBit)) // check only in case if connected
411  {
412  BuilderVec& bv = i->second;
413 
414  // remove view-owned product
415  if (viewerBit == (builderBit & viewerBit))
416  {
417  for(BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt)
418  (*bIt)->removePerViewProduct(view->typeId(), view->viewContext());
419  }
420 
421  // and setup proxy builders have-a-window flag
422  if (nviews == 1)
423  {
424  if (!haveViewForBit(builderBit))
425  {
426  if (viewerBit == (builderBit & viewerBit))
427  {
428  for(BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt)
429  (*bIt)->setHaveWindow(false);
430  }
431  }
432  }
433  }
434  }
435 
436 
437  for(EveViewVec_it i= m_views[typeId].begin(); i != m_views[typeId].end(); ++i) {
438  if(i->get() == vb) {
439  m_views[typeId].erase(i);
440  break;
441  }
442  }
443 }
int i
Definition: DBlmapReader.cc:9
std::vector< boost::shared_ptr< FWEveView > >::iterator EveViewVec_it
bool haveViewForBit(int) const
std::map< int, BuilderVec > m_builders
FWViewContext * viewContext()
Definition: FWEveView.h:80
std::vector< boost::shared_ptr< FWProxyBuilderBase > > BuilderVec
BuilderVec::iterator BuilderVec_it
#define begin
Definition: vmac.h:31
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
FWViewType::EType typeId() const
Definition: FWViewBase.h:42
FWViewBase * FWEveViewManager::buildView ( TEveWindowSlot *  iParent,
const std::string &  type 
)
private

Definition at line 272 of file FWEveViewManager.cc.

References prof2calltree::back, finishViewCreate(), 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().

273 {
275  for (int i = 0; i < FWViewType::kTypeSize; ++i)
276  {
277  if (viewName == FWViewType::idToName(i))
278  {
279  type = FWViewType::EType(i);
280  break;
281  }
282  }
283 
284  boost::shared_ptr<FWEveView> view;
285  switch(type)
286  {
287  case FWViewType::k3D:
288  view.reset(new FW3DView(iParent, type));
289  break;
290  case FWViewType::kISpy:
291  view.reset(new FWISpyView(iParent, type));
292  break;
293  case FWViewType::kRhoPhi:
294  case FWViewType::kRhoZ:
296  view.reset(new FWRPZView(iParent, type));
297  break;
298  case FWViewType::kLego:
300  view.reset(new FWEveLegoView(iParent, type));
301  break;
302  case FWViewType::kLegoHF:
303  view.reset(new FWHFView(iParent, type));
304  break;
306  view.reset(new FWGlimpseView(iParent, type));
307  break;
308  default:
309  break;
310  }
311 
312  m_views[type].push_back(boost::shared_ptr<FWEveView> (view));
313  return finishViewCreate(m_views[type].back());
314 }
FWEveView * finishViewCreate(boost::shared_ptr< FWEveView >)
type
Definition: HCALResponse.h:21
int i
Definition: DBlmapReader.cc:9
static const std::string & idToName(int)
Definition: FWViewType.cc:90
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
void FWEveViewManager::colorsChanged ( )
protectedvirtual

Implements FWViewManagerBase.

Definition at line 594 of file FWEveViewManager.cc.

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

595 {
596  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
597  {
598  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
599  (*i)->setBackgroundColor(colorManager().background());
600  }
601 }
int i
Definition: DBlmapReader.cc:9
FWColorManager & colorManager() const
std::vector< boost::shared_ptr< FWEveView > >::iterator EveViewVec_it
#define begin
Definition: vmac.h:31
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
void FWEveViewManager::eventBegin ( )
virtual

Reimplemented from FWViewManagerBase.

Definition at line 605 of file FWEveViewManager.cc.

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

606 {
607  gEve->DisableRedraw();
608 
610 
611  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
612  {
613  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
614  (*i)->eventBegin();
615  }
616 }
int i
Definition: DBlmapReader.cc:9
const fireworks::Context & context() const
std::vector< boost::shared_ptr< FWEveView > >::iterator EveViewVec_it
void resetMaxEtAndEnergy() const
Definition: Context.cc:192
#define begin
Definition: vmac.h:31
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
void FWEveViewManager::eventEnd ( )
virtual

Reimplemented from FWViewManagerBase.

Definition at line 619 of file FWEveViewManager.cc.

References begin, i, FWViewType::kTypeSize, m_views, and lumiQTWidget::t.

620 {
621  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
622  {
623  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
624  (*i)->eventEnd();
625  }
626  gEve->EnableRedraw();
627 }
int i
Definition: DBlmapReader.cc:9
std::vector< boost::shared_ptr< FWEveView > >::iterator EveViewVec_it
#define begin
Definition: vmac.h:31
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
FWEveView * FWEveViewManager::finishViewCreate ( boost::shared_ptr< FWEveView view)
private

Definition at line 317 of file FWEveViewManager.cc.

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

Referenced by buildView().

318 {
319  // printf("new view %s added \n", view->typeName().c_str());
320  gEve->DisableRedraw();
321 
322  // set geometry and calo data
323  view->setContext(context());
324 
326 
327  // set proxies have a window falg
328  int viewerBit = 1 << view->typeId();
329  if (m_views[view->typeId()].size() == 1)
330  {
331  for ( std::map<int, BuilderVec>::iterator i = m_builders.begin(); i!= m_builders.end(); ++i)
332  {
333  int builderViewBit = i->first;
334  BuilderVec& bv = i->second;
335  if (viewerBit == (builderViewBit & viewerBit))
336  {
337  for(BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt)
338  {
339  (*bIt)->setHaveWindow(true);
340  }
341  }
342  }
343  }
344 
345  FWRPZView* rpzView = dynamic_cast<FWRPZView*>(view.get());
346  for ( std::map<int, BuilderVec>::iterator i = m_builders.begin(); i!= m_builders.end(); ++i)
347  {
348  int builderViewBit = i->first;
349  BuilderVec& bv = i->second;
350  if (viewerBit == (builderViewBit & viewerBit))
351  {
352  for(BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt)
353  {
354  // it is ok to call create even for shared productsm since
355  // builder map key garanties that
356  TEveElementList* product = (*bIt)->createProduct(view->typeId(), view->viewContext());
357 
358  if ((*bIt)->havePerViewProduct((FWViewType::EType)view->typeId()))
359  {
360  // view owned
361  (*bIt)->build();
362  if (rpzView)
363  {
364  rpzView->importElements(product, (*bIt)->item()->layer(), rpzView->ownedProducts());
365  }
366  else
367  {
368  view->ownedProducts()->AddElement(product);
369  }
370  }
371  else
372  {
373  // shared
374  if (rpzView)
375  {
376  rpzView->importElements(product, (*bIt)->item()->layer(), rpzView->eventScene());
377  }
378  else
379  {
380  view->eventScene()->AddElement(product);
381  }
382 
383  }
384  }
385  }
386  }
387 
388  view->beingDestroyed_.connect(boost::bind(&FWEveViewManager::beingDestroyed,this,_1));
389 
390  view->setupEnergyScale(); // notify PB for energy scale
391 
392  gEve->EnableRedraw();
393  view->viewerGL()->UpdateScene();
394  gEve->Redraw3D();
395 
396  return view.get();
397 }
int i
Definition: DBlmapReader.cc:9
Color_t background() const
const fireworks::Context & context() const
TEveScene * eventScene()
Definition: FWEveView.h:76
FWColorManager * colorManager() const
Definition: Context.h:66
void importElements(TEveElement *iProjectableChild, float layer, TEveElement *iProjectedParent=0)
Definition: FWRPZView.cc:304
void beingDestroyed(const FWViewBase *)
std::map< int, BuilderVec > m_builders
std::vector< boost::shared_ptr< FWProxyBuilderBase > > BuilderVec
BuilderVec::iterator BuilderVec_it
TEveElement * ownedProducts()
Definition: FWEveView.h:79
static Bool_t setColorSetViewer(TGLViewer *, Color_t)
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
void FWEveViewManager::globalEnergyScaleChanged ( )
private

Definition at line 578 of file FWEveViewManager.cc.

References begin, i, FWViewType::kTypeSize, m_views, and lumiQTWidget::t.

Referenced by setContext().

579 {
580  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
581  {
582  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
583  {
584  if ((*i)->isEnergyScaleGlobal())
585  {
586  (*i)->setupEnergyScale();
587  }
588  }
589 
590  }
591 }
int i
Definition: DBlmapReader.cc:9
std::vector< boost::shared_ptr< FWEveView > >::iterator EveViewVec_it
#define begin
Definition: vmac.h:31
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
bool FWEveViewManager::haveViewForBit ( int  bit) const
private

Checks whether any of the views

Definition at line 713 of file FWEveViewManager.cc.

References FWViewType::kTypeSize, m_views, findQualityFiles::size, and lumiQTWidget::t.

Referenced by beingDestroyed(), and newItem().

714 {
715  for (int t = 0; t < FWViewType::kTypeSize; ++t)
716  {
717  if ((bit & (1 << t)) && m_views[t].size())
718  return true;
719  }
720  // printf("have %d view for bit %d \n", haveView, bit);
721  return false;
722 }
tuple size
Write out results.
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
void FWEveViewManager::highlightAdded ( TEveElement *  iElement)

Definition at line 736 of file FWEveViewManager.cc.

References evf::utils::blocked, FWViewManagerBase::context(), fireworks::Context::getCaloData(), estimatePileup::hist, i, and w().

737 {
738 
739  bool blocked = gEve->GetHighlight()->BlockSignals(true);
740 
741 
742  if (iElement == context().getCaloData())
743  {
744  TEveCaloData::vCellId_t& hlist = context().getCaloData()->GetCellsHighlighted();
745  std::set<TEveCaloData::CellId_t> hset;
746 
747  int etaBin, phiBin, w, newPhiBin, tower;
748  TH2F* hist = context().getCaloData()->GetHist(0);
749  TAxis* etaAxis = hist->GetXaxis();
750  int nBinsX = etaAxis->GetNbins() + 2;
751 
752  for (TEveCaloData::vCellId_i i = hlist.begin(); i != hlist.end(); ++i)
753  {
754  hist->GetBinXYZ((*i).fTower, etaBin, phiBin, w);
755  if (TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 4.71475)
756  {
757  newPhiBin = ((phiBin + 1) / 4) * 4 - 1;
758  if (newPhiBin <= 0) newPhiBin = 71;
759 
760  tower = etaBin + newPhiBin*nBinsX;
761  hset.insert(TEveCaloData::CellId_t( tower, (*i).fSlice, (*i).fFraction));
762  tower += nBinsX;
763  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
764  tower += nBinsX;
765 
766  if (newPhiBin == 71)
767  tower = etaBin + 1*nBinsX;
768 
769  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
770  tower += nBinsX;
771  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
772  }
773  else if (TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 1.747650)
774  {
775  newPhiBin = ((phiBin + 1)/2)*2 - 1;
776  tower = etaBin + newPhiBin*nBinsX;
777  hset.insert(TEveCaloData::CellId_t( tower, (*i).fSlice, (*i).fFraction));
778  tower += nBinsX;
779  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
780  }
781  else
782  {
783  hset.insert(*i);
784  }
785  }
786 
787  // edit calo data list
788  hlist.clear();
789  for(std::set<TEveCaloData::CellId_t>::iterator it = hset.begin(); it != hset.end(); ++it)
790  {
791  hlist.push_back(*it);
792  }
793  context().getCaloData()->CellSelectionChanged();
794 
795  }
796 
797  gEve->GetHighlight()->BlockSignals(blocked);
798 }
int i
Definition: DBlmapReader.cc:9
const fireworks::Context & context() const
TEveCaloDataHist * getCaloData() const
Definition: Context.h:81
T w() const
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 502 of file FWEveViewManager.cc.

References FWProxyBuilderBase::getHaveWindow(), i, FWProxyBuilderBase::item(), FWProxyBuilderBase::itemChanged(), m_builders, and m_interactionLists.

Referenced by newItem().

503 {
504  if (!item)
505  return;
506 
507  bool itemHaveWindow = false;
508 
509  for (std::map<int, BuilderVec>::iterator i = m_builders.begin();
510  i != m_builders.end(); ++i)
511  {
512  for(size_t bi = 0, be = i->second.size(); bi != be; ++bi)
513  {
514  FWProxyBuilderBase *builder = i->second[bi].get();
515 
516  if (builder->item() != item)
517  continue;
518 
519  builder->itemChanged(item);
520  itemHaveWindow |= builder->getHaveWindow();
521  }
522  }
523 
524  if (!itemHaveWindow)
525  return;
526 
527  std::map<const FWEventItem*, FWInteractionList*>::iterator it = m_interactionLists.find(item);
528  if (it != m_interactionLists.end())
529  {
530  if (!it->second->empty())
531  it->second->itemChanged();
532  }
533 }
int i
Definition: DBlmapReader.cc:9
const FWEventItem * item() const
std::map< int, BuilderVec > m_builders
std::map< const FWEventItem *, FWInteractionList * > m_interactionLists
bool getHaveWindow() const
void itemChanged(const FWEventItem *)
void FWEveViewManager::modelChanges ( const FWModelIds iIds)
private

Callback of event item changed_ signal.

Definition at line 461 of file FWEveViewManager.cc.

References FWProxyBuilderBase::getHaveWindow(), i, FWProxyBuilderBase::item(), m_builders, m_interactionLists, and FWProxyBuilderBase::modelChanges().

Referenced by newItem().

462 {
463  FWModelId id = *(iIds.begin());
464  const FWEventItem* item = id.item();
465 
466  // in standard case new elements can be build in case of change of visibility
467  // and in non-standard case (e.g. calo towers) PB's modelChages handles all changes
468  bool itemHaveWindow = false;
469  for (std::map<int, BuilderVec>::iterator i = m_builders.begin();
470  i != m_builders.end(); ++i)
471  {
472  for (size_t bi = 0, be = i->second.size(); bi != be; ++bi)
473  {
474  FWProxyBuilderBase *builder = i->second[bi].get();
475  if (builder->getHaveWindow() && builder->item() == item)
476  {
477  builder->modelChanges(iIds);
478  itemHaveWindow = true;
479  }
480  }
481  }
482 
483  if (!itemHaveWindow)
484  return;
485 
487 
488  std::map<const FWEventItem*, FWInteractionList*>::iterator it = m_interactionLists.find(item);
489  if (it != m_interactionLists.end())
490  {
491  if (!it->second->empty())
492  it->second->modelChanges(iIds);
493  }
494 }
int i
Definition: DBlmapReader.cc:9
const FWEventItem * item() const
std::map< int, BuilderVec > m_builders
std::map< const FWEventItem *, FWInteractionList * > m_interactionLists
bool getHaveWindow() const
void modelChanges(const FWModelIds &)
void FWEveViewManager::modelChangesComing ( )
protectedvirtual

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

Implements FWViewManagerBase.

Definition at line 448 of file FWEveViewManager.cc.

449 {
450  gEve->DisableRedraw();
451 }
void FWEveViewManager::modelChangesDone ( )
protectedvirtual

Implements FWViewManagerBase.

Definition at line 454 of file FWEveViewManager.cc.

455 {
456  gEve->EnableRedraw();
457 }
void FWEveViewManager::newItem ( const FWEventItem iItem)
virtual

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

References addElements(), FWEventItem::changed_, FWProxyBuilderBase::createProduct(), alignCSCRings::e, cppFunctionSkipper::exception, fwLog, reco::get(), FWEventItem::goingToBeDestroyed_, FWProxyBuilderBase::havePerViewProduct(), haveViewForBit(), i, info, itemChanged(), FWEventItem::itemChanged_, FWViewType::kTypeSize, fwlog::kWarning, m_builders, m_interactionLists, FWEveViewManager::BuilderInfo::m_name, m_typeToBuilder, FWEveViewManager::BuilderInfo::m_viewBit, m_views, modelChanges(), FWEventItem::purpose(), removeItem(), FWProxyBuilderBase::setHaveWindow(), FWProxyBuilderBase::setInteractionList(), FWProxyBuilderBase::setItem(), findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, lumiQTWidget::t, FWEveView::viewContext(), and FWProxyBuilderBase::willHandleInteraction().

183 {
184  TypeToBuilder::iterator itFind = m_typeToBuilder.find(iItem->purpose());
185 
186  if (itFind == m_typeToBuilder.end())
187  return;
188 
189  std::vector<BuilderInfo>& blist = itFind->second;
190 
191  for (size_t bii = 0, bie = blist.size(); bii != bie; ++bii)
192  {
193  // 1.
194  BuilderInfo &info = blist[bii];
195  std::string builderName = info.m_name;
196  int builderViewBit = info.m_viewBit;
197 
198  FWProxyBuilderBase* builder = 0;
199  try
200  {
201  builder = FWProxyBuilderFactory::get()->create(builderName);
202 
203  }
204  catch (std::exception& exc)
205  {
206  fwLog(fwlog::kWarning) << "FWEveViewManager::newItem ignoring the following exception (probably edmplugincache mismatch):"
207  << std::endl << exc.what();
208  }
209  if (!builder)
210  continue;
211 
212  // 2.
213  // printf("FWEveViewManager::makeProxyBuilderFor NEW builder %s \n", builderName.c_str());
214 
215  boost::shared_ptr<FWProxyBuilderBase> pB(builder);
216  builder->setItem(iItem);
217  iItem->changed_.connect(boost::bind(&FWEveViewManager::modelChanges,this,_1));
218  iItem->goingToBeDestroyed_.connect(boost::bind(&FWEveViewManager::removeItem,this,_1));
219  iItem->itemChanged_.connect(boost::bind(&FWEveViewManager::itemChanged,this,_1));
220 
221  // 3.
222  // This calud be opaque to the user. I would pass a reference to the m_interactionLists to
223  // FWProxyBuilderBase::setInteractionList and handle different case differently.
224  if (builder->willHandleInteraction() == false)
225  {
226  typedef std::map<const FWEventItem*, FWInteractionList*>::iterator Iterator;
227  std::pair<Iterator, bool> t = m_interactionLists.insert(std::make_pair(iItem,
228  (FWInteractionList*)0));
229 
230  if (t.second == true)
231  t.first->second = new FWInteractionList(iItem);
232  // printf(">>> builder %s add list %p \n", iItem->name().c_str(), il); fflush(stdout);
233  builder->setInteractionList(t.first->second, iItem->purpose());
234  }
235 
236  builder->setHaveWindow(haveViewForBit(builderViewBit));
237 
238  // 4.
239  for (size_t viewType = 0; viewType < FWViewType::kTypeSize; ++viewType)
240  {
241  if (((1 << viewType) & builderViewBit) == 0)
242  continue;
243 
245 
246  // printf("%s builder %s supportsd view %s \n", iItem->name().c_str(), builderName.c_str(), FWViewType::idToName(viewType).c_str());
247  if (builder->havePerViewProduct((FWViewType::EType) viewType))
248  {
249  for (size_t i = 0, e = m_views[viewType].size(); i != e; ++i)
250  {
251  FWEveView *view = m_views[viewType][i].get();
252  TEveElementList* product = builder->createProduct(type,
253  view->viewContext());
254  addElements(iItem, view, viewType, product);
255  }
256  }
257  else
258  {
259  TEveElementList* product = builder->createProduct(type, 0);
260 
261  for (size_t i = 0, e = m_views[viewType].size(); i != e; ++i)
262  addElements(iItem, m_views[viewType][i].get(), viewType, product);
263  }
264  }
265 
266  m_builders[builderViewBit].push_back(pB);
267  } // loop views
268 }
type
Definition: HCALResponse.h:21
int i
Definition: DBlmapReader.cc:9
virtual bool willHandleInteraction() const
virtual bool havePerViewProduct(FWViewType::EType) const
void itemChanged(const FWEventItem *)
FWItemChangeSignal goingToBeDestroyed_
Definition: FWEventItem.h:215
TypeToBuilder m_typeToBuilder
virtual void setItem(const FWEventItem *iItem)
FWItemChangeSignal itemChanged_
Definition: FWEventItem.h:199
bool haveViewForBit(int) const
void addElements(const FWEventItem *item, FWEveView *view, int viewType, TEveElementList *product)
void modelChanges(const FWModelIds &iIds)
std::map< int, BuilderVec > m_builders
void setHaveWindow(bool iFlag)
std::map< const FWEventItem *, FWInteractionList * > m_interactionLists
#define fwLog(_level_)
Definition: fwLog.h:51
FWViewContext * viewContext()
Definition: FWEveView.h:80
FWModelChangeSignal changed_
Definition: FWEventItem.h:196
virtual void removeItem(const FWEventItem *)
TEveElementList * createProduct(FWViewType::EType, const FWViewContext *)
const std::string & purpose() const
Definition: FWEventItem.cc:513
tuple size
Write out results.
T get(const Candidate &c)
Definition: component.h:56
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
virtual void setInteractionList(FWInteractionList *, const std::string &)
const FWEveViewManager& FWEveViewManager::operator= ( const FWEveViewManager )
private
void FWEveViewManager::removeItem ( const FWEventItem item)
virtual

Remove an item from the given view.

Definition at line 538 of file FWEveViewManager.cc.

References i, m_builders, and m_interactionLists.

Referenced by newItem().

539 {
541 
542  std::map<const FWEventItem*, FWInteractionList*>::iterator it = m_interactionLists.find(item);
543  if (it != m_interactionLists.end())
544  {
545  delete it->second;
546  m_interactionLists.erase(it);
547  }
548 
549  for (std::map<int, BuilderVec>::iterator i = m_builders.begin();
550  i != m_builders.end(); ++i)
551  {
552  BuilderVec_it bIt = i->second.begin();
553  while( bIt != i->second.end() )
554  {
555  if ((*bIt)->item() == item)
556  {
557  // TODO caching of proxy builders
558  (*bIt)->itemBeingDestroyed(item);
559  bIt = i->second.erase(bIt);
560  }
561  else
562  {
563  ++bIt;
564  }
565  }
566  }
567 }
int i
Definition: DBlmapReader.cc:9
std::map< int, BuilderVec > m_builders
std::map< const FWEventItem *, FWInteractionList * > m_interactionLists
BuilderVec::iterator BuilderVec_it
void FWEveViewManager::selectionAdded ( TEveElement *  iElement)

Definition at line 651 of file FWEveViewManager.cc.

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

652 {
653  FWFromEveSelectorBase* selector = getSelector(iElement);
654  if (selector)
655  selector->doSelect();
656 }
FWFromEveSelectorBase * getSelector(TEveElement *iElement)
virtual void doSelect()=0
void FWEveViewManager::selectionCleared ( )

Definition at line 667 of file FWEveViewManager.cc.

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

668 {
670 }
const fireworks::Context & context() const
FWSelectionManager * selectionManager() const
Definition: Context.h:58
void FWEveViewManager::selectionRemoved ( TEveElement *  iElement)

Definition at line 659 of file FWEveViewManager.cc.

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

660 {
661  FWFromEveSelectorBase* selector = getSelector(iElement);
662  if (selector)
663  selector->doUnselect();
664 }
virtual void doUnselect()=0
FWFromEveSelectorBase * getSelector(TEveElement *iElement)
void FWEveViewManager::setContext ( const fireworks::Context x)
virtual

Reimplemented from FWViewManagerBase.

Definition at line 570 of file FWEveViewManager.cc.

References fireworks::Context::commonPrefs(), CmsShowCommon::getEnergyScale(), globalEnergyScaleChanged(), FWViewEnergyScale::parameterChanged_, and FWViewManagerBase::setContext().

571 {
574 
575 }
virtual void setContext(const fireworks::Context *x)
FWViewEnergyScale * getEnergyScale() const
Definition: CmsShowCommon.h:67
CmsShowCommon * commonPrefs() const
Definition: Context.cc:179
sigc::signal< void > parameterChanged_
FWTypeToRepresentations FWEveViewManager::supportedTypesAndRepresentations ( ) const
virtual

Implements FWViewManagerBase.

Definition at line 678 of file FWEveViewManager.cc.

References FWTypeToRepresentations::add(), info, FWEveViewManager::BuilderInfo::m_name, m_typeToBuilder, FWEveViewManager::BuilderInfo::m_viewBit, mergeVDriftHistosByStation::name, and AlCaHLTBitMon_QueryRunRegistry::string.

679 {
680  // needed for add collection GUI
681  FWTypeToRepresentations returnValue;
682  const std::string kSimple("simple#");
683  for(TypeToBuilder::const_iterator it = m_typeToBuilder.begin(), itEnd = m_typeToBuilder.end();
684  it != itEnd;
685  ++it)
686  {
687  std::vector<BuilderInfo> blist = it->second;
688  for (size_t bii = 0, bie = blist.size(); bii != bie; ++bii)
689  {
690  BuilderInfo &info = blist[bii];
691  std::string name = info.m_name;
692  unsigned int bitPackedViews = info.m_viewBit;
693  bool representsSubPart = (name.substr(name.find_first_of('@')-1, 1)=="!");
694 
695  if(name.substr(0,kSimple.size()) == kSimple)
696  {
697  name = name.substr(kSimple.size(), name.find_first_of('@')-kSimple.size()-1);
698  returnValue.add(boost::shared_ptr<FWRepresentationCheckerBase>(new FWSimpleRepresentationChecker(name, it->first,bitPackedViews,representsSubPart)) );
699  }
700  else
701  {
702  name = name.substr(0, name.find_first_of('@')-1);
703  returnValue.add(boost::shared_ptr<FWRepresentationCheckerBase>(new FWEDProductRepresentationChecker(name, it->first,bitPackedViews,representsSubPart)) );
704  }
705  }
706  }
707  return returnValue;
708 }
TypeToBuilder m_typeToBuilder
void add(boost::shared_ptr< FWRepresentationCheckerBase > iChecker)

Member Data Documentation

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

Definition at line 111 of file FWEveViewManager.h.

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

TypeToBuilder FWEveViewManager::m_typeToBuilder
private

Definition at line 105 of file FWEveViewManager.h.

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

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