CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

CmsShowMain Class Reference

#include <Fireworks/Core/interface/CmsShowMain.h>

Inheritance diagram for CmsShowMain:
CmsShowMainBase

List of all members.

Public Member Functions

void appendData ()
 CmsShowMain (int argc, char *argv[])
const fireworks::Contextcontext () const
void doExit ()
void fileChangedSlot (const TFile *file)
const fwlite::EventgetCurrentEvent () const
bool getVersionCheck () const
void notified (TSocket *)
void openData ()
void openDataViaURL ()
virtual void quit ()
void resetInitialization ()
virtual ~CmsShowMain ()

Protected Member Functions

virtual void eventChangedImp ()

Private Member Functions

virtual void autoLoadNewEvent ()
void checkLiveMode ()
virtual void checkPosition ()
 CmsShowMain (const CmsShowMain &)
void connectSocket ()
void filterButtonClicked ()
void loadGeometry ()
void navigatorChangedFilterState (int)
const CmsShowMainoperator= (const CmsShowMain &)
void postFiltering (bool)
void preFiltering ()
void reachedBeginning ()
void reachedEnd ()
void setLiveMode ()
void setupDataHandling ()
void setupSocket (unsigned int)
virtual void stopPlaying ()

Private Attributes

std::auto_ptr< fireworks::Contextm_context
std::vector< std::string > m_inputFiles
UInt_t m_lastXEventSerial
bool m_live
int m_liveTimeout
std::auto_ptr< SignalTimerm_liveTimer
bool m_loadedAnyInputFile
std::auto_ptr
< FWLiteJobMetadataManager
m_metadataManager
std::auto_ptr< TMonitor > m_monitor
std::auto_ptr< CmsShowNavigatorm_navigator
bool m_noVersionCheck
const TFile * m_openFile
std::auto_ptr< CmsShowSearchFilesm_searchFiles

Detailed Description

Description: Displays an fwlite::Event in ROOT

Usage: <usage>

Definition at line 61 of file CmsShowMain.h.


Constructor & Destructor Documentation

CmsShowMain::CmsShowMain ( int  argc,
char *  argv[] 
)

Definition at line 111 of file CmsShowMain.cc.

