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 <boost/bind.hpp>
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  boost::bind(&edmplugin::PluginInfo::name_, _1));
88 
91  available =
93  std::transform(available.begin(),
94  available.end(),
95  std::inserter(builders, builders.begin()),
96  boost::bind(&edmplugin::PluginInfo::name_, _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  std::string fullName = *it;
107  m_typeToBuilder[purpose].push_back(BuilderInfo(*it, viewTypes));
108  }
109 
111 
112  // view construction called via GUI mng
113  FWGUIManager::ViewBuildFunctor f = boost::bind(&FWEveViewManager::buildView, this, _1, _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(boost::bind(&FWEveViewManager::modelChanges, this, _1));
224  iItem->goingToBeDestroyed_.connect(boost::bind(&FWEveViewManager::removeItem, this, _1));
225  iItem->itemChanged_.connect(boost::bind(&FWEveViewManager::itemChanged, this, _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(boost::bind(&FWEveViewManager::beingDestroyed, this, _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(
508  boost::bind(&FWEveViewManager::globalEnergyScaleChanged, this));
509  x->commonPrefs()->eventCenterChanged_.connect(boost::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 
695 bool FWEveViewManager::haveViewForBit(int bit) const {
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 }
FWRPZView
Definition: FWRPZView.h:40
FWEveViewManager::eventEnd
void eventEnd() override
Definition: FWEveViewManager.cc:552
hgcalPlots.purpose
purpose
Definition: hgcalPlots.py:1786
HLT_2018_cff.builders
builders
Definition: HLT_2018_cff.py:31156
taus_updatedMVAIds_cff.category
category
Definition: taus_updatedMVAIds_cff.py:30
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
mps_fire.i
i
Definition: mps_fire.py:355
fireworks::Context
Definition: Context.h:41
FWGUIManager
Definition: FWGUIManager.h:94
FWEveViewManager::EveViewVec_it
std::vector< std::shared_ptr< FWEveView > >::iterator EveViewVec_it
Definition: FWEveViewManager.h:102
FWViewType::idToName
static const std::string & idToName(int)
Definition: FWViewType.cc:72
FWEveViewManager::newItem
void newItem(const FWEventItem *) override
Definition: FWEveViewManager.cc:174
FWViewManagerBase
Definition: FWViewManagerBase.h:45
fireworks::Context::resetMaxEtAndEnergy
void resetMaxEtAndEnergy() const
Definition: Context.cc:167
etaBin
int etaBin(const l1t::HGCalMulticluster *cl)
Definition: L1EGammaEEProducer.cc:19
FWViewType::EType
EType
Definition: FWViewType.h:31
FWGUIManager::registerViewBuilder
void registerViewBuilder(const std::string &iName, ViewBuildFunctor &iBuilder)
Definition: FWGUIManager.cc:273
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
FWEveViewManager::haveViewForBit
bool haveViewForBit(int) const
Definition: FWEveViewManager.cc:695
FWEveViewManager::globalEnergyScaleChanged
void globalEnergyScaleChanged()
Definition: FWEveViewManager.cc:512
FWProxyBuilderBase::itemChanged
void itemChanged(const FWEventItem *)
Definition: FWProxyBuilderBase.cc:217
fireworks::Context::colorManager
FWColorManager * colorManager() const
Definition: Context.h:58
FWEveViewManager::modelChangesDone
void modelChangesDone() override
Definition: FWEveViewManager.cc:415
BeamMonitor_cff.phiBin
phiBin
Definition: BeamMonitor_cff.py:75
FWViewManagerBase::colorManager
FWColorManager & colorManager() const
Definition: FWViewManagerBase.cc:123
EveSelectionSentry
Definition: FWEveViewManager.cc:63
FWFromEveSelectorBase::doSelect
virtual void doSelect()=0
FWModelId
Definition: FWModelId.h:28
FWViewType::kRhoZ
Definition: FWViewType.h:33
FWEveLegoView
Definition: FWEveLegoView.h:25
FWProxyBuilderBase.h
FWEventItem::goingToBeDestroyed_
FWItemChangeSignal goingToBeDestroyed_
Definition: FWEventItem.h:197
FWViewType::kTypeSize
Definition: FWViewType.h:46
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:3
FWTypeToRepresentations::add
void add(std::shared_ptr< FWRepresentationCheckerBase > iChecker)
Definition: FWTypeToRepresentations.cc:55
addElements
void addElements(const FWEventItem *item, FWEveView *view, int viewType, TEveElementList *product)
Definition: FWEveViewManager.cc:150
FWEveView::viewContext
FWViewContext * viewContext()
Definition: FWEveView.h:83
cms::cuda::assert
assert(be >=bs)
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:152
FWInteractionList
Definition: FWInteractionList.h:33
electronProducer_cfi.userData
userData
Definition: electronProducer_cfi.py:19
DDAxes::x
FWSimpleRepresentationChecker::inheritsFrom
static bool inheritsFrom(const edm::TypeWithDict &iChild, const std::string &iParentTypeName, unsigned int &distance)
Definition: FWSimpleRepresentationChecker.cc:71
FWViewType::isProjected
static bool isProjected(int)
Definition: FWViewType.cc:100
FWSelectionManager::clearSelection
void clearSelection()
Definition: FWSelectionManager.cc:63
FWEveViewManager.h
dqmdumpme.first
first
Definition: dqmdumpme.py:55
edmplugin::PluginManager::get
static PluginManager * get()
Definition: PluginManager.cc:307
FW3DView
Definition: FW3DView.h:29
FWHFView
Definition: FWHFView.h:28
FWGlimpseView
Definition: FWGlimpseView.h:35
edmplugin::PluginManager::categoryToInfos
const CategoryToInfos & categoryToInfos() const
Definition: PluginManager.h:80
FWViewType::kTableL1
Definition: FWViewType.h:40
FWInteractionList.h
FWEveView::eventScene
TEveScene * eventScene()
Definition: FWEveView.h:79
FWViewBase::typeId
FWViewType::EType typeId() const
Definition: FWViewBase.h:42
FWEveViewManager::~FWEveViewManager
~FWEveViewManager() override
Definition: FWEveViewManager.cc:137
cms::Iterator
TGeoIterator Iterator
Definition: DDFilteredView.h:49
FWEveViewManager::itemChanged
void itemChanged(const FWEventItem *)
Definition: FWEveViewManager.cc:452
FWSelectionManager.h
FWEveViewManager::colorsChanged
void colorsChanged() override
Definition: FWEveViewManager.cc:530
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
FWEveView
Definition: FWEveView.h:53
FWEveViewManager::selectionCleared
void selectionCleared()
Definition: FWEveViewManager.cc:653
Abs
T Abs(T a)
Definition: MathUtil.h:49
FWColorManager.h
compare.hist
hist
Definition: compare.py:376
w
const double w
Definition: UKUtility.cc:23
EveSelectionSentry::~EveSelectionSentry
~EveSelectionSentry()
Definition: FWEveViewManager.cc:66
FWViewType::kLego
Definition: FWViewType.h:36
vertices_cff.x
x
Definition: vertices_cff.py:29
FWEveViewManager::beingDestroyed
void beingDestroyed(const FWViewBase *)
Definition: FWEveViewManager.cc:373
FWViewType::kLegoPFECAL
Definition: FWViewType.h:43
FWEventItem::modelType
const TClass * modelType() const
Definition: FWEventItem.cc:464
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
FWEveViewManager::BuilderVec
std::vector< std::shared_ptr< FWProxyBuilderBase > > BuilderVec
Definition: FWEveViewManager.h:100
FWISpyView
Definition: FWISpyView.h:28
FWEveView::ownedProducts
TEveElement * ownedProducts()
Definition: FWEveView.h:82
OrderedSet.t
t
Definition: OrderedSet.py:90
edmplugin::PluginInfo::name_
std::string name_
Definition: PluginInfo.h:29
FWViewType::kGlimpse
Definition: FWViewType.h:38
FWEveViewManager::selectionRemoved
void selectionRemoved(TEveElement *)
Definition: FWEveViewManager.cc:647
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FWEveViewManager::s_syncAllViews
static bool s_syncAllViews
Definition: FWEveViewManager.h:106
List_t
std::list< Particle > List_t
Definition: Particle.h:174
newFWLiteAna.fullName
fullName
Definition: newFWLiteAna.py:122
FWEveViewManager::BuilderVec_it
BuilderVec::iterator BuilderVec_it
Definition: FWEveViewManager.h:101
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
dqmiodumpindices.typeName
typeName
Definition: dqmiodumpindices.py:33
edm::TypeWithDict
Definition: TypeWithDict.h:38
FWEventItem::itemChanged_
FWItemChangeSignal itemChanged_
Definition: FWEventItem.h:181
FWEveViewManager::finishViewCreate
FWEveView * finishViewCreate(std::shared_ptr< FWEveView >)
Definition: FWEveViewManager.cc:309
FWEveViewManager::BuilderInfo::m_name
std::string m_name
Definition: FWEveViewManager.h:47
FWViewManagerBase::setContext
virtual void setContext(const fireworks::Context *x)
Definition: FWViewManagerBase.h:56
FWEveViewManager::buildView
FWViewBase * buildView(TEveWindowSlot *iParent, const std::string &type)
Definition: FWEveViewManager.cc:269
FWISpyView.h
EveSelectionSentry::m_blocked
bool m_blocked
Definition: FWEveViewManager.cc:69
FWEveViewManager::eventBegin
void eventBegin() override
Definition: FWEveViewManager.cc:538
FWFromEveSelectorBase::doUnselect
virtual void doUnselect()=0
FWHFView.h
value
Definition: value.py:1
FWRPZView.h
fireworks::Context::getHidePFBuilders
bool getHidePFBuilders() const
Definition: Context.h:80
FWEveViewManager::selectionAdded
void selectionAdded(TEveElement *)
Definition: FWEveViewManager.cc:641
FWFromEveSelectorBase
Definition: FWFromEveSelectorBase.h:27
FWEveViewManager::BuilderInfo
Definition: FWEveViewManager.h:46
FWEventItem::type
const TClass * type() const
Definition: FWEventItem.cc:437
fwlog::kWarning
Definition: fwLog.h:35
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
FWEveViewManager::BuilderInfo::classType
void classType(std::string &, bool &) const
Definition: FWEveViewManager.cc:704
fwLog.h
FWViewType::kLegoHF
Definition: FWViewType.h:37
FWViewType::kTableHLT
Definition: FWViewType.h:41
FWRPZView::importElements
void importElements(TEveElement *iProjectableChild, float layer, TEveElement *iProjectedParent=nullptr)
Definition: FWRPZView.cc:281
get
#define get
FWEventItem::purpose
const std::string & purpose() const
Definition: FWEventItem.cc:439
FWEventItem.h
FWEveViewManager::supportedTypesAndRepresentations
FWTypeToRepresentations supportedTypesAndRepresentations() const override
Definition: FWEveViewManager.cc:659
FWViewContext
Definition: FWViewContext.h:32
FWEveViewManager::FWEveViewManager
FWEveViewManager(FWGUIManager *)
Definition: FWEveViewManager.cc:79
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
CmsShowCommon.h
FWEventItem
Definition: FWEventItem.h:56
type
type
Definition: HCALResponse.h:21
eostools.move
def move(src, dest)
Definition: eostools.py:511
FWGlimpseView.h
FWEveViewManager::m_interactionLists
std::map< const FWEventItem *, FWInteractionList * > m_interactionLists
Definition: FWEveViewManager.h:112
FWEveViewManager::highlightAdded
void highlightAdded(TEveElement *)
Definition: FWEveViewManager.cc:724
FWSimpleRepresentationChecker.h
FWProxyBuilderBase::modelChanges
void modelChanges(const FWModelIds &)
Definition: FWProxyBuilderBase.cc:205
FWViewType::kISpy
Definition: FWViewType.h:35
FWProxyBuilderBase
Definition: FWProxyBuilderBase.h:46
FWColorManager::setColorSetViewer
static Bool_t setColorSetViewer(TGLViewer *, Color_t)
Definition: FWColorManager.cc:224
FWTypeToRepresentations
Definition: FWTypeToRepresentations.h:33
FWEveViewManager::m_builders
std::map< int, BuilderVec > m_builders
Definition: FWEveViewManager.h:108
relativeConstraints.value
value
Definition: relativeConstraints.py:53
FWEveViewManager::m_typeToBuilder
TypeToBuilder m_typeToBuilder
Definition: FWEveViewManager.h:104
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
FWEveViewManager::modelChangesComing
void modelChangesComing() override
Definition: FWEveViewManager.cc:413
fireworks::Context::getCaloData
TEveCaloDataHist * getCaloData() const
Definition: Context.h:69
EveSelectionSentry::EveSelectionSentry
EveSelectionSentry()
Definition: FWEveViewManager.cc:65
FWViewType::k3D
Definition: FWViewType.h:34
FWEveLegoView.h
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
FWTypeToRepresentations.h
FWEveViewManager::setContext
void setContext(const fireworks::Context *) override
Definition: FWEveViewManager.cc:505
FWViewEnergyScale.h
FWGUIManager::ViewBuildFunctor
boost::function2< FWViewBase *, TEveWindowSlot *, const std::string & > ViewBuildFunctor
Definition: FWGUIManager.h:97
FWEDProductRepresentationChecker.h
FWEveView::setContext
virtual void setContext(const fireworks::Context &x)
Definition: FWEveView.cc:227
cms::cuda::be
int be
Definition: HistoContainer.h:126
FWEveViewManager::modelChanges
void modelChanges(const FWModelIds &iIds)
Definition: FWEveViewManager.cc:418
FWProxyBuilderBase::getHaveWindow
bool getHaveWindow() const
Definition: FWProxyBuilderBase.h:95
FWViewType::kRhoPhiPF
Definition: FWViewType.h:42
FWEveViewManager::m_views
std::vector< std::vector< std::shared_ptr< FWEveView > > > m_views
Definition: FWEveViewManager.h:110
FWViewBase
Definition: FWViewBase.h:36
FWViewManagerBase::context
const fireworks::Context & context() const
Definition: FWViewManagerBase.h:69
FWModelIds
std::set< FWModelId > FWModelIds
Definition: FWEveViewManager.h:40
getSelector
FWFromEveSelectorBase * getSelector(TEveElement *iElement)
Definition: FWEveViewManager.cc:625
FWTGLViewer.h
FWProxyBuilderFactory.h
FWEveViewManager::eventCenterChanged
void eventCenterChanged()
Definition: FWEveViewManager.cc:522
crabWrapper.key
key
Definition: crabWrapper.py:19
FWEventItem::changed_
FWModelChangeSignal changed_
Definition: FWEventItem.h:178
begin
#define begin
Definition: vmac.h:32
FWViewType::kRhoPhi
Definition: FWViewType.h:32
FWEveViewManager::removeItem
virtual void removeItem(const FWEventItem *)
Definition: FWEveViewManager.cc:482
FWColorManager::background
Color_t background() const
Definition: FWColorManager.h:55
fireworks::Context::selectionManager
FWSelectionManager * selectionManager() const
Definition: Context.h:54
FWGUIManager.h
Context.h
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
FW3DView.h
FWViewType::kTable
Definition: FWViewType.h:39