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 fwlite::setRefStreamer(&s_getter);
00061
00062
00063 TInterpreter* intrp= gROOT->GetInterpreter();
00064 const char* env = getenv("CMSSW_FWLITE_INCLUDE_PATH");
00065 if( 0 != env) {
00066
00067 const char* start = env;
00068 const char* end;
00069 do{
00070
00071 for(end=start; *end!=0 and *end != ':';++end);
00072 std::string dir(start, end);
00073 intrp->AddIncludePath(dir.c_str());
00074 start = end+1;
00075 }while(*end != 0);
00076 }
00077
00078 bool foundCMSIncludes = false;
00079 env = getenv("CMSSW_BASE");
00080 if( 0 != env) {
00081 foundCMSIncludes = true;
00082 std::string dir(env);
00083 dir += "/src";
00084 intrp->AddIncludePath(dir.c_str());
00085 }
00086
00087 env = getenv("CMSSW_RELEASE_BASE");
00088 if( 0 != env) {
00089 foundCMSIncludes = true;
00090 std::string dir(env);
00091 dir += "/src";
00092 intrp->AddIncludePath(dir.c_str());
00093 }
00094 if( not foundCMSIncludes) {
00095 std::cerr <<"Could not find the environment variables \n"
00096 <<" CMSSW_BASE or\n"
00097 <<" CMSSW_RELEASE_BASE\n"
00098 <<" therefore attempting to '#include' any CMS headers will not work"<<std::endl;
00099 }
00100 if (0 != gApplication) {
00101 gApplication->InitializeGraphics();
00102 }
00103 }
00104
00105 void
00106 AutoLibraryLoader::loadAll()
00107 {
00108
00109 enable();
00110 edm::RootAutoLibraryLoader::loadAll();
00111 }
00112