References CmsShowTaskExecutor::addTask(), dir2webdir::argc, dirstructure::argv, CmsShowMainBase::configFilename(), connectSocket(), gather_cfg::cout, alignCSCRings::e, CmsShowMainBase::eiManager(), AutoLibraryLoader::enable(), FWColorPopup::EnableFreePalette(), exception, cmsRelvalreport::exit, f, fmt, fwLog, CmsShowMainBase::geometryFilename(), CmsShowMainBase::guiManager(), kAdvancedRenderCommandOpt, kAdvancedRenderOpt, kAutoSaveAllViews, kChainCommandOpt, kConfigFileCommandOpt, kConfigFileOpt, kEnableFPE, fwlog::kError, kEveCommandOpt, kEveOpt, kFieldCommandOpt, kFreePaletteCommandOpt, kGeomFileCommandOpt, kGeomFileOpt, kHelpCommandOpt, kHelpOpt, fwlog::kInfo, kInputFilesCommandOpt, kInputFilesOpt, kLiveCommandOpt, kLogLevelCommandOpt, kLogLevelOpt, kLoopCommandOpt, kLoopOpt, kNoConfigFileCommandOpt, kNoConfigFileOpt, kNoVersionCheck, kPlainRootCommandOpt, kPlayCommandOpt, kPlayOpt, kPortCommandOpt, kRootInteractiveCommandOpt, kSimGeomFileCommandOpt, kSimGeomFileOpt, kSoftCommandOpt, FWMagField::kUser, kZeroWinOffsets, testEve_cfg::level, CmsShowMainBase::loadGeometry(), m_context, m_inputFiles, m_metadataManager, m_navigator, m_noVersionCheck, AlCaHLTBitMon_ParallelJobs::options, AlCaHLTBitMon_ParallelJobs::p, FWGUIManager::resetWMOffsets(), DTTTrigCorrFirst::run, CmsShowMainBase::setAutoSaveAllViewsFormat(), CmsShowMainBase::setConfigFilename(), FWEventItemsManager::setContext(), CmsShowMainBase::setGeometryFilename(), setLiveMode(), CmsShowNavigator::setMaxNumberOfFilesToChain(), CmsShowMainBase::setPlayLoop(), fwlog::setPresentLogLevel(), CmsShowMainBase::setSimGeometryFilename(), CmsShowMainBase::setup(), CmsShowMainBase::setupAutoLoad(), CmsShowMainBase::setupConfiguration(), setupDataHandling(), CmsShowMainBase::setupDebugSupport(), setupSocket(), CmsShowMainBase::setupViewManagers(), CmsShowTaskExecutor::startDoingTasks(), CmsShowMainBase::startupTasks(), and w().

   : CmsShowMainBase(),
     m_navigator(new CmsShowNavigator(*this)),
     m_metadataManager(new FWLiteJobMetadataManager()),
     m_context(new fireworks::Context(changeManager(),
                                      selectionManager(),
                                      eiManager(),
                                      colorManager(),
                                      m_metadataManager.get())),
     m_loadedAnyInputFile(false),
     m_openFile(0),
     m_live(false),
     m_liveTimer(new SignalTimer()),
     m_liveTimeout(600000),
     m_lastXEventSerial(0),
     m_noVersionCheck(false)
{
   try {
      TGLWidget* w = TGLWidget::Create(gClient->GetDefaultRoot(), kTRUE, kTRUE, 0, 10, 10);
      delete w;
   }
   catch (std::exception& iException) {
      fwLog(fwlog::kError) << "Failed creating an OpenGL window: " << iException.what() << "\n"
         "Things to check:\n"
         "- Is DISPLAY environment variable set?\n"
         "- Are OpenGL libraries installed?\n"
         "- If running remotely, make sure you use 'ssh -X' or 'ssh -Y'.\n"
         "See also: https://twiki.cern.ch/twiki/bin/viewauth/CMS/WorkBookFireworks\n";
      gSystem->Exit(1);
   }

   eiManager()->setContext(m_context.get());

   
   std::string descString(argv[0]);
   descString += " [options] <data file>\nAllowed options";

   namespace po = boost::program_options;
   po::options_description desc(descString);
   desc.add_options()
      (kInputFilesCommandOpt, po::value< std::vector<std::string> >(),   "Input root files")
      (kConfigFileCommandOpt, po::value<std::string>(),   "Include configuration file")
      (kGeomFileCommandOpt,   po::value<std::string>(),   "Include geometry file")
      (kNoConfigFileCommandOpt,                           "Don't load any configuration file")
      (kPlayCommandOpt, po::value<float>(),               "Start in play mode with given interval between events in seconds")
      (kPortCommandOpt, po::value<unsigned int>(),        "Listen to port for new data files to open")
      (kEveCommandOpt,                                    "Show Eve browser to help debug problems")
      (kLoopCommandOpt,                                   "Loop events in play mode")
      (kPlainRootCommandOpt,                              "Plain ROOT without event display")
      (kRootInteractiveCommandOpt,                        "Enable root interactive prompt")
      (kEnableFPE,                                        "Enable detection of floating-point exceptions")
      (kLogLevelCommandOpt, po::value<unsigned int>(),    "Set log level starting from 0 to 4 : kDebug, kInfo, kWarning, kError")
      (kAdvancedRenderCommandOpt,                         "Use advance options to improve rendering quality       (anti-alias etc)")
      (kSoftCommandOpt,                                   "Try to force software rendering to avoid problems with bad hardware drivers")
      (kChainCommandOpt, po::value<unsigned int>(),       "Chain up to a given number of recently open files. Default is 1 - no chain")
      (kLiveCommandOpt,                                   "Enforce playback mode if a user is not using display")
      (kFieldCommandOpt, po::value<double>(),             "Set magnetic field value explicitly. Default is auto-field estimation")
      (kFreePaletteCommandOpt,                            "Allow free color selection (requires special configuration!)")
      (kAutoSaveAllViews, po::value<std::string>(),       "Auto-save all views with given prefix (run_event_lumi_view.png is appended)")
      (kZeroWinOffsets,                                   "Disable auto-detection of window position offsets.")
      (kNoVersionCheck,                                   "No file version check.")
      (kSimGeomFileCommandOpt,po::value<std::string>(),   "Set simulation geometry file to browse")
      (kHelpCommandOpt,                                   "Display help message");
   po::positional_options_description p;
   p.add(kInputFilesOpt, -1);

   int newArgc = argc;
   char **newArgv = argv;
   po::variables_map vm;
   //po::store(po::parse_command_line(newArgc, newArgv, desc), vm);
   //po::notify(vm);
   try{ 
      po::store(po::command_line_parser(newArgc, newArgv).
                options(desc).positional(p).run(), vm);

      po::notify(vm);
   }
   catch ( const std::exception& e)
   {
      // Return with exit status 0 to avoid generating crash reports

      fwLog(fwlog::kError) <<  e.what() << std::endl;
      std::cout << desc <<std::endl;
      exit(0); 
   }

   if(vm.count(kHelpOpt)) {
      std::cout << desc <<std::endl;
      exit(0);
   }
      
   if(vm.count(kLogLevelOpt)) {
      fwlog::LogLevel level = (fwlog::LogLevel)(vm[kLogLevelOpt].as<unsigned int>());
      fwlog::setPresentLogLevel(level);
   }

   if(vm.count(kPlainRootCommandOpt)) {
      fwLog(fwlog::kInfo) << "Plain ROOT prompt requested" << std::endl;
      return;
   }

   const char* cmspath = gSystem->Getenv("CMSSW_BASE");
   if(0 == cmspath) {
      throw std::runtime_error("CMSSW_BASE environment variable not set");
   }

   // input file
   if (vm.count(kInputFilesOpt)) {
      m_inputFiles = vm[kInputFilesOpt].as< std::vector<std::string> >();
   }

   if (!m_inputFiles.size())
      fwLog(fwlog::kInfo) << "No data file given." << std::endl;
   else if (m_inputFiles.size() == 1)
      fwLog(fwlog::kInfo) << "Input " << m_inputFiles.front() << std::endl;
   else
      fwLog(fwlog::kInfo) << m_inputFiles.size() << " input files; first: " << m_inputFiles.front() << ", last: " << m_inputFiles.back() << std::endl;

   // configuration file
   if (vm.count(kConfigFileOpt)) {
      setConfigFilename(vm[kConfigFileOpt].as<std::string>());
      if (access(configFilename(), R_OK) == -1)
      {
         fwLog(fwlog::kError) << "Specified configuration file does not exist. Quitting.\n";
         exit(0);
      }
   } else {
      if (vm.count(kNoConfigFileOpt)) {
         fwLog(fwlog::kInfo) << "No configuration is loaded, show everything.\n";
         setConfigFilename("");
      } else
         setConfigFilename("default.fwc");
   }
   fwLog(fwlog::kInfo) << "Config "  <<  configFilename() << std::endl;

   // geometry
   if (vm.count(kGeomFileOpt)) {
      setGeometryFilename(vm[kGeomFileOpt].as<std::string>());
   } else {
      //  fwLog(fwlog::kInfo) << "No geom file name.  Choosing default.\n";
      setGeometryFilename("cmsGeom10.root");
   }
   fwLog(fwlog::kInfo) << "Geometry file " << geometryFilename() << "\n";

   if (vm.count(kSimGeomFileOpt)) {
      setSimGeometryFilename(vm[kSimGeomFileOpt].as<std::string>());
   } else {
      setSimGeometryFilename("cmsSimGeom-14.root");
   }
   // Free-palette palette
   if (vm.count(kFreePaletteCommandOpt)) {
      FWColorPopup::EnableFreePalette();
      fwLog(fwlog::kInfo) << "Palette restriction removed on user request!\n";
   }
   bool eveMode = vm.count(kEveOpt);

   //Delay creating guiManager and enabling autoloading until here so that if we have a 'help' request we don't
   // open any graphics or build dictionaries
   AutoLibraryLoader::enable();

   TEveManager::Create(kFALSE, "FIV");

   setup(m_navigator.get(), m_context.get(), m_metadataManager.get());

   if (vm.count(kZeroWinOffsets))
   {
      guiManager()->resetWMOffsets();
      fwLog(fwlog::kInfo) << "Window offsets reset on user request!\n";
   }

   if ( vm.count(kAdvancedRenderOpt) ) 
   {
      TEveLine::SetDefaultSmooth(kTRUE);
   }

   //figure out where to find macros
   //tell ROOT where to find our macros
   CmsShowTaskExecutor::TaskFunctor f;
   // first check if port is not occupied
   if (vm.count(kPortCommandOpt)) {      
      f=boost::bind(&CmsShowMain::setupSocket, this, vm[kPortCommandOpt].as<unsigned int>());    
      startupTasks()->addTask(f);        
   }
    
   f=boost::bind(&CmsShowMainBase::loadGeometry,this);
   startupTasks()->addTask(f);
   f=boost::bind(&CmsShowMainBase::setupViewManagers,this);
   startupTasks()->addTask(f);
   f=boost::bind(&CmsShowMainBase::setupConfiguration,this);
   startupTasks()->addTask(f);
   f=boost::bind(&CmsShowMain::setupDataHandling,this);
   startupTasks()->addTask(f);

   if (vm.count(kLoopOpt))
      setPlayLoop();

   if (eveMode) {
      f = boost::bind(&CmsShowMainBase::setupDebugSupport,this);
      startupTasks()->addTask(f);
   }
   if(vm.count(kChainCommandOpt)) {
      f = boost::bind(&CmsShowNavigator::setMaxNumberOfFilesToChain, m_navigator.get(), vm[kChainCommandOpt].as<unsigned int>());
      startupTasks()->addTask(f);
   }
   if (vm.count(kPlayOpt)) {
      f = boost::bind(&CmsShowMainBase::setupAutoLoad, this, vm[kPlayOpt].as<float>());
      startupTasks()->addTask(f);
   }

   if(vm.count(kLiveCommandOpt))
   {
      f = boost::bind(&CmsShowMain::setLiveMode, this);
      startupTasks()->addTask(f);
   }
      
   if(vm.count(kFieldCommandOpt)) 
   {
      m_context->getField()->setSource(FWMagField::kUser);
      m_context->getField()->setUserField(vm[kFieldCommandOpt].as<double>());
   }
   if(vm.count(kAutoSaveAllViews)) {
      std::string fmt = vm[kAutoSaveAllViews].as<std::string>();
      fmt += "%u_%u_%u_%s.png";
      setAutoSaveAllViewsFormat(fmt);
   }
   if(vm.count(kNoVersionCheck)) {
      m_noVersionCheck=true;
   }
   if(vm.count(kEnableFPE)) {
      gSystem->SetFPEMask();
   }

   if (vm.count(kPortCommandOpt)) {      
      f=boost::bind(&CmsShowMain::connectSocket, this);          
      startupTasks()->addTask(f);        
   }

   startupTasks()->startDoingTasks();
}
CmsShowMain::~CmsShowMain ( ) [virtual]

