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"
67 m_blocked = gEve->GetSelection()->BlockSignals(
true);
71 gEve->GetSelection()->BlockSignals(
m_blocked);
94 std::inserter(builders,builders.begin()),
101 std::inserter(builders,builders.begin()),
106 for(std::set<std::string>::iterator it = builders.begin(), itEnd=builders.end();
112 first = it->find_last_of(
'@')+1;
114 int viewTypes = atoi(view_str.c_str());
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()");
139 gEve->GetHighlight()->Connect(
"SelectionAdded(TEveElement*)",
"FWEveViewManager",
this,
"highlightAdded(TEveElement*)");
140 gEve->GetHighlight()->Connect(
"SelectionRepeated(TEveElement*)",
"FWEveViewManager",
this,
"highlightAdded(TEveElement*)");
142 TGeoManager::SetVerboseLevel(0);
162 int viewType, TEveElementList* product)
198 std::vector<BuilderInfo>& blist = itFind->second;
201 for (
size_t bii = 0, bie = blist.size(); bii != bie; ++bii)
218 if (itype != bType) {
235 fwLog(
fwlog::kWarning) <<
"FWEveViewManager::newItem ignoring the following exception (probably edmplugincache mismatch):"
236 << std::endl << exc.what();
244 std::shared_ptr<FWProxyBuilderBase> pB(builder);
255 typedef std::map<const FWEventItem*, FWInteractionList*>::iterator
Iterator;
259 if (t.second ==
true)
270 if (((1 << viewType) & builderViewBit) == 0)
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();
638 gEve->EnforceTimerActive(kTRUE);
639 gEve->DisableRedraw();
668 TExMapIter stamped_elements(gEve->PtrToStampedElements());
669 while (stamped_elements.Next(key, value))
671 TEveElement *el =
reinterpret_cast<TEveElement*
>(
key);
672 if (el->GetChangeBits() & TEveElement::kCBVisibility)
674 el->CollectSceneParents(scenes);
677 gEve->ScenesChanged(scenes);
681 gEve->GetScenes()->ProcessSceneChanges(kFALSE, gEve->PtrToStampedElements());
692 (*i)->fwViewerGL()->DrawHiLod(swap_on_render);
696 if ( ! swap_on_render)
701 (*i)->fwViewerGL()->JustSwap();
705 gEve->GetViewers()->RepaintChangedViewers(kFALSE, kFALSE);
709 TExMapIter stamped_elements(gEve->PtrToStampedElements());
710 while (stamped_elements.Next(key, value))
712 TEveElement *el =
reinterpret_cast<TEveElement*
>(
key);
713 if (gEve->GetEditor()->GetModel() == el->GetEditorObject(
"FWEveViewManager::eventEnd"))
714 gEve->EditElement(el);
715 TEveGedEditor::ElementChanged(el);
720 gEve->PtrToStampedElements()->Delete();
722 gEve->GetListTree()->ClearViewPort();
724 gEve->EnableRedraw();
725 gEve->EnforceTimerActive(kFALSE);
738 void* userData = iElement->GetUserData();
781 const static std::string kFullFrameWorkPBExtension =
"FullFramework";
786 std::vector<BuilderInfo> blist = it->second;
787 for (
size_t bii = 0, bie = blist.size(); bii != bie; ++bii)
793 if (std::string::npos != info.
m_name.find(pfExt))
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);
807 returnValue.
add(std::make_shared<FWSimpleRepresentationChecker>(name, it->first,bitPackedViews,representsSubPart, FFOnly) );
811 returnValue.
add(std::make_shared<FWEDProductRepresentationChecker>(name, it->first,bitPackedViews,representsSubPart, FFOnly) );
837 simple = (
m_name.substr(0,kSimple.size()) == kSimple);
840 typeName =
m_name.substr(kSimple.size(),
m_name.find_first_of(
'@')-kSimple.size()-1);
844 typeName =
m_name.substr(0,
m_name.find_first_of(
'@')-1);
856 #include "TEveCaloData.h"
862 bool blocked = gEve->GetHighlight()->BlockSignals(
true);
865 if (iElement ==
context().getCaloData())
868 std::set<TEveCaloData::CellId_t> hset;
870 int etaBin, phiBin,
w, newPhiBin, tower;
872 TAxis* etaAxis = hist->GetXaxis();
873 int nBinsX = etaAxis->GetNbins() + 2;
875 for (TEveCaloData::vCellId_i
i = hlist.begin();
i != hlist.end(); ++
i)
877 hist->GetBinXYZ((*i).fTower, etaBin, phiBin, w);
878 if (
TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 4.71475)
880 newPhiBin = ((phiBin + 1) / 4) * 4 - 1;
881 if (newPhiBin <= 0) newPhiBin = 71;
883 tower = etaBin + newPhiBin*nBinsX;
884 hset.insert(TEveCaloData::CellId_t( tower, (*i).fSlice, (*i).fFraction));
886 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
890 tower = etaBin + 1*nBinsX;
892 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
894 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
896 else if (
TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 1.747650)
898 newPhiBin = ((phiBin + 1)/2)*2 - 1;
899 tower = etaBin + newPhiBin*nBinsX;
900 hset.insert(TEveCaloData::CellId_t( tower, (*i).fSlice, (*i).fFraction));
902 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
912 for(std::set<TEveCaloData::CellId_t>::iterator it = hset.begin(); it != hset.end(); ++it)
914 hlist.push_back(*it);
920 gEve->GetHighlight()->BlockSignals(blocked);
const CategoryToInfos & categoryToInfos() const
Color_t background() const
const fireworks::Context & context() const
virtual void modelChangesDone()
virtual void doUnselect()=0
FWTypeToRepresentations supportedTypesAndRepresentations() const
virtual bool willHandleInteraction() const
virtual bool havePerViewProduct(FWViewType::EType) const
FWColorManager * colorManager() const
void globalEnergyScaleChanged()
void selectionAdded(TEveElement *)
void itemChanged(const FWEventItem *)
virtual void colorsChanged()
FWItemChangeSignal goingToBeDestroyed_
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)
T x() const
Cartesian x coordinate.
static bool inheritsFrom(const edm::TypeWithDict &iChild, const std::string &iParentTypeName, unsigned int &distance)
FWEveView * finishViewCreate(std::shared_ptr< FWEveView >)
virtual void setContext(const fireworks::Context *x)
virtual void newItem(const FWEventItem *)
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
virtual void setContext(const fireworks::Context *)
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views
void selectionRemoved(TEveElement *)
void highlightAdded(TEveElement *)
void importElements(TEveElement *iProjectableChild, float layer, TEveElement *iProjectedParent=0)
TEveCaloDataHist * getCaloData() const
void modelChanges(const FWModelIds &iIds)
void beingDestroyed(const FWViewBase *)
std::map< int, BuilderVec > m_builders
FWSelectionManager * selectionManager() const
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
std::vector< std::shared_ptr< FWEveView > >::iterator EveViewVec_it
FWViewBase * buildView(TEveWindowSlot *iParent, const std::string &type)
virtual void doSelect()=0
void setHaveWindow(bool iFlag)
std::map< const FWEventItem *, FWInteractionList * > m_interactionLists
virtual void modelChangesComing()
FWViewContext * viewContext()
FWViewEnergyScale * getEnergyScale() const
virtual ~FWEveViewManager()
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
virtual void eventBegin()
TEveElementList * createProduct(FWViewType::EType, const FWViewContext *)
const std::string & purpose() const
static PluginManager * get()
void classType(std::string &, bool &) const
tuple size
Write out results.
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 &)
FWViewType::EType typeId() const