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

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

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

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