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  std::string fullName = *it;
107  m_typeToBuilder[purpose].push_back(BuilderInfo(*it, viewTypes));
108  }
109 
111 
112  // view construction called via GUI mng
114  std::bind(&FWEveViewManager::buildView, this, std::placeholders::_1, std::placeholders::_2);
115  for (int i = 0; i < FWViewType::kTypeSize; i++) {
117  continue;
119  }
120 
121  // signal
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()");
129 
130  gEve->GetHighlight()->Connect(
131  "SelectionAdded(TEveElement*)", "FWEveViewManager", this, "highlightAdded(TEveElement*)");
132  gEve->GetHighlight()->Connect(
133  "SelectionRepeated(TEveElement*)", "FWEveViewManager", this, "highlightAdded(TEveElement*)");
134 
135  TGeoManager::SetVerboseLevel(0);
136 }
137 
139 
140 //
141 // member functions
142 //
143 
144 //______________________________________________________________________________
145 
151 void addElements(const FWEventItem* item, FWEveView* view, int viewType, TEveElementList* product) {
152  if (FWViewType::isProjected(viewType)) {
153  FWRPZView* rpzView = dynamic_cast<FWRPZView*>(view);
154  assert(rpzView);
155  rpzView->importElements(product, item->layer(), rpzView->eventScene());
156  } else {
157  view->eventScene()->AddElement(product);
158  }
159 }
160 
176  TypeToBuilder::iterator itFind = m_typeToBuilder.find(iItem->purpose());
177 
178  if (itFind == m_typeToBuilder.end())
179  return;
180 
181  std::vector<BuilderInfo>& blist = itFind->second;
182 
183  std::string bType;
184  bool bIsSimple;
185  for (size_t bii = 0, bie = blist.size(); bii != bie; ++bii) {
186  // 1.
187  BuilderInfo& info = blist[bii];
188  info.classType(bType, bIsSimple);
189  if (bIsSimple) {
190  unsigned int distance = 1;
191  edm::TypeWithDict modelType(*(iItem->modelType()->GetTypeInfo()));
192  if (!FWSimpleRepresentationChecker::inheritsFrom(modelType, bType, distance)) {
193  // printf("PB does not matche itemType (%s) !!! EDproduct %s %s\n", info.m_name.c_str(), iItem->modelType()->GetTypeInfo()->name(), bType.c_str() );
194  continue;
195  }
196  } else {
197  std::string itype = iItem->type()->GetTypeInfo()->name();
198  if (itype != bType) {
199  // printf("PB does not match modeType (%s)!!! EDproduct %s %s\n", info.m_name.c_str(), itype.c_str(), bType.c_str() );
200  continue;
201  }
202  }
203 
204  std::string builderName = info.m_name;
205  int builderViewBit = info.m_viewBit;
206 
207  std::shared_ptr<FWProxyBuilderBase> builder;
208  try {
209  builder = std::shared_ptr<FWProxyBuilderBase>{FWProxyBuilderFactory::get()->create(builderName)};
210 
211  } catch (std::exception& exc) {
213  << "FWEveViewManager::newItem ignoring the following exception (probably edmplugincache mismatch):"
214  << std::endl
215  << exc.what();
216  }
217  if (!builder)
218  continue;
219 
220  // 2.
221  // printf("FWEveViewManager::makeProxyBuilderFor NEW builder %s \n", builderName.c_str());
222 
223  builder->setItem(iItem);
224  iItem->changed_.connect(std::bind(&FWEveViewManager::modelChanges, this, std::placeholders::_1));
225  iItem->goingToBeDestroyed_.connect(std::bind(&FWEveViewManager::removeItem, this, std::placeholders::_1));
226  iItem->itemChanged_.connect(std::bind(&FWEveViewManager::itemChanged, this, std::placeholders::_1));
227 
228  // 3.
229  // This calud be opaque to the user. I would pass a reference to the m_interactionLists to
230  // FWProxyBuilderBase::setInteractionList and handle different case differently.
231  if (builder->willHandleInteraction() == false) {
232  typedef std::map<const FWEventItem*, FWInteractionList*>::iterator Iterator;
233  std::pair<Iterator, bool> t = m_interactionLists.insert(std::make_pair(iItem, (FWInteractionList*)nullptr));
234 
235  if (t.second == true)
236  t.first->second = new FWInteractionList(iItem);
237  // printf(">>> builder %s add list %p \n", iItem->name().c_str(), il); fflush(stdout);
238  builder->setInteractionList(t.first->second, iItem->purpose());
239  }
240 
241  builder->setHaveWindow(haveViewForBit(builderViewBit));
242 
243  // 4.
244  for (size_t viewType = 0; viewType < FWViewType::kTypeSize; ++viewType) {
245  if (((1 << viewType) & builderViewBit) == 0)
246  continue;
247 
249 
250  // printf("%s builder %s supportsd view %s \n", iItem->name().c_str(), builderName.c_str(), FWViewType::idToName(viewType).c_str());
251  if (builder->havePerViewProduct((FWViewType::EType)viewType)) {
252  for (size_t i = 0, e = m_views[viewType].size(); i != e; ++i) {
253  FWEveView* view = m_views[viewType][i].get();
254  TEveElementList* product = builder->createProduct(type, view->viewContext());
255  addElements(iItem, view, viewType, product);
256  }
257  } else {
258  TEveElementList* product = builder->createProduct(type, nullptr);
259 
260  for (size_t i = 0, e = m_views[viewType].size(); i != e; ++i)
261  addElements(iItem, m_views[viewType][i].get(), viewType, product);
262  }
263  }
264 
265  m_builders[builderViewBit].emplace_back(std::move(builder));
266  } // loop views
267 }
268 
269 //______________________________________________________________________________
270 FWViewBase* FWEveViewManager::buildView(TEveWindowSlot* iParent, const std::string& viewName) {
272  for (int i = 0; i < FWViewType::kTypeSize; ++i) {
273  if (viewName == FWViewType::idToName(i)) {
275  break;
276  }
277  }
278 
279  std::shared_ptr<FWEveView> view;
280  switch (type) {
281  case FWViewType::k3D:
282  view.reset(new FW3DView(iParent, type));
283  break;
284  case FWViewType::kISpy:
285  view.reset(new FWISpyView(iParent, type));
286  break;
287  case FWViewType::kRhoPhi:
288  case FWViewType::kRhoZ:
290  view.reset(new FWRPZView(iParent, type));
291  break;
292  case FWViewType::kLego:
294  view.reset(new FWEveLegoView(iParent, type));
295  break;
296  case FWViewType::kLegoHF:
297  view.reset(new FWHFView(iParent, type));
298  break;
300  view.reset(new FWGlimpseView(iParent, type));
301  break;
302  default:
303  break;
304  }
305 
306  m_views[type].push_back(std::shared_ptr<FWEveView>(view));
307  return finishViewCreate(m_views[type].back());
308 }
309 
310 FWEveView* FWEveViewManager::finishViewCreate(std::shared_ptr<FWEveView> view) {
311  // printf("new view %s added \n", view->typeName().c_str());
312  gEve->DisableRedraw();
313 
314  // set geometry and calo data
315  view->setContext(context());
316 
318 
319  // set proxies have a window falg
320  int viewerBit = 1 << view->typeId();
321  if (m_views[view->typeId()].size() == 1) {
322  for (std::map<int, BuilderVec>::iterator i = m_builders.begin(); i != m_builders.end(); ++i) {
323  int builderViewBit = i->first;
324  BuilderVec& bv = i->second;
325  if (viewerBit == (builderViewBit & viewerBit)) {
326  for (BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt) {
327  (*bIt)->setHaveWindow(true);
328  }
329  }
330  }
331  }
332 
333  FWRPZView* rpzView = dynamic_cast<FWRPZView*>(view.get());
334  for (std::map<int, BuilderVec>::iterator i = m_builders.begin(); i != m_builders.end(); ++i) {
335  int builderViewBit = i->first;
336  BuilderVec& bv = i->second;
337  if (viewerBit == (builderViewBit & viewerBit)) {
338  for (BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt) {
339  // it is ok to call create even for shared productsm since
340  // builder map key garanties that
341  TEveElementList* product = (*bIt)->createProduct(view->typeId(), view->viewContext());
342 
343  if ((*bIt)->havePerViewProduct((FWViewType::EType)view->typeId())) {
344  // view owned
345  (*bIt)->build();
346  if (rpzView) {
347  rpzView->importElements(product, (*bIt)->item()->layer(), rpzView->ownedProducts());
348  } else {
349  view->ownedProducts()->AddElement(product);
350  }
351  } else {
352  // shared
353  if (rpzView) {
354  rpzView->importElements(product, (*bIt)->item()->layer(), rpzView->eventScene());
355  } else {
356  view->eventScene()->AddElement(product);
357  }
358  }
359  }
360  }
361  }
362 
363  view->beingDestroyed_.connect(std::bind(&FWEveViewManager::beingDestroyed, this, std::placeholders::_1));
364 
365  view->setupEnergyScale(); // notify PB for energy scale
366 
367  gEve->EnableRedraw();
368  view->viewerGL()->UpdateScene();
369  gEve->Redraw3D();
370 
371  return view.get();
372 }
373 
375  FWEveView* view = (FWEveView*)vb;
376  int typeId = view->typeId();
377 
378  int viewerBit = 1 << typeId;
379  int nviews = m_views[typeId].size();
380  for (std::map<int, BuilderVec>::iterator i = m_builders.begin(); i != m_builders.end(); ++i) {
381  int builderBit = i->first;
382  if (viewerBit == (builderBit & viewerBit)) // check only in case if connected
383  {
384  BuilderVec& bv = i->second;
385 
386  // remove view-owned product
387  if (viewerBit == (builderBit & viewerBit)) {
388  for (BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt)
389  (*bIt)->removePerViewProduct(view->typeId(), view->viewContext());
390  }
391 
392  // and setup proxy builders have-a-window flag
393  if (nviews == 1) {
394  if (!haveViewForBit(builderBit)) {
395  if (viewerBit == (builderBit & viewerBit)) {
396  for (BuilderVec_it bIt = bv.begin(); bIt != bv.end(); ++bIt)
397  (*bIt)->setHaveWindow(false);
398  }
399  }
400  }
401  }
402  }
403 
404  for (EveViewVec_it i = m_views[typeId].begin(); i != m_views[typeId].end(); ++i) {
405  if (i->get() == vb) {
406  m_views[typeId].erase(i);
407  break;
408  }
409  }
410 }
411 
412 //______________________________________________________________________________
413 
414 void FWEveViewManager::modelChangesComing() { gEve->DisableRedraw(); }
415 
416 void FWEveViewManager::modelChangesDone() { gEve->EnableRedraw(); }
417 
420  FWModelId id = *(iIds.begin());
421  const FWEventItem* item = id.item();
422 
423  // in standard case new elements can be build in case of change of visibility
424  // and in non-standard case (e.g. calo towers) PB's modelChages handles all changes
425  bool itemHaveWindow = false;
426  for (std::map<int, BuilderVec>::iterator i = m_builders.begin(); i != m_builders.end(); ++i) {
427  for (size_t bi = 0, be = i->second.size(); bi != be; ++bi) {
428  FWProxyBuilderBase* builder = i->second[bi].get();
429  if (builder->getHaveWindow() && builder->item() == item) {
430  builder->modelChanges(iIds);
431  itemHaveWindow = true;
432  }
433  }
434  }
435 
436  if (!itemHaveWindow)
437  return;
438 
440 
441  std::map<const FWEventItem*, FWInteractionList*>::iterator it = m_interactionLists.find(item);
442  if (it != m_interactionLists.end()) {
443  if (!it->second->empty())
444  it->second->modelChanges(iIds);
445  }
446 }
447 
454  if (!item)
455  return;
456 
457  bool itemHaveWindow = false;
458 
459  for (std::map<int, BuilderVec>::iterator i = m_builders.begin(); i != m_builders.end(); ++i) {
460  for (size_t bi = 0, be = i->second.size(); bi != be; ++bi) {
461  FWProxyBuilderBase* builder = i->second[bi].get();
462 
463  if (builder->item() != item)
464  continue;
465 
466  builder->itemChanged(item);
467  itemHaveWindow |= builder->getHaveWindow();
468  }
469  }
470 
471  if (!itemHaveWindow)
472  return;
473 
474  std::map<const FWEventItem*, FWInteractionList*>::iterator it = m_interactionLists.find(item);
475  if (it != m_interactionLists.end()) {
476  if (!it->second->empty())
477  it->second->itemChanged();
478  }
479 }
480 
485 
486  std::map<const FWEventItem*, FWInteractionList*>::iterator it = m_interactionLists.find(item);
487  if (it != m_interactionLists.end()) {
488  delete it->second;
489  m_interactionLists.erase(it);
490  }
491 
492  for (std::map<int, BuilderVec>::iterator i = m_builders.begin(); i != m_builders.end(); ++i) {
493  BuilderVec_it bIt = i->second.begin();
494  while (bIt != i->second.end()) {
495  if ((*bIt)->item() == item) {
496  // TODO caching of proxy builders
497  (*bIt)->itemBeingDestroyed(item);
498  bIt = i->second.erase(bIt);
499  } else {
500  ++bIt;
501  }
502  }
503  }
504 }
505 
508  x->commonPrefs()->getEnergyScale()->parameterChanged_.connect(
510  x->commonPrefs()->eventCenterChanged_.connect(std::bind(&FWEveViewManager::eventCenterChanged, this));
511 }
512 
514  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
515  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i) {
516  if ((*i)->isEnergyScaleGlobal()) {
517  (*i)->setupEnergyScale();
518  }
519  }
520  }
521 }
522 
524  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
525  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i) {
526  (*i)->setupEventCenter();
527  }
528  }
529 }
530 
532  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
533  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
534  (*i)->setBackgroundColor(colorManager().background());
535  }
536 }
537 
538 //______________________________________________________________________________
540  // Prevent registration of redraw timer, full redraw is done in
541  // FWEveViewManager::eventEnd().
542  gEve->EnforceTimerActive(kTRUE);
543  gEve->DisableRedraw();
544 
546 
547  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
548  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
549  (*i)->eventBegin();
550  }
551 }
552 
554  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
555  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
556  (*i)->eventEnd();
557  }
558 
559  // What follows is a copy of TEveManager::DoRedraw3D() with the difference that
560  // we have full control over execution of GL view rendering. In particular:
561  // - optionally delay buffer swapping so they can all be swapped together;
562  // - we could render into FBO once and then use this to be put on screen
563  // and saved into an image file.
564 
565  {
566  TEveElement::List_t scenes;
567  Long64_t key, value;
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);
573  }
574  }
575  gEve->ScenesChanged(scenes);
576  }
577 
578  // Process changes in scenes.
579  gEve->GetScenes()->ProcessSceneChanges(kFALSE, gEve->PtrToStampedElements());
580 
581  // To synchronize buffer swapping set swap_on_render to false.
582  // Note that this costs 25-40% extra time with 4 views, depending on V-sync settings.
583  // Tested with NVIDIA 343.22.
584  const bool swap_on_render = !s_syncAllViews;
585 
586  // Loop over viewers, swap buffers if swap_on_render is true.
587  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
588  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
589  (*i)->fwViewerGL()->DrawHiLod(swap_on_render);
590  }
591 
592  // Swap buffers if they were not swapped before.
593  if (!swap_on_render) {
594  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
595  for (EveViewVec_it i = m_views[t].begin(); i != m_views[t].end(); ++i)
596  (*i)->fwViewerGL()->JustSwap();
597  }
598  }
599 
600  gEve->GetViewers()->RepaintChangedViewers(kFALSE, kFALSE);
601 
602  {
603  Long64_t key, value;
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);
610 
611  el->ClearStamps();
612  }
613  }
614  gEve->PtrToStampedElements()->Delete();
615 
616  gEve->GetListTree()->ClearViewPort(); // Fix this when several list-trees can be added.
617 
618  gEve->EnableRedraw();
619  gEve->EnforceTimerActive(kFALSE);
620 }
621 
622 //______________________________________________________________________________
623 
626 FWFromEveSelectorBase* getSelector(TEveElement* iElement) {
627  if (!iElement)
628  return nullptr;
629 
630  //std::cout <<" non null"<<std::endl;
631  void* userData = iElement->GetUserData();
632  //std::cout <<" user data "<<userData<<std::endl;
633  if (!userData)
634  return nullptr;
635 
636  //std::cout <<" have userData"<<std::endl;
637  //std::cout <<" calo"<<std::endl;
639  return reinterpret_cast<FWFromEveSelectorBase*>(userData);
640 }
641 
642 void FWEveViewManager::selectionAdded(TEveElement* iElement) {
643  FWFromEveSelectorBase* selector = getSelector(iElement);
644  if (selector)
645  selector->doSelect();
646 }
647 
648 void FWEveViewManager::selectionRemoved(TEveElement* iElement) {
649  FWFromEveSelectorBase* selector = getSelector(iElement);
650  if (selector)
651  selector->doUnselect();
652 }
653 
655 
656 //
657 // const member functions
658 //
659 
661  // needed for add collection GUI
662  FWTypeToRepresentations returnValue;
663  const static std::string kFullFrameWorkPBExtension = "FullFramework";
664  for (TypeToBuilder::const_iterator it = m_typeToBuilder.begin(), itEnd = m_typeToBuilder.end(); it != itEnd; ++it) {
665  std::vector<BuilderInfo> blist = it->second;
666  for (size_t bii = 0, bie = blist.size(); bii != bie; ++bii) {
667  BuilderInfo& info = blist[bii];
668 
669  if (context().getHidePFBuilders()) {
670  const static std::string pfExt = "PF ";
671  if (std::string::npos != info.m_name.find(pfExt))
672  continue;
673  }
674 
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);
679 
681  bool isSimple;
682  info.classType(name, isSimple);
683  if (isSimple) {
684  returnValue.add(std::make_shared<FWSimpleRepresentationChecker>(
685  name, it->first, bitPackedViews, representsSubPart, FFOnly));
686  } else {
687  returnValue.add(std::make_shared<FWEDProductRepresentationChecker>(
688  name, it->first, bitPackedViews, representsSubPart, FFOnly));
689  }
690  }
691  }
692  return returnValue;
693 }
694 
696 bool FWEveViewManager::haveViewForBit(int bit) const {
697  for (int t = 0; t < FWViewType::kTypeSize; ++t) {
698  if ((bit & (1 << t)) && !m_views[t].empty())
699  return true;
700  }
701  // printf("have %d view for bit %d \n", haveView, bit);
702  return false;
703 }
704 
706  const std::string kSimple("simple#");
707  simple = (m_name.substr(0, kSimple.size()) == kSimple);
708  if (simple) {
709  typeName = m_name.substr(kSimple.size(), m_name.find_first_of('@') - kSimple.size() - 1);
710  } else {
711  typeName = m_name.substr(0, m_name.find_first_of('@') - 1);
712  }
713 }
714 
715 /*
716 AMT: temporary workaround for using TEveCaloDataHist instead of
717 TEveCaloDataVec.
718 
719  */
720 
721 #include "TH2F.h"
722 #include "TAxis.h"
723 #include "TEveCaloData.h"
724 
725 void FWEveViewManager::highlightAdded(TEveElement* iElement) {
726  bool blocked = gEve->GetHighlight()->BlockSignals(true);
727 
728  if (iElement == context().getCaloData()) {
729  TEveCaloData::vCellId_t& hlist = context().getCaloData()->GetCellsHighlighted();
730  std::set<TEveCaloData::CellId_t> hset;
731 
732  int etaBin, phiBin, w, newPhiBin, tower;
733  TH2F* hist = context().getCaloData()->GetHist(0);
734  TAxis* etaAxis = hist->GetXaxis();
735  int nBinsX = etaAxis->GetNbins() + 2;
736 
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;
741  if (newPhiBin <= 0)
742  newPhiBin = 71;
743 
744  tower = etaBin + newPhiBin * nBinsX;
745  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
746  tower += nBinsX;
747  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
748  tower += nBinsX;
749 
750  if (newPhiBin == 71)
751  tower = etaBin + 1 * nBinsX;
752 
753  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
754  tower += nBinsX;
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));
760  tower += nBinsX;
761  hset.insert(TEveCaloData::CellId_t(tower, (*i).fSlice, (*i).fFraction));
762  } else {
763  hset.insert(*i);
764  }
765  }
766 
767  // edit calo data list
768  hlist.clear();
769  for (std::set<TEveCaloData::CellId_t>::iterator it = hset.begin(); it != hset.end(); ++it) {
770  hlist.push_back(*it);
771  }
772  context().getCaloData()->CellSelectionChanged();
773  }
774 
775  gEve->GetHighlight()->BlockSignals(blocked);
776 }
FWRPZView
Definition: FWRPZView.h:40
FWEveViewManager::eventEnd
void eventEnd() override
Definition: FWEveViewManager.cc:553
hgcalPlots.purpose
purpose
Definition: hgcalPlots.py:2049
taus_updatedMVAIds_cff.category
category
Definition: taus_updatedMVAIds_cff.py:31
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
mps_fire.i
i
Definition: mps_fire.py:428
fireworks::Context
Definition: Context.h:41
FWGUIManager
Definition: FWGUIManager.h:95
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:175
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:696
FWEveViewManager::globalEnergyScaleChanged
void globalEnergyScaleChanged()
Definition: FWEveViewManager.cc:513
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:416
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:4
HLT_FULL_cff.builders
builders
Definition: HLT_FULL_cff.py:32608
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:151
FWEveView::viewContext
FWViewContext * viewContext()
Definition: FWEveView.h:83
cms::cuda::assert
assert(be >=bs)
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
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:306
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:82
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:138
cms::Iterator
TGeoIterator Iterator
Definition: DDFilteredView.h:54
FWEveViewManager::itemChanged
void itemChanged(const FWEventItem *)
Definition: FWEveViewManager.cc:453
FWSelectionManager.h
FWEveViewManager::colorsChanged
void colorsChanged() override
Definition: FWEveViewManager.cc:531
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
FWEveView
Definition: FWEveView.h:53
FWEveViewManager::selectionCleared
void selectionCleared()
Definition: FWEveViewManager.cc:654
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
FWEveViewManager::beingDestroyed
void beingDestroyed(const FWViewBase *)
Definition: FWEveViewManager.cc:374
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
edmplugin::PluginInfo::name_
std::string name_
Definition: PluginInfo.h:29
FWViewType::kGlimpse
Definition: FWViewType.h:38
FWEveViewManager::selectionRemoved
void selectionRemoved(TEveElement *)
Definition: FWEveViewManager.cc:648
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
FWGUIManager::ViewBuildFunctor
std::function< FWViewBase *(TEveWindowSlot *, const std::string &)> ViewBuildFunctor
Definition: FWGUIManager.h:98
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:310
FWEveViewManager::BuilderInfo::m_name
std::string m_name
Definition: FWEveViewManager.h:47
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
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:270
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:39
FWISpyView.h
EveSelectionSentry::m_blocked
bool m_blocked
Definition: FWEveViewManager.cc:69
FWEveViewManager::eventBegin
void eventBegin() override
Definition: FWEveViewManager.cc:539
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:642
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:705
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:285
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:660
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
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:725
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:414
genVertex_cff.x
x
Definition: genVertex_cff.py:12
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:506
FWViewEnergyScale.h
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:419
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:626
FWTGLViewer.h
FWProxyBuilderFactory.h
FWEveViewManager::eventCenterChanged
void eventCenterChanged()
Definition: FWEveViewManager.cc:523
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7733
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
crabWrapper.key
key
Definition: crabWrapper.py:19
FWEventItem::changed_
FWModelChangeSignal changed_
Definition: FWEventItem.h:178
FWViewType::kRhoPhi
Definition: FWViewType.h:32
FWEveViewManager::removeItem
virtual void removeItem(const FWEventItem *)
Definition: FWEveViewManager.cc:483
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