CMS 3D CMS Logo

FWEveViewManager.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWEveViewManager
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Chris Jones, Alja Mrak-Tadel
10 // Created: Thu Mar 18 14:11:32 CET 2010
11 //
12 
13 // system include files
14 
15 #include <functional>
16 
17 // user include files
18 #include "TEveManager.h"
19 #include "TEveSelection.h"
20 #include "TEveScene.h"
21 #include "TEveViewer.h"
22 #include "TEveCalo.h"
23 #include "TEveGedEditor.h"
24 #include "TGListTree.h"
25 #include "TGeoManager.h"
26 #include "TExMap.h"
27 #include "TEnv.h"
28 
38 
39 // PB
46 
47 // viewes
55 
58 
59 class FWViewContext;
60 
61 // sentry class block TEveSelection signals when call TEveSelection::Remove/AddElement and
62 // when process its callbacks
64 public:
65  EveSelectionSentry() { m_blocked = gEve->GetSelection()->BlockSignals(true); }
66  ~EveSelectionSentry() { gEve->GetSelection()->BlockSignals(m_blocked); }
67 
68 private:
69  bool m_blocked;
70 };
71 
72 //
73 //
74 // constants, enums and typedefs
75 //
76 //
77 // constructors and destructor
78 //
80  // builders
81  std::set<std::string> builders;
82 
83  std::vector<edmplugin::PluginInfo> available = FWProxyBuilderFactory::get()->available();
84  std::transform(available.begin(),
85  available.end(),
86  std::inserter(builders, builders.begin()),
87  std::bind(&edmplugin::PluginInfo::name_, std::placeholders::_1));
88 
91  available =
93  std::transform(available.begin(),
94  available.end(),
95  std::inserter(builders, builders.begin()),
96  std::bind(&edmplugin::PluginInfo::name_, std::placeholders::_1));
97  }
98 
99  for (std::set<std::string>::iterator it = builders.begin(), itEnd = builders.end(); it != itEnd; ++it) {
100  std::string::size_type first = it->find_first_of('@') + 1;
101  std::string purpose = it->substr(first, it->find_last_of('@') - first);
102 
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());
106  m_typeToBuilder[purpose].push_back(BuilderInfo(*it, viewTypes));
107  }
108 
110 
111  // view construction called via GUI mng
113  std::bind(&FWEveViewManager::buildView, this, std::placeholders::_1, std::placeholders::_2);
114  for (int i = 0; i < FWViewType::kTypeSize; i++) {
116  continue;
118  }
119 
120  // signal
121  gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_Master);
122  TEveSelection* eveSelection = gEve->GetSelection();
123  eveSelection->SetPickToSelect(TEveSelection::kPS_Master);
124  eveSelection->Connect("SelectionAdded(TEveElement*)", "FWEveViewManager", this, "selectionAdded(TEveElement*)");
125  eveSelection->Connect("SelectionRepeated(TEveElement*)", "FWEveViewManager", this, "selectionAdded(TEveElement*)");
126  eveSelection->Connect("SelectionRemoved(TEveElement*)", "FWEveViewManager", this, "selectionRemoved(TEveElement*)");
127  eveSelection->Connect("SelectionCleared()", "FWEveViewManager", this, "selectionCleared()");
128 
129  gEve->GetHighlight()->Connect(
130  "SelectionAdded(TEveElement*)", "FWEveViewManager", this, "highlightAdded(TEveElement*)");
131  gEve->GetHighlight()->Connect(
132  "SelectionRepeated(TEveElement*)", "FWEveViewManager", this, "highlightAdded(TEveElement*)");
133 
134  TGeoManager::SetVerboseLevel(0);
135 }
136 
138 
139 //
140 // member functions
141 //
142 
143 //______________________________________________________________________________
144 
150 void addElements(const FWEventItem* item, FWEveView* view, int viewType, TEveElementList* product) {
151  if (FWViewType::isProjected(viewType)) {
152  FWRPZView* rpzView = dynamic_cast<FWRPZView*>(view);
153  assert(rpzView);
154  rpzView->importElements(product, item->layer(), rpzView->eventScene());
155  } else {
156  view->eventScene()->AddElement(product);
157  }
158 }
159 
175  TypeToBuilder::iterator itFind = m_typeToBuilder.find(iItem->purpose());
176 
177  if (itFind == m_typeToBuilder.end())
178  return;
179 
180  std::vector<BuilderInfo>& blist = itFind->second;
181 
182  std::string bType;
183  bool bIsSimple;
184  for (size_t bii = 0, bie = blist.size(); bii != bie; ++bii) {
185  // 1.
186  BuilderInfo& info = blist[bii];
187  info.classType(bType, bIsSimple);
188  if (bIsSimple) {
189  unsigned int distance = 1;
190  edm::TypeWithDict modelType(*(iItem->modelType()->GetTypeInfo()));
191  if (!FWSimpleRepresentationChecker::inheritsFrom(modelType, bType, distance)) {
192  // printf("PB does not matche itemType (%s) !!! EDproduct %s %s\n", info.m_name.c_str(), iItem->modelType()->GetTypeInfo()->name(), bType.c_str() );
193  continue;
194  }
195  } else {
196  std::string itype = iItem->type()->GetTypeInfo()->name();
197  if (itype != bType) {
198  // printf("PB does not match modeType (%s)!!! EDproduct %s %s\n", info.m_name.c_str(), itype.c_str(), bType.c_str() );
199  continue;
200  }
201  }
202 
203  std::string builderName = info.m_name;
204  int builderViewBit = info.m_viewBit;
205 
206  std::shared_ptr<FWProxyBuilderBase> builder;
207  try {
208  builder = std::shared_ptr<FWProxyBuilderBase>{FWProxyBuilderFactory::get()->create(builderName)};
209 
210  } catch (std::exception& exc) {
212  << "FWEveViewManager::newItem ignoring the following exception (probably edmplugincache mismatch):"
213  << std::endl
214  << exc.what();
215  }
216  if (!builder)
217  continue;
218 
219  // 2.
220  // printf("FWEveViewManager::makeProxyBuilderFor NEW builder %s \n", builderName.c_str());
221 
222  builder->setItem(iItem);
223  iItem->changed_.connect(std::bind(&FWEveViewManager::modelChanges, this, std::placeholders::_1));
224  iItem->goingToBeDestroyed_.connect(std::bind(&FWEveViewManager::removeItem, this, std::placeholders::_1));
225  iItem->itemChanged_.connect(std::bind(&FWEveViewManager::itemChanged, this, std::placeholders::_1));
226 
227  // 3.
228  // This calud be opaque to the user. I would pass a reference to the m_interactionLists to
229  // FWProxyBuilderBase::setInteractionList and handle different case differently.
230  if (builder->willHandleInteraction() == false) {
231  typedef std::map<const FWEventItem*, FWInteractionList*>::iterator Iterator;
232  std::pair<Iterator, bool> t = m_interactionLists.insert(std::make_pair(iItem, (FWInteractionList*)nullptr));
233 
234  if (t.second == true)
235  t.first->second = new FWInteractionList(iItem);
236  // printf(">>> builder %s add list %p \n", iItem->name().c_str(), il); fflush(stdout);
237  builder->setInteractionList(t.first->second, iItem->purpose());
238  }
239 
240  builder->setHaveWindow(haveViewForBit(builderViewBit));
241 
242  // 4.
243  for (size_t viewType = 0; viewType < FWViewType::kTypeSize; ++viewType) {
244  if (((1 << viewType) & builderViewBit) == 0)
245  continue;
246 
248 
249  // printf("%s builder %s supportsd view %s \n", iItem->name().c_str(), builderName.c_str(), FWViewType::idToName(viewType).c_str());
250  if (builder->havePerViewProduct((FWViewType::EType)viewType)) {
251  for (size_t i = 0, e = m_views[viewType].size(); i != e; ++i) {
252  FWEveView* view = m_views[viewType][i].get();
253  TEveElementList* product = builder->createProduct(type, view->viewContext());
254  addElements(iItem, view, viewType, product);
255  }
256  } else {
257  TEveElementList* product = builder->createProduct(type, nullptr);
258 
259  for (size_t i = 0, e = m_views[viewType].size(); i != e; ++i)
260  addElements(iItem, m_views[viewType][i].get(), viewType, product);
261  }
262  }
263 
264  m_builders[builderViewBit].emplace_back(std::move(builder));
265  } // loop views
266 }
267 
268 //______________________________________________________________________________
269 FWViewBase* FWEveViewManager::buildView(TEveWindowSlot* iParent, const std::string& viewName) {
271  for (int i = 0; i < FWViewType::kTypeSize; ++i) {
272  if (viewName == FWViewType::idToName(i)) {
274  break;
275  }
276  }
277 
278  std::shared_ptr<FWEveView> view;
279  switch (type) {
280  case FWViewType::k3D:
281  view.reset(new FW3DView(iParent, type));
282  break;
283  case FWViewType::kISpy:
284  view.reset(new FWISpyView(iParent, type));
285  break;
286  case FWViewType::kRhoPhi:
287  case FWViewType::kRhoZ:
289  view.reset(new FWRPZView(iParent, type));
290  break;
291  case FWViewType::kLego:
293  view.reset(new FWEveLegoView(iParent, type));
294  break;
295  case FWViewType::kLegoHF:
296  view.reset(new FWHFView(iParent, type));
297  break;
299  view.reset(new FWGlimpseView(iParent, type));
300  break;
301  default:
302  break;
303  }
304 
305  m_views[type].push_back(std::shared_ptr<FWEveView>(view));
306  return finishViewCreate(m_views[type].back());
307 }
308 
309 FWEveView* FWEveViewManager::finishViewCreate(std::shared_ptr<FWEveView> view) {
310  // printf("new view %s added \n", view->typeName().c_str());
311  gEve->DisableRedraw();
312 
313  // set geometry and calo data
314  view->setContext(context());
315 
317 
318  // set proxies have a window falg
319  int viewerBit = 1 << view->typeId();
320  if (m_views[view->typeId()].size() == 1) {
321  for (std::map<int, BuilderVec>::iterator i = m_builders.begin(); i != m_builders.end(); ++i) {
322  int builderViewBit = i->first;
323  BuilderVec& bv = i->second;
324  if (viewerBit == (builderViewBit & viewerBit)) {
325  for (BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt) {
326  (*bIt)->setHaveWindow(true);
327  }
328  }
329  }
330  }
331 
332  FWRPZView* rpzView = dynamic_cast<FWRPZView*>(view.get());
333  for (std::map<int, BuilderVec>::iterator i = m_builders.begin(); i != m_builders.end(); ++i) {
334  int builderViewBit = i->first;
335  BuilderVec& bv = i->second;
336  if (viewerBit == (builderViewBit & viewerBit)) {
337  for (BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt) {
338  // it is ok to call create even for shared productsm since
339  // builder map key garanties that
340  TEveElementList* product = (*bIt)->createProduct(view->typeId(), view->viewContext());
341 
342  if ((*bIt)->havePerViewProduct((FWViewType::EType)view->typeId())) {
343  // view owned
344  (*bIt)->build();
345  if (rpzView) {
346  rpzView->importElements(product, (*bIt)->item()->layer(), rpzView->ownedProducts());
347  } else {
348  view->ownedProducts()->AddElement(product);
349  }
350  } else {
351  // shared
352  if (rpzView) {
353  rpzView->importElements(product, (*bIt)->item()->layer(), rpzView->eventScene());
354  } else {
355  view->eventScene()->AddElement(product);
356  }
357  }
358  }
359  }
360  }
361 
362  view->beingDestroyed_.connect(std::bind(&FWEveViewManager::beingDestroyed, this, std::placeholders::_1));
363 
364  view->setupEnergyScale(); // notify PB for energy scale
365 
366  gEve->EnableRedraw();
367  view->viewerGL()->UpdateScene();
368  gEve->Redraw3D();
369 
370  return view.get();
371 }
372 
374  FWEveView* view = (FWEveView*)vb;
375  int typeId = view->typeId();
376 
377  int viewerBit = 1 << typeId;
378  int nviews = m_views[typeId].size();
379  for (std::map<int, BuilderVec>::iterator i = m_builders.begin(); i != m_builders.end(); ++i) {
380  int builderBit = i->first;
381  if (viewerBit == (builderBit & viewerBit)) // check only in case if connected
382  {
383  BuilderVec& bv = i->second;
384 
385  // remove view-owned product
386  if (viewerBit == (builderBit & viewerBit)) {
387  for (BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt)
388  (*bIt)->removePerViewProduct(view->typeId(), view->viewContext());
389  }
390 
391  // and setup proxy builders have-a-window flag
392  if (nviews == 1) {
393  if (!haveViewForBit(builderBit)) {
394  if (viewerBit == (builderBit & viewerBit)) {
395  for (BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt)
396  (*bIt)->setHaveWindow(false);
397  }
398  }
399  }
400  }
401  }
402 
403  for (EveViewVec_it i = m_views[typeId].begin(); i != m_views[typeId].end(); ++i) {
404  if (i->get() == vb) {
405  m_views[typeId].erase(i);
406  break;
407  }
408  }
409 }
410 
411 //______________________________________________________________________________
412 
413 void FWEveViewManager::modelChangesComing() { gEve->DisableRedraw(); }
414 
415 void FWEveViewManager::modelChangesDone() { gEve->EnableRedraw(); }
416 
419  FWModelId id = *(iIds.begin());
420  const FWEventItem* item = id.item();
421 
422  // in standard case new elements can be build in case of change of visibility
423  // and in non-standard case (e.g. calo towers) PB's modelChages handles all changes
424  bool itemHaveWindow = false;
425  for (std::map<int, BuilderVec>::iterator i = m_builders.begin(); i != m_builders.end(); ++i) {
426  for (size_t bi = 0, be = i->second.size(); bi != be; ++bi) {
427  FWProxyBuilderBase* builder = i->second[bi].get();
428  if (builder->getHaveWindow() && builder->item() == item) {
429  builder->modelChanges(iIds);
430  itemHaveWindow = true;
431  }
432  }
433  }
434 
435  if (!itemHaveWindow)
436  return;
437 
439 
440  std::map<const FWEventItem*, FWInteractionList*>::iterator it = m_interactionLists.find(item);
441  if (it != m_interactionLists.end()) {
442  if (!it->second->empty())
443  it->second->modelChanges(iIds);
444  }
445 }
446 
453  if (!item)
454  return;
455 
456  bool itemHaveWindow = false;
457 
458  for (std::map<int, BuilderVec>::iterator i = m_builders.begin(); i != m_builders.end(); ++i) {
459  for (size_t bi = 0, be = i->second.size(); bi != be; ++bi) {
460  FWProxyBuilderBase* builder = i->second[bi].get();
461 
462  if (builder->item() != item)
463  continue;
464 
465  builder->itemChanged(item);
466  itemHaveWindow |= builder->getHaveWindow();
467  }
468  }
469 
470  if (!itemHaveWindow)
471  return;
472 
473  std::map<const FWEventItem*, FWInteractionList*>::iterator it = m_interactionLists.find(item);
474  if (it != m_interactionLists.end()) {
475  if (!it->second->empty())
476  it->second->itemChanged();
477  }
478 }
479 
484 
485  std::map<const FWEventItem*, FWInteractionList*>::iterator it = m_interactionLists.find(item);
486  if (it != m_interactionLists.end()) {
487  delete it->second;
488  m_interactionLists.erase(it);
489  }
490 
491  for (std::map<int, BuilderVec>::iterator i = m_builders.begin(); i != m_builders.end(); ++i) {
492  BuilderVec_it bIt = i->second.begin();
493  while (bIt != i->second.end()) {
494  if ((*bIt)->item() == item) {
495  // TODO caching of proxy builders
496  (*bIt)->itemBeingDestroyed(item);
497  bIt = i->second.erase(bIt);
498  } else {
499  ++bIt;
500  }
501  }
502  }
503 }
504 
507  x->commonPrefs()->getEnergyScale()->parameterChanged_.connect(
509  x->commonPrefs()->eventCenterChanged_.connect(std::bind(&FWEveViewManager::eventCenterChanged, this));
510 }
511 
513  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
514  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i) {
515  if ((*i)->isEnergyScaleGlobal()) {
516  (*i)->setupEnergyScale();
517  }
518  }
519  }
520 }
521 
523  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
524  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i) {
525  (*i)->setupEventCenter();
526  }
527  }
528 }
529 
531  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
532  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
533  (*i)->setBackgroundColor(colorManager().background());
534  }
535 }
536 
537 //______________________________________________________________________________
539  // Prevent registration of redraw timer, full redraw is done in
540  // FWEveViewManager::eventEnd().
541  gEve->EnforceTimerActive(kTRUE);
542  gEve->DisableRedraw();
543 
545 
546  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
547  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
548  (*i)->eventBegin();
549  }
550 }
551 
553  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
554  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
555  (*i)->eventEnd();
556  }
557 
558  // What follows is a copy of TEveManager::DoRedraw3D() with the difference that
559  // we have full control over execution of GL view rendering. In particular:
560  // - optionally delay buffer swapping so they can all be swapped together;
561  // - we could render into FBO once and then use this to be put on screen
562  // and saved into an image file.
563 
564  {
565  TEveElement::List_t scenes;
566  Long64_t key, value;
567  TExMapIter stamped_elements(gEve->PtrToStampedElements());
568  while (stamped_elements.Next(key, value)) {
569  TEveElement* el = reinterpret_cast<TEveElement*>(key);
570  if (el->GetChangeBits() & TEveElement::kCBVisibility) {
571  el->CollectSceneParents(scenes);
572  }
573  }
574  gEve->ScenesChanged(scenes);
575  }
576 
577  // Process changes in scenes.
578  gEve->GetScenes()->ProcessSceneChanges(kFALSE, gEve->PtrToStampedElements());
579 
580  // To synchronize buffer swapping set swap_on_render to false.
581  // Note that this costs 25-40% extra time with 4 views, depending on V-sync settings.
582  // Tested with NVIDIA 343.22.
583  const bool swap_on_render = !s_syncAllViews;
584 
585  // Loop over viewers, swap buffers if swap_on_render is true.
586  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
587  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
588  (*i)->fwViewerGL()->DrawHiLod(swap_on_render);
589  }
590 
591  // Swap buffers if they were not swapped before.
592  if (!swap_on_render) {
593  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
594  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
595  (*i)->fwViewerGL()->JustSwap();
596  }
597  }
598 
599  gEve->GetViewers()->RepaintChangedViewers(kFALSE, kFALSE);
600 
601  {
602  Long64_t key, value;
603  TExMapIter stamped_elements(gEve->PtrToStampedElements());
604  while (stamped_elements.Next(key, value)) {
605  TEveElement* el = reinterpret_cast<TEveElement*>(key);
606  if (gEve->GetEditor()->GetModel() == el->GetEditorObject("FWEveViewManager::eventEnd"))
607  gEve->EditElement(el);
608  TEveGedEditor::ElementChanged(el);
609 
610  el->ClearStamps();
611  }
612  }
613  gEve->PtrToStampedElements()->Delete();
614 
615  gEve->GetListTree()->ClearViewPort(); // Fix this when several list-trees can be added.
616 
617  gEve->EnableRedraw();
618  gEve->EnforceTimerActive(kFALSE);
619 }
620 
621 //______________________________________________________________________________
622 
625 FWFromEveSelectorBase* getSelector(TEveElement* iElement) {
626  if (!iElement)
627  return nullptr;
628 
629  //std::cout <<" non null"<<std::endl;
630  void* userData = iElement->GetUserData();
631  //std::cout <<" user data "<<userData<<std::endl;
632  if (!userData)
633  return nullptr;
634 
635  //std::cout <<" have userData"<<std::endl;
636  //std::cout <<" calo"<<std::endl;
638  return reinterpret_cast<FWFromEveSelectorBase*>(userData);
639 }
640 
641 void FWEveViewManager::selectionAdded(TEveElement* iElement) {
642  FWFromEveSelectorBase* selector = getSelector(iElement);
643  if (selector)
644  selector->doSelect();
645 }
646 
647 void FWEveViewManager::selectionRemoved(TEveElement* iElement) {
648  FWFromEveSelectorBase* selector = getSelector(iElement);
649  if (selector)
650  selector->doUnselect();
651 }
652 
654 
655 //
656 // const member functions
657 //
658 
660  // needed for add collection GUI
661  FWTypeToRepresentations returnValue;
662  const static std::string kFullFrameWorkPBExtension = "FullFramework";
663  for (TypeToBuilder::const_iterator it = m_typeToBuilder.begin(), itEnd = m_typeToBuilder.end(); it != itEnd; ++it) {
664  std::vector<BuilderInfo> blist = it->second;
665  for (size_t bii = 0, bie = blist.size(); bii != bie; ++bii) {
666  BuilderInfo& info = blist[bii];
667 
668  if (context().getHidePFBuilders()) {
669  const static std::string pfExt = "PF ";
670  if (std::string::npos != info.m_name.find(pfExt))
671  continue;
672  }
673 
674  unsigned int bitPackedViews = info.m_viewBit;
675  bool representsSubPart = (info.m_name.substr(info.m_name.find_first_of('@') - 1, 1) == "!");
676  size_t extp = info.m_name.rfind(kFullFrameWorkPBExtension);
677  bool FFOnly = (extp != std::string::npos);
678 
680  bool isSimple;
681  info.classType(name, isSimple);
682  if (isSimple) {
683  returnValue.add(std::make_shared<FWSimpleRepresentationChecker>(
684  name, it->first, bitPackedViews, representsSubPart, FFOnly));
685  } else {
686  returnValue.add(std::make_shared<FWEDProductRepresentationChecker>(
687  name, it->first, bitPackedViews, representsSubPart, FFOnly));
688  }
689  }
690  }
691  return returnValue;
692 }
693 
696  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
697  if ((bit & (1 << t)) && !m_views[t].empty())
698  return true;
699  }
700  // printf("have %d view for bit %d \n", haveView, bit);
701  return false;
702 }
703 
705  const std::string kSimple("simple#");
706  simple = (m_name.substr(0, kSimple.size()) == kSimple);
707  if (simple) {
708  typeName = m_name.substr(kSimple.size(), m_name.find_first_of('@') - kSimple.size() - 1);
709  } else {
710  typeName = m_name.substr(0, m_name.find_first_of('@') - 1);
711  }
712 }
713 
714 /*
715 AMT: temporary workaround for using TEveCaloDataHist instead of
716 TEveCaloDataVec.
717 
718  */
719 
720 #include "TH2F.h"
721 #include "TAxis.h"
722 #include "TEveCaloData.h"
723 
724 void FWEveViewManager::highlightAdded(TEveElement* iElement) {
725  bool blocked = gEve->GetHighlight()->BlockSignals(true);
726 
727  if (iElement == context().getCaloData()) {
728  TEveCaloData::vCellId_t& hlist = context().getCaloData()->GetCellsHighlighted();
729  std::set<TEveCaloData::CellId_t> hset;
730 
731  int etaBin, phiBin, w, newPhiBin, tower;
732  TH2F* hist = context().getCaloData()->GetHist(0);
733  TAxis* etaAxis = hist->GetXaxis();
734  int nBinsX = etaAxis->GetNbins() + 2;
735 
736  for (TEveCaloData::vCellId_i i = hlist.begin(); i != hlist.end(); ++i) {
737  hist->GetBinXYZ((*i).fTower, etaBin, phiBin, w);
738  if (TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 4.71475) {
739  newPhiBin = ((phiBin + 1) / 4) * 4 - 1;
740  if (newPhiBin <= 0)
741  newPhiBin = 71;
742 
743  tower = etaBin + newPhiBin * nBinsX;
744  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
745  tower += nBinsX;
746  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
747  tower += nBinsX;
748 
749  if (newPhiBin == 71)
750  tower = etaBin + 1 * nBinsX;
751 
752  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
753  tower += nBinsX;
754  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
755  } else if (TMath::Abs(etaAxis->GetBinCenter(etaBin)) > 1.747650) {
756  newPhiBin = ((phiBin + 1) / 2) * 2 - 1;
757  tower = etaBin + newPhiBin * nBinsX;
758  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
759  tower += nBinsX;
760  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
761  } else {
762  hset.insert(*i);
763  }
764  }
765 
766  // edit calo data list
767  hlist.clear();
768  for (std::set<TEveCaloData::CellId_t>::iterator it = hset.begin(); it != hset.end(); ++it) {
769  hlist.push_back(*it);
770  }
771  context().getCaloData()->CellSelectionChanged();
772  }
773 
774  gEve->GetHighlight()->BlockSignals(blocked);
775 }
const CategoryToInfos & categoryToInfos() const
Definition: PluginManager.h:82
size
Write out results.
FWSelectionManager * selectionManager() const
Definition: Context.h:54
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views
static const TGPicture * info(bool iBackgroundIsBlack)
TEveScene * eventScene()
Definition: FWEveView.h:79
void resetMaxEtAndEnergy() const
Definition: Context.cc:174
virtual void doUnselect()=0
std::vector< std::shared_ptr< FWEveView > >::iterator EveViewVec_it
void eventBegin() override
T w() const
FWColorManager & colorManager() const
void selectionAdded(TEveElement *)
void itemChanged(const FWEventItem *)
bool haveViewForBit(int) const
FWItemChangeSignal goingToBeDestroyed_
Definition: FWEventItem.h:197
void newItem(const FWEventItem *) override
TypeToBuilder m_typeToBuilder
Color_t background() const
TEveCaloDataHist * getCaloData() const
Definition: Context.h:69
assert(be >=bs)
uint16_t size_type
static bool s_syncAllViews
void add(std::shared_ptr< FWRepresentationCheckerBase > iChecker)
TGeoIterator Iterator
FWEveViewManager(FWGUIManager *)
void registerViewBuilder(const std::string &iName, ViewBuildFunctor &iBuilder)
bool getHidePFBuilders() const
Definition: Context.h:80
FWFromEveSelectorBase * getSelector(TEveElement *iElement)
static bool isProjected(int)
Definition: FWViewType.cc:100
const TClass * modelType() const
Definition: FWEventItem.cc:464
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
bool getHaveWindow() const
FWItemChangeSignal itemChanged_
Definition: FWEventItem.h:181
void addElements(const FWEventItem *item, FWEveView *view, int viewType, TEveElementList *product)
double f[11][100]
void selectionRemoved(TEveElement *)
void highlightAdded(TEveElement *)
void modelChanges(const FWModelIds &iIds)
void beingDestroyed(const FWViewBase *)
Definition: value.py:1
std::map< int, BuilderVec > m_builders
std::function< FWViewBase *(TEveWindowSlot *, const std::string &)> ViewBuildFunctor
Definition: FWGUIManager.h:98
FWViewBase * buildView(TEveWindowSlot *iParent, const std::string &type)
void setContext(const fireworks::Context *) override
virtual void doSelect()=0
void classType(std::string &, bool &) const
#define fwLog(_level_)
Definition: fwLog.h:45
const TClass * type() const
Definition: FWEventItem.cc:437
void colorsChanged() override
std::map< const FWEventItem *, FWInteractionList * > m_interactionLists
void importElements(TEveElement *iProjectableChild, float layer, TEveElement *iProjectedParent=nullptr)
Definition: FWRPZView.cc:290
BuilderVec::iterator BuilderVec_it
FWModelChangeSignal changed_
Definition: FWEventItem.h:178
std::vector< std::shared_ptr< FWProxyBuilderBase > > BuilderVec
static const std::string & idToName(int)
Definition: FWViewType.cc:72
std::string name_
Definition: PluginInfo.h:29
TEveElement * ownedProducts()
Definition: FWEveView.h:82
static Bool_t setColorSetViewer(TGLViewer *, Color_t)
float x
virtual void removeItem(const FWEventItem *)
const std::string & purpose() const
Definition: FWEventItem.cc:439
FWTypeToRepresentations supportedTypesAndRepresentations() const override
void eventEnd() override
#define get
void modelChangesDone() override
static PluginManager * get()
const FWEventItem * item() const
void modelChangesComing() override
def move(src, dest)
Definition: eostools.py:511
void itemChanged(const FWEventItem *)
FWColorManager * colorManager() const
Definition: Context.h:58
const fireworks::Context & context() const
void modelChanges(const FWModelIds &)
unsigned transform(const HcalDetId &id, unsigned transformCode)