1 #ifndef PhysicsTools_Utilities_rootPlot_h
2 #define PhysicsTools_Utilities_rootPlot_h
16 Color_t lineColor0 = kRed, Width_t lineWidth0 = 1,
17 Style_t lineStyle0 = kDashed, Int_t npx0 = 1000,
18 Color_t lineColor1 = kGreen, Width_t lineWidth1 = 1,
19 Style_t lineStyle1 = kDashed, Int_t npx1 = 1000,
20 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
21 const char * yTitle =
"Y Title") {
22 fun0.SetLineColor(lineColor0);
23 fun0.SetLineWidth(lineWidth0);
24 fun0.SetLineStyle(lineStyle0);
26 fun1.SetLineColor(lineColor1);
27 fun1.SetLineWidth(lineWidth1);
28 fun1.SetLineStyle(lineStyle1);
30 TCanvas *
canvas =
new TCanvas(
"canvas");
31 histo.SetTitle(
title);
32 histo.SetXTitle(xTitle);
33 histo.SetYTitle(yTitle);
37 std::string plotName =
name;
38 canvas->SaveAs(plotName.c_str());
40 std::string logPlotName =
"log_" + plotName;
41 canvas->SaveAs(logPlotName.c_str());
46 Color_t lineColor = kRed, Width_t lineWidth = 1,
47 Style_t lineStyle = kDashed, Int_t npx = 1000,
48 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
49 const char * yTitle =
"Y Title") {
50 fun.SetLineColor(lineColor);
51 fun.SetLineWidth(lineWidth);
52 fun.SetLineStyle(lineStyle);
54 TCanvas *
canvas =
new TCanvas(
"canvas");
55 histo.SetTitle(
title);
56 histo.SetXTitle(xTitle);
57 histo.SetYTitle(yTitle);
60 std::string plotName =
name;
61 canvas->SaveAs(plotName.c_str());
63 std::string logPlotName =
"log_" + plotName;
64 canvas->SaveAs(logPlotName.c_str());
69 Color_t lineColor = kRed, Width_t lineWidth = 1,
70 Style_t lineStyle = kDashed, Int_t npx = 1000,
71 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
72 const char * yTitle =
"Y Title") {
74 plotTF1(name, fun, histo, min, max,
75 lineColor, lineWidth, lineStyle, npx,
76 title, xTitle, yTitle);
82 Color_t lineColor = kRed, Width_t lineWidth = 1,
83 Style_t lineStyle = kDashed, Int_t npx = 1000,
84 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
85 const char * yTitle =
"Y Title") {
86 TF1 fun =
root::tf1(
"fun", f, min, max, p0);
87 plotTF1(name, fun, histo, min, max,
88 lineColor, lineWidth, lineStyle, npx,
89 title, xTitle, yTitle);
96 Color_t lineColor = kRed, Width_t lineWidth = 1,
97 Style_t lineStyle = kDashed, Int_t npx = 1000,
98 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
99 const char * yTitle =
"Y Title") {
100 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1);
101 plotTF1(name, fun, histo, min, max,
102 lineColor, lineWidth, lineStyle, npx,
103 title, xTitle, yTitle);
111 Color_t lineColor = kRed, Width_t lineWidth = 1,
112 Style_t lineStyle = kDashed, Int_t npx = 1000,
113 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
114 const char * yTitle =
"Y Title") {
115 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2);
116 plotTF1(name, fun, histo, min, max,
117 lineColor, lineWidth, lineStyle, npx,
118 title, xTitle, yTitle);
127 Color_t lineColor = kRed, Width_t lineWidth = 1,
128 Style_t lineStyle = kDashed, Int_t npx = 1000,
129 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
130 const char * yTitle =
"Y Title") {
131 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3);
132 plotTF1(name, fun, histo, min, max,
133 lineColor, lineWidth, lineStyle, npx,
134 title, xTitle, yTitle);
144 Color_t lineColor = kRed, Width_t lineWidth = 1,
145 Style_t lineStyle = kDashed, Int_t npx = 1000,
146 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
147 const char * yTitle =
"Y Title") {
148 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4);
149 plotTF1(name, fun, histo, min, max,
150 lineColor, lineWidth, lineStyle, npx,
151 title, xTitle, yTitle);
162 Color_t lineColor = kRed, Width_t lineWidth = 1,
163 Style_t lineStyle = kDashed, Int_t npx = 1000,
164 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
165 const char * yTitle =
"Y Title") {
166 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5);
167 plotTF1(name, fun, histo, min, max,
168 lineColor, lineWidth, lineStyle, npx,
169 title, xTitle, yTitle);
181 Color_t lineColor = kRed, Width_t lineWidth = 1,
182 Style_t lineStyle = kDashed, Int_t npx = 1000,
183 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
184 const char * yTitle =
"Y Title") {
185 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6);
186 plotTF1(name, fun, histo, min, max,
187 lineColor, lineWidth, lineStyle, npx,
188 title, xTitle, yTitle);
201 Color_t lineColor = kRed, Width_t lineWidth = 1,
202 Style_t lineStyle = kDashed, Int_t npx = 1000,
203 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
204 const char * yTitle =
"Y Title") {
205 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7);
206 plotTF1(name, fun, histo, min, max,
207 lineColor, lineWidth, lineStyle, npx,
208 title, xTitle, yTitle);
222 Color_t lineColor = kRed, Width_t lineWidth = 1,
223 Style_t lineStyle = kDashed, Int_t npx = 1000,
224 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
225 const char * yTitle =
"Y Title") {
226 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8);
227 plotTF1(name, fun, histo, min, max,
228 lineColor, lineWidth, lineStyle, npx,
229 title, xTitle, yTitle);
244 Color_t lineColor = kRed, Width_t lineWidth = 1,
245 Style_t lineStyle = kDashed, Int_t npx = 1000,
246 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
247 const char * yTitle =
"Y Title") {
248 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
249 plotTF1(name, fun, histo, min, max,
250 lineColor, lineWidth, lineStyle, npx,
251 title, xTitle, yTitle);
267 Color_t lineColor = kRed, Width_t lineWidth = 1,
268 Style_t lineStyle = kDashed, Int_t npx = 1000,
269 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
270 const char * yTitle =
"Y Title") {
271 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,
273 plotTF1(name, fun, histo, min, max,
274 lineColor, lineWidth, lineStyle, npx,
275 title, xTitle, yTitle);
292 Color_t lineColor = kRed, Width_t lineWidth = 1,
293 Style_t lineStyle = kDashed, Int_t npx = 1000,
294 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
295 const char * yTitle =
"Y Title") {
296 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,
298 plotTF1(name, fun, histo, min, max,
299 lineColor, lineWidth, lineStyle, npx,
300 title, xTitle, yTitle);
318 Color_t lineColor = kRed, Width_t lineWidth = 1,
319 Style_t lineStyle = kDashed, Int_t npx = 1000,
320 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
321 const char * yTitle =
"Y Title") {
322 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,
324 plotTF1(name, fun, histo, min, max,
325 lineColor, lineWidth, lineStyle, npx,
326 title, xTitle, yTitle);
345 Color_t lineColor = kRed, Width_t lineWidth = 1,
346 Style_t lineStyle = kDashed, Int_t npx = 1000,
347 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
348 const char * yTitle =
"Y Title") {
349 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,
351 plotTF1(name, fun, histo, min, max,
352 lineColor, lineWidth, lineStyle, npx,
353 title, xTitle, yTitle);
373 Color_t lineColor = kRed, Width_t lineWidth = 1,
374 Style_t lineStyle = kDashed, Int_t npx = 1000,
375 const char *
title =
"Histo Title",
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,
378 p10, p11, p12, p13, p14);
379 plotTF1(name, fun, histo, min, max,
380 lineColor, lineWidth, lineStyle, npx,
381 title, xTitle, yTitle);
402 Color_t lineColor = kRed, Width_t lineWidth = 1,
403 Style_t lineStyle = kDashed, Int_t npx = 1000,
404 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
405 const char * yTitle =
"Y Title") {
406 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,
407 p10, p11, p12, p13, p14, p15);
408 plotTF1(name, fun, histo, min, max,
409 lineColor, lineWidth, lineStyle, npx,
410 title, xTitle, yTitle);
432 Color_t lineColor = kRed, Width_t lineWidth = 1,
433 Style_t lineStyle = kDashed, Int_t npx = 1000,
434 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
435 const char * yTitle =
"Y Title") {
436 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,
437 p10, p11, p12, p13, p14, p15, p16);
438 plotTF1(name, fun, histo, min, max,
439 lineColor, lineWidth, lineStyle, npx,
440 title, xTitle, yTitle);
463 Color_t lineColor = kRed, Width_t lineWidth = 1,
464 Style_t lineStyle = kDashed, Int_t npx = 1000,
465 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
466 const char * yTitle =
"Y Title") {
467 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,
468 p10, p11, p12, p13, p14, p15, p16, p17);
469 plotTF1(name, fun, histo, min, max,
470 lineColor, lineWidth, lineStyle, npx,
471 title, xTitle, yTitle);
495 Color_t lineColor = kRed, Width_t lineWidth = 1,
496 Style_t lineStyle = kDashed, Int_t npx = 1000,
497 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
498 const char * yTitle =
"Y Title") {
499 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,
500 p10, p11, p12, p13, p14, p15, p16, p17, p18);
501 plotTF1(name, fun, histo, min, max,
502 lineColor, lineWidth, lineStyle, npx,
503 title, xTitle, yTitle);
528 Color_t lineColor = kRed, Width_t lineWidth = 1,
529 Style_t lineStyle = kDashed, Int_t npx = 1000,
530 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
531 const char * yTitle =
"Y Title") {
532 TF1 fun =
root::tf1(
"fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,
533 p10, p11, p12, p13, p14, p15, p16, p17, p18, p19);
534 plotTF1(name, fun, histo, min, max,
535 lineColor, lineWidth, lineStyle, npx,
536 title, xTitle, yTitle);
541 const std::vector<funct::Parameter> &
p,
542 Color_t lineColor = kRed, Width_t lineWidth = 1,
543 Style_t lineStyle = kDashed, Int_t npx = 1000,
544 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
545 const char * yTitle =
"Y Title") {
546 TF1 fun =
root::tf1(
"fun", f, min, max, p);
547 plotTF1(name, fun, histo, min, max,
548 lineColor, lineWidth, lineStyle, npx,
549 title, xTitle, yTitle);
554 const std::vector<boost::shared_ptr<double> > &
p,
555 Color_t lineColor = kRed, Width_t lineWidth = 1,
556 Style_t lineStyle = kDashed, Int_t npx = 1000,
557 const char *
title =
"Histo Title",
const char * xTitle =
"X Title",
558 const char * yTitle =
"Y Title") {
560 plotTF1(name, fun, histo, min, max,
561 lineColor, lineWidth, lineStyle, npx,
562 title, xTitle, yTitle);
const T & max(const T &a, const T &b)
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")
string root
initialization