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
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 ()
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
Int_t m_lastPointerPositionX
Int_t m_lastPointerPositionY
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
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 107 of file CmsShowMain.cc.

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

   : 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_lastPointerPositionX(-999),
     m_lastPointerPositionY(-999)
{
   try {
      TGLWidget* w = TGLWidget::Create(gClient->GetDefaultRoot(), kTRUE, kTRUE, 0, 10, 10);
      delete w;
   }
   catch (std::exception& iException) {
      std::cerr << "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")
      (kDebugCommandOpt,                                  "Start the display from a debugger and produce a crash report")
      (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.")
      (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);
   po::store(po::command_line_parser(newArgc, newArgv).
             options(desc).positional(p).run(), vm);
   po::notify(vm);
   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(1);
      }
   } 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) << "Geom " << geometryFilename() << std::endl;

   // 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 += "%d_%d_%d_%s.png";
      setAutoSaveAllViewsFormat(fmt);
   }
   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 330 of file CmsShowMain.cc.

{}
CmsShowMain::CmsShowMain ( const CmsShowMain ) [private]

Member Function Documentation

void CmsShowMain::appendData ( )

Definition at line 440 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 494 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 780 of file CmsShowMain.cc.

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

Referenced by setLiveMode().

{
   m_liveTimer->TurnOff();

   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);


   if ( !isPlaying() &&
        m_lastPointerPositionX == root_x && 
        m_lastPointerPositionY == root_y )
   {
      guiManager()->playEventsAction()->switchMode();
   }

   m_lastPointerPositionX = root_x;
   m_lastPointerPositionY = root_y;


   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 631 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 357 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 387 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;
}
void CmsShowMain::loadGeometry ( ) [private]

Reimplemented from CmsShowMainBase.

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

Definition at line 638 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, asciidump::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 416 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 465 of file CmsShowMain.cc.

References checkPosition(), FWGUIManager::clearStatus(), CmsShowMainBase::draw(), CmsShowMainBase::guiManager(), 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_navigator->firstEvent();
         checkPosition();
         draw();
         guiManager()->clearStatus();
      } else {
         guiManager()->updateStatus("failed to load data file");
      }
   }
}
const CmsShowMain& CmsShowMain::operator= ( const CmsShowMain ) [private]
void CmsShowMain::postFiltering ( ) [private]
void CmsShowMain::preFiltering ( ) [private]

Definition at line 739 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 352 of file CmsShowMain.cc.

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

Referenced by autoLoadNewEvent().

void CmsShowMain::resetInitialization ( )

Definition at line 412 of file CmsShowMain.cc.

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

Definition at line 758 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 562 of file CmsShowMain.cc.

References CSGAction::activated, appendData(), checkPosition(), CmsShowMainBase::draw(), 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));

   // 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");
         openData();
      }
      else
      {
         m_loadedAnyInputFile = true;

      }
   }

   if (m_loadedAnyInputFile)
   {
      m_navigator->firstEvent();
      checkPosition();
      draw();
   }
   else if (m_monitor.get() == 0)
      openData();
}
void CmsShowMain::setupSocket ( unsigned int  iSocket) [private]

Definition at line 618 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 116 of file CmsShowMain.h.

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

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

Definition at line 118 of file CmsShowMain.h.

Referenced by CmsShowMain(), and setupDataHandling().

Definition at line 128 of file CmsShowMain.h.

Referenced by checkLiveMode().

Definition at line 129 of file CmsShowMain.h.

Referenced by checkLiveMode().

bool CmsShowMain::m_live [private]

Definition at line 125 of file CmsShowMain.h.

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

Definition at line 127 of file CmsShowMain.h.

Referenced by checkLiveMode(), and setLiveMode().

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

Definition at line 126 of file CmsShowMain.h.

Referenced by checkLiveMode(), and setLiveMode().

Definition at line 119 of file CmsShowMain.h.

Referenced by appendData(), autoLoadNewEvent(), notified(), openData(), and setupDataHandling().

Definition at line 115 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]
const TFile* CmsShowMain::m_openFile [private]

Definition at line 120 of file CmsShowMain.h.

Referenced by eventChangedImp(), and fileChangedSlot().

Definition at line 122 of file CmsShowMain.h.

Referenced by openDataViaURL().