16 #include <boost/bind.hpp>
17 #include <boost/program_options.hpp>
21 #include "TGLWidget.h"
24 #include "TGFileDialog.h"
27 #include "TServerSocket.h"
29 #include "TEveManager.h"
114 m_context(new fireworks::
Context(changeManager(),
118 m_metadataManager.
get())),
119 m_loadedAnyInputFile(
false),
123 m_liveTimeout(600000),
124 m_lastPointerPositionX(-999),
125 m_lastPointerPositionY(-999),
126 m_noVersionCheck(
false)
129 TGLWidget* w = TGLWidget::Create(gClient->GetDefaultRoot(), kTRUE, kTRUE, 0, 10, 10);
133 std::cerr <<
"Failed creating an OpenGL window: " << iException.what() <<
"\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";
145 std::string descString(argv[0]);
146 descString +=
" [options] <data file>\nAllowed options";
148 namespace po = boost::program_options;
149 po::options_description desc(descString);
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")
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")
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")
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.")
175 po::positional_options_description
p;
179 char **newArgv = argv;
180 po::variables_map vm;
183 po::store(po::command_line_parser(newArgc, newArgv).
201 const char* cmspath = gSystem->Getenv(
"CMSSW_BASE");
203 throw std::runtime_error(
"CMSSW_BASE environment variable not set");
254 bool eveMode = vm.count(
kEveOpt);
260 TEveManager::Create(kFALSE,
"FIV");
272 TEveLine::SetDefaultSmooth(kTRUE);
322 fmt +=
"%d_%d_%d_%s.png";
329 gSystem->SetFPEMask();
383 gSystem->ProcessEvents();
407 return static_cast<const fwlite::Event*>(
m_navigator->getCurrentEvent());
435 const char* kRootType[] = {
"ROOT files",
"*.root", 0, 0};
437 fi.fFileTypes = kRootType;
442 fi.fIniDir =
new char[128];
443 strncpy(fi.fIniDir,
".", 127);
459 const char* kRootType[] = {
"ROOT files",
"*.root", 0, 0};
461 fi.fFileTypes = kRootType;
466 fi.fIniDir =
new char[128];
467 strncpy(fi.fIniDir,
".", 127);
472 m_navigator->appendFile(fi.fFilename,
false,
false);
486 "Open Remote Data Files",
489 m_searchFiles->CenterOnParent(kTRUE,TGTransientFrame::kBottomRight);
492 if(!chosenFile.empty()) {
530 else if (!reachedEnd)
606 for (
unsigned int ii = 0; ii <
m_inputFiles.size(); ++ii)
636 m_monitor = std::auto_ptr<TMonitor>(
new TMonitor);
637 TServerSocket*
server =
new TServerSocket(iSocket,kTRUE);
638 if (server->GetErrorCode())
640 fwLog(
fwlog::kError) <<
"CmsShowMain::setupSocket, can't create socket on port "<< iSocket <<
"." << std::endl;
649 m_monitor->Connect(
"Ready(TSocket*)",
"CmsShowMain",
this,
"notified(TSocket*)");
656 TServerSocket*
server =
dynamic_cast<TServerSocket*
> (iSocket);
659 TSocket* connection = server->Accept();
664 s <<
"received connection from "<<iSocket->GetInetAddress().GetHostName();
671 memset(buffer,0,
sizeof(buffer));
672 if (iSocket->RecvRaw(buffer,
sizeof(buffer)) <= 0)
683 if (lastNonSpace != std::string::npos)
685 fileName.erase(lastNonSpace+1);
689 s <<
"New file notified '"<<fileName<<
"'";
710 std::stringstream sr;
711 sr <<
"New file registered '"<<fileName<<
"'";
716 std::stringstream sr;
717 sr <<
"New file NOT registered '"<<fileName<<
"'";
780 Window_t rootw, childw;
781 Int_t root_x, root_y, win_x, win_y;
783 gVirtualX->QueryPointer(gClient->GetDefaultRoot()->GetId(),
800 Window_t rootw, childw;
801 Int_t root_x, root_y, win_x, win_y;
803 gVirtualX->QueryPointer(gClient->GetDefaultRoot()->GetId(),
818 m_lastPointerPositionY = root_y;
DieTimer(CmsShowMain *app)
void fileChangedSlot(const TFile *file)
static const char *const kPlayCommandOpt
static const char *const kNoVersionCheck
void navigatorChangedFilterState(int)
void startAutoLoadTimer()
const fwlite::Event * getCurrentEvent() const
static const char *const kGeomFileCommandOpt
void showEventFilterGUI(const TGWindow *p)
FWSelectionManager * selectionManager()
sigc::signal< void > filterButtonClicked_
static const char *const kChainCommandOpt
static const char *const kAutoSaveAllViews
bool m_loadedAnyInputFile
void resetInitialization()
virtual void checkPosition()
virtual void eventChangedImp()
FWGUIManager * guiManager()
static const char *const kZeroWinOffsets
void setupSocket(unsigned int)
void setFilterButtonIcon(int)
static const char *const kFieldCommandOpt
Int_t m_lastPointerPositionX
FWEventItemsManager * eiManager()
sigc::signal< void > activated
static const char *const kLogLevelOpt
static const char *const kSimGeomFileOpt
std::auto_ptr< FWLiteJobMetadataManager > m_metadataManager
static const char *const kNoConfigFileOpt
const char * configFilename() const
const std::string sOpenData
void setup(FWNavigatorBase *navigator, fireworks::Context *context, FWJobMetadataManager *metadataManager)
void updateStatus(const char *status)
void setContext(fireworks::Context *)
void enableNavigatorControls()
static const char *const kConfigFileCommandOpt
void enableActions(bool enable=true)
virtual void autoLoadNewEvent()
std::auto_ptr< SignalTimer > m_liveTimer
static const char *const kAdvancedRenderOpt
CmsShowMain(int argc, char *argv[])
static const char *const kGeomFileOpt
std::auto_ptr< fireworks::Context > m_context
void setupAutoLoad(float x)
static const char *const kPortCommandOpt
void setGeometryFilename(const std::string &filename)
static const char *const kPlayOpt
void filterButtonClicked()
const std::string sAppendData
CmsShowTaskExecutor * startupTasks()
virtual Bool_t isEnabled() const
std::auto_ptr< TMonitor > m_monitor
sigc::signal< void, const TGWindow * > showEventFilterGUI_
static const char *const kEveOpt
virtual void eventChangedImp()
static const char *const kConfigFileOpt
static const char *const kFreePaletteCommandOpt
static const char *const kLoopOpt
static const char *const kDebugCommandOpt
void setupConfiguration()
static const char *const kEveCommandOpt
static const char *const kSoftCommandOpt
static const char *const kLogLevelCommandOpt
CmsShowMainFrame * getMainFrame() const
static const char *const kNoConfigFileCommandOpt
static const char *const kEnableFPE
std::vector< std::string > m_inputFiles
void setIsPlaying(bool value)
void setSimGeometryFilename(const std::string &filename)
const_iterator begin() const
NOTE: iterator is allowed to return a null object for items that have been removed.
static const char *const kDebugOpt
CSGAction * getAction(const std::string name)
static const char *const kLiveCommandOpt
void updateEventFilterEnable(bool)
static const char *const kHelpCommandOpt
static const char *const kInputFilesCommandOpt
static const char *const kInputFilesOpt
static const char *const kPlainRootCommandOpt
void setAutoSaveAllViewsFormat(const std::string &fmt)
std::auto_ptr< CmsShowNavigator > m_navigator
void setFilterButtonText(const char *txt)
std::auto_ptr< CmsShowSearchFiles > m_searchFiles
static const char *const kRootInteractiveCommandOpt
CSGContinuousAction * playEventsAction()
static const char *const kAdvancedRenderCommandOpt
boost::function0< void > TaskFunctor
void showEventFilterGUI()
void addTask(const TaskFunctor &iTask)
void setMaxNumberOfFilesToChain(unsigned int i)
static void enable()
enable automatic library loading
virtual void stopPlaying()
const std::string & geometryFilename(void)
Int_t m_lastPointerPositionY
void setPresentLogLevel(LogLevel)
static const char *const kSimGeomFileCommandOpt
void titleChanged(const char *title)
static const char *const kHelpOpt
static const char *const kLoopCommandOpt
void setConfigFilename(const std::string &f)
T get(const Candidate &c)
const_iterator end() const
const std::string sSearchFiles