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

Member Typedef Documentation

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

Definition at line 99 of file FWEveViewManager.h.

typedef BuilderVec::iterator FWEveViewManager::BuilderVec_it
private

Definition at line 100 of file FWEveViewManager.h.

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

Definition at line 101 of file FWEveViewManager.h.

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

Definition at line 98 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_lumi_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 
136  TGeoManager::SetVerboseLevel(0);
137 }
const CategoryToInfos & categoryToInfos() const
Definition: PluginManager.h:82
int i
Definition: DBlmapReader.cc:9
TypeToBuilder m_typeToBuilder
uint16_t size_type
boost::function2< FWViewBase *, TEveWindowSlot *, const std::string & > ViewBuildFunctor
Definition: FWGUIManager.h:99
void registerViewBuilder(const std::string &iName, ViewBuildFunctor &iBuilder)
double f[11][100]
bool first
Definition: L1TdeRCT.cc:75
FWViewBase * buildView(TEveWindowSlot *iParent, const std::string &type)
string fullName
static const std::string & idToName(int)
Definition: FWViewType.cc:89
std::string name_
Definition: PluginInfo.h:29
static PluginManager * get()
T get(const Candidate &c)
Definition: component.h:55
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
FWEveViewManager::~FWEveViewManager ( )
virtual

Definition at line 139 of file FWEveViewManager.cc.

140 {
141 }
FWEveViewManager::FWEveViewManager ( const FWEveViewManager )
private

Member Function Documentation

void FWEveViewManager::beingDestroyed ( const FWViewBase vb)
private

Definition at line 402 of file FWEveViewManager.cc.

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

Referenced by finishViewCreate().

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

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

275 {
277  for (int i = 0; i < FWViewType::kTypeSize; ++i)
278  {
279  if (viewName == FWViewType::idToName(i))
280  {
281  type = FWViewType::EType(i);
282  break;
283  }
284  }
285 
286  boost::shared_ptr<FWEveView> view;
287  switch(type)
288  {
289  case FWViewType::k3D:
290  view.reset(new FW3DView(iParent, type));
291  break;
292  case FWViewType::kISpy:
293  view.reset(new FWISpyView(iParent, type));
294  break;
295  case FWViewType::kRhoPhi:
296  case FWViewType::kRhoZ:
298  view.reset(new FWRPZView(iParent, type));
299  break;
300  case FWViewType::kLego:
302  view.reset(new FWEveLegoView(iParent, type));
303  break;
304  case FWViewType::kLegoHF:
305  view.reset(new FWHFView(iParent, type));
306  break;
308  view.reset(new FWGlimpseView(iParent, type));
309  break;
310  default:
311  break;
312  }
313 
314  m_views[type].push_back(boost::shared_ptr<FWEveView> (view));
315  return finishViewCreate(m_views[type].back());
316 }
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:89
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
void FWEveViewManager::colorsChanged ( )
protectedvirtual

Implements FWViewManagerBase.

Definition at line 596 of file FWEveViewManager.cc.

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

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

Reimplemented from FWViewManagerBase.

Definition at line 607 of file FWEveViewManager.cc.

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

608 {
609  gEve->DisableRedraw();
610 
612 
613  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
614  {
615  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
616  (*i)->eventBegin();
617  }
618 }
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:191
#define begin
Definition: vmac.h:30
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
void FWEveViewManager::eventEnd ( )
virtual

Reimplemented from FWViewManagerBase.

Definition at line 621 of file FWEveViewManager.cc.

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

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

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

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

Definition at line 580 of file FWEveViewManager.cc.

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

Referenced by setContext().

581 {
582  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
583  {
584  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
585  {
586  if ((*i)->isEnergyScaleGlobal())
587  {
588  (*i)->setupEnergyScale();
589  }
590  }
591 
592  }
593 }
int i
Definition: DBlmapReader.cc:9
std::vector< boost::shared_ptr< FWEveView > >::iterator EveViewVec_it
#define begin
Definition: vmac.h:30
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 718 of file FWEveViewManager.cc.

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

Referenced by beingDestroyed(), and newItem().

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

Definition at line 741 of file FWEveViewManager.cc.

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

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

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

Referenced by newItem().

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

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

Referenced by newItem().

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

451 {
452  gEve->DisableRedraw();
453 }
void FWEveViewManager::modelChangesDone ( )
protectedvirtual

Implements FWViewManagerBase.

Definition at line 456 of file FWEveViewManager.cc.

457 {
458  gEve->EnableRedraw();
459 }
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 184 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, edmStreamStallGrapher::t, FWEveView::viewContext(), and FWProxyBuilderBase::willHandleInteraction().

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

References i, m_builders, and m_interactionLists.

Referenced by newItem().

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

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

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

Definition at line 669 of file FWEveViewManager.cc.

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

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

Definition at line 661 of file FWEveViewManager.cc.

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

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

Reimplemented from FWViewManagerBase.

Definition at line 572 of file FWEveViewManager.cc.

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

573 {
576 
577 }
virtual void setContext(const fireworks::Context *x)
FWViewEnergyScale * getEnergyScale() const
Definition: CmsShowCommon.h:67
CmsShowCommon * commonPrefs() const
Definition: Context.cc:178
sigc::signal< void > parameterChanged_
FWTypeToRepresentations FWEveViewManager::supportedTypesAndRepresentations ( ) const
virtual

Implements FWViewManagerBase.

Definition at line 680 of file FWEveViewManager.cc.

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

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

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

TypeToBuilder FWEveViewManager::m_typeToBuilder
private

Definition at line 103 of file FWEveViewManager.h.

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

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