CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWFFHelper.cc
Go to the documentation of this file.
4 
5 #define private public
6 #include "TROOT.h"
7 #include "TSystem.h"
8 #include "TColor.h"
9 #include "TStyle.h"
10 #include "TEnv.h"
11 #include "TRint.h"
12 #include "TEveManager.h"
13 #include "TEveEventManager.h"
14 #include "TEveTrackPropagator.h"
15 #include "TGLWidget.h"
16 #include "TEveBrowser.h"
17 
18 #include <cassert>
19 #include <iostream>
20 
21 class FWFFTRint : public TRint
22 {
23 public:
24  FWFFTRint(const char *appClassName, Int_t *argc, char **argv, bool rootPrompt)
25  : TRint(appClassName, argc, argv, 0, 0, !rootPrompt),
26  m_rootPrompt(rootPrompt)
27  {
28  if (rootPrompt)
29  return;
30 
31  SetPrompt("");
32  fInputHandler->Remove();
33  }
34 
35  Bool_t HandleTermInput() override
36  {
37  if (m_rootPrompt)
38  return TRint::HandleTermInput();
39  return true;
40  }
41 private:
43 };
44 
46  : m_Rint(0)
47 {
48  printf ("CMSSW is starting... You should always have a 2 minutes walk every 45 minutes anyways.\n");
49  const char* dummyArgvArray[] = {"cmsRun"};
50  char** dummyArgv = const_cast<char**>(dummyArgvArray);
51  int dummyArgc = 1;
52 
53  m_Rint = new FWFFTRint("App", &dummyArgc, dummyArgv, ps.getUntrackedParameter<bool>("rootPrompt"));
54  assert(TApplication::GetApplications()->GetSize());
55 
56  gROOT->SetBatch(kFALSE);
57  TApplication::NeedGraphicsLibs();
58 
59  try {
60  TGLWidget* w = TGLWidget::Create(gClient->GetDefaultRoot(), kTRUE, kTRUE, 0, 10, 10);
61  delete w;
62  }
63  catch (std::exception& iException) {
64  std::cerr <<"Insufficient GL support. " << iException.what() << std::endl;
65  throw;
66  }
67 
68 // AMT workaround for an agressive clenup in 5.43.18
69 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,34,18)
70  if (!gStyle) {
71  TColor::fgInitDone=false;
72  TColor::InitializeColors();
73  TStyle::BuildStyles();
74  gROOT->SetStyle(gEnv->GetValue("Canvas.Style", "Modern"));
75  gStyle = gROOT->GetStyle("Classic");
76  }
77 #endif
78 
79  TEveManager::Create(kFALSE, "FI");
80 }
T getUntrackedParameter(std::string const &, T const &) const
const double w
Definition: UKUtility.cc:23
bool m_rootPrompt
Definition: FWFFHelper.cc:42
assert(m_qm.get())
Bool_t HandleTermInput() override
Definition: FWFFHelper.cc:35
TRint * m_Rint
Definition: FWFFHelper.h:18
tuple argc
Definition: dir2webdir.py:38
FWFFTRint(const char *appClassName, Int_t *argc, char **argv, bool rootPrompt)
Definition: FWFFHelper.cc:24
FWFFHelper(const edm::ParameterSet &, const edm::ActivityRegistry &)
Definition: FWFFHelper.cc:45