CMS 3D CMS Logo

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

#include <FWFFService.h>

Inheritance diagram for FWFFService:
CmsShowMainBase

Public Member Functions

virtual void autoLoadNewEvent ()
 
virtual void checkPosition ()
 
void display (const std::string &info="")
 
 FWFFService (const edm::ParameterSet &, edm::ActivityRegistry &)
 
TEveMagField * getMagField ()
 
void postBeginJob ()
 
void postBeginRun (const edm::Run &, const edm::EventSetup &)
 
void postEndJob ()
 
void postProcessEvent (const edm::Event &, const edm::EventSetup &)
 
void quit ()
 
void setupFieldForPropagator (TEveTrackPropagator *prop)
 
virtual void stopPlaying ()
 
virtual ~FWFFService ()
 
- Public Member Functions inherited from CmsShowMainBase
FWModelChangeManagerchangeManager ()
 
virtual void checkKeyBindingsOnPLayEventsStateChanged ()
 
 CmsShowMainBase ()
 
FWColorManagercolorManager ()
 
const char * configFilename () const
 
FWConfigurationManagerconfigurationManager ()
 
void doFirstEvent ()
 
void doLastEvent ()
 
void doNextEvent ()
 
void doPreviousEvent ()
 
void draw ()
 
FWEventItemsManagereiManager ()
 
bool forward () const
 
const std::string & geometryFilename (void)
 
FWGeometrygetGeom ()
 
void goToRunEvent (edm::RunNumber_t, edm::LuminosityBlockNumber_t, edm::EventNumber_t)
 
FWGUIManagerguiManager ()
 
bool isPlaying () const
 
void loadGeometry ()
 
bool loop () const
 
FWModelChangeManagermodelChangeManager ()
 
void partialLoadConfiguration (const std::string &config)
 
void partialWriteToConfigFile (const std::string &config)
 
void playBackward ()
 
void playForward ()
 
void registerPhysicsObject (const FWPhysicsObjectDesc &iItem)
 
void reloadConfiguration (const std::string &config)
 
FWSelectionManagerselectionManager ()
 
void setAutoSaveAllViewsFormat (const std::string &fmt)
 
void setAutoSaveAllViewsHeight (int x)
 
void setConfigFilename (const std::string &f)
 
void setGeometryFilename (const std::string &filename)
 
void setPlayDelay (Float_t val)
 
void setPlayLoop ()
 
void setSimGeometryFilename (const std::string &filename)
 
void setup (FWNavigatorBase *navigator, fireworks::Context *context, FWJobMetadataManager *metadataManager)
 
void setupActions ()
 
void setupAutoLoad (float x)
 
void setupConfiguration ()
 
void setupDebugSupport ()
 
void setupViewManagers ()
 
void startAutoLoadTimer ()
 
CmsShowTaskExecutorstartupTasks ()
 
void stopAutoLoadTimer ()
 
void unsetPlayLoop ()
 
FWViewManagerManagerviewManager ()
 
void writePartialToConfigFile ()
 
void writeToConfigFile (const std::string &config)
 
void writeToCurrentConfigFile ()
 
virtual ~CmsShowMainBase ()
 

Private Member Functions

 FWFFService (const FWFFService &)
 
const FWFFServiceoperator= (const FWFFService &)
 

Private Attributes

bool m_AllowStep
 
FWFFHelper m_appHelper
 
std::auto_ptr< fireworks::Contextm_context
 
TEveManager * m_EveManager
 
bool m_firstTime
 
TEveMagField * m_MagField
 
std::auto_ptr
< FWFFMetadataManager
m_metadataManager
 
std::auto_ptr< FWFFNavigatorm_navigator
 
TRint * m_Rint
 
bool m_ShowEvent
 

Additional Inherited Members

- Protected Member Functions inherited from CmsShowMainBase
fireworks::Contextcontext ()
 
virtual void eventChangedImp ()
 
void eventChangedSlot ()
 
