|
|
Go to the documentation of this file.
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),
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);
165 kGeomFileCommandOpt, po::value<std::string>(),
"Reco geometry file. Default is cmsGeom10.root")(
167 po::value<std::string>(),
168 "Geometry file for browsing in table view. Default is CmsSimGeom-14.root. Can be simulation or reco geometry in "
169 "TGeo format")(
kTGeoNameCommandOpt, po::value<std::string>(),
"TGeoManager name. The default is \"cmsGeo;1\"")(
170 kFieldCommandOpt, po::value<double>(),
"Set magnetic field value explicitly. Default is auto-field estimation")(
172 kSoftCommandOpt,
"Try to force software rendering to avoid problems with bad hardware drivers")(
175 po::options_description livedesc(
"Live Event Display");
176 livedesc.add_options()(
177 kPlayCommandOpt, po::value<float>(),
"Start in play mode with given interval between events in seconds")(
178 kPortCommandOpt, po::value<unsigned int>(),
"Listen to port for new data files to open")(
181 po::value<unsigned int>(),
182 "Chain up to a given number of recently open files. Default is 1 - no chain")(
183 kLiveCommandOpt,
"Enforce playback mode if a user is not using display")(
185 po::value<std::string>(),
186 "Auto-save all views with given prefix (run_event_lumi_view.<auto-save-type> is appended)")(
187 kAutoSaveType, po::value<std::string>(),
"Image type of auto-saved views, png or jpg (png is default)")(
188 kAutoSaveHeight, po::value<int>(),
"Screenshots height when auto-save-all-views is enabled")(
191 po::options_description debugdesc(
"Debug");
193 po::value<unsigned int>(),
194 "Set log level starting from 0 to 4 : kDebug, kInfo, kWarning, kError")(
196 "Enable detection of floating-point exceptions");
198 po::options_description tcachedesc(
"TreeCache");
199 tcachedesc.add_options()(
kLogTreeCacheOpt,
"Log tree cache operations and status")(
200 kSizeTreeCacheOpt, po::value<int>(),
"Set size of TTreeCache for data access in MB (default is 50)")(
203 po::options_description rnrdesc(
"Appearance");
204 rnrdesc.add_options()(
kFreePaletteCommandOpt,
"Allow free color selection (requires special configuration!)")(
206 "Enable line anti-aliasing");
207 po::positional_options_description
p;
210 po::options_description hiddendesc(
"hidden");
211 hiddendesc.add_options();
213 po::options_description
all(
"");
214 all.add(
desc).add(rnrdesc).add(livedesc).add(debugdesc).add(tcachedesc);
217 char** newArgv =
argv;
218 po::variables_map vm;
220 po::store(po::command_line_parser(newArgc, newArgv).
options(
all).positional(
p).
run(), vm);
254 throw std::runtime_error(
"tree-cache-size should be non negative");
256 throw std::runtime_error(
"tree-cache-size should be smaller than 8 GB");
257 fwLog(
fwlog::kInfo) <<
"Setting default TTreeCache size to " << ds <<
" MB." << std::endl;
266 const char* cmspath = gSystem->Getenv(
"CMSSW_BASE");
267 if (
nullptr == cmspath) {
268 throw std::runtime_error(
"CMSSW_BASE environment variable not set");
321 bool eveMode = vm.count(
kEveOpt);
327 TEveManager::Create(kFALSE, eveMode ?
"FIV" :
"FI");
349 TEveLine::SetDefaultSmooth(kTRUE);
401 if (
type !=
"png" &&
type !=
"jpg") {
407 fmt +=
"%u_%u_%llu_%s.";
421 gSystem->SetFPEMask();
466 gSystem->ProcessEvents();
488 return static_cast<const fwlite::Event*>(
m_navigator->getCurrentEvent());
518 const char* kRootType[] = {
"ROOT files",
"*.root",
nullptr,
nullptr};
520 fi.fFileTypes = kRootType;
525 fi.fIniDir =
new char[128];
526 strncpy(fi.fIniDir,
".", 127);
542 const char* kRootType[] = {
"ROOT files",
"*.root",
nullptr,
nullptr};
544 fi.fFileTypes = kRootType;
549 fi.fIniDir =
new char[128];
550 strncpy(fi.fIniDir,
".", 127);
555 m_navigator->appendFile(fi.fFilename,
false,
false);
567 std::make_unique<CmsShowSearchFiles>(
"",
"Open Remote Data Files",
guiManager()->getMainFrame(), 500, 400);
568 m_searchFiles->CenterOnParent(kTRUE, TGTransientFrame::kBottomRight);
571 if (!chosenFile.empty()) {
721 m_monitor = std::make_unique<TMonitor>();
722 TServerSocket*
server =
new TServerSocket(iSocket, kTRUE);
723 if (
server->GetErrorCode()) {
724 fwLog(
fwlog::kError) <<
"CmsShowMain::setupSocket, can't create socket on port " << iSocket <<
"." << std::endl;
733 TServerSocket*
server = dynamic_cast<TServerSocket*>(iSocket);
735 TSocket* connection =
server->Accept();
739 s <<
"received connection from " << iSocket->GetInetAddress().GetHostName();
755 if (lastNonSpace != std::string::npos) {
760 s <<
"New file notified '" <<
fileName <<
"'";
779 std::stringstream sr;
780 sr <<
"New file registered '" <<
fileName <<
"'";
783 std::stringstream sr;
784 sr <<
"New file NOT registered '" <<
fileName <<
"'";
792 Int_t keycode = gVirtualX->KeysymToKeycode((
int)kKey_Space);
794 gVirtualX->GrabKey(
id, keycode, 0,
isPlaying());
843 Window_t rootw, childw;
844 Int_t root_x, root_y, win_x, win_y;
846 gVirtualX->QueryPointer(gClient->GetDefaultRoot()->GetId(), rootw, childw, root_x, root_y, win_x, win_y, mask);
856 #if defined(R__LINUX)
857 TGX11* x11 = dynamic_cast<TGX11*>(gVirtualX);
859 XAnyEvent*
ev = (XAnyEvent*)x11->GetNativeEvent();
const char * configFilename() const
static const char *const kEnableFPE
static const char *const kLogLevelCommandOpt
const std::string sSearchFiles
FWConfigurationManager * configurationManager()
sigc::signal< void > filterButtonClicked_
void setupConfiguration()
virtual void eventChangedImp()
static void SetDefaultCacheSize(int def_size)
void enableActions(bool enable=true)
static const char *const kEveCommandOpt
void setFilterButtonIcon(int)
static const char *const kSoftCommandOpt
FWGUIManager * guiManager()
static const char *const kNoConfigFileCommandOpt
void stopPlaying() override
void enableNavigatorControls()
CSGContinuousAction * playEventsAction()
CmsShowMain(int argc, char *argv[])
static const char *const kLiveCommandOpt
static const char *const kInputFilesCommandOpt
static const char *const kInputFilesOpt
static const char *const kHelpCommandOpt
static const char *const kPrefetchTreeCacheOpt
static const char *const kPlainRootCommandOpt
void applyGlobalTag(const std::string >)
void setSimGeometryFilename(const std::string &filename, const std::string &geoname)
void setLoadedAnyInputFileAfterStartup()
static const char *const kRootInteractiveCommandOpt
static const char *const kAutoSaveType
void setup(FWNavigatorBase *navigator, fireworks::Context *context, FWJobMetadataManager *metadataManager)
std::unique_ptr< CmsShowNavigator > m_navigator
static const char *const kAdvancedRenderCommandOpt
void navigatorChangedFilterState(int)
void setAutoSaveAllViewsHeight(int x)
sigc::signal< void, const TGWindow * > showEventFilterGUI_
std::unique_ptr< fireworks::Context > m_context
void titleChanged(const char *title)
void setConfigFilename(const std::string &f)
void checkPosition() override
void setupSocket(unsigned int)
bool m_loadedAnyInputFile
std::unique_ptr< FWLiteJobMetadataManager > m_metadataManager
void resetInitialization()
CmsShowMainFrame * getMainFrame() const
const std::string sOpenData
CSGAction * getAction(const std::string name)
void updateStatus(const char *status)
static const char *const kLoopCommandOpt
static const char *const kAutoSaveHeight
void setAutoSaveAllViewsFormat(const std::string &fmt)
void autoLoadNewEvent() override
ESource getSource() const
static const char *const kSimGeomFileCommandOpt
static const char *const kSizeTreeCacheOpt
sigc::signal< void > activated
static const char *const kPlayCommandOpt
static const char *const kHelpOpt
void setupAutoLoad(float x)
static const char *const kGeomFileCommandOpt
CmsShowTaskExecutor * startupTasks()
virtual void stopPlaying()
static const char *const kChainCommandOpt
void resetFieldEstimate() const
void startAutoLoadTimer()
static void enable()
enable automatic library loading
static void syncAllViews()
void setMaxNumberOfFilesToChain(unsigned int i)
static const char *const kNoVersionCheck
static const char *const kZeroWinOffsets
const std::string & geometryFilename(void)
static void PrefetchingOn()
const_iterator end() const
static const char *const kSyncAllViews
FWGeometry * getGeom() const
void showEventFilterGUI(const TGWindow *p)
const std::string sAppendData
static const char *const kAutoSaveAllViews
const fwlite::Event * getCurrentEvent() const
static const char *const kFieldCommandOpt
void setGeometryFilename(const std::string &filename)
static const char *const kLogTreeCacheOpt
UInt_t m_lastXEventSerial
void filterButtonClicked()
void setFilterButtonText(const char *txt)
FWSelectionManager * selectionManager()
static const char *const kSimGeomFileOpt
void setPresentLogLevel(LogLevel)
static FWGUIManager * getGUIManager()
std::unique_ptr< TMonitor > m_monitor
void startDoingTasks() override
FWMagField * getField() const
const_iterator begin() const
NOTE: iterator is allowed to return a null object for items that have been removed.
std::vector< std::string > m_inputFiles
std::unique_ptr< SignalTimer > m_liveTimer
void showEventFilterGUI()
static const char *const kTGeoNameCommandOpt
void setContext(fireworks::Context *)
static const char *const kNoConfigFileOpt
virtual Bool_t isEnabled() const
const fireworks::Context * context() const
std::function< void()> TaskFunctor
DieTimer(CmsShowMain *app)
static const char *const kAdvancedRenderOpt
void fileChangedSlot(const TFile *file)
static const char *const kGeomFileOpt
void addTask(const TaskFunctor &iTask)
static const char *const kTGeoNameOpt
static Context * getInstance()
static const char *const kPortCommandOpt
void eventChangedImp() override
static const char *const kConfigFileCommandOpt
FWEventItemsManager * eiManager()
static const char *const kExpertCommandOpt
static const char *const kEveOpt
static const char *const kPlayOpt
void updateEventFilterEnable(bool)
static const char *const kLoopOpt
static const char *const kFreePaletteCommandOpt
void checkKeyBindingsOnPLayEventsStateChanged() override
static const char *const kConfigFileOpt
std::unique_ptr< CmsShowSearchFiles > m_searchFiles