#include "TEnv.h"
#include "TSystem.h"
#include "TEveManager.h"
#include "TRint.h"
#include "TApplication.h"
#include "TSysEvtHandler.h"
#include "Getline.h"
#include <iostream>
#include <fstream>
#include <string.h>
#include <memory>
#include <signal.h>
#include "Fireworks/Core/src/CmsShowMain.h"
#include "Fireworks/Core/interface/fwPaths.h"
#include "FWCore/MessageLogger/interface/AbstractMLscribe.h"
#include "FWCore/MessageLogger/interface/ErrorObj.h"
#include "FWCore/MessageLogger/interface/MessageLoggerQ.h"
#include "FWCore/MessageLogger/interface/MessageDrop.h"
Go to the source code of this file.
Functions | |
int | main (int argc, char **argv) |
void | run_app (TApplication &app, int argc, char **argv) |
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 128 of file cmsShow.cc.
References benchmark_cfg::cerr, exception, i, run_app(), and fireworks::setPath().
{ const char* dummyArgvArray[] = {"cmsShow"}; char** dummyArgv = const_cast<char**>(dummyArgvArray); int dummyArgc = 1; gEnv->SetValue("Gui.BackgroundColor", "#9f9f9f"); // print version TString infoText; if (gSystem->Getenv("CMSSW_VERSION")) { infoText = gSystem->Getenv("CMSSW_VERSION"); } else { TString infoFileName("data/version.txt"); fireworks::setPath(infoFileName); ifstream infoFile(infoFileName); infoText.ReadLine(infoFile); infoFile.close(); } printf("Starting cmsShow, version %s.\n", infoText.Data()); fflush(stdout); // check root interactive promp bool isri = false; for (Int_t i =0; i<argc; i++) { if (strncmp(argv[i], "-r", 2) == 0 || strncmp(argv[i], "--root", 6) == 0) { isri=true; } } try { if (isri) { std::cerr<<""<<std::endl; std::cerr<<"WARNING:You are running cmsShow with ROOT prompt enabled."<<std::endl; std::cerr<<"If you encounter an issue you suspect to be a bug in "<<std::endl; std::cerr<<"cmsShow, please re-run without this option and try to "<<std::endl; std::cerr<<"reproduce it before submitting a bug-report. "<<std::endl; std::cerr<<""<<std::endl; TRint app("cmsShow", &dummyArgc, dummyArgv); run_app(app,argc, argv); } else { TApplication app("cmsShow", &dummyArgc, dummyArgv); run_app(app,argc, argv); } } catch(std::exception& iException) { std::cerr <<"CmsShow unhandled exception "<<iException.what()<<std::endl; return 1; } return 0; }
void run_app | ( | TApplication & | app, |
int | argc, | ||
char ** | argv | ||
) |
Definition at line 92 of file cmsShow.cc.
References edm::MessageDrop::instance(), edm::MessageLoggerQ::MLqEND(), edm::MLSCRIBE_RUNNING_INDICATOR, and edm::MessageLoggerQ::setMLscribe_ptr().
Referenced by main().
{ //Remove when FWLite handles the MessageLogger edm::MessageLoggerQ::setMLscribe_ptr(boost::shared_ptr<edm::service::AbstractMLscribe>(new SilentMLscribe)); edm::MessageDrop::instance()->messageLoggerScribeIsRunning = edm::MLSCRIBE_RUNNING_INDICATOR; //--------------------- std::auto_ptr<CmsShowMain> pMain( new CmsShowMain(argc,argv) ); // Avoid haing root handling various associated to an error and install // back the default ones. gSystem->ResetSignal(kSigBus); gSystem->ResetSignal(kSigSegmentationViolation); gSystem->ResetSignal(kSigIllegalInstruction); gSystem->ResetSignal(kSigSystem); gSystem->ResetSignal(kSigPipe); gSystem->ResetSignal(kSigFloatingException); struct sigaction sac; sac.sa_sigaction = signal_handler_wrapper; sigemptyset(&sac.sa_mask); sac.sa_flags = SA_SIGINFO; sigaction(SIGILL, &sac, 0); sigaction(SIGSEGV, &sac, 0); sigaction(SIGBUS, &sac, 0); sigaction(SIGFPE, &sac, 0); app.Run(); pMain.reset(); TEveManager::Terminate(); app.Terminate(); //Remove when FWLite handled the MessageLogger edm::MessageLoggerQ::MLqEND(); }