Re: how to allow a file-split only at very specific times ?

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Tue, 8 Feb 2011 10:15:16 -0600


Hi Sebastien,

> which -- I suppose -- I could manually trigger when the max-file size
> limit is looming...

Yes, you indeed could/should. In addition, as mentioned by Tim, instead of 'remember' the original output TFile, you can really on the TTree to give you access to its current TFile object. I.e. at the end you can do

     thistree->GetCurrentFile()->Write();
     delete thistree->GetCurrentFile(); // Deletes both the TFile and the TTree.

Cheers,
Philippe.

On 2/8/11 10:10 AM, Sebastien Binet wrote:
> Philippe,
>
> On Tue, 8 Feb 2011 09:27:55 -0600, Philippe Canal<pcanal_at_fnal.gov> wrote:
>> Hi Sebastien,
>>
>> For data based selection, you might be able to use
>> TFile *output_file = TFile:Open(.....);
>> TTree *output_tree = input_tree->CopyTree("pz<0"); // Or some other TTree::Draw style selection
>> output_file->Write();
>> Or if you need more precise/complicated control:
>>
>> TFile *output_file = TFile:Open(.....);
>> TTree *output_tree = input_tree->CloneTree(0);
>> for (Int_t i=0;i<input_tree->GetEntries(); i++) {
>> input_tree->GetEntry(i);
>> if (event->GetNtrack()> 605) output_tree->Fill();
>> event->Clear();
>> }
>> output->file->Write();
>>
>> See $ROOTSYS/tutorials/tree/copytree* for other examples.
> yes, I am well aware of these examples :)
>
> FTR, this is the program I am talking about:
> http://alxr.usatlas.bnl.gov/lxr/source/atlas/Tools/PyUtils/bin/filter-and-merge-d3pd.py?v=head
>
> it can remove branches off a tree, apply an entry selection based on
> the tree's variables or from an external "good run list" (xml! arf!) file.
>
> the problem is that as I am merging (and filtering) many input files and
> many trees, I may hit the MaxSizeTree limit (and I should at hit it at
> some point because even if data management likes big files, data
> migration doesn't like *too big* files) for my output merged file(s)
> while not having finished to process the entry N for all the trees I am
> processing...
>
>
> Looking deeper into the TTree source code, I finally noticed
> TTree:ChangeFile
>
> http://root.cern.ch/root/html/src/TTree.cxx.html#2192
>
> which -- I suppose -- I could manually trigger when the max-file size
> limit is looming...
>
> any road block on this path ?
>
>
Received on Tue Feb 08 2011 - 17:15:29 CET

This archive was generated by hypermail 2.2.0 : Tue Feb 08 2011 - 17:50:02 CET