Definition at line 355 of file CmsShowMain.cc.

References FWSelectionManager::clearSelection(), and CmsShowMainBase::selectionManager().

{
   //avoids a seg fault from eve which happens if eve is terminated after the GUI is gone
   selectionManager()->clearSelection();
}
CmsShowMain::CmsShowMain ( const CmsShowMain ) [private]

Member Function Documentation

void CmsShowMain::appendData ( )

Definition at line 468 of file CmsShowMain.cc.

References checkPosition(), FWGUIManager::clearStatus(), CmsShowMainBase::draw(), FWGUIManager::getMainFrame(), CmsShowMainBase::guiManager(), m_loadedAnyInputFile, m_navigator, FWGUIManager::titleChanged(), and FWGUIManager::updateStatus().

Referenced by setupDataHandling().

{
   const char* kRootType[] = {"ROOT files","*.root", 0, 0};
   TGFileInfo fi;
   fi.fFileTypes = kRootType;
   /* this is how things used to be done:
      fi.fIniDir = ".";
      this is bad because the destructor calls delete[] on fIniDir.
   */
   fi.fIniDir = new char[128];
   strncpy(fi.fIniDir,  ".", 127);
   guiManager()->updateStatus("waiting for data file ...");
   new TGFileDialog(gClient->GetDefaultRoot(), guiManager()->getMainFrame(), kFDOpen, &fi);
   guiManager()->updateStatus("loading file ...");
   if (fi.fFilename) {
      m_navigator->appendFile(fi.fFilename, false, false);
      m_loadedAnyInputFile = true;
      checkPosition();
      draw();
      guiManager()->titleChanged(m_navigator->frameTitle());
   }
   guiManager()->clearStatus();
}
void CmsShowMain::autoLoadNewEvent ( ) [private, virtual]

