14 <contact>software-tracking@belle2.org</contact>
15 <input>KShortGenSimNoBkg.root</input>
16 <output>V0ValidationSample.root, V0ValidationHarvested.root</output>
17 <description>This module generates events for the V0 validation.</description>
22 from tracking
import add_tracking_reconstruction
29 """Collects variables of interest for the V0Validation and the v0ValidationCreatePlots script."""
32 """Initialize the harvester.
33 Defines over which StoreArray is iterated and the output file.
35 HarvestingModule.__init__(self, foreach=
"MCParticles", output_file_name=
"../V0ValidationHarvested.root")
37 def pick(self, mc_particle):
38 """Selects all MCParticles which are KShort.
40 :param mc_particle: Belle2::MCParticle.
41 :return: True if the MCParticle is a KShort.
43 return abs(mc_particle.getPDG()) == 310
46 """Selects MCTrue variables of interest for all KShort in the sample. If the KShort has a related reconstructed
47 V0, these values are written out too. Variables of interest are:
48 R: Radial (in xy) distance to origin.
49 Theta: Theta Angle of decay vertex.
50 Phi: Phi Angle of decay vertex.
51 P: Momentum of the KShort.
52 M: Invariant mass of the KShort.
53 Chi2: Chi2 of vertex fit.
54 isFound: True if MCParticle has a related V0.
56 If the MCParticle has no related V0, the variables are filled with NaN's.
58 :param mc: Belle2::MCParticle
59 :return: dict with the variables of interest.
61 mc_vertex = mc.getDecayVertex()
62 mc_perp = mc_vertex.Perp()
63 mc_theta = mc_vertex.Theta()
64 mc_phi = mc_vertex.Phi()
66 mc_p = mc.getMomentum().Mag()
68 v0 = mc.getRelated(
"V0ValidationVertexs")
71 v0_vertex = v0.getVertexPosition()
72 v0_perp = v0_vertex.Perp()
73 v0_theta = v0_vertex.Theta()
74 v0_phi = v0_vertex.Phi()
75 v0_m = v0.getFittedInvariantMass()
76 v0_p = v0.getFittedMomentum()
77 v0_chi2 = v0.getVertexChi2()
115 basf2.set_random_seed(1337)
116 path = basf2.create_path()
118 path.add_module(
'RootInput', inputFileName=
'../KShortGenSimNoBkg.root')
119 path.add_module(
'Gearbox')
121 add_tracking_reconstruction(path)
124 for module
in path.modules():
125 if module.name() ==
"V0Finder":
126 module.param(
"Validation",
True)
127 path.add_module(
'MCV0Matcher', V0ColName=
'V0ValidationVertexs')
131 print(basf2.statistics)
def pick(self, mc_particle)