.. | ||
b2kstll/models | ||
Generator Level Fit | ||
MC Fit | ||
properties.env | ||
README.md | ||
requirements.yaml | ||
root_file_inspect.py | ||
rootio.py |
Angular Analysis of B+toK*+Pi0Mu-Mu+
Setup
For this setup you will need to install miniconda on the machine you are working and do the following procedure:
conda env create -f requirements.yaml
- Check with
conda activate angularanalysis
if the environment is working - Check out the following page in order to install the analysis-tool package:
https://github.com/jonas-eschle/analysis-tools
- Check out the following page in order to install the angular-analysis B->K*ll package:
https://gitlab.cern.ch/LHCb-RD/ewp-bd2ksteeangular-legacy/-/tree/master/b2kstll
Afterwards you can use your conda environment in order to run the code. But before you do, you need to setup the properties.env. Inside of properties.env you will find different configuration variables which are used throughout the code in order to control the behavior of the code. Below you can find a table which summarizes what these environment variables do.
Environment Variable | Use-Case |
---|---|
LOWER_COSTHETAK_CUT | Controls the lower boundary of cos(theta_K) |
UPPER_COSTHETAK_CUT | Controls the upper boundary of cos(theta_K) |
SYS_PATH | We need one local package in order to make the code work, namely hep_analytics which you can also find in this repo, the interpreter needs to find that package, so set SYS_PATH to the relative path to hep_analytics |
GEN_FILE | Path to the Generator File |
MC_FILE | Path to the MC File |
MC_PHSP_FILE | Path to the PHSP MC File |
If you want to see how to set the environment variables, have a look at properties.env
. Also, I have run the code on the LHCbA1 machine but it should make no difference where you run the code.
You are done (apply also the custom fixes described down below)!
Custom Fix
The b2kstll package has a few caveats when you want to apply a cos(theta_K) cut since the normalisation will be wrong in this case for the pdfs. So in order to compensate for that, I changed a few lines in the packages code, have a look at the b2kstll/models
folder, there you will find all the files which I touched.
Useful Scripts
root_file_inspect.py
This script can be used to look inside a root file and see which branches and features it includes. To kick it off, give it a try with:
python root_file_inspect.py --file=ROOT_FILE_PATH --regex=.*
You do not need to set the regex flag but it can be useful if you search for some particular feature. This script depends on the file rootio.py
.
diff_pair_tables_*.py
There are 3 scripts which are prefixed with diff_pair_tables
and which are very similar but have different use-cases. You can use them as templates whenever you have generated tables by prettytable
or another library/tool and use them in order to automatically extract the values out of these tables. Then you do not have to type them manually into your code.
hep_analytics
package: pathing
The module aggregate.py
exposes the PathAggregator
which is very simple and simply builds a path string. For only this reason the class is not very useful but when your directory path setup is more complex and you do not want to manually type out all relevant paths, this class can be easily extended and adapted.
package: processing
Exposes three modules: extract
, transform
, visualisation
. extract
exposes the FileManager
which can be used to extract the relevant features out of the branches of a root
file. transform
exposes useful functions like select_feature
in order to make cuts and reweight_feature
. Take note that select_feature
is not the most efficient way of doing cuts, for more efficient usage use the functionality of uproot3
directly. visualisation
exposes reweight_comparing_plot
in order to plot 3 diagrams, two original features and the reweighted feature.