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 127 of file cmsShow.cc.

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

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

Definition at line 91 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().

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