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 | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
FWEveViewManager Class Reference

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

Inheritance diagram for FWEveViewManager:
FWViewManagerBase

Classes

struct  BuilderInfo
 

Public Member Functions

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

Static Public Member Functions

static void syncAllViews ()
 

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
 

Static Private Attributes

static bool s_syncAllViews = false
 

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

typedef BuilderVec::iterator FWEveViewManager::BuilderVec_it
private

Definition at line 103 of file FWEveViewManager.h.

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

Definition at line 104 of file FWEveViewManager.h.

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

Definition at line 101 of file FWEveViewManager.h.

Constructor & Destructor Documentation

FWEveViewManager::FWEveViewManager ( FWGUIManager iGUIMgr)

Definition at line 91 of file FWEveViewManager.cc.

References HLT_25ns14e33_v1_cff::builders, buildView(), python.rootplot.argparse::category, edmplugin::PluginManager::categoryToInfos(), f, plotBeamSpotDB::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.

91  :
93 {
94 
95  // builders
96  std::set<std::string> builders;
97 
98  std::vector<edmplugin::PluginInfo> available = FWProxyBuilderFactory::get()->available();
99  std::transform(available.begin(),
100  available.end(),
101  std::inserter(builders,builders.begin()),
102  boost::bind(&edmplugin::PluginInfo::name_,_1));
103 
106  std::transform(available.begin(),
107  available.end(),
108  std::inserter(builders,builders.begin()),
109  boost::bind(&edmplugin::PluginInfo::name_,_1));
110  }
111 
112 
113  for(std::set<std::string>::iterator it = builders.begin(), itEnd=builders.end();
114  it!=itEnd;
115  ++it) {
116  std::string::size_type first = it->find_first_of('@')+1;
117  std::string purpose = it->substr(first,it->find_last_of('@')-first);
118 
119  first = it->find_last_of('@')+1;
120  std::string view_str = it->substr(first,it->find_last_of('#')-first);
121  int viewTypes = atoi(view_str.c_str());
122  std::string fullName = *it;
123  m_typeToBuilder[purpose].push_back(BuilderInfo(*it, viewTypes));
124  }
125 
127 
128  // view construction called via GUI mng
129  FWGUIManager::ViewBuildFunctor f = boost::bind(&FWEveViewManager::buildView, this, _1, _2);
130  for (int i = 0; i < FWViewType::kTypeSize; i++)
131  {
133  continue;
135  }
136 
137  // signal
138  gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_Master);
139  TEveSelection* eveSelection = gEve->GetSelection();
140  eveSelection->SetPickToSelect(TEveSelection::kPS_Master);
141  eveSelection->Connect("SelectionAdded(TEveElement*)","FWEveViewManager",this,"selectionAdded(TEveElement*)");
142  eveSelection->Connect("SelectionRepeated(TEveElement*)","FWEveViewManager",this,"selectionAdded(TEveElement*)");
143  eveSelection->Connect("SelectionRemoved(TEveElement*)","FWEveViewManager",this,"selectionRemoved(TEveElement*)");
144  eveSelection->Connect("SelectionCleared()","FWEveViewManager",this,"selectionCleared()");
145 
146  gEve->GetHighlight()->Connect("SelectionAdded(TEveElement*)","FWEveViewManager",this,"highlightAdded(TEveElement*)");
147  gEve->GetHighlight()->Connect("SelectionRepeated(TEveElement*)","FWEveViewManager",this,"highlightAdded(TEveElement*)");
148 
149  TGeoManager::SetVerboseLevel(0);
150 }
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]
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 152 of file FWEveViewManager.cc.

153 {
154 }
FWEveViewManager::FWEveViewManager ( const FWEveViewManager )
private

Member Function Documentation

void FWEveViewManager::beingDestroyed ( const FWViewBase vb)
private

Definition at line 436 of file FWEveViewManager.cc.

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

Referenced by finishViewCreate().

