Logo ROOT   6.14/05
Reference Guide
alien.C File Reference

Detailed Description

View in nbviewer Open in SWAN Example of use of the TAlien class (an implementation of TGrid)

void alien()
TString testdir = "root-test3";
int nfiles = 10;
// connect to AliEn
TGrid *alien = TGrid::Connect("alien", gSystem->Getenv("USER"), "",
if (alien->IsZombie()) {
delete alien;
// get info on AliEn version
printf("Using AliEn version %s\n", alien->GetInfo());
// print current working directory
printf("Current directory is %s\n", alien->Pwd());
// check if directory exists
Long_t size, flags, modtime;
if (alien->GetPathInfo(testdir, &size, &flags, &modtime) == 0) {
// delete existing directory
// create a directory
// change directory
printf("Current directory is %s\n", alien->Pwd());
// insert nfiles into the catalog
Int_t i;
char lfn[32], pfn[256];
for (i = 0; i < nfiles; i++) {
sprintf(lfn, "test-%d.root", i);
sprintf(pfn, "rfio:/castor/cern.ch/user/r/rdm/mytest-%d.root", i);
alien->AddFile(lfn, pfn, 1000000000);
// list the contents of a directory
alien->ls("", "l");
// get physical file name from lfn
for (i = 0; i < nfiles; i++) {
sprintf(lfn, "test-%d.root", i);
char *pf = alien->GetPhysicalFileName(lfn);
if (i == nfiles-1)
printf("last pfn retrieved is: %s\n", pf);
delete [] pf;
delete alien;
Andreas Peters

Definition in file alien.C.