class HReport: public TNamed

_HADES_CLASS_DESCRIPTION

 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


Function Members (Methods)

public:
HReport(const HReport&)
HReport(const Char_t* name = "", const Char_t* title = "")
virtual~HReport()
voidTObject::AbstractMethod(const char* method) const
voidaddText(TString text)
voidallwaysSkipCurly()
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
voidcloseAppendix()
voidcloseDocument()
voidcloseTable(TString cap = "", TString shcap = "", TString lab = "")
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
voidfigure(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")
voidfigureSideCaption(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")
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
virtual const char*TNamed::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
voidincludePackages(TString packages = "")
voidincludeSource(TString source = "", TString cap = "", TString shcap = "", TString label = "", Int_t firstline = -1, Int_t lastline = -1, TString option = "")
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
voidmakepdf()
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
voidopenAppendix()
voidopenDocument()
voidopenpdf()
voidopenTable(TString format = "")
voidopenTex(TString tdir = "", TString tfile = "", TString titlename = "Report", TString authorname = "")
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
HReport&operator=(const HReport&)
virtual voidTObject::Paint(Option_t* option = "")
TString*parseString(TString options, Int_t& size, TString separator = "", Bool_t tolower = kTRUE, Bool_t removespace = kTRUE)
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
voidprintOptions()
voidprintOrder()
voidprintSettings()
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
Int_tsaveToPdf(TCanvas* canvas = 0, TString filename = "", Bool_t separate = kFALSE, Bool_t force = kFALSE)
Int_tsaveToPng(TCanvas* canvas = 0, TString filename = "", Bool_t separate = kFALSE, Bool_t force = kFALSE)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidsetLineBreak(Int_t width)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
voidsetOptions(TString option = "")
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
voidtable(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 = "")
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
voidwriteTex(TString text = "", Bool_t skip_curly = kTRUE)
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidinitVariables()
voidTObject::MakeZombie()

Data Members

public:
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
Bool_talways_skip_curly! force skipping curly braces for line break
TStringauthor! author of the report
Bool_tclosedoc! flag
Bool_tcolorlinks! switch pdf links
TStringcolumn! onecolumn twocolumn layout
TStringdate! date of creation
TDatimedaytime! time object
Bool_tdraft! replace pics by place holders
TStringTNamed::fNameobject identifier
TStringTNamed::fTitleobject title
Int_tfont_size! font size
ofstream*fout! stream to output file
TStringinclude_packages! include additional packages if needed
Bool_tincludepack! flag
Bool_tkeeppics! keep old pictures or remake
Int_tlinebreak! line width in tex file
Int_tlinect! counter of character in line
Bool_tmakeListFigures! list of figures
Bool_tmakeListListings! list of listings
Bool_tmakeListTables! list of tables
Bool_tmakeTOC! table of contents
Bool_topendoc! flag
Bool_topentex! flag
TStringorientation! landscape or potrait
Bool_tsetopt! flag
TStringsingle_double! oneside or twoside paper
TStringtexdirname of the temp directory
TStringtexfilename of the report tex file
TStringtitle! title of the report
Bool_tuseviewer! flag
TStringviewer! gv or acroread

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

HReport(const Char_t* name = "", const Char_t* 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 = "Report", 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 = kTRUE)
 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 = 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")
 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 = 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")
 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 = 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 = "")
  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 lab = "")
   "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 = -1, Int_t lastline = -1, 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 = 0, TString filename = "", Bool_t separate = kFALSE, Bool_t force = kFALSE)
 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 = 0, TString filename = "", Bool_t separate = kFALSE, Bool_t force = kFALSE)
 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 = kTRUE, Bool_t removespace = kTRUE)
 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.
HReport(const Char_t* name = "", const Char_t* title = "")
void setLineBreak(Int_t width)
{linebreak=width;}
void allwaysSkipCurly()
{always_skip_curly=kTRUE;}

Last change: Sat May 22 13:08:04 2010
Last generated: 2010-05-22 13:08

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.