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

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

Definition at line 163 of file FWFFService.cc.

163  {
164  printf("FWFFService::~FWFFService DTOR\n");
165 
166  delete m_MagField;
167 }
TEveMagField * m_MagField
Definition: FWFFService.h:74
FWFFService::FWFFService ( const FWFFService )
privatedelete

Member Function Documentation

void FWFFService::autoLoadNewEvent ( )
inlineoverridevirtual

Implements CmsShowMainBase.

Definition at line 56 of file FWFFService.h.

56 {}
void FWFFService::checkPosition ( )
overridevirtual

Implements CmsShowMainBase.

Definition at line 195 of file FWFFService.cc.

References heppy_loop::loop.

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 }
FWGUIManager * guiManager()
void enable()
Definition: CSGAction.cc:268
std::unique_ptr< FWFFNavigator > m_navigator
Definition: FWFFService.h:66
bool loop() const
CmsShowMainFrame * getMainFrame() const
Definition: FWGUIManager.h:196
void disablePrevious()
CSGContinuousAction * playEventsAction()
bool isPlaying() const
void disableNext()
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 }
TRint * m_Rint
Definition: FWFFService.h:72
bool m_AllowStep
Definition: FWFFService.h:76
TEveMagField * FWFFService::getMagField ( )

Definition at line 285 of file FWFFService.cc.

285 { return m_MagField; }
TEveMagField * m_MagField
Definition: FWFFService.h:74
const FWFFService& FWFFService::operator= ( const FWFFService )
privatedelete
void FWFFService::postBeginJob ( )

Definition at line 173 of file FWFFService.cc.

References f.

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 }
TRint * m_Rint
Definition: FWFFService.h:72
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 213 of file FWFFService.cc.

References edm::ConditionsInRunBlock::BAvgCurrent, edm::EventSetup::get(), edm::Run::getByLabel(), FWRecoGeometry::idToName, edm::HandleBase::isValid(), and edm::ESTransientHandle< T >::product().

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 }
bool getByLabel(std::string const &label, Handle< PROD > &result) const
Definition: Run.h:280
FWGUIManager * guiManager()
void initMap(const FWRecoGeom::InfoMap &map)
Definition: FWGeometry.cc:199
void updateStatus(const char *status)
Definition: Electron.h:6
std::unique_ptr< fireworks::Context > m_context
Definition: FWFFService.h:68
FWRecoGeom::InfoMap idToName
bool isValid() const
Definition: HandleBase.h:70
TEveMagField * m_MagField
Definition: FWFFService.h:74
T const * product() const
FWGeometry & getGeom()
T get() const
Definition: EventSetup.h:73
bool m_firstTime
Definition: FWFFService.h:78
void FWFFService::postEndJob ( )

Definition at line 189 of file FWFFService.cc.

189  {
190  printf("FWFFService::postEndJob\n");
191 
192  TEveManager::Terminate();
193 }
void FWFFService::postProcessEvent ( const edm::Event event,
const edm::EventSetup es 
)

Definition at line 259 of file FWFFService.cc.

References ntuplePlotting::draw().

259  {
260  printf("FWFFService::postProcessEvent: Starting GUI loop.\n");
261 
262  m_metadataManager->update(new FWFFMetadataUpdateRequest(event));
263  m_navigator->setCurrentEvent(&event);
264  checkPosition();
265  draw();
266  m_Rint->Run(kTRUE);
267 }
TRint * m_Rint
Definition: FWFFService.h:72
std::unique_ptr< FWFFMetadataManager > m_metadataManager
Definition: FWFFService.h:67
std::unique_ptr< FWFFNavigator > m_navigator
Definition: FWFFService.h:66
void checkPosition() override
Definition: FWFFService.cc:195
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 }
void FWFFService::setupFieldForPropagator ( TEveTrackPropagator *  prop)

Definition at line 287 of file FWFFService.cc.

287 { prop->SetMagFieldObj(m_MagField, kFALSE); }
TEveMagField * m_MagField
Definition: FWFFService.h:74
void FWFFService::stopPlaying ( )
inlineoverridevirtual

Reimplemented from CmsShowMainBase.

Definition at line 55 of file FWFFService.h.

55 {}

Member Data Documentation

bool FWFFService::m_AllowStep
private

Definition at line 76 of file FWFFService.h.

FWFFHelper FWFFService::m_appHelper
private

Definition at line 70 of file FWFFService.h.

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

Definition at line 68 of file FWFFService.h.

TEveManager* FWFFService::m_EveManager
private

Definition at line 71 of file FWFFService.h.

bool FWFFService::m_firstTime
private

Definition at line 78 of file FWFFService.h.

TEveMagField* FWFFService::m_MagField
private

Definition at line 74 of file FWFFService.h.

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

Definition at line 67 of file FWFFService.h.

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

Definition at line 66 of file FWFFService.h.

TRint* FWFFService::m_Rint
private

Definition at line 72 of file FWFFService.h.

bool FWFFService::m_ShowEvent
private

Definition at line 77 of file FWFFService.h.