|
|
Go to the documentation of this file.
15 #include <boost/bind.hpp>
16 #include <boost/program_options.hpp>
20 #include "TGLWidget.h"
23 #include "TGFileDialog.h"
26 #include "TServerSocket.h"
28 #include "TEveManager.h"
31 #include "TVirtualX.h"
32 #include <KeySymbols.h>
130 changeManager(), selectionManager(), eiManager(), colorManager(), m_metadataManager.
get())),
131 m_loadedAnyInputFile(
false),
135 m_liveTimeout(600000),
136 m_lastXEventSerial(0),
137 m_noVersionCheck(
false),
138 m_globalTagCheck(
true) {
140 TGLWidget*
w = TGLWidget::Create(gClient->GetDefaultRoot(), kTRUE, kTRUE,
nullptr, 10, 10);
146 "- Is DISPLAY environment variable set?\n"
147 "- Are OpenGL libraries installed?\n"
148 "- If running remotely, make sure you use 'ssh -X' or 'ssh -Y'.\n"
149 "See also: https://twiki.cern.ch/twiki/bin/viewauth/CMS/WorkBookFireworks\n";
156 descString +=
" [options] <data file>\nGeneral";
158 namespace po = boost::program_options;
159 po::options_description desc(descString);
160 desc.add_options()(
kInputFilesCommandOpt, po::value<std::vector<std::string> >(),
"Input root files")(
163 kGeomFileCommandOpt, po::value<std::string>(),
"Reco geometry file. Default is cmsGeom10.root")(
165 po::value<std::string>(),
166 "Geometry file for browsing in table view. Default is CmsSimGeom-14.root. Can be simulation or reco geometry in "
167 "TGeo format")(
kTGeoNameCommandOpt, po::value<std::string>(),
"TGeoManager name. The default is \"cmsGeo;1\"")(
168 kFieldCommandOpt, po::value<double>(),
"Set magnetic field value explicitly. Default is auto-field estimation")(
170 kSoftCommandOpt,
"Try to force software rendering to avoid problems with bad hardware drivers")(
173 po::options_description livedesc(
"Live Event Display");
174 livedesc.add_options()(
175 kPlayCommandOpt, po::value<float>(),
"Start in play mode with given interval between events in seconds")(
176 kPortCommandOpt, po::value<unsigned int>(),
"Listen to port for new data files to open")(
179 po::value<unsigned int>(),
180 "Chain up to a given number of recently open files. Default is 1 - no chain")(
181 kLiveCommandOpt,
"Enforce playback mode if a user is not using display")(
183 po::value<std::string>(),
184 "Auto-save all views with given prefix (run_event_lumi_view.<auto-save-type> is appended)")(
185 kAutoSaveType, po::value<std::string>(),
"Image type of auto-saved views, png or jpg (png is default)")(
186 kAutoSaveHeight, po::value<int>(),
"Screenshots height when auto-save-all-views is enabled")(
189 po::options_description debugdesc(
"Debug");
191 po::value<unsigned int>(),
192 "Set log level starting from 0 to 4 : kDebug, kInfo, kWarning, kError")(
194 "Enable detection of floating-point exceptions");
196 po::options_description tcachedesc(
"TreeCache");
197 tcachedesc.add_options()(
kLogTreeCacheOpt,
"Log tree cache operations and status")(
198 kSizeTreeCacheOpt, po::value<int>(),
"Set size of TTreeCache for data access in MB (default is 50)")(
201 po::options_description rnrdesc(
"Appearance");
202 rnrdesc.add_options()(
kFreePaletteCommandOpt,
"Allow free color selection (requires special configuration!)")(
204 "Enable line anti-aliasing");
205 po::positional_options_description
p;
208 po::options_description hiddendesc(
"hidden");
209 hiddendesc.add_options();
211 po::options_description
all(
"");
212 all.add(desc).add(rnrdesc).add(livedesc).add(debugdesc).add(tcachedesc);
215 char** newArgv =
argv;
216 po::variables_map vm;
218 po::store(po::command_line_parser(newArgc, newArgv).
options(
all).positional(
p).
run(), vm);
252 throw std::runtime_error(
"tree-cache-size should be non negative");
254 throw std::runtime_error(
"tree-cache-size should be smaller than 8 GB");
255 fwLog(
fwlog::kInfo) <<
"Setting default TTreeCache size to " << ds <<
" MB." << std::endl;
264 const char* cmspath = gSystem->Getenv(
"CMSSW_BASE");
265 if (
nullptr == cmspath) {
266 throw std::runtime_error(
"CMSSW_BASE environment variable not set");
319 bool eveMode = vm.count(
kEveOpt);
325 TEveManager::Create(kFALSE, eveMode ?
"FIV" :
"FI");
347 TEveLine::SetDefaultSmooth(kTRUE);
399 if (
type !=
"png" &&
type !=
"jpg") {
405 fmt +=
"%u_%u_%llu_%s.";
419 gSystem->SetFPEMask();
464 gSystem->ProcessEvents();
486 return static_cast<const fwlite::Event*>(
m_navigator->getCurrentEvent());
516 const char* kRootType[] = {
"ROOT files",
"*.root",
nullptr,
nullptr};
518 fi.fFileTypes = kRootType;
523 fi.fIniDir =
new char[128];
524 strncpy(fi.fIniDir,
".", 127);
540 const char* kRootType[] = {
"ROOT files",
"*.root",
nullptr,
nullptr};
542 fi.fFileTypes = kRootType;
547 fi.fIniDir =
new char[128];
548 strncpy(fi.fIniDir,
".", 127);
553 m_navigator->appendFile(fi.fFilename,
false,
false);
566 m_searchFiles->CenterOnParent(kTRUE, TGTransientFrame::kBottomRight);
569 if (!chosenFile.empty()) {
716 m_monitor = std::unique_ptr<TMonitor>(
new TMonitor);
717 TServerSocket*
server =
new TServerSocket(iSocket, kTRUE);
718 if (
server->GetErrorCode()) {
719 fwLog(
fwlog::kError) <<
"CmsShowMain::setupSocket, can't create socket on port " << iSocket <<
"." << std::endl;
728 TServerSocket*
server = dynamic_cast<TServerSocket*>(iSocket);
730 TSocket* connection =
server->Accept();
734 s <<
"received connection from " << iSocket->GetInetAddress().GetHostName();
750 if (lastNonSpace != std::string::npos) {
755 s <<
"New file notified '" <<
fileName <<
"'";
774 std::stringstream sr;
775 sr <<
"New file registered '" <<
fileName <<
"'";
778 std::stringstream sr;
779 sr <<
"New file NOT registered '" <<
fileName <<
"'";
787 Int_t keycode = gVirtualX->KeysymToKeycode((
int)kKey_Space);
789 gVirtualX->GrabKey(
id, keycode, 0,
isPlaying());
838 Window_t rootw, childw;
839 Int_t root_x, root_y, win_x, win_y;
841 gVirtualX->QueryPointer(gClient->GetDefaultRoot()->GetId(), rootw, childw, root_x, root_y, win_x, win_y, mask);
851 #if defined(R__LINUX)
852 TGX11* x11 = dynamic_cast<TGX11*>(gVirtualX);
854 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
boost::function0< void > TaskFunctor
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
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