Re: [ROOT] uncertain file order after TChain::Add("<regular expression>")

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Aug 21 2003 - 15:12:24 MEST


Zaldy,

If you had named your files,
 file001A001.root
 file001A002.root, etc
the problem will not be solved

Rene Brun

zaldy wrote:
> 
> Dear Rene,
> 
> This is a similat observation I have with TChain.
> 
> For exmaple I have 179 file I have. Using a Tree->MakeClass("...");
> I will have the list of the chained root files. However, I have problems
> with arrangement especially if the files are taken in order and time
> element is important.
> 
> In my case TChain list files like this.
> 
> file001A01.root
> file001A02.root
> ....
> file001A09.root
> file001A100.root
> file001A101.root
> ...............
> file001A109.root
> file001A10.root
> file001A101.root
> file001A102.root
> ................
> ...............
> file001A109.root
> file001A10.root
> file001A110.root
> file001A111.root
> ...............
> file001A119.root
> file001A11.root
> ..............
> ..............
> 
> In my Application, the reverse ordering is critical because this will also
> reverse the time information in the root file.
> 
> My solution now is to edit the myClass.h and re-arrange the ordering;
> 
> Is there a command in root to correcc the ordering or how do we correct
> this?
> 
> Thank you.
> 
> PS. root 3.05/05 gcc 3.2.2 RedHat 9.0
> 
> > Hi Maksim,
> >
> > Thanks for this remark.
> > I have modified TChain::Add in CVS to sort the files in alphanumeric order
> > in case a regular expression is used in the argument.
> >
> > Rene Brun
> >
> > "Maksim A. Nikulin" wrote:
> > >
> > > Hi,
> > >
> > > Firstly, mandatory info: root-3.05.07 gcc2.95.2 RedHat-7.3 binary
> > > installation.
> > >
> > > I noticed that file order in a chain after
> > > Int_t TChain::Add(const char *name, Int_t nentries)
> > > is depends on file creation sequence, if I use a regular expression.
> > > I think the file file1.root should be before file2.root when
> > > chain->Add("file[1-2].root") is used.
> > >
> > > If chain1 have a friend chain2 then inappropriate file order in any
> > > chain leads to wrong entry accordance.
> > >
> > > See the script wrong_order in the attachment. Four files
> > > tree1.root, tree2.root, friend2.root, friend1.root are created and
> > > merged. I get
> > > <session>
> > > $ root wrong_order.C
> > > <skip />
> > > ************************************
> > > *    Row   *       var * friend_va *
> > > ************************************
> > > *        0 *         1 *         2 *
> > > *        1 *         2 *         1 *
> > > ************************************
> > > </session>
> > >
> > > I expect
> > > <expected>
> > > ************************************
> > > *    Row   *       var * friend_va *
> > > ************************************
> > > *        0 *         1 *         1 *
> > > *        1 *         2 *         2 *
> > > ************************************
> > > </expected>
> > >
> > > I think this effect takes place because of simple loop other directory
> > > without sorting in the
> > > Int_t TChain::Add(const char *name, Int_t nentries)
> > > implementation.
> > >
> > > Best regards,
> > > Maksim Nikulin
> > >
> > >   --------------------------------------------------------------------------------
> > >                     Name: wrong_order.C
> > >    wrong_order.C    Type: Plain Text (text/plain)
> > >                 Encoding: 7bit
> >
> 
> --
> 
> --------------------------------------------------------
>                    Zaldy A. Nawang
>                    PS Users Room 2
>                    Yon Gokan,
>                    E362, Neutrino Group,
>                    IPNS, KEK,
>                    Japan
> 
>                    e-mail: zaldy@neutrino.kek.jp
>                    Tel. No. : (81) 029864 - 5387
> --------------------------------------------------------



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET