From 297fe9137d964873a33c4fd09b01cbb4bc277e84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Renata=20Kopecn=C3=A1?= Date: Wed, 26 Jan 2022 16:16:19 +0100 Subject: [PATCH] Add 'Design.cpp' --- Design.cpp.md | 555 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 555 insertions(+) create mode 100644 Design.cpp.md diff --git a/Design.cpp.md b/Design.cpp.md new file mode 100644 index 0000000..6a77ce9 --- /dev/null +++ b/Design.cpp.md @@ -0,0 +1,555 @@ +In this file, the functions used to make pretty plots (creating and defining canvases, histograms, graphs, ....) are defined. Please refer to [[Selection-code|Selection code]] page for more details how to include the file into ROOT. + +Most of these functions are overloaded as ROOT was not always happy at compilation with using eg TH1 for TH1D and TH1F. + + +# Functions and their parameters: +### void design_markers() +Takes an existing histogram/TEfficiency, defines marker style. The histogram markers and lines are set to have selected color. +Sets it's x-axis title to xaxis_name and y-axis name to yaxis_name. Sets the title and label offsets. +* **Parameters** + * TH1F \*histogram OR TH1D \*histogram OR TEfficiency \*histogram + * string xaxis_name + * string yaxis_name + * Color_t color + +### void design_lines() +Takes an existing histogram, defines line style. The histogram lines are set to have selected color. +Sets it's x-axis title to xaxis_name and y-axis name to yaxis_name. Sets the title and label offsets. +* **Parameters** + * TH1F \*histogram OR TH1D \*histogram OR TH1 \*histogram + * string xaxis_name + * string yaxis_name + * Color_t color + + +### void design_filled_plot() +Takes an existing histogram, defines line width and the fill style. The histogram lines and fill are set to have selected color. +Sets it's x-axis title to xaxis_name and y-axis name to yaxis_name. Sets the title and label offsets. +* **Parameters** + * TH1F \*histogram OR TH1D \*histogram + * string xaxis_name + * string yaxis_name + * Color_t fill_color + * int fill_style + + +### void design_filled_plot() +Calls `design_filled_plot()` defined above and on top sets the line color. +* **Parameters** + * TH1F \*histogram OR TH1D \*histogram + * string xaxis_name + * string yaxis_name + * Color_t fill_color + * int fill_style + * Color_t line_color + + +### void design_canvas() +Takes an existing canvas and sets the margins. +* **Parameters** + * TCanvas \*canvas + +### void design_canvas() +Takes an existing canvas, sets the margins and the title. +* **Parameters** + * TCanvas \*canvas + * string title + +### void design_canvas_Bmass() +Takes an existing canvas and sets the margins. Used for B mass plots. +* **Parameters** + * TCanvas \*canvas + +### void design_canvas_Bmass() +Takes an existing canvas, sets the margins and the title. Used for B mass plots. +* **Parameters** + * TCanvas \*canvas + * string title + +### TCanvas \*c_TH2F() +Creates a 750x700 canvas, sets the margins, returns the canvas. +* **Parameters** + * string c_name +* **Return** + * Returns a 750x700 TCanvas. + +### void design_canvas_TH2F() +Takes an existing canvas and sets the margins. Used for 2D plots. +* **Parameters** + * TCanvas \*canvas + +### void design_canvas_fancy() +Takes an existing canvas and sets the margins. Used for fancier plots. +* **Parameters** + * TCanvas \*canvas + +### void design_TH2F() + +* **Parameters** + * TH2F \*histogram OR TH2D \*histogram + * string xaxis_name + * string yaxis_name + * string zaxis_name + +### void design_TH2F() + +* **Parameters** + * TH2F \*histogram OR TH2D \*histogram + * string xaxis_name + * string yaxis_name + * string zaxis_name + * int palette + + +### void design_TH2F_ratio() + +* **Parameters** + * TH2F \*histogram OR TH2D \*histogram + * string xaxis_name + * string yaxis_name + * string zaxis_name + * int palette + +### void design_function() + +* **Parameters** + * TF1 \*graph + * Color_t color +* **Return** + +### void design_function() + +* **Parameters** + * TF1 \*graph + * Color_t color + * int style +* **Return** + +### void design_TH1F() + +* **Parameters** + * TH1F \*histogram + * string xaxis_name + * string yaxis_name + * Color_t color +* **Return** + +### void design_TH1D() + +* **Parameters** + * TH1D \*histogram + * string xaxis_name + * string yaxis_name + * Color_t color +* **Return** + +### void design_TH1F() + +* **Parameters** + * TH1F \*histogram + * string xaxis_name + * string yaxis_name + * Color_t color + * int marker_style +* **Return** + +### void design_TH1D() + +* **Parameters** + * TH1D \*histogram + * string xaxis_name + * string yaxis_name + * Color_t color + * int marker_style +* **Return** + +### void design_TH1F() + +* **Parameters** + * TH1F \*histogram + * string xaxis_name + * string yaxis_name + * Color_t color + * int marker_style + * double x_low + * double x_up + * double y_low + * double y_up +* **Return** + +### void design_TH1D() + +* **Parameters** + * TH1D \*histogram + * string xaxis_name + * string yaxis_name + * Color_t color + * int marker_style + * double x_low + * double x_up + * double y_low + * double y_up +* **Return** + +### TLine \*design_cut_line() + +* **Parameters** + * float x1 + * float y1 + * float x2 + * float y2 + * Color_t color +* **Return** + +### TLine \*design_ratio_line() + +* **Parameters** + * float x1 + * float x2 + * Color_t color +* **Return** + +### TLine \*design_veto_line() + +* **Parameters** + * float x1 + * float y1 + * float x2 + * float y2 + * Color_t color +* **Return** + +### bool DesignCorrelationPlots() + +* **Parameters** + * TH2F \*h_corr +* **Return** + +### TCanvas \*c_Correlation() + +* **Parameters** + * string type +* **Return** + +### bool designVariablesSignalVsBackground() + +* **Parameters** + * TH1F \*h_variableS + * TH1F \*h_variableB +* **Return** + +### bool designResponseSignalVsBackground() + +* **Parameters** + * TH1F \*h_responseS + * TH1F \*h_responseB + * string method +* **Return** + +### bool designOvertraining() + +* **Parameters** + * TH1F \*h_responseS + * TH1F \*h_responseB +* **Return** + +### TCanvas \*c_VariablesSignalVsBackground() + +* **Parameters** + * string variable +* **Return** + +### TCanvas \*c_Efficiency() + +* **Parameters** + * string c_name +* **Return** + +### bool designEfficiency() + +* **Parameters** + * TH1F \*h_efficiencySignal + * TH1F \*h_efficiencyBackground + * TH1F \*h_purity + * TH1F \*h_significance + * string method +* **Return** + +### TPaveText \*significanceText() + +* **Parameters** + * double xmin + * int nSig + * int nBkg + * double maxSignificance + * double maxSignificanceMLPcut +* **Return** + +### TPaveText \*text_effFromPi0() + +* **Parameters** + * double yieldSig + * double yieldBkg + * double ymax +* **Return** + +### TCanvas \*c_ROCplot() + +* **Parameters** + * string c_name +* **Return** + +### void designROC() + +* **Parameters** + * TH1F\* h_ROC + * int index + +### TCanvas \*c_L0MuonEff() + +* **Parameters** + * string c_name +* **Return** + +### void designL0MuonEffHistos() + +* **Parameters** + * TH1D \*L0MuonEffData + * TH1D \*L0MuonEffMC + * TH1D \*L0MuonEffRatio + +### TCanvas \* designL0MuonEfficiencies() + +* **Parameters** + * string year + * string magnet + * TH1D \*L0MuonEffData + * TH1D \*L0MuonEffMC + * TH1D \*L0MuonEffRatio + * string extraString + +### void designBasicEfficiency() + +* **Parameters** + * TGraphErrors \*graph + * string title + * string xAxisName + * string effName + * double lowRange + * double highRange + +### void designBasicEfficiency() + +* **Parameters** + * TGraphErrors \*graph + * string title + * string xAxisName + * string effName + * double lowRange + * double highRange + * Color_t color + +### void designMultiGraphEfficiency() + +* **Parameters** + * TMultiGraph \*graph + * string title + * string xAxisName + * string effName + * double lowRange + * double highRange + +### TCanvas \*c_canvas() + +* **Parameters** + * string name +* **Return** + +### void designTGraph() + +* **Parameters** + * TGraphErrors \*graph + * string title + * string xAxisName + * string yAxisName + * Color_t color + * Int_t markerStyle + +### TH1D \*generalHistogram() + +* **Parameters** + * string hist_name + * string title + * int nBins + * double low_edge + * double high_edge + * string xaxis_name + * string yaxis_name + * Color_t color +* **Return** + +### TH1D \*BmassHistogram() + +* **Parameters** + * string hist_name + * string title + * string xaxis_name + * Color_t color +* **Return** + +### void TM_canvas() + +* **Parameters** + * string name + * TH1D \*all + * TH1D \*TMed + * TH1D \*notTMed + * string year + * bool ReferenceChannel + * bool PHSP + * bool B0 + * bool K1 + * bool Inc + +### void designMultiGraph() + +* **Parameters** + * TMultiGraph \*multGraph + * string name + * string xaxis_name + * string yaxis_name + * double lowx + * double highx + * double lowy + * double highy + +### void designMultiGraph() + +* **Parameters** + * TMultiGraph \*multGraph + * string name + * string xaxis_name + * string yaxis_name + +### void addYearTag() + +* **Parameters** + * Float_t x = 0.6 + * Float_t y = 0.85 + * string year = "" + * int Run = 0 + * Int_t color = 1 + * Float_t Scaling = 1.0 + +### void addAnyTag() + +* **Parameters** + * Float_t x = 0.6 + * Float_t y = 0.85 + * string text = "" + * Int_t color = 1 + * Float_t Scaling = 1.0 + +### TCanvas \*c_for_TH2D() + +* **Parameters** + * string name +* **Return** + +### bool designTH2D() + +* **Parameters** + * TH2F \*hist +* **Return** + +### TH1D \*hist_cosThetaK() + +* **Parameters** + * string hist_name + * string title + * Color_t color + * bool cos +* **Return** + +### TH1D \*hist_cosAngle() + +* **Parameters** + * string angle + * string hist_name + * string title + * Color_t color + * bool cos + * bool norm +* **Return** + +### void designMassFitFrame() + +* **Parameters** + * RooPlot\* frame + * float pullHeight + +### void designPullFrame() + +* **Parameters** + * RooPlot \*pullFrame + * RooPlot \*frame_m + * float pullHeight + +### TLine \*threeSigmaLine () + +* **Parameters** + * bool plus +* **Return** + +### void drawKolmogorovTest() + +* **Parameters** + * TH1D \*hist_nTracks + * TH1D \* hist_nTracks_MC + * string canvasPath + * string TMtype + +### void drawWeightRatio() + +* **Parameters** + * TH1D \*hist_w + * string canvasPath + * bool is2D + * string TMtype + +### void drawWeightCorrelation() + +* **Parameters** + * TH2D \*hCorrelationCheck + * double CorrelationCoefficent + * string canvasPath + +### void designYieldGraph() + +* **Parameters** + * TGraphErrors \*graph + * int Run + * string year + * string tag + * string basicPath + * TFile \*TGraphOutput + * bool fineScan + +### void design_YieldInQ2() + +* **Parameters** + * int Run + * TGraphErrors \*graphSig + * TGraphErrors \*graphBkg + * TGraphErrors \*graphSignificance + * TGraphErrors \*CMS + * bool fixRange + +### void design_SignificanceInQ2() + +* **Parameters** + * int Run + * TGraphErrors \*graphSignificance + * TGraphErrors \*CMS + * bool fixRange