# Warning in using prooflite with TSelector to write output tree

**URL:** <https://root-forum.cern.ch/t/warning-in-using-prooflite-with-tselector-to-write-output-tree/42537>\
**Category:** Newbie\
**Created:** [November 30, 2020, 10:16pm UTC](https://root-forum.cern.ch/t/warning-in-using-prooflite-with-tselector-to-write-output-tree/42537 "2020-11-30T22:16:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mariana](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/c0e974/32.png) [@Mariana](https://root-forum.cern.ch/u/Mariana)\
**Post date:** [November 30, 2020, 10:16pm UTC](https://root-forum.cern.ch/t/warning-in-using-prooflite-with-tselector-to-write-output-tree/42537/1 "2020-11-30T22:16:41Z")

</div>

\_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?

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [December 1, 2020, 5:31pm UTC](https://root-forum.cern.ch/t/warning-in-using-prooflite-with-tselector-to-write-output-tree/42537/2 "2020-12-01T17:31:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ganis](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ganis/32/12484_2.png) [@ganis](https://root-forum.cern.ch/u/ganis)\
**Post date:** [December 7, 2020, 3:59pm UTC](https://root-forum.cern.ch/t/warning-in-using-prooflite-with-tselector-to-write-output-tree/42537/3 "2020-12-07T15:59:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mariana](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/c0e974/32.png) [@Mariana](https://root-forum.cern.ch/u/Mariana)\
**Post date:** [December 7, 2020, 7:21pm UTC](https://root-forum.cern.ch/t/warning-in-using-prooflite-with-tselector-to-write-output-tree/42537/4 "2020-12-07T19:21:20Z")

</div>

Thank you, it worked.

---

<div class="post-metadata">

**Author:** ![Mariana](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/c0e974/32.png) [@Mariana](https://root-forum.cern.ch/u/Mariana)\
**Post date:** [December 7, 2020, 7:22pm UTC](https://root-forum.cern.ch/t/warning-in-using-prooflite-with-tselector-to-write-output-tree/42537/5 "2020-12-07T19:22:05Z")

</div>

Thank you for your help.
