Belle II Software  release-05-01-25
exampleOfRetentionCheck.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 """Example showing the use of the RetentionCheck module
4 
5 To run the example, simply do
6 
7  basf2 exampleOfRetentionCheck.py -n 100
8 """
9 
10 __authors__ = "Cyrille Praz"
11 
12 import basf2 as b2
13 import modularAnalysis as ma
14 from skimExpertFunctions import get_test_file
15 from skimRetentionCheck import RetentionCheck, pathWithRetentionCheck
16 from skim.fei import runFEIforB0SL, B0SL
17 
18 # Create a basf2 path.
19 path = b2.create_path()
20 
21 # Input a test mdst file.
22 ma.inputMdstList('default', get_test_file("MC12_mixedBGx1"), path=path)
23 
24 # Run pre-selection cuts and FEI.
25 runFEIforB0SL(path)
26 # Apply *arbitrary* cuts on the B tag list.
27 ma.applyCuts('B0:semileptonic', 'sigProb>0.0001', path=path)
28 ma.applyCuts('B0:semileptonic', '-4.0<cosThetaBY<3.0', path=path)
29 ma.applyCuts('B0:semileptonic', 'dmID<8', path=path)
30 ma.applyCuts('B0:semileptonic', '[[dmID<4 and d1_p_CMSframe>1.0] or [dmID>=4 and d2_p_CMSframe>1.0]]', path=path)
31 
32 # Add the retention tracker.
33 path = pathWithRetentionCheck(['B0:semileptonic'], path)
34 
35 # Process the basf2 path.
36 b2.process(path)
37 
38 # Print out the retention tracker results and create an associated plot.
39 RetentionCheck.print_results()
40 RetentionCheck.plot_retention('B0:semileptonic', save_as='retention_rate.pdf')
skim.fei
Definition: fei.py:1