Implements CmsShowMainBase.

Definition at line 523 of file CmsShowMain.cc.

References checkPosition(), CmsShowMainBase::draw(), FWGUIManager::enableActions(), CmsShowMainBase::forward(), CmsShowMainBase::guiManager(), CmsShowMainBase::loop(), m_loadedAnyInputFile, m_monitor, m_navigator, reachedEnd(), CmsShowMainBase::startAutoLoadTimer(), and CmsShowMainBase::stopAutoLoadTimer().

{
   stopAutoLoadTimer();
   
   // case when start with no input file
   if (!m_loadedAnyInputFile)
   {
      if (m_monitor.get()) 
         startAutoLoadTimer();
      return;
   }

   bool reachedEnd = (forward() && m_navigator->isLastEvent()) || (!forward() && m_navigator->isFirstEvent());

   if (loop() && reachedEnd)
   {
      forward() ? m_navigator->firstEvent() : m_navigator->lastEvent();
      draw();
   }
   else if (!reachedEnd)
   {
      forward() ? m_navigator->nextEvent() : m_navigator->previousEvent();
      draw();
   }

   // stop loop in case no loop or monitor mode
   if (reachedEnd && (loop() || m_monitor.get()) == kFALSE)
   {
      if (forward() && m_navigator->isLastEvent())
      {
         guiManager()->enableActions();
         checkPosition();
      }

      if ((!forward()) && m_navigator->isFirstEvent())
      {
         guiManager()->enableActions();
         checkPosition();
      }
   }
   else
      startAutoLoadTimer();
}
void CmsShowMain::checkLiveMode ( ) [private]

