Update 'nTrackWeights.cpp'

Renata Kopecná 2022-01-30 18:28:09 +01:00
parent fa2927652f
commit 1926404c14

@ -1,29 +1,27 @@
## Global variables:
In this file, the sWeghts for data and MC are calculated and saved. The variables used to create weights are defined in [[GlobalFunctions.hh|GlobalFunctions.hh]] as `firstMCweight` and `secondMCweight`. The number of bins in the histograms, their names and range are also defined there. The main function that performs the weighting is [NtrackWeight()](#int-nstrackweight)
# Functions and their parameters:
### TH1D \*get_hist_MC_w()
Clones the `*hist` and sets the name of the histogram.
* **Parameters**
* TH1D \*hist
* string name
* bool is2D
* **Return**
* An initialised histogram for MC weights.
*
### TH1D \*get_hist()
Makes a new histogram used for the weights.
* **Parameters**
* string name
* bool is2D
* bool is2D (Use one or two variables to get the weights?)
* bool isMC
* **Return**
* An initilized histogram for the weights.
### void getWeightHist()
Reads the weight from the tree, fills them into a histogram which is normalised and inverted.
* **Parameters**
* TChain \*tree
* string weightName
@ -32,29 +30,27 @@
* string TMmethod
* bool KshortDecayInVelo
* bool gammaTM
* **Return**
### void fillWeightHist()
Takes the histogram `h_w` and loads the bin content into `w` and the error into `delta_w`. If TM is true, those will be set into 1 and -1, respectively.
* **Parameters**
* double &w
* double &delta_w
* int bin
* bool TM
* TH1D \*h_w
* **Return**
### double getDelta_w2D()
* **Parameters**
* double w
* double delta_w
* double w2D
* double delta_w2D
* **Return**
Adds toghether the errors of first and second weight
### int quickFitAll()
Creates sWeights in data. Takes the model and performes B mass fit (see [[B mass model|B mass model]] for details).
* **Parameters**
* string SignalShape = "OneCB"
* string BckShape = "SingleExponential"
@ -63,9 +59,10 @@
* bool ConstrainParameters = true
* int Run = 1
* **Return**
* 0 if something fails, otherwise 1.
### int NtrackWeight()
Calculates and saves weights in the MC samples. User can deside whether to use weights only from a multiplicity variable or also use the second weighting variables.
* **Parameters**
* string year = "2011"
* const bool ReferenceChannel = false
@ -74,6 +71,7 @@
* bool KshortDecayInVelo = true
* bool sWeightUse = true
* **Return**
* 0 if something fails, otherwise 1.
### int NtrackWeightAllKplus()