CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | 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

virtual void addTo (FWConfiguration &) const
 
const fireworks::Contextcontext ()
 
virtual
FWViewContextMenuHandlerBase
contextMenuHandler () const
 
virtual void eventBegin ()
 
virtual void eventEnd ()
 
TEveScene * eventScene ()
 
 FWEveView (TEveWindowSlot *, FWViewType::EType, unsigned int version=6)
 
TEveScene * geoScene ()
 
virtual bool isEnergyScaleGlobal () const
 
TEveElement * ownedProducts ()
 
virtual void populateController (ViewerParameterGUI &) const
 
virtual void saveImageTo (const std::string &iName) const
 
virtual void setBackgroundColor (Color_t)
 
virtual void setContext (const fireworks::Context &x)
 
virtual void setFrom (const FWConfiguration &)
 
virtual void setupEnergyScale ()
 
virtual void useGlobalEnergyScaleChanged ()
 
FWViewContextviewContext ()
 
TEveViewer * viewer ()
 
TGLViewer * viewerGL () const
 
virtual void voteCaloMaxVal ()
 
virtual ~FWEveView ()
 
- 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
 
virtual ~FWConfigurableParameterizable ()
 
- 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
virtual ~FWViewBase ()
 

Private Member Functions

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

Private Attributes

TGLCameraGuide * m_cameraGuide
 
const fireworks::Contextm_context
 
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::auto_ptr< FWViewEnergyScalem_localEnergyScale
 
FWEventAnnotationm_overlayEventInfo
 
CmsAnnotationm_overlayLogo
 
TEveElement * m_ownedProducts
 
FWDoubleParameter m_pointSize
 
FWBoolParameter m_pointSmooth
 
FWBoolParameter m_showCameraGuide
 
FWBoolParameter m_useGlobalEnergyScale
 
std::auto_ptr< FWViewContextm_viewContext
 
boost::shared_ptr
< FWViewContextMenuHandlerGL
m_viewContextMenu
 
FWViewEnergyScaleEditorm_viewEnergyScaleEditor
 
TEveViewer * m_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_
 
- Protected Attributes inherited from FWViewBase
FWViewType m_type
 

Detailed Description

Definition at line 53 of file FWEveView.h.

Constructor & Destructor Documentation

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

Definition at line 80 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(), FWViewContextMenuHandlerGL::setPickCameraCenter(), setupEnergyScale(), CmsAnnotation::setVisible(), FWViewBase::typeName(), useGlobalEnergyScaleChanged(), and viewerGL().

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

Definition at line 181 of file FWEveView.cc.

References m_eventScene, m_geoScene, and m_viewer.

182 {
183  m_geoScene->RemoveElements();
184  m_eventScene->RemoveElements();
185  m_viewer->DestroyWindowAndSlot();
186 }
TEveViewer * m_viewer
Definition: FWEveView.h:111
TEveScene * m_geoScene
Definition: FWEveView.h:114
TEveScene * m_eventScene
Definition: FWEveView.h:112
FWEveView::FWEveView ( const FWEveView )
private

Member Function Documentation

void FWEveView::addTo ( FWConfiguration iTo) const
virtual

Reimplemented from FWConfigurableParameterizable.

Reimplemented in FWLegoViewBase, FWRPZView, FW3DViewBase, and FWGlimpseView.

Definition at line 338 of file FWEveView.cc.

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

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

339 {
340  // take care of parameters
342 
343  {
344  assert ( m_overlayEventInfo );
346  }
347  {
348  assert ( m_overlayLogo );
349  m_overlayLogo->addTo(iTo);
350  }
351 
352  m_viewContext->getEnergyScale()->addTo(iTo);
353 }
FWEventAnnotation * m_overlayEventInfo
Definition: FWEveView.h:116
std::auto_ptr< FWViewContext > m_viewContext
Definition: FWEveView.h:144
virtual void addTo(FWConfiguration &) const
virtual void addTo(FWConfiguration &) const
CmsAnnotation * m_overlayLogo
Definition: FWEveView.h:117
virtual void addTo(FWConfiguration &) const
void FWEveView::addToOrthoCamera ( TGLOrthoCamera *  camera,
FWConfiguration iTo 
) const
protected

Definition at line 393 of file FWEveView.cc.

