Re: [ROOT] Loading en masse

From: Bob McElrath (mcelrath@draal.physics.wisc.edu)
Date: Mon Sep 24 2001 - 00:26:21 MEST


Here's a simple script to load everything in the ~/.root/ directory,
where I put files with often-used functions.  Just in case anyone else
wants it.

{
  //Load all ROOT scripts (*.C) in the current directory
  TString homedir = gSystem->Getenv("HOME");
  //Load all ROOT scripts (*.C) in the ~/.root/ directory
  void *dirp = gSystem->OpenDirectory(homedir + "/.root/");
  if(!dirp) printf("failed to open directory $HOME/.root/!\n");
  const char *afile;
  char aline[256];
  while(afile = gSystem->GetDirEntry(dirp)) {
    if (strstr(afile,".C")) {
      printf("loading file: %s\n",afile);
      sprintf(aline,".L %s",afile);
      gROOT->ProcessLine(aline);
    }                            
  }
}

Rene Brun [Rene.Brun@cern.ch] wrote:
> This is a variant of my previous script
> 
> {
>    //Load all ROOT scripts (*.C) in the current directory
>    void *dirp = gSystem->OpenDirectory(".");
>    const char *afile;
>    char aline[256];
>    while(afile = gSystem->GetDirEntry(dirp)) {
>       if (strstr(afile,".C")) {
>          printf("file: %s\n",afile);
>          sprintf(aline,".L %s",afile);
>          gROOT->ProcessLine(aline);
>       }
>    }
> }
> 
> 
> Rene Brun

-- Bob

Bob McElrath (rsmcelrath@students.wisc.edu) 
Univ. of Wisconsin at Madison, Department of Physics





This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:00 MET