import basf2
import modularAnalysis as ma
from variables import variables as v
import stdV0s as stdv
import variables.utils as vu
from vibe.core.utils.misc import fancy_validation_mode_header
from vibe.core.validation_mode import ValidationModeBaseClass
[docs]
@fancy_validation_mode_header
class MergedL0Efficiency(ValidationModeBaseClass):
name = "MergedL0Efficiency"
[docs]
def create_basf2_path(self):
v.addAlias("daughtersChargeProduct", "formula((daughter(0, charge))*(daughter(1, charge)))")
v.addAlias("mcProdVertexX", "mcProductionVertexX")
v.addAlias("mcProdVertexY", "mcProductionVertexY")
v.addAlias("mcProdVertexZ", "mcProductionVertexZ")
v.addAlias("mcX", "mcDecayVertexX")
v.addAlias("mcY", "mcDecayVertexY")
v.addAlias("mcZ", "mcDecayVertexZ")
v.addAlias("seen", "formula(seenInSVD+seenInCDC)")
v.addAlias("d0seen", "formula(daughter(0, seenInSVD)+daughter(0, seenInCDC))")
v.addAlias("d1seen", "formula(daughter(1, seenInSVD)+daughter(1, seenInCDC))")
main_path = basf2.Path()
v0_cut = "nDaughters > 1 and daughtersChargeProduct == -1"
tr_cut = "abs(genMotherPDG) == 3122"
Lambdas_MC = ("Lambda0:gen", v0_cut)
pions_MC = ("pi+:gen", tr_cut)
protons_MC = ("p+:gen", tr_cut)
ma.fillParticleListsFromMC([Lambdas_MC], path=main_path, addDaughters=True)
ma.fillParticleListsFromMC([pions_MC, protons_MC], path=main_path)
pions = ("pi+:reco", "abs(genMotherPDG) == 3122")
protons = ("p+:reco", "abs(genMotherPDG) == 3122")
ma.fillParticleLists([pions, protons], path=main_path)
ma.applyCuts("pi+:reco", "isSignal == 1 and isCloneTrack == 0", path=main_path)
ma.applyCuts("p+:reco", "isSignal == 1 and isCloneTrack == 0", path=main_path)
stdv.stdLambdas(prioritiseV0=True, path=main_path)
ma.matchMCTruth("Lambda0:merged", path=main_path)
# ntuples
v_FOMs_MC = ["nDaughters"]
v_FOMS_4daughters = ["genMotherPDG", "isCloneTrack"]
v_FOMS_daughters = vu.create_daughter_aliases(v_FOMS_4daughters, 0) + vu.create_daughter_aliases(
v_FOMS_4daughters, 1
)
v_FOMs_v0 = ["isSignal"]
v_kin_MC_4daughters = ["mcPX", "mcPY", "mcPZ", "charge"]
v_kin_MC_daughters = vu.create_daughter_aliases(v_kin_MC_4daughters, 0) + vu.create_daughter_aliases(
v_kin_MC_4daughters, 1
)
v_kin_MC = ["mcPX", "mcPY", "mcPZ", "mcX", "mcY", "mcZ", "mcFlightDistance"] + v_kin_MC_daughters
v_kin_4daughters = ["px", "py", "pz"]
v_kin_daughters = vu.create_daughter_aliases(v_kin_4daughters, 0) + vu.create_daughter_aliases(
v_kin_4daughters, 1
)
v_kin = v_kin_MC + ["px", "py", "pz", "x", "y", "z", "flightDistance"] + v_kin_daughters
v_v0 = v_FOMs_v0 + v_FOMS_daughters + v_kin
v_v0_MC = v_FOMs_MC + v_kin_MC + ["d0seen", "d1seen"]
v_tracks_MC = ["genMotherPDG"] + v_kin_MC_4daughters + ["mcProdVertexX", "mcProdVertexY", "mcProdVertexZ"]
v_tracks = v_tracks_MC + v_kin_4daughters + ["prodVertexX", "prodVertexY", "prodVertexZ"]
self.variables_to_validation_ntuple(decay_str="Lambda0:merged", variables=list(v_v0), path=main_path)
self.variables_to_validation_ntuple(decay_str="Lambda0:gen", variables=list(v_v0_MC), path=main_path)
self.variables_to_validation_ntuple(decay_str="pi+:reco", variables=list(v_tracks), path=main_path)
self.variables_to_validation_ntuple(decay_str="pi+:gen", variables=list(v_tracks_MC + ["seen"]), path=main_path)
self.variables_to_validation_ntuple(decay_str="p+:reco", variables=list(v_tracks), path=main_path)
self.variables_to_validation_ntuple(decay_str="p+:gen", variables=list(v_tracks_MC + ["seen"]), path=main_path)
return main_path