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 55 of file FWEveView.h.

Constructor & Destructor Documentation

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

Definition at line 77 of file FWEveView.cc.

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().

77  :
79  m_context(nullptr),
80  m_viewer(nullptr),
81  m_eventScene(nullptr),
82  m_ownedProducts(nullptr),
83  m_geoScene(nullptr),
84  m_overlayEventInfo(nullptr),
85  m_overlayLogo(nullptr),
86  m_energyMaxValAnnotation(nullptr),
87  m_cameraGuide(nullptr),
88  // style
89 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,26,0)
90  m_imageScale(this, "Image Scale", 1.0, 1.0, 6.0),
91 #endif
92  m_eventInfoLevel(this, "Overlay Event Info", 0l, 0l, 2l),
93  m_drawCMSLogo(this,"Show Logo",false),
94  m_pointSmooth(this, "Smooth points", false),
95  m_pointSize(this, "Point size", 1.0, 1.0, 10.0),
96  m_lineSmooth(this, "Smooth lines", false),
97  m_lineWidth(this,"Line width",1.0,1.0,10.0),
98  m_lineOutlineScale(this, "Outline width scale", 1.0, 0.01, 10.0),
99  m_lineWireframeScale(this, "Wireframe width scale", 1.0, 0.01, 10.0),
100  m_showCameraGuide(this,"Show Camera Guide",false),
101  m_useGlobalEnergyScale(this, "UseGlobalEnergyScale", true),
104  m_viewEnergyScaleEditor(nullptr)
105 {
106  m_viewer = new FWTEveViewer(typeName().c_str());
107 
108  FWTGLViewer *embeddedViewer = m_viewer->SpawnFWTGLViewer();
109  iParent->ReplaceWindow(m_viewer);
110  gEve->GetViewers()->AddElement(m_viewer);
111 
112  m_eventScene = gEve->SpawnNewScene(Form("EventScene %s", typeName().c_str()));
113  m_ownedProducts = new TEveElementList("ViewSpecificProducts");
114  m_eventScene->AddElement(m_ownedProducts);
115 
116  m_viewer->AddScene(m_eventScene);
117 
118  // spawn geo scene
119  m_geoScene = gEve->SpawnNewScene(Form("GeoScene %s", typeName().c_str()));
120  m_geoScene->GetGLScene()->SetSelectable(kFALSE);
121  m_viewer->AddScene(m_geoScene);
122 
123  FWGLEventHandler* eh = new FWGLEventHandler((TGWindow*)embeddedViewer->GetGLWidget(), (TObject*)embeddedViewer);
124  embeddedViewer->SetEventHandler(eh);
125  eh->setViewer(this);
127  eh->SetDoInternalSelection(kFALSE);
129  // ctxHand->setPickCameraCenter(true);
130  m_viewContextMenu.reset(ctxHand);
131 
132  m_energyMaxValAnnotation = new ScaleAnnotation(viewerGL(), "empty", 0.1, 0.9);
133  m_energyMaxValAnnotation->SetRole(TGLOverlayElement::kViewer);
134  m_energyMaxValAnnotation->SetState(TGLOverlayElement::kInvisible);
135  m_energyMaxValAnnotation->SetUseColorSet(false);
136  m_energyMaxValAnnotation->SetTextSize(0.05);
137  m_energyMaxValAnnotation->SetTextColor(kMagenta);
138 
139  // style params
140 
141  m_overlayEventInfo = new FWEventAnnotation(embeddedViewer);
143 
144  m_eventInfoLevel.addEntry(0, "Nothing");
145  m_eventInfoLevel.addEntry(1, "Run / event");
146  m_eventInfoLevel.addEntry(2, "Run / event / lumi");
147  m_eventInfoLevel.addEntry(3, "Full");
149 
150  m_overlayLogo = new CmsAnnotation(embeddedViewer, 0.02, 0.98);
151  m_overlayLogo->setVisible(false);
153 
154  m_cameraGuide = new TGLCameraGuide(0.9, 0.1, 0.08);
155  m_cameraGuide->SetState(TGLOverlayElement::kInvisible);
156  embeddedViewer->AddOverlayElement(m_cameraGuide);
157  m_showCameraGuide.changed_.connect(boost::bind(&FWEveView::cameraGuideChanged,this));
158 
159  m_pointSmooth.changed_.connect(boost::bind(&FWEveView::pointLineScalesChanged,this));
160  m_pointSize.changed_.connect(boost::bind(&FWEveView::pointLineScalesChanged,this));
161  m_lineSmooth.changed_.connect(boost::bind(&FWEveView::pointLineScalesChanged,this));
162  m_lineWidth.changed_.connect(boost::bind(&FWEveView::pointLineScalesChanged,this));
165 
166 
167  // create scale for view ..
168  m_viewContext->setEnergyScale(m_localEnergyScale.get());
170  m_localEnergyScale->parameterChanged_.connect(boost::bind(&FWEveView::setupEnergyScale, this));
171 }
type
Definition: HCALResponse.h:21
FWEventAnnotation * m_overlayEventInfo
Definition: FWEveView.h:126
virtual void useGlobalEnergyScaleChanged()
Definition: FWEveView.cc:287
std::shared_ptr< FWViewContextMenuHandlerGL > m_viewContextMenu
Definition: FWEveView.h:149
virtual void pointLineScalesChanged()
Definition: FWEveView.cc:225
const std::string & typeName() const
Definition: FWViewBase.cc:120
TEveScene * m_geoScene
Definition: FWEveView.h:124
FWViewEnergyScaleEditor * m_viewEnergyScaleEditor
Definition: FWEveView.h:153
virtual void setupEnergyScale()
Definition: FWEveView.cc:303
FWDoubleParameter m_pointSize
Definition: FWEveView.h:140
TGLViewer * viewerGL() const
Definition: FWEveView.cc:190
sigc::signal< void, T > changed_
const fireworks::Context * m_context
Definition: FWEveView.h:112
TEveElement * m_ownedProducts
Definition: FWEveView.h:123
FWBoolParameter m_lineSmooth
Definition: FWEveView.h:141
FWBoolParameter m_showCameraGuide
Definition: FWEveView.h:146
FWBoolParameter m_useGlobalEnergyScale
Definition: FWEveView.h:147
virtual void cameraGuideChanged()
Definition: FWEveView.cc:238
ScaleAnnotation * m_energyMaxValAnnotation
Definition: FWEveView.h:128
FWTEveViewer * m_viewer
Definition: FWEveView.h:121
bool addEntry(Long_t id, const std::string &txt)
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
FWBoolParameter m_drawCMSLogo
Definition: FWEveView.h:137
void setViewer(FWEveView *ev)
std::unique_ptr< FWViewEnergyScale > m_localEnergyScale
Definition: FWEveView.h:151
FWBoolParameter m_pointSmooth
Definition: FWEveView.h:139
FWDoubleParameter m_imageScale
Definition: FWEveView.h:134
FWDoubleParameter m_lineOutlineScale
Definition: FWEveView.h:143
TEveScene * m_eventScene
Definition: FWEveView.h:122
FWEnumParameter m_eventInfoLevel
Definition: FWEveView.h:136
std::unique_ptr< FWViewContext > m_viewContext
Definition: FWEveView.h:150
static const std::string & idToName(int)
Definition: FWViewType.cc:89
FWDoubleParameter m_lineWidth
Definition: FWEveView.h:142
FWDoubleParameter m_lineWireframeScale
Definition: FWEveView.h:144
void setVisible(bool x)
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
Definition: FWViewBase.h:58
TGLCameraGuide * m_cameraGuide
Definition: FWEveView.h:129
FWTGLViewer * SpawnFWTGLViewer()
FWViewBase(FWViewType::EType, unsigned int iVersion=1)
Definition: FWViewBase.cc:33
CmsAnnotation * m_overlayLogo
Definition: FWEveView.h:127
FWEveView::~FWEveView ( )
override

