TProofOutputFile and AutoSave problem

I’m following the instruction from: root.cern.ch/drupal/content/hand … root-files to use the TProofOutputFile. The problem is that the output file contains two copies of the TTree I’m saving.

I’ve find the same problem executing the example

runProof("ntuple", "")
root [1] _file0.ls()
TFile**		ProofNtuple.root	
 TFile*		ProofNtuple.root	
  KEY: TNtuple	ntuple;2	Demo ntuple
  KEY: TNtuple	ntuple;1	Demo ntuple
root [3] ((TTree*)_file0.Get("ntuple;1"))->GetEntries()
(const Long64_t)959
root [4] ((TTree*)_file0.Get("ntuple;2"))->GetEntries()
(const Long64_t)1000

as you can see the two ntuples are not the same.

Using ROOT 5.30/04 (in fact seems the problem is not in 5.32, by the way I have to use 5.30)

Hi,

Could you try by replacing

  fNtp->Write();

with

  fNtp->Write(0, TObject::kOverwrite);

?
I’m surprised that the problem is not present in 5.32, though.

Gerri

[quote=“ganis”]Hi,

Could you try by replacing

  fNtp->Write();

with

  fNtp->Write(0, TObject::kOverwrite);

?
I’m surprised that the problem is not present in 5.32, though.

Gerri[/quote]

Is it ok for a TProofOutputFile?

This applies to the example that you referred to, in the ProofNtuple::SlaveTerminate method.
TProofOutputFile only makes sure that the file information is transferred correctly.
The way objects are saved to the file is up to you.
The fact is that the last AutoSave automatic call makes a copy of the TTree with, in your case, 96% of the entries. The final Write saves the complete TTree; if the kOverwrite bit is not specified it will create a new copy.

As you may have seen, we have some new functionality for automatically saving outputs to a file (root.cern.ch/drupal/content/handling-outputs); but this is available in the trunk and 5.34/02 only.

[quote=“ganis”]This applies to the example that you referred to, in the ProofNtuple::SlaveTerminate method.
TProofOutputFile only makes sure that the file information is transferred correctly.
The way objects are saved to the file is up to you.
The fact is that the last AutoSave automatic call makes a copy of the TTree with, in your case, 96% of the entries. The final Write saves the complete TTree; if the kOverwrite bit is not specified it will create a new copy.

As you may have seen, we have some new functionality for automatically saving outputs to a file (root.cern.ch/drupal/content/handling-outputs); but this is available in the trunk and 5.34/02 only.[/quote]

ok, thanks. Are this new features complemetary or alternative to TProofOutputFile?

Complementary.
They heavily use TProofOutputFile inside when the save-to-file option is chosen or imposed on the server-side.