Definition at line 813 of file CmsShowMain.cc.

References CmsShowMainBase::guiManager(), CmsShowMainBase::isPlaying(), m_lastXEventSerial, m_liveTimeout, m_liveTimer, FWGUIManager::playEventsAction(), and CSGContinuousAction::switchMode().

Referenced by setLiveMode().

{
   m_liveTimer->TurnOff();

   TGX11 *x11 = dynamic_cast<TGX11*>(gVirtualX);
   if (x11) {
      XAnyEvent *ev = (XAnyEvent*) x11->GetNativeEvent();
      // printf("serial %d \n",(int)ev->serial );

      if ( !isPlaying() && m_lastXEventSerial == ev->serial )
         guiManager()->playEventsAction()->switchMode();
      m_lastXEventSerial = ev->serial;
   }

   m_liveTimer->SetTime((Long_t)(m_liveTimeout));
   m_liveTimer->Reset();
   m_liveTimer->TurnOn();
}
void CmsShowMain::checkPosition ( ) [private, virtual]
void CmsShowMain::connectSocket ( ) [private]

Definition at line 664 of file CmsShowMain.cc.

References m_monitor.

Referenced by CmsShowMain().

{
  m_monitor->Connect("Ready(TSocket*)","CmsShowMain",this,"notified(TSocket*)");

}
const fireworks::Context* CmsShowMain::context ( ) const [inline]

Definition at line 81 of file CmsShowMain.h.

References m_context.

Referenced by CmsShowNavigator::getProcessList(), and CmsShowNavigator::updateFileFilters().

{ return m_context.get(); };
void CmsShowMain::doExit ( )

Definition at line 385 of file CmsShowMain.cc.

References FWGUIManager::evePreTerminate(), CmsShowMainBase::guiManager(), and m_context.

Referenced by DieTimer::Notify().

{
   // pre terminate eve
   m_context->deleteEveElements();
   guiManager()->evePreTerminate();

   // sleep at least 150 ms
   // windows in ROOT GUI are destroyed in 150 ms timeout after
   gSystem->Sleep(151);
   gSystem->ProcessEvents();
   gSystem->ExitLoop();
}
void CmsShowMain::eventChangedImp ( ) [protected, virtual]
void CmsShowMain::fileChangedSlot ( const TFile *  file)
void CmsShowMain::filterButtonClicked ( ) [private]
const fwlite::Event * CmsShowMain::getCurrentEvent ( ) const

Definition at line 415 of file CmsShowMain.cc.

References m_navigator.

Referenced by eventChangedImp(), and fileChangedSlot().

{
   if (m_navigator.get())
     return static_cast<const fwlite::Event*>(m_navigator->getCurrentEvent());
   return 0;
}
bool CmsShowMain::getVersionCheck ( ) const [inline]

Definition at line 82 of file CmsShowMain.h.

References m_noVersionCheck.

Referenced by CmsShowNavigator::appendFile(), and CmsShowNavigator::openFile().

{ return !m_noVersionCheck; }
void CmsShowMain::loadGeometry ( ) [private]

Reimplemented from CmsShowMainBase.

void CmsShowMain::navigatorChangedFilterState ( int  state) [private]
void CmsShowMain::notified ( TSocket *  iSocket)

