CMS 3D CMS Logo

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

#include <FWGeometryBrowser.h>

Inheritance diagram for FWGeometryBrowser:
FWConfigurableParameterizable FWParameterSetterEditorBase FWParameterizable FWConfigurable

Public Types

enum  EMode { kNode, kVolume }
 
- Public Types inherited from FWParameterizable
typedef std::vector
< FWParameterBase * >
::const_iterator 
const_iterator
 

Public Member Functions

virtual void addTo (FWConfiguration &) const
 
void browse ()
 
void cellClicked (Int_t iRow, Int_t iColumn, Int_t iButton, Int_t iKeyMod, Int_t iGlobalX, Int_t iGlobalY)
 
 FWGeometryBrowser (FWGUIManager *)
 
Bool_t HandleKey (Event_t *event)
 
void newIndexSelected (int, int)
 
void readFile ()
 
virtual void setFrom (const FWConfiguration &)
 
void updateStatusBar (const char *status)
 
void windowIsClosing ()
 
virtual ~FWGeometryBrowser ()
 
- 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 ()
 
- Public Member Functions inherited from FWParameterSetterEditorBase
 FWParameterSetterEditorBase ()
 
virtual void updateEditor ()
 
virtual ~FWParameterSetterEditorBase ()
 

Protected Attributes

FWLongParameter m_autoExpand
 
FWStringParameter m_filter
 
FWLongParameter m_maxDaughters
 
FWEnumParameter m_mode
 

Private Member Functions

 ClassDef (FWGeometryBrowser, 0)
 
 FWGeometryBrowser (const FWGeometryBrowser &)
 
void makeSetter (TGCompositeFrame *frame, FWParameterBase *param)
 
const FWGeometryBrowseroperator= (const FWGeometryBrowser &)
 
void resetSetters ()
 

Private Attributes

TGTextButton * m_fileOpen
 
TFile * m_geometryFile
 
FWGUIManagerm_guiManager
 
std::vector< boost::shared_ptr
< FWParameterSetterBase > > 
m_setters
 
TGCompositeFrame * m_settersFrame
 
TGStatusBar * m_statBar
 
FWGeometryTableManagerm_tableManager
 
FWTableWidgetm_tableWidget
 

Friends

class FWGeometryTableManager
 

Detailed Description

Definition at line 34 of file FWGeometryBrowser.h.

Member Enumeration Documentation

Enumerator
kNode 
kVolume 

Definition at line 42 of file FWGeometryBrowser.h.

Constructor & Destructor Documentation

FWGeometryBrowser::FWGeometryBrowser ( FWGUIManager guiManager)

Definition at line 20 of file FWGeometryBrowser.cc.

References FWEnumParameter::addEntry(), FWTableWidget::disableGrowInWidth(), FWGeometryTableManager, m_fileOpen, m_mode, m_settersFrame, m_statBar, m_tableManager, m_tableWidget, resetSetters(), FWTableWidget::SetBackgroundColor(), FWTableWidget::SetHeaderBackgroundColor(), and FWTableWidget::SetLineSeparatorColor().

