18 #include "TEveManager.h"
19 #include "TEveSelection.h"
20 #include "TEveScene.h"
21 #include "TEveViewer.h"
23 #include "TEveGedEditor.h"
24 #include "TGListTree.h"
25 #include "TGeoManager.h"
86 std::inserter(builders, builders.begin()),
95 std::inserter(builders, builders.begin()),
99 for (std::set<std::string>::iterator it = builders.begin(), itEnd = builders.end(); it != itEnd; ++it) {
103 first = it->find_last_of(
'@') + 1;
105 int viewTypes = atoi(view_str.c_str());
122 gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_Master);
123 TEveSelection* eveSelection = gEve->GetSelection();
124 eveSelection->SetPickToSelect(TEveSelection::kPS_Master);
125 eveSelection->Connect(
"SelectionAdded(TEveElement*)",
"FWEveViewManager",
this,
"selectionAdded(TEveElement*)");
126 eveSelection->Connect(
"SelectionRepeated(TEveElement*)",
"FWEveViewManager",
this,
"selectionAdded(TEveElement*)");
127 eveSelection->Connect(
"SelectionRemoved(TEveElement*)",
"FWEveViewManager",
this,
"selectionRemoved(TEveElement*)");
128 eveSelection->Connect(
"SelectionCleared()",
"FWEveViewManager",
this,
"selectionCleared()");
130 gEve->GetHighlight()->Connect(
131 "SelectionAdded(TEveElement*)",
"FWEveViewManager",
this,
"highlightAdded(TEveElement*)");
132 gEve->GetHighlight()->Connect(
133 "SelectionRepeated(TEveElement*)",
"FWEveViewManager",
this,
"highlightAdded(TEveElement*)");
135 TGeoManager::SetVerboseLevel(0);
181 std::vector<BuilderInfo>& blist = itFind->second;
185 for (
size_t bii = 0, bie = blist.size(); bii != bie; ++bii) {
198 if (itype != bType) {
207 std::shared_ptr<FWProxyBuilderBase> builder;
213 <<
"FWEveViewManager::newItem ignoring the following exception (probably edmplugincache mismatch):"
223 builder->setItem(iItem);
231 if (builder->willHandleInteraction() ==
false) {
232 typedef std::map<const FWEventItem*, FWInteractionList*>::iterator
Iterator;
235 if (t.second ==
true)
238 builder->setInteractionList(t.first->second, iItem->
purpose());
245 if (((1 << viewType) & builderViewBit) == 0)
254 TEveElementList* product = builder->createProduct(type, view->
viewContext());
258 TEveElementList* product = builder->createProduct(type,
nullptr);
279 std::shared_ptr<FWEveView> view;
282 view.reset(
new FW3DView(iParent, type));
290 view.reset(
new FWRPZView(iParent, type));
297 view.reset(
new FWHFView(iParent, type));
306 m_views[
type].push_back(std::shared_ptr<FWEveView>(view));
312 gEve->DisableRedraw();
320 int viewerBit = 1 << view->typeId();
321 if (
m_views[view->typeId()].size() == 1) {
323 int builderViewBit =
i->first;
325 if (viewerBit == (builderViewBit & viewerBit)) {
326 for (
BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt) {
327 (*bIt)->setHaveWindow(
true);
335 int builderViewBit =
i->first;
337 if (viewerBit == (builderViewBit & viewerBit)) {
338 for (
BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt) {
341 TEveElementList* product = (*bIt)->createProduct(view->typeId(), view->viewContext());
349 view->ownedProducts()->AddElement(product);
356 view->eventScene()->AddElement(product);
365 view->setupEnergyScale();
367 gEve->EnableRedraw();
368 view->viewerGL()->UpdateScene();
376 int typeId = view->
typeId();
378 int viewerBit = 1 << typeId;
379 int nviews =
m_views[typeId].size();
381 int builderBit =
i->first;
382 if (viewerBit == (builderBit & viewerBit))
387 if (viewerBit == (builderBit & viewerBit)) {
395 if (viewerBit == (builderBit & viewerBit)) {
397 (*bIt)->setHaveWindow(
false);
405 if (
i->get() == vb) {
425 bool itemHaveWindow =
false;
427 for (
size_t bi = 0,
be =
i->second.size(); bi !=
be; ++bi) {
431 itemHaveWindow =
true;
441 std::map<const FWEventItem*, FWInteractionList*>::iterator it =
m_interactionLists.find(item);
443 if (!it->second->empty())
444 it->second->modelChanges(iIds);
457 bool itemHaveWindow =
false;
460 for (
size_t bi = 0,
be =
i->second.size(); bi !=
be; ++bi) {
474 std::map<const FWEventItem*, FWInteractionList*>::iterator it =
m_interactionLists.find(item);
476 if (!it->second->empty())
477 it->second->itemChanged();
486 std::map<const FWEventItem*, FWInteractionList*>::iterator it =
m_interactionLists.find(item);
494 while (bIt !=
i->second.end()) {
495 if ((*bIt)->item() ==
item) {
497 (*bIt)->itemBeingDestroyed(item);
498 bIt =
i->second.erase(bIt);
516 if ((*i)->isEnergyScaleGlobal()) {
517 (*i)->setupEnergyScale();
526 (*i)->setupEventCenter();
542 gEve->EnforceTimerActive(kTRUE);
543 gEve->DisableRedraw();
566 TEveElement::List_t scenes;
568 TExMapIter stamped_elements(gEve->PtrToStampedElements());
569 while (stamped_elements.Next(key, value)) {
570 TEveElement* el =
reinterpret_cast<TEveElement*
>(
key);
571 if (el->GetChangeBits() & TEveElement::kCBVisibility) {
572 el->CollectSceneParents(scenes);
575 gEve->ScenesChanged(scenes);
579 gEve->GetScenes()->ProcessSceneChanges(kFALSE, gEve->PtrToStampedElements());
589 (*i)->fwViewerGL()->DrawHiLod(swap_on_render);
593 if (!swap_on_render) {
596 (*i)->fwViewerGL()->JustSwap();
600 gEve->GetViewers()->RepaintChangedViewers(kFALSE, kFALSE);
604 TExMapIter stamped_elements(gEve->PtrToStampedElements());
605 while (stamped_elements.Next(key, value)) {
606 TEveElement* el =
reinterpret_cast<TEveElement*
>(
key);
607 if (gEve->GetEditor()->GetModel() == el->GetEditorObject(
"FWEveViewManager::eventEnd"))
608 gEve->EditElement(el);
609 TEveGedEditor::ElementChanged(el);
614 gEve->PtrToStampedElements()->Delete();
616 gEve->GetListTree()->ClearViewPort();
618 gEve->EnableRedraw();
619 gEve->EnforceTimerActive(kFALSE);
631 void* userData = iElement->GetUserData();
663 const static std::string kFullFrameWorkPBExtension =
"FullFramework";
665 std::vector<BuilderInfo> blist = it->second;
666 for (
size_t bii = 0, bie = blist.size(); bii != bie; ++bii) {
671 if (std::string::npos != info.
m_name.find(pfExt))
675 unsigned int bitPackedViews = info.
m_viewBit;
676 bool representsSubPart = (info.
m_name.substr(info.
m_name.find_first_of(
'@') - 1, 1) ==
"!");
677 size_t extp = info.
m_name.rfind(kFullFrameWorkPBExtension);
678 bool FFOnly = (extp != std::string::npos);
684 returnValue.
add(std::make_shared<FWSimpleRepresentationChecker>(
685 name, it->first, bitPackedViews, representsSubPart, FFOnly));
687 returnValue.
add(std::make_shared<FWEDProductRepresentationChecker>(
688 name, it->first, bitPackedViews, representsSubPart, FFOnly));
707 simple = (
m_name.substr(0, kSimple.size()) == kSimple);
709 typeName =
m_name.substr(kSimple.size(),
m_name.find_first_of(
'@') - kSimple.size() - 1);
711 typeName =
m_name.substr(0,
m_name.find_first_of(
'@') - 1);
723 #include "TEveCaloData.h"
726 bool blocked = gEve->GetHighlight()->BlockSignals(
true);
728 if (iElement ==
context().getCaloData()) {
730 std::set<TEveCaloData::CellId_t> hset;
734 TAxis* etaAxis = hist->GetXaxis();
735 int nBinsX = etaAxis->GetNbins() + 2;
737 for (TEveCaloData::vCellId_i
i = hlist.begin();
i != hlist.end(); ++
i) {
738 hist->GetBinXYZ((*i).fTower, etaBin, phiBin, w);
739 if (TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 4.71475) {
740 newPhiBin = ((phiBin + 1) / 4) * 4 - 1;
744 tower = etaBin + newPhiBin * nBinsX;
745 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
747 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
751 tower = etaBin + 1 * nBinsX;
753 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
755 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
756 }
else if (TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 1.747650) {
757 newPhiBin = ((phiBin + 1) / 2) * 2 - 1;
758 tower = etaBin + newPhiBin * nBinsX;
759 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
761 hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
769 for (std::set<TEveCaloData::CellId_t>::iterator it = hset.begin(); it != hset.end(); ++it) {
770 hlist.push_back(*it);
775 gEve->GetHighlight()->BlockSignals(blocked);
const CategoryToInfos & categoryToInfos() const
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views
Color_t background() const
const fireworks::Context & context() const
virtual void doUnselect()=0
static const char category[]
std::vector< std::shared_ptr< FWEveView > >::iterator EveViewVec_it
void eventBegin() override
FWColorManager * colorManager() const
void globalEnergyScaleChanged()
void selectionAdded(TEveElement *)
void itemChanged(const FWEventItem *)
FWItemChangeSignal goingToBeDestroyed_
void newItem(const FWEventItem *) override
TypeToBuilder m_typeToBuilder
FWColorManager & colorManager() const
static bool s_syncAllViews
void add(std::shared_ptr< FWRepresentationCheckerBase > iChecker)
const FWEventItem * item() const
FWEveViewManager(FWGUIManager *)
void registerViewBuilder(const std::string &iName, ViewBuildFunctor &iBuilder)
FWFromEveSelectorBase * getSelector(TEveElement *iElement)
static bool isProjected(int)
static bool inheritsFrom(const edm::TypeWithDict &iChild, const std::string &iParentTypeName, unsigned int &distance)
FWEveView * finishViewCreate(std::shared_ptr< FWEveView >)
~FWEveViewManager() override
virtual void setContext(const fireworks::Context *x)
std::set< FWModelId > FWModelIds
void resetMaxEtAndEnergy() const
const TClass * type() const
FWItemChangeSignal itemChanged_
bool haveViewForBit(int) const
void addElements(const FWEventItem *item, FWEveView *view, int viewType, TEveElementList *product)
tuple key
prepare the HTCondor submission files and eventually submit them
bool getHidePFBuilders() const
uint16_t const *__restrict__ x
void selectionRemoved(TEveElement *)
void highlightAdded(TEveElement *)
TEveCaloDataHist * getCaloData() const
void modelChanges(const FWModelIds &iIds)
void beingDestroyed(const FWViewBase *)
std::map< int, BuilderVec > m_builders
FWSelectionManager * selectionManager() const
sigc::signal< void()> parameterChanged_
std::function< FWViewBase *(TEveWindowSlot *, const std::string &)> ViewBuildFunctor
FWViewBase * buildView(TEveWindowSlot *iParent, const std::string &type)
void setContext(const fireworks::Context *) override
virtual void doSelect()=0
FWViewContext * viewContext()
void colorsChanged() override
FWViewEnergyScale * getEnergyScale() const
std::map< const FWEventItem *, FWInteractionList * > m_interactionLists
void importElements(TEveElement *iProjectableChild, float layer, TEveElement *iProjectedParent=nullptr)
CmsShowCommon * commonPrefs() const
BuilderVec::iterator BuilderVec_it
FWModelChangeSignal changed_
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
FWTypeToRepresentations supportedTypesAndRepresentations() const override
const std::string & purpose() const
void modelChangesDone() override
static PluginManager * get()
void classType(std::string &, bool &) const
int etaBin(const l1t::HGCalMulticluster *cl)
tuple size
Write out results.
sigc::signal< void(const CmsShowCommon *)> eventCenterChanged_
void modelChangesComing() override
virtual void setContext(const fireworks::Context &x)
void itemChanged(const FWEventItem *)
void modelChanges(const FWModelIds &)
void eventCenterChanged()
FWViewType::EType typeId() const