CMS 3D CMS Logo

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

#include <FWFFLooper.h>

Inheritance diagram for FWFFLooper:
CmsShowMainBase edm::EDLooperBase edm::EDConsumerBase

Public Member Functions

void attachTo (edm::ActivityRegistry &) override
 Override this method if you need to monitor the state of the processing. More...
 
void autoLoadNewEvent () override
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 Called after all event modules have processed the begin of a Run. More...
 
void checkPosition () override
 
void display (const std::string &info="")
 
edm::EDLooperBase::Status duringLoop (const edm::Event &, const edm::EventSetup &, edm::ProcessingController &) override
 
edm::EDLooperBase::Status endOfLoop (const edm::EventSetup &, unsigned int) override
 
 FWFFLooper (const edm::ParameterSet &)
 
TEveMagField * getMagField ()
 
void postBeginJob ()
 
void postEndJob ()
 
void quit () override
 
void remakeGeometry (const DisplayGeomRecord &dgRec)
 
void requestChanges (const std::string &, const edm::ParameterSet &)
 
void setupFieldForPropagator (TEveTrackPropagator *prop)
 
void showPathsGUI (const TGWindow *p)
 
void startingNewLoop (unsigned int) override
 
void stopPlaying () override
 
 ~FWFFLooper () 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)
 
- Public Member Functions inherited from edm::EDLooperBase
void beginOfJob (EventSetupImpl const &)
 
virtual void beginOfJob (EventSetup const &)
 
virtual void beginOfJob ()
 
void copyInfo (ScheduleInfo const &)
 
void doBeginLuminosityBlock (LuminosityBlockPrincipal &, EventSetupImpl const &, ProcessContext *)
 
void doBeginRun (RunPrincipal &, EventSetupImpl const &, ProcessContext *)
 
Status doDuringLoop (EventPrincipal &eventPrincipal, EventSetupImpl const &es, ProcessingController &, StreamContext *)
 
void doEndLuminosityBlock (LuminosityBlockPrincipal &, EventSetupImpl const &, ProcessContext *)
 
Status doEndOfLoop (EventSetupImpl const &es)
 
void doEndRun (RunPrincipal &, EventSetupImpl const &, ProcessContext *)
 
void doStartingNewLoop ()
 
 EDLooperBase ()
 
 EDLooperBase (EDLooperBase const &)=delete
 
virtual void endOfJob ()
 
void esPrefetchAsync (WaitingTaskHolder iTask, EventSetupImpl const &iImpl, Transition iTrans, ServiceToken const &iToken) const
 
virtual std::set
< eventsetup::EventSetupRecordKey
modifyingRecords () const
 
EDLooperBaseoperator= (EDLooperBase const &)=delete
 
void prefetchAsync (WaitingTaskHolder iTask, ServiceToken const &token, Transition iTrans, Principal const &iPrincipal, EventSetupImpl const &iImpl) const
 
void prepareForNextLoop (eventsetup::EventSetupProvider *esp)
 
void setActionTable (ExceptionToActionTable const *actionTable)
 
void setModuleChanger (ModuleChanger *)
 
 ~EDLooperBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector
< ProductResolverIndexAndSkipBit >
const & 
itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef std::map< std::string,
edm::ParameterSet
ModuleChanges
 

Private Member Functions

 FWFFLooper (const FWFFLooper &)
 
void loadDefaultGeometryFile (void)
 
const FWFFLooperoperator= (const FWFFLooper &)
 

Private Attributes

bool m_AllowStep
 
edm::Service< FWFFHelperm_appHelper
 
bool m_autoReload
 
std::unique_ptr
< fireworks::Context
m_context
 
const edm::ESGetToken
< TGeoManager,
DisplayGeomRecord
m_displayGeomToken
 
TEveManager * m_EveManager
 
bool m_firstTime
 
edm::ESWatcher< DisplayGeomRecordm_geomWatcher
 
bool m_isFirstEvent
 
bool m_isLastEvent
 
TEveMagField * m_MagField
 
std::unique_ptr
< FWFFMetadataManager
m_metadataManager
 
std::unique_ptr< FWFFNavigatorm_navigator
 
edm::EventID m_nextEventId
 
FWPathsPopupm_pathsGUI
 
const edm::ESGetToken
< FWRecoGeometry,
FWRecoGeometryRecord
m_recoGeomToken
 
TRint * m_Rint
 
const edm::ESGetToken< RunInfo,
RunInfoRcd
m_runInfoToken
 
ModuleChanges m_scheduledChanges
 
bool m_ShowEvent
 

Additional Inherited Members

- Public Types inherited from edm::EDLooperBase
enum  Status { kContinue, kStop }
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from CmsShowMainBase
fireworks::Contextcontext ()
 
virtual void eventChangedImp ()
 
void eventChangedSlot ()
 
void sendVersionInfo ()
 
- Protected Member Functions inherited from edm::EDLooperBase
ModuleChangermoduleChanger ()
 This only returns a non-zero value during the call to endOfLoop. More...
 
ScheduleInfo const * scheduleInfo () const
 This returns a non-zero value after the constructor has been called. More...
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 48 of file FWFFLooper.h.

Member Typedef Documentation

typedef std::map<std::string, edm::ParameterSet> FWFFLooper::ModuleChanges
private

Definition at line 108 of file FWFFLooper.h.

Constructor & Destructor Documentation

FWFFLooper::FWFFLooper ( const edm::ParameterSet ps)

Definition at line 116 of file FWFFLooper.cc.

References CmsShowMainBase::eiManager(), CmsShowMainBase::geometryFilename(), edm::ParameterSet::getUntrackedParameter(), loadDefaultGeometryFile(), m_context, m_MagField, m_metadataManager, m_navigator, CmsShowMainBase::setConfigFilename(), FWEventItemsManager::setContext(), CmsShowMainBase::setGeometryFilename(), CmsShowMainBase::setup(), and AlCaHLTBitMon_QueryRunRegistry::string.

117  : CmsShowMainBase(),
118  m_navigator(new FWFFNavigator(*this)),
122  m_Rint(m_appHelper->app()),
123  m_AllowStep(true),
124  m_ShowEvent(true),
125  m_firstTime(true),
126  m_pathsGUI(nullptr),
131  setup(m_navigator.get(), m_context.get(), m_metadataManager.get());
132 
133  eiManager()->setContext(m_context.get());
134 
135  // By default, we look up geometry and configuration in the workarea, then
136  // in the release area then in the local directory. It is also possible to
137  // override those locations by using the displayConfigurationFilename and
138  // geometryFilename in the parameterset.
139  const char* releaseBase = std::getenv("CMSSW_RELEASE_BASE");
140  const char* workarea = std::getenv("CMSSW_BASE");
141  std::string displayConfigRelFilename = "/src/Fireworks/FWInterface/macros/ffw.fwc";
142  std::string geometryRelFilename = "/src/Fireworks/FWInterface/data/cmsGeom10.root";
143 
144  std::string displayConfigFilename = "ffw.fwc";
146 
147  if (releaseBase && access((releaseBase + displayConfigFilename).c_str(), R_OK) == 0)
148  displayConfigFilename = releaseBase + displayConfigRelFilename;
149  if (workarea && access((workarea + displayConfigRelFilename).c_str(), R_OK) == 0)
150  displayConfigFilename = workarea + displayConfigRelFilename;
151 
152  if (releaseBase && access((releaseBase + geometryRelFilename).c_str(), R_OK) == 0)
153  geometryFilename = releaseBase + geometryRelFilename;
154  if (workarea && access((workarea + geometryRelFilename).c_str(), R_OK) == 0)
155  geometryFilename = workarea + geometryRelFilename;
156 
157  displayConfigFilename = ps.getUntrackedParameter<std::string>("displayConfigFilename", displayConfigFilename);
158  geometryFilename = ps.getUntrackedParameter<std::string>("geometryFilename", geometryFilename);
159  if (!geometryFilename.empty()) {
161  }
162  setGeometryFilename(geometryFilename);
163  setConfigFilename(displayConfigFilename);
164 
165  if (!geometryFilename.empty()) {
167  }
168 
169  m_MagField = new CmsEveMagField();
170 }
edm::ESWatcher< DisplayGeomRecord > m_geomWatcher
Definition: FWFFLooper.h:115
T getUntrackedParameter(std::string const &, T const &) const
FWSelectionManager * selectionManager()
bool m_ShowEvent
Definition: FWFFLooper.h:104
const edm::ESGetToken< RunInfo, RunInfoRcd > m_runInfoToken
Definition: FWFFLooper.h:117
FWColorManager * colorManager()
FWEventItemsManager * eiManager()
FWPathsPopup * m_pathsGUI
Definition: FWFFLooper.h:106
TEveMagField * m_MagField
Definition: FWFFLooper.h:101
void setup(FWNavigatorBase *navigator, fireworks::Context *context, FWJobMetadataManager *metadataManager)
void remakeGeometry(const DisplayGeomRecord &dgRec)
Definition: FWFFLooper.cc:455
void setContext(fireworks::Context *)
void loadDefaultGeometryFile(void)
Definition: FWFFLooper.cc:172
FWModelChangeManager * changeManager()
void setGeometryFilename(const std::string &filename)
std::unique_ptr< FWFFMetadataManager > m_metadataManager
Definition: FWFFLooper.h:95
TRint * m_Rint
Definition: FWFFLooper.h:99
bool m_firstTime
Definition: FWFFLooper.h:105
TRint * app()
Definition: FWFFHelper.h:14
edm::Service< FWFFHelper > m_appHelper
Definition: FWFFLooper.h:93
std::unique_ptr< FWFFNavigator > m_navigator
Definition: FWFFLooper.h:94
const edm::ESGetToken< TGeoManager, DisplayGeomRecord > m_displayGeomToken
Definition: FWFFLooper.h:118
bool m_AllowStep
Definition: FWFFLooper.h:103
std::unique_ptr< fireworks::Context > m_context
Definition: FWFFLooper.h:96
const std::string & geometryFilename(void)
const edm::ESGetToken< FWRecoGeometry, FWRecoGeometryRecord > m_recoGeomToken
Definition: FWFFLooper.h:116
void setConfigFilename(const std::string &f)
FWFFLooper::~FWFFLooper ( )
override

Definition at line 186 of file FWFFLooper.cc.

References m_MagField.

186 { delete m_MagField; }
TEveMagField * m_MagField
Definition: FWFFLooper.h:101
FWFFLooper::FWFFLooper ( const FWFFLooper )
private

Member Function Documentation

void FWFFLooper::attachTo ( edm::ActivityRegistry )
overridevirtual

Override this method if you need to monitor the state of the processing.

Reimplemented from edm::EDLooperBase.

Definition at line 178 of file FWFFLooper.cc.

References CmsShowMainBase::guiManager(), m_pathsGUI, postEndJob(), FWPathsPopup::postModuleEvent(), FWPathsPopup::preModuleEvent(), edm::ActivityRegistry::watchPostEndJob(), edm::ActivityRegistry::watchPostModuleEvent(), and edm::ActivityRegistry::watchPreModuleEvent().

178  {
179  m_pathsGUI = new FWPathsPopup(this, guiManager());
180 
181  ar.watchPostModuleEvent(m_pathsGUI, &FWPathsPopup::postModuleEvent);
182  ar.watchPreModuleEvent(m_pathsGUI, &FWPathsPopup::preModuleEvent);
183  ar.watchPostEndJob(this, &FWFFLooper::postEndJob);
184 }
void preModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &)
FWGUIManager * guiManager()
FWPathsPopup * m_pathsGUI
Definition: FWFFLooper.h:106
void postEndJob()
Definition: FWFFLooper.cc:213
void postModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &)
void FWFFLooper::autoLoadNewEvent ( )
overridevirtual

This actually needs to be different from the standalone case because nextEvent() / previousEvent() will immediately interrupt the GUI event loop and fall back to the looper.

Implements CmsShowMainBase.

Definition at line 240 of file FWFFLooper.cc.

References FWGUIManager::enableActions(), CmsShowMainFrame::enableComplexNavigation(), CmsShowMainBase::forward(), FWGUIManager::getMainFrame(), CmsShowMainBase::guiManager(), CmsShowMainBase::loop(), m_autoReload, m_isFirstEvent, m_isLastEvent, m_navigator, CmsShowMainBase::stopAutoLoadTimer(), and CmsShowMainBase::stopPlaying().

240  {
242  bool reachedEnd = (forward() && m_isLastEvent) || (!forward() && m_isFirstEvent);
243 
244  if (!reachedEnd || loop()) {
245  // Will exit the loop here!
246  m_autoReload = true;
247  forward() ? m_navigator->nextEvent() : m_navigator->previousEvent();
248  } else {
249  m_autoReload = false;
253  }
254 }
bool m_isLastEvent
Definition: FWFFLooper.h:113
FWGUIManager * guiManager()
void enableActions(bool enable=true)
virtual void stopPlaying()
bool loop() const
bool m_autoReload
Definition: FWFFLooper.h:111
CmsShowMainFrame * getMainFrame() const
Definition: FWGUIManager.h:197
bool m_isFirstEvent
Definition: FWFFLooper.h:112
std::unique_ptr< FWFFNavigator > m_navigator
Definition: FWFFLooper.h:94
bool forward() const
void enableComplexNavigation(bool enable=true)
void FWFFLooper::beginRun ( const edm::Run ,
const edm::EventSetup  
)
overridevirtual

