CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
FWEveView Class Reference

#include <FWEveView.h>

Inheritance diagram for FWEveView:
FWViewBase FWConfigurableParameterizable FWParameterizable FWConfigurable FW3DViewBase FWGlimpseView FWLegoViewBase FWRPZView FW3DView FWISpyView FWEveLegoView FWHFView

Public Member Functions

void addTo (FWConfiguration &) const override
 
const fireworks::Contextcontext ()
 
FWViewContextMenuHandlerBasecontextMenuHandler () const override
 
virtual void eventBegin ()
 
virtual void eventEnd ()
 
TEveScene * eventScene ()
 
 FWEveView (TEveWindowSlot *, FWViewType::EType, unsigned int version=7)
 
FWTEveViewerfwViewer ()
 
FWTGLViewerfwViewerGL () const
 
TEveScene * geoScene ()
 
virtual bool isEnergyScaleGlobal () const
 
TEveElement * ownedProducts ()
 
void populateController (ViewerParameterGUI &) const override
 
virtual bool requestGLHandlerPick () const
 
void saveImageTo (const std::string &iName) const override
 
virtual void setBackgroundColor (Color_t)
 
virtual void setContext (const fireworks::Context &x)
 
void setFrom (const FWConfiguration &) override
 
virtual void setupEnergyScale ()
 
virtual void setupEventCenter ()
 
virtual void useGlobalEnergyScaleChanged ()
 
FWViewContextviewContext ()
 
TEveViewer * viewer ()
 
TGLViewer * viewerGL () const
 
virtual void voteCaloMaxVal ()
 
 ~FWEveView () override
 
- Public Member Functions inherited from FWViewBase
void destroy ()
 
 FWViewBase (FWViewType::EType, unsigned int iVersion=1)
 
void promptForSaveImageTo (TGFrame *) const
 
FWViewType::EType typeId () const
 
const std::string & typeName () const
 
- Public Member Functions inherited from FWConfigurableParameterizable
 FWConfigurableParameterizable (unsigned int iVersion=1)
 
unsigned int version () const
 
 ~FWConfigurableParameterizable () override
 
- Public Member Functions inherited from FWParameterizable
void add (FWParameterBase *)
 
const_iterator begin () const
 
const_iterator end () const
 
 FWParameterizable ()
 
virtual ~FWParameterizable ()
 
- Public Member Functions inherited from FWConfigurable
 FWConfigurable ()
 
virtual ~FWConfigurable ()
 

Protected Member Functions

void addToOrthoCamera (TGLOrthoCamera *, FWConfiguration &) const
 
void addToPerspectiveCamera (TGLPerspectiveCamera *, const std::string &, FWConfiguration &) const
 
virtual void cameraGuideChanged ()
 
virtual TEveCaloViz * getEveCalo () const
 
virtual void pointLineScalesChanged ()
 
virtual void resetCamera ()
 
void setFromOrthoCamera (TGLOrthoCamera *, const FWConfiguration &)
 
void setFromPerspectiveCamera (TGLPerspectiveCamera *, const std::string &, const FWConfiguration &)
 
- Protected Member Functions inherited from FWViewBase
 ~FWViewBase () override
 

Protected Attributes

const fireworks::Contextm_context
 
- Protected Attributes inherited from FWViewBase
FWViewType m_type
 

Private Member Functions

 FWEveView (const FWEveView &)=delete
 
const FWEveViewoperator= (const FWEveView &)=delete
 

Private Attributes

TGLCameraGuide * m_cameraGuide
 
FWBoolParameter m_drawCMSLogo
 
ScaleAnnotationm_energyMaxValAnnotation
 
FWEnumParameter m_eventInfoLevel
 
TEveScene * m_eventScene
 
TEveScene * m_geoScene
 
FWDoubleParameter m_imageScale
 
FWDoubleParameter m_lineOutlineScale
 
FWBoolParameter m_lineSmooth
 
FWDoubleParameter m_lineWidth
 
FWDoubleParameter m_lineWireframeScale
 
std::unique_ptr< FWViewEnergyScalem_localEnergyScale
 
FWEventAnnotationm_overlayEventInfo
 
CmsAnnotationm_overlayLogo
 
TEveElement * m_ownedProducts
 
FWDoubleParameter m_pointSize
 
FWBoolParameter m_pointSmooth
 
FWBoolParameter m_showCameraGuide
 
FWBoolParameter m_useGlobalEnergyScale
 
std::unique_ptr< FWViewContextm_viewContext
 
std::shared_ptr< FWViewContextMenuHandlerGLm_viewContextMenu
 
FWViewEnergyScaleEditorm_viewEnergyScaleEditor
 
FWTEveViewerm_viewer
 

Additional Inherited Members

- Public Types inherited from FWParameterizable
typedef std::vector< FWParameterBase * >::const_iterator const_iterator
 
- Public Attributes inherited from FWViewBase
sigc::signal< void, const FWViewBase * > beingDestroyed_
 
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
 

Detailed Description

Definition at line 53 of file FWEveView.h.

Constructor & Destructor Documentation

◆ FWEveView() [1/2]

FWEveView::FWEveView ( TEveWindowSlot *  iParent,
FWViewType::EType  type,
unsigned int  version = 7 
)

Definition at line 70 of file FWEveView.cc.

