ROOTTools
Loading...
Searching...
No Matches
TCanvasTools.hpp
Go to the documentation of this file.
1
11#ifndef ROOT_TOOLS_TCANVAS_TOOLS_HPP
12#define ROOT_TOOLS_TCANVAS_TOOLS_HPP
13
14#include <string>
15#include <iostream>
16
17#include "TH1.h"
18#include "TH2.h"
19#include "TCanvas.h"
20
22namespace ROOTTools
23{
24 /* @brief Draws frame for TCanvas
25 *
26 * @param[in] hist histogram that will be used as a reference for the pad frame
27 * @param[in] title title of a frame
28 * @param[in] xTitle title of X axis
29 * @param[in] yTitle title of Y axis
30 * @param[in] xTitleOffset offset of X axis title
31 * @param[in] yTitleOffset offset of Y axis title
32 * @param[in] xTitleSize sizes of X axis title and label
33 * @param[in] yTitleSize sizes of Y axis title and label
34 * @param[in] drawOppositeAxis if true frame will be drawn additionally with options "SAME X+ Y+" for drawing X and Y axis on the top and on the right respectively
35 * @param[in] drawContents if true contents of hist will be drawn
36 */
37 template<typename T>
38 void DrawFrame(T *hist, const std::string& title,
39 const std::string& xTitle, const std::string& yTitle,
40 const double xTitleOffset = 1., const double yTitleOffset = 1.5,
41 const double xTitleSize = 0.05, const double yTitleSize = 0.05,
42 const bool drawOppositeAxis = true, const bool drawContents = true);
43 /* @brief Draws frame for TCanvas
44 *
45 * @param[in] xMin minimum x value
46 * @param[in] yMin minimum y value
47 * @param[in] xMax maximum x value
48 * @param[in] yMax maximum y value
49 * @param[in] title title of a frame
50 * @param[in] xTitle title of X axis
51 * @param[in] yTitle title of Y axis
52 * @param[in] xTitleOffset offset of X axis title
53 * @param[in] yTitleOffset offset of Y axis title
54 * @param[in] xTitleSize sizes of X axis title and label
55 * @param[in] yTitleSize sizes of Y axis title and label
56 * @param[in] drawOppositeAxis if true frame will be drawn additionally with options "SAME X+ Y+" for drawing X and Y axis on the top and on the right respectively
57 */
58 void DrawFrame(const double xMin, const double yMin,
59 const double xMax, const double yMax,
60 const std::string& title, const std::string& xTitle, const std::string& yTitle,
61 const double xTitleOffset = 1., const double yTitleOffset = 1.5,
62 const double xTitleSize = 0.05, const double yTitleSize = 0.05,
63 const bool drawOppositeAxis = true);
72 void PrintCanvas(TCanvas *canv, const std::string& outputFileNameNoExt,
73 const bool printPng = true, const bool printPdf = true,
74 const bool compressPdf = true, const bool parallelCompression = true);
75}
76
77#endif /* ROOT_TOOLS_TCANVAS_TOOLS_HPP */
void PrintCanvas(TCanvas *canv, const std::string &outputFileNameNoExt, const bool printPng=true, const bool printPdf=true, const bool compressPdf=true, const bool parallelCompression=true)
Saves TCanvas in .pdf format and additionaly in .png format if specified. Also makes canvas backgroun...
Definition TCanvasTools.cpp:70
void DrawFrame(T *hist, const std::string &title, const std::string &xTitle, const std::string &yTitle, const double xTitleOffset=1., const double yTitleOffset=1.5, const double xTitleSize=0.05, const double yTitleSize=0.05, const bool drawOppositeAxis=true, const bool drawContents=true)
Definition TCanvasTools.cpp:17