void sendVersionInfo ()
 

Detailed Description

Definition at line 34 of file FWFFService.h.

Constructor & Destructor Documentation

FWFFService::FWFFService ( const edm::ParameterSet ps,
edm::ActivityRegistry ar 
)

Definition at line 113 of file FWFFService.cc.

References CmsShowTaskExecutor::addTask(), CmsShowMainBase::eiManager(), f, CmsShowMainBase::geometryFilename(), edm::ParameterSet::getUntrackedParameter(), CmsShowMainBase::loadGeometry(), m_context, m_MagField, m_metadataManager, m_navigator, postBeginJob(), postBeginRun(), postEndJob(), postProcessEvent(), CmsShowMainBase::setConfigFilename(), FWEventItemsManager::setContext(), CmsShowMainBase::setGeometryFilename(), CmsShowMainBase::setup(), CmsShowMainBase::startupTasks(), AlCaHLTBitMon_QueryRunRegistry::string, edm::ActivityRegistry::watchPostBeginJob(), edm::ActivityRegistry::watchPostBeginRun(), edm::ActivityRegistry::watchPostEndJob(), and edm::ActivityRegistry::watchPostProcessEvent().

114  : CmsShowMainBase(),
115  m_navigator(new FWFFNavigator(*this)),
119  eiManager(),
120  colorManager(),
121  m_metadataManager.get())),
122  m_appHelper(ps, ar),
124  m_AllowStep(true),
125  m_ShowEvent(true),
126  m_firstTime(true)
127 {
128  printf("FWFFService::FWFFService CTOR\n");
129 
130  setup(m_navigator.get(), m_context.get(), m_metadataManager.get());
131 
132  eiManager()->setContext(m_context.get());
133 
134  // By default, we look up geometry and configuration in the workarea, then
135  // in the release area then in the local directory. It is also possible to
136  // override those locations by using the displayConfigurationFilename and
137  // geometryFilename in the parameterset.
138  const char *releaseBase = getenv("CMSSW_RELEASE_BASE");
139  const char *workarea = getenv("CMSSW_BASE");
140  std::string displayConfigRelFilename = "/src/Fireworks/FWInterface/macros/ffw.fwc";
141  std::string geometryRelFilename = "/src/Fireworks/FWInterface/data/cmsGeom10.root";
142 
143  std::string displayConfigFilename = "ffw.fwc";
145 
146  if (releaseBase && access((releaseBase + displayConfigFilename).c_str(), R_OK) == 0)
147  displayConfigFilename = releaseBase + displayConfigRelFilename;
148  if (workarea && access((workarea + displayConfigRelFilename).c_str(), R_OK) == 0)
149  displayConfigFilename = workarea + displayConfigRelFilename;
150 
151  if (releaseBase && access((releaseBase + geometryRelFilename).c_str(), R_OK) == 0)
152  geometryFilename = releaseBase + geometryRelFilename;
153  if (workarea && access((workarea + geometryRelFilename).c_str(), R_OK) == 0)
154  geometryFilename = workarea + geometryRelFilename;
155 
156  displayConfigFilename = ps.getUntrackedParameter<std::string>("diplayConfigFilename", displayConfigFilename);
157  geometryFilename = ps.getUntrackedParameter<std::string>("geometryFilename", geometryFilename);
158 
159  setGeometryFilename(geometryFilename);
160  setConfigFilename(displayConfigFilename);
161 
163 
164  if (!geometryFilename.empty())
165  {
166  f=boost::bind(&CmsShowMainBase::loadGeometry,this);
167  startupTasks()->addTask(f);
168  }
169 
170  m_MagField = new CmsEveMagField();
171 
172  // ----------------------------------------------------------------
173 
176 
178 
180 }
void watchPostBeginRun(PostBeginRun::slot_type const &iSlot)
T getUntrackedParameter(std::string const &, T const &) const
void postBeginJob()
Definition: FWFFService.cc:195
FWSelectionManager * selectionManager()
std::auto_ptr< FWFFNavigator > m_navigator
Definition: FWFFService.h:69
TRint * m_Rint
Definition: FWFFService.h:75
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
FWColorManager * colorManager()
void postProcessEvent(const edm::Event &, const edm::EventSetup &)
Definition: FWFFService.cc:295
FWEventItemsManager * eiManager()
void postBeginRun(const edm::Run &, const edm::EventSetup &)
Definition: FWFFService.cc:242
bool m_ShowEvent
Definition: FWFFService.h:81
void setup(FWNavigatorBase *navigator, fireworks::Context *context, FWJobMetadataManager *metadataManager)
void setContext(fireworks::Context *)
FWModelChangeManager * changeManager()
void setGeometryFilename(const std::string &filename)
void watchPostProcessEvent(PostProcessEvent::slot_type const &iSlot)
bool m_AllowStep
Definition: FWFFService.h:80
CmsShowTaskExecutor * startupTasks()
double f[11][100]
TRint * app()
Definition: FWFFHelper.h:16
TEveMagField * m_MagField
Definition: FWFFService.h:77
std::auto_ptr< FWFFMetadataManager > m_metadataManager
Definition: FWFFService.h:70
boost::function0< void > TaskFunctor
void addTask(const TaskFunctor &iTask)
FWFFHelper m_appHelper
Definition: FWFFService.h:73
std::auto_ptr< fireworks::Context > m_context
Definition: FWFFService.h:71
const std::string & geometryFilename(void)
void postEndJob()
Definition: FWFFService.cc:213
void setConfigFilename(const std::string &f)
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal
bool m_firstTime
Definition: FWFFService.h:82
FWFFService::~FWFFService ( )
virtual