437 {
438  FWEveView* view = (FWEveView*) vb;
439  int typeId = view->typeId();
440 
441  int viewerBit = 1 << typeId;
442  int nviews = m_views[typeId].size();
443  for ( std::map<int, BuilderVec>::iterator i = m_builders.begin(); i!= m_builders.end(); ++i)
444  {
445  int builderBit = i->first;
446  if (viewerBit == (builderBit & viewerBit)) // check only in case if connected
447  {
448  BuilderVec& bv = i->second;
449 
450  // remove view-owned product
451  if (viewerBit == (builderBit & viewerBit))
452  {
453  for(BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt)
454  (*bIt)->removePerViewProduct(view->typeId(), view->viewContext());
455  }
456 
457  // and setup proxy builders have-a-window flag
458  if (nviews == 1)
459  {
460  if (!haveViewForBit(builderBit))
461  {
462  if (viewerBit == (builderBit & viewerBit))
463  {
464  for(BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt)
465  (*bIt)->setHaveWindow(false);
466  }
467  }
468  }
469  }
470  }
471 
472 
473  for(EveViewVec_it i= m_views[typeId].begin(); i != m_views[typeId].end(); ++i) {
474  if(i->get() == vb) {
475  m_views[typeId].erase(i);
476  break;
477  }
478  }
479 }
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:86
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 308 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().

309 {
311  for (int i = 0; i < FWViewType::kTypeSize; ++i)
312  {
313  if (viewName == FWViewType::idToName(i))
314  {
315  type = FWViewType::EType(i);
316  break;
317  }
318  }
319 
320  boost::shared_ptr<FWEveView> view;
321  switch(type)
322  {
323  case FWViewType::k3D:
324  view.reset(new FW3DView(iParent, type));
325  break;
326  case FWViewType::kISpy:
327  view.reset(new FWISpyView(iParent, type));
328  break;
329  case FWViewType::kRhoPhi:
330  case FWViewType::kRhoZ:
332  view.reset(new FWRPZView(iParent, type));
333  break;
334  case FWViewType::kLego:
336  view.reset(new FWEveLegoView(iParent, type));
337  break;
338  case FWViewType::kLegoHF:
339  view.reset(new FWHFView(iParent, type));
340  break;
342  view.reset(new FWGlimpseView(iParent, type));
343  break;
344  default:
345  break;
346  }
347 
348  m_views[type].push_back(boost::shared_ptr<FWEveView> (view));
349  return finishViewCreate(m_views[type].back());
350 }
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 630 of file FWEveViewManager.cc.

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

631 {
632  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
633  {
634  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
635  (*i)->setBackgroundColor(colorManager().background());
636  }
637 }
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 641 of file FWEveViewManager.cc.

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

642 {
643  // Prevent registration of redraw timer, full redraw is done in
644  // FWEveViewManager::eventEnd().
645  gEve->fTimerActive = kTRUE;
646  gEve->DisableRedraw();
647 
649 
650  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
651  {
652  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
653  (*i)->eventBegin();
654  }
655 }
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:30
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
void FWEveViewManager::eventEnd ( )
virtual

Reimplemented from FWViewManagerBase.

Definition at line 658 of file FWEveViewManager.cc.

References begin, i, relval_steps::key, FWViewType::kTypeSize, m_views, s_syncAllViews, edmStreamStallGrapher::t, and relativeConstraints::value.