Definition at line 173 of file FWEveView.cc.

References m_eventScene, m_geoScene, and m_viewer.

174 {
175  m_geoScene->RemoveElements();
176  m_eventScene->RemoveElements();
177  m_viewer->DestroyWindowAndSlot();
178 }
TEveScene * m_geoScene
Definition: FWEveView.h:124
FWTEveViewer * m_viewer
Definition: FWEveView.h:121
TEveScene * m_eventScene
Definition: FWEveView.h:122
FWEveView::FWEveView ( const FWEveView )
privatedelete

Member Function Documentation

void FWEveView::addTo ( FWConfiguration iTo) const
overridevirtual

Reimplemented from FWConfigurableParameterizable.

Reimplemented in FWLegoViewBase, FWRPZView, and FWGlimpseView.

Definition at line 351 of file FWEveView.cc.

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

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

352 {
353  // take care of parameters
355 
356  {
357  assert ( m_overlayEventInfo );
359  }
360  {
361  assert ( m_overlayLogo );
362  m_overlayLogo->addTo(iTo);
363  }
364 
365  m_viewContext->getEnergyScale()->addTo(iTo);
366 }
void addTo(FWConfiguration &) const override
FWEventAnnotation * m_overlayEventInfo
Definition: FWEveView.h:126
virtual void addTo(FWConfiguration &) const
std::unique_ptr< FWViewContext > m_viewContext
Definition: FWEveView.h:150
virtual void addTo(FWConfiguration &) const
CmsAnnotation * m_overlayLogo
Definition: FWEveView.h:127
void FWEveView::addToOrthoCamera ( TGLOrthoCamera *  camera,
FWConfiguration iTo 
) const
protected