Definition at line 182 of file FWFFService.cc.

References m_MagField.

183 {
184  printf("FWFFService::~FWFFService DTOR\n");
185 
186  delete m_MagField;
187 }
TEveMagField * m_MagField
Definition: FWFFService.h:77
FWFFService::FWFFService ( const FWFFService )
private

Member Function Documentation

virtual void FWFFService::autoLoadNewEvent ( )
inlinevirtual

Implements CmsShowMainBase.

Definition at line 60 of file FWFFService.h.

60 {}
void FWFFService::checkPosition ( )
virtual

Implements CmsShowMainBase.

Definition at line 221 of file FWFFService.cc.

References FWGUIManager::disableNext(), FWGUIManager::disablePrevious(), CSGAction::enable(), CmsShowMainFrame::enableNavigatorControls(), FWGUIManager::getMainFrame(), CmsShowMainBase::guiManager(), CmsShowMainBase::isPlaying(), CmsShowMainBase::loop(), m_navigator, and FWGUIManager::playEventsAction().

Referenced by postProcessEvent().

222 {
223  if (loop() && isPlaying())
224  return;
225 
227 
228  if (m_navigator->isFirstEvent())
230 
231  if (m_navigator->isLastEvent())
232  {
233  guiManager()->disableNext();
234  // force enable play events action in --port mode
235  if (!guiManager()->playEventsAction()->isEnabled())
237  }
238 }
std::auto_ptr< FWFFNavigator > m_navigator
Definition: FWFFService.h:69
FWGUIManager * guiManager()
void enable()
Definition: CSGAction.cc:284
bool loop() const
CmsShowMainFrame * getMainFrame() const
Definition: FWGUIManager.h:201
void disablePrevious()
CSGContinuousAction * playEventsAction()
bool isPlaying() const
void disableNext()
void FWFFService::display ( const std::string &  info = "")

Definition at line 309 of file FWFFService.cc.

References m_AllowStep, and m_Rint.

310 {
311  // Display whatever was registered so far, wait until user presses
312  // the "Step" button.
313 
314  if (m_AllowStep)
315  {
316  gEve->Redraw3D();
317  m_Rint->Run(kTRUE);
318  }
319 }
TRint * m_Rint
Definition: FWFFService.h:75
bool m_AllowStep
Definition: FWFFService.h:80
TEveMagField * FWFFService::getMagField ( )

