# Can the Factory output root file NOT store the TTrees?

**URL:** <https://root-forum.cern.ch/t/can-the-factory-output-root-file-not-store-the-ttrees/40944>\
**Category:** TMVA\
**Created:** [August 11, 2020, 9:37am UTC](https://root-forum.cern.ch/t/can-the-factory-output-root-file-not-store-the-ttrees/40944 "2020-08-11T09:37:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JuliaIturbe](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@JuliaIturbe](https://root-forum.cern.ch/u/JuliaIturbe)\
**Post date:** [August 11, 2020, 9:37am UTC](https://root-forum.cern.ch/t/can-the-factory-output-root-file-not-store-the-ttrees/40944/1 "2020-08-11T09:37:08Z")

</div>

Hi, is there a way to prevent the output file used in TMVA Factory from storing the train/test events in TTrees?

I’m trying to optimise the BDT parameters using a grid scan so I’m running about ~350 jobs and in each one I have about 7.5 million events. The output files are about 880 MB so I’m struggling to store everything. I would like to keep the histograms and correlation matrices but I don’t really need the TTrees.

Thanks,  
Julia.

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [August 13, 2020, 7:21am UTC](https://root-forum.cern.ch/t/can-the-factory-output-root-file-not-store-the-ttrees/40944/2 "2020-08-13T07:21:28Z")

</div>

Hi Julia,

Let me check with @swunsch and @moneta - maybe they know?

Cheers, Axel.

---

<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:** [August 13, 2020, 7:43am UTC](https://root-forum.cern.ch/t/can-the-factory-output-root-file-not-store-the-ttrees/40944/3 "2020-08-13T07:43:10Z")

</div>

Hi ,  
You can avoid writing the output trees, but in that case it will also not write the histograms and correlation matrices. I don’t think it is possible to avoid only the writing of the trees. This is maybe an option we could consider to add in a future release.  
To avoid writing the output , just pass a nullptr when constructing the Factory class. Here is an example code:

```auto
 TFile * outputFile = nullptr;
 if (writeFile) outputFile = TFile::Open( outfileName, "RECREATE" );

 // Creating the factory object
 TMVA::Factory *factory = new TMVA::Factory( "TMVAClassification", outputFile, "AnalysisType=Classification" );

```

Lorenzo