72  m_context(nullptr),
73  m_viewer(nullptr),
74  m_eventScene(nullptr),
75  m_ownedProducts(nullptr),
76  m_geoScene(nullptr),
77  m_overlayEventInfo(nullptr),
78  m_overlayLogo(nullptr),
79  m_energyMaxValAnnotation(nullptr),
80  m_cameraGuide(nullptr),
81 // style
82 #if ROOT_VERSION_CODE >= ROOT_VERSION(5, 26, 0)
83  m_imageScale(this, "Image Scale", 1.0, 1.0, 6.0),
84 #endif
85  m_eventInfoLevel(this, "Overlay Event Info", 0l, 0l, 2l),
86  m_drawCMSLogo(this, "Show Logo", false),
87  m_pointSmooth(this, "Smooth points", false),
88  m_pointSize(this, "Point size", 1.0, 1.0, 10.0),
89  m_lineSmooth(this, "Smooth lines", false),
90  m_lineWidth(this, "Line width", 1.0, 1.0, 10.0),
91  m_lineOutlineScale(this, "Outline width scale", 1.0, 0.01, 10.0),
92  m_lineWireframeScale(this, "Wireframe width scale", 1.0, 0.01, 10.0),
93  m_showCameraGuide(this, "Show Camera Guide", false),
94  m_useGlobalEnergyScale(this, "UseGlobalEnergyScale", true),
97  m_viewEnergyScaleEditor(nullptr) {
98  m_viewer = new FWTEveViewer(typeName().c_str());
99 
100  FWTGLViewer* embeddedViewer = m_viewer->SpawnFWTGLViewer();
101  iParent->ReplaceWindow(m_viewer);
102  gEve->GetViewers()->AddElement(m_viewer);
103 
104  m_eventScene = gEve->SpawnNewScene(Form("EventScene %s", typeName().c_str()));
105  m_ownedProducts = new TEveElementList("ViewSpecificProducts");
106  m_eventScene->AddElement(m_ownedProducts);
107 
108  m_viewer->AddScene(m_eventScene);
109 
110  // spawn geo scene
111  m_geoScene = gEve->SpawnNewScene(Form("GeoScene %s", typeName().c_str()));
112  m_geoScene->GetGLScene()->SetSelectable(kFALSE);
113  m_viewer->AddScene(m_geoScene);
114 
115  FWGLEventHandler* eh = new FWGLEventHandler((TGWindow*)embeddedViewer->GetGLWidget(), (TObject*)embeddedViewer);
116  embeddedViewer->SetEventHandler(eh);
117  eh->setViewer(this);
119  eh->SetDoInternalSelection(kFALSE);
121  // ctxHand->setPickCameraCenter(true);
122  m_viewContextMenu.reset(ctxHand);
123 
124  m_energyMaxValAnnotation = new ScaleAnnotation(viewerGL(), "empty", 0.1, 0.9);
125  m_energyMaxValAnnotation->SetRole(TGLOverlayElement::kViewer);
126  m_energyMaxValAnnotation->SetState(TGLOverlayElement::kInvisible);
127  m_energyMaxValAnnotation->SetUseColorSet(false);
128  m_energyMaxValAnnotation->SetTextSize(0.05);
129  m_energyMaxValAnnotation->SetTextColor(kMagenta);
130 
131  // style params
132 
133  m_overlayEventInfo = new FWEventAnnotation(embeddedViewer);
135 
136  m_eventInfoLevel.addEntry(0, "Nothing");
137  m_eventInfoLevel.addEntry(1, "Run / event");
138  m_eventInfoLevel.addEntry(2, "Run / event / lumi");
139  m_eventInfoLevel.addEntry(3, "Full");
141 
142  m_overlayLogo = new CmsAnnotation(embeddedViewer, 0.02, 0.98);
143  m_overlayLogo->setVisible(false);
145 
146  m_cameraGuide = new TGLCameraGuide(0.9, 0.1, 0.08);
147  m_cameraGuide->SetState(TGLOverlayElement::kInvisible);
148  embeddedViewer->AddOverlayElement(m_cameraGuide);
149  m_showCameraGuide.changed_.connect(boost::bind(&FWEveView::cameraGuideChanged, this));
150 
151  m_pointSmooth.changed_.connect(boost::bind(&FWEveView::pointLineScalesChanged, this));
152  m_pointSize.changed_.connect(boost::bind(&FWEveView::pointLineScalesChanged, this));
153  m_lineSmooth.changed_.connect(boost::bind(&FWEveView::pointLineScalesChanged, this));
154  m_lineWidth.changed_.connect(boost::bind(&FWEveView::pointLineScalesChanged, this));
157 
158  // create scale for view ..
159  m_viewContext->setEnergyScale(m_localEnergyScale.get());
161  m_localEnergyScale->parameterChanged_.connect(boost::bind(&FWEveView::setupEnergyScale, this));
162 }

References FWEnumParameter::addEntry(), cameraGuideChanged(), FWGenericParameter< T >::changed_, m_cameraGuide, m_drawCMSLogo, m_energyMaxValAnnotation, m_eventInfoLevel, m_eventScene, m_geoScene, m_lineOutlineScale, m_lineSmooth, m_lineWidth, m_lineWireframeScale, m_localEnergyScale, m_overlayEventInfo, m_overlayLogo, m_ownedProducts, m_pointSize, m_pointSmooth, m_showCameraGuide, m_useGlobalEnergyScale, m_viewContext, m_viewContextMenu, m_viewer, FWGLEventHandler::openSelectedModelContextMenu_, FWViewBase::openSelectedModelContextMenu_, pointLineScalesChanged(), FWEventAnnotation::setLevel(), setupEnergyScale(), FWGLEventHandler::setViewer(), CmsAnnotation::setVisible(), FWTEveViewer::SpawnFWTGLViewer(), FWViewBase::typeName(), useGlobalEnergyScaleChanged(), and viewerGL().

◆ ~FWEveView()

FWEveView::~FWEveView ( )
override

Definition at line 164 of file FWEveView.cc.

164  {
165  m_geoScene->RemoveElements();
166  m_eventScene->RemoveElements();
167  m_viewer->DestroyWindowAndSlot();
168 }

References m_eventScene, m_geoScene, and m_viewer.

◆ FWEveView() [2/2]

FWEveView::FWEveView ( const FWEveView )
privatedelete

Member Function Documentation

◆ addTo()

void FWEveView::addTo ( FWConfiguration iTo) const
overridevirtual

Reimplemented from FWConfigurableParameterizable.

Reimplemented in FWLegoViewBase, FWRPZView, and FWGlimpseView.

Definition at line 291 of file FWEveView.cc.

291  {
292  // take care of parameters
294 
295  {
298  }
299  {
301  m_overlayLogo->addTo(iTo);
302  }
303 
304  m_viewContext->getEnergyScale()->addTo(iTo);
305 }

References FWEventAnnotation::addTo(), CmsAnnotation::addTo(), FWConfigurableParameterizable::addTo(), cms::cuda::assert(), m_overlayEventInfo, m_overlayLogo, and m_viewContext.

