Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:23

0001 #include "Fireworks/FWInterface/interface/FWFFHelper.h"
0002 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0003 #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
0004 
0005 #include "TROOT.h"
0006 #include "TSystem.h"
0007 #include "TColor.h"
0008 #include "TStyle.h"
0009 #include "TEnv.h"
0010 #include "TRint.h"
0011 #include "TEveManager.h"
0012 #include "TEveEventManager.h"
0013 #include "TEveTrackPropagator.h"
0014 #include "TGLWidget.h"
0015 #include "TEveBrowser.h"
0016 
0017 #include <cassert>
0018 #include <iostream>
0019 
0020 class FWFFTRint : public TRint {
0021 public:
0022   FWFFTRint(const char *appClassName, Int_t *argc, char **argv, bool rootPrompt)
0023       : TRint(appClassName, argc, argv, nullptr, 0, !rootPrompt), m_rootPrompt(rootPrompt) {
0024     if (rootPrompt)
0025       return;
0026 
0027     SetPrompt("");
0028     GetInputHandler()->Remove();
0029   }
0030 
0031   Bool_t HandleTermInput() override {
0032     if (m_rootPrompt)
0033       return TRint::HandleTermInput();
0034     return true;
0035   }
0036 
0037 private:
0038   bool m_rootPrompt;
0039 };
0040 
0041 FWFFHelper::FWFFHelper(const edm::ParameterSet &ps, const edm::ActivityRegistry &) : m_Rint(nullptr) {
0042   printf("CMSSW is starting... You should always have a 2 minutes walk every 45 minutes anyways.\n");
0043   const char *dummyArgvArray[] = {"cmsRun"};
0044   char **dummyArgv = const_cast<char **>(dummyArgvArray);
0045   int dummyArgc = 1;
0046 
0047   m_Rint = new FWFFTRint("App", &dummyArgc, dummyArgv, ps.getUntrackedParameter<bool>("rootPrompt"));
0048   assert(TApplication::GetApplications()->GetSize());
0049 
0050   gROOT->SetBatch(kFALSE);
0051   TApplication::NeedGraphicsLibs();
0052 
0053   try {
0054     TGLWidget *w = TGLWidget::Create(gClient->GetDefaultRoot(), kTRUE, kTRUE, nullptr, 10, 10);
0055     delete w;
0056   } catch (std::exception &iException) {
0057     std::cerr << "Insufficient GL support. " << iException.what() << std::endl;
0058     throw;
0059   }
0060 
0061   TEveManager::Create(kFALSE, "FI");
0062 }