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

References HLT_25ns10e33_v2_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_, vertexPlots::purpose, FWGUIManager::registerViewBuilder(), AlCaHLTBitMon_QueryRunRegistry::string, and create_public_lumi_plots::transform.

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

146 {
147 }
FWEveViewManager::FWEveViewManager ( const FWEveViewManager )
private

Member Function Documentation

void FWEveViewManager::beingDestroyed ( const FWViewBase vb)
private

Definition at line 429 of file FWEveViewManager.cc.

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

Referenced by finishViewCreate().

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

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

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

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

624 {
625  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
626  {
627  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
628  (*i)->setBackgroundColor(colorManager().background());
629  }
630 }
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 634 of file FWEveViewManager.cc.

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

635 {
636  // Prevent registration of redraw timer, full redraw is done in
637  // FWEveViewManager::eventEnd().
638  gEve->EnforceTimerActive(kTRUE);
639  gEve->DisableRedraw();
640 
642 
643  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
644  {
645  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
646  (*i)->eventBegin();
647  }
648 }
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:190
#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 651 of file FWEveViewManager.cc.

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

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

347 {
348  // printf("new view %s added \n", view->typeName().c_str());
349  gEve->DisableRedraw();
350 
351  // set geometry and calo data
352  view->setContext(context());
353 
355 
356  // set proxies have a window falg
357  int viewerBit = 1 << view->typeId();
358  if (m_views[view->typeId()].size() == 1)
359  {
360  for ( std::map<int, BuilderVec>::iterator i = m_builders.begin(); i!= m_builders.end(); ++i)
361  {
362  int builderViewBit = i->first;
363  BuilderVec& bv = i->second;
364  if (viewerBit == (builderViewBit & viewerBit))
365  {
366  for(BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt)
367  {
368  (*bIt)->setHaveWindow(true);
369  }
370  }
371  }
372  }
373 
374  FWRPZView* rpzView = dynamic_cast<FWRPZView*>(view.get());
375  for ( std::map<int, BuilderVec>::iterator i = m_builders.begin(); i!= m_builders.end(); ++i)
376  {
377  int builderViewBit = i->first;
378  BuilderVec& bv = i->second;
379  if (viewerBit == (builderViewBit & viewerBit))
380  {
381  for(BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt)
382  {
383  // it is ok to call create even for shared productsm since
384  // builder map key garanties that
385  TEveElementList* product = (*bIt)->createProduct(view->typeId(), view->viewContext());
386 
387  if ((*bIt)->havePerViewProduct((FWViewType::EType)view->typeId()))
388  {
389  // view owned
390  (*bIt)->build();
391  if (rpzView)
392  {
393  rpzView->importElements(product, (*bIt)->item()->layer(), rpzView->ownedProducts());
394  }
395  else
396  {
397  view->ownedProducts()->AddElement(product);
398  }
399  }
400  else
401  {
402  // shared
403  if (rpzView)
404  {
405  rpzView->importElements(product, (*bIt)->item()->layer(), rpzView->eventScene());
406  }
407  else
408  {
409  view->eventScene()->AddElement(product);
410  }
411 
412  }
413  }
414  }
415  }
416 
417  view->beingDestroyed_.connect(boost::bind(&FWEveViewManager::beingDestroyed,this,_1));
418 
419  view->setupEnergyScale(); // notify PB for energy scale
420 
421  gEve->EnableRedraw();
422  view->viewerGL()->UpdateScene();
423  gEve->Redraw3D();
424 
425  return view.get();
426 }
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:298
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 607 of file FWEveViewManager.cc.

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

Referenced by setContext().