Definition at line 671 of file CmsShowMain.cc.

References checkPosition(), CmsShowMainBase::draw(), convertXMLtoSQLite_cfg::fileName, CmsShowMainBase::forward(), CmsShowMainBase::guiManager(), CmsShowMainBase::isPlaying(), m_live, m_loadedAnyInputFile, m_monitor, m_navigator, alignCSCRings::s, getRunRegistry::server, and FWGUIManager::updateStatus().

{
   TServerSocket* server = dynamic_cast<TServerSocket*> (iSocket);
   if (server)
   {
      TSocket* connection = server->Accept();
      if (connection)
      {
         m_monitor->Add(connection);
         std::stringstream s;
         s << "received connection from "<<iSocket->GetInetAddress().GetHostName();
         guiManager()->updateStatus(s.str().c_str());
      }
   }
   else
   {
      char buffer[4096];
      memset(buffer,0,sizeof(buffer));
      if (iSocket->RecvRaw(buffer, sizeof(buffer)) <= 0)
      {
         m_monitor->Remove(iSocket);
         //std::stringstream s;
         //s << "closing connection to "<<iSocket->GetInetAddress().GetHostName();
         //m_guiManager->updateStatus(s.str().c_str());
         delete iSocket;
         return;
      }
      std::string fileName(buffer);
      std::string::size_type lastNonSpace = fileName.find_last_not_of(" \n\t");
      if (lastNonSpace != std::string::npos)
      {
         fileName.erase(lastNonSpace+1);
      }

      std::stringstream s;
      s <<"New file notified '"<<fileName<<"'";
      guiManager()->updateStatus(s.str().c_str());

      bool appended = m_navigator->appendFile(fileName, true, m_live);

      if (appended)
      {
         if (m_live && isPlaying() && forward())
            m_navigator->activateNewFileOnNextEvent();
         else if (!isPlaying())
            checkPosition();

         // bootstrap case: --port  and no input file
         if (!m_loadedAnyInputFile)
         {
            m_loadedAnyInputFile = true;
            m_navigator->firstEvent();
            if (!isPlaying())
               draw();
         }

         std::stringstream sr;
         sr <<"New file registered '"<<fileName<<"'";
         guiManager()->updateStatus(sr.str().c_str());
      }
      else
      {
         std::stringstream sr;
         sr <<"New file NOT registered '"<<fileName<<"'";
         guiManager()->updateStatus(sr.str().c_str());
      }
   }
}
void CmsShowMain::openData ( )

Definition at line 444 of file CmsShowMain.cc.

References checkPosition(), FWGUIManager::clearStatus(), CmsShowMainBase::draw(), FWGUIManager::getMainFrame(), CmsShowMainBase::guiManager(), m_loadedAnyInputFile, m_navigator, and FWGUIManager::updateStatus().

Referenced by setupDataHandling().

{
   const char* kRootType[] = {"ROOT files","*.root", 0, 0};
   TGFileInfo fi;
   fi.fFileTypes = kRootType;
   /* this is how things used to be done:
      fi.fIniDir = ".";
      this is bad because the destructor calls delete[] on fIniDir.
    */
   fi.fIniDir = new char[128];
   strncpy(fi.fIniDir, ".", 127);  
   guiManager()->updateStatus("waiting for data file ...");
   new TGFileDialog(gClient->GetDefaultRoot(), guiManager()->getMainFrame(), kFDOpen, &fi);
   guiManager()->updateStatus("loading file ...");
   if (fi.fFilename) {
      m_navigator->openFile(fi.fFilename);
      m_loadedAnyInputFile = true;
      m_navigator->firstEvent();
      checkPosition();
      draw();
   }
   guiManager()->clearStatus();
}
void CmsShowMain::openDataViaURL ( )

Definition at line 493 of file CmsShowMain.cc.

References checkPosition(), FWGUIManager::clearStatus(), CmsShowMainBase::draw(), CmsShowMainBase::guiManager(), m_loadedAnyInputFile, m_navigator, m_searchFiles, and FWGUIManager::updateStatus().

Referenced by setupDataHandling().