Definition at line 326 of file FWFFService.cc.

References m_MagField.

327 {
328  return m_MagField;
329 }
TEveMagField * m_MagField
Definition: FWFFService.h:77
const FWFFService& FWFFService::operator= ( const FWFFService )
private
void FWFFService::postBeginJob ( )

Definition at line 195 of file FWFFService.cc.

References CmsShowTaskExecutor::addTask(), assert(), f, m_Rint, CmsShowTaskExecutor::startDoingTasks(), and CmsShowMainBase::startupTasks().

Referenced by FWFFService().

196 {
197  printf("FWFFService::postBeginJob\n");
198  // We need to enter the GUI loop in order to
199  // have all the callbacks executed. The last callback will
200  // be responsible for returning the control to CMSSW.
201  assert(m_Rint);
203  f=boost::bind(&TApplication::Terminate, m_Rint, 0);
204  startupTasks()->addTask(f);
205  // FIXME: do we really need to delay tasks like this?
207  m_Rint->Run(kTRUE);
208  // Show the GUI ...
209  gSystem->ProcessEvents();
210 }
TRint * m_Rint
Definition: FWFFService.h:75
assert(m_qm.get())
CmsShowTaskExecutor * startupTasks()
double f[11][100]
boost::function0< void > TaskFunctor
void addTask(const TaskFunctor &iTask)
void FWFFService::postBeginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)

Definition at line 242 of file FWFFService.cc.

References edm::EventSetup::get(), edm::Run::getByLabel(), CmsShowMainBase::getGeom(), CmsShowMainBase::guiManager(), FWGeometry::initMap(), edm::HandleBase::isValid(), m_context, m_firstTime, m_MagField, edm::ESTransientHandle< T >::product(), CmsShowMainBase::setupActions(), CmsShowMainBase::setupConfiguration(), CmsShowMainBase::setupViewManagers(), and FWGUIManager::updateStatus().

Referenced by FWFFService().

243 {
244  // If the geometry was not picked up from a file, we try to get it from the
245  // EventSetup!
246  // FIXME: we need to check we execute only once because the view managers
247  // depend on geometry and they cannot be initialised more than once.
248  // This should actually be cleaned up so that the various view manager
249  // don't care about geometry.
250  // FIXME: we should actually be able to update the geometry when requested.
251  // this is not possible at the moment.
252  if (m_firstTime == true)
253  {
254  if (m_context->getGeom() == 0)
255  {
256  guiManager()->updateStatus("Loading geometry...");
258  iSetup.get<FWRecoGeometryRecord>().get(geoh);
259  getGeom().initMap(geoh.product()->idToName);
260  m_context->setGeom(&(getGeom()));
261  }
262 
265  setupActions();
266  m_firstTime = false;
267  }
268 
269  float current = 18160.0f;
270 
272  // bool res = iRun.getByType(runCond);
273  bool res = iRun.getByLabel("conditionsInEdm", runCond);
274  if (res && runCond.isValid())
275  {
276  printf("Got current from conds in edm %f\n", runCond->BAvgCurrent);
277  current = runCond->BAvgCurrent;
278  }
279  else
280  {
281  printf("Could not extract run-conditions get-result=%d, is-valid=%d\n", res, runCond.isValid());
282 
284  iSetup.get<RunInfoRcd>().get(sum);
285 
286  current = sum->m_avg_current;
287  printf("Got current from RunInfoRcd %f\n", sum->m_avg_current);
288  }
289 
290  static_cast<CmsEveMagField*>(m_MagField)->SetFieldByCurrent(current);
291 }
bool getByLabel(std::string const &label, Handle< PROD > &result) const
Definition: Run.h:219
FWGUIManager * guiManager()
void initMap(const FWRecoGeom::InfoMap &map)
Definition: FWGeometry.cc:143
void updateStatus(const char *status)
bool isValid() const
Definition: HandleBase.h:75
TEveMagField * m_MagField
Definition: FWFFService.h:77
const T & get() const
Definition: EventSetup.h:56
T const * product() const
FWGeometry & getGeom()
std::auto_ptr< fireworks::Context > m_context
Definition: FWFFService.h:71
bool m_firstTime
Definition: FWFFService.h:82
void FWFFService::postEndJob ( )