Referenced by FWGlimpseView::addTo(), FWRPZView::addTo(), FW3DViewBase::addTo(), and FWLegoViewBase::addTo().

◆ addToOrthoCamera()

void FWEveView::addToOrthoCamera ( TGLOrthoCamera *  camera,
FWConfiguration iTo 
) const
protected

Definition at line 352 of file FWEveView.cc.

352  {
353  // zoom
354  std::string name("cameraZoom");
355  iTo.addKeyValue(name + typeName(), FWConfiguration(std::to_string(camera->GetZoom())));
356 
357  // transformation matrix
358  std::string matrixName("cameraMatrix");
359  for (unsigned int i = 0; i < 16; ++i) {
360  std::ostringstream osIndex;
361  osIndex << i;
362  std::ostringstream osValue;
363  osValue << camera->GetCamTrans()[i];
364  iTo.addKeyValue(matrixName + osIndex.str() + typeName(), FWConfiguration(osValue.str()));
365  }
366 }

References FWConfiguration::addKeyValue(), mps_fire::i, Skims_PA_cff::name, AlCaHLTBitMon_QueryRunRegistry::string, and FWViewBase::typeName().

Referenced by FWRPZView::addTo(), and FWLegoViewBase::addTo().

◆ addToPerspectiveCamera()

void FWEveView::addToPerspectiveCamera ( TGLPerspectiveCamera *  cam,
const std::string &  name,
FWConfiguration iTo 
) const
protected

Definition at line 397 of file FWEveView.cc.

397  {
398  // transformation matrix
399  std::string matrixName("cameraMatrix");
400  for (unsigned int i = 0; i < 16; ++i) {
401  std::ostringstream osIndex;
402  osIndex << i;
403  std::ostringstream osValue;
404  osValue << (cam->GetCamTrans())[i];
405  iTo.addKeyValue(matrixName + osIndex.str() + name, FWConfiguration(osValue.str()));
406  }
407 
408  // transformation matrix base
409  matrixName = "cameraMatrixBase";
410  for (unsigned int i = 0; i < 16; ++i) {
411  std::ostringstream osIndex;
412  osIndex << i;
413  std::ostringstream osValue;
414  osValue << (cam->GetCamBase())[i];
415  iTo.addKeyValue(matrixName + osIndex.str() + name, FWConfiguration(osValue.str()));
416  }
417  { iTo.addKeyValue(name + " FOV", FWConfiguration(std::to_string(cam->GetFOV()))); }
418 }

References FWConfiguration::addKeyValue(), mps_fire::i, Skims_PA_cff::name, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FWGlimpseView::addTo(), FW3DViewBase::addTo(), and FWLegoViewBase::addTo().

◆ cameraGuideChanged()

void FWEveView::cameraGuideChanged ( )
protectedvirtual

Definition at line 209 of file FWEveView.cc.

209  {
210  m_cameraGuide->SetBinaryState(m_showCameraGuide.value());
211  viewerGL()->Changed();
212  gEve->Redraw3D();
213 }

References m_cameraGuide, m_showCameraGuide, FWGenericParameter< T >::value(), and viewerGL().

Referenced by FWEveView().

◆ context()

const fireworks::Context& FWEveView::context ( )
inline

◆ contextMenuHandler()

FWViewContextMenuHandlerBase * FWEveView::contextMenuHandler ( ) const
overridevirtual

Reimplemented from FWViewBase.

Definition at line 173 of file FWEveView.cc.

173  {
174  return dynamic_cast<FWViewContextMenuHandlerBase*>(m_viewContextMenu.get());
175 }

References m_viewContextMenu.

◆ eventBegin()

void FWEveView::eventBegin ( )
virtual

Reimplemented in FWRPZView.

Definition at line 215 of file FWEveView.cc.

215 {}

◆ eventEnd()

void FWEveView::eventEnd ( )
virtual

Reimplemented in FWRPZView.

Definition at line 217 of file FWEveView.cc.

217  {
220 }

References m_overlayEventInfo, FWEventAnnotation::setEvent(), and setupEnergyScale().

Referenced by FWRPZView::eventEnd().

◆ eventScene()

TEveScene* FWEveView::eventScene ( )
inline

◆ fwViewer()

FWTEveViewer* FWEveView::fwViewer ( )
inline

Definition at line 77 of file FWEveView.h.

77 { return m_viewer; }

References m_viewer.

◆ fwViewerGL()

FWTGLViewer * FWEveView::fwViewerGL ( ) const

Definition at line 181 of file FWEveView.cc.

181 { return m_viewer->fwGlViewer(); }

References FWTEveViewer::fwGlViewer(), and m_viewer.

◆ geoScene()

TEveScene* FWEveView::geoScene ( )
inline

◆ getEveCalo()

virtual TEveCaloViz* FWEveView::getEveCalo ( ) const
inlineprotectedvirtual

Reimplemented in FWLegoViewBase, FWRPZView, and FW3DView.

Definition at line 100 of file FWEveView.h.

100 { return nullptr; }

Referenced by setupEnergyScale(), and voteCaloMaxVal().

◆ isEnergyScaleGlobal()

bool FWEveView::isEnergyScaleGlobal ( ) const
virtual

Definition at line 235 of file FWEveView.cc.

235 { return m_useGlobalEnergyScale.value(); }

References m_useGlobalEnergyScale, and FWGenericParameter< T >::value().

◆ operator=()

const FWEveView& FWEveView::operator= ( const FWEveView )
privatedelete

◆ ownedProducts()

TEveElement* FWEveView::ownedProducts ( )
inline

Definition at line 82 of file FWEveView.h.

82 { return m_ownedProducts; }

References m_ownedProducts.

Referenced by FWEveViewManager::finishViewCreate().

◆ pointLineScalesChanged()

void FWEveView::pointLineScalesChanged ( )
protectedvirtual

Definition at line 198 of file FWEveView.cc.

198  {
199  viewerGL()->SetSmoothPoints(m_pointSmooth.value());
200  viewerGL()->SetPointScale(m_pointSize.value());
201  viewerGL()->SetSmoothLines(m_lineSmooth.value());
202  viewerGL()->SetLineScale(m_lineWidth.value());
203  viewerGL()->SetOLLineW(m_lineOutlineScale.value());
204  viewerGL()->SetWFLineW(m_lineWireframeScale.value());
205  viewerGL()->Changed();
206  gEve->Redraw3D();
207 }