Called after all event modules have processed the begin of a Run.

Reimplemented from edm::EDLooperBase.

Definition at line 267 of file FWFFLooper.cc.

References edm::ESWatcher< T >::check(), CmsShowMainBase::context(), cppFunctionSkipper::exception, FWGUIManager::filterButtonClicked_, edm::EventSetup::find(), fwLog, edm::Run::getByLabel(), edm::EventSetup::getData(), fireworks::Context::getField(), CmsShowMainBase::getGeom(), CmsShowMainBase::guiManager(), FWGeometry::initMap(), edm::HandleBase::isValid(), fwlog::kInfo, CmsShowMainBase::loadGeometry(), m_autoReload, RunInfo::m_avg_current, m_context, m_firstTime, m_geomWatcher, m_MagField, m_recoGeomToken, m_runInfoToken, gpuVertexFinder::printf(), FWMagField::setFFFieldMag(), FWGUIManager::setFilterButtonText(), CmsShowMainBase::setGeometryFilename(), CmsShowMainBase::setupActions(), CmsShowMainBase::setupConfiguration(), CmsShowMainBase::setupViewManagers(), FWGUIManager::showEventFilterGUI(), FWGUIManager::showEventFilterGUI_, showPathsGUI(), and FWGUIManager::updateStatus().

267  {
268  // Check DisplayGeomRecord changes.
269  try {
270  m_geomWatcher.check(iSetup);
271  } catch (...) {
272  }
273 
274  // If the geometry was not picked up from a file, we try to get it from the
275  // EventSetup!
276  // FIXME: we need to check we execute only once because the view managers
277  // depend on geometry and they cannot be initialised more than once.
278  // This should actually be cleaned up so that the various view manager
279  // don't care about geometry.
280  // FIXME: we should actually be able to update the geometry when requested.
281  // this is not possible at the moment.
282  if (m_firstTime == true) {
283  if (m_context->getGeom() == nullptr) {
284  try {
285  guiManager()->updateStatus("Loading geometry...");
286  getGeom().initMap(iSetup.getData(m_recoGeomToken).idToName);
287  m_context->setGeom(&(getGeom()));
288  } catch (const cms::Exception& exception) {
289  setGeometryFilename("cmsGeom10.root");
291  }
292  }
293 
296  setupActions();
297 
298  guiManager()->showEventFilterGUI_.connect(std::bind(&FWFFLooper::showPathsGUI, this, std::placeholders::_1));
299  guiManager()->setFilterButtonText("Show paths / CMSSW configuration editor");
301 
302  m_firstTime = false;
303  m_autoReload = false;
304  }
305 
306  float current = 18160.0f;
307  try {
309  // bool res = iRun.getByType(runCond);
310  bool res = iRun.getByLabel("conditionsInEdm", runCond);
311  if (res && runCond.isValid()) {
312  printf("Got current from conds in edm %f\n", runCond->BAvgCurrent);
313  current = runCond->BAvgCurrent;
314  } else {
315  printf("Could not extract run-conditions get-result=%d, is-valid=%d\n", res, runCond.isValid());
316 
317  auto rec = iSetup.find(edm::eventsetup::EventSetupRecordKey::makeKey<RunInfoRcd>());
318  if (rec) {
319  RunInfo const& sum = iSetup.getData(m_runInfoToken);
320 
321  current = sum.m_avg_current;
322  printf("Got current from RunInfoRcd %f\n", sum.m_avg_current);
323  }
324  }
325  } catch (...) {
326  fwLog(fwlog::kInfo) << "ConditionsInRunBlock not available\n";
327  }
328  static_cast<CmsEveMagField*>(m_MagField)->SetFieldByCurrent(current);
329  context()->getField()->setFFFieldMag(m_MagField->GetMaxFieldMag());
330 }
edm::ESWatcher< DisplayGeomRecord > m_geomWatcher
Definition: FWFFLooper.h:115
const edm::ESGetToken< RunInfo, RunInfoRcd > m_runInfoToken
Definition: FWFFLooper.h:117
FWGUIManager * guiManager()
void initMap(const FWRecoGeom::InfoMap &map)
Definition: FWGeometry.cc:203
TEveMagField * m_MagField
Definition: FWFFLooper.h:101
void updateStatus(const char *status)
void setGeometryFilename(const std::string &filename)
void setFFFieldMag(float)
Definition: FWMagField.cc:190
FWMagField * getField() const
Definition: Context.h:66
bool m_autoReload
Definition: FWFFLooper.h:111
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
fireworks::Context * context()
bool m_firstTime
Definition: FWFFLooper.h:105
bool isValid() const
Definition: HandleBase.h:70
#define fwLog(_level_)
Definition: fwLog.h:45
void setFilterButtonText(const char *txt)
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
float m_avg_current
Definition: RunInfo.h:28
FWGeometry & getGeom()
void showEventFilterGUI()
std::unique_ptr< fireworks::Context > m_context
Definition: FWFFLooper.h:96
void showPathsGUI(const TGWindow *p)
Definition: FWFFLooper.cc:437
sigc::signal< void()> filterButtonClicked_
Definition: FWGUIManager.h:203
sigc::signal< void(const TGWindow *)> showEventFilterGUI_
Definition: FWGUIManager.h:204
const edm::ESGetToken< FWRecoGeometry, FWRecoGeometryRecord > m_recoGeomToken
Definition: FWFFLooper.h:116
void FWFFLooper::checkPosition ( )
overridevirtual

