loadlibs.C
Go to the documentation of this file.
1 {
2  TString libs0 = gSystem->GetDynamicPath();
3  TString libs = libs0 + ":/usr/lib:/usr/local/lib:/opt/lib:/opt/local/lib";
4  gSystem->SetDynamicPath(libs.Data());
5 
6  // PYTHIA 6 lib
7  gSystem->Load("libPythia6");
8 
9  // extra ROOT libs
10  gSystem->Load("libPhysics");
11  gSystem->Load("libEG");
12  gSystem->Load("libEGPythia6");
13  gSystem->Load("libGeom");
14  gSystem->Load("libTree");
15 
16  // libxml2 and log4cpp libs
17  gSystem->Load("libxml2");
18  gSystem->Load("liblog4cpp");
19 
20  //
21  // GENIE libs
22  //
23 
24  // Read them from genie-config
25  TString command = TString::Format("genie-config --libs");
26  FILE * f = gSystem->OpenPipe(command.Data(),"r");
27 
28  TPRegexp re("-l([\\d\\w]*)");
29  while (true) {
30  TString line;
31  if (!line.Gets(f)) {break;}
32  TObjArray * tokens = line.Tokenize(" ");
33  for (int i = 0 ; i < tokens->GetEntries() ; i++) {
34  TObjString * token_os = static_cast<TObjString*>(tokens->At(i));
35  if (!token_os) {continue;}
36  TObjArray * matches = re.MatchS(token_os->GetString());
37  if (matches->GetEntries()!=2) { continue; }
38  TObjString * libname_os = static_cast<TObjString*>(matches->At(1));
39  if (!libname_os) {continue;}
40  TString full_libname = "lib"+libname_os->GetString();
41  //~ cerr<<full_libname<<endl;
42  gSystem->Load(full_libname.Data());
43  delete matches;
44  }
45  delete tokens;
46  }
47  gSystem->ClosePipe(f);
48 }
49 
size_t i(0)
FILE * f
Definition: loadlibs.C:26
TString command
Definition: loadlibs.C:25
TString libs
Definition: loadlibs.C:3
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154
TPRegexp re("-l([\\d\\w]*)")