Re: can root read free format card file?

Rene Brun (Rene.Brun@cern.ch)
Mon, 30 Nov 1998 08:23:49 +0100


Canguo Li wrote:
>
> Can ROOT read card files (like FFREAD)?
> I guess the answer should be yes. Can anybody refer me to the relevant
> section of the ROOT manuals?
> My plan is to read in things like detector parameters from
> free-formatted files into arrays in my ROOT application, and then in my
> program assign these parameters to some objects(e.g., material class
> predefined by ROOT). I think this should work. However, I wonder if there's
> a better or more efficient way to achieve this purpose.
>
> --Canguo

You can read ascii files from your classes. See an example
in tutorials basic.C and staff.C.
It is however much better to replace the style "FFREAD" data cards
by a Root C++ macro calling setter functions of your classes.
This has many advantages:
- you can call this (these) macros(s) at any time from the command line
- macros can easily call other macros
- the user sees one single API (interactive & batch)
- you can document (hyperize) your input with the class THtml
Examples are given in the ATLFast package
http://root.cern.ch/root/Atlfast.html

Rene Brun