References FWConfiguration::addKeyValue(), i, AlCaRecoCosmics_cfg::name, asciidump::s, and FWViewBase::typeName().

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

394 {
395  // zoom
396  std::ostringstream s;
397  s<<(camera->fZoom);
398  std::string name("cameraZoom");
399  iTo.addKeyValue(name+typeName(),FWConfiguration(s.str()));
400 
401  // transformation matrix
402  std::string matrixName("cameraMatrix");
403  for ( unsigned int i = 0; i < 16; ++i ) {
404  std::ostringstream osIndex;
405  osIndex << i;
406  std::ostringstream osValue;
407  osValue << camera->GetCamTrans()[i];
408  iTo.addKeyValue(matrixName+osIndex.str()+typeName(),FWConfiguration(osValue.str()));
409  }
410 }
int i
Definition: DBlmapReader.cc:9
const std::string & typeName() const
Definition: FWViewBase.cc:114
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
string s
Definition: asciidump.py:422
void FWEveView::addToPerspectiveCamera ( TGLPerspectiveCamera *  cam,
const std::string &  name,
FWConfiguration iTo 
) const
protected

Definition at line 449 of file FWEveView.cc.

References FWConfiguration::addKeyValue(), i, and AlCaRecoCosmics_cfg::name.

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

450 {
451  // transformation matrix
452  std::string matrixName("cameraMatrix");
453  for ( unsigned int i = 0; i < 16; ++i ){
454  std::ostringstream osIndex;
455  osIndex << i;
456  std::ostringstream osValue;
457  osValue << (cam->GetCamTrans())[i];
458  iTo.addKeyValue(matrixName+osIndex.str()+name,FWConfiguration(osValue.str()));
459  }
460 
461  // transformation matrix base
462  matrixName = "cameraMatrixBase";
463  for ( unsigned int i = 0; i < 16; ++i ){
464  std::ostringstream osIndex;
465  osIndex << i;
466  std::ostringstream osValue;
467  osValue << (cam->GetCamBase())[i];
468  iTo.addKeyValue(matrixName+osIndex.str()+name,FWConfiguration(osValue.str()));
469  }
470  {
471  std::ostringstream osValue;
472  osValue << cam->fFOV;
473  iTo.addKeyValue(name+" FOV",FWConfiguration(osValue.str()));
474  }
475 }
int i
Definition: DBlmapReader.cc:9
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
void FWEveView::cameraGuideChanged ( )
protectedvirtual

Definition at line 234 of file FWEveView.cc.

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

Referenced by FWEveView().

235 {
236  m_cameraGuide->SetBinaryState(m_showCameraGuide.value());
237  viewerGL()->Changed();
238  gEve->Redraw3D();
239 }
TGLViewer * viewerGL() const
Definition: FWEveView.cc:198
FWBoolParameter m_showCameraGuide
Definition: FWEveView.h:140
TGLCameraGuide * m_cameraGuide
Definition: FWEveView.h:119
const fireworks::Context& FWEveView::context ( )
inline
FWViewContextMenuHandlerBase * FWEveView::contextMenuHandler ( ) const
virtual

Reimplemented from FWViewBase.

Definition at line 193 of file FWEveView.cc.

References m_viewContextMenu.

193  {
195 }
boost::shared_ptr< FWViewContextMenuHandlerGL > m_viewContextMenu
Definition: FWEveView.h:143
void FWEveView::eventBegin ( )
virtual

Reimplemented in FWRPZView.

Definition at line 242 of file FWEveView.cc.

243 {
244 }
void FWEveView::eventEnd ( )
virtual

Definition at line 247 of file FWEveView.cc.

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

248 {
251 }
FWEventAnnotation * m_overlayEventInfo
Definition: FWEveView.h:116
virtual void setupEnergyScale()
Definition: FWEveView.cc:299
TEveScene* FWEveView::eventScene ( )
inline
TEveScene* FWEveView::geoScene ( )
inline
virtual TEveCaloViz* FWEveView::getEveCalo ( ) const
inlineprotectedvirtual

Reimplemented in FWLegoViewBase, FWRPZView, and FW3DView.

Definition at line 95 of file FWEveView.h.

Referenced by setupEnergyScale(), and voteCaloMaxVal().

