15 #include <boost/bind.hpp>
21 #define protected public
22 #define private public
23 #include "TEveManager.h"
27 #include "TEveSelection.h"
28 #include "TEveScene.h"
29 #include "TEveViewer.h"
31 #include "TEveGedEditor.h"
32 #include "TGListTree.h"
33 #include "TGeoManager.h"
74 m_blocked = gEve->GetSelection()->BlockSignals(
true);
78 gEve->GetSelection()->BlockSignals(
m_blocked);
101 std::inserter(builders,builders.begin()),
108 std::inserter(builders,builders.begin()),
113 for(std::set<std::string>::iterator it = builders.begin(), itEnd=builders.end();
119 first = it->find_last_of(
'@')+1;
121 int viewTypes = atoi(view_str.c_str());
138 gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_Master);
139 TEveSelection* eveSelection = gEve->GetSelection();
140 eveSelection->SetPickToSelect(TEveSelection::kPS_Master);
141 eveSelection->Connect(
"SelectionAdded(TEveElement*)",
"FWEveViewManager",
this,
"selectionAdded(TEveElement*)");
142 eveSelection->Connect(
"SelectionRepeated(TEveElement*)",
"FWEveViewManager",
this,
"selectionAdded(TEveElement*)");
143 eveSelection->Connect(
"SelectionRemoved(TEveElement*)",
"FWEveViewManager",
this,
"selectionRemoved(TEveElement*)");
144 eveSelection->Connect(
"SelectionCleared()",
"FWEveViewManager",
this,
"selectionCleared()");
146 gEve->GetHighlight()->Connect(
"SelectionAdded(TEveElement*)",
"FWEveViewManager",
this,
"highlightAdded(TEveElement*)");
147 gEve->GetHighlight()->Connect(
"SelectionRepeated(TEveElement*)",
"FWEveViewManager",
this,
"highlightAdded(TEveElement*)");
149 TGeoManager::SetVerboseLevel(0);
169 int viewType, TEveElementList* product)
205 std::vector<BuilderInfo>& blist = itFind->second;
208 for (
size_t bii = 0, bie = blist.size(); bii != bie; ++bii)
225 if (itype != bType) {
242 fwLog(
fwlog::kWarning) <<
"FWEveViewManager::newItem ignoring the following exception (probably edmplugincache mismatch):"
243 << std::endl << exc.what();
251 boost::shared_ptr<FWProxyBuilderBase> pB(builder);
262 typedef std::map<const FWEventItem*, FWInteractionList*>::iterator
Iterator;
266 if (t.second ==
true)
277 if (((1 << viewType) & builderViewBit) == 0)
320 boost::shared_ptr<FWEveView> view;
324 view.reset(
new FW3DView(iParent, type));
332 view.reset(
new FWRPZView(iParent, type));
339 view.reset(
new FWHFView(iParent, type));
348 m_views[
type].push_back(boost::shared_ptr<FWEveView> (view));
356 gEve->DisableRedraw();
364 int viewerBit = 1 << view->typeId();
365 if (
m_views[view->typeId()].size() == 1)
369 int builderViewBit =
i->first;
371 if (viewerBit == (builderViewBit & viewerBit))
375 (*bIt)->setHaveWindow(
true);
384 int builderViewBit =
i->first;
386 if (viewerBit == (builderViewBit & viewerBit))
392 TEveElementList* product = (*bIt)->createProduct(view->typeId(), view->viewContext());
404 view->ownedProducts()->AddElement(product);
416 view->eventScene()->AddElement(product);
426 view->setupEnergyScale();
428 gEve->EnableRedraw();
429 view->viewerGL()->UpdateScene();
439 int typeId = view->
typeId();
441 int viewerBit = 1 << typeId;
442 int nviews =
m_views[typeId].size();
445 int builderBit =
i->first;
446 if (viewerBit == (builderBit & viewerBit))
451 if (viewerBit == (builderBit & viewerBit))
462 if (viewerBit == (builderBit & viewerBit))
465 (*bIt)->setHaveWindow(
false);
486 gEve->DisableRedraw();
492 gEve->EnableRedraw();
504 bool itemHaveWindow =
false;
505 for (std::map<int, BuilderVec>::iterator
i =
m_builders.begin();
508 for (
size_t bi = 0, be =
i->second.size(); bi != be; ++bi)
514 itemHaveWindow =
true;
524 std::map<const FWEventItem*, FWInteractionList*>::iterator it =
m_interactionLists.find(item);
527 if (!it->second->empty())
528 it->second->modelChanges(iIds);
543 bool itemHaveWindow =
false;
545 for (std::map<int, BuilderVec>::iterator
i =
m_builders.begin();
548 for(
size_t bi = 0, be =
i->second.size(); bi != be; ++bi)
552 if (builder->
item() != item)
563 std::map<const FWEventItem*, FWInteractionList*>::iterator it =
m_interactionLists.find(item);
566 if (!it->second->empty())
567 it->second->itemChanged();
578 std::map<const FWEventItem*, FWInteractionList*>::iterator it =
m_interactionLists.find(item);
585 for (std::map<int, BuilderVec>::iterator
i =
m_builders.begin();
589 while( bIt !=
i->second.end() )
591 if ((*bIt)->item() == item)
594 (*bIt)->itemBeingDestroyed(item);
595 bIt =
i->second.erase(bIt);
620 if ((*i)->isEnergyScaleGlobal())
622 (*i)->setupEnergyScale();
645 gEve->fTimerActive = kTRUE;
646 gEve->DisableRedraw();
675 TExMapIter stamped_elements(gEve->fStampedElements);
676 while (stamped_elements.Next(key, value))
678 TEveElement *el =
reinterpret_cast<TEveElement*
>(
key);
679 if (el->GetChangeBits() & TEveElement::kCBVisibility)
681 el->CollectSceneParents(scenes);
684 gEve->ScenesChanged(scenes);
688 gEve->fScenes->ProcessSceneChanges(gEve->fDropLogicals, gEve->fStampedElements);
699 (*i)->fwViewerGL()->DrawHiLod(swap_on_render);
703 if ( ! swap_on_render)
708 (*i)->fwViewerGL()->JustSwap();
712 gEve->fViewers->RepaintChangedViewers(gEve->fResetCameras, gEve->fDropLogicals);
716 TExMapIter stamped_elements(gEve->fStampedElements);
717 while (stamped_elements.Next(key, value))
719 TEveElement *el =
reinterpret_cast<TEveElement*
>(
key);
720 if (gEve->GetEditor()->GetModel() == el->GetEditorObject(
"FWEveViewManager::eventEnd"))
721 gEve->EditElement(el);
722 TEveGedEditor::ElementChanged(el);
727 gEve->fStampedElements->Delete();
729 gEve->GetListTree()->ClearViewPort();
731 gEve->fResetCameras = kFALSE;
732 gEve->fDropLogicals = kFALSE;
734 gEve->EnableRedraw();
735 gEve->fTimerActive = kFALSE;
748 void* userData = iElement->GetUserData();
791 const static std::string kFullFrameWorkPBExtension =
"FullFramework";
796 std::vector<BuilderInfo> blist = it->second;
797 for (
size_t bii = 0, bie = blist.size(); bii != bie; ++bii)
803 if (std::string::npos != info.
m_name.find(pfExt))
807 unsigned int bitPackedViews = info.
m_viewBit;
808 bool representsSubPart = (info.
m_name.substr(info.
m_name.find_first_of(
'@')-1, 1)==
"!");
809 size_t extp = info.
m_name.rfind(kFullFrameWorkPBExtension);
810 bool FFOnly = (extp != std::string::npos);
817 returnValue.
add(boost::shared_ptr<FWRepresentationCheckerBase>(
new FWSimpleRepresentationChecker(name, it->first,bitPackedViews,representsSubPart, FFOnly)) );
847 simple = (
m_name.substr(0,kSimple.size()) == kSimple);
850 typeName =
m_name.substr(kSimple.size(),
m_name.find_first_of(
'@')-kSimple.size()-1);
854 typeName =
m_name.substr(0,
m_name.find_first_of(
'@')-1);
866 #include "TEveCaloData.h"
872 bool blocked = gEve->GetHighlight()->BlockSignals(
true);
875 if (iElement ==
context().getCaloData())
878 std::set<TEveCaloData::CellId_t> hset;
880 int etaBin, phiBin,
w, newPhiBin, tower;
882 TAxis* etaAxis = hist->GetXaxis();
883 int nBinsX = etaAxis->GetNbins() + 2;
885 for (TEveCaloData::vCellId_i
i = hlist.begin();
i != hlist.end(); ++
i)
887 hist->GetBinXYZ((*i).fTower, etaBin, phiBin, w);
888 if (
TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 4.71475)
890 newPhiBin = ((phiBin + 1) / 4) * 4 - 1;
891 if (newPhiBin <= 0) newPhiBin = 71;
893 tower = etaBin + newPhiBin*nBinsX;
894 hset.insert(TEveCaloData::CellId_t( tower, (*i).fSlice, (*i).fFraction));
896 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
900 tower = etaBin + 1*nBinsX;
902 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
904 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
906 else if (
TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 1.747650)
908 newPhiBin = ((phiBin + 1)/2)*2 - 1;
909 tower = etaBin + newPhiBin*nBinsX;
910 hset.insert(TEveCaloData::CellId_t( tower, (*i).fSlice, (*i).fFraction));
912 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
922 for(std::set<TEveCaloData::CellId_t>::iterator it = hset.begin(); it != hset.end(); ++it)
924 hlist.push_back(*it);
930 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
static bool s_syncAllViews
const FWEventItem * item() const
void add(boost::shared_ptr< FWRepresentationCheckerBase > iChecker)
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)
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
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 *)
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.
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)
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 &)
std::vector< std::vector< boost::shared_ptr< FWEveView > > > m_views
virtual void setInteractionList(FWInteractionList *, const std::string &)
FWViewType::EType typeId() const