Implements CmsShowMainBase.

Definition at line 218 of file FWFFLooper.cc.

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

Referenced by duringLoop(), and stopPlaying().

218  {
219  if (loop() && isPlaying())
220  return;
221 
224 
225  if (m_isFirstEvent)
227 
228  if (m_isLastEvent) {
229  guiManager()->disableNext();
230  // force enable play events action in --port mode
231  if (!guiManager()->playEventsAction()->isEnabled())
233  }
234 }
bool m_isLastEvent
Definition: FWFFLooper.h:113
FWGUIManager * guiManager()
void enable()
Definition: CSGAction.cc:269
bool loop() const
CmsShowMainFrame * getMainFrame() const
Definition: FWGUIManager.h:197
void disablePrevious()
bool m_isFirstEvent
Definition: FWFFLooper.h:112
CSGContinuousAction * playEventsAction()
bool isPlaying() const
void enableComplexNavigation(bool enable=true)
void disableNext()
void FWFFLooper::display ( const std::string &  info = "")

Definition at line 390 of file FWFFLooper.cc.

References m_AllowStep, and m_Rint.

390  {
391  // Display whatever was registered so far, wait until user presses
392  // the "Step" button.
393 
394  if (m_AllowStep) {
395  gEve->Redraw3D();
396  m_Rint->Run(kTRUE);
397  }
398 }
TRint * m_Rint
Definition: FWFFLooper.h:99
bool m_AllowStep
Definition: FWFFLooper.h:103
edm::EDLooperBase::Status FWFFLooper::duringLoop ( const edm::Event ,
const edm::EventSetup ,
edm::ProcessingController  
)
overridevirtual

Called after all event modules have had a chance to process the Event.

Implements edm::EDLooperBase.

Definition at line 333 of file FWFFLooper.cc.

References edm::ESWatcher< T >::check(), checkPosition(), CmsShowMainBase::draw(), edm::ProcessingController::forwardState(), FWPathsPopup::hasChanges(), edm::ProcessingController::kAtFirstEvent, edm::ProcessingController::kAtLastEvent, edm::EDLooperBase::kContinue, FWFFNavigator::kFirstEvent, FWFFNavigator::kLastEvent, FWFFNavigator::kNextEvent, FWFFNavigator::kPreviousEvent, edm::EDLooperBase::kStop, m_autoReload, m_geomWatcher, m_isFirstEvent, m_isLastEvent, m_metadataManager, m_navigator, m_nextEventId, m_pathsGUI, m_Rint, FWPathsPopup::postEvent(), edm::ProcessingController::reverseState(), edm::ProcessingController::setTransitionToEvent(), edm::ProcessingController::setTransitionToNextEvent(), edm::ProcessingController::setTransitionToPreviousEvent(), and CmsShowMainBase::startAutoLoadTimer().

