CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes
FWGeometryTableViewManager Class Reference

#include <Fireworks/Core/interface/FWGeometryTableViewManager.h>

Inheritance diagram for FWGeometryTableViewManager:
FWViewManagerBase

Public Member Functions

FWViewBasebuildView (TEveWindowSlot *iParent, const std::string &type)
 
virtual void colorsChanged ()
 
 FWGeometryTableViewManager (FWGUIManager *, std::string fileName)
 
TList * getListOfVolumes () const
 
TGeoNode * getTopTGeoNode ()
 
virtual void newItem (const FWEventItem *)
 
virtual FWTypeToRepresentations supportedTypesAndRepresentations () const
 
virtual ~FWGeometryTableViewManager ()
 
- Public Member Functions inherited from FWViewManagerBase
void colorsChangedSlot ()
 
const fireworks::Contextcontext () const
 
virtual void eventBegin ()
 
virtual void eventEnd ()
 
void modelChangesComingSlot ()
 
void modelChangesDoneSlot ()
 
void setChangeManager (FWModelChangeManager *iCM)
 
void setColorManager (FWColorManager *iCM)
 
virtual void setContext (const fireworks::Context *x)
 
virtual ~FWViewManagerBase ()
 

Static Public Member Functions

static TGeoManager * getGeoMangeur ()
 

Protected Member Functions

virtual void modelChangesComing ()
 
virtual void modelChangesDone ()
 
- Protected Member Functions inherited from FWViewManagerBase
FWModelChangeManagerchangeManager () const
 
FWColorManagercolorManager () const
 
void * createInstanceOf (const TClass *iBaseClass, const char *iNameOfClass)
 
 FWViewManagerBase ()
 

Protected Attributes

std::vector< boost::shared_ptr
< FWGeometryTableView > > 
m_views
 

Private Member Functions

void beingDestroyed (const FWViewBase *iView)
 
 FWGeometryTableViewManager (const FWGeometryTableViewManager &)
 
void initGeoManager ()
 
const FWGeometryTableViewManageroperator= (const FWGeometryTableViewManager &)
 

Private Attributes

std::string m_fileName
 

Static Private Attributes

static TGeoManager * s_geoManager = 0
 

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 30 of file FWGeometryTableViewManager.h.

Constructor & Destructor Documentation

FWGeometryTableViewManager::FWGeometryTableViewManager ( FWGUIManager iGUIMgr,
std::string  fileName 
)

Definition at line 29 of file FWGeometryTableViewManager.cc.

References buildView(), f, FWViewType::idToName(), FWViewType::kGeometryTable, and FWGUIManager::registerViewBuilder().

29  :
32 {
34  f=boost::bind(&FWGeometryTableViewManager::buildView, this, _1, _2);
36 }
boost::function2< FWViewBase *, TEveWindowSlot *, const std::string & > ViewBuildFunctor
Definition: FWGUIManager.h:100
void registerViewBuilder(const std::string &iName, ViewBuildFunctor &iBuilder)
double f[11][100]
FWViewBase * buildView(TEveWindowSlot *iParent, const std::string &type)
static const std::string & idToName(int)
Definition: FWViewType.cc:89
FWGeometryTableViewManager::~FWGeometryTableViewManager ( )
virtual

Definition at line 38 of file FWGeometryTableViewManager.cc.

39 {
40 }
FWGeometryTableViewManager::FWGeometryTableViewManager ( const FWGeometryTableViewManager )
private

Member Function Documentation

void FWGeometryTableViewManager::beingDestroyed ( const FWViewBase iView)
private

Definition at line 59 of file FWGeometryTableViewManager.cc.

References m_views.

Referenced by buildView().

60 {
61  for(std::vector<boost::shared_ptr<FWGeometryTableView> >::iterator it=m_views.begin(); it != m_views.end(); ++it) {
62  if(it->get() == iView) {
63  m_views.erase(it);
64  return;
65  }
66  }
67 }
std::vector< boost::shared_ptr< FWGeometryTableView > > m_views
class FWViewBase * FWGeometryTableViewManager::buildView ( TEveWindowSlot *  iParent,
const std::string &  type 
)

Definition at line 44 of file FWGeometryTableViewManager.cc.

References beingDestroyed(), FWViewManagerBase::colorManager(), initGeoManager(), m_views, and s_geoManager.

Referenced by FWGeometryTableViewManager().

45 {
46  boost::shared_ptr<FWGeometryTableView> view;
48  view.reset( new FWGeometryTableView(iParent, &colorManager(), s_geoManager->GetTopNode(), s_geoManager->GetListOfVolumes()));
49 
50  view->setBackgroundColor();
51  m_views.push_back(boost::shared_ptr<FWGeometryTableView> (view));
52  view->beingDestroyed_.connect(boost::bind(&FWGeometryTableViewManager::beingDestroyed, this,_1));
53 
54  return view.get();
55 }
std::vector< boost::shared_ptr< FWGeometryTableView > > m_views
FWColorManager & colorManager() const
void beingDestroyed(const FWViewBase *iView)
void FWGeometryTableViewManager::colorsChanged ( )
virtual