95 { return 0; }
bool FWEveView::isEnergyScaleGlobal ( ) const
virtual

Definition at line 277 of file FWEveView.cc.

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

278 {
279  return m_useGlobalEnergyScale.value();
280 }
FWBoolParameter m_useGlobalEnergyScale
Definition: FWEveView.h:141
const FWEveView& FWEveView::operator= ( const FWEveView )
private
TEveElement* FWEveView::ownedProducts ( )
inline

Definition at line 79 of file FWEveView.h.

References m_ownedProducts.

Referenced by FWEveViewManager::finishViewCreate().

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

Definition at line 221 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().

222 {
223  viewerGL()->SetSmoothPoints(m_pointSmooth.value());
224  viewerGL()->SetPointScale (m_pointSize.value());
225  viewerGL()->SetSmoothLines (m_lineSmooth.value());
226  viewerGL()->SetLineScale (m_lineWidth.value());
227  viewerGL()->SetOLLineW (m_lineOutlineScale.value());
228  viewerGL()->SetWFLineW (m_lineWireframeScale.value());
229  viewerGL()->Changed();
230  gEve->Redraw3D();
231 }
FWDoubleParameter m_pointSize
Definition: FWEveView.h:134
TGLViewer * viewerGL() const
Definition: FWEveView.cc:198
FWBoolParameter m_lineSmooth
Definition: FWEveView.h:135
FWBoolParameter m_pointSmooth
Definition: FWEveView.h:133
FWDoubleParameter m_lineOutlineScale
Definition: FWEveView.h:137
FWDoubleParameter m_lineWidth
Definition: FWEveView.h:136
FWDoubleParameter m_lineWireframeScale
Definition: FWEveView.h:138
void FWEveView::populateController ( ViewerParameterGUI gui) const
virtual

Reimplemented from FWViewBase.

Reimplemented in FWLegoViewBase, FWRPZView, and FW3DViewBase.

Definition at line 531 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(), FWViewEnergyScaleEditor::setEnabled(), FWViewBase::typeId(), and FWGenericParameter< T >::value().

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

532 {
533  gui.requestTab("Style").
534  addParam(&m_eventInfoLevel).
535  addParam(&m_drawCMSLogo).
536  addParam(&m_showCameraGuide).
537  separator().
538 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,26,0)
539  addParam(&m_imageScale).
540 #endif
541  addParam(&m_pointSize).
542  addParam(&m_pointSmooth).
543  addParam(&m_lineSmooth).
544  addParam(&m_lineWidth).
545  addParam(&m_lineOutlineScale).
546  addParam(&m_lineWireframeScale);
547 
548 
549  gui.requestTab("Scales").
550  addParam(&m_useGlobalEnergyScale);
551 
555 }
ViewerParameterGUI & requestTab(const char *)
FWViewEnergyScaleEditor * m_viewEnergyScaleEditor
Definition: FWEveView.h:147
void addFrameToContainer(TGCompositeFrame *)
FWDoubleParameter m_pointSize
Definition: FWEveView.h:134
FWBoolParameter m_lineSmooth
Definition: FWEveView.h:135
FWBoolParameter m_showCameraGuide
Definition: FWEveView.h:140
FWBoolParameter m_useGlobalEnergyScale
Definition: FWEveView.h:141
FWBoolParameter m_drawCMSLogo
Definition: FWEveView.h:131
std::auto_ptr< FWViewEnergyScale > m_localEnergyScale
Definition: FWEveView.h:145
FWBoolParameter m_pointSmooth
Definition: FWEveView.h:133
FWDoubleParameter m_imageScale
Definition: FWEveView.h:128
FWDoubleParameter m_lineOutlineScale
Definition: FWEveView.h:137
TGCompositeFrame * getTabContainer()
FWEnumParameter m_eventInfoLevel
Definition: FWEveView.h:130
static bool isLego(int)
Definition: FWViewType.cc:121
FWDoubleParameter m_lineWidth
Definition: FWEveView.h:136
FWDoubleParameter m_lineWireframeScale
Definition: FWEveView.h:138
FWViewType::EType typeId() const
Definition: FWViewBase.h:42
void FWEveView::resetCamera ( )
protectedvirtual

Definition at line 260 of file FWEveView.cc.