{
   if (m_searchFiles.get() == 0) {
      m_searchFiles = std::auto_ptr<CmsShowSearchFiles>(new CmsShowSearchFiles("",
                                                                               "Open Remote Data Files",
                                                                               guiManager()->getMainFrame(),
                                                                               500, 400));
      m_searchFiles->CenterOnParent(kTRUE,TGTransientFrame::kBottomRight);
   }
   std::string chosenFile = m_searchFiles->chooseFileFromURL();
   if(!chosenFile.empty()) {
      guiManager()->updateStatus("loading file ...");
      if(m_navigator->openFile(chosenFile.c_str())) {
         m_loadedAnyInputFile = true;
         m_navigator->firstEvent();
         checkPosition();
         draw();
         guiManager()->clearStatus();
      } else {
         guiManager()->updateStatus("failed to load data file");
      }
   }
}
const CmsShowMain& CmsShowMain::operator= ( const CmsShowMain ) [private]
void CmsShowMain::postFiltering ( bool  doDraw) [private]

Definition at line 779 of file CmsShowMain.cc.

References checkPosition(), FWGUIManager::clearStatus(), CmsShowMainBase::draw(), CmsShowMainBase::guiManager(), m_navigator, and FWGUIManager::setFilterButtonText().

Referenced by setupDataHandling().

{
   // called only filter is changed
   guiManager()->clearStatus();
   if (doDraw) draw();
   checkPosition();
   guiManager()->setFilterButtonText(m_navigator->filterStatusMessage());
}
void CmsShowMain::preFiltering ( ) [private]

Definition at line 772 of file CmsShowMain.cc.

References CmsShowMainBase::guiManager(), and FWGUIManager::updateStatus().

{
   // called only if filter has changed
   guiManager()->updateStatus("Filtering events");
}
void CmsShowMain::quit ( ) [virtual]

Implements CmsShowMainBase.

Definition at line 380 of file CmsShowMain.cc.

{
   new DieTimer(this);
}
void CmsShowMain::reachedBeginning ( ) [private]
void CmsShowMain::reachedEnd ( ) [private]

Referenced by autoLoadNewEvent().

void CmsShowMain::resetInitialization ( )

Definition at line 440 of file CmsShowMain.cc.

                                      {
   //printf("Need to reset\n");
}
void CmsShowMain::setLiveMode ( ) [private]

Definition at line 791 of file CmsShowMain.cc.

References checkLiveMode(), m_live, m_liveTimeout, and m_liveTimer.

Referenced by CmsShowMain().

{
   m_live = true;
   m_liveTimer.reset(new SignalTimer());
   m_liveTimer->timeout_.connect(boost::bind(&CmsShowMain::checkLiveMode,this));

   Window_t rootw, childw;
   Int_t root_x, root_y, win_x, win_y;
   UInt_t mask;
   gVirtualX->QueryPointer(gClient->GetDefaultRoot()->GetId(),
                           rootw, childw,
                           root_x, root_y,
                           win_x, win_y,
                           mask);


   m_liveTimer->SetTime(m_liveTimeout);
   m_liveTimer->Reset();
   m_liveTimer->TurnOn();
}
void CmsShowMain::setupDataHandling ( ) [private]

Definition at line 591 of file CmsShowMain.cc.

References CSGAction::activated, appendData(), FWEventItemsManager::begin(), checkPosition(), CmsShowMainBase::draw(), CmsShowMainBase::eiManager(), FWEventItemsManager::end(), fileChangedSlot(), filterButtonClicked(), FWGUIManager::filterButtonClicked_, alignmentValidation::fname, FWGUIManager::getAction(), CmsShowMainBase::guiManager(), m_inputFiles, m_loadedAnyInputFile, m_monitor, m_navigator, navigatorChangedFilterState(), openData(), openDataViaURL(), postFiltering(), cmsshow::sAppendData, FWGUIManager::setFilterButtonIcon(), CmsShowMainBase::setupActions(), CmsShowNavigator::showEventFilterGUI(), FWGUIManager::showEventFilterGUI_, cmsshow::sOpenData, cmsshow::sSearchFiles, FWGUIManager::updateEventFilterEnable(), and FWGUIManager::updateStatus().

Referenced by CmsShowMain().