21  : TGMainFrame(gClient->GetRoot(), 600, 500),
22  m_mode(this, "Mode:", 1l, 0l, 1l),
23  m_filter(this,"Materials:",std::string()),
24  m_autoExpand(this,"AutoExpand:", 5l, 0l, 1000l),
25  m_maxDaughters(this,"MaxChildren:", 999l, 0l, 1000l), // debug
26  m_guiManager(guiManager),
27  m_tableManager(0),
28  m_geometryFile(0),
29  m_fileOpen(0),
31 {
32  m_mode.addEntry(0, "Node");
33  m_mode.addEntry(1, "Volume");
34 
36 
37  TGTextButton* m_fileOpen = new TGTextButton (this, "Open Geometry File");
38  this->AddFrame(m_fileOpen, new TGLayoutHints( kLHintsExpandX , 4, 2, 2, 2));
39  m_fileOpen->Connect("Clicked()","FWGeometryBrowser",this,"browse()");
40 
41 
42  m_settersFrame = new TGHorizontalFrame(this);
43  this->AddFrame( m_settersFrame,new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2));
44  m_settersFrame->SetCleanup(kDeepCleanup);
45 
47  AddFrame(m_tableWidget,new TGLayoutHints(kLHintsExpandX|kLHintsExpandY,2,2,2,2));
51  m_tableWidget->Connect("cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)",
52  "FWGeometryBrowser",this,
53  "cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)");
55  resetSetters();
56 
57  m_statBar = new TGStatusBar(this, this->GetWidth(), 12);
58  m_statBar->SetText("No simulation geomtery loaded.");
59  AddFrame(m_statBar, new TGLayoutHints(kLHintsExpandX));
60 
61  SetWindowName("Geometry Browser");
62  this->Connect("CloseWindow()","FWGeometryBrowser",this,"windowIsClosing()");
63  Layout();
64  MapSubwindows();
65 
66  gVirtualX->SelectInput(GetId(), kKeyPressMask | kKeyReleaseMask | kExposureMask |
67  kPointerMotionMask | kStructureNotifyMask | kFocusChangeMask |
68  kEnterWindowMask | kLeaveWindowMask);
69 }
void SetBackgroundColor(Pixel_t)
FWStringParameter m_filter
TGTextButton * m_fileOpen
void SetHeaderBackgroundColor(Pixel_t)
TGCompositeFrame * m_settersFrame
void SetLineSeparatorColor(Pixel_t)
TGStatusBar * m_statBar
void disableGrowInWidth()
bool addEntry(Long_t id, const std::string &txt)
FWLongParameter m_maxDaughters
FWGUIManager * m_guiManager
FWEnumParameter m_mode
friend class FWGeometryTableManager
FWGeometryTableManager * m_tableManager
FWLongParameter m_autoExpand
FWTableWidget * m_tableWidget
FWGeometryBrowser::~FWGeometryBrowser ( )
virtual

Definition at line 71 of file FWGeometryBrowser.cc.

72 {}
FWGeometryBrowser::FWGeometryBrowser ( const FWGeometryBrowser )
private

Member Function Documentation

void FWGeometryBrowser::addTo ( FWConfiguration iTo) const
virtual

Reimplemented from FWConfigurableParameterizable.

Definition at line 109 of file FWGeometryBrowser.cc.

References FWConfigurableParameterizable::addTo().

Referenced by FWGUIManager::addTo().

110 {
112 }
virtual void addTo(FWConfiguration &) const
void FWGeometryBrowser::browse ( )

Definition at line 204 of file FWGeometryBrowser.cc.

References FWGUIManager::clearStatus(), gather_cfg::cout, geodebug, FWGUIManager::getMainFrame(), m_geometryFile, m_guiManager, readFile(), and FWGUIManager::updateStatus().

Referenced by FWGUIManager::showGeometryBrowser().

205 {
206  std::cout<<"FWGeometryBrowser::openFile()"<<std::endl;
207 
208  if (!geodebug)
209  {
210  const char* kRootType[] = {"ROOT files","*.root", 0, 0};
211  TGFileInfo fi;
212  fi.fFileTypes = kRootType;
213 
214  m_guiManager->updateStatus("opening geometry file...");
215 
216  new TGFileDialog(gClient->GetDefaultRoot(),
217  (TGWindow*) m_guiManager->getMainFrame(), kFDOpen, &fi);
218 
219  m_guiManager->updateStatus("loading geometry file...");
220  m_geometryFile = new TFile(fi.fFilename, "READ");
221  }
222  else
223  {
224  // AMT developing environment
225  m_geometryFile = new TFile("cmsSimGeom-14.root", "READ");
226  }
228 
229  readFile();
230 }
void updateStatus(const char *status)
FWGUIManager * m_guiManager
bool geodebug
CmsShowMainFrame * getMainFrame() const
Definition: FWGUIManager.h:202
void clearStatus()
tuple cout
Definition: gather_cfg.py:41
void FWGeometryBrowser::cellClicked ( Int_t  iRow,
Int_t  iColumn,
Int_t  iButton,
Int_t  iKeyMod,
Int_t  iGlobalX,
Int_t  iGlobalY 
)

Definition at line 132 of file FWGeometryBrowser.cc.

References FWGeometryTableManager::firstColumnClicked(), and m_tableManager.

