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

Member Typedef Documentation

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

Definition at line 98 of file FWEveViewManager.h.

typedef BuilderVec::iterator FWEveViewManager::BuilderVec_it
private

Definition at line 99 of file FWEveViewManager.h.

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

Definition at line 100 of file FWEveViewManager.h.

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

Definition at line 97 of file FWEveViewManager.h.

Constructor & Destructor Documentation

FWEveViewManager::FWEveViewManager ( FWGUIManager iGUIMgr)

Definition at line 75 of file FWEveViewManager.cc.

References buildView(), 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_, and FWGUIManager::registerViewBuilder().

75  :
77 {
78 
79  // builders
80  std::set<std::string> builders;
81 
82  std::vector<edmplugin::PluginInfo> available = FWProxyBuilderFactory::get()->available();
83  std::transform(available.begin(),
84  available.end(),
85  std::inserter(builders,builders.begin()),
86  boost::bind(&edmplugin::PluginInfo::name_,_1));
87 
90  std::transform(available.begin(),
91  available.end(),
92  std::inserter(builders,builders.begin()),
93  boost::bind(&edmplugin::PluginInfo::name_,_1));
94  }
95 
96 
97  for(std::set<std::string>::iterator it = builders.begin(), itEnd=builders.end();
98  it!=itEnd;
99  ++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 
110 
112 
113 
114  // view construction called via GUI mng
115  FWGUIManager::ViewBuildFunctor f = boost::bind(&FWEveViewManager::buildView, this, _1, _2);
116  for (int i = 0; i < FWViewType::kTypeSize; i++)
117  {
119  continue;
121  }
122 
123  // signal
124  gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_Master);
125  TEveSelection* eveSelection = gEve->GetSelection();
126  eveSelection->SetPickToSelect(TEveSelection::kPS_Master);
127  eveSelection->Connect("SelectionAdded(TEveElement*)","FWEveViewManager",this,"selectionAdded(TEveElement*)");
128  eveSelection->Connect("SelectionRepeated(TEveElement*)","FWEveViewManager",this,"selectionAdded(TEveElement*)");
129  eveSelection->Connect("SelectionRemoved(TEveElement*)","FWEveViewManager",this,"selectionRemoved(TEveElement*)");
130  eveSelection->Connect("SelectionCleared()","FWEveViewManager",this,"selectionCleared()");
131 
132  gEve->GetHighlight()->Connect("SelectionAdded(TEveElement*)","FWEveViewManager",this,"highlightAdded(TEveElement*)");
133  gEve->GetHighlight()->Connect("SelectionRepeated(TEveElement*)","FWEveViewManager",this,"highlightAdded(TEveElement*)");
134 }
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:101
void registerViewBuilder(const std::string &iName, ViewBuildFunctor &iBuilder)
double f[11][100]
bool first
Definition: L1TdeRCT.cc:79
FWViewBase * buildView(TEveWindowSlot *iParent, const std::string &type)
string fullName
static const std::string & idToName(int)
Definition: FWViewType.cc:88
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
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 136 of file FWEveViewManager.cc.

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

Member Function Documentation

void FWEveViewManager::beingDestroyed ( const FWViewBase vb)
private

Definition at line 399 of file FWEveViewManager.cc.

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

Referenced by finishViewCreate().

400 {
401  FWEveView* view = (FWEveView*) vb;
402  int typeId = view->typeId();
403 
404  int viewerBit = 1 << typeId;
405  int nviews = m_views[typeId].size();
406  for ( std::map<int, BuilderVec>::iterator i = m_builders.begin(); i!= m_builders.end(); ++i)
407  {
408  int builderBit = i->first;
409  if (viewerBit == (builderBit & viewerBit)) // check only in case if connected
410  {
411  BuilderVec& bv = i->second;
412 
413  // remove view-owned product
414  if (viewerBit == (builderBit & viewerBit))
415  {
416  for(BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt)
417  (*bIt)->removePerViewProduct(view->typeId(), view->viewContext());
418  }
419 
420  // and setup proxy builders have-a-window flag
421  if (nviews == 1)
422  {
423  if (!haveViewForBit(builderBit))
424  {
425  if (viewerBit == (builderBit & viewerBit))
426  {
427  for(BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt)
428  (*bIt)->setHaveWindow(false);
429  }
430  }
431  }
432  }
433  }
434 
435 
436  for(EveViewVec_it i= m_views[typeId].begin(); i != m_views[typeId].end(); ++i) {
437  if(i->get() == vb) {
438  m_views[typeId].erase(i);
439  break;
440  }
441  }
442 }
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 271 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().

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

Implements FWViewManagerBase.

Definition at line 593 of file FWEveViewManager.cc.

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

594 {
595  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
596  {
597  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
598  (*i)->setBackgroundColor(colorManager().background());
599  }
600 }
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 604 of file FWEveViewManager.cc.

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

605 {
606  gEve->DisableRedraw();
607 
609 
610  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
611  {
612  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
613  (*i)->eventBegin();
614  }
615 }
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 618 of file FWEveViewManager.cc.

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

619 {
620  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
621  {
622  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
623  (*i)->eventEnd();
624  }
625  gEve->EnableRedraw();
626 }
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 316 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().

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

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

Referenced by setContext().

578 {
579  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
580  {
581  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
582  {
583  if ((*i)->isEnergyScaleGlobal())
584  {
585  (*i)->setupEnergyScale();
586  }
587  }
588 
589  }
590 }
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 712 of file FWEveViewManager.cc.

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

Referenced by beingDestroyed(), and newItem().

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

Definition at line 735 of file FWEveViewManager.cc.

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

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

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

Referenced by newItem().

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

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

Referenced by newItem().

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

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

Implements FWViewManagerBase.

Definition at line 453 of file FWEveViewManager.cc.

454 {
455  gEve->EnableRedraw();
456 }
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 181 of file FWEveViewManager.cc.

References addElements(), FWEventItem::changed_, FWProxyBuilderBase::createProduct(), ExpressReco_HICollisions_FallBack::e, cmsCodeRules.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, matplotRender::t, FWEveView::viewContext(), and FWProxyBuilderBase::willHandleInteraction().

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

References i, m_builders, and m_interactionLists.

Referenced by newItem().

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

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

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

Definition at line 666 of file FWEveViewManager.cc.

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

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

Definition at line 658 of file FWEveViewManager.cc.

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

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

Reimplemented from FWViewManagerBase.

Definition at line 569 of file FWEveViewManager.cc.

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

570 {
573 
574 }
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 677 of file FWEveViewManager.cc.

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

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

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

TypeToBuilder FWEveViewManager::m_typeToBuilder
private

Definition at line 102 of file FWEveViewManager.h.

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

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