13 <contact>software-tracking@belle2.org</contact>
14 <input>KShortGenSimNoBkg.root</input>
15 <output>V0ValidationSample.root, V0ValidationHarvested.root</output>
16 <description>This module generates events for the V0 validation.</description>
21 from tracking
import add_tracking_reconstruction
28 """Collects variables of interest for the V0Validation and the v0ValidationCreatePlots script."""
31 """Initialize the harvester.
32 Defines over which StoreArray is iterated and the output file.
34 HarvestingModule.__init__(self, foreach=
"MCParticles", output_file_name=
"../V0ValidationHarvested.root")
36 def pick(self, mc_particle):
37 """Selects all MCParticles which are KShort AND decay to Pi+Pi-.
39 :param mc_particle: Belle2::MCParticle.
40 :return: True if the MCParticle is a KShort decaying to two charged pions.
42 if abs(mc_particle.getPDG()) != 310:
44 daughters = mc_particle.getDaughters()
45 return len(daughters) == 2
and abs(daughters[0].getPDG()) == 211
and abs(daughters[1].getPDG()) == 211
48 """Selects MCTrue variables of interest for all KShort in the sample. If the KShort has a related reconstructed
49 V0, these values are written out too. Variables of interest are:
50 R: Radial (in xy) distance to origin.
51 Theta: Theta Angle of decay vertex.
52 Phi: Phi Angle of decay vertex.
53 P: Momentum of the KShort.
54 M: Invariant mass of the KShort.
55 Chi2: Chi2 of vertex fit.
56 isFound: True if MCParticle has a related V0.
58 If the MCParticle has no related V0, the variables are filled with NaN's.
60 :param mc: Belle2::MCParticle
61 :return: dict with the variables of interest.
63 mc_vertex = mc.getDecayVertex()
64 mc_perp = mc_vertex.Rho()
65 mc_theta = mc_vertex.Theta()
66 mc_phi = mc_vertex.Phi()
68 mc_p = mc.getMomentum().R()
70 v0 = mc.getRelated(
"V0ValidationVertexs")
73 v0_vertex = v0.getVertexPosition()
74 v0_perp = v0_vertex.Rho()
75 v0_theta = v0_vertex.Theta()
76 v0_phi = v0_vertex.Phi()
77 v0_m = v0.getFittedInvariantMass()
78 v0_p = v0.getFittedMomentum()
79 v0_chi2 = v0.getVertexChi2()
101 "THETA_MC": mc_theta,
117 basf2.set_random_seed(1337)
118 path = basf2.create_path()
120 path.add_module(
'RootInput', inputFileName=
'../KShortGenSimNoBkg.root')
121 path.add_module(
'Gearbox')
123 add_tracking_reconstruction(path)
126 for module
in path.modules():
127 if module.name() ==
"V0Finder":
128 module.param(
"Validation",
True)
129 path.add_module(
'MCV0Matcher', V0ColName=
'V0ValidationVertexs')
132 path.add_module(
"Progress")
135 print(basf2.statistics)
def pick(self, mc_particle)