6 <contact>software-tracking@belle2.org</contact>
7 <input>KShortGenSimNoBkg.root</input>
8 <output>V0ValidationSample.root, V0ValidationHarvested.root</output>
9 <description>This module generates events for the V0 validation.</description>
14 from tracking
import add_tracking_reconstruction
21 """Collects variables of interest for the V0Validation and the v0ValidationCreatePlots script."""
24 """Initialize the harvester.
25 Defines over which StoreArray is iterated and the output file.
27 HarvestingModule.__init__(self, foreach=
"MCParticles", output_file_name=
"../V0ValidationHarvested.root")
29 def pick(self, mc_particle):
30 """Selects all MCParticles which are KShort.
32 :param mc_particle: Belle2::MCParticle.
33 :return: True if the MCParticle is a KShort.
35 return abs(mc_particle.getPDG()) == 310
38 """Selects MCTrue variables of interest for all KShort in the sample. If the KShort has a related reconstructed
39 V0, these values are written out too. Variables of interest are:
40 R: Radial (in xy) distance to origin.
41 Theta: Theta Angle of decay vertex.
42 Phi: Phi Angle of decay vertex.
43 P: Momentum of the KShort.
44 M: Invariant mass of the KShort.
45 Chi2: Chi2 of vertex fit.
46 isFound: True if MCParticle has a related V0.
48 If the MCParticle has no related V0, the variables are filled with NaN's.
50 :param mc: Belle2::MCParticle
51 :return: dict with the variables of interest.
53 mc_vertex = mc.getDecayVertex()
54 mc_perp = mc_vertex.Perp()
55 mc_theta = mc_vertex.Theta()
56 mc_phi = mc_vertex.Phi()
58 mc_p = mc.getMomentum().Mag()
60 v0 = mc.getRelated(
"V0ValidationVertexs")
63 v0_vertex = v0.getVertexPosition()
64 v0_perp = v0_vertex.Perp()
65 v0_theta = v0_vertex.Theta()
66 v0_phi = v0_vertex.Phi()
67 v0_m = v0.getFittedInvariantMass()
68 v0_p = v0.getFittedMomentum()
69 v0_chi2 = v0.getVertexChi2()
107 basf2.set_random_seed(1337)
108 path = basf2.create_path()
110 path.add_module(
'RootInput', inputFileName=
'../KShortGenSimNoBkg.root')
111 path.add_module(
'Gearbox')
113 add_tracking_reconstruction(path)
116 for module
in path.modules():
117 if module.name() ==
"V0Finder":
118 module.param(
"Validation",
True)
119 path.add_module(
'MCV0Matcher', V0ColName=
'V0ValidationVertexs')
123 print(basf2.statistics)