References m_lineOutlineScale, m_lineSmooth, m_lineWidth, m_lineWireframeScale, m_pointSize, m_pointSmooth, FWGenericParameter< T >::value(), and viewerGL().

Referenced by FWEveView().

◆ populateController()

void FWEveView::populateController ( ViewerParameterGUI gui) const
overridevirtual

Reimplemented from FWViewBase.

Reimplemented in FWLegoViewBase, FWRPZView, and FWISpyView.

Definition at line 466 of file FWEveView.cc.

466  {
467  gui.requestTab("Style")
471  .separator()
472  .
473 #if ROOT_VERSION_CODE >= ROOT_VERSION(5, 26, 0)
474  addParam(&m_imageScale)
475  .
476 #endif
477  addParam(&m_pointSize)
483 
485 
490 }

References ViewerParameterGUI::addFrameToContainer(), ViewerParameterGUI::addParam(), ViewerParameterGUI::getTabContainer(), FWViewType::isLego(), m_drawCMSLogo, m_eventInfoLevel, m_imageScale, m_lineOutlineScale, m_lineSmooth, m_lineWidth, m_lineWireframeScale, m_localEnergyScale, m_pointSize, m_pointSmooth, m_showCameraGuide, m_useGlobalEnergyScale, m_viewEnergyScaleEditor, ViewerParameterGUI::requestTab(), ViewerParameterGUI::separator(), FWViewEnergyScaleEditor::setEnabled(), FWViewBase::typeId(), and FWGenericParameter< T >::value().

Referenced by FWRPZView::populateController(), FW3DViewBase::populateController(), and FWLegoViewBase::populateController().

◆ requestGLHandlerPick()

virtual bool FWEveView::requestGLHandlerPick ( ) const
inlinevirtual

Reimplemented in FW3DViewBase.

Definition at line 92 of file FWEveView.h.

92 { return false; }

Referenced by FWGLEventHandler::HandleButton().

◆ resetCamera()

void FWEveView::resetCamera ( )
protectedvirtual

Definition at line 224 of file FWEveView.cc.

224 { viewerGL()->ResetCurrentCamera(); }

References viewerGL().

Referenced by FW3DViewBase::updateClipPlanes().

◆ saveImageTo()

void FWEveView::saveImageTo ( const std::string &  iName) const
overridevirtual

Implements FWViewBase.

Definition at line 183 of file FWEveView.cc.

183  {
184  bool succeeded = false;
185 #if ROOT_VERSION_CODE >= ROOT_VERSION(5, 26, 0)
186  succeeded = viewerGL()->SavePictureScale(iName, m_imageScale.value());
187 #else
188  succeeded = viewerGL()->SavePicture(iName.c_str());
189 #endif
190 
191  if (!succeeded) {
192  throw std::runtime_error("Unable to save picture");
193  }
194  fwLog(fwlog::kInfo) << "Saved image " << iName << std::endl;
195 }

References fwLog, fwlog::kInfo, m_imageScale, summarizeEdmComparisonLogfiles::succeeded, FWGenericParameter< T >::value(), and viewerGL().

◆ setBackgroundColor()

void FWEveView::setBackgroundColor ( Color_t  iColor)
virtual

Reimplemented in FWEveLegoView.

Definition at line 222 of file FWEveView.cc.

References FWColorManager::setColorSetViewer(), and viewerGL().

Referenced by FWEveLegoView::setBackgroundColor().

◆ setContext()

void FWEveView::setContext ( const fireworks::Context x)
virtual

Reimplemented in FWISpyView, FW3DViewBase, FWRPZView, FWLegoViewBase, FW3DView, FWHFView, and FWEveLegoView.

Definition at line 227 of file FWEveView.cc.

227  {
228  m_context = &x;
229 
230  // in constructor view context has local scale
232  m_viewContext->setEnergyScale(context().commonPrefs()->getEnergyScale());
233 }

References context(), m_context, m_useGlobalEnergyScale, m_viewContext, FWGenericParameter< T >::value(), and x.

Referenced by FWEveViewManager::finishViewCreate(), FWLegoViewBase::setContext(), FWRPZView::setContext(), and FW3DViewBase::setContext().

◆ setFrom()

void FWEveView::setFrom ( const FWConfiguration iFrom)
overridevirtual

Reimplemented from FWConfigurableParameterizable.

Reimplemented in FWRPZView, FWLegoViewBase, and FWGlimpseView.

Definition at line 307 of file FWEveView.cc.

307  {
308  // Make sure you change the version ranges here
309  // whenever you update the logic.
310  // The rationale should be:
311  // (version range supported by the next block) && (version range in the configuration file)
312  //
313  // This is not "forward" compatible, but I don't think
314  // we care.
315  if (version() >= 2 && iFrom.version() >= 1) {
316  for (const_iterator it = begin(), itEnd = end(); it != itEnd; ++it) {
317  (*it)->setFrom(iFrom);
318  }
319  }
320  if (iFrom.version() > 1) {
322  m_overlayEventInfo->setFrom(iFrom);
323  }
324  {
326  m_overlayLogo->setFrom(iFrom);
327  }
328 
329  if (iFrom.version() > 4) {
330  m_localEnergyScale->setFrom(iFrom);
331  }
332 
333  // selection clors
334  {
335  const TGLColorSet& lcs = context().commonPrefs()->getLightColorSet();
336  const TGLColorSet& dcs = context().commonPrefs()->getDarkColorSet();
337  const UChar_t* ca = nullptr;
338 
339  ca = lcs.Selection(1).CArr();
340  viewerGL()->RefLightColorSet().Selection(1).SetColor(ca[0], ca[1], ca[2]);
341  ca = lcs.Selection(3).CArr();
342  viewerGL()->RefLightColorSet().Selection(3).SetColor(ca[0], ca[1], ca[2]);
343  ca = dcs.Selection(1).CArr();
344  viewerGL()->RefDarkColorSet().Selection(1).SetColor(ca[0], ca[1], ca[2]);
345  ca = dcs.Selection(3).CArr();
346  viewerGL()->RefDarkColorSet().Selection(3).SetColor(ca[0], ca[1], ca[2]);
347  }
348 }

References cms::cuda::assert(), FWParameterizable::begin(), fireworks::Context::commonPrefs(), context(), FWParameterizable::end(), CmsShowCommon::getDarkColorSet(), CmsShowCommon::getLightColorSet(), m_localEnergyScale, m_overlayEventInfo, m_overlayLogo, FWEventAnnotation::setFrom(), CmsAnnotation::setFrom(), FWConfigurableParameterizable::version(), FWConfiguration::version(), and viewerGL().

Referenced by FWGlimpseView::setFrom(), FWLegoViewBase::setFrom(), FWRPZView::setFrom(), and FW3DViewBase::setFrom().

◆ setFromOrthoCamera()

void FWEveView::setFromOrthoCamera ( TGLOrthoCamera *  camera,
const FWConfiguration iFrom 
)
protected

Definition at line 368 of file FWEveView.cc.

368  {
369  try {
370  // zoom
371  std::string zoomName("cameraZoom");
372  zoomName += typeName();
373  if (iFrom.valueForKey(zoomName) == nullptr) {
374  throw std::runtime_error("can't restore parameter cameraZoom");
375  }
376  camera->SetZoom(std::stod(iFrom.valueForKey(zoomName)->value()));
377 
378  // transformation matrix
379  std::string matrixName("cameraMatrix");
380  for (unsigned int i = 0; i < 16; ++i) {
381  std::ostringstream os;
382  os << i;
383  const FWConfiguration* value = iFrom.valueForKey(matrixName + os.str() + typeName());
384  if (value == nullptr) {
385  throw std::runtime_error("can't restore parameter cameraMatrix.");
386  }
387  std::istringstream s(value->value());
388  s >> (camera->RefCamTrans()[i]);
389  }
390  } catch (const std::runtime_error& iException) {
391  fwLog(fwlog::kInfo) << "Caught exception while restoring camera parameters in view " << typeName() << "\n.";
392  viewerGL()->ResetCamerasAfterNextUpdate();
393  }
394  camera->IncTimeStamp();
395 }

References fwLog, mps_fire::i, fwlog::kInfo, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, FWViewBase::typeName(), FWConfiguration::value(), FWConfiguration::valueForKey(), and viewerGL().

Referenced by FWLegoViewBase::setFrom(), and FWRPZView::setFrom().

◆ setFromPerspectiveCamera()

void FWEveView::setFromPerspectiveCamera ( TGLPerspectiveCamera *  cam,
const std::string &  name,
const FWConfiguration iFrom 
)
protected

Definition at line 420 of file FWEveView.cc.

422  {
423  try {
424  std::string matrixName("cameraMatrix");
425  for (unsigned int i = 0; i < 16; ++i) {
426  std::ostringstream os;
427  os << i;
428  const FWConfiguration* value = iFrom.valueForKey(matrixName + os.str() + name);
429  if (value == nullptr) {
430  throw std::runtime_error("can't restore parameter cameraMatrix.");
431  }
432  std::istringstream s(value->value());
433  s >> ((cam->RefCamTrans())[i]);
434  }
435 
436  // transformation matrix base
437  matrixName = "cameraMatrixBase";
438  for (unsigned int i = 0; i < 16; ++i) {
439  std::ostringstream os;
440  os << i;
441  const FWConfiguration* value = iFrom.valueForKey(matrixName + os.str() + name);
442  if (value == nullptr) {
443  throw std::runtime_error("can't restore parameter cameraMatrixBase.");
444  }
445 
446  std::istringstream s(value->value());
447  s >> ((cam->RefCamBase())[i]);
448  }
449 
450  {
451  const FWConfiguration* value = iFrom.valueForKey(name + " FOV");
452  if (value == nullptr) {
453  throw std::runtime_error("can't restore parameter cameraMatrixBase.");
454  }
455  cam->SetFOV(std::stod(value->value()));
456  }
457 
458  cam->IncTimeStamp();
459  } catch (const std::runtime_error& iException) {
460  fwLog(fwlog::kInfo) << "Caught exception while restoring camera parameters in view " << typeName() << "\n.";
461  viewerGL()->ResetCamerasAfterNextUpdate();
462  fwLog(fwlog::kDebug) << "Reset camera fo view " << typeName() << "\n.";
463  }
464 }

References fwLog, mps_fire::i, fwlog::kDebug, fwlog::kInfo, Skims_PA_cff::name, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, FWViewBase::typeName(), FWConfiguration::valueForKey(), and viewerGL().

Referenced by FWGlimpseView::setFrom(), FWLegoViewBase::setFrom(), and FW3DViewBase::setFrom().

◆ setupEnergyScale()

void FWEveView::setupEnergyScale ( )
virtual

Definition at line 251 of file FWEveView.cc.

251  {
252  // Called at end of event OR if scale parameters changed.
253 
254  FWViewEnergyScale* energyScale = viewContext()->getEnergyScale();
255  // printf("setupEnergyScale %s >> scale name %s\n", typeName().c_str(), energyScale->name().c_str());
256  voteCaloMaxVal();
257 
258  // set cache for energy to lenght conversion
259  float maxVal = context().getMaxEnergyInEvent(energyScale->getPlotEt());
260  energyScale->updateScaleFactors(maxVal);
261  // printf("max event val %f \n", maxVal);
262  // printf("scales lego %f \n", energyScale->getScaleFactorLego());
263 
264  // configure TEveCaloViz
265  TEveCaloViz* calo = getEveCalo();
266  if (calo) {
267  calo->SetPlotEt(energyScale->getPlotEt());
268  if (FWViewType::isLego(typeId())) {
269  float f = energyScale->getScaleFactorLego();
270  calo->SetMaxValAbs(TMath::Pi() / f);
271  } else {
272  float f = energyScale->getScaleFactor3D();
273  calo->SetMaxValAbs(100 / f);
274  }
275  calo->ElementChanged();
276  }
277 
278  // emit signal to proxy builders
280  gEve->Redraw3D();
281 }