335  {
336  // Check DisplayGeomRecord changes.
337  try {
338  m_geomWatcher.check(es);
339  } catch (...) {
340  }
341 
343 
344  m_isLastEvent = controller.forwardState() == edm::ProcessingController::kAtLastEvent;
345  m_isFirstEvent = controller.reverseState() == edm::ProcessingController::kAtFirstEvent;
346  // If the next event id is valid, set the transition so
347  // that we go to it go to to it.
348  if (m_nextEventId != edm::EventID()) {
349  controller.setTransitionToEvent(m_nextEventId);
351  return kContinue;
352  }
353  // We handle "last event" by going to the first event and then moving to the
354  // previous event.
355  if (m_navigator->currentTransition() == FWFFNavigator::kLastEvent) {
356  m_navigator->resetTransition();
357  controller.setTransitionToPreviousEvent();
358  return kContinue;
359  }
360 
361  m_pathsGUI->hasChanges() = false;
363  m_navigator->setCurrentEvent(&event);
364  if (m_autoReload == true)
366 
367  checkPosition();
368  draw();
369 
370  m_Rint->Run(kTRUE);
371  // If the GUI changed the PSet, save the current event to reload
372  // it on next iteration.
373  if (m_pathsGUI->hasChanges()) {
375  return kStop;
376  } else if (m_navigator->currentTransition() == FWFFNavigator::kFirstEvent) {
377  m_nextEventId = m_navigator->getFirstEventID();
378  return kStop;
379  } else if (m_navigator->currentTransition() == FWFFNavigator::kLastEvent) {
380  m_nextEventId = m_navigator->getFirstEventID();
381  return kStop;
382  } else if (m_navigator->currentTransition() == FWFFNavigator::kNextEvent)
383  controller.setTransitionToNextEvent();
384  else if (m_navigator->currentTransition() == FWFFNavigator::kPreviousEvent)
385  controller.setTransitionToPreviousEvent();
386  return kContinue;
387 }
edm::ESWatcher< DisplayGeomRecord > m_geomWatcher
Definition: FWFFLooper.h:115
bool m_isLastEvent
Definition: FWFFLooper.h:113
FWPathsPopup * m_pathsGUI
Definition: FWFFLooper.h:106
bool m_autoReload
Definition: FWFFLooper.h:111
std::unique_ptr< FWFFMetadataManager > m_metadataManager
Definition: FWFFLooper.h:95
bool & hasChanges()
Definition: FWPathsPopup.h:35
TRint * m_Rint
Definition: FWFFLooper.h:99
bool m_isFirstEvent
Definition: FWFFLooper.h:112
void checkPosition() override
Definition: FWFFLooper.cc:218
std::unique_ptr< FWFFNavigator > m_navigator
Definition: FWFFLooper.h:94
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
void postEvent(edm::Event const &event)
edm::EventID m_nextEventId
Definition: FWFFLooper.h:110
edm::EDLooperBase::Status FWFFLooper::endOfLoop ( const edm::EventSetup ,
unsigned int   
)
overridevirtual

This is called at the end of looping. We always continue because we want the transition set in the ProcessingController to happen.

Implements edm::EDLooperBase.

Definition at line 423 of file FWFFLooper.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, edm::ModuleChanger::changeModule(), alignCSCRings::e, fwLog, mps_fire::i, edm::EDLooperBase::kContinue, fwlog::kError, m_scheduledChanges, edm::EDLooperBase::moduleChanger(), and cms::Exception::what().

423  {
424  // Looks like the module changer is availble only here.
425  for (ModuleChanges::iterator i = m_scheduledChanges.begin(), e = m_scheduledChanges.end(); i != e; ++i) {
426  try {
427  moduleChanger()->changeModule(i->first, i->second);
428  } catch (cms::Exception const& e) {
429  fwLog(fwlog::kError) << "FWFFLooper::endOfLoop caught exception.\n";
430  std::cerr << e.what() << std::endl;
431  }
432  }
433  m_scheduledChanges.clear();
434  return kContinue;
435 }
ModuleChanges m_scheduledChanges
Definition: FWFFLooper.h:109
char const * what() const noexceptoverride
Definition: Exception.cc:103
bool changeModule(const std::string &iLabel, const ParameterSet &iPSet)
#define fwLog(_level_)
Definition: fwLog.h:45
ModuleChanger * moduleChanger()
This only returns a non-zero value during the call to endOfLoop.
TEveMagField * FWFFLooper::getMagField ( )

Definition at line 404 of file FWFFLooper.cc.

References m_MagField.

404 { return m_MagField; }
TEveMagField * m_MagField
Definition: FWFFLooper.h:101
void FWFFLooper::loadDefaultGeometryFile ( void  )
private

Definition at line 172 of file FWFFLooper.cc.

References CmsShowTaskExecutor::addTask(), validate-o2o-wbm::f, CmsShowMainBase::loadGeometry(), and CmsShowMainBase::startupTasks().

Referenced by FWFFLooper().

