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 ()
 
 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 playBackward ()
 
void playForward ()
 
void registerPhysicsObject (const FWPhysicsObjectDesc &iItem)
 
void reloadConfiguration (const std::string &config)
 
FWSelectionManagerselectionManager ()
 
void setAutoSaveAllViewsFormat (const std::string &fmt)
 
void setConfigFilename (const std::string &f)
 
void setGeometryFilename (const std::string &filename)
 
void setIsPlaying (bool value)
 
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 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
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 112 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().

113  : CmsShowMainBase(),
114  m_navigator(new FWFFNavigator(*this)),
118  eiManager(),
119  colorManager(),
120  m_metadataManager.get())),
121  m_appHelper(ps, ar),
123  m_AllowStep(true),
124  m_ShowEvent(true),
125  m_firstTime(true)
126 {
127  printf("FWFFService::FWFFService CTOR\n");
128 
129  setup(m_navigator.get(), m_context.get(), m_metadataManager.get());
130 
131  eiManager()->setContext(m_context.get());
132 
133  // By default, we look up geometry and configuration in the workarea, then
134  // in the release area then in the local directory. It is also possible to
135  // override those locations by using the displayConfigurationFilename and
136  // geometryFilename in the parameterset.
137  const char *releaseBase = getenv("CMSSW_RELEASE_BASE");
138  const char *workarea = getenv("CMSSW_BASE");
139  std::string displayConfigRelFilename = "/src/Fireworks/FWInterface/macros/ffw.fwc";
140  std::string geometryRelFilename = "/src/Fireworks/FWInterface/data/cmsGeom10.root";
141 
142  std::string displayConfigFilename = "ffw.fwc";
144 
145  if (releaseBase && access((releaseBase + displayConfigFilename).c_str(), R_OK) == 0)
146  displayConfigFilename = releaseBase + displayConfigRelFilename;
147  if (workarea && access((workarea + displayConfigRelFilename).c_str(), R_OK) == 0)
148  displayConfigFilename = workarea + displayConfigRelFilename;
149 
150  if (releaseBase && access((releaseBase + geometryRelFilename).c_str(), R_OK) == 0)
151  geometryFilename = releaseBase + geometryRelFilename;
152  if (workarea && access((workarea + geometryRelFilename).c_str(), R_OK) == 0)
153  geometryFilename = workarea + geometryRelFilename;
154 
155  displayConfigFilename = ps.getUntrackedParameter<std::string>("diplayConfigFilename", displayConfigFilename);
156  geometryFilename = ps.getUntrackedParameter<std::string>("geometryFilename", geometryFilename);
157 
158  setGeometryFilename(geometryFilename);
159  setConfigFilename(displayConfigFilename);
160 
162 
163  if (!geometryFilename.empty())
164  {
165  f=boost::bind(&CmsShowMainBase::loadGeometry,this);
166  startupTasks()->addTask(f);
167  }
168 
169  m_MagField = new CmsEveMagField();
170 
171  // ----------------------------------------------------------------
172 
175 
177 
179 }
void watchPostBeginRun(PostBeginRun::slot_type const &iSlot)
T getUntrackedParameter(std::string const &, T const &) const
void postBeginJob()
Definition: FWFFService.cc:194
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:294
FWEventItemsManager * eiManager()
void postBeginRun(const edm::Run &, const edm::EventSetup &)
Definition: FWFFService.cc:241
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:212
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 181 of file FWFFService.cc.

References m_MagField.

182 {
183  printf("FWFFService::~FWFFService DTOR\n");
184 
185  delete m_MagField;
186 }
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 220 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().

221 {
222  if (loop() && isPlaying())
223  return;
224 
226 
227  if (m_navigator->isFirstEvent())
229 
230  if (m_navigator->isLastEvent())
231  {
232  guiManager()->disableNext();
233  // force enable play events action in --port mode
234  if (!guiManager()->playEventsAction()->isEnabled())
236  }
237 }
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:199
void disablePrevious()
CSGContinuousAction * playEventsAction()
bool isPlaying() const
void disableNext()
void FWFFService::display ( const std::string &  info = "")

Definition at line 308 of file FWFFService.cc.

References m_AllowStep, and m_Rint.

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

Definition at line 325 of file FWFFService.cc.

References m_MagField.

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

Definition at line 194 of file FWFFService.cc.

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

Referenced by FWFFService().

195 {
196  printf("FWFFService::postBeginJob\n");
197  // We need to enter the GUI loop in order to
198  // have all the callbacks executed. The last callback will
199  // be responsible for returning the control to CMSSW.
200  assert(m_Rint);
202  f=boost::bind(&TApplication::Terminate, m_Rint, 0);
203  startupTasks()->addTask(f);
204  // FIXME: do we really need to delay tasks like this?
206  m_Rint->Run(kTRUE);
207  // Show the GUI ...
208  gSystem->ProcessEvents();
209 }
TRint * m_Rint
Definition: FWFFService.h:75
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 241 of file FWFFService.cc.

References cond::rpcobimon::current, 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().

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

Referenced by FWFFService().

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

Definition at line 294 of file FWFFService.cc.

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

Referenced by FWFFService().

295 {
296  printf("FWFFService::postProcessEvent: Starting GUI loop.\n");
297 
298  m_metadataManager->update(new FWFFMetadataUpdateRequest(event));
299  m_navigator->setCurrentEvent(&event);
300  checkPosition();
301  draw();
302  m_Rint->Run(kTRUE);
303 }
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:220
void FWFFService::quit ( )
virtual

Implements CmsShowMainBase.

Definition at line 337 of file FWFFService.cc.

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

Definition at line 331 of file FWFFService.cc.

References m_MagField.

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

Implements 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.