Go to the documentation of this file.00001 #include "Fireworks/FWInterface/interface/FWFFHelper.h"
00002 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00003 #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
00004
00005 #include "TROOT.h"
00006 #include "TSystem.h"
00007 #define private public
00008 #include "TRint.h"
00009 #include "TEveManager.h"
00010 #include "TEveEventManager.h"
00011 #include "TEveTrackPropagator.h"
00012 #include "TGLWidget.h"
00013 #include "TEveBrowser.h"
00014
00015 #include <cassert>
00016 #include <iostream>
00017
00018 class FWFFTRint : public TRint
00019 {
00020 public:
00021 FWFFTRint(const char *appClassName, Int_t *argc, char **argv, bool rootPrompt)
00022 : TRint(appClassName, argc, argv, 0, 0, !rootPrompt),
00023 m_rootPrompt(rootPrompt)
00024 {
00025 if (rootPrompt)
00026 return;
00027
00028 SetPrompt("");
00029 fInputHandler->Remove();
00030 }
00031
00032 Bool_t HandleTermInput()
00033 {
00034 if (m_rootPrompt)
00035 return TRint::HandleTermInput();
00036 return true;
00037 }
00038 private:
00039 bool m_rootPrompt;
00040 };
00041
00042 FWFFHelper::FWFFHelper(const edm::ParameterSet &ps, const edm::ActivityRegistry &)
00043 : m_Rint(0)
00044 {
00045 printf ("CMSSW is starting... You should always have a 2 minutes walk every 45 minutes anyways.\n");
00046 const char* dummyArgvArray[] = {"cmsRun"};
00047 char** dummyArgv = const_cast<char**>(dummyArgvArray);
00048 int dummyArgc = 1;
00049
00050 m_Rint = new FWFFTRint("App", &dummyArgc, dummyArgv, ps.getUntrackedParameter<bool>("rootPrompt"));
00051 assert(TApplication::GetApplications()->GetSize());
00052
00053 gROOT->SetBatch(kFALSE);
00054 TApplication::NeedGraphicsLibs();
00055
00056 try {
00057 TGLWidget* w = TGLWidget::Create(gClient->GetDefaultRoot(), kTRUE, kTRUE, 0, 10, 10);
00058 delete w;
00059 }
00060 catch (std::exception& iException) {
00061 std::cerr <<"Insufficient GL support. " << iException.what() << std::endl;
00062 throw;
00063 }
00064
00065
00066 TEveManager::Create(kFALSE, "FIV");
00067 }