15 #include <boost/bind.hpp>
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());
121 gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_Master);
122 TEveSelection* eveSelection = gEve->GetSelection();
123 eveSelection->SetPickToSelect(TEveSelection::kPS_Master);
124 eveSelection->Connect(
"SelectionAdded(TEveElement*)",
"FWEveViewManager",
this,
"selectionAdded(TEveElement*)");
125 eveSelection->Connect(
"SelectionRepeated(TEveElement*)",
"FWEveViewManager",
this,
"selectionAdded(TEveElement*)");
126 eveSelection->Connect(
"SelectionRemoved(TEveElement*)",
"FWEveViewManager",
this,
"selectionRemoved(TEveElement*)");
127 eveSelection->Connect(
"SelectionCleared()",
"FWEveViewManager",
this,
"selectionCleared()");
129 gEve->GetHighlight()->Connect(
130 "SelectionAdded(TEveElement*)",
"FWEveViewManager",
this,
"highlightAdded(TEveElement*)");
131 gEve->GetHighlight()->Connect(
132 "SelectionRepeated(TEveElement*)",
"FWEveViewManager",
this,
"highlightAdded(TEveElement*)");
134 TGeoManager::SetVerboseLevel(0);
152 FWRPZView* rpzView = dynamic_cast<FWRPZView*>(view);
180 std::vector<BuilderInfo>& blist = itFind->second;
184 for (
size_t bii = 0, bie = blist.size(); bii != bie; ++bii) {
187 info.classType(bType, bIsSimple);
197 if (itype != bType) {
204 int builderViewBit =
info.m_viewBit;
206 std::shared_ptr<FWProxyBuilderBase> builder;
212 <<
"FWEveViewManager::newItem ignoring the following exception (probably edmplugincache mismatch):"
222 builder->setItem(iItem);
230 if (builder->willHandleInteraction() ==
false) {
231 typedef std::map<const FWEventItem*, FWInteractionList*>::iterator
Iterator;
234 if (
t.second ==
true)
237 builder->setInteractionList(
t.first->second, iItem->
purpose());
244 if (((1 << viewType) & builderViewBit) == 0)
253 TEveElementList* product = builder->createProduct(
type, view->
viewContext());
257 TEveElementList* product = builder->createProduct(
type,
nullptr);
278 std::shared_ptr<FWEveView> view;
305 m_views[
type].push_back(std::shared_ptr<FWEveView>(view));
311 gEve->DisableRedraw();
319 int viewerBit = 1 << view->typeId();
320 if (
m_views[view->typeId()].size() == 1) {
322 int builderViewBit =
i->first;
324 if (viewerBit == (builderViewBit & viewerBit)) {
325 for (
BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt) {
326 (*bIt)->setHaveWindow(
true);
332 FWRPZView* rpzView = dynamic_cast<FWRPZView*>(view.get());
334 int builderViewBit =
i->first;
336 if (viewerBit == (builderViewBit & viewerBit)) {
337 for (
BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt) {
340 TEveElementList* product = (*bIt)->createProduct(view->typeId(), view->viewContext());
348 view->ownedProducts()->AddElement(product);
355 view->eventScene()->AddElement(product);
364 view->setupEnergyScale();
366 gEve->EnableRedraw();
367 view->viewerGL()->UpdateScene();
375 int typeId = view->
typeId();
377 int viewerBit = 1 << typeId;
378 int nviews =
m_views[typeId].size();
380 int builderBit =
i->first;
381 if (viewerBit == (builderBit & viewerBit))
386 if (viewerBit == (builderBit & viewerBit)) {
394 if (viewerBit == (builderBit & viewerBit)) {
396 (*bIt)->setHaveWindow(
false);
404 if (
i->get() == vb) {
424 bool itemHaveWindow =
false;
426 for (
size_t bi = 0,
be =
i->second.size(); bi !=
be; ++bi) {
430 itemHaveWindow =
true;
442 if (!it->second->empty())
443 it->second->modelChanges(iIds);
456 bool itemHaveWindow =
false;
459 for (
size_t bi = 0,
be =
i->second.size(); bi !=
be; ++bi) {
475 if (!it->second->empty())
476 it->second->itemChanged();
493 while (bIt !=
i->second.end()) {
494 if ((*bIt)->item() ==
item) {
496 (*bIt)->itemBeingDestroyed(
item);
497 bIt =
i->second.erase(bIt);
507 x->commonPrefs()->getEnergyScale()->parameterChanged_.connect(
515 if ((*i)->isEnergyScaleGlobal()) {
516 (*i)->setupEnergyScale();
525 (*i)->setupEventCenter();
541 gEve->EnforceTimerActive(kTRUE);
542 gEve->DisableRedraw();
567 TExMapIter stamped_elements(gEve->PtrToStampedElements());
568 while (stamped_elements.Next(
key,
value)) {
569 TEveElement* el = reinterpret_cast<TEveElement*>(
key);
570 if (el->GetChangeBits() & TEveElement::kCBVisibility) {
571 el->CollectSceneParents(scenes);
574 gEve->ScenesChanged(scenes);
578 gEve->GetScenes()->ProcessSceneChanges(kFALSE, gEve->PtrToStampedElements());
588 (*i)->fwViewerGL()->DrawHiLod(swap_on_render);
592 if (!swap_on_render) {
595 (*i)->fwViewerGL()->JustSwap();
599 gEve->GetViewers()->RepaintChangedViewers(kFALSE, kFALSE);
603 TExMapIter stamped_elements(gEve->PtrToStampedElements());
604 while (stamped_elements.Next(
key,
value)) {
605 TEveElement* el = reinterpret_cast<TEveElement*>(
key);
606 if (gEve->GetEditor()->GetModel() == el->GetEditorObject(
"FWEveViewManager::eventEnd"))
607 gEve->EditElement(el);
608 TEveGedEditor::ElementChanged(el);
613 gEve->PtrToStampedElements()->Delete();
615 gEve->GetListTree()->ClearViewPort();
617 gEve->EnableRedraw();
618 gEve->EnforceTimerActive(kFALSE);
630 void*
userData = iElement->GetUserData();
638 return reinterpret_cast<FWFromEveSelectorBase*>(
userData);
662 const static std::string kFullFrameWorkPBExtension =
"FullFramework";
664 std::vector<BuilderInfo> blist = it->second;
665 for (
size_t bii = 0, bie = blist.size(); bii != bie; ++bii) {
670 if (std::string::npos !=
info.m_name.find(pfExt))
674 unsigned int bitPackedViews =
info.m_viewBit;
675 bool representsSubPart = (
info.m_name.substr(
info.m_name.find_first_of(
'@') - 1, 1) ==
"!");
676 size_t extp =
info.m_name.rfind(kFullFrameWorkPBExtension);
677 bool FFOnly = (extp != std::string::npos);
683 returnValue.
add(std::make_shared<FWSimpleRepresentationChecker>(
684 name, it->first, bitPackedViews, representsSubPart, FFOnly));
686 returnValue.
add(std::make_shared<FWEDProductRepresentationChecker>(
687 name, it->first, bitPackedViews, representsSubPart, FFOnly));
706 simple = (
m_name.substr(0, kSimple.size()) == kSimple);
722 #include "TEveCaloData.h"
725 bool blocked = gEve->GetHighlight()->BlockSignals(
true);
727 if (iElement ==
context().getCaloData()) {
729 std::set<TEveCaloData::CellId_t> hset;
733 TAxis* etaAxis =
hist->GetXaxis();
734 int nBinsX = etaAxis->GetNbins() + 2;
736 for (TEveCaloData::vCellId_i
i = hlist.begin();
i != hlist.end(); ++
i) {
739 newPhiBin = ((
phiBin + 1) / 4) * 4 - 1;
744 hset.insert(TEveCaloData::CellId_t(
tower, (*i).fSlice, (*i).fFraction));
746 hset.insert(TEveCaloData::CellId_t(
tower, (*i).fSlice, (*i).fFraction));
752 hset.insert(TEveCaloData::CellId_t(
tower, (*i).fSlice, (*i).fFraction));
754 hset.insert(TEveCaloData::CellId_t(
tower, (*i).fSlice, (*i).fFraction));
756 newPhiBin = ((
phiBin + 1) / 2) * 2 - 1;
758 hset.insert(TEveCaloData::CellId_t(
tower, (*i).fSlice, (*i).fFraction));
760 hset.insert(TEveCaloData::CellId_t(
tower, (*i).fSlice, (*i).fFraction));
768 for (std::set<TEveCaloData::CellId_t>::iterator it = hset.begin(); it != hset.end(); ++it) {
769 hlist.push_back(*it);
774 gEve->GetHighlight()->BlockSignals(blocked);