15 #include <boost/bind.hpp> 19 #include "TEveManager.h" 20 #include "TEveSelection.h" 21 #include "TEveScene.h" 22 #include "TEveViewer.h" 24 #include "TEveGedEditor.h" 25 #include "TGListTree.h" 26 #include "TGeoManager.h" 68 m_blocked = gEve->GetSelection()->BlockSignals(
true);
72 gEve->GetSelection()->BlockSignals(
m_blocked);
95 std::inserter(builders,builders.begin()),
102 std::inserter(builders,builders.begin()),
107 for(std::set<std::string>::iterator it = builders.begin(), itEnd=builders.end();
113 first = it->find_last_of(
'@')+1;
115 int viewTypes = atoi(view_str.c_str());
132 gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_Master);
133 TEveSelection* eveSelection = gEve->GetSelection();
134 eveSelection->SetPickToSelect(TEveSelection::kPS_Master);
135 eveSelection->Connect(
"SelectionAdded(TEveElement*)",
"FWEveViewManager",
this,
"selectionAdded(TEveElement*)");
136 eveSelection->Connect(
"SelectionRepeated(TEveElement*)",
"FWEveViewManager",
this,
"selectionAdded(TEveElement*)");
137 eveSelection->Connect(
"SelectionRemoved(TEveElement*)",
"FWEveViewManager",
this,
"selectionRemoved(TEveElement*)");
138 eveSelection->Connect(
"SelectionCleared()",
"FWEveViewManager",
this,
"selectionCleared()");
140 gEve->GetHighlight()->Connect(
"SelectionAdded(TEveElement*)",
"FWEveViewManager",
this,
"highlightAdded(TEveElement*)");
141 gEve->GetHighlight()->Connect(
"SelectionRepeated(TEveElement*)",
"FWEveViewManager",
this,
"highlightAdded(TEveElement*)");
143 TGeoManager::SetVerboseLevel(0);
163 int viewType, TEveElementList* product)
199 std::vector<BuilderInfo>& blist = itFind->second;
202 for (
size_t bii = 0, bie = blist.size(); bii != bie; ++bii)
219 if (itype != bType) {
228 std::shared_ptr<FWProxyBuilderBase> builder;
236 fwLog(
fwlog::kWarning) <<
"FWEveViewManager::newItem ignoring the following exception (probably edmplugincache mismatch):" 237 << std::endl << exc.what();
245 builder->setItem(iItem);
253 if (builder->willHandleInteraction() ==
false)
255 typedef std::map<const FWEventItem*, FWInteractionList*>::iterator
Iterator;
259 if (t.second ==
true)
262 builder->setInteractionList(t.first->second, iItem->
purpose());
270 if (((1 << viewType) & builderViewBit) == 0)
281 TEveElementList* product = builder->createProduct(type,
288 TEveElementList* product = builder->createProduct(type,
nullptr);
313 std::shared_ptr<FWEveView> view;
317 view.reset(
new FW3DView(iParent, type));
325 view.reset(
new FWRPZView(iParent, type));
332 view.reset(
new FWHFView(iParent, type));
341 m_views[
type].push_back(std::shared_ptr<FWEveView> (view));
349 gEve->DisableRedraw();
357 int viewerBit = 1 << view->typeId();
358 if (
m_views[view->typeId()].size() == 1)
362 int builderViewBit =
i->first;
364 if (viewerBit == (builderViewBit & viewerBit))
368 (*bIt)->setHaveWindow(
true);
377 int builderViewBit =
i->first;
379 if (viewerBit == (builderViewBit & viewerBit))
385 TEveElementList* product = (*bIt)->createProduct(view->typeId(), view->viewContext());
397 view->ownedProducts()->AddElement(product);
409 view->eventScene()->AddElement(product);
419 view->setupEnergyScale();
421 gEve->EnableRedraw();
422 view->viewerGL()->UpdateScene();
432 int typeId = view->
typeId();
434 int viewerBit = 1 << typeId;
435 int nviews =
m_views[typeId].size();
438 int builderBit =
i->first;
439 if (viewerBit == (builderBit & viewerBit))
444 if (viewerBit == (builderBit & viewerBit))
455 if (viewerBit == (builderBit & viewerBit))
458 (*bIt)->setHaveWindow(
false);
479 gEve->DisableRedraw();
485 gEve->EnableRedraw();
497 bool itemHaveWindow =
false;
498 for (std::map<int, BuilderVec>::iterator
i =
m_builders.begin();
501 for (
size_t bi = 0, be =
i->second.size(); bi != be; ++bi)
507 itemHaveWindow =
true;
517 std::map<const FWEventItem*, FWInteractionList*>::iterator it =
m_interactionLists.find(item);
520 if (!it->second->empty())
521 it->second->modelChanges(iIds);
536 bool itemHaveWindow =
false;
538 for (std::map<int, BuilderVec>::iterator
i =
m_builders.begin();
541 for(
size_t bi = 0, be =
i->second.size(); bi != be; ++bi)
545 if (builder->
item() != item)
556 std::map<const FWEventItem*, FWInteractionList*>::iterator it =
m_interactionLists.find(item);
559 if (!it->second->empty())
560 it->second->itemChanged();
571 std::map<const FWEventItem*, FWInteractionList*>::iterator it =
m_interactionLists.find(item);
578 for (std::map<int, BuilderVec>::iterator
i =
m_builders.begin();
582 while( bIt !=
i->second.end() )
584 if ((*bIt)->item() == item)
587 (*bIt)->itemBeingDestroyed(item);
588 bIt =
i->second.erase(bIt);
613 if ((*i)->isEnergyScaleGlobal())
615 (*i)->setupEnergyScale();
629 (*i)->setupEventCenter();
651 gEve->EnforceTimerActive(kTRUE);
652 gEve->DisableRedraw();
681 TExMapIter stamped_elements(gEve->PtrToStampedElements());
682 while (stamped_elements.Next(key, value))
684 TEveElement *el =
reinterpret_cast<TEveElement*
>(
key);
685 if (el->GetChangeBits() & TEveElement::kCBVisibility)
687 el->CollectSceneParents(scenes);
690 gEve->ScenesChanged(scenes);
694 gEve->GetScenes()->ProcessSceneChanges(kFALSE, gEve->PtrToStampedElements());
705 (*i)->fwViewerGL()->DrawHiLod(swap_on_render);
709 if ( ! swap_on_render)
714 (*i)->fwViewerGL()->JustSwap();
718 gEve->GetViewers()->RepaintChangedViewers(kFALSE, kFALSE);
722 TExMapIter stamped_elements(gEve->PtrToStampedElements());
723 while (stamped_elements.Next(key, value))
725 TEveElement *el =
reinterpret_cast<TEveElement*
>(
key);
726 if (gEve->GetEditor()->GetModel() == el->GetEditorObject(
"FWEveViewManager::eventEnd"))
727 gEve->EditElement(el);
728 TEveGedEditor::ElementChanged(el);
733 gEve->PtrToStampedElements()->Delete();
735 gEve->GetListTree()->ClearViewPort();
737 gEve->EnableRedraw();
738 gEve->EnforceTimerActive(kFALSE);
751 void*
userData = iElement->GetUserData();
794 const static std::string kFullFrameWorkPBExtension =
"FullFramework";
799 std::vector<BuilderInfo> blist = it->second;
800 for (
size_t bii = 0, bie = blist.size(); bii != bie; ++bii)
806 if (std::string::npos != info.
m_name.find(pfExt))
810 unsigned int bitPackedViews = info.
m_viewBit;
811 bool representsSubPart = (info.
m_name.substr(info.
m_name.find_first_of(
'@')-1, 1)==
"!");
812 size_t extp = info.
m_name.rfind(kFullFrameWorkPBExtension);
813 bool FFOnly = (extp != std::string::npos);
820 returnValue.
add(std::make_shared<FWSimpleRepresentationChecker>(name, it->first,bitPackedViews,representsSubPart, FFOnly) );
824 returnValue.
add(std::make_shared<FWEDProductRepresentationChecker>(name, it->first,bitPackedViews,representsSubPart, FFOnly) );
850 simple = (m_name.substr(0,kSimple.size()) == kSimple);
853 typeName = m_name.substr(kSimple.size(), m_name.find_first_of(
'@')-kSimple.size()-1);
857 typeName = m_name.substr(0, m_name.find_first_of(
'@')-1);
869 #include "TEveCaloData.h" 875 bool blocked = gEve->GetHighlight()->BlockSignals(
true);
878 if (iElement ==
context().getCaloData())
881 std::set<TEveCaloData::CellId_t> hset;
885 TAxis* etaAxis = hist->GetXaxis();
886 int nBinsX = etaAxis->GetNbins() + 2;
888 for (TEveCaloData::vCellId_i
i = hlist.begin();
i != hlist.end(); ++
i)
890 hist->GetBinXYZ((*i).fTower, etaBin, phiBin, w);
891 if (
TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 4.71475)
893 newPhiBin = ((phiBin + 1) / 4) * 4 - 1;
894 if (newPhiBin <= 0) newPhiBin = 71;
896 tower = etaBin + newPhiBin*nBinsX;
897 hset.insert(TEveCaloData::CellId_t( tower, (*i).fSlice, (*i).fFraction));
899 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
903 tower = etaBin + 1*nBinsX;
905 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
907 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
909 else if (
TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 1.747650)
911 newPhiBin = ((phiBin + 1)/2)*2 - 1;
912 tower = etaBin + newPhiBin*nBinsX;
913 hset.insert(TEveCaloData::CellId_t( tower, (*i).fSlice, (*i).fFraction));
915 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
925 for(std::set<TEveCaloData::CellId_t>::iterator it = hset.begin(); it != hset.end(); ++it)
927 hlist.push_back(*it);
933 gEve->GetHighlight()->BlockSignals(blocked);
const CategoryToInfos & categoryToInfos() const
Color_t background() const
const fireworks::Context & context() const
sigc::signal< void, const CmsShowCommon * > eventCenterChanged_
virtual void doUnselect()=0
void eventBegin() override
FWColorManager * colorManager() const
void globalEnergyScaleChanged()
void selectionAdded(TEveElement *)
void itemChanged(const FWEventItem *)
FWItemChangeSignal goingToBeDestroyed_
void newItem(const FWEventItem *) override
TypeToBuilder m_typeToBuilder
FWColorManager & colorManager() const
boost::function2< FWViewBase *, TEveWindowSlot *, const std::string & > ViewBuildFunctor
static bool s_syncAllViews
void add(std::shared_ptr< FWRepresentationCheckerBase > iChecker)
const FWEventItem * item() const
std::list< Particle > List_t
FWEveViewManager(FWGUIManager *)
void registerViewBuilder(const std::string &iName, ViewBuildFunctor &iBuilder)
FWFromEveSelectorBase * getSelector(TEveElement *iElement)
static bool isProjected(int)
static bool inheritsFrom(const edm::TypeWithDict &iChild, const std::string &iParentTypeName, unsigned int &distance)
FWEveView * finishViewCreate(std::shared_ptr< FWEveView >)
~FWEveViewManager() override
virtual void setContext(const fireworks::Context *x)
std::set< FWModelId > FWModelIds
void resetMaxEtAndEnergy() const
const TClass * type() const
FWItemChangeSignal itemChanged_
bool haveViewForBit(int) const
void addElements(const FWEventItem *item, FWEveView *view, int viewType, TEveElementList *product)
bool getHidePFBuilders() const
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views
void selectionRemoved(TEveElement *)
void highlightAdded(TEveElement *)
TEveCaloDataHist * getCaloData() const
void modelChanges(const FWModelIds &iIds)
void beingDestroyed(const FWViewBase *)
std::map< int, BuilderVec > m_builders
FWSelectionManager * selectionManager() const
std::vector< std::shared_ptr< FWEveView > >::iterator EveViewVec_it
FWTypeToRepresentations supportedTypesAndRepresentations() const override
FWViewBase * buildView(TEveWindowSlot *iParent, const std::string &type)
void setContext(const fireworks::Context *) override
virtual void doSelect()=0
std::map< const FWEventItem *, FWInteractionList * > m_interactionLists
FWViewContext * viewContext()
void colorsChanged() override
FWViewEnergyScale * getEnergyScale() const
void importElements(TEveElement *iProjectableChild, float layer, TEveElement *iProjectedParent=nullptr)
CmsShowCommon * commonPrefs() const
BuilderVec::iterator BuilderVec_it
FWModelChangeSignal changed_
sigc::signal< void > parameterChanged_
std::vector< std::shared_ptr< FWProxyBuilderBase > > BuilderVec
static const std::string & idToName(int)
const TClass * modelType() const
TEveElement * ownedProducts()
static Bool_t setColorSetViewer(TGLViewer *, Color_t)
virtual void removeItem(const FWEventItem *)
bool getHaveWindow() const
const std::string & purpose() const
void modelChangesDone() override
static PluginManager * get()
void classType(std::string &, bool &) const
void modelChangesComing() override
virtual void setContext(const fireworks::Context &x)
T get(const Candidate &c)
void itemChanged(const FWEventItem *)
void modelChanges(const FWModelIds &)
void eventCenterChanged()
FWViewType::EType typeId() const