18 #include <boost/program_options.hpp> 22 #include "TGLWidget.h" 25 #include "TGFileDialog.h" 28 #include "TServerSocket.h" 30 #include "TEveManager.h" 33 #include "TVirtualX.h" 34 #include <KeySymbols.h> 132 changeManager(), selectionManager(), eiManager(), colorManager(), m_metadataManager.
get())),
133 m_loadedAnyInputFile(
false),
136 m_liveTimer(new SignalTimer()),
137 m_liveTimeout(600000),
138 m_lastXEventSerial(0),
139 m_noVersionCheck(
false),
140 m_globalTagCheck(
true) {
142 TGLWidget*
w = TGLWidget::Create(gClient->GetDefaultRoot(), kTRUE, kTRUE,
nullptr, 10, 10);
148 "- Is DISPLAY environment variable set?\n" 149 "- Are OpenGL libraries installed?\n" 150 "- If running remotely, make sure you use 'ssh -X' or 'ssh -Y'.\n" 151 "See also: https://twiki.cern.ch/twiki/bin/viewauth/CMS/WorkBookFireworks\n";
158 descString +=
" [options] <data file>\nGeneral";
160 namespace po = boost::program_options;
161 po::options_description
desc(descString);
166 kGeomFileCommandOpt, po::value<std::string>(),
"Reco geometry file. Default is cmsGeom10.root")(
168 po::value<std::string>(),
169 "Geometry file for browsing in table view. Default is CmsSimGeom-14.root. Can be simulation or reco geometry in " 170 "TGeo format")(
kTGeoNameCommandOpt, po::value<std::string>(),
"TGeoManager name. The default is \"cmsGeo;1\"")(
171 kFieldCommandOpt, po::value<double>(),
"Set magnetic field value explicitly. Default is auto-field estimation")(
173 kSoftCommandOpt,
"Try to force software rendering to avoid problems with bad hardware drivers")(
176 po::options_description livedesc(
"Live Event Display");
177 livedesc.add_options()(
178 kPlayCommandOpt, po::value<float>(),
"Start in play mode with given interval between events in seconds")(
179 kPortCommandOpt, po::value<unsigned int>(),
"Listen to port for new data files to open")(
182 po::value<unsigned int>(),
183 "Chain up to a given number of recently open files. Default is 1 - no chain")(
184 kLiveCommandOpt,
"Enforce playback mode if a user is not using display")(
186 po::value<std::string>(),
187 "Auto-save all views with given prefix (run_event_lumi_view.<auto-save-type> is appended)")(
188 kAutoSaveType, po::value<std::string>(),
"Image type of auto-saved views, png or jpg (png is default)")(
189 kAutoSaveHeight, po::value<int>(),
"Screenshots height when auto-save-all-views is enabled")(
193 po::options_description debugdesc(
"Debug");
195 po::value<unsigned int>(),
196 "Set log level starting from 0 to 4 : kDebug, kInfo, kWarning, kError")(
198 "Enable detection of floating-point exceptions");
200 po::options_description tcachedesc(
"TreeCache");
201 tcachedesc.add_options()(
kLogTreeCacheOpt,
"Log tree cache operations and status")(
202 kSizeTreeCacheOpt, po::value<int>(),
"Set size of TTreeCache for data access in MB (default is 50)")(
205 po::options_description rnrdesc(
"Appearance");
206 rnrdesc.add_options()(
kFreePaletteCommandOpt,
"Allow free color selection (requires special configuration!)")(
208 "Enable line anti-aliasing");
209 po::positional_options_description
p;
212 po::options_description hiddendesc(
"hidden");
213 hiddendesc.add_options();
215 po::options_description
all(
"");
216 all.add(
desc).add(rnrdesc).add(livedesc).add(debugdesc).add(tcachedesc);
219 char** newArgv =
argv;
220 po::variables_map vm;
222 po::store(po::command_line_parser(newArgc, newArgv).
options(
all).positional(
p).
run(), vm);
256 throw std::runtime_error(
"tree-cache-size should be non negative");
258 throw std::runtime_error(
"tree-cache-size should be smaller than 8 GB");
259 fwLog(
fwlog::kInfo) <<
"Setting default TTreeCache size to " << ds <<
" MB." << std::endl;
268 const char* cmspath = gSystem->Getenv(
"CMSSW_BASE");
269 if (
nullptr == cmspath) {
270 throw std::runtime_error(
"CMSSW_BASE environment variable not set");
323 bool eveMode = vm.count(
kEveOpt);
329 TEveManager::Create(kFALSE, eveMode ?
"FIV" :
"FI");
351 TEveLine::SetDefaultSmooth(kTRUE);
403 if (
type !=
"png" &&
type !=
"jpg") {
409 fmt +=
"%u_%u_%llu_%s.";
423 gSystem->SetFPEMask();
468 gSystem->ProcessEvents();
490 return static_cast<const fwlite::Event*>(
m_navigator->getCurrentEvent());
520 const char* kRootType[] = {
"ROOT files",
"*.root",
nullptr,
nullptr};
522 fi.fFileTypes = kRootType;
527 fi.fIniDir =
new char[128];
528 strncpy(fi.fIniDir,
".", 127);
544 const char* kRootType[] = {
"ROOT files",
"*.root",
nullptr,
nullptr};
546 fi.fFileTypes = kRootType;
551 fi.fIniDir =
new char[128];
552 strncpy(fi.fIniDir,
".", 127);
557 m_navigator->appendFile(fi.fFilename,
false,
false);
569 std::make_unique<CmsShowSearchFiles>(
"",
"Open Remote Data Files",
guiManager()->
getMainFrame(), 500, 400);
570 m_searchFiles->CenterOnParent(kTRUE, TGTransientFrame::kBottomRight);
573 if (!chosenFile.empty()) {
723 m_monitor = std::make_unique<TMonitor>();
724 TServerSocket*
server =
new TServerSocket(iSocket, kTRUE);
725 if (
server->GetErrorCode()) {
726 fwLog(
fwlog::kError) <<
"CmsShowMain::setupSocket, can't create socket on port " << iSocket <<
"." << std::endl;
735 TServerSocket*
server =
dynamic_cast<TServerSocket*
>(iSocket);
737 TSocket* connection =
server->Accept();
741 s <<
"received connection from " << iSocket->GetInetAddress().GetHostName();
757 if (lastNonSpace != std::string::npos) {
762 s <<
"New file notified '" <<
fileName <<
"'";
781 std::stringstream sr;
782 sr <<
"New file registered '" <<
fileName <<
"'";
785 std::stringstream sr;
786 sr <<
"New file NOT registered '" <<
fileName <<
"'";
794 Int_t keycode = gVirtualX->KeysymToKeycode((
int)kKey_Space);
796 gVirtualX->GrabKey(
id, keycode, 0,
isPlaying());
845 Window_t rootw, childw;
846 Int_t root_x, root_y, win_x, win_y;
848 gVirtualX->QueryPointer(gClient->GetDefaultRoot()->GetId(), rootw, childw, root_x, root_y, win_x, win_y,
mask);
858 #if defined(R__LINUX) 859 TGX11* x11 =
dynamic_cast<TGX11*
>(gVirtualX);
861 XAnyEvent*
ev = (XAnyEvent*)x11->GetNativeEvent();
DieTimer(CmsShowMain *app)
void fileChangedSlot(const TFile *file)
static const char *const kPlayCommandOpt
static const char *const kNoVersionCheck
void navigatorChangedFilterState(int)
void startAutoLoadTimer()
static void PrefetchingOn()
static const char *const kGeomFileCommandOpt
void setLoadedAnyInputFileAfterStartup()
void showEventFilterGUI(const TGWindow *p)
FWSelectionManager * selectionManager()
static const char *const kChainCommandOpt
static const char *const kAutoSaveAllViews
void checkPosition() override
bool m_loadedAnyInputFile
void resetFieldEstimate() const
void eventChangedImp() override
void resetInitialization()
FWGUIManager * guiManager()
static const char *const kZeroWinOffsets
void setupSocket(unsigned int)
void setFilterButtonIcon(int)
static const char *const kSyncAllViews
static const char *const kFieldCommandOpt
void setAutoSaveAllViewsHeight(int x)
static const char *const kLogTreeCacheOpt
std::unique_ptr< CmsShowSearchFiles > m_searchFiles
void startDoingTasks() override
FWEventItemsManager * eiManager()
std::function< void()> TaskFunctor
void checkKeyBindingsOnPLayEventsStateChanged() override
static const char *const kSimGeomFileOpt
static const char *const kTGeoNameCommandOpt
static const char *const kNoConfigFileOpt
const std::string sOpenData
void setup(FWNavigatorBase *navigator, fireworks::Context *context, FWJobMetadataManager *metadataManager)
void updateStatus(const char *status)
void setContext(fireworks::Context *)
static const char *const kTGeoNameOpt
void enableNavigatorControls()
static const char *const kConfigFileCommandOpt
void stopPlaying() override
void enableActions(bool enable=true)
static const char *const kExpertCommandOpt
CmsShowMainFrame * getMainFrame() const
static const char *const kAdvancedRenderOpt
CmsShowMain(int argc, char *argv[])
static const char *const kGeomFileOpt
const char * configFilename() const
void setupAutoLoad(float x)
static const char *const kPortCommandOpt
void setGeometryFilename(const std::string &filename)
static const char *const kPlayOpt
virtual void stopPlaying()
void filterButtonClicked()
FWGeometry * getGeom() const
const std::string sAppendData
CmsShowTaskExecutor * startupTasks()
std::unique_ptr< TMonitor > m_monitor
UInt_t m_lastXEventSerial
std::unique_ptr< CmsShowNavigator > m_navigator
static const char *const kEveOpt
std::unique_ptr< fireworks::Context > m_context
virtual void eventChangedImp()
static void enable()
enable automatic library loading
std::unique_ptr< FWLiteJobMetadataManager > m_metadataManager
static const char *const kConfigFileOpt
static const char *const kFreePaletteCommandOpt
static const char *const kLoopOpt
void setupConfiguration()
static const char *const kEveCommandOpt
void setSimGeometryFilename(const std::string &filename, const std::string &geoname)
static const char *const kSoftCommandOpt
std::unique_ptr< SignalTimer > m_liveTimer
static const char *const kLogLevelCommandOpt
static const char *const kNoConfigFileCommandOpt
static const char *const kEnableFPE
std::vector< std::string > m_inputFiles
static Context * getInstance()
static const char *const kPrefetchTreeCacheOpt
void autoLoadNewEvent() override
CSGAction * getAction(const std::string name)
static const char *const kLiveCommandOpt
void updateEventFilterEnable(bool)
static const char *const kHelpCommandOpt
static FWGUIManager * getGUIManager()
static const char *const kInputFilesCommandOpt
static const char *const kInputFilesOpt
static const char *const kPlainRootCommandOpt
virtual Bool_t isEnabled() const
void setAutoSaveAllViewsFormat(const std::string &fmt)
void setFilterButtonText(const char *txt)
static const char *const kAutoSaveType
static const char *const kRootInteractiveCommandOpt
CSGContinuousAction * playEventsAction()
static const char *const kAdvancedRenderCommandOpt
const fwlite::Event * getCurrentEvent() const
FWConfigurationManager * configurationManager()
void showEventFilterGUI()
void addTask(const TaskFunctor &iTask)
void setMaxNumberOfFilesToChain(unsigned int i)
sigc::signal< void()> activated
const_iterator begin() const
NOTE: iterator is allowed to return a null object for items that have been removed.
void applyGlobalTag(const std::string >)
sigc::signal< void()> filterButtonClicked_
const_iterator end() const
const std::string & geometryFilename(void)
void setPresentLogLevel(LogLevel)
static const char *const kSizeTreeCacheOpt
static const char *const kSimGeomFileCommandOpt
sigc::signal< void(const TGWindow *)> showEventFilterGUI_
static void syncAllViews()
ESource getSource() const
void titleChanged(const char *title)
static const char *const kHelpOpt
static void SetDefaultCacheSize(int def_size)
static const char *const kLoopCommandOpt
static const char *const kAutoSaveHeight
void setConfigFilename(const std::string &f)
FWMagField * getField() const
const fireworks::Context * context() const
const std::string sSearchFiles