133 {
134  if (iButton != kButton1)
135  {
136  // m_tableManager->setSelection(iRow, iColumn, iKeyMod);
137  return;
138  }
139 
140  if (iButton == kButton1 && iColumn == 0)
141  {
143  }
144 }
FWGeometryTableManager * m_tableManager
FWGeometryBrowser::ClassDef ( FWGeometryBrowser  ,
 
)
private
bool FWGeometryBrowser::HandleKey ( Event_t *  event)

Definition at line 146 of file FWGeometryBrowser.cc.

References if(), and m.

147 {
148  if (!fBindList) return kFALSE;
149 
150  TIter next(fBindList);
151  TGMapKey *m;
152  TGFrame *w = 0;
153 
154  while ((m = (TGMapKey *) next())) {
155  if (m->fKeyCode == event->fCode) {
156  w = (TGFrame *) m->fWindow;
157  if (w->HandleKey(event)) return kTRUE;
158  }
159  }
160  return kFALSE;
161 }
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
perl if(1 lt scalar(@::datatypes))
Definition: edlooper.cc:31
void FWGeometryBrowser::makeSetter ( TGCompositeFrame *  frame,
FWParameterBase param 
)
private

Definition at line 95 of file FWGeometryBrowser.cc.

References m_setters, and FWParameterSetterBase::makeSetterFor().

Referenced by resetSetters().

96 {
97  boost::shared_ptr<FWParameterSetterBase> ptr( FWParameterSetterBase::makeSetterFor(param) );
98  ptr->attach(param, this);
99 
100  TGFrame* pframe = ptr->build(frame, false);
101  frame->AddFrame(pframe, new TGLayoutHints(kLHintsExpandX));
102 
103  m_setters.push_back(ptr);
104 }
static boost::shared_ptr< FWParameterSetterBase > makeSetterFor(FWParameterBase *)
std::vector< boost::shared_ptr< FWParameterSetterBase > > m_setters
void FWGeometryBrowser::newIndexSelected ( int  iSelectedRow,
int  iSelectedColumn 
)

Definition at line 170 of file FWGeometryBrowser.cc.

References FWTableManagerBase::dataChanged(), and m_tableManager.

171 {
172  if (iSelectedRow == -1)
173  return;
174 
176 }
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
FWGeometryTableManager * m_tableManager
const FWGeometryBrowser& FWGeometryBrowser::operator= ( const FWGeometryBrowser )
private
void FWGeometryBrowser::readFile ( )

Definition at line 179 of file FWGeometryBrowser.cc.

References ExpressReco_HICollisions_FallBack::e, fwLog, fwlog::kError, FWGeometryTableManager::loadGeometry(), m_geometryFile, m_tableManager, and updateStatusBar().

Referenced by browse(), python.Vispa.Plugins.EventBrowser.EventBrowserTabController.EventBrowserTabController::navigate(), python.Vispa.Main.TabController.TabController::open(), and python.Vispa.Main.TabController.TabController::refresh().

180 {
181  try {
182 
183  if ( ! m_geometryFile )
184  throw std::runtime_error("No root file.");
185 
186  m_geometryFile->ls();
187 
188  if ( !m_geometryFile->Get("cmsGeo;1"))
189  throw std::runtime_error("Can't find TGeoManager object in selected file.");
190 
191  TGeoManager* m_geoManager = (TGeoManager*) m_geometryFile->Get("cmsGeo;1");
192  m_tableManager->loadGeometry(m_geoManager);
193  MapRaised();
194 
195  }
196  catch (std::runtime_error &e)
197  {
198  fwLog(fwlog::kError) << "Failed to load simulation geomtery.\n";
199  updateStatusBar("Failed to load simulation geomtery from file");
200  }
201 }
void updateStatusBar(const char *status)
void loadGeometry(TGeoManager *geoManager)
#define fwLog(_level_)
Definition: fwLog.h:51
FWGeometryTableManager * m_tableManager
void FWGeometryBrowser::resetSetters ( )
private

Definition at line 75 of file FWGeometryBrowser.cc.

References geodebug, m_autoExpand, m_filter, m_maxDaughters, m_mode, m_setters, m_settersFrame, and makeSetter().

Referenced by FWGeometryBrowser(), and setFrom().