659 {
660  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
661  {
662  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
663  (*i)->eventEnd();
664  }
665 
666  // What follows is a copy of TEveManager::DoRedraw3D() with the difference that
667  // we have full control over execution of GL view rendering. In particular:
668  // - optionally delay buffer swapping so they can all be swapped together;
669  // - we could render into FBO once and then use this to be put on screen
670  // and saved into an image file.
671 
672  {
673  TEveElement::List_t scenes;
674  Long64_t key, value;
675  TExMapIter stamped_elements(gEve->fStampedElements);
676  while (stamped_elements.Next(key, value))
677  {
678  TEveElement *el = reinterpret_cast<TEveElement*>(key);
679  if (el->GetChangeBits() & TEveElement::kCBVisibility)
680  {
681  el->CollectSceneParents(scenes);
682  }
683  }
684  gEve->ScenesChanged(scenes);
685  }
686 
687  // Process changes in scenes.
688  gEve->fScenes->ProcessSceneChanges(gEve->fDropLogicals, gEve->fStampedElements);
689 
690  // To synchronize buffer swapping set swap_on_render to false.
691  // Note that this costs 25-40% extra time with 4 views, depending on V-sync settings.
692  // Tested with NVIDIA 343.22.
693  const bool swap_on_render = !s_syncAllViews;
694 
695  // Loop over viewers, swap buffers if swap_on_render is true.
696  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
697  {
698  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
699  (*i)->fwViewerGL()->DrawHiLod(swap_on_render);
700  }
701 
702  // Swap buffers if they were not swapped before.
703  if ( ! swap_on_render)
704  {
705  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
706  {
707  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
708  (*i)->fwViewerGL()->JustSwap();
709  }
710  }
711 
712  gEve->fViewers->RepaintChangedViewers(gEve->fResetCameras, gEve->fDropLogicals);
713 
714  {
715  Long64_t key, value;
716  TExMapIter stamped_elements(gEve->fStampedElements);
717  while (stamped_elements.Next(key, value))
718  {
719  TEveElement *el = reinterpret_cast<TEveElement*>(key);
720  if (gEve->GetEditor()->GetModel() == el->GetEditorObject("FWEveViewManager::eventEnd"))
721  gEve->EditElement(el);
722  TEveGedEditor::ElementChanged(el);
723 
724  el->ClearStamps();
725  }
726  }
727  gEve->fStampedElements->Delete();
728 
729  gEve->GetListTree()->ClearViewPort(); // Fix this when several list-trees can be added.
730 
731  gEve->fResetCameras = kFALSE;
732  gEve->fDropLogicals = kFALSE;
733 
734  gEve->EnableRedraw();
735  gEve->fTimerActive = kFALSE;
736 }
int i
Definition: DBlmapReader.cc:9
static bool s_syncAllViews
std::list< Particle > List_t
Definition: Particle.h:143
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 353 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().

354 {
355  // printf("new view %s added \n", view->typeName().c_str());
356  gEve->DisableRedraw();
357 
358  // set geometry and calo data
359  view->setContext(context());
360 
362 
363  // set proxies have a window falg
364  int viewerBit = 1 << view->typeId();
365  if (m_views[view->typeId()].size() == 1)
366  {
367  for ( std::map<int, BuilderVec>::iterator i = m_builders.begin(); i!= m_builders.end(); ++i)
368  {
369  int builderViewBit = i->first;
370  BuilderVec& bv = i->second;
371  if (viewerBit == (builderViewBit & viewerBit))
372  {
373  for(BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt)
374  {
375  (*bIt)->setHaveWindow(true);
376  }
377  }
378  }
379  }
380 
381  FWRPZView* rpzView = dynamic_cast<FWRPZView*>(view.get());
382  for ( std::map<int, BuilderVec>::iterator i = m_builders.begin(); i!= m_builders.end(); ++i)
383  {
384  int builderViewBit = i->first;
385  BuilderVec& bv = i->second;
386  if (viewerBit == (builderViewBit & viewerBit))
387  {
388  for(BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt)
389  {
390  // it is ok to call create even for shared productsm since
391  // builder map key garanties that
392  TEveElementList* product = (*bIt)->createProduct(view->typeId(), view->viewContext());
393 
394  if ((*bIt)->havePerViewProduct((FWViewType::EType)view->typeId()))
395  {
396  // view owned
397  (*bIt)->build();
398  if (rpzView)
399  {
400  rpzView->importElements(product, (*bIt)->item()->layer(), rpzView->ownedProducts());
401  }
402  else
403  {
404  view->ownedProducts()->AddElement(product);
405  }
406  }
407  else
408  {
409  // shared
410  if (rpzView)
411  {
412  rpzView->importElements(product, (*bIt)->item()->layer(), rpzView->eventScene());
413  }
414  else
415  {
416  view->eventScene()->AddElement(product);
417  }
418 
419  }
420  }
421  }
422  }
423 
424  view->beingDestroyed_.connect(boost::bind(&FWEveViewManager::beingDestroyed,this,_1));
425 
426  view->setupEnergyScale(); // notify PB for energy scale
427 
428  gEve->EnableRedraw();
429  view->viewerGL()->UpdateScene();
430  gEve->Redraw3D();
431 
432  return view.get();
433 }
int i
Definition: DBlmapReader.cc:9
Color_t background() const
const fireworks::Context & context() const
TEveScene * eventScene()
Definition: FWEveView.h:82
FWColorManager * colorManager() const
Definition: Context.h:65
void importElements(TEveElement *iProjectableChild, float layer, TEveElement *iProjectedParent=0)
Definition: FWRPZView.cc:300
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:85
static Bool_t setColorSetViewer(TGLViewer *, Color_t)
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
void FWEveViewManager::globalEnergyScaleChanged ( )
private

