16 #include "TEveManager.h"
17 #include "TEveSelection.h"
18 #include "TEveScene.h"
19 #include "TEveViewer.h"
21 #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();
103 first = it->find_last_of(
'@')+1;
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)
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();
682 const static std::string kFullFrameWorkPBExtension =
"FullFramework";
687 std::vector<BuilderInfo> blist = it->second;
688 for (
size_t bii = 0, bie = blist.size(); bii != bie; ++bii)
693 unsigned int bitPackedViews = info.
m_viewBit;
694 bool representsSubPart = (name.substr(name.find_first_of(
'@')-1, 1)==
"!");
695 size_t extp = name.rfind(kFullFrameWorkPBExtension);
696 bool FFOnly = (extp != std::string::npos);
697 if(name.substr(0,kSimple.size()) == kSimple)
699 name = name.substr(kSimple.size(), name.find_first_of(
'@')-kSimple.size()-1);
700 returnValue.
add(boost::shared_ptr<FWRepresentationCheckerBase>(
new FWSimpleRepresentationChecker(name, it->first,bitPackedViews,representsSubPart, FFOnly)) );
704 name = name.substr(0, name.find_first_of(
'@')-1);
735 #include "TEveCaloData.h"
741 bool blocked = gEve->GetHighlight()->BlockSignals(
true);
744 if (iElement ==
context().getCaloData())
747 std::set<TEveCaloData::CellId_t> hset;
749 int etaBin, phiBin,
w, newPhiBin, tower;
751 TAxis* etaAxis = hist->GetXaxis();
752 int nBinsX = etaAxis->GetNbins() + 2;
754 for (TEveCaloData::vCellId_i
i = hlist.begin();
i != hlist.end(); ++
i)
756 hist->GetBinXYZ((*i).fTower, etaBin, phiBin, w);
757 if (TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 4.71475)
759 newPhiBin = ((phiBin + 1) / 4) * 4 - 1;
760 if (newPhiBin <= 0) newPhiBin = 71;
762 tower = etaBin + newPhiBin*nBinsX;
763 hset.insert(TEveCaloData::CellId_t( tower, (*i).fSlice, (*i).fFraction));
765 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
769 tower = etaBin + 1*nBinsX;
771 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
773 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
775 else if (TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 1.747650)
777 newPhiBin = ((phiBin + 1)/2)*2 - 1;
778 tower = etaBin + newPhiBin*nBinsX;
779 hset.insert(TEveCaloData::CellId_t( tower, (*i).fSlice, (*i).fFraction));
781 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
791 for(std::set<TEveCaloData::CellId_t>::iterator it = hset.begin(); it != hset.end(); ++it)
793 hlist.push_back(*it);
799 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
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::set< FWModelId > FWModelIds
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