References viewerGL().

261 {
262  viewerGL()->ResetCurrentCamera();
263 }
TGLViewer * viewerGL() const
Definition: FWEveView.cc:198
void FWEveView::saveImageTo ( const std::string &  iName) const
virtual

Implements FWViewBase.

Definition at line 204 of file FWEveView.cc.

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

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

Reimplemented in FWEveLegoView.

Definition at line 254 of file FWEveView.cc.

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

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

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

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

Definition at line 267 of file FWEveView.cc.

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

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

268 {
269  m_context = &x ;
270 
271  // in constructor view context has local scale
273  m_viewContext->setEnergyScale(context().commonPrefs()->getEnergyScale());
274 }
std::auto_ptr< FWViewContext > m_viewContext
Definition: FWEveView.h:144
const fireworks::Context * m_context
Definition: FWEveView.h:121
FWBoolParameter m_useGlobalEnergyScale
Definition: FWEveView.h:141
const fireworks::Context & context()
Definition: FWEveView.h:65
void FWEveView::setFrom ( const FWConfiguration iFrom)
virtual

Reimplemented from FWConfigurableParameterizable.

Reimplemented in FWRPZView, FW3DViewBase, FWLegoViewBase, and FWGlimpseView.

Definition at line 356 of file FWEveView.cc.

References FWParameterizable::begin(), FWParameterizable::end(), m_localEnergyScale, m_overlayEventInfo, m_overlayLogo, CmsAnnotation::setFrom(), FWEventAnnotation::setFrom(), FWConfigurableParameterizable::version(), and FWConfiguration::version().

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

357 {
358  // Make sure you change the version ranges here
359  // whenever you update the logic.
360  // The rationale should be:
361  // (version range supported by the next block) && (version range in the configuration file)
362  //
363  // This is not "forward" compatible, but I don't think
364  // we care.
365  if (version() >= 2 && iFrom.version() >= 1)
366  {
367  for(const_iterator it =begin(), itEnd = end();
368  it != itEnd;
369  ++it) {
370  (*it)->setFrom(iFrom);
371  }
372  }
373  if (iFrom.version() > 1)
374  {
375  assert( m_overlayEventInfo);
376  m_overlayEventInfo->setFrom(iFrom);
377  }
378  {
379  assert( m_overlayLogo);
380  m_overlayLogo->setFrom(iFrom);
381  }
382 
383  if (iFrom.version() > 4)
384  {
385  m_localEnergyScale->setFrom(iFrom);
386  }
387 }
FWEventAnnotation * m_overlayEventInfo
Definition: FWEveView.h:116
std::vector< FWParameterBase * >::const_iterator const_iterator
const_iterator begin() const
virtual void setFrom(const FWConfiguration &)
unsigned int version() const
virtual void setFrom(const FWConfiguration &)
const_iterator end() const
std::auto_ptr< FWViewEnergyScale > m_localEnergyScale
Definition: FWEveView.h:145
CmsAnnotation * m_overlayLogo
Definition: FWEveView.h:117
void FWEveView::setFromOrthoCamera ( TGLOrthoCamera *  camera,
const FWConfiguration iFrom 
)
protected

Definition at line 413 of file FWEveView.cc.

References fwLog, i, fwlog::kInfo, asciidump::s, FWViewBase::typeName(), FWConfiguration::value(), relativeConstraints::value, FWConfiguration::valueForKey(), and viewerGL().

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

