CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AutoLibraryLoader.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: LibraryLoader
4 // Class : AutoLibraryLoader
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author:
10 // Created: Wed Nov 30 14:55:01 EST 2005
11 //
12 
13 // system include files
14 #include <iostream>
15 #include "TROOT.h"
16 #include "TInterpreter.h"
17 #include "TApplication.h"
18 
19 // user include files
26 
28 //
29 // constants, enums and typedefs
30 //
31 
32 //
33 // static data member definitions
34 //
35 
36 bool AutoLibraryLoader::enabled_(false);
37 
38 //
39 // constructors and destructor
40 //
42 {
43 }
44 
45 
46 //
47 // member functions
48 //
49 
50 void
52 {
53  if (enabled_) { return; }
54  enabled_ = true;
55 
57  static BareRootProductGetter s_getter;
60  //this function must be called after enabling the autoloader
61  // so that the Reflex dictionaries will be converted to ROOT
62  // dictionaries and the TClass we need will be available
63  fwlite::setRefStreamer(&s_getter);
64 
65  //Make it easy to load our headers
66  TInterpreter* intrp= gROOT->GetInterpreter();
67  const char* env = getenv("CMSSW_FWLITE_INCLUDE_PATH");
68  if( 0 != env) {
69  //this is a comma separated list
70  const char* start = env;
71  const char* end = env;
72  do{
73  //find end
74  for(end=start; *end!=0 and *end != ':';++end);
75  std::string dir(start, end);
76  intrp->AddIncludePath(dir.c_str());
77  start = end+1;
78  }while(*end != 0);
79  }
80 
81  bool foundCMSIncludes = false;
82  env = getenv("CMSSW_BASE");
83  if( 0 != env) {
84  foundCMSIncludes = true;
85  std::string dir(env);
86  dir += "/src";
87  intrp->AddIncludePath(dir.c_str());
88  }
89 
90  env = getenv("CMSSW_RELEASE_BASE");
91  if( 0 != env) {
92  foundCMSIncludes = true;
93  std::string dir(env);
94  dir += "/src";
95  intrp->AddIncludePath(dir.c_str());
96  }
97  if( not foundCMSIncludes) {
98  std::cerr <<"Could not find the environment variables \n"
99  <<" CMSSW_BASE or\n"
100  <<" CMSSW_RELEASE_BASE\n"
101  <<" therefore attempting to '#include' any CMS headers will not work"<<std::endl;
102  }
103  if (0 != gApplication) {
104  gApplication->InitializeGraphics();
105  }
106 }
107 
108 void
110 {
111  // std::cout <<"LoadAllDictionaries"<<std::endl;
112  enable();
114 }
115 
static PluginManager & configure(const Config &)
static void loadAll()
load all known libraries holding dictionaries
PluginManager::Config config()
Definition: standard.cc:22
edm::EDProductGetter const * setRefStreamer(edm::EDProductGetter const *ep)
Definition: RefStreamer.cc:11
#define end
Definition: vmac.h:38
static void loadAll()
load all known libraries holding dictionaries
void setCacheStreamers()
static void enable()
enable automatic library loading
dbl *** dir
Definition: mlp_gen.cc:35
static void enable()
interface for TClass generators