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, const std::string &geoname)
 
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::unique_ptr< fireworks::Contextm_context
 
TEveManager * m_EveManager
 
bool m_firstTime
 
TEveMagField * m_MagField
 
std::unique_ptr< FWFFMetadataManagerm_metadataManager
 
std::unique_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 31 of file FWFFService.h.

Constructor & Destructor Documentation

◆ FWFFService() [1/2]

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

Definition at line 99 of file FWFFService.cc.

100  : CmsShowMainBase(),
101  m_navigator(new FWFFNavigator(*this)),
105  m_appHelper(ps, ar),
107  m_AllowStep(true),
108  m_ShowEvent(true),
109  m_firstTime(true) {
110  printf("FWFFService::FWFFService CTOR\n");
111 
112  setup(m_navigator.get(), m_context.get(), m_metadataManager.get());
113 
114  eiManager()->setContext(m_context.get());
115 
116  // By default, we look up geometry and configuration in the workarea, then
117  // in the release area then in the local directory. It is also possible to
118  // override those locations by using the displayConfigurationFilename and
119  // geometryFilename in the parameterset.
120  const char* releaseBase = std::getenv("CMSSW_RELEASE_BASE");
121  const char* workarea = std::getenv("CMSSW_BASE");
122  std::string displayConfigRelFilename = "/src/Fireworks/FWInterface/macros/ffw.fwc";
123  std::string geometryRelFilename = "/src/Fireworks/FWInterface/data/cmsGeom10.root";
124 
125  std::string displayConfigFilename = "ffw.fwc";
127 
128  if (releaseBase && access((releaseBase + displayConfigFilename).c_str(), R_OK) == 0)
129  displayConfigFilename = releaseBase + displayConfigRelFilename;
130  if (workarea && access((workarea + displayConfigRelFilename).c_str(), R_OK) == 0)
131  displayConfigFilename = workarea + displayConfigRelFilename;
132 
133  if (releaseBase && access((releaseBase + geometryRelFilename).c_str(), R_OK) == 0)
134  geometryFilename = releaseBase + geometryRelFilename;
135  if (workarea && access((workarea + geometryRelFilename).c_str(), R_OK) == 0)
136  geometryFilename = workarea + geometryRelFilename;
137 
138  displayConfigFilename = ps.getUntrackedParameter<std::string>("diplayConfigFilename", displayConfigFilename);
140 
142  setConfigFilename(displayConfigFilename);
143 
145 
146  if (!geometryFilename.empty()) {
147  f = boost::bind(&CmsShowMainBase::loadGeometry, this);
148  startupTasks()->addTask(f);
149  }
150 
151  m_MagField = new CmsEveMagField();
152 
153  // ----------------------------------------------------------------
154 
157 
159 
161 }

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().

◆ ~FWFFService()

FWFFService::~FWFFService ( )
override

Definition at line 163 of file FWFFService.cc.

163  {
164  printf("FWFFService::~FWFFService DTOR\n");
165 
166  delete m_MagField;
167 }

References m_MagField.

◆ FWFFService() [2/2]

FWFFService::FWFFService ( const FWFFService )
privatedelete

Member Function Documentation

◆ autoLoadNewEvent()

void FWFFService::autoLoadNewEvent ( )
inlineoverridevirtual

Implements CmsShowMainBase.

Definition at line 56 of file FWFFService.h.

56 {}

◆ checkPosition()

void FWFFService::checkPosition ( )
overridevirtual

Implements CmsShowMainBase.

Definition at line 195 of file FWFFService.cc.

195  {
196  if (loop() && isPlaying())
197  return;
198 
200 
201  if (m_navigator->isFirstEvent())
203 
204  if (m_navigator->isLastEvent()) {
205  guiManager()->disableNext();
206  // force enable play events action in --port mode
207  if (!guiManager()->playEventsAction()->isEnabled())
209  }
210 }

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().

◆ display()

void FWFFService::display ( const std::string &  info = "")

Definition at line 271 of file FWFFService.cc.

271  {
272  // Display whatever was registered so far, wait until user presses
273  // the "Step" button.
274 
275  if (m_AllowStep) {
276  gEve->Redraw3D();
277  m_Rint->Run(kTRUE);
278  }
279 }

References m_AllowStep, and m_Rint.

◆ getMagField()