608 {
609  for (int t = 0 ; t < FWViewType::kTypeSize; ++t)
610  {
611  for(EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
612  {
613  if ((*i)->isEnergyScaleGlobal())
614  {
615  (*i)->setupEnergyScale();
616  }
617  }
618 
619  }
620 }
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 821 of file FWEveViewManager.cc.

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

Referenced by beingDestroyed(), and newItem().

822 {
823  for (int t = 0; t < FWViewType::kTypeSize; ++t)
824  {
825  if ((bit & (1 << t)) && m_views[t].size())
826  return true;
827  }
828  // printf("have %d view for bit %d \n", haveView, bit);
829  return false;
830 }
tuple size
Write out results.
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
void FWEveViewManager::highlightAdded ( TEveElement *  iElement)

Definition at line 859 of file FWEveViewManager.cc.

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

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

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

Referenced by newItem().

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

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

Referenced by newItem().

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

478 {
479  gEve->DisableRedraw();
480 }
void FWEveViewManager::modelChangesDone ( )
protectedvirtual

Implements FWViewManagerBase.

Definition at line 483 of file FWEveViewManager.cc.

484 {
485  gEve->EnableRedraw();
486 }
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 191 of file FWEveViewManager.cc.

References addElements(), FWEventItem::changed_, FWEveViewManager::BuilderInfo::classType(), FWProxyBuilderBase::createProduct(), HLT_25ns10e33_v2_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, lumiQTWidget::t, FWEventItem::type(), FWEveView::viewContext(), and FWProxyBuilderBase::willHandleInteraction().

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

References i, m_builders, and m_interactionLists.

Referenced by newItem().

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

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

751 {
752  FWFromEveSelectorBase* selector = getSelector(iElement);
753  if (selector)
754  selector->doSelect();
755 }
FWFromEveSelectorBase * getSelector(TEveElement *iElement)
virtual void doSelect()=0
void FWEveViewManager::selectionCleared ( )

Definition at line 766 of file FWEveViewManager.cc.

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

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

Definition at line 758 of file FWEveViewManager.cc.

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

759 {
760  FWFromEveSelectorBase* selector = getSelector(iElement);
761  if (selector)
762  selector->doUnselect();
763 }
virtual void doUnselect()=0
FWFromEveSelectorBase * getSelector(TEveElement *iElement)
void FWEveViewManager::setContext ( const fireworks::Context x)
virtual

Reimplemented from FWViewManagerBase.

Definition at line 599 of file FWEveViewManager.cc.

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

600 {
603 
604 }
virtual void setContext(const fireworks::Context *x)
FWViewEnergyScale * getEnergyScale() const
Definition: CmsShowCommon.h:70
CmsShowCommon * commonPrefs() const
Definition: Context.cc:177
sigc::signal< void > parameterChanged_
FWTypeToRepresentations FWEveViewManager::supportedTypesAndRepresentations ( ) const
virtual

Implements FWViewManagerBase.

Definition at line 777 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.

778 {
779  // needed for add collection GUI
780  FWTypeToRepresentations returnValue;
781  const static std::string kFullFrameWorkPBExtension = "FullFramework";
782  for(TypeToBuilder::const_iterator it = m_typeToBuilder.begin(), itEnd = m_typeToBuilder.end();
783  it != itEnd;
784  ++it)
785  {
786  std::vector<BuilderInfo> blist = it->second;
787  for (size_t bii = 0, bie = blist.size(); bii != bie; ++bii)
788  {
789  BuilderInfo &info = blist[bii];
790 
791  if (context().getHidePFBuilders()) {
792  const static std::string pfExt = "PF ";
793  if (std::string::npos != info.m_name.find(pfExt))
794  continue;
795  }
796 
797  unsigned int bitPackedViews = info.m_viewBit;
798  bool representsSubPart = (info.m_name.substr(info.m_name.find_first_of('@')-1, 1)=="!");
799  size_t extp = info.m_name.rfind(kFullFrameWorkPBExtension);
800  bool FFOnly = (extp != std::string::npos);
801 
803  bool isSimple;
804  info.classType(name, isSimple);
805  if(isSimple)
806  {
807  returnValue.add(boost::shared_ptr<FWRepresentationCheckerBase>(new FWSimpleRepresentationChecker(name, it->first,bitPackedViews,representsSubPart, FFOnly)) );
808  }
809  else
810  {
811  returnValue.add(boost::shared_ptr<FWRepresentationCheckerBase>(new FWEDProductRepresentationChecker(name, it->first,bitPackedViews,representsSubPart, FFOnly)) );
812  }
813  }
814  }
815  return returnValue;
816 }
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().