CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
cmsShow.cc File Reference
#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)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 128 of file cmsShow.cc.

References dir2webdir::argc, dtNoiseDBValidation_cfg::cerr, cppFunctionSkipper::exception, i, run_app(), and fireworks::setPath().

129 {
130  const char* dummyArgvArray[] = {"cmsShow"};
131  char** dummyArgv = const_cast<char**>(dummyArgvArray);
132  int dummyArgc = 1;
133  gEnv->SetValue("Gui.BackgroundColor", "#9f9f9f");
134 
135  // print version
136  TString infoText;
137  if (gSystem->Getenv("CMSSW_VERSION"))
138  {
139  infoText = gSystem->Getenv("CMSSW_VERSION");
140  }
141  else
142  {
143  TString infoFileName("data/version.txt");
144  fireworks::setPath(infoFileName);
145  ifstream infoFile(infoFileName);
146  infoText.ReadLine(infoFile);
147  infoFile.close();
148  }
149  printf("Starting cmsShow, version %s.\n", infoText.Data());
150  fflush(stdout);
151 
152  // check root interactive promp
153  bool isri = false;
154  for (Int_t i =0; i<argc; i++)
155  {
156  if (strncmp(argv[i], "-r", 2) == 0 ||
157  strncmp(argv[i], "--root", 6) == 0)
158  {
159  isri=true;
160  }
161  }
162 
163  try {
164  if (isri) {
165  std::cerr<<""<<std::endl;
166  std::cerr<<"WARNING:You are running cmsShow with ROOT prompt enabled."<<std::endl;
167  std::cerr<<"If you encounter an issue you suspect to be a bug in "<<std::endl;
168  std::cerr<<"cmsShow, please re-run without this option and try to "<<std::endl;
169  std::cerr<<"reproduce it before submitting a bug-report. "<<std::endl;
170  std::cerr<<""<<std::endl;
171 
172  TRint app("cmsShow", &dummyArgc, dummyArgv);
173  run_app(app,argc, argv);
174  } else {
175  TApplication app("cmsShow", &dummyArgc, dummyArgv);
176  run_app(app,argc, argv);
177  }
178  }
179  catch(std::exception& iException)
180  {
181  std::cerr <<"CmsShow unhandled exception "<<iException.what()<<std::endl;
182  return 1;
183  }
184 
185  return 0;
186 }
int i
Definition: DBlmapReader.cc:9
void run_app(TApplication &app, int argc, char **argv)
Definition: cmsShow.cc:92
tuple argc
Definition: dir2webdir.py:41
void setPath(TString &v)
Definition: fwPaths.cc:15
void run_app ( TApplication &  app,
int  argc,
char **  argv 
)

Definition at line 92 of file cmsShow.cc.

References edm::MessageDrop::instance(), edm::MessageDrop::messageLoggerScribeIsRunning, edm::MessageLoggerQ::MLqEND(), edm::MLSCRIBE_RUNNING_INDICATOR, and edm::MessageLoggerQ::setMLscribe_ptr().

Referenced by main().

93 {
94  //Remove when FWLite handles the MessageLogger
95  edm::MessageLoggerQ::setMLscribe_ptr(boost::shared_ptr<edm::service::AbstractMLscribe>(new SilentMLscribe));
97  //---------------------
98  std::auto_ptr<CmsShowMain> pMain( new CmsShowMain(argc,argv) );
99 
100  // Avoid haing root handling various associated to an error and install
101  // back the default ones.
102  gSystem->ResetSignal(kSigBus);
103  gSystem->ResetSignal(kSigSegmentationViolation);
104  gSystem->ResetSignal(kSigIllegalInstruction);
105  gSystem->ResetSignal(kSigSystem);
106  gSystem->ResetSignal(kSigPipe);
107  gSystem->ResetSignal(kSigFloatingException);
108 
109  struct sigaction sac;
110  sac.sa_sigaction = signal_handler_wrapper;
111  sigemptyset(&sac.sa_mask);
112  sac.sa_flags = SA_SIGINFO;
113  sigaction(SIGILL, &sac, 0);
114  sigaction(SIGSEGV, &sac, 0);
115  sigaction(SIGBUS, &sac, 0);
116  sigaction(SIGFPE, &sac, 0);
117 
118  app.Run();
119  pMain.reset();
120 
121  TEveManager::Terminate();
122  app.Terminate();
123 
124  //Remove when FWLite handled the MessageLogger
126 }
static unsigned char messageLoggerScribeIsRunning
Definition: MessageDrop.h:109
static void setMLscribe_ptr(boost::shared_ptr< edm::service::AbstractMLscribe > m)
static MessageDrop * instance()
Definition: MessageDrop.cc:65
static const unsigned char MLSCRIBE_RUNNING_INDICATOR
Definition: MessageDrop.h:121
static void MLqEND()
tuple argc
Definition: dir2webdir.py:41