import basf2
import modularAnalysis as ma
from variables import variables as v
from vibe.core.utils.misc import fancy_validation_mode_header
from vibe.core.validation_mode import ValidationModeBaseClass
[docs]
@fancy_validation_mode_header
class TrackingEfficiency(ValidationModeBaseClass):
name = "TrackingEfficiency"
[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="pi+:gen",
cut="",
path=main_path,
)
pions = ("pi+:all", "")
kaons = ("K+:matched", "isPrimarySignal == 1")
protons = ("p+:matched", "isPrimarySignal == 1")
ma.fillParticleLists(decayStringsWithCuts=[pions, kaons, protons], path=main_path)
ma.cutAndCopyList("pi+:matched", "pi+: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),
]
pions_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),
]
pions_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="pi+:matched",
variables=particle_based_h1D + pions_h1D + for_eff_h1D,
variables_2d=particle_based_h2D + pions_h2D,
path=main_path,
)
self.variables_to_validation_histogram(
decay_str="K+:matched",
variables=particle_based_h1D,
variables_2d=particle_based_h2D,
path=main_path,
)
self.variables_to_validation_histogram(
decay_str="p+:matched",
variables=particle_based_h1D,
variables_2d=particle_based_h2D,
path=main_path,
)
self.variables_to_validation_histogram(
decay_str="pi+:gen",
variables=for_eff_h1D,
variables_2d=None,
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"] # 'x', 'y', 'z'
variables = variables_FOM + variables_kin
self.variables_to_validation_ntuple(decay_str="pi+:all", variables=list(variables), path=main_path)
self.variables_to_validation_ntuple(decay_str="pi+:gen", variables=list(variablesMC), path=main_path)
return main_path