ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/macros/setRootEnv.C
(Generate patch)

Comparing UserCode/MitAna/macros/setRootEnv.C (file contents):
Revision 1.2 by paus, Tue Jun 3 07:21:28 2008 UTC vs.
Revision 1.4 by paus, Thu Jul 3 10:27:52 2008 UTC

# Line 16 | Line 16
16  
17   void setIncludes();
18   void loadLibraries();
19 + void loadmylib(const char *name);
20 + void loadmylib(const char *pkgname, const char *subpkgname);
21 +
22 + //__________________________________________________________________________________________________
23  
24   void setRootEnv()
25   {
# Line 31 | Line 35 | void setRootEnv()
35    setIncludes();
36    loadLibraries();
37  
38 +  // have a friendly welcome message
39    if (gClassTable->GetID("mithep::Particle") >= 0) {
40      ::Info("setRootEnv", "Welcome to MITROOT!\n");
41    }
# Line 38 | Line 43 | void setRootEnv()
43  
44   void setIncludes()
45   {
46 +  if (gSystem->Getenv("CMSSW_VERSION")) {
47 +    TString str = gSystem->GetMakeSharedLib();
48 +    if (str.Contains("-m32")==0 && str.Contains("-m64")==0) {
49 +      str.ReplaceAll("g++", "g++ -m32");
50 +      gSystem->SetMakeSharedLib(str);
51 +    }
52 +  }
53 +
54    gSystem->AddIncludePath("-I$CMSSW_BASE/src/");
55    gSystem->AddIncludePath("-I$CMSSW_BASE/src/MitAna/TreeMod/inc");
56    gSystem->AddIncludePath("-I$CMSSW_BASE/src/MitAna/macros");
57    gInterpreter->AddIncludePath(TString(gSystem->Getenv("CMSSW_BASE"))+"/src/");
58 <  gInterpreter->AddIncludePath(TString(gSystem->Getenv("CMSSW_BASE"))+"/src/MitAna/TreeMod/inc");
58 >  gInterpreter->AddIncludePath(TString(gSystem->Getenv("CMSSW_BASE"))+
59 >                               "/src/MitAna/TreeMod/interface");
60    gInterpreter->AddIncludePath(TString(gSystem->Getenv("CMSSW_BASE"))+"/src/MitAna/macros");
61    gROOT->SetMacroPath(TString(gROOT->GetMacroPath())
62                        +TString(gSystem->Getenv("CMSSW_BASE"))+"/src/MitAna/macros");
# Line 76 | Line 90 | void loadLibraries()
90          gROOT->Error("setRootEnv", "could not load \"%s\" for use in ACLiC", tmpstr);
91        } else {
92          if (gDebug)
93 <          Info("setRootEnv","Loaded \"%s\" and its dependencies", tmpstr);
93 >          Info("setRootEnv","Loaded \"%s\" for use in ACLiC", tmpstr);
94        }
95      }
96      delete[] tmpstr;
97    }
98    gSystem->FreeDirectory(dir);
99   }
100 +
101 + void loadmylib(const char *name)
102 + {
103 +  TString libstr(Form("%s/lib/%s/%s",
104 +                      gSystem->Getenv("CMSSW_BASE"),
105 +                      gSystem->Getenv("SCRAM_ARCH"),
106 +                      name));
107 +
108 +  Int_t slevel=gErrorIgnoreLevel;
109 +  gErrorIgnoreLevel=kFatal;
110 +  Int_t suc = gSystem->Load(libstr);
111 +  gErrorIgnoreLevel=slevel;
112 +  
113 +  if (suc<0) {
114 +    gROOT->Error("loadmylib", "could not load \"%s\" for use in ACLiC", libstr.Data());
115 +  } else {
116 +    if (gDebug)
117 +      Info("loadmylib","Loaded \"%s\" for use in ACLiC", name);
118 +  }
119 + }
120 +
121 + void loadmylib(const char *pkgname, const char *subpkgname)
122 + {
123 +  loadmylib(Form("lib%s%s.so", pkgname, subpkgname));
124 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines