Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <iostream>
00015 #include "TROOT.h"
00016 #include "TInterpreter.h"
00017 #include "TApplication.h"
00018
00019
00020 #include "FWCore/FWLite/interface/AutoLibraryLoader.h"
00021 #include "FWCore/RootAutoLibraryLoader/interface/RootAutoLibraryLoader.h"
00022 #include "FWCore/FWLite/src/BareRootProductGetter.h"
00023 #include "FWCore/PluginManager/interface/PluginManager.h"
00024 #include "FWCore/PluginManager/interface/standard.h"
00025 #include "DataFormats/Common/interface/CacheStreamers.h"
00026
00027 #include "FWCore/FWLite/interface/setRefStreamer.h"
00028
00029
00030
00031
00032
00033
00034
00035
00036 bool AutoLibraryLoader::enabled_(false);
00037
00038
00039
00040
00041 AutoLibraryLoader::AutoLibraryLoader()
00042 {
00043 }
00044
00045
00046
00047
00048
00049
00050 void
00051 AutoLibraryLoader::enable()
00052 {
00053 if (enabled_) { return; }
00054 enabled_ = true;
00055
00056 edmplugin::PluginManager::configure(edmplugin::standard::config());
00057 static BareRootProductGetter s_getter;
00058 edm::RootAutoLibraryLoader::enable();
00059 edm::setCacheStreamers();
00060
00061
00062
00063 fwlite::setRefStreamer(&s_getter);
00064
00065
00066 TInterpreter* intrp= gROOT->GetInterpreter();
00067 const char* env = getenv("CMSSW_FWLITE_INCLUDE_PATH");
00068 if( 0 != env) {
00069
00070 const char* start = env;
00071 const char* end = env;
00072 do{
00073
00074 for(end=start; *end!=0 and *end != ':';++end);
00075 std::string dir(start, end);
00076 intrp->AddIncludePath(dir.c_str());
00077 start = end+1;
00078 }while(*end != 0);
00079 }
00080
00081 bool foundCMSIncludes = false;
00082 env = getenv("CMSSW_BASE");
00083 if( 0 != env) {
00084 foundCMSIncludes = true;
00085 std::string dir(env);
00086 dir += "/src";
00087 intrp->AddIncludePath(dir.c_str());
00088 }
00089
00090 env = getenv("CMSSW_RELEASE_BASE");
00091 if( 0 != env) {
00092 foundCMSIncludes = true;
00093 std::string dir(env);
00094 dir += "/src";
00095 intrp->AddIncludePath(dir.c_str());
00096 }
00097 if( not foundCMSIncludes) {
00098 std::cerr <<"Could not find the environment variables \n"
00099 <<" CMSSW_BASE or\n"
00100 <<" CMSSW_RELEASE_BASE\n"
00101 <<" therefore attempting to '#include' any CMS headers will not work"<<std::endl;
00102 }
00103 if (0 != gApplication) {
00104 gApplication->InitializeGraphics();
00105 }
00106 }
00107
00108 void
00109 AutoLibraryLoader::loadAll()
00110 {
00111
00112 enable();
00113 edm::RootAutoLibraryLoader::loadAll();
00114 }
00115