Example of script showing how to create a ROOT file with subdirectories.
The script scans a given directory tree and recreates the same structure in the ROOT file. All source files of type .h,cxx,c,dat,py are imported as TMacro objects. See also the other tutorial readCode.C
void importdir(const char *dirname) {
char *
slash = (
char*)strrchr(dirname,
'/');
char *locdir;
else locdir = (char*)dirname;
printf("processing dir %s\n",dirname);
void *dirp =
gSystem->OpenDirectory(dirname);
if (!dirp) return;
char *direntry;
while ((direntry=(
char*)
gSystem->GetDirEntry(dirp))) {
if (direntry[0] == '.') continue;
if (!strcmp(direntry,"CVS")) continue;
if (!strcmp(direntry,"htmldoc")) continue;
if (strstr(dirname,"root/include")) continue;
if (strstr(direntry,"G__")) continue;
if (strstr(direntry,".c") ||
strstr(direntry,".h") ||
strstr(direntry,".dat") ||
strstr(direntry,".py") ||
strstr(direntry,".C")) {
} else {
if (flags != 3) continue;
importdir(afile);
}
}
}
void importCode() {
}
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TSystem * gSystem
Describe directory structure in memory.
virtual TDirectory * mkdir(const char *name, const char *title="", Bool_t returnExistingDirectory=kFALSE)
virtual Bool_t cd()
Change current directory to "this" directory.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
Class supporting a collection of lines with C++ code.
const char * Data() const
- Author
- Rene Brun
Definition in file importCode.C.