Definition at line 424 of file FWEveView.cc.

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

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

425 {
426  // zoom
427  std::string name("cameraZoom");
428  iTo.addKeyValue(name+typeName(),FWConfiguration(std::to_string(camera->GetZoom())));
429 
430  // transformation matrix
431  std::string matrixName("cameraMatrix");
432  for ( unsigned int i = 0; i < 16; ++i ) {
433  std::ostringstream osIndex;
434  osIndex << i;
435  std::ostringstream osValue;
436  osValue << camera->GetCamTrans()[i];
437  iTo.addKeyValue(matrixName+osIndex.str()+typeName(),FWConfiguration(osValue.str()));
438  }
439 }
const std::string & typeName() const
Definition: FWViewBase.cc:120
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
void FWEveView::addToPerspectiveCamera ( TGLPerspectiveCamera *  cam,
const std::string &  name,
FWConfiguration iTo 
) const
protected

Definition at line 477 of file FWEveView.cc.

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

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

478 {
479  // transformation matrix
480  std::string matrixName("cameraMatrix");
481  for ( unsigned int i = 0; i < 16; ++i ){
482  std::ostringstream osIndex;
483  osIndex << i;
484  std::ostringstream osValue;
485  osValue << (cam->GetCamTrans())[i];
486  iTo.addKeyValue(matrixName+osIndex.str()+name,FWConfiguration(osValue.str()));
487  }
488 
489  // transformation matrix base
490  matrixName = "cameraMatrixBase";
491  for ( unsigned int i = 0; i < 16; ++i ){
492  std::ostringstream osIndex;
493  osIndex << i;
494  std::ostringstream osValue;
495  osValue << (cam->GetCamBase())[i];
496  iTo.addKeyValue(matrixName+osIndex.str()+name,FWConfiguration(osValue.str()));
497  }
498  {
499  iTo.addKeyValue(name+" FOV",FWConfiguration(std::to_string(cam->GetFOV())));
500  }
501 }
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
void FWEveView::cameraGuideChanged ( )
protectedvirtual

Definition at line 238 of file FWEveView.cc.

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

Referenced by FWEveView().

239 {
240  m_cameraGuide->SetBinaryState(m_showCameraGuide.value());
241  viewerGL()->Changed();
242  gEve->Redraw3D();
243 }
TGLViewer * viewerGL() const
Definition: FWEveView.cc:190
FWBoolParameter m_showCameraGuide
Definition: FWEveView.h:146
TGLCameraGuide * m_cameraGuide
Definition: FWEveView.h:129
const fireworks::Context& FWEveView::context ( )
inline
FWViewContextMenuHandlerBase * FWEveView::contextMenuHandler ( ) const
overridevirtual

Reimplemented from FWViewBase.

Definition at line 185 of file FWEveView.cc.

References m_viewContextMenu.

185  {
186  return dynamic_cast<FWViewContextMenuHandlerBase*> (m_viewContextMenu.get());
187 }
std::shared_ptr< FWViewContextMenuHandlerGL > m_viewContextMenu
Definition: FWEveView.h:149
void FWEveView::eventBegin ( )
virtual

Reimplemented in FWRPZView.

Definition at line 246 of file FWEveView.cc.

247 {
248 }
void FWEveView::eventEnd ( )
virtual

Reimplemented in FWRPZView.

Definition at line 251 of file FWEveView.cc.

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

Referenced by FWRPZView::eventEnd().

252 {
255 }
FWEventAnnotation * m_overlayEventInfo
Definition: FWEveView.h:126
virtual void setupEnergyScale()
Definition: FWEveView.cc:303
TEveScene* FWEveView::eventScene ( )
inline
FWTEveViewer* FWEveView::fwViewer ( )
inline

Definition at line 80 of file FWEveView.h.

80 { return m_viewer; }
FWTEveViewer * m_viewer
Definition: FWEveView.h:121
FWTGLViewer * FWEveView::fwViewerGL ( ) const

Definition at line 202 of file FWEveView.cc.

