CMS 3D CMS Logo

CmsShowMainBase.h
Go to the documentation of this file.
1 #ifndef Fireworks_Core_CmsShowMainBase_h
2 #define Fireworks_Core_CmsShowMainBase_h
3 
6 
8 
9 #include <memory>
10 #include <string>
11 #include <cassert>
12 #include "sigc++/signal.h"
13 
14 #include "TTimer.h"
15 
17 class FWGUIManager;
19 class FWNavigatorBase;
20 
21 // replace forfard declaration with include to avoid compilation warnigs
22 /*
23 class FWModelChangeManager;
24 class FWSelectionManager;
25 class FWViewManagerManager;
26 class CmsShowTaskExecutor;
27 class FWChangeManager;
28 class FWColorManager;
29 class FWConfigurationManager;
30 */
38 
39 namespace fireworks {
40  class Context;
41 }
42 
50 {
51 public:
53  virtual ~CmsShowMainBase() noexcept(false);
54 
55  FWModelChangeManager *changeManager() {return m_changeManager.get(); }
56  FWColorManager *colorManager() { return m_colorManager.get(); }
57  FWConfigurationManager *configurationManager() { return m_configurationManager.get(); }
58  FWEventItemsManager *eiManager() { return m_eiManager.get(); }
59  FWModelChangeManager *modelChangeManager() { return m_changeManager.get(); }
60  FWSelectionManager *selectionManager() { return m_selectionManager.get(); }
61  FWViewManagerManager *viewManager() { return m_viewManager.get(); }
63  {
64  assert(m_guiManager.get() && "Call CmsShowMainBase::setup first!");
65  return m_guiManager.get();
66  }
67 
68  CmsShowTaskExecutor *startupTasks() { return m_startupTasks.get(); }
69 
71  fireworks::Context *context,
72  FWJobMetadataManager *metadataManager);
73 
74  void setupActions();
75  void setupViewManagers();
76 
77  // Configuration handling.
78  void setConfigFilename(const std::string &f) { m_configFileName = f; };
79  const char *configFilename() const { return m_configFileName.c_str(); };
80 
81  void writeToConfigFile(const std::string &config);
82  void writeToCurrentConfigFile();
83  void writePartialToConfigFile();
84  void reloadConfiguration(const std::string &config);
85  void partialWriteToConfigFile(const std::string &config);
86  void partialLoadConfiguration(const std::string &config);
87  void setupConfiguration();
88 
89  void registerPhysicsObject(const FWPhysicsObjectDesc&iItem);
90  void draw();
91 
92  // Geometry handling
93  void loadGeometry();
94  void setGeometryFilename(const std::string &filename) {m_geometryFilename = filename; }
95  const std::string &geometryFilename(void) { return m_geometryFilename; }
96  FWGeometry& getGeom() { return m_geom; }
97 
98  void setSimGeometryFilename(const std::string &filename) {m_simGeometryFilename = filename; }
99 
100  // Event navigation.
101  void doFirstEvent();
102  void doPreviousEvent();
103  void doNextEvent();
104  void doLastEvent();
106  virtual void checkPosition() = 0;
107  bool forward() const { return m_forward; }
108  bool loop() const { return m_loop; }
109  virtual void quit() = 0;
110 
111  void setupAutoLoad(float x);
112  void startAutoLoadTimer();
113  void stopAutoLoadTimer();
114  void setupDebugSupport();
115 
116  void setPlayDelay(Float_t val);
117  void playForward();
118  void playBackward();
119  bool isPlaying() const { return m_isPlaying; }
120 
122  virtual void stopPlaying();
123  virtual void autoLoadNewEvent() = 0;
124 
125  void setPlayLoop();
126  void unsetPlayLoop();
127 
128  void setAutoSaveAllViewsFormat(const std::string& fmt) { m_autoSaveAllViewsFormat = fmt; }
129  void setAutoSaveAllViewsHeight(int x) { m_autoSaveAllViewsHeight = x; }
130 
131  class SignalTimer : public TTimer {
132  public:
133  virtual Bool_t Notify() {
134  timeout_();
135  return true;
136  }
137  sigc::signal<void> timeout_;
138  };
139 
140 protected:
141  void eventChangedSlot();
142  virtual void eventChangedImp();
143  void sendVersionInfo();
144  fireworks::Context* context() { return m_contextPtr; }
145 
146 private:
147  // The base class is responsible for the destruction of fwlite / FF
148  // agnostic managers.
149  std::auto_ptr<FWModelChangeManager> m_changeManager;
150  std::auto_ptr<FWColorManager> m_colorManager;
151  std::auto_ptr<FWConfigurationManager> m_configurationManager;
152  std::auto_ptr<FWEventItemsManager> m_eiManager;
153  std::auto_ptr<FWGUIManager> m_guiManager;
154  std::auto_ptr<FWSelectionManager> m_selectionManager;
155  std::auto_ptr<CmsShowTaskExecutor> m_startupTasks;
156  std::auto_ptr<FWViewManagerManager> m_viewManager;
157 
158 
159 
160  std::auto_ptr<SignalTimer> m_autoLoadTimer;
161 
162  // These are actually set by the concrete implementation via the setup
163  // method.
167 
168  void setPlayLoopImp();
169  void unsetPlayLoopImp();
170 
174  bool m_forward;
176  bool m_loop;
177  Float_t m_playDelay;
182 };
183 
184 #endif
sigc::signal< void > timeout_
FWSelectionManager * selectionManager()
FWModelChangeManager * modelChangeManager()
std::auto_ptr< FWConfigurationManager > m_configurationManager
std::string m_geometryFilename
FWGUIManager * guiManager()
FWColorManager * colorManager()
void setAutoSaveAllViewsHeight(int x)
FWEventItemsManager * eiManager()
unsigned long long EventNumber_t
#define noexcept
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
const char * configFilename() const
std::auto_ptr< FWSelectionManager > m_selectionManager
std::auto_ptr< FWEventItemsManager > m_eiManager
Definition: config.py:1
unsigned int LuminosityBlockNumber_t
FWModelChangeManager * changeManager()
T x() const
Cartesian x coordinate.
FWNavigatorBase * m_navigatorPtr
void setGeometryFilename(const std::string &filename)
bool loop() const
CmsShowTaskExecutor * startupTasks()
std::auto_ptr< SignalTimer > m_autoLoadTimer
virtual void checkKeyBindingsOnPLayEventsStateChanged()
FWJobMetadataManager * m_metadataManagerPtr
fireworks::Context * context()
double f[11][100]
std::auto_ptr< CmsShowTaskExecutor > m_startupTasks
void setSimGeometryFilename(const std::string &filename)
FWViewManagerManager * viewManager()
std::string m_simGeometryFilename
void setAutoSaveAllViewsFormat(const std::string &fmt)
fireworks::Context * m_contextPtr
bool isPlaying() const
FWGeometry & getGeom()
FWConfigurationManager * configurationManager()
std::string m_autoSaveAllViewsFormat
std::auto_ptr< FWModelChangeManager > m_changeManager
unsigned int RunNumber_t
bool forward() const
const std::string & geometryFilename(void)
std::auto_ptr< FWViewManagerManager > m_viewManager
std::auto_ptr< FWColorManager > m_colorManager
std::auto_ptr< FWGUIManager > m_guiManager
void setConfigFilename(const std::string &f)
std::string m_configFileName