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