414 {
415  try {
416  // zoom
417  std::string zoomName("cameraZoom"); zoomName += typeName();
418  if (iFrom.valueForKey(zoomName) == 0 )
419  {
420  throw std::runtime_error("can't restore parameter cameraZoom");
421  }
422  std::istringstream s(iFrom.valueForKey(zoomName)->value());
423  s>>(camera->fZoom);
424 
425  // transformation matrix
426  std::string matrixName("cameraMatrix");
427  for ( unsigned int i = 0; i < 16; ++i ) {
428  std::ostringstream os;
429  os << i;
430  const FWConfiguration* value = iFrom.valueForKey( matrixName + os.str() + typeName() );
431  if ( value == 0 )
432  {
433  throw std::runtime_error ("can't restore parameter cameraMatrix.");
434  }
435  std::istringstream s(value->value());
436  s>> (camera->RefCamTrans()[i]);
437  }
438  }
439  catch (const std::runtime_error& iException)
440  {
441  fwLog(fwlog::kInfo) << "Caught exception while restoring camera parameters in view " << typeName() << "\n.";
442  viewerGL()->ResetCamerasAfterNextUpdate();
443 
444  }
445  camera->IncTimeStamp();
446 }
int i
Definition: DBlmapReader.cc:9
const std::string & typeName() const
Definition: FWViewBase.cc:114
TGLViewer * viewerGL() const
Definition: FWEveView.cc:198
const std::string & value(unsigned int iIndex=0) const
#define fwLog(_level_)
Definition: fwLog.h:51
const FWConfiguration * valueForKey(const std::string &iKey) const
string s
Definition: asciidump.py:422
void FWEveView::setFromPerspectiveCamera ( TGLPerspectiveCamera *  cam,
const std::string &  name,
const FWConfiguration iFrom 
)
protected

Definition at line 478 of file FWEveView.cc.

References fwLog, i, fwlog::kDebug, fwlog::kInfo, AlCaRecoCosmics_cfg::name, asciidump::s, FWViewBase::typeName(), FWConfiguration::value(), relativeConstraints::value, FWConfiguration::valueForKey(), and viewerGL().

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

479 {
480  try {
481  std::string matrixName("cameraMatrix");
482  for ( unsigned int i = 0; i < 16; ++i ){
483  std::ostringstream os;
484  os << i;
485  const FWConfiguration* value = iFrom.valueForKey( matrixName + os.str() + name );
486  if ( value == 0 )
487  {
488  throw std::runtime_error ("can't restore parameter cameraMatrix.");
489  }
490  std::istringstream s(value->value());
491  s>>((cam->RefCamTrans())[i]);
492  }
493 
494  // transformation matrix base
495  matrixName = "cameraMatrixBase";
496  for ( unsigned int i = 0; i < 16; ++i ){
497  std::ostringstream os;
498  os << i;
499  const FWConfiguration* value = iFrom.valueForKey( matrixName + os.str() + name );
500  if ( value == 0 )
501  {
502  throw std::runtime_error ("can't restore parameter cameraMatrixBase.");
503  }
504 
505  std::istringstream s(value->value());
506  s>>((cam->RefCamBase())[i]);
507  }
508 
509  {
510  const FWConfiguration* value = iFrom.valueForKey( name + " FOV" );
511  if ( value == 0 )
512  {
513  throw std::runtime_error ("can't restore parameter cameraMatrixBase.");
514  }
515  std::istringstream s(value->value());
516  s>>cam->fFOV;
517  }
518 
519  cam->IncTimeStamp();
520  }
521  catch (const std::runtime_error& iException)
522  {
523  fwLog(fwlog::kInfo) << "Caught exception while restoring camera parameters in view " << typeName() << "\n.";
524  viewerGL()->ResetCamerasAfterNextUpdate();
525  fwLog(fwlog::kDebug) << "Reset camera fo view " << typeName() << "\n.";
526  }
527 }
int i
Definition: DBlmapReader.cc:9
const std::string & typeName() const
Definition: FWViewBase.cc:114
TGLViewer * viewerGL() const
Definition: FWEveView.cc:198
const std::string & value(unsigned int iIndex=0) const
#define fwLog(_level_)
Definition: fwLog.h:51
const FWConfiguration * valueForKey(const std::string &iKey) const
string s
Definition: asciidump.py:422
void FWEveView::setupEnergyScale ( )
virtual

Definition at line 299 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().

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

Definition at line 283 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().

284 {
288 }
std::auto_ptr< FWViewContext > m_viewContext
Definition: FWEveView.h:144
FWViewEnergyScaleEditor * m_viewEnergyScaleEditor
Definition: FWEveView.h:147
virtual void setupEnergyScale()
Definition: FWEveView.cc:299
FWBoolParameter m_useGlobalEnergyScale
Definition: FWEveView.h:141
std::auto_ptr< FWViewEnergyScale > m_localEnergyScale
Definition: FWEveView.h:145
const fireworks::Context & context()
Definition: FWEveView.h:65
FWViewEnergyScale * getEnergyScale() const
Definition: CmsShowCommon.h:67
CmsShowCommon * commonPrefs() const
Definition: Context.cc:179
FWViewContext* FWEveView::viewContext ( )
inline

