1 #ifndef PhysicsTools_Utilities_rootPlot_h
2 #define PhysicsTools_Utilities_rootPlot_h
20 Color_t lineColor0 = kRed,
21 Width_t lineWidth0 = 1,
22 Style_t lineStyle0 = kDashed,
24 Color_t lineColor1 = kGreen,
25 Width_t lineWidth1 = 1,
26 Style_t lineStyle1 = kDashed,
28 const char*
title =
"Histo Title",
29 const char* xTitle =
"X Title",
30 const char* yTitle =
"Y Title") {
31 fun0.SetLineColor(lineColor0);
32 fun0.SetLineWidth(lineWidth0);
33 fun0.SetLineStyle(lineStyle0);
35 fun1.SetLineColor(lineColor1);
36 fun1.SetLineWidth(lineWidth1);
37 fun1.SetLineStyle(lineStyle1);
39 TCanvas*
canvas =
new TCanvas(
"canvas");
40 histo.SetTitle(
title);
41 histo.SetXTitle(xTitle);
42 histo.SetYTitle(yTitle);
47 canvas->SaveAs(plotName.c_str());
50 canvas->SaveAs(logPlotName.c_str());
58 Color_t lineColor = kRed,
59 Width_t lineWidth = 1,
60 Style_t lineStyle = kDashed,
62 const char*
title =
"Histo Title",
63 const char* xTitle =
"X Title",
64 const char* yTitle =
"Y Title") {
65 fun.SetLineColor(lineColor);
66 fun.SetLineWidth(lineWidth);
67 fun.SetLineStyle(lineStyle);
69 TCanvas*
canvas =
new TCanvas(
"canvas");
70 histo.SetTitle(
title);
71 histo.SetXTitle(xTitle);
72 histo.SetYTitle(yTitle);
76 canvas->SaveAs(plotName.c_str());
79 canvas->SaveAs(logPlotName.c_str());
88 Color_t lineColor = kRed,
89 Width_t lineWidth = 1,
90 Style_t lineStyle = kDashed,
92 const char*
title =
"Histo Title",
93 const char* xTitle =
"X Title",
94 const char* yTitle =
"Y Title") {
96 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
106 Color_t lineColor = kRed,
107 Width_t lineWidth = 1,
108 Style_t lineStyle = kDashed,
110 const char*
title =
"Histo Title",
111 const char* xTitle =
"X Title",
112 const char* yTitle =
"Y Title") {
113 TF1 fun =
root::tf1(
"fun", f, min, max, p0);
114 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
117 template <
typename F>
125 Color_t lineColor = kRed,
126 Width_t lineWidth = 1,
127 Style_t lineStyle = kDashed,
129 const char*
title =
"Histo Title",
130 const char* xTitle =
"X Title",
131 const char* yTitle =
"Y Title") {
132 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1);
133 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
136 template <
typename F>
145 Color_t lineColor = kRed,
146 Width_t lineWidth = 1,
147 Style_t lineStyle = kDashed,
149 const char*
title =
"Histo Title",
150 const char* xTitle =
"X Title",
151 const char* yTitle =
"Y Title") {
152 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2);
153 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
156 template <
typename F>
166 Color_t lineColor = kRed,
167 Width_t lineWidth = 1,
168 Style_t lineStyle = kDashed,
170 const char*
title =
"Histo Title",
171 const char* xTitle =
"X Title",
172 const char* yTitle =
"Y Title") {
173 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3);
174 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
177 template <
typename F>
188 Color_t lineColor = kRed,
189 Width_t lineWidth = 1,
190 Style_t lineStyle = kDashed,
192 const char*
title =
"Histo Title",
193 const char* xTitle =
"X Title",
194 const char* yTitle =
"Y Title") {
195 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4);
196 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
199 template <
typename F>
211 Color_t lineColor = kRed,
212 Width_t lineWidth = 1,
213 Style_t lineStyle = kDashed,
215 const char*
title =
"Histo Title",
216 const char* xTitle =
"X Title",
217 const char* yTitle =
"Y Title") {
218 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5);
219 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
222 template <
typename F>
235 Color_t lineColor = kRed,
236 Width_t lineWidth = 1,
237 Style_t lineStyle = kDashed,
239 const char*
title =
"Histo Title",
240 const char* xTitle =
"X Title",
241 const char* yTitle =
"Y Title") {
242 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6);
243 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
246 template <
typename F>
260 Color_t lineColor = kRed,
261 Width_t lineWidth = 1,
262 Style_t lineStyle = kDashed,
264 const char*
title =
"Histo Title",
265 const char* xTitle =
"X Title",
266 const char* yTitle =
"Y Title") {
267 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7);
268 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
271 template <
typename F>
286 Color_t lineColor = kRed,
287 Width_t lineWidth = 1,
288 Style_t lineStyle = kDashed,
290 const char*
title =
"Histo Title",
291 const char* xTitle =
"X Title",
292 const char* yTitle =
"Y Title") {
293 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8);
294 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
297 template <
typename F>
313 Color_t lineColor = kRed,
314 Width_t lineWidth = 1,
315 Style_t lineStyle = kDashed,
317 const char*
title =
"Histo Title",
318 const char* xTitle =
"X Title",
319 const char* yTitle =
"Y Title") {
320 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
321 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
324 template <
typename F>
341 Color_t lineColor = kRed,
342 Width_t lineWidth = 1,
343 Style_t lineStyle = kDashed,
345 const char*
title =
"Histo Title",
346 const char* xTitle =
"X Title",
347 const char* yTitle =
"Y Title") {
348 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
349 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
352 template <
typename F>
370 Color_t lineColor = kRed,
371 Width_t lineWidth = 1,
372 Style_t lineStyle = kDashed,
374 const char*
title =
"Histo Title",
375 const char* xTitle =
"X Title",
376 const char* yTitle =
"Y Title") {
377 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
378 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
381 template <
typename F>
400 Color_t lineColor = kRed,
401 Width_t lineWidth = 1,
402 Style_t lineStyle = kDashed,
404 const char*
title =
"Histo Title",
405 const char* xTitle =
"X Title",
406 const char* yTitle =
"Y Title") {
407 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
408 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
411 template <
typename F>
431 Color_t lineColor = kRed,
432 Width_t lineWidth = 1,
433 Style_t lineStyle = kDashed,
435 const char*
title =
"Histo Title",
436 const char* xTitle =
"X Title",
437 const char* yTitle =
"Y Title") {
438 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13);
439 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
442 template <
typename F>
463 Color_t lineColor = kRed,
464 Width_t lineWidth = 1,
465 Style_t lineStyle = kDashed,
467 const char*
title =
"Histo Title",
468 const char* xTitle =
"X Title",
469 const char* yTitle =
"Y Title") {
470 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14);
471 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
474 template <
typename F>
496 Color_t lineColor = kRed,
497 Width_t lineWidth = 1,
498 Style_t lineStyle = kDashed,
500 const char*
title =
"Histo Title",
501 const char* xTitle =
"X Title",
502 const char* yTitle =
"Y Title") {
503 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15);
504 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
507 template <
typename F>
530 Color_t lineColor = kRed,
531 Width_t lineWidth = 1,
532 Style_t lineStyle = kDashed,
534 const char*
title =
"Histo Title",
535 const char* xTitle =
"X Title",
536 const char* yTitle =
"Y Title") {
537 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16);
538 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
541 template <
typename F>
565 Color_t lineColor = kRed,
566 Width_t lineWidth = 1,
567 Style_t lineStyle = kDashed,
569 const char*
title =
"Histo Title",
570 const char* xTitle =
"X Title",
571 const char* yTitle =
"Y Title") {
573 root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17);
574 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
577 template <
typename F>
602 Color_t lineColor = kRed,
603 Width_t lineWidth = 1,
604 Style_t lineStyle = kDashed,
606 const char*
title =
"Histo Title",
607 const char* xTitle =
"X Title",
608 const char* yTitle =
"Y Title") {
610 "fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18);
611 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
614 template <
typename F>
640 Color_t lineColor = kRed,
641 Width_t lineWidth = 1,
642 Style_t lineStyle = kDashed,
644 const char*
title =
"Histo Title",
645 const char* xTitle =
"X Title",
646 const char* yTitle =
"Y Title") {
648 "fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19);
649 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
652 template <
typename F>
658 const std::vector<funct::Parameter>&
p,
659 Color_t lineColor = kRed,
660 Width_t lineWidth = 1,
661 Style_t lineStyle = kDashed,
663 const char*
title =
"Histo Title",
664 const char* xTitle =
"X Title",
665 const char* yTitle =
"Y Title") {
666 TF1 fun =
root::tf1(
"fun", f, min, max, p);
667 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
670 template <
typename F>
677 Color_t lineColor = kRed,
678 Width_t lineWidth = 1,
679 Style_t lineStyle = kDashed,
681 const char*
title =
"Histo Title",
682 const char* xTitle =
"X Title",
683 const char* yTitle =
"Y Title") {
685 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx,
title, xTitle, yTitle);
void plot(const char *name, TH1 &histo, F &f, double min, double max, Color_t lineColor=kRed, Width_t lineWidth=1, Style_t lineStyle=kDashed, Int_t npx=1000, const char *title="Histo Title", const char *xTitle="X Title", const char *yTitle="Y Title")
TF1 tf1(const char *name, F &f, double min, double max)
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
void plotTF1(const char *name, TF1 &fun0, TF1 &fun1, TH1 &histo, double min, double max, Color_t lineColor0=kRed, Width_t lineWidth0=1, Style_t lineStyle0=kDashed, Int_t npx0=1000, Color_t lineColor1=kGreen, Width_t lineWidth1=1, Style_t lineStyle1=kDashed, Int_t npx1=1000, const char *title="Histo Title", const char *xTitle="X Title", const char *yTitle="Y Title")