File indexing completed on 2024-04-06 12:24:20
0001 #ifndef PhysicsTools_Utilities_rootPlot_h
0002 #define PhysicsTools_Utilities_rootPlot_h
0003 #include "PhysicsTools/Utilities/interface/rootTf1.h"
0004 #include "TF1.h"
0005 #include "TH1.h"
0006 #include "TCanvas.h"
0007 #include "PhysicsTools/Utilities/interface/Parameter.h"
0008
0009 namespace root {
0010 namespace helper {
0011 struct PlotNoArg {};
0012 }
0013
0014 inline void plotTF1(const char* name,
0015 TF1& fun0,
0016 TF1& fun1,
0017 TH1& histo,
0018 double min,
0019 double max,
0020 Color_t lineColor0 = kRed,
0021 Width_t lineWidth0 = 1,
0022 Style_t lineStyle0 = kDashed,
0023 Int_t npx0 = 1000,
0024 Color_t lineColor1 = kGreen,
0025 Width_t lineWidth1 = 1,
0026 Style_t lineStyle1 = kDashed,
0027 Int_t npx1 = 1000,
0028 const char* title = "Histo Title",
0029 const char* xTitle = "X Title",
0030 const char* yTitle = "Y Title") {
0031 fun0.SetLineColor(lineColor0);
0032 fun0.SetLineWidth(lineWidth0);
0033 fun0.SetLineStyle(lineStyle0);
0034 fun0.SetNpx(npx0);
0035 fun1.SetLineColor(lineColor1);
0036 fun1.SetLineWidth(lineWidth1);
0037 fun1.SetLineStyle(lineStyle1);
0038 fun1.SetNpx(npx1);
0039 TCanvas* canvas = new TCanvas("canvas");
0040 histo.SetTitle(title);
0041 histo.SetXTitle(xTitle);
0042 histo.SetYTitle(yTitle);
0043 histo.Draw("e");
0044 fun0.Draw("same");
0045 fun1.Draw("same");
0046 std::string plotName = name;
0047 canvas->SaveAs(plotName.c_str());
0048 canvas->SetLogy();
0049 std::string logPlotName = "log_" + plotName;
0050 canvas->SaveAs(logPlotName.c_str());
0051 }
0052
0053 inline void plotTF1(const char* name,
0054 TF1& fun,
0055 TH1& histo,
0056 double min,
0057 double max,
0058 Color_t lineColor = kRed,
0059 Width_t lineWidth = 1,
0060 Style_t lineStyle = kDashed,
0061 Int_t npx = 1000,
0062 const char* title = "Histo Title",
0063 const char* xTitle = "X Title",
0064 const char* yTitle = "Y Title") {
0065 fun.SetLineColor(lineColor);
0066 fun.SetLineWidth(lineWidth);
0067 fun.SetLineStyle(lineStyle);
0068 fun.SetNpx(npx);
0069 TCanvas* canvas = new TCanvas("canvas");
0070 histo.SetTitle(title);
0071 histo.SetXTitle(xTitle);
0072 histo.SetYTitle(yTitle);
0073 histo.Draw("e");
0074 fun.Draw("same");
0075 std::string plotName = name;
0076 canvas->SaveAs(plotName.c_str());
0077 canvas->SetLogy();
0078 std::string logPlotName = "log_" + plotName;
0079 canvas->SaveAs(logPlotName.c_str());
0080 }
0081
0082 template <typename F>
0083 void plot(const char* name,
0084 TH1& histo,
0085 F& f,
0086 double min,
0087 double max,
0088 Color_t lineColor = kRed,
0089 Width_t lineWidth = 1,
0090 Style_t lineStyle = kDashed,
0091 Int_t npx = 1000,
0092 const char* title = "Histo Title",
0093 const char* xTitle = "X Title",
0094 const char* yTitle = "Y Title") {
0095 TF1 fun = root::tf1("fun", f, min, max);
0096 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0097 }
0098
0099 template <typename F>
0100 void plot(const char* name,
0101 TH1& histo,
0102 F& f,
0103 double min,
0104 double max,
0105 const funct::Parameter& p0,
0106 Color_t lineColor = kRed,
0107 Width_t lineWidth = 1,
0108 Style_t lineStyle = kDashed,
0109 Int_t npx = 1000,
0110 const char* title = "Histo Title",
0111 const char* xTitle = "X Title",
0112 const char* yTitle = "Y Title") {
0113 TF1 fun = root::tf1("fun", f, min, max, p0);
0114 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0115 }
0116
0117 template <typename F>
0118 void plot(const char* name,
0119 TH1& histo,
0120 F& f,
0121 double min,
0122 double max,
0123 const funct::Parameter& p0,
0124 const funct::Parameter& p1,
0125 Color_t lineColor = kRed,
0126 Width_t lineWidth = 1,
0127 Style_t lineStyle = kDashed,
0128 Int_t npx = 1000,
0129 const char* title = "Histo Title",
0130 const char* xTitle = "X Title",
0131 const char* yTitle = "Y Title") {
0132 TF1 fun = root::tf1("fun", f, min, max, p0, p1);
0133 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0134 }
0135
0136 template <typename F>
0137 void plot(const char* name,
0138 TH1& histo,
0139 F& f,
0140 double min,
0141 double max,
0142 const funct::Parameter& p0,
0143 const funct::Parameter& p1,
0144 const funct::Parameter& p2,
0145 Color_t lineColor = kRed,
0146 Width_t lineWidth = 1,
0147 Style_t lineStyle = kDashed,
0148 Int_t npx = 1000,
0149 const char* title = "Histo Title",
0150 const char* xTitle = "X Title",
0151 const char* yTitle = "Y Title") {
0152 TF1 fun = root::tf1("fun", f, min, max, p0, p1, p2);
0153 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0154 }
0155
0156 template <typename F>
0157 void plot(const char* name,
0158 TH1& histo,
0159 F& f,
0160 double min,
0161 double max,
0162 const funct::Parameter& p0,
0163 const funct::Parameter& p1,
0164 const funct::Parameter& p2,
0165 const funct::Parameter& p3,
0166 Color_t lineColor = kRed,
0167 Width_t lineWidth = 1,
0168 Style_t lineStyle = kDashed,
0169 Int_t npx = 1000,
0170 const char* title = "Histo Title",
0171 const char* xTitle = "X Title",
0172 const char* yTitle = "Y Title") {
0173 TF1 fun = root::tf1("fun", f, min, max, p0, p1, p2, p3);
0174 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0175 }
0176
0177 template <typename F>
0178 void plot(const char* name,
0179 TH1& histo,
0180 F& f,
0181 double min,
0182 double max,
0183 const funct::Parameter& p0,
0184 const funct::Parameter& p1,
0185 const funct::Parameter& p2,
0186 const funct::Parameter& p3,
0187 const funct::Parameter& p4,
0188 Color_t lineColor = kRed,
0189 Width_t lineWidth = 1,
0190 Style_t lineStyle = kDashed,
0191 Int_t npx = 1000,
0192 const char* title = "Histo Title",
0193 const char* xTitle = "X Title",
0194 const char* yTitle = "Y Title") {
0195 TF1 fun = root::tf1("fun", f, min, max, p0, p1, p2, p3, p4);
0196 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0197 }
0198
0199 template <typename F>
0200 void plot(const char* name,
0201 TH1& histo,
0202 F& f,
0203 double min,
0204 double max,
0205 const funct::Parameter& p0,
0206 const funct::Parameter& p1,
0207 const funct::Parameter& p2,
0208 const funct::Parameter& p3,
0209 const funct::Parameter& p4,
0210 const funct::Parameter& p5,
0211 Color_t lineColor = kRed,
0212 Width_t lineWidth = 1,
0213 Style_t lineStyle = kDashed,
0214 Int_t npx = 1000,
0215 const char* title = "Histo Title",
0216 const char* xTitle = "X Title",
0217 const char* yTitle = "Y Title") {
0218 TF1 fun = root::tf1("fun", f, min, max, p0, p1, p2, p3, p4, p5);
0219 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0220 }
0221
0222 template <typename F>
0223 void plot(const char* name,
0224 TH1& histo,
0225 F& f,
0226 double min,
0227 double max,
0228 const funct::Parameter& p0,
0229 const funct::Parameter& p1,
0230 const funct::Parameter& p2,
0231 const funct::Parameter& p3,
0232 const funct::Parameter& p4,
0233 const funct::Parameter& p5,
0234 const funct::Parameter& p6,
0235 Color_t lineColor = kRed,
0236 Width_t lineWidth = 1,
0237 Style_t lineStyle = kDashed,
0238 Int_t npx = 1000,
0239 const char* title = "Histo Title",
0240 const char* xTitle = "X Title",
0241 const char* yTitle = "Y Title") {
0242 TF1 fun = root::tf1("fun", f, min, max, p0, p1, p2, p3, p4, p5, p6);
0243 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0244 }
0245
0246 template <typename F>
0247 void plot(const char* name,
0248 TH1& histo,
0249 F& f,
0250 double min,
0251 double max,
0252 const funct::Parameter& p0,
0253 const funct::Parameter& p1,
0254 const funct::Parameter& p2,
0255 const funct::Parameter& p3,
0256 const funct::Parameter& p4,
0257 const funct::Parameter& p5,
0258 const funct::Parameter& p6,
0259 const funct::Parameter& p7,
0260 Color_t lineColor = kRed,
0261 Width_t lineWidth = 1,
0262 Style_t lineStyle = kDashed,
0263 Int_t npx = 1000,
0264 const char* title = "Histo Title",
0265 const char* xTitle = "X Title",
0266 const char* yTitle = "Y Title") {
0267 TF1 fun = root::tf1("fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7);
0268 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0269 }
0270
0271 template <typename F>
0272 void plot(const char* name,
0273 TH1& histo,
0274 F& f,
0275 double min,
0276 double max,
0277 const funct::Parameter& p0,
0278 const funct::Parameter& p1,
0279 const funct::Parameter& p2,
0280 const funct::Parameter& p3,
0281 const funct::Parameter& p4,
0282 const funct::Parameter& p5,
0283 const funct::Parameter& p6,
0284 const funct::Parameter& p7,
0285 const funct::Parameter& p8,
0286 Color_t lineColor = kRed,
0287 Width_t lineWidth = 1,
0288 Style_t lineStyle = kDashed,
0289 Int_t npx = 1000,
0290 const char* title = "Histo Title",
0291 const char* xTitle = "X Title",
0292 const char* yTitle = "Y Title") {
0293 TF1 fun = root::tf1("fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8);
0294 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0295 }
0296
0297 template <typename F>
0298 void plot(const char* name,
0299 TH1& histo,
0300 F& f,
0301 double min,
0302 double max,
0303 const funct::Parameter& p0,
0304 const funct::Parameter& p1,
0305 const funct::Parameter& p2,
0306 const funct::Parameter& p3,
0307 const funct::Parameter& p4,
0308 const funct::Parameter& p5,
0309 const funct::Parameter& p6,
0310 const funct::Parameter& p7,
0311 const funct::Parameter& p8,
0312 const funct::Parameter& p9,
0313 Color_t lineColor = kRed,
0314 Width_t lineWidth = 1,
0315 Style_t lineStyle = kDashed,
0316 Int_t npx = 1000,
0317 const char* title = "Histo Title",
0318 const char* xTitle = "X Title",
0319 const char* yTitle = "Y Title") {
0320 TF1 fun = root::tf1("fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
0321 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0322 }
0323
0324 template <typename F>
0325 void plot(const char* name,
0326 TH1& histo,
0327 F& f,
0328 double min,
0329 double max,
0330 const funct::Parameter& p0,
0331 const funct::Parameter& p1,
0332 const funct::Parameter& p2,
0333 const funct::Parameter& p3,
0334 const funct::Parameter& p4,
0335 const funct::Parameter& p5,
0336 const funct::Parameter& p6,
0337 const funct::Parameter& p7,
0338 const funct::Parameter& p8,
0339 const funct::Parameter& p9,
0340 const funct::Parameter& p10,
0341 Color_t lineColor = kRed,
0342 Width_t lineWidth = 1,
0343 Style_t lineStyle = kDashed,
0344 Int_t npx = 1000,
0345 const char* title = "Histo Title",
0346 const char* xTitle = "X Title",
0347 const char* yTitle = "Y Title") {
0348 TF1 fun = root::tf1("fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
0349 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0350 }
0351
0352 template <typename F>
0353 void plot(const char* name,
0354 TH1& histo,
0355 F& f,
0356 double min,
0357 double max,
0358 const funct::Parameter& p0,
0359 const funct::Parameter& p1,
0360 const funct::Parameter& p2,
0361 const funct::Parameter& p3,
0362 const funct::Parameter& p4,
0363 const funct::Parameter& p5,
0364 const funct::Parameter& p6,
0365 const funct::Parameter& p7,
0366 const funct::Parameter& p8,
0367 const funct::Parameter& p9,
0368 const funct::Parameter& p10,
0369 const funct::Parameter& p11,
0370 Color_t lineColor = kRed,
0371 Width_t lineWidth = 1,
0372 Style_t lineStyle = kDashed,
0373 Int_t npx = 1000,
0374 const char* title = "Histo Title",
0375 const char* xTitle = "X Title",
0376 const char* yTitle = "Y Title") {
0377 TF1 fun = root::tf1("fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
0378 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0379 }
0380
0381 template <typename F>
0382 void plot(const char* name,
0383 TH1& histo,
0384 F& f,
0385 double min,
0386 double max,
0387 const funct::Parameter& p0,
0388 const funct::Parameter& p1,
0389 const funct::Parameter& p2,
0390 const funct::Parameter& p3,
0391 const funct::Parameter& p4,
0392 const funct::Parameter& p5,
0393 const funct::Parameter& p6,
0394 const funct::Parameter& p7,
0395 const funct::Parameter& p8,
0396 const funct::Parameter& p9,
0397 const funct::Parameter& p10,
0398 const funct::Parameter& p11,
0399 const funct::Parameter& p12,
0400 Color_t lineColor = kRed,
0401 Width_t lineWidth = 1,
0402 Style_t lineStyle = kDashed,
0403 Int_t npx = 1000,
0404 const char* title = "Histo Title",
0405 const char* xTitle = "X Title",
0406 const char* yTitle = "Y Title") {
0407 TF1 fun = root::tf1("fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
0408 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0409 }
0410
0411 template <typename F>
0412 void plot(const char* name,
0413 TH1& histo,
0414 F& f,
0415 double min,
0416 double max,
0417 const funct::Parameter& p0,
0418 const funct::Parameter& p1,
0419 const funct::Parameter& p2,
0420 const funct::Parameter& p3,
0421 const funct::Parameter& p4,
0422 const funct::Parameter& p5,
0423 const funct::Parameter& p6,
0424 const funct::Parameter& p7,
0425 const funct::Parameter& p8,
0426 const funct::Parameter& p9,
0427 const funct::Parameter& p10,
0428 const funct::Parameter& p11,
0429 const funct::Parameter& p12,
0430 const funct::Parameter& p13,
0431 Color_t lineColor = kRed,
0432 Width_t lineWidth = 1,
0433 Style_t lineStyle = kDashed,
0434 Int_t npx = 1000,
0435 const char* title = "Histo Title",
0436 const char* xTitle = "X Title",
0437 const char* yTitle = "Y Title") {
0438 TF1 fun = root::tf1("fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13);
0439 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0440 }
0441
0442 template <typename F>
0443 void plot(const char* name,
0444 TH1& histo,
0445 F& f,
0446 double min,
0447 double max,
0448 const funct::Parameter& p0,
0449 const funct::Parameter& p1,
0450 const funct::Parameter& p2,
0451 const funct::Parameter& p3,
0452 const funct::Parameter& p4,
0453 const funct::Parameter& p5,
0454 const funct::Parameter& p6,
0455 const funct::Parameter& p7,
0456 const funct::Parameter& p8,
0457 const funct::Parameter& p9,
0458 const funct::Parameter& p10,
0459 const funct::Parameter& p11,
0460 const funct::Parameter& p12,
0461 const funct::Parameter& p13,
0462 const funct::Parameter& p14,
0463 Color_t lineColor = kRed,
0464 Width_t lineWidth = 1,
0465 Style_t lineStyle = kDashed,
0466 Int_t npx = 1000,
0467 const char* title = "Histo Title",
0468 const char* xTitle = "X Title",
0469 const char* yTitle = "Y Title") {
0470 TF1 fun = root::tf1("fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14);
0471 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0472 }
0473
0474 template <typename F>
0475 void plot(const char* name,
0476 TH1& histo,
0477 F& f,
0478 double min,
0479 double max,
0480 const funct::Parameter& p0,
0481 const funct::Parameter& p1,
0482 const funct::Parameter& p2,
0483 const funct::Parameter& p3,
0484 const funct::Parameter& p4,
0485 const funct::Parameter& p5,
0486 const funct::Parameter& p6,
0487 const funct::Parameter& p7,
0488 const funct::Parameter& p8,
0489 const funct::Parameter& p9,
0490 const funct::Parameter& p10,
0491 const funct::Parameter& p11,
0492 const funct::Parameter& p12,
0493 const funct::Parameter& p13,
0494 const funct::Parameter& p14,
0495 const funct::Parameter& p15,
0496 Color_t lineColor = kRed,
0497 Width_t lineWidth = 1,
0498 Style_t lineStyle = kDashed,
0499 Int_t npx = 1000,
0500 const char* title = "Histo Title",
0501 const char* xTitle = "X Title",
0502 const char* yTitle = "Y Title") {
0503 TF1 fun = root::tf1("fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15);
0504 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0505 }
0506
0507 template <typename F>
0508 void plot(const char* name,
0509 TH1& histo,
0510 F& f,
0511 double min,
0512 double max,
0513 const funct::Parameter& p0,
0514 const funct::Parameter& p1,
0515 const funct::Parameter& p2,
0516 const funct::Parameter& p3,
0517 const funct::Parameter& p4,
0518 const funct::Parameter& p5,
0519 const funct::Parameter& p6,
0520 const funct::Parameter& p7,
0521 const funct::Parameter& p8,
0522 const funct::Parameter& p9,
0523 const funct::Parameter& p10,
0524 const funct::Parameter& p11,
0525 const funct::Parameter& p12,
0526 const funct::Parameter& p13,
0527 const funct::Parameter& p14,
0528 const funct::Parameter& p15,
0529 const funct::Parameter& p16,
0530 Color_t lineColor = kRed,
0531 Width_t lineWidth = 1,
0532 Style_t lineStyle = kDashed,
0533 Int_t npx = 1000,
0534 const char* title = "Histo Title",
0535 const char* xTitle = "X Title",
0536 const char* yTitle = "Y Title") {
0537 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);
0538 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0539 }
0540
0541 template <typename F>
0542 void plot(const char* name,
0543 TH1& histo,
0544 F& f,
0545 double min,
0546 double max,
0547 const funct::Parameter& p0,
0548 const funct::Parameter& p1,
0549 const funct::Parameter& p2,
0550 const funct::Parameter& p3,
0551 const funct::Parameter& p4,
0552 const funct::Parameter& p5,
0553 const funct::Parameter& p6,
0554 const funct::Parameter& p7,
0555 const funct::Parameter& p8,
0556 const funct::Parameter& p9,
0557 const funct::Parameter& p10,
0558 const funct::Parameter& p11,
0559 const funct::Parameter& p12,
0560 const funct::Parameter& p13,
0561 const funct::Parameter& p14,
0562 const funct::Parameter& p15,
0563 const funct::Parameter& p16,
0564 const funct::Parameter& p17,
0565 Color_t lineColor = kRed,
0566 Width_t lineWidth = 1,
0567 Style_t lineStyle = kDashed,
0568 Int_t npx = 1000,
0569 const char* title = "Histo Title",
0570 const char* xTitle = "X Title",
0571 const char* yTitle = "Y Title") {
0572 TF1 fun =
0573 root::tf1("fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17);
0574 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0575 }
0576
0577 template <typename F>
0578 void plot(const char* name,
0579 TH1& histo,
0580 F& f,
0581 double min,
0582 double max,
0583 const funct::Parameter& p0,
0584 const funct::Parameter& p1,
0585 const funct::Parameter& p2,
0586 const funct::Parameter& p3,
0587 const funct::Parameter& p4,
0588 const funct::Parameter& p5,
0589 const funct::Parameter& p6,
0590 const funct::Parameter& p7,
0591 const funct::Parameter& p8,
0592 const funct::Parameter& p9,
0593 const funct::Parameter& p10,
0594 const funct::Parameter& p11,
0595 const funct::Parameter& p12,
0596 const funct::Parameter& p13,
0597 const funct::Parameter& p14,
0598 const funct::Parameter& p15,
0599 const funct::Parameter& p16,
0600 const funct::Parameter& p17,
0601 const funct::Parameter& p18,
0602 Color_t lineColor = kRed,
0603 Width_t lineWidth = 1,
0604 Style_t lineStyle = kDashed,
0605 Int_t npx = 1000,
0606 const char* title = "Histo Title",
0607 const char* xTitle = "X Title",
0608 const char* yTitle = "Y Title") {
0609 TF1 fun = root::tf1(
0610 "fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18);
0611 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0612 }
0613
0614 template <typename F>
0615 void plot(const char* name,
0616 TH1& histo,
0617 F& f,
0618 double min,
0619 double max,
0620 const funct::Parameter& p0,
0621 const funct::Parameter& p1,
0622 const funct::Parameter& p2,
0623 const funct::Parameter& p3,
0624 const funct::Parameter& p4,
0625 const funct::Parameter& p5,
0626 const funct::Parameter& p6,
0627 const funct::Parameter& p7,
0628 const funct::Parameter& p8,
0629 const funct::Parameter& p9,
0630 const funct::Parameter& p10,
0631 const funct::Parameter& p11,
0632 const funct::Parameter& p12,
0633 const funct::Parameter& p13,
0634 const funct::Parameter& p14,
0635 const funct::Parameter& p15,
0636 const funct::Parameter& p16,
0637 const funct::Parameter& p17,
0638 const funct::Parameter& p18,
0639 const funct::Parameter& p19,
0640 Color_t lineColor = kRed,
0641 Width_t lineWidth = 1,
0642 Style_t lineStyle = kDashed,
0643 Int_t npx = 1000,
0644 const char* title = "Histo Title",
0645 const char* xTitle = "X Title",
0646 const char* yTitle = "Y Title") {
0647 TF1 fun = root::tf1(
0648 "fun", f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19);
0649 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0650 }
0651
0652 template <typename F>
0653 void plot(const char* name,
0654 TH1& histo,
0655 F& f,
0656 double min,
0657 double max,
0658 const std::vector<funct::Parameter>& p,
0659 Color_t lineColor = kRed,
0660 Width_t lineWidth = 1,
0661 Style_t lineStyle = kDashed,
0662 Int_t npx = 1000,
0663 const char* title = "Histo Title",
0664 const char* xTitle = "X Title",
0665 const char* yTitle = "Y Title") {
0666 TF1 fun = root::tf1("fun", f, min, max, p);
0667 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0668 }
0669
0670 template <typename F>
0671 void plot(const char* name,
0672 TH1& histo,
0673 F& f,
0674 double min,
0675 double max,
0676 const std::vector<std::shared_ptr<double> >& p,
0677 Color_t lineColor = kRed,
0678 Width_t lineWidth = 1,
0679 Style_t lineStyle = kDashed,
0680 Int_t npx = 1000,
0681 const char* title = "Histo Title",
0682 const char* xTitle = "X Title",
0683 const char* yTitle = "Y Title") {
0684 TF1 fun = root::tf1("fun", f, min, max, p);
0685 plotTF1(name, fun, histo, min, max, lineColor, lineWidth, lineStyle, npx, title, xTitle, yTitle);
0686 }
0687 }
0688
0689 #endif