3 #include "TEveManager.h"
5 #include "TApplication.h"
6 #include "TSysEvtHandler.h"
32 SilentMLscribe(
const SilentMLscribe&) =
delete;
34 const SilentMLscribe&
operator=(
const SilentMLscribe&) =
delete;
63 void signal_handler_wrapper(
int sid, siginfo_t* sinfo,
void* sctx) {
65 std::cerr <<
"Program received signal ID = " << sid << std::endl;
66 std::cerr <<
"Printing stack trace ... " << std::endl;
68 TString gdbCommand(
"scripts/gdb-backtrace.sh");
72 gdbCommand += gSystem->GetPid();
74 gSystem->Exec(gdbCommand.Data());
76 Getlinem(kCleanUp,
nullptr);
84 std::shared_ptr<edm::service::AbstractMLscribe>(std::make_shared<SilentMLscribe>()));
87 std::unique_ptr<CmsShowMain> pMain(
new CmsShowMain(argc, argv));
91 gSystem->ResetSignal(kSigBus);
92 gSystem->ResetSignal(kSigSegmentationViolation);
93 gSystem->ResetSignal(kSigIllegalInstruction);
94 gSystem->ResetSignal(kSigSystem);
95 gSystem->ResetSignal(kSigPipe);
96 gSystem->ResetSignal(kSigFloatingException);
99 sac.sa_sigaction = signal_handler_wrapper;
100 sigemptyset(&sac.sa_mask);
101 sac.sa_flags = SA_SIGINFO;
102 sigaction(SIGILL, &sac,
nullptr);
103 sigaction(SIGSEGV, &sac,
nullptr);
104 sigaction(SIGBUS, &sac,
nullptr);
105 sigaction(SIGFPE, &sac,
nullptr);
110 TEveManager::Terminate();
118 const char* dummyArgvArray[] = {
"cmsShow"};
119 char** dummyArgv =
const_cast<char**
>(dummyArgvArray);
121 gEnv->SetValue(
"Gui.BackgroundColor",
"#9f9f9f");
125 if (gSystem->Getenv(
"CMSSW_VERSION")) {
126 infoText = gSystem->Getenv(
"CMSSW_VERSION");
128 TString infoFileName(
"data/version.txt");
130 std::ifstream infoFile(infoFileName);
131 infoText.ReadLine(infoFile);
134 printf(
"Starting cmsShow, version %s.\n", infoText.Data());
139 for (Int_t
i = 0;
i <
argc;
i++) {
140 if (strncmp(argv[
i],
"-r", 2) == 0 || strncmp(argv[i],
"--root", 6) == 0) {
148 std::cerr <<
"WARNING:You are running cmsShow with ROOT prompt enabled." << std::endl;
149 std::cerr <<
"If you encounter an issue you suspect to be a bug in " << std::endl;
150 std::cerr <<
"cmsShow, please re-run without this option and try to " << std::endl;
151 std::cerr <<
"reproduce it before submitting a bug-report. " << std::endl;
154 TRint app(
"cmsShow", &dummyArgc, dummyArgv);
157 TApplication app(
"cmsShow", &dummyArgc, dummyArgv);
161 std::cerr <<
"CmsShow unhandled exception " << iException.what() << std::endl;
static unsigned char messageLoggerScribeIsRunning
void run_app(TApplication &app, int argc, char **argv)
static MessageDrop * instance()
static const unsigned char MLSCRIBE_RUNNING_INDICATOR
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
static void setMLscribe_ptr(std::shared_ptr< edm::service::AbstractMLscribe > m)
void operator=(AbstractMLscribe const &)=delete
virtual void runCommand(MessageLoggerQ::OpCode opcode, void *operand)