#include <FWFFLooper.h>
Definition at line 44 of file FWFFLooper.h.
typedef std::map<std::string, edm::ParameterSet> FWFFLooper::ModuleChanges [private] |
Definition at line 105 of file FWFFLooper.h.
FWFFLooper::FWFFLooper | ( | const edm::ParameterSet & | ps | ) |
Definition at line 123 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(), and CmsShowMainBase::setup().
: CmsShowMainBase(), m_navigator(new FWFFNavigator(*this)), m_metadataManager(new FWFFMetadataManager()), m_context(new fireworks::Context(changeManager(), selectionManager(), eiManager(), colorManager(), m_metadataManager.get())), m_Rint(m_appHelper->app()), m_AllowStep(true), m_ShowEvent(true), m_firstTime(true), m_pathsGUI(0), m_geomWatcher(this, &FWFFLooper::remakeGeometry) { setup(m_navigator.get(), m_context.get(), m_metadataManager.get()); eiManager()->setContext(m_context.get()); // By default, we look up geometry and configuration in the workarea, then // in the release area then in the local directory. It is also possible to // override those locations by using the displayConfigurationFilename and // geometryFilename in the parameterset. const char *releaseBase = getenv("CMSSW_RELEASE_BASE"); const char *workarea = getenv("CMSSW_BASE"); std::string displayConfigRelFilename = "/src/Fireworks/FWInterface/macros/ffw.fwc"; std::string geometryRelFilename = "/src/Fireworks/FWInterface/data/cmsGeom10.root"; std::string displayConfigFilename = "ffw.fwc"; std::string geometryFilename; if (releaseBase && access((releaseBase + displayConfigFilename).c_str(), R_OK) == 0) displayConfigFilename = releaseBase + displayConfigRelFilename; if (workarea && access((workarea + displayConfigRelFilename).c_str(), R_OK) == 0) displayConfigFilename = workarea + displayConfigRelFilename; if (releaseBase && access((releaseBase + geometryRelFilename).c_str(), R_OK) == 0) geometryFilename = releaseBase + geometryRelFilename; if (workarea && access((workarea + geometryRelFilename).c_str(), R_OK) == 0) geometryFilename = workarea + geometryRelFilename; displayConfigFilename = ps.getUntrackedParameter<std::string>("displayConfigFilename", displayConfigFilename); geometryFilename = ps.getUntrackedParameter<std::string>("geometryFilename", geometryFilename); setGeometryFilename(geometryFilename); setConfigFilename(displayConfigFilename); if( !geometryFilename.empty()) { loadDefaultGeometryFile(); } m_MagField = new CmsEveMagField(); }
FWFFLooper::~FWFFLooper | ( | ) | [virtual] |
FWFFLooper::FWFFLooper | ( | const FWFFLooper & | ) | [private] |
void FWFFLooper::attachTo | ( | edm::ActivityRegistry & | ) | [virtual] |
Override this method if you need to monitor the state of the processing.
Reimplemented from edm::EDLooperBase.
Definition at line 188 of file FWFFLooper.cc.
References CmsShowMainBase::guiManager(), m_pathsGUI, postEndJob(), FWPathsPopup::postModule(), FWPathsPopup::postProcessEvent(), FWPathsPopup::preModule(), edm::ActivityRegistry::watchPostEndJob(), edm::ActivityRegistry::watchPostModule(), edm::ActivityRegistry::watchPostProcessEvent(), and edm::ActivityRegistry::watchPreModule().
{ m_pathsGUI = new FWPathsPopup(this, guiManager()); ar.watchPostProcessEvent(m_pathsGUI, &FWPathsPopup::postProcessEvent); ar.watchPostModule(m_pathsGUI, &FWPathsPopup::postModule); ar.watchPreModule(m_pathsGUI, &FWPathsPopup::preModule); ar.watchPostEndJob(this, &FWFFLooper::postEndJob); }
void FWFFLooper::autoLoadNewEvent | ( | ) | [virtual] |
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 265 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::setIsPlaying(), and CmsShowMainBase::stopAutoLoadTimer().
{ stopAutoLoadTimer(); bool reachedEnd = (forward() && m_isLastEvent) || (!forward() && m_isFirstEvent); if (!reachedEnd || loop()) { // Will exit the loop here! m_autoReload = true; forward() ? m_navigator->nextEvent() : m_navigator->previousEvent(); } else { m_autoReload = false; setIsPlaying(false); guiManager()->enableActions(); guiManager()->getMainFrame()->enableComplexNavigation(false); } }
void FWFFLooper::beginRun | ( | const edm::Run & | , |
const edm::EventSetup & | |||
) | [virtual] |
Called after all event modules have processed the begin of a Run.
Reimplemented from edm::EDLooperBase.
Definition at line 300 of file FWFFLooper.cc.
References edm::ESWatcher< T >::check(), cond::rpcobimon::current, exception, FWGUIManager::filterButtonClicked_, edm::EventSetup::find(), fwLog, edm::EventSetup::get(), edm::Run::getByType(), CmsShowMainBase::getGeom(), CmsShowMainBase::guiManager(), FWGeometry::initMap(), edm::HandleBase::isValid(), fwlog::kInfo, CmsShowMainBase::loadGeometry(), m_autoReload, m_context, m_firstTime, m_geomWatcher, m_MagField, edm::ESHandle< T >::product(), FWGUIManager::setFilterButtonText(), CmsShowMainBase::setGeometryFilename(), CmsShowMainBase::setupActions(), CmsShowMainBase::setupConfiguration(), CmsShowMainBase::setupViewManagers(), FWGUIManager::showEventFilterGUI(), FWGUIManager::showEventFilterGUI_, showPathsGUI(), and FWGUIManager::updateStatus().
{ // Check DisplayGeomRecord changes. try { m_geomWatcher.check(iSetup); } catch (...) {} // If the geometry was not picked up from a file, we try to get it from the // EventSetup! // FIXME: we need to check we execute only once because the view managers // depend on geometry and they cannot be initialised more than once. // This should actually be cleaned up so that the various view manager // don't care about geometry. // FIXME: we should actually be able to update the geometry when requested. // this is not possible at the moment. if (m_firstTime == true) { if (m_context->getGeom() == 0) { try { guiManager()->updateStatus("Loading geometry..."); edm::ESHandle<FWRecoGeometry> geoh; iSetup.get<FWRecoGeometryRecord>().get(geoh); getGeom().initMap(geoh.product()->idToName); m_context->setGeom(&(getGeom())); } catch( const cms::Exception& exception ) { setGeometryFilename("cmsGeom10.root"); CmsShowMainBase::loadGeometry(); } } setupViewManagers(); setupConfiguration(); setupActions(); guiManager()->showEventFilterGUI_.connect(boost::bind(&FWFFLooper::showPathsGUI, this, _1)); guiManager()->setFilterButtonText("Show paths / CMSSW configuration editor"); guiManager()->filterButtonClicked_.connect(boost::bind(&FWGUIManager::showEventFilterGUI, guiManager())); m_firstTime = false; m_autoReload = false; } float current = 18160.0f; try { edm::Handle<edm::ConditionsInRunBlock> runCond; bool res = iRun.getByType(runCond); //bool res = run.getByLabel("conditionsInEdm", runCond, "", ""); if (res && runCond.isValid()) { printf("Got current from conds in edm %f\n", runCond->BAvgCurrent); current = runCond->BAvgCurrent; } else { printf("Could not extract run-conditions get-result=%d, is-valid=%d\n", res, runCond.isValid()); const edm::eventsetup::EventSetupRecord* rec = iSetup.find( edm::eventsetup::EventSetupRecordKey::makeKey<RunInfoRcd>()); if( 0 != rec ) { edm::ESHandle<RunInfo> sum; iSetup.get<RunInfoRcd>().get(sum); current = sum->m_avg_current; printf("Got current from RunInfoRcd %f\n", sum->m_avg_current); } } } catch (...) { fwLog(fwlog::kInfo) << "ConditionsInRunBlock not available\n"; } static_cast<CmsEveMagField*>(m_MagField)->SetFieldByCurrent(current); }
void FWFFLooper::checkPosition | ( | ) | [virtual] |
Implements CmsShowMainBase.
Definition at line 240 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().
{ if (loop() && isPlaying()) return; guiManager()->getMainFrame()->enableNavigatorControls(); guiManager()->getMainFrame()->enableComplexNavigation(false); if (m_isFirstEvent) guiManager()->disablePrevious(); if (m_isLastEvent) { guiManager()->disableNext(); // force enable play events action in --port mode if (!guiManager()->playEventsAction()->isEnabled()) guiManager()->playEventsAction()->enable(); } }
void FWFFLooper::display | ( | const std::string & | info = "" | ) |
Definition at line 445 of file FWFFLooper.cc.
References m_AllowStep, and m_Rint.
{ // Display whatever was registered so far, wait until user presses // the "Step" button. if (m_AllowStep) { gEve->Redraw3D(); m_Rint->Run(kTRUE); } }
void FWFFLooper::doBeginLuminosityBlock | ( | edm::LuminosityBlockPrincipal & | iLB, |
edm::EventSetup const & | iES | ||
) | [virtual] |
Reimplemented from edm::EDLooperBase.
Definition at line 532 of file FWFFLooper.cc.
References edm::ESWatcher< T >::check(), and m_geomWatcher.
{ try { m_geomWatcher.check(iES); } catch (...) {} EDLooperBase::doBeginLuminosityBlock(iLB, iES); }
void FWFFLooper::doEndLuminosityBlock | ( | edm::LuminosityBlockPrincipal & | iLB, |
edm::EventSetup const & | iES | ||
) | [virtual] |
Reimplemented from edm::EDLooperBase.
Definition at line 541 of file FWFFLooper.cc.
References edm::ESWatcher< T >::check(), and m_geomWatcher.
{ try { m_geomWatcher.check(iES); } catch (...) {} EDLooperBase::doEndLuminosityBlock(iLB, iES); }
edm::EDLooperBase::Status FWFFLooper::duringLoop | ( | const edm::Event & | , |
const edm::EventSetup & | , | ||
edm::ProcessingController & | |||
) | [virtual] |
Called after all event modules have had a chance to process the Event.
Implements edm::EDLooperBase.
Definition at line 380 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, edm::ProcessingController::reverseState(), edm::ProcessingController::setTransitionToEvent(), edm::ProcessingController::setTransitionToNextEvent(), edm::ProcessingController::setTransitionToPreviousEvent(), and CmsShowMainBase::startAutoLoadTimer().
{ // Check DisplayGeomRecord changes. try { m_geomWatcher.check(es); } catch (...) {} m_isLastEvent = controller.forwardState() == edm::ProcessingController::kAtLastEvent; m_isFirstEvent = controller.reverseState() == edm::ProcessingController::kAtFirstEvent; // If the next event id is valid, set the transition so // that we go to it go to to it. if (m_nextEventId != edm::EventID()) { controller.setTransitionToEvent(m_nextEventId); m_nextEventId = edm::EventID(); return kContinue; } // We handle "last event" by going to the first event and then moving to the // previous event. if (m_navigator->currentTransition() == FWFFNavigator::kLastEvent) { m_navigator->resetTransition(); controller.setTransitionToPreviousEvent(); return kContinue; } m_pathsGUI->hasChanges() = false; m_metadataManager->update(new FWFFMetadataUpdateRequest(event)); m_navigator->setCurrentEvent(&event); if (m_autoReload == true) startAutoLoadTimer(); checkPosition(); draw(); m_Rint->Run(kTRUE); // If the GUI changed the PSet, save the current event to reload // it on next iteration. if (m_pathsGUI->hasChanges()) { m_nextEventId = edm::EventID(); return kStop; } else if (m_navigator->currentTransition() == FWFFNavigator::kFirstEvent) { m_nextEventId = m_navigator->getFirstEventID(); return kStop; } else if (m_navigator->currentTransition() == FWFFNavigator::kLastEvent) { m_nextEventId = m_navigator->getFirstEventID(); return kStop; } else if (m_navigator->currentTransition() == FWFFNavigator::kNextEvent) controller.setTransitionToNextEvent(); else if (m_navigator->currentTransition() == FWFFNavigator::kPreviousEvent) controller.setTransitionToPreviousEvent(); return kContinue; }
edm::EDLooperBase::Status FWFFLooper::endOfLoop | ( | const edm::EventSetup & | , |
unsigned int | |||
) | [virtual] |
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 491 of file FWFFLooper.cc.
References alignCSCRings::e, i, edm::EDLooperBase::kContinue, m_scheduledChanges, and edm::EDLooperBase::moduleChanger().
{ // Looks like the module changer is availble only here. for (ModuleChanges::iterator i = m_scheduledChanges.begin(), e = m_scheduledChanges.end(); i != e; ++i) { moduleChanger()->changeModule(i->first, i->second); } m_scheduledChanges.clear(); return kContinue; }
TEveMagField * FWFFLooper::getMagField | ( | ) |
void FWFFLooper::loadDefaultGeometryFile | ( | void | ) | [private] |
Definition at line 180 of file FWFFLooper.cc.
References CmsShowTaskExecutor::addTask(), f, CmsShowMainBase::loadGeometry(), and CmsShowMainBase::startupTasks().
Referenced by FWFFLooper().
{ CmsShowTaskExecutor::TaskFunctor f; f=boost::bind( &CmsShowMainBase::loadGeometry, this ); startupTasks()->addTask( f ); }
const FWFFLooper& FWFFLooper::operator= | ( | const FWFFLooper & | ) | [private] |
void FWFFLooper::postBeginJob | ( | ) |
void FWFFLooper::postEndJob | ( | ) |
Definition at line 233 of file FWFFLooper.cc.
Referenced by attachTo().
{ // printf("FWFFLooper::postEndJob\n"); // TEveManager::Terminate(); }
void FWFFLooper::quit | ( | ) | [virtual] |
Implements CmsShowMainBase.
Definition at line 474 of file FWFFLooper.cc.
{ gSystem->ExitLoop(); // Throwing exception here is bad because: // a) it does not work when in a "debug step"; // b) does not restore terminal state. // So we do exit instead for now. // throw cms::Exception("UserTerminationRequest"); gSystem->Exit(0); }
void FWFFLooper::remakeGeometry | ( | const DisplayGeomRecord & | dgRec | ) |
Definition at line 553 of file FWFFLooper.cc.
References fwLog, relativeConstraints::geom, edm::eventsetup::EventSetupRecord::get(), fwlog::kInfo, edm::ESHandle< T >::product(), and FWGeometryTableViewManager::setGeoManagerRuntime().
{ fwLog(fwlog::kInfo) << "FWFFLooper set TGeo geomtery from DisplayGeomRecord.\n"; edm::ESHandle<TGeoManager> geom; dgRec.get(geom); TEveGeoManagerHolder _tgeo(const_cast<TGeoManager*>(geom.product())); FWGeometryTableViewManager::setGeoManagerRuntime(gGeoManager); }
void FWFFLooper::requestChanges | ( | const std::string & | moduleLabel, |
const edm::ParameterSet & | ps | ||
) |
Definition at line 522 of file FWFFLooper.cc.
References m_scheduledChanges.
Referenced by FWPathsPopup::scheduleReloadEvent().
{ m_scheduledChanges[moduleLabel] = ps; }
void FWFFLooper::setupFieldForPropagator | ( | TEveTrackPropagator * | prop | ) |
Definition at line 468 of file FWFFLooper.cc.
References m_MagField.
{ prop->SetMagFieldObj(m_MagField, kFALSE); }
void FWFFLooper::showPathsGUI | ( | const TGWindow * | p | ) |
Definition at line 505 of file FWFFLooper.cc.
References CmsShowMainBase::guiManager(), m_pathsGUI, and FWGUIManager::setFilterButtonText().
Referenced by beginRun().
{ if (!m_pathsGUI) return; if (m_pathsGUI->IsMapped()) { guiManager()->setFilterButtonText("Show paths / CMSSW configuration editor"); m_pathsGUI->UnmapWindow(); } else { guiManager()->setFilterButtonText("Hide paths / CMSSW configuration editor"); m_pathsGUI->MapWindow(); } }
void FWFFLooper::startingNewLoop | ( | unsigned | int | ) | [virtual] |
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 209 of file FWFFLooper.cc.
References CmsShowTaskExecutor::addTask(), f, info, m_pathsGUI, m_Rint, edm::EDLooperBase::scheduleInfo(), FWPathsPopup::setup(), CmsShowTaskExecutor::startDoingTasks(), and CmsShowMainBase::startupTasks().
{ // Initialise on first loop. if (count == 0) { const edm::ScheduleInfo *info = scheduleInfo(); m_pathsGUI->setup(info); // We need to enter the GUI loop in order to // have all the callbacks executed. The last callback will // be responsible for returning the control to CMSSW. assert(m_Rint); CmsShowTaskExecutor::TaskFunctor f; f=boost::bind(&TApplication::Terminate, m_Rint, 0); startupTasks()->addTask(f); // FIXME: do we really need to delay tasks like this? startupTasks()->startDoingTasks(); m_Rint->Run(kTRUE); // Show the GUI ... gSystem->ProcessEvents(); } }
void FWFFLooper::stopPlaying | ( | ) | [virtual] |
Implements CmsShowMainBase.
Definition at line 286 of file FWFFLooper.cc.
References checkPosition(), FWGUIManager::enableActions(), CmsShowMainFrame::enableComplexNavigation(), FWGUIManager::getMainFrame(), CmsShowMainBase::guiManager(), m_autoReload, CmsShowMainBase::setIsPlaying(), and CmsShowMainBase::stopAutoLoadTimer().
{ stopAutoLoadTimer(); m_autoReload = false; setIsPlaying(false); guiManager()->enableActions(); guiManager()->getMainFrame()->enableComplexNavigation(false); checkPosition(); }
bool FWFFLooper::m_AllowStep [private] |
Definition at line 100 of file FWFFLooper.h.
Referenced by display().
edm::Service<FWFFHelper> FWFFLooper::m_appHelper [private] |
Definition at line 90 of file FWFFLooper.h.
bool FWFFLooper::m_autoReload [private] |
Definition at line 108 of file FWFFLooper.h.
Referenced by autoLoadNewEvent(), beginRun(), duringLoop(), and stopPlaying().
std::auto_ptr<fireworks::Context> FWFFLooper::m_context [private] |
Definition at line 93 of file FWFFLooper.h.
Referenced by beginRun(), and FWFFLooper().
TEveManager* FWFFLooper::m_EveManager [private] |
Definition at line 95 of file FWFFLooper.h.
bool FWFFLooper::m_firstTime [private] |
Definition at line 102 of file FWFFLooper.h.
Referenced by beginRun().
Definition at line 112 of file FWFFLooper.h.
Referenced by beginRun(), doBeginLuminosityBlock(), doEndLuminosityBlock(), and duringLoop().
bool FWFFLooper::m_isFirstEvent [private] |
Definition at line 109 of file FWFFLooper.h.
Referenced by autoLoadNewEvent(), checkPosition(), and duringLoop().
bool FWFFLooper::m_isLastEvent [private] |
Definition at line 110 of file FWFFLooper.h.
Referenced by autoLoadNewEvent(), checkPosition(), and duringLoop().
TEveMagField* FWFFLooper::m_MagField [private] |
Definition at line 98 of file FWFFLooper.h.
Referenced by beginRun(), FWFFLooper(), getMagField(), setupFieldForPropagator(), and ~FWFFLooper().
std::auto_ptr<FWFFMetadataManager> FWFFLooper::m_metadataManager [private] |
Definition at line 92 of file FWFFLooper.h.
Referenced by duringLoop(), and FWFFLooper().
std::auto_ptr<FWFFNavigator> FWFFLooper::m_navigator [private] |
Definition at line 91 of file FWFFLooper.h.
Referenced by autoLoadNewEvent(), duringLoop(), and FWFFLooper().
edm::EventID FWFFLooper::m_nextEventId [private] |
Definition at line 107 of file FWFFLooper.h.
Referenced by duringLoop().
FWPathsPopup* FWFFLooper::m_pathsGUI [private] |
Definition at line 103 of file FWFFLooper.h.
Referenced by attachTo(), duringLoop(), showPathsGUI(), and startingNewLoop().
TRint* FWFFLooper::m_Rint [private] |
Definition at line 96 of file FWFFLooper.h.
Referenced by display(), duringLoop(), and startingNewLoop().
ModuleChanges FWFFLooper::m_scheduledChanges [private] |
Definition at line 106 of file FWFFLooper.h.
Referenced by endOfLoop(), and requestChanges().
bool FWFFLooper::m_ShowEvent [private] |
Definition at line 101 of file FWFFLooper.h.