172  {
174  f = std::bind(&CmsShowMainBase::loadGeometry, this);
175  startupTasks()->addTask(f);
176 }
std::function< void()> TaskFunctor
CmsShowTaskExecutor * startupTasks()
void addTask(const TaskFunctor &iTask)
const FWFFLooper& FWFFLooper::operator= ( const FWFFLooper )
private
void FWFFLooper::postBeginJob ( )
void FWFFLooper::postEndJob ( )

Definition at line 213 of file FWFFLooper.cc.

References gpuVertexFinder::printf().

Referenced by attachTo().

213  {
214  printf("FWFFLooper::postEndJob\n");
215  TEveManager::Terminate();
216 }
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
void FWFFLooper::quit ( )
overridevirtual

Implements CmsShowMainBase.

Definition at line 408 of file FWFFLooper.cc.

408  {
409  gSystem->ExitLoop();
410 
411  // Throwing exception here is bad because:
412  // a) it does not work when in a "debug step";
413  // b) does not restore terminal state.
414  // So we do exit instead for now.
415  // throw cms::Exception("UserTerminationRequest");
416  gSystem->Exit(0);
417 }
void FWFFLooper::remakeGeometry ( const DisplayGeomRecord dgRec)

Definition at line 455 of file FWFFLooper.cc.

References fwLog, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), fwlog::kInfo, m_displayGeomToken, and FWGeometryTableViewManager::setGeoManagerRuntime().

455  {
456  fwLog(fwlog::kInfo) << "FWFFLooper set TGeo geometry from DisplayGeomRecord.\n";
457 
458  TEveGeoManagerHolder _tgeo(const_cast<TGeoManager*>(&dgRec.get(m_displayGeomToken)));
460 }
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
const edm::ESGetToken< TGeoManager, DisplayGeomRecord > m_displayGeomToken
Definition: FWFFLooper.h:118
#define fwLog(_level_)
Definition: fwLog.h:45
static void setGeoManagerRuntime(TGeoManager *)
void FWFFLooper::requestChanges ( const std::string &  moduleLabel,
const edm::ParameterSet ps 
)

Definition at line 449 of file FWFFLooper.cc.

References m_scheduledChanges.

Referenced by FWPathsPopup::scheduleReloadEvent().

449  {
450  m_scheduledChanges[moduleLabel] = ps;
451 }
ModuleChanges m_scheduledChanges
Definition: FWFFLooper.h:109
void FWFFLooper::setupFieldForPropagator ( TEveTrackPropagator *  prop)

Definition at line 406 of file FWFFLooper.cc.

References m_MagField.

406 { prop->SetMagFieldObj(m_MagField, kFALSE); }
TEveMagField * m_MagField
Definition: FWFFLooper.h:101
void FWFFLooper::showPathsGUI ( const TGWindow *  p)

Definition at line 437 of file FWFFLooper.cc.

References CmsShowMainBase::guiManager(), m_pathsGUI, and FWGUIManager::setFilterButtonText().

Referenced by beginRun().

437  {
438  if (!m_pathsGUI)
439  return;
440  if (m_pathsGUI->IsMapped()) {
441  guiManager()->setFilterButtonText("Show paths / CMSSW configuration editor");
442  m_pathsGUI->UnmapWindow();
443  } else {
444  guiManager()->setFilterButtonText("Hide paths / CMSSW configuration editor");
445  m_pathsGUI->MapWindow();
446  }
447 }
FWGUIManager * guiManager()
FWPathsPopup * m_pathsGUI
Definition: FWFFLooper.h:106
void setFilterButtonText(const char *txt)
void FWFFLooper::startingNewLoop ( unsigned  int)
overridevirtual

Called before system starts to loop over the events. The argument is a count of how many loops have been processed. For the first time through the events the argument will be 0.

Implements edm::EDLooperBase.

Definition at line 192 of file FWFFLooper.cc.

References CmsShowTaskExecutor::addTask(), cms::cuda::assert(), validate-o2o-wbm::f, info(), m_pathsGUI, m_Rint, edm::EDLooperBase::scheduleInfo(), FWPathsPopup::setup(), CmsShowTaskExecutor::startDoingTasks(), and CmsShowMainBase::startupTasks().

192  {
193  // Initialise on first loop.
194  if (count == 0) {
196  m_pathsGUI->setup(info);
197 
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 = std::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  }
211 }
static const TGPicture * info(bool iBackgroundIsBlack)
void startDoingTasks() override
std::function< void()> TaskFunctor
FWPathsPopup * m_pathsGUI
Definition: FWFFLooper.h:106
assert(be >=bs)
CmsShowTaskExecutor * startupTasks()
TRint * m_Rint
Definition: FWFFLooper.h:99
ScheduleInfo const * scheduleInfo() const
This returns a non-zero value after the constructor has been called.
void addTask(const TaskFunctor &iTask)
void setup(const edm::ScheduleInfo *info)
void FWFFLooper::stopPlaying ( )
overridevirtual