TEveMagField * FWFFService::getMagField ( )

Definition at line 285 of file FWFFService.cc.

285 { return m_MagField; }

References m_MagField.

◆ operator=()

const FWFFService& FWFFService::operator= ( const FWFFService )
privatedelete

◆ postBeginJob()

void FWFFService::postBeginJob ( )

Definition at line 173 of file FWFFService.cc.

173  {
174  printf("FWFFService::postBeginJob\n");
175  // We need to enter the GUI loop in order to
176  // have all the callbacks executed. The last callback will
177  // be responsible for returning the control to CMSSW.
178  assert(m_Rint);
180  f = boost::bind(&TApplication::Terminate, m_Rint, 0);
181  startupTasks()->addTask(f);
182  // FIXME: do we really need to delay tasks like this?
184  m_Rint->Run(kTRUE);
185  // Show the GUI ...
186  gSystem->ProcessEvents();
187 }

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

Referenced by FWFFService().

◆ postBeginRun()

void FWFFService::postBeginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)

Definition at line 213 of file FWFFService.cc.

213  {
214  // If the geometry was not picked up from a file, we try to get it from the
215  // EventSetup!
216  // FIXME: we need to check we execute only once because the view managers
217  // depend on geometry and they cannot be initialised more than once.
218  // This should actually be cleaned up so that the various view manager
219  // don't care about geometry.
220  // FIXME: we should actually be able to update the geometry when requested.
221  // this is not possible at the moment.
222  if (m_firstTime == true) {
223  if (m_context->getGeom() == nullptr) {
224  guiManager()->updateStatus("Loading geometry...");
226  iSetup.get<FWRecoGeometryRecord>().get(geoh);
227  getGeom().initMap(geoh.product()->idToName);
228  m_context->setGeom(&(getGeom()));
229  }
230 
233  setupActions();
234  m_firstTime = false;
235  }
236 
237  float current = 18160.0f;
238 
240  // bool res = iRun.getByType(runCond);
241  bool res = iRun.getByLabel("conditionsInEdm", runCond);
242  if (res && runCond.isValid()) {
243  printf("Got current from conds in edm %f\n", runCond->BAvgCurrent);
244  current = runCond->BAvgCurrent;
245  } else {
246  printf("Could not extract run-conditions get-result=%d, is-valid=%d\n", res, runCond.isValid());
247 
249  iSetup.get<RunInfoRcd>().get(sum);
250 
251  current = sum->m_avg_current;
252  printf("Got current from RunInfoRcd %f\n", sum->m_avg_current);
253  }
254 
255  static_cast<CmsEveMagField*>(m_MagField)->SetFieldByCurrent(current);
256 }

References edm::ConditionsInRunBlock::BAvgCurrent, edm::EventSetup::get(), get, edm::Run::getByLabel(), CmsShowMainBase::getGeom(), CmsShowMainBase::guiManager(), FWRecoGeometry::idToName, 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().

◆ postEndJob()

void FWFFService::postEndJob ( )

Definition at line 189 of file FWFFService.cc.

189  {
190  printf("FWFFService::postEndJob\n");
191 
192  TEveManager::Terminate();
193 }

Referenced by FWFFService().

◆ postProcessEvent()

void FWFFService::postProcessEvent ( const edm::Event event,
const edm::EventSetup es 
)

Definition at line 259 of file FWFFService.cc.

259  {
260  printf("FWFFService::postProcessEvent: Starting GUI loop.\n");
261 
263  m_navigator->setCurrentEvent(&event);
264  checkPosition();
265  draw();
266  m_Rint->Run(kTRUE);
267 }

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

Referenced by FWFFService().

◆ quit()

void FWFFService::quit ( )
overridevirtual

Implements CmsShowMainBase.

Definition at line 289 of file FWFFService.cc.

289  {
290  gSystem->ExitLoop();
291  printf("FWFFService exiting on user request.\n");
292 
293  // Throwing exception here is bad because:
294  // a) it does not work when in a "debug step";
295  // b) does not restore terminal state.
296  // So we do exit instead for now.
297  // throw cms::Exception("UserTerminationRequest");
298  gSystem->Exit(0);
299 }

◆ setupFieldForPropagator()

void FWFFService::setupFieldForPropagator ( TEveTrackPropagator *  prop)

Definition at line 287 of file FWFFService.cc.

287 { prop->SetMagFieldObj(m_MagField, kFALSE); }

References m_MagField.

◆ stopPlaying()

void FWFFService::stopPlaying ( )
inlineoverridevirtual

Reimplemented from CmsShowMainBase.

Definition at line 55 of file FWFFService.h.

55 {}

Member Data Documentation

◆ m_AllowStep

bool FWFFService::m_AllowStep
private

Definition at line 76 of file FWFFService.h.

Referenced by display().

◆ m_appHelper

FWFFHelper FWFFService::m_appHelper
private

Definition at line 70 of file FWFFService.h.

◆ m_context

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

Definition at line 68 of file FWFFService.h.

Referenced by FWFFService(), and postBeginRun().

◆ m_EveManager

TEveManager* FWFFService::m_EveManager
private

Definition at line 71 of file FWFFService.h.

◆ m_firstTime

bool FWFFService::m_firstTime
private

Definition at line 78 of file FWFFService.h.

Referenced by postBeginRun().

◆ m_MagField

TEveMagField* FWFFService::m_MagField
private

◆ m_metadataManager

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

Definition at line 67 of file FWFFService.h.

Referenced by FWFFService(), and postProcessEvent().

◆ m_navigator

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

Definition at line 66 of file FWFFService.h.

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

◆ m_Rint

TRint* FWFFService::m_Rint
private

Definition at line 72 of file FWFFService.h.

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

◆ m_ShowEvent

bool FWFFService::m_ShowEvent
private

Definition at line 77 of file FWFFService.h.