{
   guiManager()->updateStatus("Setting up data handling...");


   // navigator filtering  ->
   m_navigator->fileChanged_.connect(boost::bind(&CmsShowMain::fileChangedSlot, this, _1));
   m_navigator->editFiltersExternally_.connect(boost::bind(&FWGUIManager::updateEventFilterEnable, guiManager(), _1));
   m_navigator->filterStateChanged_.connect(boost::bind(&CmsShowMain::navigatorChangedFilterState, this, _1));
   m_navigator->postFiltering_.connect(boost::bind(&CmsShowMain::postFiltering, this, _1));

   // navigator fitlering <-
   guiManager()->showEventFilterGUI_.connect(boost::bind(&CmsShowNavigator::showEventFilterGUI, m_navigator.get(),_1));
   guiManager()->filterButtonClicked_.connect(boost::bind(&CmsShowMain::filterButtonClicked,this));

   // Data handling. File related and therefore not in the base class.
   if (guiManager()->getAction(cmsshow::sOpenData)    != 0) 
      guiManager()->getAction(cmsshow::sOpenData)->activated.connect(sigc::mem_fun(*this, &CmsShowMain::openData));
   if (guiManager()->getAction(cmsshow::sAppendData)  != 0) 
      guiManager()->getAction(cmsshow::sAppendData)->activated.connect(sigc::mem_fun(*this, &CmsShowMain::appendData));
   if (guiManager()->getAction(cmsshow::sSearchFiles) != 0)
      guiManager()->getAction(cmsshow::sSearchFiles)->activated.connect(sigc::mem_fun(*this, &CmsShowMain::openDataViaURL));

   setupActions();
   // init data from  CmsShowNavigator configuration, can do this with signals since there were not connected yet
   guiManager()->setFilterButtonIcon(m_navigator->getFilterState());

   for (unsigned int ii = 0; ii < m_inputFiles.size(); ++ii)
   {
      const std::string& fname = m_inputFiles[ii];
      if (fname.empty())
         continue;
      guiManager()->updateStatus("loading data file ...");
      if (!m_navigator->appendFile(fname, false, false))
      {
         guiManager()->updateStatus("failed to load data file");
      }
      else
      {
         m_loadedAnyInputFile = true;

      }
   }

   if (m_loadedAnyInputFile)
   {
      m_navigator->firstEvent();
      checkPosition();
      draw();
   }
   else if (m_monitor.get() == 0 && (eiManager()->begin() != eiManager()->end()) )
   {
      if (m_inputFiles.empty())
         openDataViaURL();
      else
         openData();
   }
}
void CmsShowMain::setupSocket ( unsigned int  iSocket) [private]

Definition at line 651 of file CmsShowMain.cc.

References cmsRelvalreport::exit, fwLog, fwlog::kError, m_monitor, and getRunRegistry::server.

Referenced by CmsShowMain().

{
   m_monitor = std::auto_ptr<TMonitor>(new TMonitor);
   TServerSocket* server = new TServerSocket(iSocket,kTRUE);
   if (server->GetErrorCode())
   {
      fwLog(fwlog::kError) << "CmsShowMain::setupSocket, can't create socket on port "<< iSocket << "." << std::endl;
      exit(0);
   }    
   m_monitor->Add(server);
}
void CmsShowMain::stopPlaying ( ) [private, virtual]

Member Data Documentation

std::auto_ptr<fireworks::Context> CmsShowMain::m_context [private]

Definition at line 117 of file CmsShowMain.h.

Referenced by CmsShowMain(), context(), and doExit().

std::vector<std::string> CmsShowMain::m_inputFiles [private]

Definition at line 119 of file CmsShowMain.h.

Referenced by CmsShowMain(), and setupDataHandling().

Definition at line 129 of file CmsShowMain.h.

Referenced by checkLiveMode().

bool CmsShowMain::m_live [private]

Definition at line 126 of file CmsShowMain.h.

Referenced by notified(), setLiveMode(), and stopPlaying().

Definition at line 128 of file CmsShowMain.h.

Referenced by checkLiveMode(), and setLiveMode().

std::auto_ptr<SignalTimer> CmsShowMain::m_liveTimer [private]

Definition at line 127 of file CmsShowMain.h.

Referenced by checkLiveMode(), and setLiveMode().

Definition at line 116 of file CmsShowMain.h.

Referenced by CmsShowMain(), eventChangedImp(), and fileChangedSlot().

std::auto_ptr<TMonitor> CmsShowMain::m_monitor [private]
std::auto_ptr<CmsShowNavigator> CmsShowMain::m_navigator [private]

Definition at line 131 of file CmsShowMain.h.

Referenced by CmsShowMain(), and getVersionCheck().

const TFile* CmsShowMain::m_openFile [private]

Definition at line 121 of file CmsShowMain.h.

Referenced by eventChangedImp(), and fileChangedSlot().

Definition at line 123 of file CmsShowMain.h.

Referenced by openDataViaURL().