_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
HReport(const HReport&) | |
HReport(const Char_t* name = "", const Char_t* title = "") | |
virtual | ~HReport() |
void | TObject::AbstractMethod(const char* method) const |
void | addText(TString text) |
void | allwaysSkipCurly() |
virtual void | TObject::AppendPad(Option_t* option = "") |
virtual void | TObject::Browse(TBrowser* b) |
static TClass* | Class() |
virtual const char* | TObject::ClassName() const |
virtual void | TNamed::Clear(Option_t* option = "") |
virtual TObject* | TNamed::Clone(const char* newname = "") const |
void | closeAppendix() |
void | closeDocument() |
void | closeTable(TString cap = "", TString shcap = "", TString lab = "") |
virtual Int_t | TNamed::Compare(const TObject* obj) const |
virtual void | TNamed::Copy(TObject& named) const |
virtual void | TObject::Delete(Option_t* option = "")MENU |
virtual Int_t | TObject::DistancetoPrimitive(Int_t px, Int_t py) |
virtual void | TObject::Draw(Option_t* option = "") |
virtual void | TObject::DrawClass() constMENU |
virtual TObject* | TObject::DrawClone(Option_t* option = "") constMENU |
virtual void | TObject::Dump() constMENU |
virtual void | TObject::Error(const char* method, const char* msgfmt) const |
virtual void | TObject::Execute(const char* method, const char* params, Int_t* error = 0) |
virtual void | TObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0) |
virtual void | TObject::ExecuteEvent(Int_t event, Int_t px, Int_t py) |
virtual void | TObject::Fatal(const char* method, const char* msgfmt) const |
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") |
virtual void | TNamed::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_t | TObject::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_t | TObject::GetObjectStat() |
virtual Option_t* | TObject::GetOption() const |
virtual const char* | TNamed::GetTitle() const |
virtual UInt_t | TObject::GetUniqueID() const |
virtual Bool_t | TObject::HandleTimer(TTimer* timer) |
virtual ULong_t | TNamed::Hash() const |
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 void | TObject::Info(const char* method, const char* msgfmt) const |
virtual Bool_t | TObject::InheritsFrom(const char* classname) const |
virtual Bool_t | TObject::InheritsFrom(const TClass* cl) const |
virtual void | TObject::Inspect() constMENU |
void | TObject::InvertBit(UInt_t f) |
virtual TClass* | IsA() const |
virtual Bool_t | TObject::IsEqual(const TObject* obj) const |
virtual Bool_t | TObject::IsFolder() const |
Bool_t | TObject::IsOnHeap() const |
virtual Bool_t | TNamed::IsSortable() const |
Bool_t | TObject::IsZombie() const |
virtual void | TNamed::ls(Option_t* option = "") const |
void | makepdf() |
void | TObject::MayNotUse(const char* method) const |
virtual Bool_t | TObject::Notify() |
void | openAppendix() |
void | openDocument() |
void | openpdf() |
void | openTable(TString format = "") |
void | openTex(TString tdir = "", TString tfile = "", TString titlename = "Report", TString authorname = "") |
static void | TObject::operator delete(void* ptr) |
static void | TObject::operator delete(void* ptr, void* vp) |
static void | TObject::operator delete[](void* ptr) |
static void | TObject::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 void | TObject::Paint(Option_t* option = "") |
TString* | parseString(TString options, Int_t& size, TString separator = "", Bool_t tolower = kTRUE, Bool_t removespace = kTRUE) |
virtual void | TObject::Pop() |
virtual void | TNamed::Print(Option_t* option = "") const |
void | printOptions() |
void | printOrder() |
void | printSettings() |
virtual Int_t | TObject::Read(const char* name) |
virtual void | TObject::RecursiveRemove(TObject* obj) |
void | TObject::ResetBit(UInt_t f) |
virtual void | TObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU |
virtual void | TObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "") |
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 | TObject::SetBit(UInt_t f) |
void | TObject::SetBit(UInt_t f, Bool_t set) |
virtual void | TObject::SetDrawOption(Option_t* option = "")MENU |
static void | TObject::SetDtorOnly(void* obj) |
void | setLineBreak(Int_t width) |
virtual void | TNamed::SetName(const char* name)MENU |
virtual void | TNamed::SetNameTitle(const char* name, const char* title) |
static void | TObject::SetObjectStat(Bool_t stat) |
void | setOptions(TString option = "") |
virtual void | TNamed::SetTitle(const char* title = "")MENU |
virtual void | TObject::SetUniqueID(UInt_t uid) |
virtual void | ShowMembers(TMemberInspector& insp, char* parent) |
virtual Int_t | TNamed::Sizeof() const |
virtual void | Streamer(TBuffer& b) |
void | StreamerNVirtual(TBuffer& b) |
virtual void | TObject::SysError(const char* method, const char* msgfmt) const |
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 = "") |
Bool_t | TObject::TestBit(UInt_t f) const |
Int_t | TObject::TestBits(UInt_t f) const |
virtual void | TObject::UseCurrentStyle() |
virtual void | TObject::Warning(const char* method, const char* msgfmt) const |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const |
void | writeTex(TString text = "", Bool_t skip_curly = kTRUE) |
virtual void | TObject::DoError(int level, const char* location, const char* fmt, va_list va) const |
void | initVariables() |
void | TObject::MakeZombie() |
enum TObject::EStatusBits { | kCanDelete | |
kMustCleanup | ||
kObjInCanvas | ||
kIsReferenced | ||
kHasUUID | ||
kCannotPick | ||
kNoContextMenu | ||
kInvalidObject | ||
}; | ||
enum TObject::[unnamed] { | kIsOnHeap | |
kNotDeleted | ||
kZombie | ||
kBitMask | ||
kSingleKey | ||
kOverwrite | ||
kWriteDelete | ||
}; |
Bool_t | always_skip_curly | ! force skipping curly braces for line break |
TString | author | ! author of the report |
Bool_t | closedoc | ! flag |
Bool_t | colorlinks | ! switch pdf links |
TString | column | ! onecolumn twocolumn layout |
TString | date | ! date of creation |
TDatime | daytime | ! time object |
Bool_t | draft | ! replace pics by place holders |
TString | TNamed::fName | object identifier |
TString | TNamed::fTitle | object title |
Int_t | font_size | ! font size |
ofstream* | fout | ! stream to output file |
TString | include_packages | ! include additional packages if needed |
Bool_t | includepack | ! flag |
Bool_t | keeppics | ! keep old pictures or remake |
Int_t | linebreak | ! line width in tex file |
Int_t | linect | ! counter of character in line |
Bool_t | makeListFigures | ! list of figures |
Bool_t | makeListListings | ! list of listings |
Bool_t | makeListTables | ! list of tables |
Bool_t | makeTOC | ! table of contents |
Bool_t | opendoc | ! flag |
Bool_t | opentex | ! flag |
TString | orientation | ! landscape or potrait |
Bool_t | setopt | ! flag |
TString | single_double | ! oneside or twoside paper |
TString | texdir | name of the temp directory |
TString | texfile | name of the report tex file |
TString | title | ! title of the report |
Bool_t | useviewer | ! flag |
TString | viewer | ! gv or acroread |
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().
Comma separated list of additional packages (optional) report->includePackages("name,name2"); This function has to be called befor 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! 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
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).
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
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
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.
Header of the table environment. format specifies the tabel ("|c|c|l|")
opens the appendix environment. All text added until closeAppendix() will be contained in appendix.
close the appendix environment. All text added between openAppendix() and closeAppendix() will be contained in appendix.
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).
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.
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.