References FWTEveViewer::fwGlViewer(), and m_viewer.

203 {
204  return m_viewer->fwGlViewer();
205 }
FWTGLViewer * fwGlViewer()
Definition: FWTEveViewer.h:53
FWTEveViewer * m_viewer
Definition: FWEveView.h:121
TEveScene* FWEveView::geoScene ( )
inline
virtual TEveCaloViz* FWEveView::getEveCalo ( ) const
inlineprotectedvirtual

Reimplemented in FWLegoViewBase, FWRPZView, and FW3DView.

Definition at line 103 of file FWEveView.h.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by setupEnergyScale(), and voteCaloMaxVal().

103 { return nullptr; }
bool FWEveView::isEnergyScaleGlobal ( ) const
virtual

Definition at line 281 of file FWEveView.cc.

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

282 {
283  return m_useGlobalEnergyScale.value();
284 }
FWBoolParameter m_useGlobalEnergyScale
Definition: FWEveView.h:147
const FWEveView& FWEveView::operator= ( const FWEveView )
privatedelete
TEveElement* FWEveView::ownedProducts ( )
inline

Definition at line 85 of file FWEveView.h.

Referenced by FWEveViewManager::finishViewCreate().

85 { return m_ownedProducts; }
TEveElement * m_ownedProducts
Definition: FWEveView.h:123
void FWEveView::pointLineScalesChanged ( )
protectedvirtual

Definition at line 225 of file FWEveView.cc.

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

Referenced by FWEveView().

226 {
227  viewerGL()->SetSmoothPoints(m_pointSmooth.value());
228  viewerGL()->SetPointScale (m_pointSize.value());
229  viewerGL()->SetSmoothLines (m_lineSmooth.value());
230  viewerGL()->SetLineScale (m_lineWidth.value());
231  viewerGL()->SetOLLineW (m_lineOutlineScale.value());
232  viewerGL()->SetWFLineW (m_lineWireframeScale.value());
233  viewerGL()->Changed();
234  gEve->Redraw3D();
235 }
FWDoubleParameter m_pointSize
Definition: FWEveView.h:140
TGLViewer * viewerGL() const
Definition: FWEveView.cc:190
FWBoolParameter m_lineSmooth
Definition: FWEveView.h:141
FWBoolParameter m_pointSmooth
Definition: FWEveView.h:139
FWDoubleParameter m_lineOutlineScale
Definition: FWEveView.h:143
FWDoubleParameter m_lineWidth
Definition: FWEveView.h:142
FWDoubleParameter m_lineWireframeScale
Definition: FWEveView.h:144
void FWEveView::populateController ( ViewerParameterGUI gui) const
overridevirtual

Reimplemented from FWViewBase.

Reimplemented in FWLegoViewBase, FWRPZView, and FWISpyView.

Definition at line 556 of file FWEveView.cc.

References ViewerParameterGUI::addFrameToContainer(), 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(), mps_merge::separator, FWViewEnergyScaleEditor::setEnabled(), FWViewBase::typeId(), and FWGenericParameter< T >::value().

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

557 {
558  gui.requestTab("Style").
559  addParam(&m_eventInfoLevel).
560  addParam(&m_drawCMSLogo).
561  addParam(&m_showCameraGuide).
562  separator().
563 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,26,0)
564  addParam(&m_imageScale).
565 #endif
566  addParam(&m_pointSize).
567  addParam(&m_pointSmooth).
568  addParam(&m_lineSmooth).
569  addParam(&m_lineWidth).
570  addParam(&m_lineOutlineScale).
571  addParam(&m_lineWireframeScale);
572 
573 
574  gui.requestTab("Scales").
575  addParam(&m_useGlobalEnergyScale);
576 
580 }
string separator
Definition: mps_merge.py:79
ViewerParameterGUI & requestTab(const char *)
FWViewEnergyScaleEditor * m_viewEnergyScaleEditor
Definition: FWEveView.h:153
void addFrameToContainer(TGCompositeFrame *)
FWDoubleParameter m_pointSize
Definition: FWEveView.h:140
FWBoolParameter m_lineSmooth
Definition: FWEveView.h:141
FWBoolParameter m_showCameraGuide
Definition: FWEveView.h:146
FWBoolParameter m_useGlobalEnergyScale
Definition: FWEveView.h:147
FWBoolParameter m_drawCMSLogo
Definition: FWEveView.h:137
std::unique_ptr< FWViewEnergyScale > m_localEnergyScale
Definition: FWEveView.h:151
FWBoolParameter m_pointSmooth
Definition: FWEveView.h:139
FWDoubleParameter m_imageScale
Definition: FWEveView.h:134
FWDoubleParameter m_lineOutlineScale
Definition: FWEveView.h:143
TGCompositeFrame * getTabContainer()
FWEnumParameter m_eventInfoLevel
Definition: FWEveView.h:136
static bool isLego(int)
Definition: FWViewType.cc:135
FWDoubleParameter m_lineWidth
Definition: FWEveView.h:142
FWDoubleParameter m_lineWireframeScale
Definition: FWEveView.h:144
FWViewType::EType typeId() const
Definition: FWViewBase.h:43
virtual bool FWEveView::requestGLHandlerPick ( ) const
inlinevirtual