FWFFService::m_Rint
TRint * m_Rint
Definition: FWFFService.h:72
fireworks::Context
Definition: Context.h:41
CmsShowMainBase::changeManager
FWModelChangeManager * changeManager()
Definition: CmsShowMainBase.h:54
CmsShowMainBase::setupConfiguration
void setupConfiguration()
Definition: CmsShowMainBase.cc:315
FWFFService::postEndJob
void postEndJob()
Definition: FWFFService.cc:189
edm::ESTransientHandle::product
T const * product() const
Definition: ESTransientHandle.h:51
CmsShowMainBase::loadGeometry
void loadGeometry()
Definition: CmsShowMainBase.cc:388
FWRecoGeometryRecord
Definition: FWRecoGeometryRecord.h:9
FWFFService::m_metadataManager
std::unique_ptr< FWFFMetadataManager > m_metadataManager
Definition: FWFFService.h:67
CmsShowMainBase::guiManager
FWGUIManager * guiManager()
Definition: CmsShowMainBase.h:61
FWFFService::m_ShowEvent
bool m_ShowEvent
Definition: FWFFService.h:77
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
FWRecoGeometry::idToName
FWRecoGeom::InfoMap idToName
Definition: FWRecoGeometry.h:14
CmsShowMainFrame::enableNavigatorControls
void enableNavigatorControls()
Definition: CmsShowMainFrame.cc:567
FWFFService::postProcessEvent
void postProcessEvent(const edm::Event &, const edm::EventSetup &)
Definition: FWFFService.cc:259
FWFFHelper::app
TRint * app()
Definition: FWFFHelper.h:14
FWGUIManager::playEventsAction
CSGContinuousAction * playEventsAction()
Definition: FWGUIManager.cc:350
CmsShowMainBase::loop
bool loop() const
Definition: CmsShowMainBase.h:107
FWFFService::postBeginRun
void postBeginRun(const edm::Run &, const edm::EventSetup &)
Definition: FWFFService.cc:213
FWFFService::postBeginJob
void postBeginJob()
Definition: FWFFService.cc:173
cms::cuda::assert
assert(be >=bs)
CmsShowMainBase::setup
void setup(FWNavigatorBase *navigator, fireworks::Context *context, FWJobMetadataManager *metadataManager)
Definition: CmsShowMainBase.cc:196
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition: AssociativeIterator.h:50
CmsShowMainBase::setConfigFilename
void setConfigFilename(const std::string &f)
Definition: CmsShowMainBase.h:74
FWGUIManager::getMainFrame
CmsShowMainFrame * getMainFrame() const
Definition: FWGUIManager.h:196
FWGUIManager::updateStatus
void updateStatus(const char *status)
Definition: FWGUIManager.cc:367
edm::ActivityRegistry::watchPostEndJob
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
Definition: ActivityRegistry.h:168
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
CmsShowMainBase::setupActions
void setupActions()
Definition: CmsShowMainBase.cc:73
FWFFService::m_navigator
std::unique_ptr< FWFFNavigator > m_navigator
Definition: FWFFService.h:66
CmsShowMainBase::CmsShowMainBase
CmsShowMainBase()
Definition: CmsShowMainBase.cc:49
edm::ConditionsInRunBlock::BAvgCurrent
float BAvgCurrent
Definition: ConditionsInEdm.h:27
FWFFService::m_context
std::unique_ptr< fireworks::Context > m_context
Definition: FWFFService.h:68
edm::ESHandle
Definition: DTSurvey.h:22
edm::ActivityRegistry::watchPostBeginJob
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal
Definition: ActivityRegistry.h:156
CmsShowMainBase::colorManager
FWColorManager * colorManager()
Definition: CmsShowMainBase.h:55
CmsShowMainBase::isPlaying
bool isPlaying() const
Definition: CmsShowMainBase.h:118
CmsShowMainBase::draw
void draw()
Definition: CmsShowMainBase.cc:173
CmsShowMainBase::startupTasks
CmsShowTaskExecutor * startupTasks()
Definition: CmsShowMainBase.h:66
RunInfoRcd
Definition: RunSummaryRcd.h:26
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CmsShowMainBase::geometryFilename
const std::string & geometryFilename(void)
Definition: CmsShowMainBase.h:91
FWGUIManager::disablePrevious
void disablePrevious()
Definition: FWGUIManager.cc:358
FWFFService::m_AllowStep
bool m_AllowStep
Definition: FWFFService.h:76
FWFFService::m_MagField
TEveMagField * m_MagField
Definition: FWFFService.h:74
CmsShowMainBase::setupViewManagers
void setupViewManagers()
Definition: CmsShowMainBase.cc:107
FWFFMetadataUpdateRequest
Definition: FWFFMetadataUpdateRequest.h:7
CmsShowTaskExecutor::TaskFunctor
boost::function0< void > TaskFunctor
Definition: CmsShowTaskExecutor.h:35
FWGUIManager::disableNext
void disableNext()
Definition: FWGUIManager.cc:360
CmsShowMainBase::setGeometryFilename
void setGeometryFilename(const std::string &filename)
Definition: CmsShowMainBase.h:90
edm::ActivityRegistry::watchPostBeginRun
void watchPostBeginRun(PostBeginRun::slot_type const &iSlot)
Definition: ActivityRegistry.h:475
CmsShowMainBase::selectionManager
FWSelectionManager * selectionManager()
Definition: CmsShowMainBase.h:59
FWGeometry::initMap
void initMap(const FWRecoGeom::InfoMap &map)
Definition: FWGeometry.cc:200
get
#define get
res
Definition: Electron.h:6
FWFFNavigator
Definition: FWFFNavigator.h:11
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
CmsShowTaskExecutor::startDoingTasks
void startDoingTasks() override
Definition: CmsShowTaskExecutor.cc:55
FWEventItemsManager::setContext
void setContext(fireworks::Context *)
Definition: FWEventItemsManager.cc:294
CmsShowTaskExecutor::addTask
void addTask(const TaskFunctor &iTask)
Definition: CmsShowTaskExecutor.cc:53
FWFFMetadataManager
Definition: FWFFMetadataManager.h:11
FWFFService::m_firstTime
bool m_firstTime
Definition: FWFFService.h:78
edm::ActivityRegistry::watchPostProcessEvent
void watchPostProcessEvent(PostProcessEvent::slot_type const &iSlot)
Definition: ActivityRegistry.h:459
edm::Run::getByLabel
bool getByLabel(std::string const &label, Handle< PROD > &result) const
Definition: Run.h:280
CmsShowMainBase::eiManager
FWEventItemsManager * eiManager()
Definition: CmsShowMainBase.h:57
FWFFService::m_appHelper
FWFFHelper m_appHelper
Definition: FWFFService.h:70
CSGAction::enable
void enable()
Definition: CSGAction.cc:269
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
event
Definition: event.py:1
CmsShowMainBase::getGeom
FWGeometry & getGeom()
Definition: CmsShowMainBase.h:92
FWFFService::checkPosition
void checkPosition() override
Definition: FWFFService.cc:195