References L1TowerCalibrationProducer_cfi::calo, context(), f, FWViewContext::getEnergyScale(), getEveCalo(), fireworks::Context::getMaxEnergyInEvent(), FWViewEnergyScale::getPlotEt(), FWViewEnergyScale::getScaleFactor3D(), FWViewEnergyScale::getScaleFactorLego(), FWViewType::isLego(), Pi, FWViewContext::scaleChanged(), FWViewBase::typeId(), FWViewEnergyScale::updateScaleFactors(), viewContext(), and voteCaloMaxVal().

Referenced by eventEnd(), FWEveView(), FWRPZView::setEtaRng(), and useGlobalEnergyScaleChanged().

◆ setupEventCenter()

void FWEveView::setupEventCenter ( )
virtual

Reimplemented in FWRPZView.

Definition at line 283 of file FWEveView.cc.

283  {
284  // piggyback on scales signal connections to redraw jets
285  // can add new signal in future if necessary
287  gEve->Redraw3D();
288 }

References FWViewContext::scaleChanged(), and viewContext().

Referenced by FWRPZView::setupEventCenter().

◆ useGlobalEnergyScaleChanged()

void FWEveView::useGlobalEnergyScaleChanged ( )
virtual

◆ viewContext()

FWViewContext* FWEveView::viewContext ( )
inline

Definition at line 83 of file FWEveView.h.

83 { return m_viewContext.get(); }

References m_viewContext.

Referenced by FWEveViewManager::beingDestroyed(), FWEveViewManager::newItem(), setupEnergyScale(), and setupEventCenter().

◆ viewer()

TEveViewer * FWEveView::viewer ( )

◆ viewerGL()

TGLViewer * FWEveView::viewerGL ( ) const

◆ voteCaloMaxVal()

void FWEveView::voteCaloMaxVal ( )
virtual

Reimplemented in FWRPZView.

Definition at line 245 of file FWEveView.cc.

245  {
246  TEveCaloViz* calo = getEveCalo();
247  if (calo)
248  context().voteMaxEtAndEnergy(calo->GetData()->GetMaxVal(true), calo->GetData()->GetMaxVal(false));
249 }

References L1TowerCalibrationProducer_cfi::calo, context(), getEveCalo(), and fireworks::Context::voteMaxEtAndEnergy().

Referenced by setupEnergyScale().

Member Data Documentation

◆ m_cameraGuide

TGLCameraGuide* FWEveView::m_cameraGuide
private

Definition at line 125 of file FWEveView.h.

Referenced by cameraGuideChanged(), and FWEveView().

◆ m_context

const fireworks::Context* FWEveView::m_context
protected

Definition at line 109 of file FWEveView.h.

Referenced by context(), FWRPZView::populateController(), and setContext().

◆ m_drawCMSLogo

FWBoolParameter FWEveView::m_drawCMSLogo
private

Definition at line 133 of file FWEveView.h.

Referenced by FWEveView(), and populateController().

◆ m_energyMaxValAnnotation

ScaleAnnotation* FWEveView::m_energyMaxValAnnotation
private

Definition at line 124 of file FWEveView.h.

Referenced by FWEveView().

◆ m_eventInfoLevel

FWEnumParameter FWEveView::m_eventInfoLevel
private

Definition at line 132 of file FWEveView.h.

Referenced by FWEveView(), and populateController().

◆ m_eventScene

TEveScene* FWEveView::m_eventScene
private

Definition at line 118 of file FWEveView.h.

Referenced by eventScene(), FWEveView(), and ~FWEveView().

◆ m_geoScene

TEveScene* FWEveView::m_geoScene
private

Definition at line 120 of file FWEveView.h.

Referenced by FWEveView(), geoScene(), and ~FWEveView().

◆ m_imageScale

FWDoubleParameter FWEveView::m_imageScale
private

Definition at line 130 of file FWEveView.h.

Referenced by populateController(), and saveImageTo().

◆ m_lineOutlineScale

FWDoubleParameter FWEveView::m_lineOutlineScale
private

Definition at line 139 of file FWEveView.h.

Referenced by FWEveView(), pointLineScalesChanged(), and populateController().

◆ m_lineSmooth

FWBoolParameter FWEveView::m_lineSmooth
private

Definition at line 137 of file FWEveView.h.

Referenced by FWEveView(), pointLineScalesChanged(), and populateController().

◆ m_lineWidth

FWDoubleParameter FWEveView::m_lineWidth
private

Definition at line 138 of file FWEveView.h.

Referenced by FWEveView(), pointLineScalesChanged(), and populateController().

◆ m_lineWireframeScale

FWDoubleParameter FWEveView::m_lineWireframeScale
private

Definition at line 140 of file FWEveView.h.

Referenced by FWEveView(), pointLineScalesChanged(), and populateController().

◆ m_localEnergyScale

std::unique_ptr<FWViewEnergyScale> FWEveView::m_localEnergyScale
private

Definition at line 147 of file FWEveView.h.

Referenced by FWEveView(), populateController(), setFrom(), and useGlobalEnergyScaleChanged().

◆ m_overlayEventInfo

FWEventAnnotation* FWEveView::m_overlayEventInfo
private

Definition at line 122 of file FWEveView.h.

Referenced by addTo(), eventEnd(), FWEveView(), and setFrom().

◆ m_overlayLogo

CmsAnnotation* FWEveView::m_overlayLogo
private

Definition at line 123 of file FWEveView.h.

Referenced by addTo(), FWEveView(), and setFrom().

◆ m_ownedProducts

TEveElement* FWEveView::m_ownedProducts
private

Definition at line 119 of file FWEveView.h.

Referenced by FWEveView(), and ownedProducts().

◆ m_pointSize

FWDoubleParameter FWEveView::m_pointSize
private

Definition at line 136 of file FWEveView.h.

Referenced by FWEveView(), pointLineScalesChanged(), and populateController().

◆ m_pointSmooth

FWBoolParameter FWEveView::m_pointSmooth
private

Definition at line 135 of file FWEveView.h.

Referenced by FWEveView(), pointLineScalesChanged(), and populateController().

◆ m_showCameraGuide

FWBoolParameter FWEveView::m_showCameraGuide
private

Definition at line 142 of file FWEveView.h.

Referenced by cameraGuideChanged(), FWEveView(), and populateController().