Reimplemented in FW3DViewBase.

Definition at line 95 of file FWEveView.h.

Referenced by FWGLEventHandler::HandleButton().

95 { return false;}
void FWEveView::resetCamera ( )
protectedvirtual

Definition at line 264 of file FWEveView.cc.

References viewerGL().

265 {
266  viewerGL()->ResetCurrentCamera();
267 }
TGLViewer * viewerGL() const
Definition: FWEveView.cc:190
void FWEveView::saveImageTo ( const std::string &  iName) const
overridevirtual

Implements FWViewBase.

Definition at line 208 of file FWEveView.cc.

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

209 {
210  bool succeeded = false;
211 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,26,0)
212  succeeded = viewerGL()->SavePictureScale(iName, m_imageScale.value());
213 #else
214  succeeded = viewerGL()->SavePicture(iName.c_str());
215 #endif
216 
217  if(!succeeded) {
218  throw std::runtime_error("Unable to save picture");
219  }
220  fwLog(fwlog::kInfo) << "Saved image " << iName << std::endl;
221 }
TGLViewer * viewerGL() const
Definition: FWEveView.cc:190
FWDoubleParameter m_imageScale
Definition: FWEveView.h:134
#define fwLog(_level_)
Definition: fwLog.h:50
void FWEveView::setBackgroundColor ( Color_t  iColor)
virtual

Reimplemented in FWEveLegoView.

Definition at line 258 of file FWEveView.cc.

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

Referenced by Vispa.Plugins.EdmBrowser.EventContentView.LabelItem::__init__(), and FWEveLegoView::setBackgroundColor().

259 {
261 }
TGLViewer * viewerGL() const
Definition: FWEveView.cc:190
static Bool_t setColorSetViewer(TGLViewer *, Color_t)
void FWEveView::setContext ( const fireworks::Context x)
virtual

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

Definition at line 271 of file FWEveView.cc.

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

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

272 {
273  m_context = &x ;
274 
275  // in constructor view context has local scale
277  m_viewContext->setEnergyScale(context().commonPrefs()->getEnergyScale());
278 }
const fireworks::Context * m_context
Definition: FWEveView.h:112
FWBoolParameter m_useGlobalEnergyScale
Definition: FWEveView.h:147
const fireworks::Context & context()
Definition: FWEveView.h:67
std::unique_ptr< FWViewContext > m_viewContext
Definition: FWEveView.h:150
void FWEveView::setFrom ( const FWConfiguration iFrom)
overridevirtual

Reimplemented from FWConfigurableParameterizable.

Reimplemented in FWRPZView, FWLegoViewBase, and FWGlimpseView.

Definition at line 369 of file FWEveView.cc.

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

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

