HReport
class description - source file - inheritance tree (.pdf)
protected:
void initVariables()
public:
HReport(const char* name, const char* title)
HReport(const HReport&)
~HReport()
void addText(TString text)
void allwaysSkipCurly()
static TClass* Class()
void closeAppendix()
void closeDocument()
void closeTable(TString cap, TString shcap, TString lab)
void figure(TCanvas* canvas = 0, TString cap, TString shcap, TString lab, Float_t width = -1, Int_t x1 = -1, Int_t y1 = -1, Int_t x2 = -1, Int_t y2 = -1, Int_t rotate = 0, TString filename, Bool_t force = kFALSE, TString format = pdf)
void figureSideCaption(TCanvas* canvas = 0, TString cap, TString shcap, TString lab, Float_t widthpic = 0.5, Float_t widthtxt = 0.45, Float_t space = 0.02, Int_t x1 = -1, Int_t y1 = -1, Int_t x2 = -1, Int_t y2 = -1, Int_t rotate = 0, TString filename, Bool_t force = kFALSE, TString format = pdf)
void includePackages(TString packages)
void includeSource(TString source, TString cap, TString shcap, TString label, Int_t firstline = -1, Int_t lastline = -1, TString option)
virtual TClass* IsA() const
void makepdf()
void openAppendix()
void openDocument()
void openpdf()
void openTable(TString format)
void openTex(TString tdir, TString tfile, TString titlename = Report, TString authorname)
HReport& operator=(const HReport&)
TString* parseString(TString options, Int_t& size, TString separator, Bool_t tolower = kTRUE, Bool_t removespace = kTRUE)
void printOptions()
void printOrder()
void printSettings()
Int_t saveToPdf(TCanvas* canvas = 0, TString filename, Bool_t separate = kFALSE, Bool_t force = kFALSE)
Int_t saveToPng(TCanvas* canvas = 0, TString filename, Bool_t separate = kFALSE, Bool_t force = kFALSE)
void setLineBreak(Int_t width)
void setOptions(TString option)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
void table(Float_t* val = 0, Float_t* valerr = 0, Int_t sx = 0, Int_t sy = 0, TString titlex, TString titley, TString format, TString line, TString cap, TString shcap, TString label)
void writeTex(TString text, Bool_t skip_curly = kTRUE)
protected:
TString texfile name of the report tex file
TString texdir name of the temp directory
Bool_t colorlinks ! switch pdf links
Bool_t makeTOC ! table of contents
Bool_t makeListFigures ! list of figures
Bool_t makeListTables ! list of tables
Bool_t makeListListings ! list of listings
Bool_t draft ! replace pics by place holders
Int_t font_size ! font size
TString single_double ! oneside or twoside paper
TString orientation ! landscape or potrait
TString column ! onecolumn twocolumn layout
TString viewer ! gv or acroread
Bool_t keeppics ! keep old pictures or remake
TString include_packages ! include additional packages if needed
TString title ! title of the report
TString author ! author of the report
TString date ! date of creation
TDatime daytime ! time object
ofstream* fout ! stream to output file
Bool_t setopt ! flag
Bool_t includepack ! flag
Bool_t opentex ! flag
Bool_t opendoc ! flag
Bool_t closedoc ! flag
Bool_t useviewer ! flag
Int_t linebreak ! line width in tex file
Int_t linect ! counter of character in line
Bool_t always_skip_curly ! force skipping curly braces for line break
HReport
This class provides a wrapper arround Latex/pdflatex. The tex file will
be created on the fly from a ROOT macro and compiled in background. The
output is a pdf file. This class uses pdflatex with report.sty, so it needs
latex/pdflattex to be installed on the system. For viewing acroread or gv is
used. For converting ROOT graphics ps2pdf and convert has to be available.
HReport creates a directory (name specified in openTex(...)). The tex file
and the converted pictures will be created inside the directory. The pdf
output is coppied to the working dir. A new run of HReport will remove the
existing directory (if "keeppics" option is not specified), so make sure
that the directory name is not equal to a directory you don't want to remove!
The order of the different function calls is important! setOptions("") and
includePackages("") has to be called before openTex(), otherwise they will
have no effect.
--------------------------------------------------------------------------
HOW TO USE HReport:
HReport* report=new HReport("report","report");
report->setOptions("");
Options:
landscape (default portrait)
switch the orientation of the paper
colorlinks (default no colorlinks)
pdf links will be red and printed colored
noTOC (default TOC)
do not make table of contents
noListFigures (default ListFigures)
do not make a list of figures
noListTables (default ListTables)
do not make a list of tables
noListListings (default ListListings)
do not make a list of listings
fontsize=11 or 10 (default fontsize=12)
switch to smaler fonts 10pt and 11pt
oneside (default twoside)
single sided layout
twocolumn (default onecolumn)
two text columns
keeppics (default do not keep pics)
keep the old pictures
draft (default no draft)
place holders instead of pictures
gv (default acroread)
use gv or acroread to view the pdf output
report->includePackages("name,name2"); :: comma separated list
:: of additional packages (optional)
report->openTex("tex_dir", :: temp dir in working dir (created) containing pictures,tex..
"tex_file_name.tex", :: name of the created tex file (and the created pdf output!)
"Title of report", :: Title of the report shown on the title page
"Author"); :: Author shown on the title page
report->openDocument(); :: open the tex file with specified options
report->closeDocument(); :: closes the tex file
report->makepdf(); :: calls pdflatex in background and copies the pdf output to working dir
report->openpdf(); :: opens the pdf file in acroread
--------------------------------------------------------------------------
Between openDocument() and closeDocument() you can add what ever you like
to your report.
Add any text using latex commands :
Rules: "" has to be replaced by "\"
"n" gives a new line in texfile
"n\n" creates a new paragraph
report->addText("\chapter{Report something }n "
"This report is very important....n\n "
"line can be splitted in this way if your editor does not "
"support line wrapping."};
report->openAppendix() opens the appendix environment
report->closeAppendix() close the appendix environment
--everything between the calls will go into the appendix
---------------------------------------------------------------------------
For simple formated tables a template can be created :
Float_t values[6]={1.1,2.2,
3.3,4.4,
5.5,6.6};
Float_t valerr[6]={1.1,2.2,
3.3,4.4,
5.5,6.6};
report->table(&values[0],&valerr[0], :: pointer to 1dim array value and error of value
2,3, :: size in x and y of the table (2x3 only)
"x1,x2","y1,y2,y3", :: comma separated list column header (x) and line header (y)
"|c|c|", :: format of the tabel (here centered with line separation)
"%5.1f $\pm$ %5.2f & %5.1f $\pm$ %5.2f", :: cells are seprated by &, $\pm$ indicates usage of errors,
:: formating as printf for floats (tipp: a simple % becomes \%%)
"caption of table", :: caption below the table
"short caption for list of tables", :: caption used in list of tables
"label_of_table"); :: label for referencing of the table
---------------------------------------------------------------------------
Add Root graphics to the report:
Figure with caption on the binding side:
report->figureSideCaption(Tcanvas* canvas, :: canvas pointer which contains the grahic
"caption of figure", :: caption beside the figure
"short caption for list of figures", :: caption used in list of figures
"label_of_figure", :: label for referencing of the figure
0.7,0.2,0.02, :: size of graphic / caption / space in terms of linewidth
54,30,1030,750, :: viewport x1,y1,x2,y2 in pixels (display ony a part or the picture)
:: values equal -1 shows full picture
-90, :: rotation (- = clock wise)
"filename"); :: output name of picture ("" will generate the
name from name of canvas).
force); :: picture will be created no matter if keeppics option is used
Figure with caption below as decribed above (without parameters for caption size and space)
report->figure(canv ,"caption","short cap","label",picsize,x1,y1,x2,y2,rotation,"filename");
---------------------------------------------------------------------------
Include C++ source files / ROOT macros into your code:
This is a wrapper arround listings package of tex. Not all
features are supported but the documentation of the package
will help to get the maximum usage out.
report->includeSource(TString source, :: path/filename of the source (relative path accpeted)
TString cap, :: caption used above the listing
TString shcap, :: caption used for list of listings
TString label, :: label for referencing the listing
Int_t firstline, :: first line of code listed
Int_t lastline, :: last line of code listed
TString option); :: additional options can be taken into account
HReport(const char* name,const char* title)
: TNamed(name,title)
constructor for HReport
~HReport()
destructor of HReport
void initVariables()
inits all variables
void printOptions()
void printSettings()
void setOptions(TString option)
Options:
landscape (default portrait)
switch the orientation of the paper
colorlinks (default no colorlinks)
pdf links will be red and printed colored
noTOC (default TOC)
do not make table of contents
noListFigures (default ListFigures)
do not make a list of figures
noListTables (default ListTables)
do not make a list of tables
noListListings (default ListListings)
do not make a list of listings
fontsize=11 or 10 (default fontsize=12)
switch to smaler fonts 10pt and 11pt
oneside (default twoside)
single sided layout
twocolumn (default onecolumn)
two text columns
keeppics (default do not keep pics)
keep the old pictures
draft (default no draft)
place holders instead of pictures
gv (default acroread)
use gv or acroread to view the pdf output
This function has to be called befor openTex().
void includePackages(TString packages)
Comma separated list of additional packages (optional)
report->includePackages("name,name2");
This function has to be called befor openTex().
void openTex(TString tdir,TString tfile, TString titlename, TString authorname)
The tex file and the converted pictures will be created inside the directory.
The pdf output is coppied to the working dir. A new run of HReport will
remove the existing directory (if "keeppics" option is not specified), so
make sure that the directory name is not equal to a directory you don't
want to remove!
report->openTex("tex_dir", :: temp dir in working dir (created) containing pictures,tex..
"tex_file_name.tex", :: name of the created tex file (and the created pdf output!)
"Title of report", :: Title of the report shown on the title page
"Author"); :: Author shown on the title page
void openDocument()
open the tex file with specified options
void closeDocument()
closes the tex file
void addText(TString text)
Between openDocument() and closeDocument() you can add what ever you like
to your report.
Add any text using latex commands :
Rules: "" has to be replaced by "\"
"n" gives a new line in texfile (only needed if the line
should have an extract break here, otherwise it will
done automatically)
"n\n" creates a new paragraph
report->addText("\chapter{Report something }n "
"This report is very important....n\n "
"line can be splitted in this way if your editor does not "
"support line wrapping."};
The tex file is formated with a line width of linebreak characters.
(setLineBreak()). Do not use "" as string break in input, it can cause
strange effects (use the above mentioned method).
void writeTex(TString text,Bool_t skip_curly)
remove all tabs and multible spaces from string
and insert line break in next space if line is longer than
linebreak characters. Does not break in {},[] or $$.
skip_curly= kFALSE will force to break in curly braces.
If alwaysSkipCurly() has been set skip_curly will
be overwritten to kTRUE.
void makepdf()
calls pdflatex in background and copies
the pdf output to working dir.
void openpdf()
opens the pdf file in acroread or gv
void figure(TCanvas* canvas,TString cap,TString shcap,TString lab,
Float_t width,Int_t x1,Int_t y1,Int_t x2,Int_t y2,Int_t rotate,
TString filename,Bool_t force,TString format)
Add Root graphics to the report:
The canvas will be saved as .ps and converted to pdf
by ps2pdf. The pdf pic will be stored in tex_dir.
Figure with caption below:
report->figureSideCaption(Tcanvas* canvas, :: canvas pointer which contains the grahic
"caption of figure", :: caption beside the figure
"short caption for list of figures", :: caption used in list of figures
"label_of_figure", :: label for referencing of the figure
0.7, :: size of graphic in terms of linewidth
54,30,1030,750, :: viewport x1,y1,x2,y2 in pixels (display ony a part or the picture)
:: values equal -1 shows full picture
-90, :: rotation (- = clock wise)
"filename", :: output name of picture ("" will generate the
name from name of canvas).
force); :: picture will be created no matter if keeppics option is used
void figureSideCaption(TCanvas* canvas,TString cap,TString shcap,TString lab,
Float_t widthpic,Float_t widthtxt,Float_t space,Int_t x1,Int_t y1,Int_t x2,Int_t y2,Int_t rotate,
TString filename,Bool_t force,TString format)
Add Root graphics to the report:
The canvas will be saved as .ps and converted to pdf
by ps2pdf. The pdf pic will be stored in tex_dir.
Figure with caption on the binding side:
report->figureSideCaption(Tcanvas* canvas, :: canvas pointer which contains the grahic
"caption of figure", :: caption beside the figure
"short caption for list of figures", :: caption used in list of figures
"label_of_figure", :: label for referencing of the figure
0.7,0.2,0.02, :: size of graphic / caption / space in terms of linewidth
54,30,1030,750, :: viewport x1,y1,x2,y2 in pixels (display ony a part or the picture)
:: values equal -1 shows full picture
-90, :: rotation (- = clock wise)
"filename", :: output name of picture ("" will generate the
name from name of canvas).
force); :: picture will be created no matter if keeppics option is used
void table(Float_t* val,Float_t* valerr,Int_t sx,Int_t sy,
TString titlex,TString titley,
TString format,TString line,
TString cap,TString shcap,TString label)
For simple formated tables a template can be created :
Float_t values[6]={1.1,2.2,
3.3,4.4,
5.5,6.6};
Float_t valerr[6]={1.1,2.2,
3.3,4.4,
5.5,6.6};
report->table(&values[0],&valerr[0], :: pointer to 1dim array value and error of value
2,3, :: size in x and y of the table (2x3 only)
"x1,x2","y1,y2,y3", :: comma separated list column header (x) and line header (y)
"|c|c|", :: format of the tabel (here centered with line separation)
"%5.1f $\pm$ %5.2f & %5.1f $\pm$ %5.2f", :: cells are seprated by &, $\pm$ indicates usage of errors,
:: formating as printf for floats (tipp: a simple % becomes \%%)
"caption of table", :: caption below the table
"short caption for list of tables", :: caption used in list of tables
"label_of_table"); :: label for referencing of the table
if valerr=0 no errors will be used. Which value will be printed with errors
is defined by the line format.
void openTable(TString format)
Header of the table environment.
format specifies the tabel ("|c|c|l|")
void closeTable(TString cap,TString shcap,TString label)
"cap" :: caption below the table
"shcap" :: caption used in list of tables
"label" :: label for referencing of the table
void openAppendix()
opens the appendix environment. All text added until closeAppendix()
will be contained in appendix.
void closeAppendix()
close the appendix environment. All text added between openAppendix()
and closeAppendix() will be contained in appendix.
void includeSource(TString source,TString cap,TString shcap,TString label,Int_t firstline,Int_t lastline,TString option)
Include C++ source files / ROOT macros into your code:
This is a wrapper arround listings package of tex. Not all
features are supported but the documentation of the package
will help to get the maximum out of the package.
report->includeSource(TString source, :: path/filename of the source (relative path accpeted)
TString cap, :: caption used above the listing
TString shcap, :: caption used for list of listings
TString label, :: label for referencing the listing
Int_t firstline, :: first line of code listed
Int_t lastline, :: last line of code listed
TString option); :: additional options can be taken into account
source and cap are mandatory, the is optional. Part of the source can be listed with firstline/lastline arguments.
firstline==-1 && lastline!=1 will list from beginning of file to lastline. firstline!=-1 && lastline==-1 will list
from firstline to end of file. Both equal -1 will list the full file (default).
void printOrder()
Int_t saveToPdf(TCanvas* canvas,TString filename,Bool_t separate,Bool_t force)
saves a canvas to pdf file by storing it as ps and calling
ps2pdf to convert it to pdf. The ps file will be removed.
canvas is the pointer of the canvas which you want to save
path is the path to the directory where you want to store the pdf
filename is the name of the pdf which wou create
separate=kTRUE will loop over all pads and save the pictures single
(path/filename_i) separate=kFALSE as the canvas in one pdf.
Int_t saveToPng(TCanvas* canvas,TString filename,Bool_t separate,Bool_t force)
saves a canvas to png file by storing it as ps and calling
conver to convert it to png. The ps file will be removed.
canvas is the pointer of the canvas which you want to save
path is the path to the directory where you want to store the png
filename is the name of the png which wou create
separate=kTRUE will loop over all pads and save the pictures single
(path/filename_i) separate=kFALSE as the canvas in one png.
TString* parseString(TString options,Int_t& size,TString separator,Bool_t tolower,Bool_t removespace)
loops over TString options and find substrings separated by separator
and puts them to an array of TStrings. size will hold the size of this
array and the pointer to the array is returned. If tolower is kTRUE options
will be made toLower. if removespace=kTRUE spaces will be remove from the string.
Inline Functions
void setLineBreak(Int_t width)
void allwaysSkipCurly()
TClass* Class()
TClass* IsA() const
void ShowMembers(TMemberInspector& insp, char* parent)
void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
HReport HReport(const HReport&)
HReport& operator=(const HReport&)
Last update: Fri Jan 26 12:24:38 2007
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.