CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CmsShowMain.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : CmsShowMain
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author:
10 // Created: Mon Dec 3 08:38:38 PST 2007
11 // $Id: CmsShowMain.cc,v 1.192 2011/07/13 20:50:57 amraktad Exp $
12 //
13 
14 // system include files
15 #include <sstream>
16 #include <boost/bind.hpp>
17 #include <boost/program_options.hpp>
18 #include <string.h>
19 
20 #include "TSystem.h"
21 #include "TGLWidget.h"
22 #include "TTimer.h"
23 #include "TROOT.h"
24 #include "TGFileDialog.h"
25 #include "TGMsgBox.h"
26 #include "TMonitor.h"
27 #include "TServerSocket.h"
28 #include "TEveLine.h"
29 #include "TEveManager.h"
30 #include "TFile.h"
31 
33 
35 
49 
54 
56 
60 
62 
64 
65 //
66 // constants, enums and typedefs
67 //
68 
69 static const char* const kInputFilesOpt = "input-files";
70 static const char* const kInputFilesCommandOpt = "input-files,i";
71 static const char* const kConfigFileOpt = "config-file";
72 static const char* const kConfigFileCommandOpt = "config-file,c";
73 static const char* const kGeomFileOpt = "geom-file";
74 static const char* const kGeomFileCommandOpt = "geom-file,g";
75 static const char* const kSimGeomFileOpt = "sim-geom-file";
76 static const char* const kSimGeomFileCommandOpt= "sim-geom-file";
77 static const char* const kNoConfigFileOpt = "noconfig";
78 static const char* const kNoConfigFileCommandOpt = "noconfig,n";
79 static const char* const kPlayOpt = "play";
80 static const char* const kPlayCommandOpt = "play,p";
81 static const char* const kLoopOpt = "loop";
82 static const char* const kLoopCommandOpt = "loop";
83 static const char* const kDebugOpt = "debug";
84 static const char* const kDebugCommandOpt = "debug,d";
85 static const char* const kLogLevelCommandOpt = "log";
86 static const char* const kLogLevelOpt = "log";
87 static const char* const kEveOpt = "eve";
88 static const char* const kEveCommandOpt = "eve";
89 static const char* const kAdvancedRenderOpt = "shine";
90 static const char* const kAdvancedRenderCommandOpt = "shine,s";
91 static const char* const kHelpOpt = "help";
92 static const char* const kHelpCommandOpt = "help,h";
93 static const char* const kSoftCommandOpt = "soft";
94 static const char* const kPortCommandOpt = "port";
95 static const char* const kPlainRootCommandOpt = "prompt";
96 static const char* const kRootInteractiveCommandOpt = "root-interactive,r";
97 static const char* const kChainCommandOpt = "chain";
98 static const char* const kLiveCommandOpt = "live";
99 static const char* const kFieldCommandOpt = "field";
100 static const char* const kFreePaletteCommandOpt = "free-palette";
101 static const char* const kAutoSaveAllViews = "auto-save-all-views";
102 static const char* const kEnableFPE = "enable-fpe";
103 static const char* const kZeroWinOffsets = "zero-window-offsets";
104 static const char* const kNoVersionCheck = "no-version-check";
105 
106 
107 //
108 // constructors and destructor
109 //
110 CmsShowMain::CmsShowMain(int argc, char *argv[])
111  : CmsShowMainBase(),
112  m_navigator(new CmsShowNavigator(*this)),
113  m_metadataManager(new FWLiteJobMetadataManager()),
114  m_context(new fireworks::Context(changeManager(),
115  selectionManager(),
116  eiManager(),
117  colorManager(),
118  m_metadataManager.get())),
119  m_loadedAnyInputFile(false),
120  m_openFile(0),
121  m_live(false),
122  m_liveTimer(new SignalTimer()),
123  m_liveTimeout(600000),
124  m_lastPointerPositionX(-999),
125  m_lastPointerPositionY(-999),
126  m_noVersionCheck(false)
127 {
128  try {
129  TGLWidget* w = TGLWidget::Create(gClient->GetDefaultRoot(), kTRUE, kTRUE, 0, 10, 10);
130  delete w;
131  }
132  catch (std::exception& iException) {
133  std::cerr << "Failed creating an OpenGL window: " << iException.what() << "\n"
134  "Things to check:\n"
135  "- Is DISPLAY environment variable set?\n"
136  "- Are OpenGL libraries installed?\n"
137  "- If running remotely, make sure you use 'ssh -X' or 'ssh -Y'.\n"
138  "See also: https://twiki.cern.ch/twiki/bin/viewauth/CMS/WorkBookFireworks\n";
139  gSystem->Exit(1);
140  }
141 
142  eiManager()->setContext(m_context.get());
143 
144 
145  std::string descString(argv[0]);
146  descString += " [options] <data file>\nAllowed options";
147 
148  namespace po = boost::program_options;
149  po::options_description desc(descString);
150  desc.add_options()
151  (kInputFilesCommandOpt, po::value< std::vector<std::string> >(), "Input root files")
152  (kConfigFileCommandOpt, po::value<std::string>(), "Include configuration file")
153  (kGeomFileCommandOpt, po::value<std::string>(), "Include geometry file")
154  (kNoConfigFileCommandOpt, "Don't load any configuration file")
155  (kPlayCommandOpt, po::value<float>(), "Start in play mode with given interval between events in seconds")
156  (kPortCommandOpt, po::value<unsigned int>(), "Listen to port for new data files to open")
157  (kEveCommandOpt, "Show Eve browser to help debug problems")
158  (kLoopCommandOpt, "Loop events in play mode")
159  (kPlainRootCommandOpt, "Plain ROOT without event display")
160  (kRootInteractiveCommandOpt, "Enable root interactive prompt")
161  (kDebugCommandOpt, "Start the display from a debugger and produce a crash report")
162  (kEnableFPE, "Enable detection of floating-point exceptions")
163  (kLogLevelCommandOpt, po::value<unsigned int>(), "Set log level starting from 0 to 4 : kDebug, kInfo, kWarning, kError")
164  (kAdvancedRenderCommandOpt, "Use advance options to improve rendering quality (anti-alias etc)")
165  (kSoftCommandOpt, "Try to force software rendering to avoid problems with bad hardware drivers")
166  (kChainCommandOpt, po::value<unsigned int>(), "Chain up to a given number of recently open files. Default is 1 - no chain")
167  (kLiveCommandOpt, "Enforce playback mode if a user is not using display")
168  (kFieldCommandOpt, po::value<double>(), "Set magnetic field value explicitly. Default is auto-field estimation")
169  (kFreePaletteCommandOpt, "Allow free color selection (requires special configuration!)")
170  (kAutoSaveAllViews, po::value<std::string>(), "Auto-save all views with given prefix (run_event_lumi_view.png is appended)")
171  (kZeroWinOffsets, "Disable auto-detection of window position offsets.")
172  (kNoVersionCheck, "No file version check.")
173  (kSimGeomFileCommandOpt,po::value<std::string>(), "Set simulation geometry file to browse")
174  (kHelpCommandOpt, "Display help message");
175  po::positional_options_description p;
176  p.add(kInputFilesOpt, -1);
177 
178  int newArgc = argc;
179  char **newArgv = argv;
180  po::variables_map vm;
181  //po::store(po::parse_command_line(newArgc, newArgv, desc), vm);
182  //po::notify(vm);
183  po::store(po::command_line_parser(newArgc, newArgv).
184  options(desc).positional(p).run(), vm);
185  po::notify(vm);
186  if(vm.count(kHelpOpt)) {
187  std::cout << desc <<std::endl;
188  exit(0);
189  }
190 
191  if(vm.count(kLogLevelOpt)) {
192  fwlog::LogLevel level = (fwlog::LogLevel)(vm[kLogLevelOpt].as<unsigned int>());
194  }
195 
196  if(vm.count(kPlainRootCommandOpt)) {
197  fwLog(fwlog::kInfo) << "Plain ROOT prompt requested" << std::endl;
198  return;
199  }
200 
201  const char* cmspath = gSystem->Getenv("CMSSW_BASE");
202  if(0 == cmspath) {
203  throw std::runtime_error("CMSSW_BASE environment variable not set");
204  }
205 
206  // input file
207  if (vm.count(kInputFilesOpt)) {
208  m_inputFiles = vm[kInputFilesOpt].as< std::vector<std::string> >();
209  }
210 
211  if (!m_inputFiles.size())
212  fwLog(fwlog::kInfo) << "No data file given." << std::endl;
213  else if (m_inputFiles.size() == 1)
214  fwLog(fwlog::kInfo) << "Input " << m_inputFiles.front() << std::endl;
215  else
216  fwLog(fwlog::kInfo) << m_inputFiles.size() << " input files; first: " << m_inputFiles.front() << ", last: " << m_inputFiles.back() << std::endl;
217 
218  // configuration file
219  if (vm.count(kConfigFileOpt)) {
220  setConfigFilename(vm[kConfigFileOpt].as<std::string>());
221  if (access(configFilename(), R_OK) == -1)
222  {
223  fwLog(fwlog::kError) << "Specified configuration file does not exist. Quitting.\n";
224  exit(1);
225  }
226  } else {
227  if (vm.count(kNoConfigFileOpt)) {
228  fwLog(fwlog::kInfo) << "No configuration is loaded, show everything.\n";
229  setConfigFilename("");
230  } else
231  setConfigFilename("default.fwc");
232  }
233  fwLog(fwlog::kInfo) << "Config " << configFilename() << std::endl;
234 
235  // geometry
236  if (vm.count(kGeomFileOpt)) {
237  setGeometryFilename(vm[kGeomFileOpt].as<std::string>());
238  } else {
239  fwLog(fwlog::kInfo) << "No geom file name. Choosing default.\n";
240  setGeometryFilename("cmsGeom10.root");
241  }
242  fwLog(fwlog::kInfo) << "Geom " << geometryFilename() << std::endl;
243 
244  if (vm.count(kSimGeomFileOpt)) {
245  setSimGeometryFilename(vm[kSimGeomFileOpt].as<std::string>());
246  } else {
247  setSimGeometryFilename("cmsSimGeom-14.root");
248  }
249  // Free-palette palette
250  if (vm.count(kFreePaletteCommandOpt)) {
252  fwLog(fwlog::kInfo) << "Palette restriction removed on user request!\n";
253  }
254  bool eveMode = vm.count(kEveOpt);
255 
256  //Delay creating guiManager and enabling autoloading until here so that if we have a 'help' request we don't
257  // open any graphics or build dictionaries
259 
260  TEveManager::Create(kFALSE, "FIV");
261 
262  setup(m_navigator.get(), m_context.get(), m_metadataManager.get());
263 
264  if (vm.count(kZeroWinOffsets))
265  {
267  fwLog(fwlog::kInfo) << "Window offsets reset on user request!\n";
268  }
269 
270  if ( vm.count(kAdvancedRenderOpt) )
271  {
272  TEveLine::SetDefaultSmooth(kTRUE);
273  }
274 
275  //figure out where to find macros
276  //tell ROOT where to find our macros
278  // first check if port is not occupied
279  if (vm.count(kPortCommandOpt)) {
280  f=boost::bind(&CmsShowMain::setupSocket, this, vm[kPortCommandOpt].as<unsigned int>());
281  startupTasks()->addTask(f);
282  }
283 
284  f=boost::bind(&CmsShowMainBase::loadGeometry,this);
285  startupTasks()->addTask(f);
286  f=boost::bind(&CmsShowMainBase::setupViewManagers,this);
287  startupTasks()->addTask(f);
288  f=boost::bind(&CmsShowMainBase::setupConfiguration,this);
289  startupTasks()->addTask(f);
290  f=boost::bind(&CmsShowMain::setupDataHandling,this);
291  startupTasks()->addTask(f);
292 
293  if (vm.count(kLoopOpt))
294  setPlayLoop();
295 
296  if (eveMode) {
297  f = boost::bind(&CmsShowMainBase::setupDebugSupport,this);
298  startupTasks()->addTask(f);
299  }
300  if(vm.count(kChainCommandOpt)) {
301  f = boost::bind(&CmsShowNavigator::setMaxNumberOfFilesToChain, m_navigator.get(), vm[kChainCommandOpt].as<unsigned int>());
302  startupTasks()->addTask(f);
303  }
304  if (vm.count(kPlayOpt)) {
305  f = boost::bind(&CmsShowMainBase::setupAutoLoad, this, vm[kPlayOpt].as<float>());
306  startupTasks()->addTask(f);
307  }
308 
309  if(vm.count(kLiveCommandOpt))
310  {
311  f = boost::bind(&CmsShowMain::setLiveMode, this);
312  startupTasks()->addTask(f);
313  }
314 
315  if(vm.count(kFieldCommandOpt))
316  {
317  m_context->getField()->setSource(FWMagField::kUser);
318  m_context->getField()->setUserField(vm[kFieldCommandOpt].as<double>());
319  }
320  if(vm.count(kAutoSaveAllViews)) {
321  std::string fmt = vm[kAutoSaveAllViews].as<std::string>();
322  fmt += "%d_%d_%d_%s.png";
324  }
325  if(vm.count(kNoVersionCheck)) {
326  m_noVersionCheck=true;
327  }
328  if(vm.count(kEnableFPE)) {
329  gSystem->SetFPEMask();
330  }
331 
332  if (vm.count(kPortCommandOpt)) {
333  f=boost::bind(&CmsShowMain::connectSocket, this);
334  startupTasks()->addTask(f);
335  }
336 
338 }
339 
340 //
341 // Destruction
342 //
343 
345 {
346  //avoids a seg fault from eve which happens if eve is terminated after the GUI is gone
348 }
349 
350 class DieTimer : public TTimer
351 {
352 protected:
354 public:
355  DieTimer(CmsShowMain* app) : TTimer(), fApp(app)
356  {
357  Start(0, kTRUE);
358  }
359 
360  virtual Bool_t Notify()
361  {
362  TurnOff();
363  fApp->doExit();
364  delete this;
365  return kFALSE;
366  }
367 };
368 
370 {
371  new DieTimer(this);
372 }
373 
375 {
376  // pre terminate eve
377  m_context->deleteEveElements();
379 
380  // sleep at least 150 ms
381  // windows in ROOT GUI are destroyed in 150 ms timeout after
382  gSystem->Sleep(151);
383  gSystem->ProcessEvents();
384  gSystem->ExitLoop();
385 }
386 
387 //
388 // assignment operators
389 //
390 // const CmsShowMain& CmsShowMain::operator=(const CmsShowMain& rhs)
391 // {
392 // //An exception safe implementation is
393 // CmsShowMain temp(rhs);
394 // swap(rhs);
395 //
396 // return *this;
397 // }
398 
399 //
400 // member functions
401 //
402 
403 const fwlite::Event*
405 {
406  if (m_navigator.get())
407  return static_cast<const fwlite::Event*>(m_navigator->getCurrentEvent());
408  return 0;
409 }
410 
411 void
413 {
414  m_openFile = file;
415  if (file)
416  guiManager()->titleChanged(m_navigator->frameTitle());
417 
419 }
420 
421 void
423 {
425  guiManager()->titleChanged(m_navigator->frameTitle());
427 }
428 
430  //printf("Need to reset\n");
431 }
432 
434 {
435  const char* kRootType[] = {"ROOT files","*.root", 0, 0};
436  TGFileInfo fi;
437  fi.fFileTypes = kRootType;
438  /* this is how things used to be done:
439  fi.fIniDir = ".";
440  this is bad because the destructor calls delete[] on fIniDir.
441  */
442  fi.fIniDir = new char[128];
443  strncpy(fi.fIniDir, ".", 127);
444  guiManager()->updateStatus("waiting for data file ...");
445  new TGFileDialog(gClient->GetDefaultRoot(), guiManager()->getMainFrame(), kFDOpen, &fi);
446  guiManager()->updateStatus("loading file ...");
447  if (fi.fFilename) {
448  m_navigator->openFile(fi.fFilename);
449  m_loadedAnyInputFile = true;
450  m_navigator->firstEvent();
451  checkPosition();
452  draw();
453  }
454  guiManager()->clearStatus();
455 }
456 
458 {
459  const char* kRootType[] = {"ROOT files","*.root", 0, 0};
460  TGFileInfo fi;
461  fi.fFileTypes = kRootType;
462  /* this is how things used to be done:
463  fi.fIniDir = ".";
464  this is bad because the destructor calls delete[] on fIniDir.
465  */
466  fi.fIniDir = new char[128];
467  strncpy(fi.fIniDir, ".", 127);
468  guiManager()->updateStatus("waiting for data file ...");
469  new TGFileDialog(gClient->GetDefaultRoot(), guiManager()->getMainFrame(), kFDOpen, &fi);
470  guiManager()->updateStatus("loading file ...");
471  if (fi.fFilename) {
472  m_navigator->appendFile(fi.fFilename, false, false);
473  m_loadedAnyInputFile = true;
474  checkPosition();
475  draw();
476  guiManager()->titleChanged(m_navigator->frameTitle());
477  }
478  guiManager()->clearStatus();
479 }
480 
481 void
483 {
484  if (m_searchFiles.get() == 0) {
485  m_searchFiles = std::auto_ptr<CmsShowSearchFiles>(new CmsShowSearchFiles("",
486  "Open Remote Data Files",
487  guiManager()->getMainFrame(),
488  500, 400));
489  m_searchFiles->CenterOnParent(kTRUE,TGTransientFrame::kBottomRight);
490  }
491  std::string chosenFile = m_searchFiles->chooseFileFromURL();
492  if(!chosenFile.empty()) {
493  guiManager()->updateStatus("loading file ...");
494  if(m_navigator->openFile(chosenFile.c_str())) {
495  m_navigator->firstEvent();
496  checkPosition();
497  draw();
498  guiManager()->clearStatus();
499  } else {
500  guiManager()->updateStatus("failed to load data file");
501  }
502  }
503 }
504 
505 //
506 // const member functions
507 //
508 
509 //_______________________________________________________________________________
510 void
512 {
514 
515  // case when start with no input file
517  {
518  if (m_monitor.get())
520  return;
521  }
522 
523  bool reachedEnd = (forward() && m_navigator->isLastEvent()) || (!forward() && m_navigator->isFirstEvent());
524 
525  if (loop() && reachedEnd)
526  {
527  forward() ? m_navigator->firstEvent() : m_navigator->lastEvent();
528  draw();
529  }
530  else if (!reachedEnd)
531  {
532  forward() ? m_navigator->nextEvent() : m_navigator->previousEvent();
533  draw();
534  }
535 
536  // stop loop in case no loop or monitor mode
537  if (reachedEnd && (loop() || m_monitor.get()) == kFALSE)
538  {
539  if (forward() && m_navigator->isLastEvent())
540  {
542  checkPosition();
543  }
544 
545  if ((!forward()) && m_navigator->isFirstEvent())
546  {
548  checkPosition();
549  }
550  }
551  else
553 }
554 
555 //______________________________________________________________________________
556 
557 void
559 {
560  if ((m_monitor.get() || loop() ) && isPlaying())
561  return;
562 
564 
565  if (m_navigator->isFirstEvent())
567 
568  if (m_navigator->isLastEvent())
569  {
570  guiManager()->disableNext();
571  // force enable play events action in --port mode
572  if (m_monitor.get() && !guiManager()->playEventsAction()->isEnabled())
574  }
575 }
576 
577 //==============================================================================
578 void
580 {
581  guiManager()->updateStatus("Setting up data handling...");
582 
583 
584  // navigator filtering ->
585  m_navigator->fileChanged_.connect(boost::bind(&CmsShowMain::fileChangedSlot, this, _1));
586  m_navigator->editFiltersExternally_.connect(boost::bind(&FWGUIManager::updateEventFilterEnable, guiManager(), _1));
587  m_navigator->filterStateChanged_.connect(boost::bind(&CmsShowMain::navigatorChangedFilterState, this, _1));
588  m_navigator->postFiltering_.connect(boost::bind(&CmsShowMain::postFiltering, this));
589 
590  // navigator fitlering <-
593 
594  // Data handling. File related and therefore not in the base class.
595  if (guiManager()->getAction(cmsshow::sOpenData) != 0)
596  guiManager()->getAction(cmsshow::sOpenData)->activated.connect(sigc::mem_fun(*this, &CmsShowMain::openData));
597  if (guiManager()->getAction(cmsshow::sAppendData) != 0)
598  guiManager()->getAction(cmsshow::sAppendData)->activated.connect(sigc::mem_fun(*this, &CmsShowMain::appendData));
599  if (guiManager()->getAction(cmsshow::sSearchFiles) != 0)
601 
602  setupActions();
603  // init data from CmsShowNavigator configuration, can do this with signals since there were not connected yet
604  guiManager()->setFilterButtonIcon(m_navigator->getFilterState());
605 
606  for (unsigned int ii = 0; ii < m_inputFiles.size(); ++ii)
607  {
608  const std::string& fname = m_inputFiles[ii];
609  if (fname.empty())
610  continue;
611  guiManager()->updateStatus("loading data file ...");
612  if (!m_navigator->appendFile(fname, false, false))
613  {
614  guiManager()->updateStatus("failed to load data file");
615  }
616  else
617  {
618  m_loadedAnyInputFile = true;
619 
620  }
621  }
622 
624  {
625  m_navigator->firstEvent();
626  checkPosition();
627  draw();
628  }
629  else if (m_monitor.get() == 0 && (eiManager()->begin() != eiManager()->end()) )
630  openData();
631 }
632 
633 void
634 CmsShowMain::setupSocket(unsigned int iSocket)
635 {
636  m_monitor = std::auto_ptr<TMonitor>(new TMonitor);
637  TServerSocket* server = new TServerSocket(iSocket,kTRUE);
638  if (server->GetErrorCode())
639  {
640  fwLog(fwlog::kError) << "CmsShowMain::setupSocket, can't create socket on port "<< iSocket << "." << std::endl;
641  exit(0);
642  }
643  m_monitor->Add(server);
644 }
645 
646 void
648 {
649  m_monitor->Connect("Ready(TSocket*)","CmsShowMain",this,"notified(TSocket*)");
650 
651 }
652 
653 void
654 CmsShowMain::notified(TSocket* iSocket)
655 {
656  TServerSocket* server = dynamic_cast<TServerSocket*> (iSocket);
657  if (server)
658  {
659  TSocket* connection = server->Accept();
660  if (connection)
661  {
662  m_monitor->Add(connection);
663  std::stringstream s;
664  s << "received connection from "<<iSocket->GetInetAddress().GetHostName();
665  guiManager()->updateStatus(s.str().c_str());
666  }
667  }
668  else
669  {
670  char buffer[4096];
671  memset(buffer,0,sizeof(buffer));
672  if (iSocket->RecvRaw(buffer, sizeof(buffer)) <= 0)
673  {
674  m_monitor->Remove(iSocket);
675  //std::stringstream s;
676  //s << "closing connection to "<<iSocket->GetInetAddress().GetHostName();
677  //m_guiManager->updateStatus(s.str().c_str());
678  delete iSocket;
679  return;
680  }
681  std::string fileName(buffer);
682  std::string::size_type lastNonSpace = fileName.find_last_not_of(" \n\t");
683  if (lastNonSpace != std::string::npos)
684  {
685  fileName.erase(lastNonSpace+1);
686  }
687 
688  std::stringstream s;
689  s <<"New file notified '"<<fileName<<"'";
690  guiManager()->updateStatus(s.str().c_str());
691 
692  bool appended = m_navigator->appendFile(fileName, true, m_live);
693 
694  if (appended)
695  {
696  if (m_live && isPlaying() && forward())
697  m_navigator->activateNewFileOnNextEvent();
698  else if (!isPlaying())
699  checkPosition();
700 
701  // bootstrap case: --port and no input file
703  {
704  m_loadedAnyInputFile = true;
705  m_navigator->firstEvent();
706  if (!isPlaying())
707  draw();
708  }
709 
710  std::stringstream sr;
711  sr <<"New file registered '"<<fileName<<"'";
712  guiManager()->updateStatus(sr.str().c_str());
713  }
714  else
715  {
716  std::stringstream sr;
717  sr <<"New file NOT registered '"<<fileName<<"'";
718  guiManager()->updateStatus(sr.str().c_str());
719  }
720  }
721 }
722 
723 void
725 {
727  if (m_live)
728  m_navigator->resetNewFileOnNextEvent();
729  setIsPlaying(false);
731  checkPosition();
732 }
733 
734 void
736 {
738  if (m_navigator->filesNeedUpdate() == false)
739  {
740  guiManager()->setFilterButtonText(m_navigator->filterStatusMessage());
741  checkPosition();
742  }
743 }
744 
745 void
747 {
748  if (m_navigator->getFilterState() == CmsShowNavigator::kWithdrawn )
750  else
751  m_navigator->toggleFilterEnable();
752 }
753 
754 void
756 {
757  // called only if filter has changed
758  guiManager()->updateStatus("Filtering events");
759 }
760 
761 void
763 {
764  // called only filter is changed
765  guiManager()->clearStatus();
766  draw();
767  checkPosition();
768  guiManager()->setFilterButtonText(m_navigator->filterStatusMessage());
769 }
770 
771 //______________________________________________________________________________
772 
773 void
775 {
776  m_live = true;
777  m_liveTimer.reset(new SignalTimer());
778  m_liveTimer->timeout_.connect(boost::bind(&CmsShowMain::checkLiveMode,this));
779 
780  Window_t rootw, childw;
781  Int_t root_x, root_y, win_x, win_y;
782  UInt_t mask;
783  gVirtualX->QueryPointer(gClient->GetDefaultRoot()->GetId(),
784  rootw, childw,
785  root_x, root_y,
786  win_x, win_y,
787  mask);
788 
789 
790  m_liveTimer->SetTime(m_liveTimeout);
791  m_liveTimer->Reset();
792  m_liveTimer->TurnOn();
793 }
794 
795 void
797 {
798  m_liveTimer->TurnOff();
799 
800  Window_t rootw, childw;
801  Int_t root_x, root_y, win_x, win_y;
802  UInt_t mask;
803  gVirtualX->QueryPointer(gClient->GetDefaultRoot()->GetId(),
804  rootw, childw,
805  root_x, root_y,
806  win_x, win_y,
807  mask);
808 
809 
810  if ( !isPlaying() &&
811  m_lastPointerPositionX == root_x &&
812  m_lastPointerPositionY == root_y )
813  {
815  }
816 
817  m_lastPointerPositionX = root_x;
818  m_lastPointerPositionY = root_y;
819 
820 
821  m_liveTimer->SetTime((Long_t)(m_liveTimeout));
822  m_liveTimer->Reset();
823  m_liveTimer->TurnOn();
824 }
DieTimer(CmsShowMain *app)
Definition: CmsShowMain.cc:355
void fileChangedSlot(const TFile *file)
Definition: CmsShowMain.cc:412
static const char *const kPlayCommandOpt
Definition: CmsShowMain.cc:80
static const char *const kNoVersionCheck
Definition: CmsShowMain.cc:104
void navigatorChangedFilterState(int)
Definition: CmsShowMain.cc:735
void openData()
Definition: CmsShowMain.cc:433
const fwlite::Event * getCurrentEvent() const
Definition: CmsShowMain.cc:404
CmsShowMain * fApp
Definition: CmsShowMain.cc:353
static const char *const kGeomFileCommandOpt
Definition: CmsShowMain.cc:74
void showEventFilterGUI(const TGWindow *p)
FWSelectionManager * selectionManager()
sigc::signal< void > filterButtonClicked_
Definition: FWGUIManager.h:207
static const char *const kChainCommandOpt
Definition: CmsShowMain.cc:97
static const char *const kAutoSaveAllViews
Definition: CmsShowMain.cc:101
bool m_loadedAnyInputFile
Definition: CmsShowMain.h:120
void resetInitialization()
Definition: CmsShowMain.cc:429
virtual void checkPosition()
Definition: CmsShowMain.cc:558
virtual void eventChangedImp()
Definition: CmsShowMain.cc:422
FWGUIManager * guiManager()
static const char *const kZeroWinOffsets
Definition: CmsShowMain.cc:103
void appendData()
Definition: CmsShowMain.cc:457
void preFiltering()
Definition: CmsShowMain.cc:755
void setupSocket(unsigned int)
Definition: CmsShowMain.cc:634
void setFilterButtonIcon(int)
void checkLiveMode()
Definition: CmsShowMain.cc:796
static const char *const kFieldCommandOpt
Definition: CmsShowMain.cc:99
Int_t m_lastPointerPositionX
Definition: CmsShowMain.h:129
void enable()
Definition: CSGAction.cc:274
FWEventItemsManager * eiManager()
sigc::signal< void > activated
Definition: CSGAction.h:89
static const char *const kLogLevelOpt
Definition: CmsShowMain.cc:86
static const char *const kSimGeomFileOpt
Definition: CmsShowMain.cc:75
std::auto_ptr< FWLiteJobMetadataManager > m_metadataManager
Definition: CmsShowMain.h:116
static const char *const kNoConfigFileOpt
Definition: CmsShowMain.cc:77
const char * configFilename() const
const std::string sOpenData
Definition: ActionsList.cc:12
void setup(FWNavigatorBase *navigator, fireworks::Context *context, FWJobMetadataManager *metadataManager)
void updateStatus(const char *status)
void setContext(fireworks::Context *)
virtual ~CmsShowMain()
Definition: CmsShowMain.cc:344
uint16_t size_type
static const char *const kConfigFileCommandOpt
Definition: CmsShowMain.cc:72
void setupDataHandling()
Definition: CmsShowMain.cc:579
void enableActions(bool enable=true)
virtual void autoLoadNewEvent()
Definition: CmsShowMain.cc:511
std::auto_ptr< SignalTimer > m_liveTimer
Definition: CmsShowMain.h:127
static const char *const kAdvancedRenderOpt
Definition: CmsShowMain.cc:89
CmsShowMain(int argc, char *argv[])
Definition: CmsShowMain.cc:110
static const char *const kGeomFileOpt
Definition: CmsShowMain.cc:73
std::auto_ptr< fireworks::Context > m_context
Definition: CmsShowMain.h:117
LogLevel
Definition: fwLog.h:36
void setupAutoLoad(float x)
static const char *const kPortCommandOpt
Definition: CmsShowMain.cc:94
void setGeometryFilename(const std::string &filename)
static const char *const kPlayOpt
Definition: CmsShowMain.cc:79
void filterButtonClicked()
Definition: CmsShowMain.cc:746
void resetWMOffsets()
const std::string sAppendData
Definition: ActionsList.cc:13
bool loop() const
CmsShowTaskExecutor * startupTasks()
virtual Bool_t isEnabled() const
Definition: CSGAction.cc:298
std::auto_ptr< TMonitor > m_monitor
Definition: CmsShowMain.h:134
sigc::signal< void, const TGWindow * > showEventFilterGUI_
Definition: FWGUIManager.h:208
static const char *const kEveOpt
Definition: CmsShowMain.cc:87
virtual void quit()
Definition: CmsShowMain.cc:369
virtual void eventChangedImp()
static const char *const kConfigFileOpt
Definition: CmsShowMain.cc:71
static const char *const kFreePaletteCommandOpt
Definition: CmsShowMain.cc:100
static const char *const kLoopOpt
Definition: CmsShowMain.cc:81
static const char *const kDebugCommandOpt
Definition: CmsShowMain.cc:84
static const char *const kEveCommandOpt
Definition: CmsShowMain.cc:88
double f[11][100]
static const char *const kSoftCommandOpt
Definition: CmsShowMain.cc:93
static const char *const kLogLevelCommandOpt
Definition: CmsShowMain.cc:85
CmsShowMainFrame * getMainFrame() const
Definition: FWGUIManager.h:201
void disablePrevious()
static const char *const kNoConfigFileCommandOpt
Definition: CmsShowMain.cc:78
static const char *const kEnableFPE
Definition: CmsShowMain.cc:102
std::vector< std::string > m_inputFiles
Definition: CmsShowMain.h:119
void setLiveMode()
Definition: CmsShowMain.cc:774
void setIsPlaying(bool value)
void setSimGeometryFilename(const std::string &filename)
void clearStatus()
unsigned int UInt_t
Definition: FUTypes.h:12
const_iterator begin() const
NOTE: iterator is allowed to return a null object for items that have been removed.
static const char *const kDebugOpt
Definition: CmsShowMain.cc:83
CSGAction * getAction(const std::string name)
static const char *const kLiveCommandOpt
Definition: CmsShowMain.cc:98
void updateEventFilterEnable(bool)
static const char *const kHelpCommandOpt
Definition: CmsShowMain.cc:92
static const char *const kInputFilesCommandOpt
Definition: CmsShowMain.cc:70
#define fwLog(_level_)
Definition: fwLog.h:51
static const char *const kInputFilesOpt
Definition: CmsShowMain.cc:69
static const char *const kPlainRootCommandOpt
Definition: CmsShowMain.cc:95
const TFile * m_openFile
Definition: CmsShowMain.h:121
void setAutoSaveAllViewsFormat(const std::string &fmt)
std::auto_ptr< CmsShowNavigator > m_navigator
Definition: CmsShowMain.h:115
void setFilterButtonText(const char *txt)
std::auto_ptr< CmsShowSearchFiles > m_searchFiles
Definition: CmsShowMain.h:123
char state
Definition: procUtils.cc:75
static const char *const kRootInteractiveCommandOpt
Definition: CmsShowMain.cc:96
CSGContinuousAction * playEventsAction()
string fname
main script
bool m_noVersionCheck
Definition: CmsShowMain.h:132
static const char *const kAdvancedRenderCommandOpt
Definition: CmsShowMain.cc:90
void doExit()
Definition: CmsShowMain.cc:374
bool isPlaying() const
boost::function0< void > TaskFunctor
void showEventFilterGUI()
void addTask(const TaskFunctor &iTask)
int m_liveTimeout
Definition: CmsShowMain.h:128
void evePreTerminate()
void setMaxNumberOfFilesToChain(unsigned int i)
static void enable()
enable automatic library loading
tuple cout
Definition: gather_cfg.py:41
virtual void stopPlaying()
Definition: CmsShowMain.cc:724
void notified(TSocket *)
Definition: CmsShowMain.cc:654
tuple level
Definition: testEve_cfg.py:34
bool forward() const
string s
Definition: asciidump.py:422
const std::string & geometryFilename(void)
static void EnableFreePalette()
Int_t m_lastPointerPositionY
Definition: CmsShowMain.h:130
void setPresentLogLevel(LogLevel)
Definition: fwLog.cc:56
static const char *const kSimGeomFileCommandOpt
Definition: CmsShowMain.cc:76
void connectSocket()
Definition: CmsShowMain.cc:647
void titleChanged(const char *title)
static const char *const kHelpOpt
Definition: CmsShowMain.cc:91
void disableNext()
static const char *const kLoopCommandOpt
Definition: CmsShowMain.cc:82
void postFiltering()
Definition: CmsShowMain.cc:762
void openDataViaURL()
Definition: CmsShowMain.cc:482
void reachedEnd()
void setConfigFilename(const std::string &f)
T get(const Candidate &c)
Definition: component.h:56
const_iterator end() const
const std::string sSearchFiles
Definition: ActionsList.cc:14
virtual Bool_t Notify()
Definition: CmsShowMain.cc:360