Update 'Utils.hpp'
parent
be80f1eed3
commit
1308074972
120
Utils.hpp.md
120
Utils.hpp.md
@ -3,6 +3,7 @@ In this file, various helper functions are defined. Unfortunately, as we are try
|
|||||||
|
|
||||||
## Global variables:
|
## Global variables:
|
||||||
|
|
||||||
|
### Number of generated MC events
|
||||||
* double generated_basic_events = 10000.0
|
* double generated_basic_events = 10000.0
|
||||||
* double generated_basic_events_PHSP = 1000.0
|
* double generated_basic_events_PHSP = 1000.0
|
||||||
* vector\<int> generated_signal_events_down
|
* vector\<int> generated_signal_events_down
|
||||||
@ -11,10 +12,15 @@ In this file, various helper functions are defined. Unfortunately, as we are try
|
|||||||
* vector\<int> generated_reference_events_up
|
* vector\<int> generated_reference_events_up
|
||||||
* vector\<int> generated_PHSP_events_down
|
* vector\<int> generated_PHSP_events_down
|
||||||
* vector\<int> generated_PHSP_events_up
|
* vector\<int> generated_PHSP_events_up
|
||||||
|
### Generator tables
|
||||||
|
**TODO** Add linke
|
||||||
* vector\<double> gen_tables_signal_efficiency_down
|
* vector\<double> gen_tables_signal_efficiency_down
|
||||||
* vector\<double> gen_tables_signal_efficiency_up
|
* vector\<double> gen_tables_signal_efficiency_up
|
||||||
* vector\<double> gen_tables_reference_efficiency_down
|
* vector\<double> gen_tables_reference_efficiency_down
|
||||||
* vector\<double> gen_tables_reference_efficiency_up
|
* vector\<double> gen_tables_reference_efficiency_up
|
||||||
|
|
||||||
|
### Yields and their errors
|
||||||
|
Obsolete now, the numbers are not up to date!
|
||||||
* vector\<int> yield_signal_events
|
* vector\<int> yield_signal_events
|
||||||
* vector\<int> yield_signal_events_err
|
* vector\<int> yield_signal_events_err
|
||||||
* vector\<int> yield_reference_events
|
* vector\<int> yield_reference_events
|
||||||
@ -195,15 +201,18 @@ In this file, various helper functions are defined. Unfortunately, as we are try
|
|||||||
* **Return**
|
* **Return**
|
||||||
* A string combining [getFullCut()](#string-getfullcut), [getTMcut()](#string-gettmcut) and [getMultipleCut()](#string-getmultiplecut)
|
* A string combining [getFullCut()](#string-getfullcut), [getTMcut()](#string-gettmcut) and [getMultipleCut()](#string-getmultiplecut)
|
||||||
|
|
||||||
### string checkIf2015MC()
|
## Sanity checks
|
||||||
|
|
||||||
|
### string checkIf2015MC()
|
||||||
|
Buggy 2015 MC needs to be removed and replaced by 2016, hence check whether you are trying to load ot
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* string year
|
* string year
|
||||||
* bool MC
|
* bool MC
|
||||||
* bool Reference
|
* bool Reference
|
||||||
* bool PHSP
|
* bool PHSP
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* 2015 the MC sample exists, otherwise 2016
|
||||||
|
*
|
||||||
### bool checkMC()
|
### bool checkMC()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
@ -212,82 +221,90 @@ In this file, various helper functions are defined. Unfortunately, as we are try
|
|||||||
* bool PHSP
|
* bool PHSP
|
||||||
* bool mutuallyExclusive
|
* bool mutuallyExclusive
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* True if you are selecting a meaningful sample, otherwise false
|
||||||
|
|
||||||
### bool checkMC()
|
### bool checkMC()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* bool ReferenceChannel
|
* bool ReferenceChannel
|
||||||
* bool PHSP
|
* bool PHSP
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* True if !(ReferenceChannel && PHSP), else False
|
||||||
|
|
||||||
### bool checkQ2Range()
|
### bool checkQ2Range()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* bool UseOnlyJpsi
|
* bool UseOnlyJpsi
|
||||||
* bool UseOnlyMuMu
|
* bool UseOnlyMuMu
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* False if you simultaneously require reference and rare Q2 region, true otherwise
|
||||||
|
|
||||||
### bool checkTM()
|
### bool checkTM()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* bool MC
|
* bool MC
|
||||||
* bool &TM
|
* bool &TM
|
||||||
* bool &nonTM
|
* bool &nonTM
|
||||||
* bool Preselected
|
* bool Preselected
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* True if you require meaningful sample to be truth matched, false otherwise
|
||||||
|
|
||||||
### bool checkKshort()
|
### bool checkKshort()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* bool &KshortDecaysInVelo
|
* bool &KshortDecaysInVelo
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* Check you do not require LL tracks in the K+pi0 channel
|
||||||
|
|
||||||
### bool checkRefYear()
|
### bool checkRefYear()
|
||||||
|
No reference MC available for 2017 and 2018
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* string year
|
* string year
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* True if year < 2017, false otherwise
|
||||||
|
|
||||||
### bool checkEntries()
|
### bool checkEntries()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* TTree \*tree
|
* TTree \*tree
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* False if the tree is empty, true otherwise.
|
||||||
|
|
||||||
### bool checkYear()
|
### bool checkYear()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* int year
|
* int year
|
||||||
* bool MC
|
* bool MC
|
||||||
* bool ReferenceChannel
|
* bool ReferenceChannel
|
||||||
* bool PHSP
|
* bool PHSP
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* True if you require a meaningful year for the given data sample, false otherwise
|
||||||
|
|
||||||
### bool checkRun()
|
### bool checkRun()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* int Run
|
* int Run
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* True if the Run number is meaningful, false otherwise
|
||||||
|
|
||||||
|
## Names and tags
|
||||||
|
|
||||||
### string getTMtag()
|
### string getTMtag()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* string customTMbranch
|
* string customTMbranch
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* Branch tag used in the truth matching branch
|
||||||
|
*
|
||||||
### string getTMtag()
|
### string getTMtag()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* string customTMbranch
|
* string customTMbranch
|
||||||
* bool gammaTM
|
* bool gammaTM
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* Branch tag used in the truth matching branch
|
||||||
|
|
||||||
### string getWeightName()
|
### string getWeightName()
|
||||||
|
Weighting depends on the truth matching, hence each weight branch has a TM tag too
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* string customTMbranch
|
* string customTMbranch
|
||||||
* bool gammaTM
|
* bool gammaTM
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* Branch tag used in the weighting branch
|
||||||
|
|
||||||
### std::string getDataTypeTag()
|
### std::string getDataTypeTag()
|
||||||
|
|
||||||
@ -299,6 +316,7 @@ In this file, various helper functions are defined. Unfortunately, as we are try
|
|||||||
* bool K1
|
* bool K1
|
||||||
* bool Inc
|
* bool Inc
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* Tag corresponding to the selected sample, eg "Data" or "MC BtoXMuMu"
|
||||||
|
|
||||||
### string getDataTypeTag()
|
### string getDataTypeTag()
|
||||||
|
|
||||||
@ -307,6 +325,7 @@ In this file, various helper functions are defined. Unfortunately, as we are try
|
|||||||
* bool Reference
|
* bool Reference
|
||||||
* bool PHSP
|
* bool PHSP
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* Tag corresponding to the selected sample, calls [getDataTypeTag()](std-string-getdatatypetag)
|
||||||
|
|
||||||
### string getYearRunTag()
|
### string getYearRunTag()
|
||||||
|
|
||||||
@ -314,17 +333,20 @@ In this file, various helper functions are defined. Unfortunately, as we are try
|
|||||||
* int Run
|
* int Run
|
||||||
* string year
|
* string year
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* Tag with the given run or year
|
||||||
|
|
||||||
|
## Similarly populated bins
|
||||||
|
|
||||||
### void getSimilarlyPopulatedBins()
|
### void getSimilarlyPopulatedBins()
|
||||||
|
This function assumes the original bin width is one!!! Takes the histogram and rebins it in a way the final bins are simirarly populated.
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* TH1D \*histogram
|
* TH1D \*histogram
|
||||||
* int desiredBins
|
* int desiredBins
|
||||||
* int nBins
|
* int nBins
|
||||||
* **Return**
|
|
||||||
|
|
||||||
### void getSimilarlyPopulatedBinsVar()
|
### void getSimilarlyPopulatedBinsVar()
|
||||||
|
Reads a TTree, fills in the histogram based on the input parameters with `var`, modifies it to be simirarly populated, and exits. The histogram is ont saved anywhere though.
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* string var
|
* string var
|
||||||
* int nBins
|
* int nBins
|
||||||
@ -336,13 +358,14 @@ In this file, various helper functions are defined. Unfortunately, as we are try
|
|||||||
* int Run
|
* int Run
|
||||||
* bool ReferenceChannel
|
* bool ReferenceChannel
|
||||||
* bool PHSP
|
* bool PHSP
|
||||||
* **Return**
|
|
||||||
|
## Getting results from a RooFit file
|
||||||
|
|
||||||
### RooFitResult\* getResult()
|
### RooFitResult\* getResult()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* TFile \*fitFile
|
* TFile \*fitFile
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* Retureves the RooFitResult from the fitFile
|
||||||
|
|
||||||
### RooRealVar\* getVarFromResult()
|
### RooRealVar\* getVarFromResult()
|
||||||
|
|
||||||
@ -350,92 +373,94 @@ In this file, various helper functions are defined. Unfortunately, as we are try
|
|||||||
* RooFitResult \*fitResult
|
* RooFitResult \*fitResult
|
||||||
* string name
|
* string name
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* Retrieves the RooRealVar from the RooFitResult based on the name
|
||||||
|
|
||||||
### double getBplusMeanFromResult()
|
### double getBplusMeanFromResult()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* TFile\* fitFile
|
* TFile\* fitFile
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* Reads the mass mean from the mass fit file
|
||||||
|
|
||||||
### double getSigYield()
|
### double getSigYield()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* TFile \*fitFile
|
* TFile \*fitFile
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* signal yield from the mass fitFile
|
||||||
|
|
||||||
### double getSigYieldErr()
|
### double getSigYieldErr()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* TFile \*fitFile
|
* TFile \*fitFile
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* signal yield error from the mass fitFile
|
||||||
|
|
||||||
### double getBkgYield()
|
### double getBkgYield()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* TFile \*fitFile
|
* TFile \*fitFile
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* background yield from the mass fitFile
|
||||||
|
|
||||||
|
|
||||||
### double getBkgYieldErr()
|
### double getBkgYieldErr()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* TFile \*fitFile
|
* TFile \*fitFile
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* background yield error from the mass fitFile
|
||||||
|
|
||||||
### double getEffSigma()
|
### double getEffSigma()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* TFile \*fitFile
|
* TFile \*fitFile
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* effective sigma from the mass fitFile
|
||||||
|
|
||||||
|
## histogram/graph helpers
|
||||||
|
|
||||||
### TH1D \*convertTGraph()
|
### TH1D \*convertTGraph()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* TGraph \*graph
|
* TGraph \*graph
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* Returns a histogram created from a TGraph
|
||||||
|
|
||||||
|
## Numbers of generated events
|
||||||
|
|
||||||
### double get_generated_events()
|
### double get_generated_events()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* bool PHSP
|
* bool PHSP
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* Returns the scale used to calculate the efficiencies
|
||||||
|
|
||||||
### int get_position_from_year()
|
### int get_position_from_year()
|
||||||
|
The yields and generator efficiencies are saved in vectors for each year, 2011, 2012, 2015, 2016, 2017, 2018. This converts the year string to the correct postiion in the vector.
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* string year
|
* string year
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* position in the vector where to look a for given year
|
||||||
|
|
||||||
### int get_gen_evts()
|
### int get_gen_evts()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* string year
|
* string year/int Run
|
||||||
* bool ReferenceChannel
|
* bool ReferenceChannel
|
||||||
* bool PHSP
|
* bool PHSP
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* The number of generated events for the given year/Run
|
||||||
### int get_gen_evts()
|
### int get_gen_evts()
|
||||||
|
|
||||||
* **Parameters**
|
|
||||||
* int Run
|
|
||||||
* bool ReferenceChannel
|
|
||||||
* bool PHSP
|
|
||||||
* **Return**
|
|
||||||
|
|
||||||
### int get_selected_evts()
|
### int get_selected_evts()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* string year
|
* string year/int Run
|
||||||
* bool ReferenceChannel
|
|
||||||
* bool PHSP
|
|
||||||
* **Return**
|
|
||||||
|
|
||||||
### int get_selected_evts()
|
|
||||||
|
|
||||||
* **Parameters**
|
|
||||||
* int Run
|
|
||||||
* bool ReferenceChannel
|
* bool ReferenceChannel
|
||||||
* bool PHSP
|
* bool PHSP
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* The number of selected events for the given year/Run
|
||||||
|
|
||||||
### int get_selected_evts_err()
|
### int get_selected_evts_err()
|
||||||
|
|
||||||
@ -444,40 +469,31 @@ In this file, various helper functions are defined. Unfortunately, as we are try
|
|||||||
* bool ReferenceChannel
|
* bool ReferenceChannel
|
||||||
* bool PHSP
|
* bool PHSP
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* The error of the number of selected events for the given year
|
||||||
|
|
||||||
|
|
||||||
### double get_selection_efficiency()
|
### double get_selection_efficiency()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* string year
|
* string year/int Run
|
||||||
* bool ReferenceChannel
|
* bool ReferenceChannel
|
||||||
* bool PHSP
|
* bool PHSP
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* The selection efficiency for the given year
|
||||||
|
|
||||||
### double get_selection_efficiency()
|
|
||||||
|
|
||||||
* **Parameters**
|
|
||||||
* int Run
|
|
||||||
* bool ReferenceChannel
|
|
||||||
* bool PHSP
|
|
||||||
* **Return**
|
|
||||||
|
|
||||||
### double get_tables_eff()
|
### double get_tables_eff()
|
||||||
|
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* string year
|
* string year/int Run
|
||||||
* bool ReferenceChannel //Get efficiency in a year as an average between up and down
|
* bool ReferenceChannel
|
||||||
* **Return**
|
* **Return**
|
||||||
|
* Generator efficiency in a yearPrun as an average between up and down
|
||||||
|
|
||||||
### double get_tables_eff()
|
|
||||||
|
|
||||||
* **Parameters**
|
|
||||||
* int Run
|
|
||||||
* bool ReferenceChannel //Get efficiency of a run as an average between years
|
|
||||||
* **Return**
|
|
||||||
|
|
||||||
### void print_all_yields_and_efficiencies()
|
### void print_all_yields_and_efficiencies()
|
||||||
|
Print the number of generated events, selected events and the selection efficiency for the given year.
|
||||||
* **Parameters**
|
* **Parameters**
|
||||||
* bool ReferenceChannel
|
* bool ReferenceChannel
|
||||||
* bool PHSP
|
* bool PHSP
|
||||||
* **Return**
|
|
||||||
|
Loading…
Reference in New Issue
Block a user