16 #include "TEveManager.h"
17 #include "TEveSelection.h"
18 #include "TEveScene.h"
19 #include "TEveViewer.h"
21 #include "TGeoManager.h"
22 #include "TGLViewer.h"
49 #include <boost/bind.hpp>
59 m_blocked = gEve->GetSelection()->BlockSignals(
true);
63 gEve->GetSelection()->BlockSignals(
m_blocked);
81 std::set<std::string> builders;
86 std::inserter(builders,builders.begin()),
93 std::inserter(builders,builders.begin()),
98 for(std::set<std::string>::iterator it = builders.begin(), itEnd=builders.end();
104 first = it->find_last_of(
'@')+1;
106 int viewTypes = atoi(view_str.c_str());
125 gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_Master);
126 TEveSelection* eveSelection = gEve->GetSelection();
127 eveSelection->SetPickToSelect(TEveSelection::kPS_Master);
128 eveSelection->Connect(
"SelectionAdded(TEveElement*)",
"FWEveViewManager",
this,
"selectionAdded(TEveElement*)");
129 eveSelection->Connect(
"SelectionRepeated(TEveElement*)",
"FWEveViewManager",
this,
"selectionAdded(TEveElement*)");
130 eveSelection->Connect(
"SelectionRemoved(TEveElement*)",
"FWEveViewManager",
this,
"selectionRemoved(TEveElement*)");
131 eveSelection->Connect(
"SelectionCleared()",
"FWEveViewManager",
this,
"selectionCleared()");
133 gEve->GetHighlight()->Connect(
"SelectionAdded(TEveElement*)",
"FWEveViewManager",
this,
"highlightAdded(TEveElement*)");
134 gEve->GetHighlight()->Connect(
"SelectionRepeated(TEveElement*)",
"FWEveViewManager",
this,
"highlightAdded(TEveElement*)");
136 TGeoManager::SetVerboseLevel(0);
156 int viewType, TEveElementList* product)
191 std::vector<BuilderInfo>& blist = itFind->second;
193 for (
size_t bii = 0, bie = blist.size(); bii != bie; ++bii)
208 fwLog(
fwlog::kWarning) <<
"FWEveViewManager::newItem ignoring the following exception (probably edmplugincache mismatch):"
209 << std::endl << exc.what();
217 boost::shared_ptr<FWProxyBuilderBase> pB(builder);
228 typedef std::map<const FWEventItem*, FWInteractionList*>::iterator
Iterator;
232 if (t.second ==
true)
243 if (((1 << viewType) & builderViewBit) == 0)
286 boost::shared_ptr<FWEveView> view;
290 view.reset(
new FW3DView(iParent, type));
298 view.reset(
new FWRPZView(iParent, type));
305 view.reset(
new FWHFView(iParent, type));
314 m_views[
type].push_back(boost::shared_ptr<FWEveView> (view));
322 gEve->DisableRedraw();
330 int viewerBit = 1 << view->typeId();
331 if (
m_views[view->typeId()].size() == 1)
335 int builderViewBit =
i->first;
337 if (viewerBit == (builderViewBit & viewerBit))
341 (*bIt)->setHaveWindow(
true);
350 int builderViewBit =
i->first;
352 if (viewerBit == (builderViewBit & viewerBit))
358 TEveElementList* product = (*bIt)->createProduct(view->typeId(), view->viewContext());
370 view->ownedProducts()->AddElement(product);
382 view->eventScene()->AddElement(product);
392 view->setupEnergyScale();
394 gEve->EnableRedraw();
395 view->viewerGL()->UpdateScene();
405 int typeId = view->
typeId();
407 int viewerBit = 1 << typeId;
408 int nviews =
m_views[typeId].size();
411 int builderBit =
i->first;
412 if (viewerBit == (builderBit & viewerBit))
417 if (viewerBit == (builderBit & viewerBit))
428 if (viewerBit == (builderBit & viewerBit))
431 (*bIt)->setHaveWindow(
false);
452 gEve->DisableRedraw();
458 gEve->EnableRedraw();
470 bool itemHaveWindow =
false;
471 for (std::map<int, BuilderVec>::iterator
i =
m_builders.begin();
474 for (
size_t bi = 0, be =
i->second.size(); bi != be; ++bi)
480 itemHaveWindow =
true;
490 std::map<const FWEventItem*, FWInteractionList*>::iterator it =
m_interactionLists.find(item);
493 if (!it->second->empty())
494 it->second->modelChanges(iIds);
509 bool itemHaveWindow =
false;
511 for (std::map<int, BuilderVec>::iterator
i =
m_builders.begin();
514 for(
size_t bi = 0, be =
i->second.size(); bi != be; ++bi)
518 if (builder->
item() != item)
529 std::map<const FWEventItem*, FWInteractionList*>::iterator it =
m_interactionLists.find(item);
532 if (!it->second->empty())
533 it->second->itemChanged();
544 std::map<const FWEventItem*, FWInteractionList*>::iterator it =
m_interactionLists.find(item);
551 for (std::map<int, BuilderVec>::iterator
i =
m_builders.begin();
555 while( bIt !=
i->second.end() )
557 if ((*bIt)->item() == item)
560 (*bIt)->itemBeingDestroyed(item);
561 bIt =
i->second.erase(bIt);
586 if ((*i)->isEnergyScaleGlobal())
588 (*i)->setupEnergyScale();
609 gEve->DisableRedraw();
628 gEve->EnableRedraw();
641 void* userData = iElement->GetUserData();
685 const static std::string kFullFrameWorkPBExtension =
"FullFramework";
690 std::vector<BuilderInfo> blist = it->second;
691 for (
size_t bii = 0, bie = blist.size(); bii != bie; ++bii)
696 unsigned int bitPackedViews = info.
m_viewBit;
697 bool representsSubPart = (name.substr(name.find_first_of(
'@')-1, 1)==
"!");
698 size_t extp = name.rfind(kFullFrameWorkPBExtension);
699 bool FFOnly = (extp != std::string::npos);
700 if(name.substr(0,kSimple.size()) == kSimple)
702 name = name.substr(kSimple.size(), name.find_first_of(
'@')-kSimple.size()-1);
703 returnValue.
add(boost::shared_ptr<FWRepresentationCheckerBase>(
new FWSimpleRepresentationChecker(name, it->first,bitPackedViews,representsSubPart, FFOnly)) );
707 name = name.substr(0, name.find_first_of(
'@')-1);
738 #include "TEveCaloData.h"
744 bool blocked = gEve->GetHighlight()->BlockSignals(
true);
747 if (iElement ==
context().getCaloData())
750 std::set<TEveCaloData::CellId_t> hset;
752 int etaBin, phiBin,
w, newPhiBin, tower;
754 TAxis* etaAxis = hist->GetXaxis();
755 int nBinsX = etaAxis->GetNbins() + 2;
757 for (TEveCaloData::vCellId_i
i = hlist.begin();
i != hlist.end(); ++
i)
759 hist->GetBinXYZ((*i).fTower, etaBin, phiBin, w);
760 if (
TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 4.71475)
762 newPhiBin = ((phiBin + 1) / 4) * 4 - 1;
763 if (newPhiBin <= 0) newPhiBin = 71;
765 tower = etaBin + newPhiBin*nBinsX;
766 hset.insert(TEveCaloData::CellId_t( tower, (*i).fSlice, (*i).fFraction));
768 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
772 tower = etaBin + 1*nBinsX;
774 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
776 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
778 else if (
TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 1.747650)
780 newPhiBin = ((phiBin + 1)/2)*2 - 1;
781 tower = etaBin + newPhiBin*nBinsX;
782 hset.insert(TEveCaloData::CellId_t( tower, (*i).fSlice, (*i).fFraction));
784 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
794 for(std::set<TEveCaloData::CellId_t>::iterator it = hset.begin(); it != hset.end(); ++it)
796 hlist.push_back(*it);
802 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