Re: Problem creating directories in TFile

From: Gero Flucke <flucke_at_mail.cern.ch>
Date: Fri, 30 Mar 2007 16:48:56 +0200 (CEST)


On Wed, 28 Mar 2007, James Jackson wrote:

> I have a TFile, within which I create a directory (e.g. with file-
> >mkdir("Dir1")). If, from another section of my code, and given a pointer to
> the file object, I run the following code:
>
> file->cd();
> file->cd("Dir1");
> file->mkdir("Dir2");
> file->cd("Dir2");
>
> The result is that Dir2 is created under the file 'root' directory, and not as
> a subdirectory of Dir1. This is with version 5.13.04e.

Dear James,
what you probably want to do is

file->cd("Dir1");
gDirectory->mkdir("Dir2");
file->cd("Dir1/Dir2");

Cheers

        Gero

--
-----------------------------------------------------------------------
Gero Flucke                   office: DESY, Bldg. 67b, room 24
Inst. f. Experimentalphysik           fon: +49 (0)40 8998 2955
Universitaet Hamburg                  fax: +49 (0)40 8998 2959
Luruper Chaussee 149         at CERN: Bldg. 32 office 3-B20 
22761 Hamburg                         fon: +41 (0)22 76-77557
Germany
Received on Fri Mar 30 2007 - 16:49:11 CEST

This archive was generated by hypermail 2.2.0 : Sat Mar 31 2007 - 23:50:01 CEST