Warning in using prooflite with TSelector to write output tree

_ROOT Version: 6.08/06
Platform: CentOS7
Compiler: gcc 4.8.5

I’m using PROOF-Lite with TSelector.
I am writing a custom tree in the output.
To do so inside TSelector clas I have defined the tree and its branches as private members

TTree *m_OutTree2; //outputtree
Float_t m_eBeam,m_pxBeam,m_pyBeam,m_pzBeam,m_TargetMass; //branches

Then Inside Init() function I do

m_OutTree2= new TTree(“kin”, “kin”); //define tree
m_OutTree2->Branch(“E_Beam”, &m_eBeam, “E_Beam/F”); // Add branches to the tree
fOutput->Add(m_OutTree2); //add to output list

Inside Process() function I fill the tree

m_eBeam = locBeamP4.E(); //Assigning values to tree branches
m_OutTree2->Fill(); //Fill the tree

And finally in the Terminate() function I save the output to the file

TFile resultfile(“results.root”, “RECREATE”);
fOutput->Write();
resultfile.Close();

When I run the code it seems Proof-Lite successfully works with proof status =0,but I get a warning about the output:

root [0]
Processing /work/halld/Mariana/DSelector_analysis/gluex_root_analysis/scripts/Load_DSelector.C…
Processing Run_DSelector_DSelector_pi0etapr_new.C()…
+++ Starting PROOF-Lite with 7 workers +++
Opening connections to workers: OK (7 workers)
Setting up worker servers: OK (7 workers)
PROOF set to parallel mode (7 workers)
Info in TPackMgr::Install: installing /work/halld/Mariana/DSelector_analysis/gluex_root_analysis/Linux_CentOS7.7-x86_64-gcc4.8.5/packages/DSelector.par …
[TFile::Cp] Total 0.31 MB |====================| 100.00 % [2.3 MB/s]

Info in TProofLite::SetQueryRunning: starting query: 1
Info in TProofQueryResult::SetRunning: nwrks: 7
Looking up for exact location of files: OK (347 files)
Info in TPacketizer::TPacketizer: Initial number of workers: 7
Validating files: OK (347 files)
Lite-0: merging output objects … | (1 workers still sending)
Output file: DSelector_pi0etapr_new.root
Warning in TOutputListSelectorDataMap::SetDataMembers(): potential memory leak: replacing data member `m_OutTree2’ != 0. Please initialize m_OutTree2 to 0 in constructor DSelector_DSelector_pi0etapr_new::DSelector_DSelector_pi0etapr_new()
Lite-0: all output objects have been merged
PROOF status = 0
root [2] .q

Do you know why do I get this warning?

Hi

Please when you post code, add in the pre-formatted text field to make it more readable.
@ganis or @egiraud might know more about the warning.

Lorenzo

Hello,
The Init() is only called on the workers, so the local instance of the selector, the one printing the warnings, does not have the private members initialized. If you add an initialization (to null) in the selector constructor the warnings should go away.

This said, unless you need to stay on version 6.08/06, I suggest you move to a more recent version of ROOT, such as 6.20 or 6.22, and try RDataFrame, which is the supported way to analyse trees in parallel. Proof and ProofLite are legacy products, not really supported anymore.

G Ganis

Thank you, it worked.

Thank you for your help.