370 {
371  // Make sure you change the version ranges here
372  // whenever you update the logic.
373  // The rationale should be:
374  // (version range supported by the next block) && (version range in the configuration file)
375  //
376  // This is not "forward" compatible, but I don't think
377  // we care.
378  if (version() >= 2 && iFrom.version() >= 1)
379  {
380  for(const_iterator it =begin(), itEnd = end();
381  it != itEnd;
382  ++it) {
383  (*it)->setFrom(iFrom);
384  }
385  }
386  if (iFrom.version() > 1)
387  {
388  assert( m_overlayEventInfo);
389  m_overlayEventInfo->setFrom(iFrom);
390  }
391  {
392  assert( m_overlayLogo);
393  m_overlayLogo->setFrom(iFrom);
394  }
395 
396  if (iFrom.version() > 4)
397  {
398  m_localEnergyScale->setFrom(iFrom);
399  }
400 
401 
402  // selection clors
403  {
404  const TGLColorSet& lcs = context().commonPrefs()->getLightColorSet();
405  const TGLColorSet& dcs = context().commonPrefs()->getDarkColorSet();
406  const UChar_t* ca = nullptr;
407 
408  ca = lcs.Selection(1).CArr();
409  viewerGL()->RefLightColorSet().Selection(1).SetColor(ca[0], ca[1], ca[2]);
410  ca = lcs.Selection(3).CArr();
411  viewerGL()->RefLightColorSet().Selection(3).SetColor(ca[0], ca[1], ca[2]);
412  ca = dcs.Selection(1).CArr();
413  viewerGL()->RefDarkColorSet().Selection(1).SetColor(ca[0], ca[1], ca[2]);
414  ca = dcs.Selection(3).CArr();
415  viewerGL()->RefDarkColorSet().Selection(3).SetColor(ca[0], ca[1], ca[2]);
416  }
417 }
FWEventAnnotation * m_overlayEventInfo
Definition: FWEveView.h:126
std::vector< FWParameterBase * >::const_iterator const_iterator
const_iterator begin() const
virtual void setFrom(const FWConfiguration &)
unsigned int version() const
TGLViewer * viewerGL() const
Definition: FWEveView.cc:190
virtual void setFrom(const FWConfiguration &)
const_iterator end() const
const TGLColorSet & getLightColorSet() const
Definition: CmsShowCommon.h:75
std::unique_ptr< FWViewEnergyScale > m_localEnergyScale
Definition: FWEveView.h:151
const fireworks::Context & context()
Definition: FWEveView.h:67
const TGLColorSet & getDarkColorSet() const
Definition: CmsShowCommon.h:76
CmsShowCommon * commonPrefs() const
Definition: Context.cc:177
CmsAnnotation * m_overlayLogo
Definition: FWEveView.h:127
void FWEveView::setFromOrthoCamera ( TGLOrthoCamera *  camera,
const FWConfiguration iFrom 
)
protected

Definition at line 442 of file FWEveView.cc.

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

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

443 {
444  try {
445  // zoom
446  std::string zoomName("cameraZoom"); zoomName += typeName();
447  if (iFrom.valueForKey(zoomName) == nullptr )
448  {
449  throw std::runtime_error("can't restore parameter cameraZoom");
450  }
451  camera->SetZoom(std::stod(iFrom.valueForKey(zoomName)->value()));
452 
453  // transformation matrix
454  std::string matrixName("cameraMatrix");
455  for ( unsigned int i = 0; i < 16; ++i ) {
456  std::ostringstream os;
457  os << i;
458  const FWConfiguration* value = iFrom.valueForKey( matrixName + os.str() + typeName() );
459  if ( value == nullptr )
460  {
461  throw std::runtime_error ("can't restore parameter cameraMatrix.");
462  }
463  std::istringstream s(value->value());
464  s>> (camera->RefCamTrans()[i]);
465  }
466  }
467  catch (const std::runtime_error& iException)
468  {
469  fwLog(fwlog::kInfo) << "Caught exception while restoring camera parameters in view " << typeName() << "\n.";
470  viewerGL()->ResetCamerasAfterNextUpdate();
471 
472  }
473  camera->IncTimeStamp();
474 }
#define nullptr
const std::string & typeName() const
Definition: FWViewBase.cc:120
TGLViewer * viewerGL() const
Definition: FWEveView.cc:190
Definition: value.py:1
const std::string & value(unsigned int iIndex=0) const
#define fwLog(_level_)
Definition: fwLog.h:50
const FWConfiguration * valueForKey(const std::string &iKey) const
void FWEveView::setFromPerspectiveCamera ( TGLPerspectiveCamera *  cam,
const std::string &  name,
const FWConfiguration iFrom 
)
protected

Definition at line 504 of file FWEveView.cc.

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

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