Definition at line 614 of file FWEveViewManager.cc.

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

Referenced by setContext().

615 {
616  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
617  {
618  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
619  {
620  if ((*i)->isEnergyScaleGlobal())
621  {
622  (*i)->setupEnergyScale();
623  }
624  }
625 
626  }
627 }
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 831 of file FWEveViewManager.cc.

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

Referenced by beingDestroyed(), and newItem().

832 {
833  for (int t = 0; t < FWViewType::kTypeSize; ++t)
834  {
835  if ((bit & (1 << t)) && m_views[t].size())
836  return true;
837  }
838  // printf("have %d view for bit %d \n", haveView, bit);
839  return false;
840 }
tuple size
Write out results.
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
void FWEveViewManager::highlightAdded ( TEveElement *  iElement)

Definition at line 869 of file FWEveViewManager.cc.

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

870 {
871 
872  bool blocked = gEve->GetHighlight()->BlockSignals(true);
873 
874 
875  if (iElement == context().getCaloData())
876  {
877  TEveCaloData::vCellId_t& hlist = context().getCaloData()->GetCellsHighlighted();
878  std::set<TEveCaloData::CellId_t> hset;
879 
880  int etaBin, phiBin, w, newPhiBin, tower;
881  TH2F* hist = context().getCaloData()->GetHist(0);
882  TAxis* etaAxis = hist->GetXaxis();
883  int nBinsX = etaAxis->GetNbins() + 2;
884 
885  for (TEveCaloData::vCellId_i i = hlist.begin(); i != hlist.end(); ++i)
886  {
887  hist->GetBinXYZ((*i).fTower, etaBin, phiBin, w);
888  if (TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 4.71475)
889  {
890  newPhiBin = ((phiBin + 1) / 4) * 4 - 1;
891  if (newPhiBin <= 0) newPhiBin = 71;
892 
893  tower = etaBin + newPhiBin*nBinsX;
894  hset.insert(TEveCaloData::CellId_t( tower, (*i).fSlice, (*i).fFraction));
895  tower += nBinsX;
896  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
897  tower += nBinsX;
898 
899  if (newPhiBin == 71)
900  tower = etaBin + 1*nBinsX;
901 
902  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
903  tower += nBinsX;
904  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
905  }
906  else if (TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 1.747650)
907  {
908  newPhiBin = ((phiBin + 1)/2)*2 - 1;
909  tower = etaBin + newPhiBin*nBinsX;
910  hset.insert(TEveCaloData::CellId_t( tower, (*i).fSlice, (*i).fFraction));
911  tower += nBinsX;
912  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
913  }
914  else
915  {
916  hset.insert(*i);
917  }
918  }
919 
920  // edit calo data list
921  hlist.clear();
922  for(std::set<TEveCaloData::CellId_t>::iterator it = hset.begin(); it != hset.end(); ++it)
923  {
924  hlist.push_back(*it);
925  }
926  context().getCaloData()->CellSelectionChanged();
927 
928  }
929 
930  gEve->GetHighlight()->BlockSignals(blocked);
931 }
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 538 of file FWEveViewManager.cc.

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

Referenced by newItem().

539 {
540  if (!item)
541  return;
542 
543  bool itemHaveWindow = false;
544 
545  for (std::map<int, BuilderVec>::iterator i = m_builders.begin();
546  i != m_builders.end(); ++i)
547  {
548  for(size_t bi = 0, be = i->second.size(); bi != be; ++bi)
549  {
550  FWProxyBuilderBase *builder = i->second[bi].get();
551 
552  if (builder->item() != item)
553  continue;
554 
555  builder->itemChanged(item);
556  itemHaveWindow |= builder->getHaveWindow();
557  }
558  }
559 
560  if (!itemHaveWindow)
561  return;
562 
563  std::map<const FWEventItem*, FWInteractionList*>::iterator it = m_interactionLists.find(item);
564  if (it != m_interactionLists.end())
565  {
566  if (!it->second->empty())
567  it->second->itemChanged();
568  }
569 }
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 497 of file FWEveViewManager.cc.

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