76 {
77  if (!m_settersFrame->GetList()->IsEmpty())
78  {
79  m_setters.clear();
80  TGFrameElement *el = (TGFrameElement*) m_settersFrame->GetList()->First();
81  m_settersFrame->RemoveFrame(el->fFrame);
82  }
83 
84  TGHorizontalFrame* frame = new TGHorizontalFrame(m_settersFrame);
85  m_settersFrame->AddFrame(frame);
86  makeSetter(frame, &m_mode);
87  makeSetter(frame, &m_filter);
88  makeSetter(frame, &m_autoExpand);
89  if (geodebug) makeSetter(frame, &m_maxDaughters);
90  m_settersFrame->MapSubwindows();
91  Layout();
92 }
FWStringParameter m_filter
TGCompositeFrame * m_settersFrame
void makeSetter(TGCompositeFrame *frame, FWParameterBase *param)
FWLongParameter m_maxDaughters
bool geodebug
FWEnumParameter m_mode
std::vector< boost::shared_ptr< FWParameterSetterBase > > m_setters
FWLongParameter m_autoExpand
void FWGeometryBrowser::setFrom ( const FWConfiguration iFrom)
virtual

Reimplemented from FWConfigurableParameterizable.

Definition at line 115 of file FWGeometryBrowser.cc.

References FWParameterizable::begin(), FWParameterizable::end(), geodebug, m_maxDaughters, and resetSetters().

Referenced by FWGUIManager::setFrom().

116 {
117  for(const_iterator it =begin(), itEnd = end();
118  it != itEnd;
119  ++it) {
120 
121  if (!geodebug && (&m_maxDaughters == (*it)))
122  continue;
123 
124  (*it)->setFrom(iFrom);
125 
126  }
127  resetSetters();
128 }
std::vector< FWParameterBase * >::const_iterator const_iterator
const_iterator begin() const
const_iterator end() const
FWLongParameter m_maxDaughters
bool geodebug
void FWGeometryBrowser::updateStatusBar ( const char *  status)

Definition at line 233 of file FWGeometryBrowser.cc.

References m_statBar.

Referenced by FWGeometryTableManager::loadGeometry(), readFile(), and FWGeometryTableManager::setTableContent().

233  {
234  m_statBar->SetText(status, 0);
235 }
TGStatusBar * m_statBar
tuple status
Definition: ntuplemaker.py:245
void FWGeometryBrowser::windowIsClosing ( )

Definition at line 164 of file FWGeometryBrowser.cc.

165 {
166  UnmapWindow();
167 }

Friends And Related Function Documentation

friend class FWGeometryTableManager
friend

Definition at line 39 of file FWGeometryBrowser.h.

Referenced by FWGeometryBrowser().

Member Data Documentation

FWLongParameter FWGeometryBrowser::m_autoExpand
protected
TGTextButton* FWGeometryBrowser::m_fileOpen
private

Definition at line 82 of file FWGeometryBrowser.h.

Referenced by FWGeometryBrowser().

FWStringParameter FWGeometryBrowser::m_filter
protected
TFile* FWGeometryBrowser::m_geometryFile
private

Definition at line 81 of file FWGeometryBrowser.h.

Referenced by browse(), and readFile().

FWGUIManager* FWGeometryBrowser::m_guiManager
private

Definition at line 76 of file FWGeometryBrowser.h.

Referenced by browse().

FWLongParameter FWGeometryBrowser::m_maxDaughters
protected
FWEnumParameter FWGeometryBrowser::m_mode
protected
std::vector<boost::shared_ptr<FWParameterSetterBase> > FWGeometryBrowser::m_setters
private

Definition at line 87 of file FWGeometryBrowser.h.

Referenced by makeSetter(), and resetSetters().

TGCompositeFrame* FWGeometryBrowser::m_settersFrame
private

Definition at line 84 of file FWGeometryBrowser.h.

Referenced by FWGeometryBrowser(), and resetSetters().

TGStatusBar* FWGeometryBrowser::m_statBar
private

Definition at line 83 of file FWGeometryBrowser.h.

Referenced by FWGeometryBrowser(), and updateStatusBar().

FWGeometryTableManager* FWGeometryBrowser::m_tableManager
private

Definition at line 79 of file FWGeometryBrowser.h.

Referenced by cellClicked(), FWGeometryBrowser(), newIndexSelected(), and readFile().

FWTableWidget* FWGeometryBrowser::m_tableWidget
private

Definition at line 78 of file FWGeometryBrowser.h.

Referenced by FWGeometryBrowser().