Reimplemented from CmsShowMainBase.

Definition at line 256 of file FWFFLooper.cc.

References checkPosition(), FWGUIManager::enableActions(), CmsShowMainFrame::enableComplexNavigation(), FWGUIManager::getMainFrame(), CmsShowMainBase::guiManager(), m_autoReload, CmsShowMainBase::stopAutoLoadTimer(), and CmsShowMainBase::stopPlaying().

256  {
258  m_autoReload = false;
262  checkPosition();
263 }
FWGUIManager * guiManager()
void enableActions(bool enable=true)
virtual void stopPlaying()
bool m_autoReload
Definition: FWFFLooper.h:111
CmsShowMainFrame * getMainFrame() const
Definition: FWGUIManager.h:197
void checkPosition() override
Definition: FWFFLooper.cc:218
void enableComplexNavigation(bool enable=true)

Member Data Documentation

bool FWFFLooper::m_AllowStep
private

Definition at line 103 of file FWFFLooper.h.

Referenced by display().

edm::Service<FWFFHelper> FWFFLooper::m_appHelper
private

Definition at line 93 of file FWFFLooper.h.

bool FWFFLooper::m_autoReload
private

Definition at line 111 of file FWFFLooper.h.

Referenced by autoLoadNewEvent(), beginRun(), duringLoop(), and stopPlaying().

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

Definition at line 96 of file FWFFLooper.h.

Referenced by beginRun(), and FWFFLooper().

const edm::ESGetToken<TGeoManager, DisplayGeomRecord> FWFFLooper::m_displayGeomToken
private

Definition at line 118 of file FWFFLooper.h.

Referenced by remakeGeometry().

TEveManager* FWFFLooper::m_EveManager
private

Definition at line 98 of file FWFFLooper.h.

bool FWFFLooper::m_firstTime
private

Definition at line 105 of file FWFFLooper.h.

Referenced by beginRun().

edm::ESWatcher<DisplayGeomRecord> FWFFLooper::m_geomWatcher
private

Definition at line 115 of file FWFFLooper.h.

Referenced by beginRun(), and duringLoop().

bool FWFFLooper::m_isFirstEvent
private

Definition at line 112 of file FWFFLooper.h.

Referenced by autoLoadNewEvent(), checkPosition(), and duringLoop().

bool FWFFLooper::m_isLastEvent
private

Definition at line 113 of file FWFFLooper.h.

Referenced by autoLoadNewEvent(), checkPosition(), and duringLoop().

TEveMagField* FWFFLooper::m_MagField
private

Definition at line 101 of file FWFFLooper.h.

Referenced by beginRun(), FWFFLooper(), getMagField(), setupFieldForPropagator(), and ~FWFFLooper().

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

Definition at line 95 of file FWFFLooper.h.

Referenced by duringLoop(), and FWFFLooper().

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

Definition at line 94 of file FWFFLooper.h.

Referenced by autoLoadNewEvent(), duringLoop(), and FWFFLooper().

edm::EventID FWFFLooper::m_nextEventId
private

Definition at line 110 of file FWFFLooper.h.

Referenced by duringLoop().

FWPathsPopup* FWFFLooper::m_pathsGUI
private

Definition at line 106 of file FWFFLooper.h.

Referenced by attachTo(), duringLoop(), showPathsGUI(), and startingNewLoop().

const edm::ESGetToken<FWRecoGeometry, FWRecoGeometryRecord> FWFFLooper::m_recoGeomToken
private

Definition at line 116 of file FWFFLooper.h.

Referenced by beginRun().

TRint* FWFFLooper::m_Rint
private

Definition at line 99 of file FWFFLooper.h.

Referenced by display(), duringLoop(), and startingNewLoop().

const edm::ESGetToken<RunInfo, RunInfoRcd> FWFFLooper::m_runInfoToken
private

Definition at line 117 of file FWFFLooper.h.

Referenced by beginRun().

ModuleChanges FWFFLooper::m_scheduledChanges
private

Definition at line 109 of file FWFFLooper.h.

Referenced by endOfLoop(), and requestChanges().

bool FWFFLooper::m_ShowEvent
private

Definition at line 104 of file FWFFLooper.h.