CMS 3D CMS Logo

FWFFHelper.cc
Go to the documentation of this file.
4 
5 #include "TROOT.h"
6 #include "TSystem.h"
7 #include "TColor.h"
8 #include "TStyle.h"
9 #include "TEnv.h"
10 #include "TRint.h"
11 #include "TEveManager.h"
12 #include "TEveEventManager.h"
13 #include "TEveTrackPropagator.h"
14 #include "TGLWidget.h"
15 #include "TEveBrowser.h"
16 
17 #include <cassert>
18 #include <iostream>
19 
20 class FWFFTRint : public TRint
21 {
22 public:
23  FWFFTRint(const char *appClassName, Int_t *argc, char **argv, bool rootPrompt)
24  : TRint(appClassName, argc, argv, nullptr, 0, !rootPrompt),
25  m_rootPrompt(rootPrompt)
26  {
27  if (rootPrompt)
28  return;
29 
30  SetPrompt("");
31  GetInputHandler()->Remove();
32  }
33 
34  Bool_t HandleTermInput() override
35  {
36  if (m_rootPrompt)
37  return TRint::HandleTermInput();
38  return true;
39  }
40 private:
42 };
43 
45  : m_Rint(nullptr)
46 {
47  printf ("CMSSW is starting... You should always have a 2 minutes walk every 45 minutes anyways.\n");
48  const char* dummyArgvArray[] = {"cmsRun"};
49  char** dummyArgv = const_cast<char**>(dummyArgvArray);
50  int dummyArgc = 1;
51 
52  m_Rint = new FWFFTRint("App", &dummyArgc, dummyArgv, ps.getUntrackedParameter<bool>("rootPrompt"));
53  assert(TApplication::GetApplications()->GetSize());
54 
55  gROOT->SetBatch(kFALSE);
56  TApplication::NeedGraphicsLibs();
57 
58  try {
59  TGLWidget* w = TGLWidget::Create(gClient->GetDefaultRoot(), kTRUE, kTRUE, nullptr, 10, 10);
60  delete w;
61  }
62  catch (std::exception& iException) {
63  std::cerr <<"Insufficient GL support. " << iException.what() << std::endl;
64  throw;
65  }
66 
67  TEveManager::Create(kFALSE, "FI");
68 }
T getUntrackedParameter(std::string const &, T const &) const
const double w
Definition: UKUtility.cc:23
bool m_rootPrompt
Definition: FWFFHelper.cc:41
#define nullptr
Bool_t HandleTermInput() override
Definition: FWFFHelper.cc:34
TRint * m_Rint
Definition: FWFFHelper.h:18
FWFFTRint(const char *appClassName, Int_t *argc, char **argv, bool rootPrompt)
Definition: FWFFHelper.cc:23
FWFFHelper(const edm::ParameterSet &, const edm::ActivityRegistry &)
Definition: FWFFHelper.cc:44