505 {
506  try {
507  std::string matrixName("cameraMatrix");
508  for ( unsigned int i = 0; i < 16; ++i ){
509  std::ostringstream os;
510  os << i;
511  const FWConfiguration* value = iFrom.valueForKey( matrixName + os.str() + name );
512  if ( value == nullptr )
513  {
514  throw std::runtime_error ("can't restore parameter cameraMatrix.");
515  }
516  std::istringstream s(value->value());
517  s>>((cam->RefCamTrans())[i]);
518  }
519 
520  // transformation matrix base
521  matrixName = "cameraMatrixBase";
522  for ( unsigned int i = 0; i < 16; ++i ){
523  std::ostringstream os;
524  os << i;
525  const FWConfiguration* value = iFrom.valueForKey( matrixName + os.str() + name );
526  if ( value == nullptr )
527  {
528  throw std::runtime_error ("can't restore parameter cameraMatrixBase.");
529  }
530 
531  std::istringstream s(value->value());
532  s>>((cam->RefCamBase())[i]);
533  }
534 
535  {
536  const FWConfiguration* value = iFrom.valueForKey( name + " FOV" );
537  if ( value == nullptr )
538  {
539  throw std::runtime_error ("can't restore parameter cameraMatrixBase.");
540  }
541  cam->SetFOV(std::stod(value->value()));
542  }
543 
544  cam->IncTimeStamp();
545  }
546  catch (const std::runtime_error& iException)
547  {
548  fwLog(fwlog::kInfo) << "Caught exception while restoring camera parameters in view " << typeName() << "\n.";
549  viewerGL()->ResetCamerasAfterNextUpdate();
550  fwLog(fwlog::kDebug) << "Reset camera fo view " << typeName() << "\n.";
551  }
552 }
const std::string & typeName() const
Definition: FWViewBase.cc:120
TGLViewer * viewerGL() const
Definition: FWEveView.cc:190
Definition: value.py:1
const std::string & value(unsigned int iIndex=0) const
#define fwLog(_level_)
Definition: fwLog.h:50
const FWConfiguration * valueForKey(const std::string &iKey) const
void FWEveView::setupEnergyScale ( )
virtual

Definition at line 303 of file FWEveView.cc.

References 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().

304 {
305  // Called at end of event OR if scale parameters changed.
306 
307  FWViewEnergyScale* energyScale = viewContext()->getEnergyScale();
308  // printf("setupEnergyScale %s >> scale name %s\n", typeName().c_str(), energyScale->name().c_str());
309  voteCaloMaxVal();
310 
311  // set cache for energy to lenght conversion
312  float maxVal = context().getMaxEnergyInEvent(energyScale->getPlotEt());
313  energyScale->updateScaleFactors(maxVal);
314  // printf("max event val %f \n", maxVal);
315  // printf("scales lego %f \n", energyScale->getScaleFactorLego());
316 
317  // configure TEveCaloViz
318  TEveCaloViz* calo = getEveCalo();
319  if (calo)
320  {
321  calo->SetPlotEt(energyScale->getPlotEt());
322  if (FWViewType::isLego(typeId()))
323  {
324  float f = energyScale->getScaleFactorLego();
325  calo->SetMaxValAbs(TMath::Pi()/f);
326  }
327  else
328  {
329  float f = energyScale->getScaleFactor3D();
330  calo->SetMaxValAbs(100/f);
331  }
332  calo->ElementChanged();
333  }
334 
335  // emit signal to proxy builders
337  gEve->Redraw3D();
338 }
void scaleChanged()
const double Pi
float getScaleFactor3D() const
virtual TEveCaloViz * getEveCalo() const
Definition: FWEveView.h:103
FWViewEnergyScale * getEnergyScale() const
void updateScaleFactors(float iMaxVal)
virtual void voteCaloMaxVal()
Definition: FWEveView.cc:295
float getScaleFactorLego() const
double f[11][100]
float getMaxEnergyInEvent(bool isEt) const
Definition: Context.cc:199
const fireworks::Context & context()
Definition: FWEveView.h:67
FWViewContext * viewContext()
Definition: FWEveView.h:86
static bool isLego(int)
Definition: FWViewType.cc:135
bool getPlotEt() const
FWViewType::EType typeId() const
Definition: FWViewBase.h:43
void FWEveView::setupEventCenter ( )
virtual

Reimplemented in FWRPZView.

Definition at line 341 of file FWEveView.cc.

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

Referenced by FWRPZView::setupEventCenter().

342 {
343  // piggyback on scales signal connections to redraw jets
344  // can add new signal in future if necessary
346  gEve->Redraw3D();
347 }
void scaleChanged()
FWViewContext * viewContext()
Definition: FWEveView.h:86
void FWEveView::useGlobalEnergyScaleChanged ( )
virtual

Definition at line 287 of file FWEveView.cc.

References fireworks::Context::commonPrefs(), context(), CmsShowCommon::getEnergyScale(), m_localEnergyScale, m_useGlobalEnergyScale, m_viewContext, m_viewEnergyScaleEditor, FWViewEnergyScaleEditor::setEnabled(), setupEnergyScale(), and FWGenericParameter< T >::value().

Referenced by FWEveView().

