23.9. Tracking Calibrations#
Some tracking algorithms use MVAs that need to be calibrated, usually with the help of simulated events.
23.9.1. Flip & Refit MVA Training#
Below the instructions how to retrain, apply and evaluate the MVAs for the Flip & Refit tool.
Note
The Flip&Refit tool uses two MVAs:
1st MVA: select the RecoTracks to be flipped looking at low level variables (eg: ndf, cdc hits number, pxd hits etc)
2nd MVA: takes the fitResults from the original and the flipped Tracks as input to decide which one to keep
The steps for sample generation, training and performance evaluation are similar, and are described in the following.
step 1: sample generation#
A sample of 100k \(B\bar{B}\) events is used for training.
The sample is generated using the script tracking/tools/flipAndRefit_sample_generation.py
basf2 flipAndRefit_sample_generation.py -- --num {1,2} -n 1000 --randseed 23 --output_file_mva training_input.root
Tip
the parameter
--num
indicates that the sample is generated for the training of the 1st MVA (with--num 1
) or the 2nd MVA (with--num 2
),the rest of the parameters can be selected by the user
for help about the script execute it as
basf2 flipAndRefit_sample_generation.py -- -h
to speed up this step, the user can submit several jobs in parallel, paying attention to set different random seed and output file names for each job using the options
--ranseed
and--output_file_mva
respectively.
step 2: MVA training#
In this step, a local database containing the payloads with the weightfiles of the first or second MVA will be created.
The payloads are created with the script tracking/tools/training_flipping_mvas.py
.
An example for the 1st MVA is reported below:
basf2 tracking/tools/training_flipping_mvas.py -train train_1stmva.root -data test_1stmva.root -tree data -mva 1
Note
the training and test samples can be generated using the instructions of the step 1
for additional information on the parameters of the script, check its help:
basf2 tracking/tools/training_flipping_mvas.py --h
step 3: 1st-MVA performance evaluation#
The performance evaluation is done with the dedicated basf2
tool for MVA evaluation, basf2_mva_evaluate.py
.
An example is reported in the following:
basf2_mva_evaluate.py -id localdb/dbstore_Weightfile_rev_XXXXXX.root -tree data -train train.root -data test.root -o validation.root
Note
localdb/dbstore_Weightfile_rev_XXXXXX.root: refers to the local weight file generated by step 2
For further instructions, use the help of the executable.
basf2_mva_evaluate.py --help
How to use the local weight file in the reconstruction#
In case the user wants to use the local database, i.e. the payload created locally instead of the default one,
the user should modify the parameter identifier
of the FlipQuality
module.
Running the standard tracking chain, the easier thing to do is to directly modify the
parameter in the the utility function add_flipping_of_recoTracks
in tracking/scripts/tracking/path_utils.py
in the following way:
path.add_module("FlipQuality", recoTracksStoreArrayName=reco_tracks,
identifier='localdb/dbstore_Weightfile_rev_XXXXXX.root',
indexOfFlippingMVA=1).set_name("FlipQuality_1stMVA")
Note
if new variables added in the MVA, make sure the /tracking/trackFitting/trackQualityEstimator/variableExtractors/include/FlipRecoTrackExtractor.h
is also updated.
23.9.2. CKF Training#
Warning
work in progress