CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
rootPlot.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_Utilities_rootPlot_h
2 #define PhysicsTools_Utilities_rootPlot_h
4 #include "TF1.h"
5 #include "TH1.h"
6 #include "TCanvas.h"
8 
9 namespace root {
10  namespace helper {
11  struct PlotNoArg {};
12  } // namespace helper
13 
14  inline void plotTF1(const char* name,
15  TF1& fun0,
16  TF1& fun1,
17  TH1& histo,
18  double min,
19  double max,
20  Color_t lineColor0 = kRed,
21  Width_t lineWidth0 = 1,
22  Style_t lineStyle0 = kDashed,
23  Int_t npx0 = 1000,
24  Color_t lineColor1 = kGreen,
25  Width_t lineWidth1 = 1,
26  Style_t lineStyle1 = kDashed,
27  Int_t npx1 = 1000,
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);
34  fun0.SetNpx(npx0);
35  fun1.SetLineColor(lineColor1);
36  fun1.SetLineWidth(lineWidth1);
37  fun1.SetLineStyle(lineStyle1);
38  fun1.SetNpx(npx1);
39  TCanvas* canvas = new TCanvas("canvas");
40  histo.SetTitle(title);
41  histo.SetXTitle(xTitle);
42  histo.SetYTitle(yTitle);
43  histo.Draw("e");
44  fun0.Draw("same");
45  fun1.Draw("same");
47  canvas->SaveAs(plotName.c_str());
48  canvas->SetLogy();
49  std::string logPlotName = "log_" + plotName;
50  canvas->SaveAs(logPlotName.c_str());
51  }
52 
53  inline void plotTF1(const char* name,
54  TF1& fun,
55  TH1& histo,
56  double min,
57  double max,
58  Color_t lineColor = kRed,
59  Width_t lineWidth = 1,
60  Style_t lineStyle = kDashed,
61  Int_t npx = 1000,
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);
68  fun.SetNpx(npx);
69  TCanvas* canvas = new TCanvas("canvas");
70  histo.SetTitle(title);
71  histo.SetXTitle(xTitle);
72  histo.SetYTitle(yTitle);
73  histo.Draw("e");
74  fun.Draw("same");
76  canvas->SaveAs(plotName.c_str());
77  canvas->SetLogy();
78  std::string logPlotName = "log_" + plotName;
79  canvas->SaveAs(logPlotName.c_str());
80  }
81 
82  template <typename F>
83  void plot(const char* name,
84  TH1& histo,
85  F& f,
86  double min,
87  double max,
88  Color_t lineColor = kRed,
89  Width_t lineWidth = 1,
90  Style_t lineStyle = kDashed,
91  Int_t npx = 1000,
92  const char* title = "Histo Title",
93  const char* xTitle = "X Title",
94  const char* yTitle = "Y Title") {
95  TF1 fun = root::tf1("fun", f, min, max);
96  plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
97  }
98 
99  template <typename F>
100  void plot(const char* name,
101  TH1& histo,
102  F& f,
103  double min,
104  double max,
105  const funct::Parameter& p0,
106  Color_t lineColor = kRed,
107  Width_t lineWidth = 1,
108  Style_t lineStyle = kDashed,
109  Int_t npx = 1000,
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);
115  }
116 
117  template <typename F>
118  void plot(const char* name,
119  TH1& histo,
120  F& f,
121  double min,
122  double max,
123  const funct::Parameter& p0,
124  const funct::Parameter& p1,
125  Color_t lineColor = kRed,
126  Width_t lineWidth = 1,
127  Style_t lineStyle = kDashed,
128  Int_t npx = 1000,
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);
134  }
135 
136  template <typename F>
137  void plot(const char* name,
138  TH1& histo,
139  F& f,
140  double min,
141  double max,
142  const funct::Parameter& p0,
143  const funct::Parameter& p1,
144  const funct::Parameter& p2,
145  Color_t lineColor = kRed,
146  Width_t lineWidth = 1,
147  Style_t lineStyle = kDashed,
148  Int_t npx = 1000,
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);
154  }
155 
156  template <typename F>
157  void plot(const char* name,
158  TH1& histo,
159  F& f,
160  double min,
161  double max,
162  const funct::Parameter& p0,
163  const funct::Parameter& p1,
164  const funct::Parameter& p2,
165  const funct::Parameter& p3,
166  Color_t lineColor = kRed,
167  Width_t lineWidth = 1,
168  Style_t lineStyle = kDashed,
169  Int_t npx = 1000,
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);
175  }
176 
177  template <typename F>
178  void plot(const char* name,
179  TH1& histo,
180  F& f,
181  double min,
182  double max,
183  const funct::Parameter& p0,
184  const funct::Parameter& p1,
185  const funct::Parameter& p2,
186  const funct::Parameter& p3,
187  const funct::Parameter& p4,
188  Color_t lineColor = kRed,
189  Width_t lineWidth = 1,
190  Style_t lineStyle = kDashed,
191  Int_t npx = 1000,
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);
197  }
198 
199  template <typename F>
200  void plot(const char* name,
201  TH1& histo,
202  F& f,
203  double min,
204  double max,
205  const funct::Parameter& p0,
206  const funct::Parameter& p1,
207  const funct::Parameter& p2,
208  const funct::Parameter& p3,
209  const funct::Parameter& p4,
210  const funct::Parameter& p5,
211  Color_t lineColor = kRed,
212  Width_t lineWidth = 1,
213  Style_t lineStyle = kDashed,
214  Int_t npx = 1000,
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);
220  }
221 
222  template <typename F>
223  void plot(const char* name,
224  TH1& histo,
225  F& f,
226  double min,
227  double max,
228  const funct::Parameter& p0,
229  const funct::Parameter& p1,
230  const funct::Parameter& p2,
231  const funct::Parameter& p3,
232  const funct::Parameter& p4,
233  const funct::Parameter& p5,
234  const funct::Parameter& p6,
235  Color_t lineColor = kRed,
236  Width_t lineWidth = 1,
237  Style_t lineStyle = kDashed,
238  Int_t npx = 1000,
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);
244  }
245 
246  template <typename F>
247  void plot(const char* name,
248  TH1& histo,
249  F& f,
250  double min,
251  double max,
252  const funct::Parameter& p0,
253  const funct::Parameter& p1,
254  const funct::Parameter& p2,
255  const funct::Parameter& p3,
256  const funct::Parameter& p4,
257  const funct::Parameter& p5,
258  const funct::Parameter& p6,
259  const funct::Parameter& p7,
260  Color_t lineColor = kRed,
261  Width_t lineWidth = 1,
262  Style_t lineStyle = kDashed,
263  Int_t npx = 1000,
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);
269  }
270 
271  template <typename F>
272  void plot(const char* name,
273  TH1& histo,
274  F& f,
275  double min,
276  double max,
277  const funct::Parameter& p0,
278  const funct::Parameter& p1,
279  const funct::Parameter& p2,
280  const funct::Parameter& p3,
281  const funct::Parameter& p4,
282  const funct::Parameter& p5,
283  const funct::Parameter& p6,
284  const funct::Parameter& p7,
285  const funct::Parameter& p8,
286  Color_t lineColor = kRed,
287  Width_t lineWidth = 1,
288  Style_t lineStyle = kDashed,
289  Int_t npx = 1000,
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);
295  }
296 
297  template <typename F>
298  void plot(const char* name,
299  TH1& histo,
300  F& f,
301  double min,
302  double max,
303  const funct::Parameter& p0,
304  const funct::Parameter& p1,
305  const funct::Parameter& p2,
306  const funct::Parameter& p3,
307  const funct::Parameter& p4,
308  const funct::Parameter& p5,
309  const funct::Parameter& p6,
310  const funct::Parameter& p7,
311  const funct::Parameter& p8,
312  const funct::Parameter& p9,
313  Color_t lineColor = kRed,
314  Width_t lineWidth = 1,
315  Style_t lineStyle = kDashed,
316  Int_t npx = 1000,
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);
322  }
323 
324  template <typename F>
325  void plot(const char* name,
326  TH1& histo,
327  F& f,
328  double min,
329  double max,
330  const funct::Parameter& p0,
331  const funct::Parameter& p1,
332  const funct::Parameter& p2,
333  const funct::Parameter& p3,
334  const funct::Parameter& p4,
335  const funct::Parameter& p5,
336  const funct::Parameter& p6,
337  const funct::Parameter& p7,
338  const funct::Parameter& p8,
339  const funct::Parameter& p9,
340  const funct::Parameter& p10,
341  Color_t lineColor = kRed,
342  Width_t lineWidth = 1,
343  Style_t lineStyle = kDashed,
344  Int_t npx = 1000,
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);
350  }
351 
352  template <typename F>
353  void plot(const char* name,
354  TH1& histo,
355  F& f,
356  double min,
357  double max,
358  const funct::Parameter& p0,
359  const funct::Parameter& p1,
360  const funct::Parameter& p2,
361  const funct::Parameter& p3,
362  const funct::Parameter& p4,
363  const funct::Parameter& p5,
364  const funct::Parameter& p6,
365  const funct::Parameter& p7,
366  const funct::Parameter& p8,
367  const funct::Parameter& p9,
368  const funct::Parameter& p10,
369  const funct::Parameter& p11,
370  Color_t lineColor = kRed,
371  Width_t lineWidth = 1,
372  Style_t lineStyle = kDashed,
373  Int_t npx = 1000,
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);
379  }
380 
381  template <typename F>
382  void plot(const char* name,
383  TH1& histo,
384  F& f,
385  double min,
386  double max,
387  const funct::Parameter& p0,
388  const funct::Parameter& p1,
389  const funct::Parameter& p2,
390  const funct::Parameter& p3,
391  const funct::Parameter& p4,
392  const funct::Parameter& p5,
393  const funct::Parameter& p6,
394  const funct::Parameter& p7,
395  const funct::Parameter& p8,
396  const funct::Parameter& p9,
397  const funct::Parameter& p10,
398  const funct::Parameter& p11,
399  const funct::Parameter& p12,
400  Color_t lineColor = kRed,
401  Width_t lineWidth = 1,
402  Style_t lineStyle = kDashed,
403  Int_t npx = 1000,
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);
409  }
410 
411  template <typename F>
412  void plot(const char* name,
413  TH1& histo,
414  F& f,
415  double min,
416  double max,
417  const funct::Parameter& p0,
418  const funct::Parameter& p1,
419  const funct::Parameter& p2,
420  const funct::Parameter& p3,
421  const funct::Parameter& p4,
422  const funct::Parameter& p5,
423  const funct::Parameter& p6,
424  const funct::Parameter& p7,
425  const funct::Parameter& p8,
426  const funct::Parameter& p9,
427  const funct::Parameter& p10,
428  const funct::Parameter& p11,
429  const funct::Parameter& p12,
430  const funct::Parameter& p13,
431  Color_t lineColor = kRed,
432  Width_t lineWidth = 1,
433  Style_t lineStyle = kDashed,
434  Int_t npx = 1000,
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);
440  }
441 
442  template <typename F>
443  void plot(const char* name,
444  TH1& histo,
445  F& f,
446  double min,
447  double max,
448  const funct::Parameter& p0,
449  const funct::Parameter& p1,
450  const funct::Parameter& p2,
451  const funct::Parameter& p3,
452  const funct::Parameter& p4,
453  const funct::Parameter& p5,
454  const funct::Parameter& p6,
455  const funct::Parameter& p7,
456  const funct::Parameter& p8,
457  const funct::Parameter& p9,
458  const funct::Parameter& p10,
459  const funct::Parameter& p11,
460  const funct::Parameter& p12,
461  const funct::Parameter& p13,
462  const funct::Parameter& p14,
463  Color_t lineColor = kRed,
464  Width_t lineWidth = 1,
465  Style_t lineStyle = kDashed,
466  Int_t npx = 1000,
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);
472  }
473 
474  template <typename F>
475  void plot(const char* name,
476  TH1& histo,
477  F& f,
478  double min,
479  double max,
480  const funct::Parameter& p0,
481  const funct::Parameter& p1,
482  const funct::Parameter& p2,
483  const funct::Parameter& p3,
484  const funct::Parameter& p4,
485  const funct::Parameter& p5,
486  const funct::Parameter& p6,
487  const funct::Parameter& p7,
488  const funct::Parameter& p8,
489  const funct::Parameter& p9,
490  const funct::Parameter& p10,
491  const funct::Parameter& p11,
492  const funct::Parameter& p12,
493  const funct::Parameter& p13,
494  const funct::Parameter& p14,
495  const funct::Parameter& p15,
496  Color_t lineColor = kRed,
497  Width_t lineWidth = 1,
498  Style_t lineStyle = kDashed,
499  Int_t npx = 1000,
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);
505  }
506 
507  template <typename F>
508  void plot(const char* name,
509  TH1& histo,
510  F& f,
511  double min,
512  double max,
513  const funct::Parameter& p0,
514  const funct::Parameter& p1,
515  const funct::Parameter& p2,
516  const funct::Parameter& p3,
517  const funct::Parameter& p4,
518  const funct::Parameter& p5,
519  const funct::Parameter& p6,
520  const funct::Parameter& p7,
521  const funct::Parameter& p8,
522  const funct::Parameter& p9,
523  const funct::Parameter& p10,
524  const funct::Parameter& p11,
525  const funct::Parameter& p12,
526  const funct::Parameter& p13,
527  const funct::Parameter& p14,
528  const funct::Parameter& p15,
529  const funct::Parameter& p16,
530  Color_t lineColor = kRed,
531  Width_t lineWidth = 1,
532  Style_t lineStyle = kDashed,
533  Int_t npx = 1000,
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);
539  }
540 
541  template <typename F>
542  void plot(const char* name,
543  TH1& histo,
544  F& f,
545  double min,
546  double max,
547  const funct::Parameter& p0,
548  const funct::Parameter& p1,
549  const funct::Parameter& p2,
550  const funct::Parameter& p3,
551  const funct::Parameter& p4,
552  const funct::Parameter& p5,
553  const funct::Parameter& p6,
554  const funct::Parameter& p7,
555  const funct::Parameter& p8,
556  const funct::Parameter& p9,
557  const funct::Parameter& p10,
558  const funct::Parameter& p11,
559  const funct::Parameter& p12,
560  const funct::Parameter& p13,
561  const funct::Parameter& p14,
562  const funct::Parameter& p15,
563  const funct::Parameter& p16,
564  const funct::Parameter& p17,
565  Color_t lineColor = kRed,
566  Width_t lineWidth = 1,
567  Style_t lineStyle = kDashed,
568  Int_t npx = 1000,
569  const char* title = "Histo Title",
570  const char* xTitle = "X Title",
571  const char* yTitle = "Y Title") {
572  TF1 fun =
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);
575  }
576 
577  template <typename F>
578  void plot(const char* name,
579  TH1& histo,
580  F& f,
581  double min,
582  double max,
583  const funct::Parameter& p0,
584  const funct::Parameter& p1,
585  const funct::Parameter& p2,
586  const funct::Parameter& p3,
587  const funct::Parameter& p4,
588  const funct::Parameter& p5,
589  const funct::Parameter& p6,
590  const funct::Parameter& p7,
591  const funct::Parameter& p8,
592  const funct::Parameter& p9,
593  const funct::Parameter& p10,
594  const funct::Parameter& p11,
595  const funct::Parameter& p12,
596  const funct::Parameter& p13,
597  const funct::Parameter& p14,
598  const funct::Parameter& p15,
599  const funct::Parameter& p16,
600  const funct::Parameter& p17,
601  const funct::Parameter& p18,
602  Color_t lineColor = kRed,
603  Width_t lineWidth = 1,
604  Style_t lineStyle = kDashed,
605  Int_t npx = 1000,
606  const char* title = "Histo Title",
607  const char* xTitle = "X Title",
608  const char* yTitle = "Y Title") {
609  TF1 fun = root::tf1(
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);
612  }
613 
614  template <typename F>
615  void plot(const char* name,
616  TH1& histo,
617  F& f,
618  double min,
619  double max,
620  const funct::Parameter& p0,
621  const funct::Parameter& p1,
622  const funct::Parameter& p2,
623  const funct::Parameter& p3,
624  const funct::Parameter& p4,
625  const funct::Parameter& p5,
626  const funct::Parameter& p6,
627  const funct::Parameter& p7,
628  const funct::Parameter& p8,
629  const funct::Parameter& p9,
630  const funct::Parameter& p10,
631  const funct::Parameter& p11,
632  const funct::Parameter& p12,
633  const funct::Parameter& p13,
634  const funct::Parameter& p14,
635  const funct::Parameter& p15,
636  const funct::Parameter& p16,
637  const funct::Parameter& p17,
638  const funct::Parameter& p18,
639  const funct::Parameter& p19,
640  Color_t lineColor = kRed,
641  Width_t lineWidth = 1,
642  Style_t lineStyle = kDashed,
643  Int_t npx = 1000,
644  const char* title = "Histo Title",
645  const char* xTitle = "X Title",
646  const char* yTitle = "Y Title") {
647  TF1 fun = root::tf1(
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);
650  }
651 
652  template <typename F>
653  void plot(const char* name,
654  TH1& histo,
655  F& f,
656  double min,
657  double max,
658  const std::vector<funct::Parameter>& p,
659  Color_t lineColor = kRed,
660  Width_t lineWidth = 1,
661  Style_t lineStyle = kDashed,
662  Int_t npx = 1000,
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);
668  }
669 
670  template <typename F>
671  void plot(const char* name,
672  TH1& histo,
673  F& f,
674  double min,
675  double max,
676  const std::vector<std::shared_ptr<double> >& p,
677  Color_t lineColor = kRed,
678  Width_t lineWidth = 1,
679  Style_t lineStyle = kDashed,
680  Int_t npx = 1000,
681  const char* title = "Histo Title",
682  const char* xTitle = "X Title",
683  const char* yTitle = "Y Title") {
684  TF1 fun = root::tf1("fun", f, min, max, p);
685  plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
686  }
687 } // namespace root
688 
689 #endif
const TString p2
Definition: fwPaths.cc:13
def canvas
Definition: svgfig.py:482
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")
Definition: rootPlot.h:83
const TString p1
Definition: fwPaths.cc:12
T min(T a, T b)
Definition: MathUtil.h:58
TF1 tf1(const char *name, F &f, double min, double max)
Definition: rootTf1.h:16
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
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")
Definition: rootPlot.h:14