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) {
236 fwLog(
fwlog::kWarning) <<
"FWEveViewManager::newItem ignoring the following exception (probably edmplugincache mismatch):" 237 << std::endl << exc.what();
245 std::shared_ptr<FWProxyBuilderBase> pB(builder);
256 typedef std::map<const FWEventItem*, FWInteractionList*>::iterator
Iterator;
260 if (t.second ==
true)
271 if (((1 << viewType) & builderViewBit) == 0)
289 TEveElementList* product = builder->
createProduct(type,
nullptr);
314 std::shared_ptr<FWEveView> view;
318 view.reset(
new FW3DView(iParent, type));
326 view.reset(
new FWRPZView(iParent, type));
333 view.reset(
new FWHFView(iParent, type));
342 m_views[
type].push_back(std::shared_ptr<FWEveView> (view));
350 gEve->DisableRedraw();
358 int viewerBit = 1 << view->typeId();
359 if (
m_views[view->typeId()].size() == 1)
363 int builderViewBit =
i->first;
365 if (viewerBit == (builderViewBit & viewerBit))
369 (*bIt)->setHaveWindow(
true);
378 int builderViewBit =
i->first;
380 if (viewerBit == (builderViewBit & viewerBit))
386 TEveElementList* product = (*bIt)->createProduct(view->typeId(), view->viewContext());
398 view->ownedProducts()->AddElement(product);
410 view->eventScene()->AddElement(product);
420 view->setupEnergyScale();
422 gEve->EnableRedraw();
423 view->viewerGL()->UpdateScene();
433 int typeId = view->
typeId();
435 int viewerBit = 1 << typeId;
436 int nviews =
m_views[typeId].size();
439 int builderBit =
i->first;
440 if (viewerBit == (builderBit & viewerBit))
445 if (viewerBit == (builderBit & viewerBit))
456 if (viewerBit == (builderBit & viewerBit))
459 (*bIt)->setHaveWindow(
false);
480 gEve->DisableRedraw();
486 gEve->EnableRedraw();
498 bool itemHaveWindow =
false;
499 for (std::map<int, BuilderVec>::iterator
i =
m_builders.begin();
502 for (
size_t bi = 0, be =
i->second.size(); bi != be; ++bi)
508 itemHaveWindow =
true;
518 std::map<const FWEventItem*, FWInteractionList*>::iterator it =
m_interactionLists.find(item);
521 if (!it->second->empty())
522 it->second->modelChanges(iIds);
537 bool itemHaveWindow =
false;
539 for (std::map<int, BuilderVec>::iterator
i =
m_builders.begin();
542 for(
size_t bi = 0, be =
i->second.size(); bi != be; ++bi)
546 if (builder->
item() != item)
557 std::map<const FWEventItem*, FWInteractionList*>::iterator it =
m_interactionLists.find(item);
560 if (!it->second->empty())
561 it->second->itemChanged();
572 std::map<const FWEventItem*, FWInteractionList*>::iterator it =
m_interactionLists.find(item);
579 for (std::map<int, BuilderVec>::iterator
i =
m_builders.begin();
583 while( bIt !=
i->second.end() )
585 if ((*bIt)->item() == item)
588 (*bIt)->itemBeingDestroyed(item);
589 bIt =
i->second.erase(bIt);
614 if ((*i)->isEnergyScaleGlobal())
616 (*i)->setupEnergyScale();
630 (*i)->setupEventCenter();
652 gEve->EnforceTimerActive(kTRUE);
653 gEve->DisableRedraw();
682 TExMapIter stamped_elements(gEve->PtrToStampedElements());
683 while (stamped_elements.Next(key, value))
685 TEveElement *el =
reinterpret_cast<TEveElement*
>(
key);
686 if (el->GetChangeBits() & TEveElement::kCBVisibility)
688 el->CollectSceneParents(scenes);
691 gEve->ScenesChanged(scenes);
695 gEve->GetScenes()->ProcessSceneChanges(kFALSE, gEve->PtrToStampedElements());
706 (*i)->fwViewerGL()->DrawHiLod(swap_on_render);
710 if ( ! swap_on_render)
715 (*i)->fwViewerGL()->JustSwap();
719 gEve->GetViewers()->RepaintChangedViewers(kFALSE, kFALSE);
723 TExMapIter stamped_elements(gEve->PtrToStampedElements());
724 while (stamped_elements.Next(key, value))
726 TEveElement *el =
reinterpret_cast<TEveElement*
>(
key);
727 if (gEve->GetEditor()->GetModel() == el->GetEditorObject(
"FWEveViewManager::eventEnd"))
728 gEve->EditElement(el);
729 TEveGedEditor::ElementChanged(el);
734 gEve->PtrToStampedElements()->Delete();
736 gEve->GetListTree()->ClearViewPort();
738 gEve->EnableRedraw();
739 gEve->EnforceTimerActive(kFALSE);
752 void*
userData = iElement->GetUserData();
795 const static std::string kFullFrameWorkPBExtension =
"FullFramework";
800 std::vector<BuilderInfo> blist = it->second;
801 for (
size_t bii = 0, bie = blist.size(); bii != bie; ++bii)
807 if (std::string::npos != info.
m_name.find(pfExt))
811 unsigned int bitPackedViews = info.
m_viewBit;
812 bool representsSubPart = (info.
m_name.substr(info.
m_name.find_first_of(
'@')-1, 1)==
"!");
813 size_t extp = info.
m_name.rfind(kFullFrameWorkPBExtension);
814 bool FFOnly = (extp != std::string::npos);
821 returnValue.
add(std::make_shared<FWSimpleRepresentationChecker>(name, it->first,bitPackedViews,representsSubPart, FFOnly) );
825 returnValue.
add(std::make_shared<FWEDProductRepresentationChecker>(name, it->first,bitPackedViews,representsSubPart, FFOnly) );
851 simple = (m_name.substr(0,kSimple.size()) == kSimple);
854 typeName = m_name.substr(kSimple.size(), m_name.find_first_of(
'@')-kSimple.size()-1);
858 typeName = m_name.substr(0, m_name.find_first_of(
'@')-1);
870 #include "TEveCaloData.h" 876 bool blocked = gEve->GetHighlight()->BlockSignals(
true);
879 if (iElement ==
context().getCaloData())
882 std::set<TEveCaloData::CellId_t> hset;
886 TAxis* etaAxis = hist->GetXaxis();
887 int nBinsX = etaAxis->GetNbins() + 2;
889 for (TEveCaloData::vCellId_i
i = hlist.begin();
i != hlist.end(); ++
i)
891 hist->GetBinXYZ((*i).fTower, etaBin, phiBin, w);
892 if (
TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 4.71475)
894 newPhiBin = ((phiBin + 1) / 4) * 4 - 1;
895 if (newPhiBin <= 0) newPhiBin = 71;
897 tower = etaBin + newPhiBin*nBinsX;
898 hset.insert(TEveCaloData::CellId_t( tower, (*i).fSlice, (*i).fFraction));
900 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
904 tower = etaBin + 1*nBinsX;
906 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
908 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
910 else if (
TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 1.747650)
912 newPhiBin = ((phiBin + 1)/2)*2 - 1;
913 tower = etaBin + newPhiBin*nBinsX;
914 hset.insert(TEveCaloData::CellId_t( tower, (*i).fSlice, (*i).fFraction));
916 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
926 for(std::set<TEveCaloData::CellId_t>::iterator it = hset.begin(); it != hset.end(); ++it)
928 hlist.push_back(*it);
934 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
virtual bool willHandleInteraction() const
void eventBegin() override
virtual bool havePerViewProduct(FWViewType::EType) const
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
virtual void setItem(const FWEventItem *iItem)
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
void setHaveWindow(bool iFlag)
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
TEveElementList * createProduct(FWViewType::EType, const FWViewContext *)
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 &)
virtual void setInteractionList(FWInteractionList *, const std::string &)
void eventCenterChanged()
FWViewType::EType typeId() const