◆ m_useGlobalEnergyScale

FWBoolParameter FWEveView::m_useGlobalEnergyScale
private

◆ m_viewContext

std::unique_ptr<FWViewContext> FWEveView::m_viewContext
private

Definition at line 146 of file FWEveView.h.

Referenced by addTo(), FWEveView(), setContext(), useGlobalEnergyScaleChanged(), and viewContext().

◆ m_viewContextMenu

std::shared_ptr<FWViewContextMenuHandlerGL> FWEveView::m_viewContextMenu
private

Definition at line 145 of file FWEveView.h.

Referenced by contextMenuHandler(), and FWEveView().

◆ m_viewEnergyScaleEditor

FWViewEnergyScaleEditor* FWEveView::m_viewEnergyScaleEditor
mutableprivate

Definition at line 149 of file FWEveView.h.

Referenced by populateController(), and useGlobalEnergyScaleChanged().

◆ m_viewer

FWTEveViewer* FWEveView::m_viewer
private

Definition at line 117 of file FWEveView.h.

Referenced by FWEveView(), fwViewer(), fwViewerGL(), viewer(), viewerGL(), and ~FWEveView().

FWEveView::setupEnergyScale
virtual void setupEnergyScale()
Definition: FWEveView.cc:251
CmsShowCommon::getLightColorSet
const TGLColorSet & getLightColorSet() const
Definition: CmsShowCommon.h:72
FWGLEventHandler::openSelectedModelContextMenu_
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
Definition: FWGLEventHandler.h:25
FWParameterizable::const_iterator
std::vector< FWParameterBase * >::const_iterator const_iterator
Definition: FWParameterizable.h:34
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
mps_fire.i
i
Definition: mps_fire.py:355
ViewerParameterGUI::addFrameToContainer
void addFrameToContainer(TGCompositeFrame *)
Definition: CmsShowViewPopup.cc:245
FWEveView::m_lineWireframeScale
FWDoubleParameter m_lineWireframeScale
Definition: FWEveView.h:140
FWEveView::m_useGlobalEnergyScale
FWBoolParameter m_useGlobalEnergyScale
Definition: FWEveView.h:143
L1TowerCalibrationProducer_cfi.calo
calo
Definition: L1TowerCalibrationProducer_cfi.py:59
FWViewType::idToName
static const std::string & idToName(int)
Definition: FWViewType.cc:72
FWEveView::m_drawCMSLogo
FWBoolParameter m_drawCMSLogo
Definition: FWEveView.h:133
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
FWEveView::m_localEnergyScale
std::unique_ptr< FWViewEnergyScale > m_localEnergyScale
Definition: FWEveView.h:147
FWEveView::getEveCalo
virtual TEveCaloViz * getEveCalo() const
Definition: FWEveView.h:100
FWViewBase::typeName
const std::string & typeName() const
Definition: FWViewBase.cc:107
FWEveView::m_viewEnergyScaleEditor
FWViewEnergyScaleEditor * m_viewEnergyScaleEditor
Definition: FWEveView.h:149
FWViewContextMenuHandlerGL
Definition: FWViewContextMenuHandlerGL.h:9
FWGLEventHandler::setViewer
void setViewer(FWEveView *ev)
Definition: FWGLEventHandler.h:27
FWEnumParameter::addEntry
bool addEntry(Long_t id, const std::string &txt)
Definition: FWEnumParameter.h:53
FWEveView::viewContext
FWViewContext * viewContext()
Definition: FWEveView.h:83
cms::cuda::assert
assert(be >=bs)
FWParameterizable::end
const_iterator end() const
Definition: FWParameterizable.h:38
FWViewEnergyScale::getPlotEt
bool getPlotEt() const
Definition: FWViewEnergyScale.h:47
FWViewEnergyScale::updateScaleFactors
void updateScaleFactors(float iMaxVal)
Definition: FWViewEnergyScale.cc:70
FWTEveViewer
Definition: FWTEveViewer.h:36
DDAxes::x
FWEveView::m_lineSmooth
FWBoolParameter m_lineSmooth
Definition: FWEveView.h:137
CmsShowCommon::getDarkColorSet
const TGLColorSet & getDarkColorSet() const
Definition: CmsShowCommon.h:73
FWEventAnnotation::addTo
virtual void addTo(FWConfiguration &) const
Definition: FWEventAnnotation.cc:69
FWParameterizable::begin
const_iterator begin() const
Definition: FWParameterizable.h:36
FWEveView::useGlobalEnergyScaleChanged
virtual void useGlobalEnergyScaleChanged()
Definition: FWEveView.cc:237
FWViewEnergyScaleEditor::setEnabled
void setEnabled(bool)
Definition: FWViewEnergyScaleEditor.cc:48
FWEveView::m_cameraGuide
TGLCameraGuide * m_cameraGuide
Definition: FWEveView.h:125
FWViewEnergyScaleEditor
Definition: FWViewEnergyScaleEditor.h:37
FWViewBase::typeId
FWViewType::EType typeId() const
Definition: FWViewBase.h:42
alignCSCRings.s
s
Definition: alignCSCRings.py:92
FWGenericParameter::changed_
sigc::signal< void, T > changed_
Definition: FWGenericParameter.h:75
CmsShowCommon::getEnergyScale
FWViewEnergyScale * getEnergyScale() const
Definition: CmsShowCommon.h:70
FWEveView::m_viewer
FWTEveViewer * m_viewer
Definition: FWEveView.h:117
ViewerParameterGUI::separator
ViewerParameterGUI & separator()
Definition: CmsShowViewPopup.cc:232
FWEveView::context
const fireworks::Context & context()
Definition: FWEveView.h:64
FWEventAnnotation::setLevel
void setLevel(long x)
Definition: FWEventAnnotation.cc:21
fireworks::Context::voteMaxEtAndEnergy
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:162
FWEveView::m_viewContextMenu
std::shared_ptr< FWViewContextMenuHandlerGL > m_viewContextMenu
Definition: FWEveView.h:145
FWViewType::isLego
static bool isLego(int)
Definition: FWViewType.cc:102
FWViewBase::openSelectedModelContextMenu_
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
Definition: FWViewBase.h:57
FWEveView::pointLineScalesChanged
virtual void pointLineScalesChanged()
Definition: FWEveView.cc:198
FWConfiguration::valueForKey
const FWConfiguration * valueForKey(const std::string &iKey) const
Definition: FWConfiguration.cc:121
FWEveView::cameraGuideChanged
virtual void cameraGuideChanged()
Definition: FWEveView.cc:209
fireworks::Context::commonPrefs
CmsShowCommon * commonPrefs() const
Definition: Context.cc:160
FWEveView::m_pointSmooth
FWBoolParameter m_pointSmooth
Definition: FWEveView.h:135
ScaleAnnotation
Definition: FWEveView.cc:57
FWEveView::m_overlayLogo
CmsAnnotation * m_overlayLogo
Definition: FWEveView.h:123
FWEventAnnotation
Definition: FWEventAnnotation.h:11
FWEveView::m_geoScene
TEveScene * m_geoScene
Definition: FWEveView.h:120
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FWViewEnergyScale::getScaleFactorLego
float getScaleFactorLego() const
Definition: FWViewEnergyScale.h:45
FWConfiguration::value
const std::string & value(unsigned int iIndex=0) const
Definition: FWConfiguration.cc:114
summarizeEdmComparisonLogfiles.succeeded
succeeded
Definition: summarizeEdmComparisonLogfiles.py:101
FWEveView::m_showCameraGuide
FWBoolParameter m_showCameraGuide
Definition: FWEveView.h:142
FWEveView::m_pointSize
FWDoubleParameter m_pointSize
Definition: FWEveView.h:136
ViewerParameterGUI::getTabContainer
TGCompositeFrame * getTabContainer()
Definition: CmsShowViewPopup.cc:240
FWEventAnnotation::setFrom
virtual void setFrom(const FWConfiguration &)
Definition: FWEventAnnotation.cc:83
FWEveView::m_context
const fireworks::Context * m_context
Definition: FWEveView.h:109
FWEveView::m_overlayEventInfo
FWEventAnnotation * m_overlayEventInfo
Definition: FWEveView.h:122
FWEveView::m_ownedProducts
TEveElement * m_ownedProducts
Definition: FWEveView.h:119
CmsAnnotation::addTo
virtual void addTo(FWConfiguration &) const
Definition: CmsAnnotation.cc:313
FWTEveViewer::fwGlViewer
FWTGLViewer * fwGlViewer()
Definition: FWTEveViewer.h:50
value
Definition: value.py:1
FWEveView::m_viewContext
std::unique_ptr< FWViewContext > m_viewContext
Definition: FWEveView.h:146
FWViewContext::scaleChanged
void scaleChanged()
Definition: FWViewContext.cc:23
fireworks::Context::getMaxEnergyInEvent
float getMaxEnergyInEvent(bool isEt) const
Definition: Context.cc:174
FWConfiguration::version
unsigned int version() const
Definition: FWConfiguration.h:49
FWViewContext
Definition: FWViewContext.h:32
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
FWGenericParameter::value
T value() const
Definition: FWGenericParameter.h:50
FWViewEnergyScale::getScaleFactor3D
float getScaleFactor3D() const
Definition: FWViewEnergyScale.h:44
FWConfiguration::addKeyValue
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
Definition: FWConfiguration.cc:57
fwlog::kInfo
Definition: fwLog.h:35
FWEveView::m_eventInfoLevel
FWEnumParameter m_eventInfoLevel
Definition: FWEveView.h:132
type
type
Definition: HCALResponse.h:21
FWTEveViewer::SpawnFWTGLViewer
FWTGLViewer * SpawnFWTGLViewer()
Definition: FWTEveViewer.cc:109
FWConfigurableParameterizable::addTo
void addTo(FWConfiguration &) const override
Definition: FWConfigurableParameterizable.cc:67
fwlog::kDebug
Definition: fwLog.h:35
FWConfigurableParameterizable::version
unsigned int version() const
Definition: FWConfigurableParameterizable.h:37
FWColorManager::setColorSetViewer
static Bool_t setColorSetViewer(TGLViewer *, Color_t)
Definition: FWColorManager.cc:224
FWGLEventHandler
Definition: FWGLEventHandler.h:11
CmsAnnotation
Definition: CmsAnnotation.h:10
FWViewEnergyScale
Definition: FWViewEnergyScale.h:34
FWEveView::m_energyMaxValAnnotation
ScaleAnnotation * m_energyMaxValAnnotation
Definition: FWEveView.h:124
FWViewBase::FWViewBase
FWViewBase(FWViewType::EType, unsigned int iVersion=1)
Definition: FWViewBase.cc:32
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
FWEveView::m_imageScale
FWDoubleParameter m_imageScale
Definition: FWEveView.h:130
CmsAnnotation::setVisible
void setVisible(bool x)
Definition: CmsAnnotation.cc:305
FWEveView::m_eventScene
TEveScene * m_eventScene
Definition: FWEveView.h:118
FWEveView::viewerGL
TGLViewer * viewerGL() const
Definition: FWEveView.cc:177
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
CmsAnnotation::setFrom
virtual void setFrom(const FWConfiguration &)
Definition: CmsAnnotation.cc:327
FWConfiguration
Definition: FWConfiguration.h:31
FWEveView::voteCaloMaxVal
virtual void voteCaloMaxVal()
Definition: FWEveView.cc:245
FWEveView::m_lineOutlineScale
FWDoubleParameter m_lineOutlineScale
Definition: FWEveView.h:139
FWTGLViewer
Definition: FWTGLViewer.h:32
FWViewContext::getEnergyScale
FWViewEnergyScale * getEnergyScale() const
Definition: FWViewContext.cc:25
ViewerParameterGUI::addParam
ViewerParameterGUI & addParam(const FWParameterBase *)
Definition: CmsShowViewPopup.cc:212
FWEveView::m_lineWidth
FWDoubleParameter m_lineWidth
Definition: FWEveView.h:138
ViewerParameterGUI::requestTab
ViewerParameterGUI & requestTab(const char *)
Definition: CmsShowViewPopup.cc:197
FWEventAnnotation::setEvent
void setEvent()
Definition: FWEventAnnotation.cc:30