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.7 by bendavid, Fri Mar 12 13:44:53 2010 UTC

# Line 15 | Line 15
15   #endif
16  
17   void setIncludes();
18 < void loadLibraries();
18 > void loadLibraries(const char *libpattern="libMitAna*.so");
19 > void loadmylib(const char *name);
20 > void loadmylib(const char *pkgname, const char *subpkgname);
21 >
22 > //__________________________________________________________________________________________________
23  
24   void setRootEnv()
25   {
# Line 30 | Line 34 | void setRootEnv()
34    // customizing the MIT analysis framework things
35    setIncludes();
36    loadLibraries();
37 +  loadmylib("libMitCommonMathTools.so");
38  
39 +  // have a friendly welcome message
40    if (gClassTable->GetID("mithep::Particle") >= 0) {
41      ::Info("setRootEnv", "Welcome to MITROOT!\n");
42    }
# Line 38 | Line 44 | void setRootEnv()
44  
45   void setIncludes()
46   {
47 +  if (gSystem->Getenv("CMSSW_VERSION")) {
48 +    TString str = gSystem->GetMakeSharedLib();
49 +    if (str.Contains("-m32")==0 && str.Contains("-m64")==0) {
50 +      str.ReplaceAll("g++", "g++ -m32");
51 +      gSystem->SetMakeSharedLib(str);
52 +    }
53 +  }
54 +
55    gSystem->AddIncludePath("-I$CMSSW_BASE/src/");
56 +  gSystem->AddIncludePath("-I$CMSSW_RELEASE_BASE/src/");
57    gSystem->AddIncludePath("-I$CMSSW_BASE/src/MitAna/TreeMod/inc");
58    gSystem->AddIncludePath("-I$CMSSW_BASE/src/MitAna/macros");
59    gInterpreter->AddIncludePath(TString(gSystem->Getenv("CMSSW_BASE"))+"/src/");
60 <  gInterpreter->AddIncludePath(TString(gSystem->Getenv("CMSSW_BASE"))+"/src/MitAna/TreeMod/inc");
60 >  gInterpreter->AddIncludePath(TString(gSystem->Getenv("CMSSW_RELEASE_BASE"))+"/src/");
61 >  gInterpreter->AddIncludePath(TString(gSystem->Getenv("CMSSW_BASE"))+
62 >                               "/src/MitAna/TreeMod/interface");
63    gInterpreter->AddIncludePath(TString(gSystem->Getenv("CMSSW_BASE"))+"/src/MitAna/macros");
64    gROOT->SetMacroPath(TString(gROOT->GetMacroPath())
65                        +TString(gSystem->Getenv("CMSSW_BASE"))+"/src/MitAna/macros");
66   }
67  
68 < void loadLibraries()
68 > void loadLibraries(const char *libpattern)
69   {
70    TString libstr(Form("%s/lib/%s",gSystem->Getenv("CMSSW_BASE"),gSystem->Getenv("SCRAM_ARCH")));
71  
72    void *dir = gSystem->OpenDirectory(libstr.Data());
73 <  TRegexp re("libMitAna*.so", kTRUE);
73 >  TRegexp re(libpattern, kTRUE);
74    TRegexp reignore("libMitAnalysis*.so", kTRUE);
75    while (const char *direntry=gSystem->GetDirEntry(dir) ) {
76      TString sdirentry(direntry);
# Line 76 | Line 93 | void loadLibraries()
93          gROOT->Error("setRootEnv", "could not load \"%s\" for use in ACLiC", tmpstr);
94        } else {
95          if (gDebug)
96 <          Info("setRootEnv","Loaded \"%s\" and its dependencies", tmpstr);
96 >          Info("setRootEnv","Loaded \"%s\" for use in ACLiC", tmpstr);
97        }
98      }
99      delete[] tmpstr;
100    }
101    gSystem->FreeDirectory(dir);
102   }
103 +
104 + void loadmylib(const char *name)
105 + {
106 +  TString libstr(Form("%s/lib/%s/%s",
107 +                      gSystem->Getenv("CMSSW_BASE"),
108 +                      gSystem->Getenv("SCRAM_ARCH"),
109 +                      name));
110 +
111 +  Int_t slevel=gErrorIgnoreLevel;
112 +  gErrorIgnoreLevel=kFatal;
113 +  Int_t suc = gSystem->Load(libstr);
114 +  gErrorIgnoreLevel=slevel;
115 +  
116 +  if (suc<0) {
117 +    gROOT->Error("loadmylib", "could not load \"%s\" for use in ACLiC", libstr.Data());
118 +  } else {
119 +    if (gDebug)
120 +      Info("loadmylib","Loaded \"%s\" for use in ACLiC", name);
121 +  }
122 + }
123 +
124 + void loadmylib(const char *pkgname, const char *subpkgname)
125 + {
126 +  loadmylib(Form("lib%s%s.so", pkgname, subpkgname));
127 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines