CMS 3D CMS Logo

FWLiteEnabler.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: LibraryLoader
4 // Class : FWLiteEnabler
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 //
10 
11 // system include files
12 #include <iostream>
13 #include "TROOT.h"
14 #include "TInterpreter.h"
15 #include "TApplication.h"
16 
17 // user include files
22 
24 
25 //
26 // constants, enums and typedefs
27 //
28 
29 //
30 // static data member definitions
31 //
32 
33 bool FWLiteEnabler::enabled_(false);
34 
35 //
36 // constructors and destructor
37 //
38 // Note: this ctor will never be invoked.
39 // All data and functions are static
41 
42 //
43 // member functions
44 //
45 
47  if (enabled_) {
48  return;
49  }
50  enabled_ = true;
51 
53  static BareRootProductGetter s_getter;
54  //this function must be called
55  // so that the TClass we need will be available
56  fwlite::setRefStreamer(&s_getter);
57 
58  //Make it easy to load our headers
59  TInterpreter* intrp = gROOT->GetInterpreter();
60  char const* env = std::getenv("CMSSW_FWLITE_INCLUDE_PATH");
61  if (nullptr != env) {
62  //this is a comma separated list
63  char const* start = env;
64  char const* end;
65  do {
66  //find end
67  for (end = start; *end != 0 and *end != ':'; ++end)
68  ;
70  intrp->AddIncludePath(dir.c_str());
71  start = end + 1;
72  } while (*end != 0);
73  }
74 
75  bool foundCMSIncludes = false;
76  env = std::getenv("CMSSW_BASE");
77  if (nullptr != env) {
78  foundCMSIncludes = true;
80  dir += "/src";
81  intrp->AddIncludePath(dir.c_str());
82  }
83 
84  env = std::getenv("CMSSW_RELEASE_BASE");
85  if (nullptr != env) {
86  foundCMSIncludes = true;
88  dir += "/src";
89  intrp->AddIncludePath(dir.c_str());
90  }
91  if (not foundCMSIncludes) {
92  std::cerr << "Could not find the environment variables \n"
93  << " CMSSW_BASE or\n"
94  << " CMSSW_RELEASE_BASE\n"
95  << " therefore attempting to '#include' any CMS headers will not work" << std::endl;
96  }
97  if (nullptr != gApplication) {
98  gApplication->InitializeGraphics();
99  }
100 }
start
Definition: start.py:1
FWLiteEnabler::enabled_
static bool enabled_
Definition: FWLiteEnabler.h:21
end
#define end
Definition: vmac.h:39
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
web.browse_db.env
env
Definition: browse_db.py:18
standard.h
FWLiteEnabler::enable
static void enable()
enable automatic library loading
Definition: FWLiteEnabler.cc:46
edmplugin::PluginManager::configure
static PluginManager & configure(const Config &)
Definition: PluginManager.cc:316
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
BareRootProductGetter
Definition: BareRootProductGetter.h:43
fwlite::setRefStreamer
edm::EDProductGetter const * setRefStreamer(edm::EDProductGetter const *ep)
Definition: RefStreamer.cc:11
edmplugin::standard::config
PluginManager::Config config()
Definition: standard.cc:21
setRefStreamer.h
BareRootProductGetter.h
FWLiteEnabler::FWLiteEnabler
FWLiteEnabler()
Definition: FWLiteEnabler.cc:40
PluginManager.h
FWLiteEnabler.h
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23