CMS 3D CMS Logo

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

void autoLoadNewEvent () override
 
void checkPosition () override
 
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 () override
 
void setupFieldForPropagator (TEveTrackPropagator *prop)
 
void stopPlaying () override
 
 ~FWFFService () override
 
- 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 () noexcept(false)
 

Private Member Functions

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

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< FWFFMetadataManagerm_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 ,
edm::ActivityRegistry  
)
FWFFService::~FWFFService ( )
override

Definition at line 182 of file FWFFService.cc.

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

Member Function Documentation

void FWFFService::autoLoadNewEvent ( )
inlineoverridevirtual

Implements CmsShowMainBase.

Definition at line 60 of file FWFFService.h.

60 {}
void FWFFService::checkPosition ( )
overridevirtual

Implements CmsShowMainBase.

Definition at line 221 of file FWFFService.cc.

References heppy_loop::loop.

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.

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.

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

Definition at line 195 of file FWFFService.cc.

References f.

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
void startDoingTasks() override
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::ConditionsInRunBlock::BAvgCurrent, edm::EventSetup::get(), edm::Run::getByLabel(), FWRecoGeometry::idToName, edm::HandleBase::isValid(), and edm::ESTransientHandle< T >::product().

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() == nullptr)
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:248
FWGUIManager * guiManager()
void initMap(const FWRecoGeom::InfoMap &map)
Definition: FWGeometry.cc:149
void updateStatus(const char *status)
Definition: Electron.h:4
FWRecoGeom::InfoMap idToName
bool isValid() const
Definition: HandleBase.h:74
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 213 of file FWFFService.cc.

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 ntuplePlotting::draw().

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
void checkPosition() override
Definition: FWFFService.cc:221
void FWFFService::quit ( )
overridevirtual

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.

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

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.

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.

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.

TEveMagField* FWFFService::m_MagField
private

Definition at line 77 of file FWFFService.h.

std::auto_ptr<FWFFMetadataManager> FWFFService::m_metadataManager
private

Definition at line 70 of file FWFFService.h.

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

Definition at line 69 of file FWFFService.h.

TRint* FWFFService::m_Rint
private

Definition at line 75 of file FWFFService.h.

bool FWFFService::m_ShowEvent
private

Definition at line 81 of file FWFFService.h.