Definition at line 213 of file FWFFService.cc.

Referenced by FWFFService().

214 {
215  printf("FWFFService::postEndJob\n");
216 
217  TEveManager::Terminate();
218 }
void FWFFService::postProcessEvent ( const edm::Event event,
const edm::EventSetup es 
)

Definition at line 295 of file FWFFService.cc.

References checkPosition(), CmsShowMainBase::draw(), m_metadataManager, m_navigator, and m_Rint.

Referenced by FWFFService().

296 {
297  printf("FWFFService::postProcessEvent: Starting GUI loop.\n");
298 
299  m_metadataManager->update(new FWFFMetadataUpdateRequest(event));
300  m_navigator->setCurrentEvent(&event);
301  checkPosition();
302  draw();
303  m_Rint->Run(kTRUE);
304 }
std::auto_ptr< FWFFNavigator > m_navigator
Definition: FWFFService.h:69
TRint * m_Rint
Definition: FWFFService.h:75
std::auto_ptr< FWFFMetadataManager > m_metadataManager
Definition: FWFFService.h:70
virtual void checkPosition()
Definition: FWFFService.cc:221
void FWFFService::quit ( )
virtual

Implements CmsShowMainBase.

Definition at line 338 of file FWFFService.cc.

339 {
340  gSystem->ExitLoop();
341  printf("FWFFService exiting on user request.\n");
342 
343  // Throwing exception here is bad because:
344  // a) it does not work when in a "debug step";
345  // b) does not restore terminal state.
346  // So we do exit instead for now.
347  // throw cms::Exception("UserTerminationRequest");
348  gSystem->Exit(0);
349 }
void FWFFService::setupFieldForPropagator ( TEveTrackPropagator *  prop)

Definition at line 332 of file FWFFService.cc.

References m_MagField.

333 {
334  prop->SetMagFieldObj(m_MagField, kFALSE);
335 }
TEveMagField * m_MagField
Definition: FWFFService.h:77
virtual void FWFFService::stopPlaying ( )
inlinevirtual

Reimplemented from CmsShowMainBase.

Definition at line 59 of file FWFFService.h.

59 {}

Member Data Documentation

bool FWFFService::m_AllowStep
private

Definition at line 80 of file FWFFService.h.

Referenced by display().

FWFFHelper FWFFService::m_appHelper
private

Definition at line 73 of file FWFFService.h.

std::auto_ptr<fireworks::Context> FWFFService::m_context
private

Definition at line 71 of file FWFFService.h.

Referenced by FWFFService(), and postBeginRun().

TEveManager* FWFFService::m_EveManager
private

Definition at line 74 of file FWFFService.h.

bool FWFFService::m_firstTime
private

Definition at line 82 of file FWFFService.h.

Referenced by postBeginRun().

TEveMagField* FWFFService::m_MagField
private
std::auto_ptr<FWFFMetadataManager> FWFFService::m_metadataManager
private

Definition at line 70 of file FWFFService.h.

Referenced by FWFFService(), and postProcessEvent().

std::auto_ptr<FWFFNavigator> FWFFService::m_navigator
private

Definition at line 69 of file FWFFService.h.

Referenced by checkPosition(), FWFFService(), and postProcessEvent().

TRint* FWFFService::m_Rint
private

Definition at line 75 of file FWFFService.h.

Referenced by display(), postBeginJob(), and postProcessEvent().

bool FWFFService::m_ShowEvent
private

Definition at line 81 of file FWFFService.h.