Implements FWViewManagerBase.

Definition at line 70 of file FWGeometryTableViewManager.cc.

References m_views.

71 {
72  for(std::vector<boost::shared_ptr<FWGeometryTableView> >::iterator it=m_views.begin(); it != m_views.end(); ++it)
73  (*it)->setBackgroundColor();
74 }
std::vector< boost::shared_ptr< FWGeometryTableView > > m_views
static TGeoManager* FWGeometryTableViewManager::getGeoMangeur ( )
inlinestatic
TList* FWGeometryTableViewManager::getListOfVolumes ( ) const
TGeoNode* FWGeometryTableViewManager::getTopTGeoNode ( )
void FWGeometryTableViewManager::initGeoManager ( )
private

Definition at line 80 of file FWGeometryTableViewManager.cc.

References mergeVDriftHistosByStation::file, fwLog, fwlog::kError, m_fileName, and s_geoManager.

Referenced by buildView().

81 {
82  TGeoManager *old = gGeoManager;
83  TGeoIdentity *old_id = gGeoIdentity;
84  gGeoManager = 0;
85 
86 
87  TString filePath = m_fileName;
88 
89  if (gSystem->AccessPathName(filePath.Data()))
90  {
91  if( m_fileName[0] == '.' && m_fileName[1] == '/' )
92  {
93  filePath = Form("%s/%s", gSystem->Getenv( "PWD" ), &m_fileName.c_str()[1]);
94  }
95  else
96  {
97  // look in PWD
98  // printf("look in PWD \n");
99  filePath = Form("%s/%s", gSystem->Getenv( "PWD" ),m_fileName.c_str() );
100  // look in CMSSW_BASE
101  if(gSystem->AccessPathName(filePath.Data())) {
102  // printf("look in CMSSW \n");
103  filePath = Form("%s/%s", gSystem->Getenv( "CMSSW_BASE" ),m_fileName.c_str() );
104  }
105  }
106  }
107 
108  // printf("Sim geom file %s \n", filePath.Data());
109  if( !gSystem->AccessPathName(filePath.Data()))
110  {
111  TFile* file = new TFile( filePath.Data(), "READ");
112  try {
113  if ( ! file )
114  throw std::runtime_error("No root file.");
115 
116  file->ls();
117 
118  if ( !file->Get("cmsGeo;1"))
119  throw std::runtime_error("Can't find TGeoManager object in selected file.");
120  s_geoManager = (TGeoManager*) file->Get("cmsGeo;1");
121 
122  }
123  catch (std::runtime_error &e)
124  {
125  fwLog(fwlog::kError) << "Failed to load simulation geomtery.\n";
126  }
127  }
128 
129  gGeoManager = old;
130  gGeoIdentity = old_id;
131 }
#define fwLog(_level_)
Definition: fwLog.h:51
virtual void FWGeometryTableViewManager::modelChangesComing ( )
inlineprotectedvirtual

called when models have changed and so the display must be updated

Implements FWViewManagerBase.

Definition at line 50 of file FWGeometryTableViewManager.h.

50 {}
virtual void FWGeometryTableViewManager::modelChangesDone ( )
inlineprotectedvirtual

Implements FWViewManagerBase.

Definition at line 51 of file FWGeometryTableViewManager.h.

51 {}
virtual void FWGeometryTableViewManager::newItem ( const FWEventItem )
inlinevirtual

Implements FWViewManagerBase.

Definition at line 38 of file FWGeometryTableViewManager.h.

38 {}
const FWGeometryTableViewManager& FWGeometryTableViewManager::operator= ( const FWGeometryTableViewManager )
private
virtual FWTypeToRepresentations FWGeometryTableViewManager::supportedTypesAndRepresentations ( ) const
inlinevirtual

Member Data Documentation

std::string FWGeometryTableViewManager::m_fileName
private

Definition at line 61 of file FWGeometryTableViewManager.h.

Referenced by initGeoManager().

std::vector<boost::shared_ptr<FWGeometryTableView> > FWGeometryTableViewManager::m_views
protected

Definition at line 53 of file FWGeometryTableViewManager.h.

Referenced by beingDestroyed(), buildView(), and colorsChanged().

TGeoManager * FWGeometryTableViewManager::s_geoManager = 0
staticprivate

Definition at line 60 of file FWGeometryTableViewManager.h.

Referenced by buildView(), getGeoMangeur(), and initGeoManager().