Update 'Design.cpp'

Renata Kopecná 2022-01-26 18:36:46 +01:00
parent 5b7dc63dd5
commit edc2d518e7

@ -4,6 +4,9 @@ Most of these functions are overloaded as ROOT was not always happy at compilati
# Functions and their parameters:
## General helper function
### 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 of the axes.
@ -137,7 +140,7 @@ Sets it's x-axis title to xaxis_name and y-axis name to yaxis_name. Sets the tit
### void design_TH1F(), design_TH1D()
Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()) and sets the marker style.
Executes [design_TH1F() or design_TH1D()](#void-design_th1f-design_th1d) and sets the marker style.
* **Parameters**
* TH1F \*histogram OR TH1D \*histogram
* string xaxis_name
@ -147,7 +150,7 @@ Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()) an
### void design_TH1F(), design_TH1D()
Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()-1) and sets range of the x-axis to (x_low,x_up) and y-axis to (y_low,y_up).
Executes [design_TH1F() or design_TH1D()](#void-design_th1f-design_th1d-1) and sets range of the x-axis to (x_low,x_up) and y-axis to (y_low,y_up).
* **Parameters**
* TH1F \*histogram OR TH1D \*histogram
* string xaxis_name
@ -161,7 +164,7 @@ Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()-1)
### TLine \*design_cut_line()
Creates and returns a TLine going from x1,y1 to x2,y2. Sets the line width to 5 and the color of the line.
* **Parameters**
* float x1
* float y1
@ -169,73 +172,81 @@ Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()-1)
* float y2
* Color_t color
* **Return**
TLine going from x1,y1 to x2,y2.
### TLine \*design_ratio_line()
Creates and returns a TLine going from x1,1 to x2,1. Sets the line width to 3, line style to 2 and the color of the line.
* **Parameters**
* float x1
* float x2
* Color_t color
* **Return**
TLine going from x1,1 to x2,1.
### TLine \*design_veto_line()
Creates and returns a TLine going from x1,y1 to x2,y2. Sets the line width to 1 and the color of the line.
* **Parameters**
* float x1
* float y1
* float x2
* float y2
* Color_t color
* **Return**
## TMVA plots
### bool DesignCorrelationPlots()
Takes an existing 2D plots and designs a nice correlation plot
* **Parameters**
* TH2F \*h_corr
* **Return**
* Always true
### TCanvas \*c_Correlation()
Creates a canvas for the correlation plots.
* **Parameters**
* string type
* **Return**
* A 800x750 TCanvas
### bool designVariablesSignalVsBackground()
Takes histograms of variables assigned as bkg and as signal and sets their properties for a nice plots.
* **Parameters**
* TH1F \*h_variableS
* TH1F \*h_variableB
* **Return**
* Always true
### bool designResponseSignalVsBackground()
Takes the signal and background response histograms and designs the overtraining plot (test sample). The method can be either "BDT" or "BDTG" or "MLP". Based on the method, the histogram y-axis range is defined.
* **Parameters**
* TH1F \*h_responseS
* TH1F \*h_responseB
* string method
* **Return**
* Always true
### bool designOvertraining()
Takes the signal and background response histograms and designs the overtraining plot (training sample).
* **Parameters**
* TH1F \*h_responseS
* TH1F \*h_responseB
* **Return**
### TCanvas \*c_VariablesSignalVsBackground()
Creates a canvas used to save the variable signal-background plots designed by [designVariablesSignalVsBackground()](#void-designVariablesSignalVsBackground).
* **Parameters**
* string variable
* **Return**
* A 750x600 TCanvas
### TCanvas \*c_Efficiency()
Creates a canvas used to save the MVA efficiency.
* **Parameters**
* string c_name
* **Return**
* A 750x525 TCanvas
### bool designEfficiency()
Takes the efficiencie in signal, efficiency in background, purity and significance histograms, makes them pretty for the efficiency plots.
* **Parameters**
* TH1F \*h_efficiencySignal
* TH1F \*h_efficiencyBackground
@ -243,9 +254,10 @@ Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()-1)
* TH1F \*h_significance
* string method
* **Return**
* Always true
*
### TPaveText \*significanceText()
Takes the number of signal nad background events and creates a text. The text is placed at xmin. In the text, the number of used events, the maximal significance and the significance at given MLP cut is listed.
* **Parameters**
* double xmin
* int nSig
@ -253,42 +265,49 @@ Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()-1)
* double maxSignificance
* double maxSignificanceMLPcut
* **Return**
* TPave text saying how many events were used and what significance is obtained
### TPaveText \*text_effFromPi0()
Takes the signal and bkg yields as input. In order to place the TPaveText well, the maximal value on the y-axis is needed.
* **Parameters**
* double yieldSig
* double yieldBkg
* double ymax
* **Return**
* TPaveText
### TCanvas \*c_ROCplot()
Creates and prepares a TCanvas for a ROC plot.
* **Parameters**
* string c_name
* **Return**
* A 650x600 TCanvas
### void designROC()
Takes a ROC histograms and sets the color of the histogram depending on the index. Makes the histogram pretty and sets the user ranges.
* **Parameters**
* TH1F\* h_ROC
* int index
### TCanvas \*c_L0MuonEff()
## Efficiency plots
### TCanvas \*c_L0MuonEff()
Creates and prepares a canvas for the L0 muon efficiency plots.
* **Parameters**
* string c_name
* **Return**
* A 650x600 TCanvas.
### void designL0MuonEffHistos()
Takes as an input efficiency histogramsobtianed from data, MC and their ratio. Sets their axis titles, colors, line width, and marker style.
* **Parameters**
* TH1D \*L0MuonEffData
* TH1D \*L0MuonEffMC
* TH1D \*L0MuonEffRatio
### TCanvas \* designL0MuonEfficiencies()
Creates a TCanvas used to plot the L0 muon efficiency. Extra string uses as a name tag. It takes as an input efficiency histogramsobtianed from data, MC and their ratio. Adds legend to the plot and the LHCb tag. Saves the TCanvas.
* **Parameters**
* string year
* string magnet
@ -296,9 +315,11 @@ Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()-1)
* TH1D \*L0MuonEffMC
* TH1D \*L0MuonEffRatio
* string extraString
* **Returns**
* [TCanvas \* designL0MuonEfficiencies()](#tcanvas-c_l0muoneff) with pretty histograms, tags and legend.
### void designBasicEfficiency()
Takes and efficiency graph with errors, sets the title, x-axis name, the range and the y-axis name based on the effName. Makes the graph pretty.
* **Parameters**
* TGraphErrors \*graph
* string title
@ -308,7 +329,7 @@ Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()-1)
* double highRange
### void designBasicEfficiency()
Calls [TCanvas \* designL0MuonEfficiencies()](#void-designbasicefficiency) and sets the color.
* **Parameters**
* TGraphErrors \*graph
* string title
@ -319,7 +340,7 @@ Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()-1)
* Color_t color
### void designMultiGraphEfficiency()
Takes a multi graph as an input, sets the title, x-axis name, the range and the y-axis name based on the effName. Makes the graph pretty.
* **Parameters**
* TMultiGraph \*graph
* string title
@ -328,14 +349,17 @@ Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()-1)
* double lowRange
* double highRange
### TCanvas \*c_canvas()
## Generic plots
### TCanvas \*c_canvas()
Create and return a generic canvas.
* **Parameters**
* string name
* **Return**
* A 750x600 TCanvas.
### void designTGraph()
Take a graph with errors, set the title, axis names, the color and the marker styles. Sets the offsets and sizes, title is set to be empty.
* **Parameters**
* TGraphErrors \*graph
* string title
@ -345,7 +369,7 @@ Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()-1)
* Int_t markerStyle
### TH1D \*generalHistogram()
Create a histogram with hist_name, title, number of bins nBins ranging from low_edge to high_edge. Ten call [void design_TH1D()](#void-designth1d). Return the histogram.
* **Parameters**
* string hist_name
* string title
@ -356,18 +380,20 @@ Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()-1)
* string yaxis_name
* Color_t color
* **Return**
* A TH1D histogram
### TH1D \*BmassHistogram()
Calls [generalHistogram()](#th1d-generalhistogram) with 100 bins, y-axis name "Counts a.u.". Sets line width to 2. Returns the histogram.
* **Parameters**
* string hist_name
* string title
* string xaxis_name
* Color_t color
* **Return**
* Returns a histogram with 100 bins.
### void TM_canvas()
Creates and saves a canvas with the truth-matched, not truth-matched and both distributions.
* **Parameters**
* string name
* TH1D \*all
@ -381,7 +407,15 @@ Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()-1)
* bool Inc
### void designMultiGraph()
Makes a pretty multigraph.
* **Parameters**
* TMultiGraph \*multGraph
* string name
* string xaxis_name
* string yaxis_name
### void designMultiGraph()
Calls [designMultiGraph()](#void-designmultigraph) and sets the x- and y-axis ranges.
* **Parameters**
* TMultiGraph \*multGraph
* string name
@ -392,16 +426,9 @@ Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()-1)
* double lowy
* double highy
### void designMultiGraph()
* **Parameters**
* TMultiGraph \*multGraph
* string name
* string xaxis_name
* string yaxis_name
### void addYearTag()
Draws a TLatex with the Run/Year tag placed at (x,y). Scaling decides the size of the text. For the tag, see [[Utils.hpp|Utils.hpp]].
* **Parameters**
* Float_t x = 0.6
* Float_t y = 0.85
@ -411,37 +438,41 @@ Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()-1)
* Float_t Scaling = 1.0
### void addAnyTag()
Draws a TLatex saying `text` at (x,y).
* **Parameters**
* Float_t x = 0.6
* Float_t y = 0.85
* string text = ""
* Int_t color = 1
* Float_t Scaling = 1.0
## Truth-matching plots
### TCanvas \*c_for_TH2D()
Creates a canvas used fro 2D truth-matching plots.
* **Parameters**
* string name
* **Return**
* A 800x750 TCanvas.
### bool designTH2D()
Prepares a 2D histrogam.
* **Parameters**
* TH2F \*hist
* **Return**
* Always true
### TH1D \*hist_cosThetaK()
Calls [generalHistogram()](#th1d-generalhistogram), setting automatically the ranges, 75 bins, axis labels. Boolean `cos` denothes whether to use a cos(angle) or just (angle).
* **Parameters**
* string hist_name
* string title
* Color_t color
* bool cos
* **Return**
* A histogram of a ctk diostribution
### TH1D \*hist_cosAngle()
Calls [generalHistogram()](#th1d-generalhistogram) for given `angle`. Angle can be either "thetak","thetal" or "phi"
* **Parameters**
* string angle
* string hist_name
@ -451,35 +482,39 @@ Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()-1)
* bool norm
* **Return**
### void designMassFitFrame()
## Mass fit plots
### void designMassFitFrame()
Takes RooPlot fram eas an input and prepares it for the B+ mass plots. Pull heigh specifies what fraction of the canvas will be the pull plot.
* **Parameters**
* RooPlot\* frame
* float pullHeight
### void designPullFrame()
Takes RooPlot frame and RooPlot pull frame as input. Prepares them for the B+ mass plots. Pull heigh specifies what fraction of the canvas will be the pull plot.
* **Parameters**
* RooPlot \*pullFrame
* RooPlot \*frame_m
* float pullHeight
### TLine \*threeSigmaLine ()
Creates and returns a line from `cut_B_plus_M_low` to `cut_B_plus_M_high` (see [[GlobalFunctions.hpp|GlobalFunctions.hpp]]) at either +3 or at -3 depending on the `plus` boolean.
* **Parameters**
* bool plus
* **Return**
* A TLine showing the (+ or -) 3 sigma line in a B plus mass plot.
## Reweighting control plots
### void drawKolmogorovTest()
Take the nTracks histogram in data and MC as an input, plot them including the Kolmogorov test and save the plot.
* **Parameters**
* TH1D \*hist_nTracks
* TH1D \* hist_nTracks_MC
* TH1D \*hist_nTracks_MC
* string canvasPath
* string TMtype
### void drawWeightRatio()
Take the weights used for MC reweighting, plot it, save it.
* **Parameters**
* TH1D \*hist_w
* string canvasPath
@ -488,13 +523,15 @@ Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()-1)
### void drawWeightCorrelation()
Takes the 2D weights used for MC reweighting, plot them with their correlation coeffiient and save in a given path.
* **Parameters**
* TH2D \*hCorrelationCheck
* double CorrelationCoefficent
* string canvasPath
## MVA scan, yield plots
### void designYieldGraph()
Take the graph with errors created by the MVA scan ([[BDTcutScanner.cpp|BDTcutScanner]]), make it prety and save it to the basicPath with the given tag.
* **Parameters**
* TGraphErrors \*graph
* int Run
@ -505,7 +542,7 @@ Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()-1)
* bool fineScan
### void design_YieldInQ2()
Take the signal, background, significance and CMS yield graphs with errors, make it in a beautiful complicated plot and save it.
* **Parameters**
* int Run
* TGraphErrors \*graphSig
@ -515,7 +552,7 @@ Executes [design_TH1F() or design_TH1D()](#void-design_th1f(),-design_th1d()-1)
* bool fixRange
### void design_SignificanceInQ2()
Take only the significance and CMS yield graphs with errors, make it in a beautiful complicated plot and save it.
* **Parameters**
* int Run
* TGraphErrors \*graphSignificance