288 {
292 }
FWViewEnergyScaleEditor * m_viewEnergyScaleEditor
Definition: FWEveView.h:153
virtual void setupEnergyScale()
Definition: FWEveView.cc:303
FWBoolParameter m_useGlobalEnergyScale
Definition: FWEveView.h:147
std::unique_ptr< FWViewEnergyScale > m_localEnergyScale
Definition: FWEveView.h:151
const fireworks::Context & context()
Definition: FWEveView.h:67
FWViewEnergyScale * getEnergyScale() const
Definition: CmsShowCommon.h:72
CmsShowCommon * commonPrefs() const
Definition: Context.cc:177
std::unique_ptr< FWViewContext > m_viewContext
Definition: FWEveView.h:150
FWViewContext* FWEveView::viewContext ( )
inline

Definition at line 86 of file FWEveView.h.

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

86 { return m_viewContext.get(); }
std::unique_ptr< FWViewContext > m_viewContext
Definition: FWEveView.h:150
TEveViewer * FWEveView::viewer ( )

Definition at line 196 of file FWEveView.cc.

References m_viewer.

Referenced by FWGlimpseView::FWGlimpseView(), FWGLEventHandler::HandleCrossing(), and FWGLEventHandler::HandleFocusChange().

197 {
198  return m_viewer;
199 }
FWTEveViewer * m_viewer
Definition: FWEveView.h:121
TGLViewer * FWEveView::viewerGL ( ) const
void FWEveView::voteCaloMaxVal ( )
virtual

Reimplemented in FWRPZView.

Definition at line 295 of file FWEveView.cc.

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

Referenced by setupEnergyScale().

296 {
297  TEveCaloViz* calo = getEveCalo();
298  if (calo)
299  context().voteMaxEtAndEnergy(calo->GetData()->GetMaxVal(true), calo->GetData()->GetMaxVal(false));
300 }
virtual TEveCaloViz * getEveCalo() const
Definition: FWEveView.h:103
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:183
const fireworks::Context & context()
Definition: FWEveView.h:67

Member Data Documentation

TGLCameraGuide* FWEveView::m_cameraGuide
private

Definition at line 129 of file FWEveView.h.

Referenced by cameraGuideChanged(), and FWEveView().

const fireworks::Context* FWEveView::m_context
protected

Definition at line 112 of file FWEveView.h.

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

FWBoolParameter FWEveView::m_drawCMSLogo
private

Definition at line 137 of file FWEveView.h.

Referenced by FWEveView(), and populateController().

ScaleAnnotation* FWEveView::m_energyMaxValAnnotation
private

Definition at line 128 of file FWEveView.h.

Referenced by FWEveView().

FWEnumParameter FWEveView::m_eventInfoLevel
private

Definition at line 136 of file FWEveView.h.

Referenced by FWEveView(), and populateController().

TEveScene* FWEveView::m_eventScene
private

Definition at line 122 of file FWEveView.h.

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

TEveScene* FWEveView::m_geoScene
private

Definition at line 124 of file FWEveView.h.

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

FWDoubleParameter FWEveView::m_imageScale
private

Definition at line 134 of file FWEveView.h.

Referenced by populateController(), and saveImageTo().

FWDoubleParameter FWEveView::m_lineOutlineScale
private

Definition at line 143 of file FWEveView.h.

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

FWBoolParameter FWEveView::m_lineSmooth
private

Definition at line 141 of file FWEveView.h.

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

FWDoubleParameter FWEveView::m_lineWidth
private

Definition at line 142 of file FWEveView.h.

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

FWDoubleParameter FWEveView::m_lineWireframeScale
private

Definition at line 144 of file FWEveView.h.

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

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

Definition at line 151 of file FWEveView.h.

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

FWEventAnnotation* FWEveView::m_overlayEventInfo
private

Definition at line 126 of file FWEveView.h.

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

CmsAnnotation* FWEveView::m_overlayLogo
private

Definition at line 127 of file FWEveView.h.

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

TEveElement* FWEveView::m_ownedProducts
private

Definition at line 123 of file FWEveView.h.

Referenced by FWEveView().

FWDoubleParameter FWEveView::m_pointSize
private

Definition at line 140 of file FWEveView.h.

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

FWBoolParameter FWEveView::m_pointSmooth
private

Definition at line 139 of file FWEveView.h.

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

FWBoolParameter FWEveView::m_showCameraGuide
private

Definition at line 146 of file FWEveView.h.

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

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

Definition at line 150 of file FWEveView.h.

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

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

Definition at line 149 of file FWEveView.h.

Referenced by contextMenuHandler(), and FWEveView().

FWViewEnergyScaleEditor* FWEveView::m_viewEnergyScaleEditor
mutableprivate

Definition at line 153 of file FWEveView.h.

Referenced by populateController(), and useGlobalEnergyScaleChanged().

FWTEveViewer* FWEveView::m_viewer
private

Definition at line 121 of file FWEveView.h.

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