Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
IO tutorials

These tutorials illustrate some of the capabilities of the ROOT IO subsystem, including TTree, RNTuple, SQL and XML.

Table of contents

ROOT File

These are the tutorials illustrating the ROOT File and details of its directory-like structure.

Tutorial Description
file.C Illustration of the ROOT File description
fildir.C Illustration of the ROOT File directory-like structure
importCode.C Create a ROOT File with sub-directories.
readCode.C Navigate inside a ROOT file with sub-directories and read the objects from each sub-directory.
dirs.C Create a hierarchy of directories in a ROOT File.
copyFiles.C Copy all objects (including directories) from a source file.
loopdir.C, loopdir11.C Loop over all objects of a ROOT file directory and print all the TH1 derived objects in Postscript.

Merging ROOT Files

A few examples and learning material on how to merge ROOT files together.

Tutorial Description
hadd.C Macro to add histogram files. NOTE: This macro is kept for didactical purposes only: use instead the executable $ROOTSYS/bin/hadd.
mergeSelective.C Merge only part of the content of a set of files.
testMergeCont.C Merge containers.

Various I/O related topics

The following tutorials illustrate various useful ROOT I/O features.

Tutorial Description
double32.C Details of the Double32_t data type - what is its precision and how to use it.
float16.C Details of the Float16_t data type - what is its precision and how to use it.
testTMPIFile.C Usage of TMPIFile to simulate event reconstruction and merging them in parallel.
tcontext_context_manager.py Usage of the TContext class as a Python context manager.
tfile_context_manager.py Usage of TFile class as a Python context manager.

Topics

 RNTuple tutorials
 Various examples demonstrating ROOT's RNTuple columnar I/O subsystem.
 
 TTree tutorials
 Example code which illustrates how to use ROOT trees and ntuples.
 
 FITS files interface tutorials
 Examples showing the FITS file interface.
 
 SQL tutorials
 Examples showing the SQL classes.
 
 XML tutorials
 XML examples.
 

Files

file  copyFiles.C
  View in nbviewer Open in SWAN
Example of script showing how to copy all objects (including directories) from a source file.
 
file  dirs.C
  View in nbviewer Open in SWAN
This macro illustrates how to create a hierarchy of directories in a Root file.
 
file  double32.C
  View in nbviewer Open in SWAN
Tutorial illustrating use and precision of the Double32_t data type You should run this tutorial with ACLIC: a dictionary will be automatically created.
 
file  fildir.C
  View in nbviewer Open in SWAN
This macro displays the ROOT Directory data structure
 
file  file.C
  View in nbviewer Open in SWAN
This macro displays the physical ROOT file structure
 
file  float16.C
  View in nbviewer Open in SWAN
Tutorial illustrating use and precision of the Float16_t data type.
 
file  hadd.C
  View in nbviewer Open in SWAN
Macro to add histogram files This macro is kept for didactical purposes only: use instead the executable $ROOTSYS/bin/hadd !
 
file  importCode.C
  View in nbviewer Open in SWAN
Example of script showing how to create a ROOT file with subdirectories.
 
file  loopdir.C
  View in nbviewer Open in SWAN
Example script to loop over all the objects of a ROOT file directory and print in Postscript all the TH1 derived objects.
 
file  loopdir11.C
  View in nbviewer Open in SWAN
Example script to loop over all the objects of a ROOT file directory and print in Postscript all the TH1 derived objects.
 
file  mergeSelective.C
  View in nbviewer Open in SWAN
Merge only part of the content of a set of files.
 
file  readCode.C
  View in nbviewer Open in SWAN
Example of script showing how to navigate in a ROOT file with sub-directories and read the objects in each sub-directory.
 
file  tcontext_context_manager.py
  View in nbviewer Open in SWAN
This tutorial demonstrates the usage of the TContext class as a Python context manager.
 
file  testMergeCont.C
  View in nbviewer Open in SWAN
Macro demonstrating the merging of containers.
 
file  testTMPIFile.C
  View in nbviewer Open in SWAN
This macro shows the usage of TMPIFile to simulate event reconstruction and merging them in parallel.
 
file  tfile_context_manager.py
  View in nbviewer Open in SWAN
This tutorial demonstrates the usage of the TFile class as a Python context manager.