import basf2
import modularAnalysis as ma
from variables import variables as v
from vibe.core.validation_mode import ValidationModeBaseClass
[docs]
class DimuonTrackingEfficiency(ValidationModeBaseClass):
name = "DimuonTrackingEfficiency"
[docs]
def create_basf2_path(self):
v.addAlias("pRes", "formula(mcP-p)")
v.addAlias("ptRes", "formula(mcPT-pt)")
v.addAlias("pPull", "formula((mcP-p)/pErr)")
v.addAlias("ptPull", "formula((mcPT-pt)/ptErr)")
v.addAlias("d0Res", "formula(d0Pull*d0Err)")
v.addAlias("z0Res", "formula(z0Pull*z0Err)")
v.addAlias("phi0Res", "formula(phi0Pull*phi0Err)")
v.addAlias("tanLambdaRes", "formula(tanLambdaPull*tanLambdaErr)")
v.addAlias("omegaRes", "formula(omegaPull*omegaErr)")
v.addAlias("mcX", "mcProductionVertexX")
v.addAlias("mcY", "mcProductionVertexY")
v.addAlias("mcZ", "mcProductionVertexZ")
main_path = basf2.Path()
ma.fillParticleListFromMC(
decayString="mu+:gen",
cut="",
path=main_path,
)
muons = ("mu+:all", "")
#kaons = ("K+:matched", "isPrimarySignal == 1")
#protons = ("p+:matched", "isPrimarySignal == 1")
ma.fillParticleLists(decayStringsWithCuts=[muons], path=main_path)
ma.cutAndCopyList("mu+:matched", "mu+:all", cut="isPrimarySignal==1", path=main_path)
# 1D histograms
particle_based_h1D = [
("pPull", 200, -6.0, 6.0),
("ptPull", 200, -6.0, 6.0),
("pRes", 200, -0.05, 0.05),
("ptRes", 200, -0.05, 0.05),
("nPXDHits", 5, 0, 5),
("nSVDHits", 16, 0, 16),
("nCDCHits", 200, 0, 200),
]
muons_h1D = [
("d0Pull", 200, -6.0, 6.0),
("z0Pull", 200, -6.0, 6.0),
("omegaPull", 200, -6.0, 6.0),
("phi0Pull", 200, -6.0, 6.0),
("tanLambdaPull", 200, -6.0, 6.0),
("d0Res", 200, -0.05, 0.05),
("z0Res", 200, -0.05, 0.05),
("omegaRes", 200, -0.05, 0.05),
("phi0Res", 200, -0.05, 0.05),
("tanLambdaRes", 200, -0.05, 0.05),
]
# 2D histograms
particle_based_h2D = [
("pRes", 200, -0.05, 0.05, "charge", 3, -1.5, 1.5),
("pPull", 200, -6.0, 6.0, "charge", 3, -1.5, 1.5),
("p", 100, 0.0, 4.0, "pRes", 200, -0.05, 0.05),
("p", 100, 0.0, 4.0, "pPull", 200, -6.0, 6.0),
("ptRes", 200, -0.05, 0.05, "charge", 3, -1.5, 1.5),
("ptPull", 200, -6.0, 6.0, "charge", 3, -1.5, 1.5),
("pt", 100, 0.0, 4.0, "ptRes", 200, -0.05, 0.05),
("pt", 100, 0.0, 4.0, "ptPull", 200, -6.0, 6.0),
]
muons_h2D = [
("d0Pull", 200, -6.0, 6.0, "nPXDHits", 5, 0, 5.0),
("z0Pull", 200, -6.0, 6.0, "nPXDHits", 5, 0, 5.0),
("d0Res", 200, -0.05, 0.05, "nPXDHits", 5, 0, 5.0),
("z0Res", 200, -0.05, 0.05, "nPXDHits", 5, 0, 5.0),
("p", 100, 0.0, 4.0, "d0Res", 200, -0.05, 0.05),
("p", 100, 0.0, 4.0, "z0Res", 200, -0.05, 0.05),
]
#for_eff_h1D = [("mcP", 200, 0.0, 4.0)]
#
self.variables_to_validation_histogram(
decay_str="mu+:matched",
variables=particle_based_h1D + muons_h1D,
variables_2d=particle_based_h2D + muons_h2D,
path=main_path,
)
# ntuples
variablesMC_FOM = ["isPrimarySignal", "seenInCDC", "seenInSVD", "mcPDG"]
variablesMC_kin = ["mcPX", "mcPY", "mcPZ"] # 'mcX', 'mcY', 'mcZ'
variablesMC = variablesMC_FOM + variablesMC_kin
variables_FOM = variablesMC_FOM + [
"isSignal",
"mcSecPhysProc",
"isCloneTrack",
"isTrackFlippedAndRefitted",
"charge",
]
variables_kin = variablesMC_kin + ["px", "py", "pz", "dz", "dr", "d0", "z0", "d0Res", "z0Res", "nPXDHits", "nSVDHits", "nCDCHits"] # 'x', 'y', 'z'
variables = variables_FOM + variables_kin
self.variables_to_validation_ntuple(decay_str="mu+:all", variables=list(variables), path=main_path)
self.variables_to_validation_ntuple(decay_str="mu+:gen", variables=list(variablesMC), path=main_path)
return main_path