You are here

Creating a PAR package to read a given ROOT file

Starting with version 5.32/00 it is possible to easily create a PAR file to read the content of data stored into a ROOT file. This is done via TFile::MakeProject, exploiting the fact that ROOT files are self-describing and contain enough information to read what is stored. The method MakeProject of TFile has been augmented with the possibility to store the relevant information in form of a PAR file. To get the PAR file just open the file in READ mode

root [] TFile *f = TFile::Open("/path/to/myfile.root")
and run MakeProject in this way:
root [] f->MakeProject("/path/with/packages/mypack", "*", "par")
This will create mypack.par under /path/with/packages. The created PAR file is ready to be used with PROOF.

The following creates the equivalent of tutorials/proof/event.par :

$ root -l
root [0] TFile * f = TFile::Open("http://root.cern.ch/files/data/event_1.root")
Warning in <:tclass>: no dictionary for class Event is available
Warning in <:tclass>: no dictionary for class EventHeader is available
Warning in <:tclass>: no dictionary for class Track is available
root [1] f->MakeProject("packages/myevent", "*", "par") 
MakeProject has generated 3 classes in packages/myevent
Files Makefile, Makefile.arch, PROOF-INF/BUILD.sh and PROOF-INF/SETUP.C have been generated under 'packages/myevent'
myevent/
myevent/EventHeader.h
myevent/Event.h
myevent/myeventProjectInstances.h
myevent/myeventProjectHeaders.h
myevent/PROOF-INF/
myevent/PROOF-INF/BUILD.sh
myevent/PROOF-INF/SETUP.C
myevent/myeventLinkDef.h
myevent/Makefile.arch
myevent/Track.h
myevent/Makefile
myevent/myeventProjectSource.cxx
Info in <:makeproject>: PAR file packages/myevent.par generated
root [2] .q
$  ls packages/
myevent  myevent.par
$ ls packages/myevent
Event.h        Makefile       myeventLinkDef.h         myeventProjectInstances.h  PROOF-INF
EventHeader.h  Makefile.arch  myeventProjectHeaders.h  myeventProjectSource.cxx   Track.h
$ ls packages/myevent/PROOF-INF/
BUILD.sh  SETUP.C