CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 //
37 // constructors and destructor
38 //
39 // Note: this ctor will never be invoked.
40 // All data and functions are static
42  }
43 
44 
45 //
46 // member functions
47 //
48 
49  void
51  if (enabled_) { return; }
52  enabled_ = true;
53 
55  static BareRootProductGetter s_getter;
56  //this function must be called
57  // so that the TClass we need will be available
58  fwlite::setRefStreamer(&s_getter);
59 
60  //Make it easy to load our headers
61  TInterpreter* intrp= gROOT->GetInterpreter();
62  char const* env = getenv("CMSSW_FWLITE_INCLUDE_PATH");
63  if(nullptr != env) {
64  //this is a comma separated list
65  char const* start = env;
66  char const* end;
67  do {
68  //find end
69  for(end=start; *end!=0 and *end != ':';++end);
70  std::string dir(start, end);
71  intrp->AddIncludePath(dir.c_str());
72  start = end+1;
73  } while(*end != 0);
74  }
75 
76  bool foundCMSIncludes = false;
77  env = getenv("CMSSW_BASE");
78  if(nullptr != env) {
79  foundCMSIncludes = true;
80  std::string dir(env);
81  dir += "/src";
82  intrp->AddIncludePath(dir.c_str());
83  }
84 
85  env = getenv("CMSSW_RELEASE_BASE");
86  if(nullptr != env) {
87  foundCMSIncludes = true;
88  std::string dir(env);
89  dir += "/src";
90  intrp->AddIncludePath(dir.c_str());
91  }
92  if(not foundCMSIncludes) {
93  std::cerr <<"Could not find the environment variables \n"
94  <<" CMSSW_BASE or\n"
95  <<" CMSSW_RELEASE_BASE\n"
96  <<" therefore attempting to '#include' any CMS headers will not work"<<std::endl;
97  }
98  if (nullptr != gApplication) {
99  gApplication->InitializeGraphics();
100  }
101  }
102 
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
static PluginManager & configure(const Config &)
PluginManager::Config config()
Definition: standard.cc:21
edm::EDProductGetter const * setRefStreamer(edm::EDProductGetter const *ep)
Definition: RefStreamer.cc:10
static void enable()
enable automatic library loading
#define end
Definition: vmac.h:37
dbl *** dir
Definition: mlp_gen.cc:35
static bool enabled_
Definition: FWLiteEnabler.h:20