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

From: Tim Head <betatim_at_gmail.com>
Date: Tue, 8 Feb 2011 09:50:38 -0600


Hi Philippe

On 8 February 2011 09:27, 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();
>

ROOT will still change the output file at a "random" point in time. He wants to loop over several trees at the same time, I think.

Sebastien, I would check out
http://root.cern.ch/root/html526/TTree#TTree:SetMaxTreeSize and set the file size to a very, very large number. This isn't a solution but a hack. Any reason why you need to insist on small files, don't think there is any file system that can't handle fairly 'huge" files.

You can do TTree::GetCurrentFile() and check if the file has changed for your first tree after calling Fill() and then change the file for the other trees.

Tim

-- 
http://tim.jottit.com/
Received on Tue Feb 08 2011 - 16:50:42 CET

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