18 #include "TEveManager.h" 19 #include "TEveSelection.h" 20 #include "TEveScene.h" 21 #include "TEveViewer.h" 23 #include "TEveGedEditor.h" 24 #include "TGListTree.h" 25 #include "TGeoManager.h" 99 for (std::set<std::string>::iterator it =
builders.begin(), itEnd =
builders.end(); it != itEnd; ++it) {
103 first = it->find_last_of(
'@') + 1;
105 int viewTypes = atoi(view_str.c_str());
122 gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_Master);
123 TEveSelection* eveSelection = gEve->GetSelection();
124 eveSelection->SetPickToSelect(TEveSelection::kPS_Master);
125 eveSelection->Connect(
"SelectionAdded(TEveElement*)",
"FWEveViewManager",
this,
"selectionAdded(TEveElement*)");
126 eveSelection->Connect(
"SelectionRepeated(TEveElement*)",
"FWEveViewManager",
this,
"selectionAdded(TEveElement*)");
127 eveSelection->Connect(
"SelectionRemoved(TEveElement*)",
"FWEveViewManager",
this,
"selectionRemoved(TEveElement*)");
128 eveSelection->Connect(
"SelectionCleared()",
"FWEveViewManager",
this,
"selectionCleared()");
130 gEve->GetHighlight()->Connect(
131 "SelectionAdded(TEveElement*)",
"FWEveViewManager",
this,
"highlightAdded(TEveElement*)");
132 gEve->GetHighlight()->Connect(
133 "SelectionRepeated(TEveElement*)",
"FWEveViewManager",
this,
"highlightAdded(TEveElement*)");
135 TGeoManager::SetVerboseLevel(0);
181 std::vector<BuilderInfo>& blist = itFind->second;
185 for (
size_t bii = 0, bie = blist.size(); bii != bie; ++bii) {
188 info.classType(bType, bIsSimple);
198 if (itype != bType) {
205 int builderViewBit =
info.m_viewBit;
207 std::shared_ptr<FWProxyBuilderBase> builder;
213 <<
"FWEveViewManager::newItem ignoring the following exception (probably edmplugincache mismatch):" 223 builder->setItem(iItem);
231 if (builder->willHandleInteraction() ==
false) {
232 typedef std::map<const FWEventItem*, FWInteractionList*>::iterator
Iterator;
235 if (
t.second ==
true)
238 builder->setInteractionList(
t.first->second, iItem->
purpose());
245 if (((1 << viewType) & builderViewBit) == 0)
254 TEveElementList* product = builder->createProduct(
type, view->
viewContext());
258 TEveElementList* product = builder->createProduct(
type,
nullptr);
279 std::shared_ptr<FWEveView> view;
306 m_views[
type].push_back(std::shared_ptr<FWEveView>(view));
312 gEve->DisableRedraw();
320 int viewerBit = 1 << view->typeId();
321 if (
m_views[view->typeId()].size() == 1) {
323 int builderViewBit =
i->first;
325 if (viewerBit == (builderViewBit & viewerBit)) {
326 for (
BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt) {
327 (*bIt)->setHaveWindow(
true);
335 int builderViewBit =
i->first;
337 if (viewerBit == (builderViewBit & viewerBit)) {
338 for (
BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt) {
341 TEveElementList* product = (*bIt)->createProduct(view->typeId(), view->viewContext());
349 view->ownedProducts()->AddElement(product);
356 view->eventScene()->AddElement(product);
365 view->setupEnergyScale();
367 gEve->EnableRedraw();
368 view->viewerGL()->UpdateScene();
376 int typeId = view->
typeId();
378 int viewerBit = 1 << typeId;
379 int nviews =
m_views[typeId].size();
381 int builderBit =
i->first;
382 if (viewerBit == (builderBit & viewerBit))
387 if (viewerBit == (builderBit & viewerBit)) {
395 if (viewerBit == (builderBit & viewerBit)) {
397 (*bIt)->setHaveWindow(
false);
405 if (
i->get() == vb) {
425 bool itemHaveWindow =
false;
427 for (
size_t bi = 0,
be =
i->second.size(); bi !=
be; ++bi) {
431 itemHaveWindow =
true;
443 if (!it->second->empty())
444 it->second->modelChanges(iIds);
457 bool itemHaveWindow =
false;
460 for (
size_t bi = 0,
be =
i->second.size(); bi !=
be; ++bi) {
476 if (!it->second->empty())
477 it->second->itemChanged();
494 while (bIt !=
i->second.end()) {
495 if ((*bIt)->item() ==
item) {
497 (*bIt)->itemBeingDestroyed(
item);
498 bIt =
i->second.erase(bIt);
508 x->commonPrefs()->getEnergyScale()->parameterChanged_.connect(
516 if ((*i)->isEnergyScaleGlobal()) {
517 (*i)->setupEnergyScale();
526 (*i)->setupEventCenter();
542 gEve->EnforceTimerActive(kTRUE);
543 gEve->DisableRedraw();
566 TEveElement::List_t scenes;
568 TExMapIter stamped_elements(gEve->PtrToStampedElements());
569 while (stamped_elements.Next(
key,
value)) {
570 TEveElement* el =
reinterpret_cast<TEveElement*
>(
key);
571 if (el->GetChangeBits() & TEveElement::kCBVisibility) {
572 el->CollectSceneParents(scenes);
575 gEve->ScenesChanged(scenes);
579 gEve->GetScenes()->ProcessSceneChanges(kFALSE, gEve->PtrToStampedElements());
589 (*i)->fwViewerGL()->DrawHiLod(swap_on_render);
593 if (!swap_on_render) {
596 (*i)->fwViewerGL()->JustSwap();
600 gEve->GetViewers()->RepaintChangedViewers(kFALSE, kFALSE);
604 TExMapIter stamped_elements(gEve->PtrToStampedElements());
605 while (stamped_elements.Next(
key,
value)) {
606 TEveElement* el =
reinterpret_cast<TEveElement*
>(
key);
607 if (gEve->GetEditor()->GetModel() == el->GetEditorObject(
"FWEveViewManager::eventEnd"))
608 gEve->EditElement(el);
609 TEveGedEditor::ElementChanged(el);
614 gEve->PtrToStampedElements()->Delete();
616 gEve->GetListTree()->ClearViewPort();
618 gEve->EnableRedraw();
619 gEve->EnforceTimerActive(kFALSE);
631 void*
userData = iElement->GetUserData();
663 const static std::string kFullFrameWorkPBExtension =
"FullFramework";
665 std::vector<BuilderInfo> blist = it->second;
666 for (
size_t bii = 0, bie = blist.size(); bii != bie; ++bii) {
671 if (std::string::npos !=
info.m_name.find(pfExt))
675 unsigned int bitPackedViews =
info.m_viewBit;
676 bool representsSubPart = (
info.m_name.substr(
info.m_name.find_first_of(
'@') - 1, 1) ==
"!");
677 size_t extp =
info.m_name.rfind(kFullFrameWorkPBExtension);
678 bool FFOnly = (extp != std::string::npos);
684 returnValue.
add(std::make_shared<FWSimpleRepresentationChecker>(
685 name, it->first, bitPackedViews, representsSubPart, FFOnly));
687 returnValue.
add(std::make_shared<FWEDProductRepresentationChecker>(
688 name, it->first, bitPackedViews, representsSubPart, FFOnly));
707 simple = (
m_name.substr(0, kSimple.size()) == kSimple);
723 #include "TEveCaloData.h" 726 bool blocked = gEve->GetHighlight()->BlockSignals(
true);
728 if (iElement ==
context().getCaloData()) {
730 std::set<TEveCaloData::CellId_t> hset;
734 TAxis* etaAxis =
hist->GetXaxis();
735 int nBinsX = etaAxis->GetNbins() + 2;
737 for (TEveCaloData::vCellId_i
i = hlist.begin();
i != hlist.end(); ++
i) {
739 if (TMath::Abs(etaAxis->GetBinCenter(
etaBin)) > 4.71475) {
740 newPhiBin = ((
phiBin + 1) / 4) * 4 - 1;
745 hset.insert(TEveCaloData::CellId_t(
tower, (*i).fSlice, (*i).fFraction));
747 hset.insert(TEveCaloData::CellId_t(
tower, (*i).fSlice, (*i).fFraction));
753 hset.insert(TEveCaloData::CellId_t(
tower, (*i).fSlice, (*i).fFraction));
755 hset.insert(TEveCaloData::CellId_t(
tower, (*i).fSlice, (*i).fFraction));
756 }
else if (TMath::Abs(etaAxis->GetBinCenter(
etaBin)) > 1.747650) {
757 newPhiBin = ((
phiBin + 1) / 2) * 2 - 1;
759 hset.insert(TEveCaloData::CellId_t(
tower, (*i).fSlice, (*i).fFraction));
761 hset.insert(TEveCaloData::CellId_t(
tower, (*i).fSlice, (*i).fFraction));
769 for (std::set<TEveCaloData::CellId_t>::iterator it = hset.begin(); it != hset.end(); ++it) {
770 hlist.push_back(*it);
775 gEve->GetHighlight()->BlockSignals(blocked);
const CategoryToInfos & categoryToInfos() const
FWSelectionManager * selectionManager() const
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views
void resetMaxEtAndEnergy() const
virtual void doUnselect()=0
std::vector< std::shared_ptr< FWEveView > >::iterator EveViewVec_it
void eventBegin() override
FWColorManager & colorManager() const
void globalEnergyScaleChanged()
void selectionAdded(TEveElement *)
void itemChanged(const FWEventItem *)
bool haveViewForBit(int) const
FWItemChangeSignal goingToBeDestroyed_
void newItem(const FWEventItem *) override
TypeToBuilder m_typeToBuilder
Color_t background() const
TEveCaloDataHist * getCaloData() const
static bool s_syncAllViews
void add(std::shared_ptr< FWRepresentationCheckerBase > iChecker)
FWEveViewManager(FWGUIManager *)
void registerViewBuilder(const std::string &iName, ViewBuildFunctor &iBuilder)
bool getHidePFBuilders() const
FWFromEveSelectorBase * getSelector(TEveElement *iElement)
static bool isProjected(int)
const TClass * modelType() const
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
bool getHaveWindow() const
FWItemChangeSignal itemChanged_
void addElements(const FWEventItem *item, FWEveView *view, int viewType, TEveElementList *product)
void selectionRemoved(TEveElement *)
void highlightAdded(TEveElement *)
void modelChanges(const FWModelIds &iIds)
void beingDestroyed(const FWViewBase *)
std::map< int, BuilderVec > m_builders
std::function< FWViewBase *(TEveWindowSlot *, const std::string &)> ViewBuildFunctor
FWViewBase * buildView(TEveWindowSlot *iParent, const std::string &type)
void setContext(const fireworks::Context *) override
virtual void doSelect()=0
void classType(std::string &, bool &) const
FWViewContext * viewContext()
const TClass * type() const
void colorsChanged() override
std::map< const FWEventItem *, FWInteractionList * > m_interactionLists
void importElements(TEveElement *iProjectableChild, float layer, TEveElement *iProjectedParent=nullptr)
BuilderVec::iterator BuilderVec_it
FWModelChangeSignal changed_
std::vector< std::shared_ptr< FWProxyBuilderBase > > BuilderVec
static const std::string & idToName(int)
TEveElement * ownedProducts()
static Bool_t setColorSetViewer(TGLViewer *, Color_t)
virtual void removeItem(const FWEventItem *)
const std::string & purpose() const
FWTypeToRepresentations supportedTypesAndRepresentations() const override
FWViewType::EType typeId() const
void modelChangesDone() override
static PluginManager * get()
const FWEventItem * item() const
void modelChangesComing() override
virtual void setContext(const fireworks::Context &x)
void itemChanged(const FWEventItem *)
FWColorManager * colorManager() const
const fireworks::Context & context() const
void modelChanges(const FWModelIds &)
void eventCenterChanged()