Referenced by newItem().

498 {
499  FWModelId id = *(iIds.begin());
500  const FWEventItem* item = id.item();
501 
502  // in standard case new elements can be build in case of change of visibility
503  // and in non-standard case (e.g. calo towers) PB's modelChages handles all changes
504  bool itemHaveWindow = false;
505  for (std::map<int, BuilderVec>::iterator i = m_builders.begin();
506  i != m_builders.end(); ++i)
507  {
508  for (size_t bi = 0, be = i->second.size(); bi != be; ++bi)
509  {
510  FWProxyBuilderBase *builder = i->second[bi].get();
511  if (builder->getHaveWindow() && builder->item() == item)
512  {
513  builder->modelChanges(iIds);
514  itemHaveWindow = true;
515  }
516  }
517  }
518 
519  if (!itemHaveWindow)
520  return;
521 
523 
524  std::map<const FWEventItem*, FWInteractionList*>::iterator it = m_interactionLists.find(item);
525  if (it != m_interactionLists.end())
526  {
527  if (!it->second->empty())
528  it->second->modelChanges(iIds);
529  }
530 }
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 484 of file FWEveViewManager.cc.

485 {
486  gEve->DisableRedraw();
487 }
void FWEveViewManager::modelChangesDone ( )
protectedvirtual

Implements FWViewManagerBase.

Definition at line 490 of file FWEveViewManager.cc.

491 {
492  gEve->EnableRedraw();
493 }
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 198 of file FWEveViewManager.cc.

References addElements(), FWEventItem::changed_, FWEveViewManager::BuilderInfo::classType(), FWProxyBuilderBase::createProduct(), HLT_25ns14e33_v1_cff::distance, alignCSCRings::e, cppFunctionSkipper::exception, fwLog, reco::get(), FWEventItem::goingToBeDestroyed_, FWProxyBuilderBase::havePerViewProduct(), haveViewForBit(), i, info(), FWSimpleRepresentationChecker::inheritsFrom(), 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::modelType(), FWEventItem::purpose(), removeItem(), FWProxyBuilderBase::setHaveWindow(), FWProxyBuilderBase::setInteractionList(), FWProxyBuilderBase::setItem(), findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, edmStreamStallGrapher::t, FWEventItem::type(), FWEveView::viewContext(), and FWProxyBuilderBase::willHandleInteraction().

