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, const std::string &geoname) {
99  m_simGeometryFilename = filename;
100  m_TGeoName = geoname;
101  }
102 
103  // Event navigation.
104  void doFirstEvent();
105  void doPreviousEvent();
106  void doNextEvent();
107  void doLastEvent();
109  virtual void checkPosition() = 0;
110  bool forward() const { return m_forward; }
111  bool loop() const { return m_loop; }
112  virtual void quit() = 0;
113 
114  void setupAutoLoad(float x);
115  void startAutoLoadTimer();
116  void stopAutoLoadTimer();
117  void setupDebugSupport();
118 
119  void setPlayDelay(Float_t val);
120  void playForward();
121  void playBackward();
122  bool isPlaying() const { return m_isPlaying; }
123 
125  virtual void stopPlaying();
126  virtual void autoLoadNewEvent() = 0;
127 
128  void setPlayLoop();
129  void unsetPlayLoop();
130 
131  void setAutoSaveAllViewsFormat(const std::string& fmt) { m_autoSaveAllViewsFormat = fmt; }
132  void setAutoSaveAllViewsHeight(int x) { m_autoSaveAllViewsHeight = x; }
133 
134  class SignalTimer : public TTimer {
135  public:
136  Bool_t Notify() override {
137  timeout_();
138  return true;
139  }
140  sigc::signal<void> timeout_;
141  };
142 
143 protected:
144  void eventChangedSlot();
145  virtual void eventChangedImp();
146  void sendVersionInfo();
147  fireworks::Context* context() { return m_contextPtr; }
148 
149 private:
150  // The base class is responsible for the destruction of fwlite / FF
151  // agnostic managers.
152  std::unique_ptr<FWModelChangeManager> m_changeManager;
153  std::unique_ptr<FWColorManager> m_colorManager;
154  std::unique_ptr<FWConfigurationManager> m_configurationManager;
155  std::unique_ptr<FWEventItemsManager> m_eiManager;
156  std::unique_ptr<FWGUIManager> m_guiManager;
157  std::unique_ptr<FWSelectionManager> m_selectionManager;
158  std::unique_ptr<CmsShowTaskExecutor> m_startupTasks;
159  std::unique_ptr<FWViewManagerManager> m_viewManager;
160 
161 
162 
163  std::unique_ptr<SignalTimer> m_autoLoadTimer;
164 
165  // These are actually set by the concrete implementation via the setup
166  // method.
170 
171  void setPlayLoopImp();
172  void unsetPlayLoopImp();
173 
177  bool m_forward;
179  bool m_loop;
180  Float_t m_playDelay;
186 };
187 
188 #endif
sigc::signal< void > timeout_
FWSelectionManager * selectionManager()
FWModelChangeManager * modelChangeManager()
std::string m_geometryFilename
FWGUIManager * guiManager()
FWColorManager * colorManager()
std::unique_ptr< FWModelChangeManager > m_changeManager
void setAutoSaveAllViewsHeight(int x)
std::unique_ptr< FWGUIManager > m_guiManager
std::unique_ptr< FWSelectionManager > m_selectionManager
FWEventItemsManager * eiManager()
unsigned long long EventNumber_t
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
std::unique_ptr< FWEventItemsManager > m_eiManager
const char * configFilename() const
std::unique_ptr< SignalTimer > m_autoLoadTimer
Definition: config.py:1
unsigned int LuminosityBlockNumber_t
FWModelChangeManager * changeManager()
std::unique_ptr< FWColorManager > m_colorManager
FWNavigatorBase * m_navigatorPtr
void setGeometryFilename(const std::string &filename)
def draw(name, histos, styles=_defaultStyles, legendLabels=[], kwargs)
bool loop() const
CmsShowTaskExecutor * startupTasks()
std::unique_ptr< CmsShowTaskExecutor > m_startupTasks
virtual void checkKeyBindingsOnPLayEventsStateChanged()
FWJobMetadataManager * m_metadataManagerPtr
fireworks::Context * context()
void setSimGeometryFilename(const std::string &filename, const std::string &geoname)
double f[11][100]
#define noexcept
std::string m_TGeoName
FWViewManagerManager * viewManager()
std::string m_simGeometryFilename
void setAutoSaveAllViewsFormat(const std::string &fmt)
fireworks::Context * m_contextPtr
std::unique_ptr< FWConfigurationManager > m_configurationManager
std::unique_ptr< FWViewManagerManager > m_viewManager
bool isPlaying() const
FWGeometry & getGeom()
FWConfigurationManager * configurationManager()
std::string m_autoSaveAllViewsFormat
unsigned int RunNumber_t
bool forward() const
const std::string & geometryFilename(void)
void setConfigFilename(const std::string &f)
std::string m_configFileName