Belle II Software  release-05-01-25
test2_inclusiveBplusToKplusNuNu.py
1 #!/usr/bin/env/python3
2 # -*-coding: utf-8-*-
3 
4 """
5 <header>
6  <input>12160400.udst.root</input>
7  <output>inclusiveBplusToKplusNuNu_Validation.root</output>
8  <contact>cyrille.praz@desy.de</contact>
9 </header>
10 """
11 __author__ = "Cyrille Praz"
12 
13 import basf2 as b2
14 import modularAnalysis as ma
15 from variables import variables
16 from validation_tools.metadata import create_validation_histograms
17 
18 histogram_filename = 'inclusiveBplusToKplusNuNu_Validation.root'
19 
20 
21 my_email = 'Cyrille Praz <cyrille.praz@desy.de>'
22 
23 path = b2.Path()
24 
25 ma.inputMdst('default', '12160400.udst.root', path=path)
26 
27 # Build the event sphericity
28 ma.buildEventShape(inputListNames=[],
29  default_cleanup=True,
30  allMoments=False,
31  cleoCones=False,
32  collisionAxis=False,
33  foxWolfram=False,
34  harmonicMoments=False,
35  jets=False,
36  sphericity=True,
37  thrust=False,
38  checkForDuplicates=False,
39  path=path)
40 
41 # Default cleanup also used in and ma.buildEventShape
42 track_cleanup = 'pt > 0.1'
43 track_cleanup += ' and thetaInCDCAcceptance'
44 track_cleanup += ' and abs(dz) < 3.0'
45 track_cleanup += ' and abs(dr) < 0.5'
46 
47 # Define a couple of aliases
48 variables.addAlias('kaon_pt', 'daughter(0,pt)')
49 variables.addAlias('nCleanedTracks_simple_cleanup', 'nCleanedTracks({})'.format(track_cleanup))
50 
51 # Output validation histograms
52 create_validation_histograms(
53  rootfile=histogram_filename,
54  particlelist='B+:inclusiveBplusToKplusNuNu',
55  variables_1d=[
56  ('kaon_pt',
57  10,
58  0,
59  5,
60  'Kaon pt',
61  my_email,
62  'Transverse momentum of the kaon candidate',
63  'Maximum between 1.5 and 2 GeV/c',
64  'Kaon pt [GeV/c]',
65  'Candidates'),
66  ('nCleanedTracks_simple_cleanup',
67  12,
68  0,
69  12,
70  'Number of cleaned tracks',
71  my_email,
72  'Number of cleaned tracks in the event',
73  'Should be between 4 and 10, with two local maxima at 4 and 6',
74  'Number of cleaned tracks',
75  'Events'),
76  ('sphericity',
77  10,
78  0,
79  1,
80  'Event Sphericity',
81  my_email,
82  'Sphericity computed by ma.buildEventShape',
83  'Maximum around 0.3',
84  'Event Sphericity',
85  'Events')],
86  variables_2d=[],
87  path=path)
88 
89 b2.process(path)
90 print(b2.statistics)
validation_tools.metadata
Definition: metadata.py:1