199 {
200  TypeToBuilder::iterator itFind = m_typeToBuilder.find(iItem->purpose());
201 
202  if (itFind == m_typeToBuilder.end())
203  return;
204 
205  std::vector<BuilderInfo>& blist = itFind->second;
206 
207  std::string bType; bool bIsSimple;
208  for (size_t bii = 0, bie = blist.size(); bii != bie; ++bii)
209  {
210  // 1.
211  BuilderInfo &info = blist[bii];
212  info.classType(bType, bIsSimple);
213  if (bIsSimple)
214  {
215  unsigned int distance=1;
216  edm::TypeWithDict modelType( *(iItem->modelType()->GetTypeInfo()));
217  if (!FWSimpleRepresentationChecker::inheritsFrom(modelType, bType,distance))
218  {
219  // printf("PB does not matche itemType (%s) !!! EDproduct %s %s\n", info.m_name.c_str(), iItem->modelType()->GetTypeInfo()->name(), bType.c_str() );
220  continue;
221  }
222  }
223  else {
224  std::string itype = iItem->type()->GetTypeInfo()->name();
225  if (itype != bType) {
226  // printf("PB does not match modeType (%s)!!! EDproduct %s %s\n", info.m_name.c_str(), itype.c_str(), bType.c_str() );
227  continue;
228  }
229  }
230 
231  std::string builderName = info.m_name;
232  int builderViewBit = info.m_viewBit;
233 
234  FWProxyBuilderBase* builder = 0;
235  try
236  {
237  builder = FWProxyBuilderFactory::get()->create(builderName);
238 
239  }
240  catch (std::exception& exc)
241  {
242  fwLog(fwlog::kWarning) << "FWEveViewManager::newItem ignoring the following exception (probably edmplugincache mismatch):"
243  << std::endl << exc.what();
244  }
245  if (!builder)
246  continue;
247 
248  // 2.
249  // printf("FWEveViewManager::makeProxyBuilderFor NEW builder %s \n", builderName.c_str());
250 
251  boost::shared_ptr<FWProxyBuilderBase> pB(builder);
252  builder->setItem(iItem);
253  iItem->changed_.connect(boost::bind(&FWEveViewManager::modelChanges,this,_1));
254  iItem->goingToBeDestroyed_.connect(boost::bind(&FWEveViewManager::removeItem,this,_1));
255  iItem->itemChanged_.connect(boost::bind(&FWEveViewManager::itemChanged,this,_1));
256 
257  // 3.
258  // This calud be opaque to the user. I would pass a reference to the m_interactionLists to
259  // FWProxyBuilderBase::setInteractionList and handle different case differently.
260  if (builder->willHandleInteraction() == false)
261  {
262  typedef std::map<const FWEventItem*, FWInteractionList*>::iterator Iterator;
263  std::pair<Iterator, bool> t = m_interactionLists.insert(std::make_pair(iItem,
264  (FWInteractionList*)0));
265 
266  if (t.second == true)
267  t.first->second = new FWInteractionList(iItem);
268  // printf(">>> builder %s add list %p \n", iItem->name().c_str(), il); fflush(stdout);
269  builder->setInteractionList(t.first->second, iItem->purpose());
270  }
271 
272  builder->setHaveWindow(haveViewForBit(builderViewBit));
273 
274  // 4.
275  for (size_t viewType = 0; viewType < FWViewType::kTypeSize; ++viewType)
276  {
277  if (((1 << viewType) & builderViewBit) == 0)
278  continue;
279 
281 
282  // printf("%s builder %s supportsd view %s \n", iItem->name().c_str(), builderName.c_str(), FWViewType::idToName(viewType).c_str());
283  if (builder->havePerViewProduct((FWViewType::EType) viewType))
284  {
285  for (size_t i = 0, e = m_views[viewType].size(); i != e; ++i)
286  {
287  FWEveView *view = m_views[viewType][i].get();
288  TEveElementList* product = builder->createProduct(type,
289  view->viewContext());
290  addElements(iItem, view, viewType, product);
291  }
292  }
293  else
294  {
295  TEveElementList* product = builder->createProduct(type, 0);
296 
297  for (size_t i = 0, e = m_views[viewType].size(); i != e; ++i)
298  addElements(iItem, m_views[viewType][i].get(), viewType, product);
299  }
300  }
301 
302  m_builders[builderViewBit].push_back(pB);
303  } // loop views
304 }
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
static bool inheritsFrom(const edm::TypeWithDict &iChild, const std::string &iParentTypeName, unsigned int &distance)
virtual void setItem(const FWEventItem *iItem)
const TClass * type() const
Definition: FWEventItem.cc:506
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:86
FWModelChangeSignal changed_
Definition: FWEventItem.h:195
const TClass * modelType() const
Definition: FWEventItem.cc:561
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 574 of file FWEveViewManager.cc.

References i, m_builders, and m_interactionLists.

Referenced by newItem().

575 {
577 
578  std::map<const FWEventItem*, FWInteractionList*>::iterator it = m_interactionLists.find(item);
579  if (it != m_interactionLists.end())
580  {
581  delete it->second;
582  m_interactionLists.erase(it);
583  }
584 
585  for (std::map<int, BuilderVec>::iterator i = m_builders.begin();
586  i != m_builders.end(); ++i)
587  {
588  BuilderVec_it bIt = i->second.begin();
589  while( bIt != i->second.end() )
590  {
591  if ((*bIt)->item() == item)
592  {
593  // TODO caching of proxy builders
594  (*bIt)->itemBeingDestroyed(item);
595  bIt = i->second.erase(bIt);
596  }
597  else
598  {
599  ++bIt;
600  }
601  }
602  }
603 }
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 760 of file FWEveViewManager.cc.

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