Definition at line 80 of file FWEveView.h.

References m_viewContext.

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

80 { return m_viewContext.get(); }
std::auto_ptr< FWViewContext > m_viewContext
Definition: FWEveView.h:144
TEveViewer* FWEveView::viewer ( )
inline

Definition at line 75 of file FWEveView.h.

References m_viewer.

Referenced by FWGlimpseView::FWGlimpseView().

75 { return m_viewer; }
TEveViewer * m_viewer
Definition: FWEveView.h:111
TGLViewer * FWEveView::viewerGL ( ) const
void FWEveView::voteCaloMaxVal ( )
virtual

Reimplemented in FWRPZView.

Definition at line 291 of file FWEveView.cc.

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

Referenced by setupEnergyScale().

292 {
293  TEveCaloViz* calo = getEveCalo();
294  if (calo)
295  context().voteMaxEtAndEnergy(calo->GetData()->GetMaxVal(1), calo->GetData()->GetMaxVal(0));
296 }
virtual TEveCaloViz * getEveCalo() const
Definition: FWEveView.h:95
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:185
const fireworks::Context & context()
Definition: FWEveView.h:65

Member Data Documentation

TGLCameraGuide* FWEveView::m_cameraGuide
private

Definition at line 119 of file FWEveView.h.

Referenced by cameraGuideChanged(), and FWEveView().

const fireworks::Context* FWEveView::m_context
private

Definition at line 121 of file FWEveView.h.

Referenced by context(), and setContext().

FWBoolParameter FWEveView::m_drawCMSLogo
private

Definition at line 131 of file FWEveView.h.

Referenced by FWEveView(), and populateController().

ScaleAnnotation* FWEveView::m_energyMaxValAnnotation
private

Definition at line 118 of file FWEveView.h.

Referenced by FWEveView().

FWEnumParameter FWEveView::m_eventInfoLevel
private

Definition at line 130 of file FWEveView.h.

Referenced by FWEveView(), and populateController().

TEveScene* FWEveView::m_eventScene
private

Definition at line 112 of file FWEveView.h.

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

TEveScene* FWEveView::m_geoScene
private

Definition at line 114 of file FWEveView.h.

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

FWDoubleParameter FWEveView::m_imageScale
private

Definition at line 128 of file FWEveView.h.

Referenced by populateController(), and saveImageTo().

FWDoubleParameter FWEveView::m_lineOutlineScale
private

Definition at line 137 of file FWEveView.h.

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

FWBoolParameter FWEveView::m_lineSmooth
private

Definition at line 135 of file FWEveView.h.

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

FWDoubleParameter FWEveView::m_lineWidth
private

Definition at line 136 of file FWEveView.h.

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

FWDoubleParameter FWEveView::m_lineWireframeScale
private

Definition at line 138 of file FWEveView.h.

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

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

Definition at line 145 of file FWEveView.h.

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

FWEventAnnotation* FWEveView::m_overlayEventInfo
private

Definition at line 116 of file FWEveView.h.

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

CmsAnnotation* FWEveView::m_overlayLogo
private

Definition at line 117 of file FWEveView.h.

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

TEveElement* FWEveView::m_ownedProducts
private

Definition at line 113 of file FWEveView.h.

Referenced by FWEveView(), and ownedProducts().

FWDoubleParameter FWEveView::m_pointSize
private

Definition at line 134 of file FWEveView.h.

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

FWBoolParameter FWEveView::m_pointSmooth
private

Definition at line 133 of file FWEveView.h.

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

FWBoolParameter FWEveView::m_showCameraGuide
private

Definition at line 140 of file FWEveView.h.

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

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

Definition at line 144 of file FWEveView.h.

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

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

Definition at line 143 of file FWEveView.h.

Referenced by contextMenuHandler(), and FWEveView().

FWViewEnergyScaleEditor* FWEveView::m_viewEnergyScaleEditor
mutableprivate

Definition at line 147 of file FWEveView.h.

Referenced by populateController(), and useGlobalEnergyScaleChanged().

TEveViewer* FWEveView::m_viewer
private

Definition at line 111 of file FWEveView.h.

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