17 #include "TEveManager.h"
18 #include "TEveSelection.h"
19 #include "TEveScene.h"
20 #include "TEveViewer.h"
22 #include "TGLViewer.h"
48 #include <boost/bind.hpp>
58 m_blocked = gEve->GetSelection()->BlockSignals(
true);
62 gEve->GetSelection()->BlockSignals(
m_blocked);
80 std::set<std::string> builders;
85 std::inserter(builders,builders.begin()),
92 std::inserter(builders,builders.begin()),
97 for(std::set<std::string>::iterator it = builders.begin(), itEnd=builders.end();
101 std::string purpose = it->substr(first,it->find_last_of(
'@')-
first);
103 first = it->find_last_of(
'@')+1;
104 std::string view_str = it->substr(first,it->find_last_of(
'#')-
first);
105 int viewTypes = atoi(view_str.c_str());
124 gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_Master);
125 TEveSelection* eveSelection = gEve->GetSelection();
126 eveSelection->SetPickToSelect(TEveSelection::kPS_Master);
127 eveSelection->Connect(
"SelectionAdded(TEveElement*)",
"FWEveViewManager",
this,
"selectionAdded(TEveElement*)");
128 eveSelection->Connect(
"SelectionRepeated(TEveElement*)",
"FWEveViewManager",
this,
"selectionAdded(TEveElement*)");
129 eveSelection->Connect(
"SelectionRemoved(TEveElement*)",
"FWEveViewManager",
this,
"selectionRemoved(TEveElement*)");
130 eveSelection->Connect(
"SelectionCleared()",
"FWEveViewManager",
this,
"selectionCleared()");
132 gEve->GetHighlight()->Connect(
"SelectionAdded(TEveElement*)",
"FWEveViewManager",
this,
"highlightAdded(TEveElement*)");
133 gEve->GetHighlight()->Connect(
"SelectionRepeated(TEveElement*)",
"FWEveViewManager",
this,
"highlightAdded(TEveElement*)");
153 int viewType, TEveElementList* product)
188 std::vector<BuilderInfo>& blist = itFind->second;
190 for (
size_t bii = 0, bie = blist.size(); bii != bie; ++bii)
194 std::string builderName = info.
m_name;
205 fwLog(
fwlog::kWarning) <<
"FWEveViewManager::newItem ignoring the following exception (probably edmplugincache mismatch):"
206 << std::endl << exc.what();
214 boost::shared_ptr<FWProxyBuilderBase> pB(builder);
225 typedef std::map<const FWEventItem*, FWInteractionList*>::iterator
Iterator;
229 if (t.second ==
true)
240 if (((1 << viewType) & builderViewBit) == 0)
283 boost::shared_ptr<FWEveView> view;
287 view.reset(
new FW3DView(iParent, type));
295 view.reset(
new FWRPZView(iParent, type));
302 view.reset(
new FWHFView(iParent, type));
311 m_views[
type].push_back(boost::shared_ptr<FWEveView> (view));
319 gEve->DisableRedraw();
327 int viewerBit = 1 << view->typeId();
328 if (
m_views[view->typeId()].size() == 1)
332 int builderViewBit =
i->first;
334 if (viewerBit == (builderViewBit & viewerBit))
338 (*bIt)->setHaveWindow(
true);
347 int builderViewBit =
i->first;
349 if (viewerBit == (builderViewBit & viewerBit))
355 TEveElementList* product = (*bIt)->createProduct(view->typeId(), view->viewContext());
367 view->ownedProducts()->AddElement(product);
379 view->eventScene()->AddElement(product);
389 view->setupEnergyScale();
391 gEve->EnableRedraw();
392 view->viewerGL()->UpdateScene();
402 int typeId = view->
typeId();
404 int viewerBit = 1 << typeId;
405 int nviews =
m_views[typeId].size();
408 int builderBit =
i->first;
409 if (viewerBit == (builderBit & viewerBit))
414 if (viewerBit == (builderBit & viewerBit))
425 if (viewerBit == (builderBit & viewerBit))
428 (*bIt)->setHaveWindow(
false);
449 gEve->DisableRedraw();
455 gEve->EnableRedraw();
467 bool itemHaveWindow =
false;
468 for (std::map<int, BuilderVec>::iterator
i =
m_builders.begin();
471 for (
size_t bi = 0, be =
i->second.size(); bi != be; ++bi)
477 itemHaveWindow =
true;
487 std::map<const FWEventItem*, FWInteractionList*>::iterator it =
m_interactionLists.find(item);
490 if (!it->second->empty())
491 it->second->modelChanges(iIds);
506 bool itemHaveWindow =
false;
508 for (std::map<int, BuilderVec>::iterator
i =
m_builders.begin();
511 for(
size_t bi = 0, be =
i->second.size(); bi != be; ++bi)
515 if (builder->
item() != item)
526 std::map<const FWEventItem*, FWInteractionList*>::iterator it =
m_interactionLists.find(item);
529 if (!it->second->empty())
530 it->second->itemChanged();
541 std::map<const FWEventItem*, FWInteractionList*>::iterator it =
m_interactionLists.find(item);
548 for (std::map<int, BuilderVec>::iterator
i =
m_builders.begin();
552 while( bIt !=
i->second.end() )
554 if ((*bIt)->item() == item)
557 (*bIt)->itemBeingDestroyed(item);
558 bIt =
i->second.erase(bIt);
583 if ((*i)->isEnergyScaleGlobal())
585 (*i)->setupEnergyScale();
606 gEve->DisableRedraw();
625 gEve->EnableRedraw();
638 void* userData = iElement->GetUserData();
681 const std::string kSimple(
"simple#");
686 std::vector<BuilderInfo> blist = it->second;
687 for (
size_t bii = 0, bie = blist.size(); bii != bie; ++bii)
691 unsigned int bitPackedViews = info.
m_viewBit;
692 bool representsSubPart = (name.substr(name.find_first_of(
'@')-1, 1)==
"!");
694 if(name.substr(0,kSimple.size()) == kSimple)
696 name = name.substr(kSimple.size(), name.find_first_of(
'@')-kSimple.size()-1);
701 name = name.substr(0, name.find_first_of(
'@')-1);
732 #include "TEveCaloData.h"
738 bool blocked = gEve->GetHighlight()->BlockSignals(
true);
741 if (iElement ==
context().getCaloData())
744 std::set<TEveCaloData::CellId_t> hset;
746 int etaBin, phiBin,
w, newPhiBin, tower;
748 TAxis* etaAxis = hist->GetXaxis();
749 int nBinsX = etaAxis->GetNbins() + 2;
751 for (TEveCaloData::vCellId_i
i = hlist.begin();
i != hlist.end(); ++
i)
753 hist->GetBinXYZ((*i).fTower, etaBin, phiBin, w);
754 if (TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 4.71475)
756 newPhiBin = ((phiBin + 1) / 4) * 4 - 1;
757 if (newPhiBin <= 0) newPhiBin = 71;
759 tower = etaBin + newPhiBin*nBinsX;
760 hset.insert(TEveCaloData::CellId_t( tower, (*i).fSlice, (*i).fFraction));
762 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
766 tower = etaBin + 1*nBinsX;
768 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
770 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
772 else if (TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 1.747650)
774 newPhiBin = ((phiBin + 1)/2)*2 - 1;
775 tower = etaBin + newPhiBin*nBinsX;
776 hset.insert(TEveCaloData::CellId_t( tower, (*i).fSlice, (*i).fFraction));
778 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
788 for(std::set<TEveCaloData::CellId_t>::iterator it = hset.begin(); it != hset.end(); ++it)
790 hlist.push_back(*it);
796 gEve->GetHighlight()->BlockSignals(blocked);
const CategoryToInfos & categoryToInfos() const
FWEveView * finishViewCreate(boost::shared_ptr< FWEveView >)
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
std::set< FWModelId > FWModelIds
FWColorManager & colorManager() const
boost::function2< FWViewBase *, TEveWindowSlot *, const std::string & > ViewBuildFunctor
const FWEventItem * item() const
void add(boost::shared_ptr< FWRepresentationCheckerBase > iChecker)
FWEveViewManager(FWGUIManager *)
void registerViewBuilder(const std::string &iName, ViewBuildFunctor &iBuilder)
FWFromEveSelectorBase * getSelector(TEveElement *iElement)
static bool isProjected(int)
virtual void setContext(const fireworks::Context *x)
virtual void newItem(const FWEventItem *)
std::vector< boost::shared_ptr< FWEveView > >::iterator EveViewVec_it
virtual void setItem(const FWEventItem *iItem)
void resetMaxEtAndEnergy() const
FWItemChangeSignal itemChanged_
bool haveViewForBit(int) const
void addElements(const FWEventItem *item, FWEveView *view, int viewType, TEveElementList *product)
virtual void setContext(const fireworks::Context *)
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
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()
std::vector< boost::shared_ptr< FWProxyBuilderBase > > BuilderVec
CmsShowCommon * commonPrefs() const
BuilderVec::iterator BuilderVec_it
FWModelChangeSignal changed_
sigc::signal< void > parameterChanged_
static const std::string & idToName(int)
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()
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 &)
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
virtual void setInteractionList(FWInteractionList *, const std::string &)
FWViewType::EType typeId() const