761 {
762  FWFromEveSelectorBase* selector = getSelector(iElement);
763  if (selector)
764  selector->doSelect();
765 }
FWFromEveSelectorBase * getSelector(TEveElement *iElement)
virtual void doSelect()=0
void FWEveViewManager::selectionCleared ( )

Definition at line 776 of file FWEveViewManager.cc.

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

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

Definition at line 768 of file FWEveViewManager.cc.

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

769 {
770  FWFromEveSelectorBase* selector = getSelector(iElement);
771  if (selector)
772  selector->doUnselect();
773 }
virtual void doUnselect()=0
FWFromEveSelectorBase * getSelector(TEveElement *iElement)
void FWEveViewManager::setContext ( const fireworks::Context x)
virtual

Reimplemented from FWViewManagerBase.

Definition at line 606 of file FWEveViewManager.cc.

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

607 {
610 
611 }
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 787 of file FWEveViewManager.cc.

References FWTypeToRepresentations::add(), FWEveViewManager::BuilderInfo::classType(), FWViewManagerBase::context(), fireworks::Context::getHidePFBuilders(), info(), FWEveViewManager::BuilderInfo::m_name, m_typeToBuilder, FWEveViewManager::BuilderInfo::m_viewBit, mergeVDriftHistosByStation::name, and AlCaHLTBitMon_QueryRunRegistry::string.

788 {
789  // needed for add collection GUI
790  FWTypeToRepresentations returnValue;
791  const static std::string kFullFrameWorkPBExtension = "FullFramework";
792  for(TypeToBuilder::const_iterator it = m_typeToBuilder.begin(), itEnd = m_typeToBuilder.end();
793  it != itEnd;
794  ++it)
795  {
796  std::vector<BuilderInfo> blist = it->second;
797  for (size_t bii = 0, bie = blist.size(); bii != bie; ++bii)
798  {
799  BuilderInfo &info = blist[bii];
800 
801  if (context().getHidePFBuilders()) {
802  const static std::string pfExt = "PF ";
803  if (std::string::npos != info.m_name.find(pfExt))
804  continue;
805  }
806 
807  unsigned int bitPackedViews = info.m_viewBit;
808  bool representsSubPart = (info.m_name.substr(info.m_name.find_first_of('@')-1, 1)=="!");
809  size_t extp = info.m_name.rfind(kFullFrameWorkPBExtension);
810  bool FFOnly = (extp != std::string::npos);
811 
813  bool isSimple;
814  info.classType(name, isSimple);
815  if(isSimple)
816  {
817  returnValue.add(boost::shared_ptr<FWRepresentationCheckerBase>(new FWSimpleRepresentationChecker(name, it->first,bitPackedViews,representsSubPart, FFOnly)) );
818  }
819  else
820  {
821  returnValue.add(boost::shared_ptr<FWRepresentationCheckerBase>(new FWEDProductRepresentationChecker(name, it->first,bitPackedViews,representsSubPart, FFOnly)) );
822  }
823  }
824  }
825  return returnValue;
826 }
static const TGPicture * info(bool iBackgroundIsBlack)
const fireworks::Context & context() const
TypeToBuilder m_typeToBuilder
void add(boost::shared_ptr< FWRepresentationCheckerBase > iChecker)
bool getHidePFBuilders() const
Definition: Context.h:91
static void FWEveViewManager::syncAllViews ( )
inlinestatic

Definition at line 80 of file FWEveViewManager.h.

References s_syncAllViews.

Referenced by CmsShowMain::CmsShowMain().

80 { s_syncAllViews = true; }
static bool s_syncAllViews

Member Data Documentation

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

Definition at line 114 of file FWEveViewManager.h.

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

TypeToBuilder FWEveViewManager::m_typeToBuilder
private

Definition at line 106 of file FWEveViewManager.h.

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

std::vector< std::vector<boost::shared_ptr<FWEveView> > > FWEveViewManager::m_views
private
bool FWEveViewManager::s_syncAllViews = false
staticprivate

Definition at line 108 of file FWEveViewManager.h.

Referenced by eventEnd(), and syncAllViews().