from typing import List
import pandas as pd
import basf2
import basf2 as b2
import modularAnalysis as ma
import variables.collections as vc
import variables.utils as vu
from variables import variables as va
from vibe.core.utils.misc import fancy_validation_mode_header
from vibe.core.validation_mode import ValidationModeBaseClass
from vibe.core.helper.histogram_tools import HistVariable, Histogram, HistComponent
from vibe.core.helper.root_helper import makeROOTCompatible
# Show warnings and above (ignore info/debug)
b2.logging.log_level = b2.LogLevel.INFO
# Only show each maximum 3 times
b2.logging.max_repetitions = 3
__all__ = [
"TauMultimode",
]
[docs]
@fancy_validation_mode_header
class TauMultimode(ValidationModeBaseClass):
name = "TauMultimode"
latex_str = r"$\tau^+, \tau^- \rightarrow \pi^+ \pi^- \pi^+ \nu, e^-/\mu^-/\pi^-/K^-$"
[docs]
def create_basf2_path(self):
myPath = basf2.Path()
ma.labelTauPairMC(path=myPath)
# Define 'good' tracks and photons
trackCuts = "dr <= 0.5 and -2.0 <= dz <= 2.0 and thetaInCDCAcceptance and useCMSFrame(p) < 5.29"
# trackCuts = "dr <= 1.0 and -3.0 <= dz <= 3.0"
gammaCuts = "E > 0.20 and -0.8660 < cosTheta < 0.9563"
ma.fillParticleList("pi+:track", trackCuts, path=myPath)
ma.fillParticleList("gamma:good", gammaCuts, path=myPath)
va.addAlias("poschgInEvent", "countInList(pi+:track, charge>0)")
va.addAlias("negchgInEvent", "countInList(pi+:track, charge<0)")
## Total charge in event
va.addAlias("totalCharge", "formula(poschgInEvent - negchgInEvent)")
## Apply event cuts for total charge = 0
ma.applyEventCuts("totalCharge==0", path=myPath)
# Event shape and kinematics
ma.buildEventShape(
["pi+:track", "gamma:good"],
thrust=True,
foxWolfram=False,
cleoCones=False,
jets=False,
harmonicMoments=False,
allMoments=False,
collisionAxis=False,
sphericity=False,
path=myPath,
)
ma.buildEventKinematics(["pi+:track", "gamma:good"], path=myPath)
ma.cutAndCopyLists("pi+:parathrust", "pi+:track", "cosToThrustOfEvent>0", path=myPath)
ma.cutAndCopyLists("pi+:antithrust", "pi+:track", "cosToThrustOfEvent<0", path=myPath)
# 1-prong on positive or negative side of thrust axis
va.addAlias("trackInParaThrust", "countInList(pi+:parathrust)")
va.addAlias("trackInAntiThrust", "countInList(pi+:antithrust)")
va.addAlias("track_topology", "formula(10*trackInParaThrust + trackInAntiThrust)")
# This keeps only 3 prong on 1 side and 1 prong on the other side of the thrust axis.
ma.applyEventCuts("track_topology==31 or track_topology==13", path=myPath)
### ChargeinPara = -1 means tau- is parallel to thrust axis, tau+ is anti-parallel
### ChargeinPara = +1 means tau+ is parallel to thrust axis, tau- is anti-parallel
va.addAlias("poschgInParaThrust", "countInList(pi+:parathrust, charge>0)")
va.addAlias("negchgInAntiThrust", "countInList(pi+:antithrust, charge<0)")
va.addAlias("ChargeinPara", "formula(poschgInParaThrust + negchgInAntiThrust - 2)")
### ChargeinAnti = -1 means tau+ is parallel to thrust axis, tau- is anti-parallel
### ChargeinAnti = +1 means tau- is parallel to thrust axis, tau+ is anti-parallel
va.addAlias("poschgInAntiThrust", "countInList(pi+:antithrust, charge>0)")
va.addAlias("negchgInParaThrust", "countInList(pi+:parathrust, charge<0)")
va.addAlias("ChargeinAnti", "formula(poschgInAntiThrust + negchgInParaThrust - 2)")
va.addAlias("n_pi_in_para_evt", "nParticlesInList(pi+:parathrust)")
va.addAlias("n_pi_in_anti_evt", "nParticlesInList(pi+:antithrust)")
ma.cutAndCopyLists("gamma:parathrust", "gamma:good", "cosToThrustOfEvent>0", path=myPath)
ma.cutAndCopyLists("gamma:antithrust", "gamma:good", "cosToThrustOfEvent<0", path=myPath)
# pi0 reconstruction
ma.reconstructDecay(
"pi0:parathrust -> gamma:parathrust gamma:parathrust",
"[0.115 < M < 0.155] and daughter(0,E)>0.1 and daughter(1,E)>0.1",
path=myPath,
)
ma.reconstructDecay(
"pi0:antithrust -> gamma:antithrust gamma:antithrust",
"[0.115 < M < 0.155] and daughter(0,E)>0.1 and daughter(1,E)>0.1",
path=myPath,
)
ma.rankByLowest(particleList="pi0:parathrust", variable="abs(dM)", numBest=1, path=myPath)
ma.rankByLowest(particleList="pi0:antithrust", variable="abs(dM)", numBest=1, path=myPath)
va.addAlias("pi0InParaThrust", "countInList(pi0:parathrust)")
va.addAlias("pi0InAntiThrust", "countInList(pi0:antithrust)")
va.addAlias("topoinParaThrust", "formula(ChargeinPara*(10*trackInParaThrust+pi0InParaThrust))")
va.addAlias("topoinAntiThrust", "formula(ChargeinAnti*(10*trackInAntiThrust+pi0InAntiThrust))")
va.addAlias("Chargein1Prong", "formula(-1*(abs(ChargeinPara + trackInParaThrust - 2) - 1 ))")
final_cut = (
"[tauMinusMCMode == 163] and [[topoinParaThrust == -11 and topoinAntiThrust == 30] or [topoinParaThrust == 30 and topoinAntiThrust == -11]]"
" or "
"[tauPlusMCMode == 163] and [[topoinParaThrust == +11 and topoinAntiThrust == -30] or [topoinParaThrust == -30 and topoinAntiThrust == +11]]"
" or "
"[tauMinusMCMode != 163] and [[topoinParaThrust == -10 and topoinAntiThrust == 30] or [topoinParaThrust == 30 and topoinAntiThrust == -10]]"
" or "
"[tauPlusMCMode != 163] and [[topoinParaThrust == +10 and topoinAntiThrust == -30] or [topoinParaThrust == -30 and topoinAntiThrust == +10]]"
)
ma.applyEventCuts(final_cut, path=myPath)
ma.cutAndCopyLists("pi+:1prongpara", "pi+:parathrust", "trackInParaThrust==1", path=myPath)
ma.cutAndCopyLists("pi+:1pronganti", "pi+:antithrust", "trackInAntiThrust==1", path=myPath)
ma.copyLists("pi+:1prong", ["pi+:1prongpara", "pi+:1pronganti"], path=myPath)
ma.cutAndCopyLists("pi+:3prongpara", "pi+:parathrust", "trackInParaThrust==3", path=myPath)
ma.cutAndCopyLists("pi+:3pronganti", "pi+:antithrust", "trackInAntiThrust==3", path=myPath)
ma.copyLists("pi+:3prong", ["pi+:3prongpara", "pi+:3pronganti"], path=myPath)
ma.copyLists("pi0:1prong", ["pi0:parathrust", "pi0:antithrust"], path=myPath)
# Hadronic 1prong: tau -> pi + nu_tau
ma.reconstructDecay("rho-:1prong -> pi-:1prong pi0:1prong", "", path=myPath)
va.addAlias("Npi0_1prong", "countInList(pi0:1prong)")
va.addAlias("Npi_1prong", "countInList(pi-:1prong)")
va.addAlias("Npi_3prong", "countInList(pi-:3prong)")
va.addAlias("Nrho_1prong", "countInList(rho-:1prong)")
# Rho mass variable will be NaN for non-rho decays
va.addAlias("1prong_rho_mass", "daughterInvM(0, 1)")
va.addAlias("1prong_rho_asym", "formula((daughter(0, E) - daughter(1, E))/(daughter(0, E) + daughter(1, E)))")
# pi0 mass
va.addAlias("1prong_pi0_mass", "daughter(1, daughterInvM(0, 1))")
va.addAlias("1prong_Egamma_1", "daughter(1, daughter(0, E))")
va.addAlias("1prong_Egamma_2", "daughter(1, daughter(1, E))")
# Rank the pi+:3prong by momentum to get the slow/fast pi+ and pi- combination
ma.rankByLowest(particleList="pi+:3prong", variable="p", outputVariable="p_rank", path=myPath)
va.addAlias("p_rank", "extraInfo(p_rank)")
# reconstruction of 3prong
ma.reconstructDecay("tau+:3prong -> pi+:3prong pi+:3prong pi-:3prong ?nu", "M < 1.8", path=myPath)
va.addAlias("Ntau_3prong", "countInList(tau-:3prong)")
# Reconstruction of 1prong side for different TauDecayModes as 1, 2, 303, 304, 163
ma.reconstructDecay(
"tau-:e_1prong -> pi-:1prong ?nu",
"Npi0_1prong==0 and [ [tauMinusMCMode == 1 and Chargein1Prong == -1 ] or [tauPlusMCMode == 1 and Chargein1Prong == +1 ]]",
path=myPath,
dmID=1,
)
ma.reconstructDecay(
"tau-:mu_1prong -> pi-:1prong ?nu",
"Npi0_1prong==0 and [ [tauMinusMCMode == 2 and Chargein1Prong == -1 ] or [tauPlusMCMode == 2 and Chargein1Prong == +1 ]]",
path=myPath,
dmID=2,
)
ma.reconstructDecay(
"tau-:pi_1prong -> pi-:1prong ?nu",
"Npi0_1prong==0 and [ [tauMinusMCMode == 303 and Chargein1Prong == -1 ] or [tauPlusMCMode == 303 and Chargein1Prong == +1 ]]",
path=myPath,
dmID=3,
)
ma.reconstructDecay(
"tau-:k_1prong -> pi-:1prong ?nu",
"Npi0_1prong==0 and [ [tauMinusMCMode == 304 and Chargein1Prong == -1 ] or [tauPlusMCMode == 304 and Chargein1Prong == +1 ]]",
path=myPath,
dmID=4,
)
ma.reconstructDecay(
"tau-:rho_1prong -> pi-:1prong pi0:1prong ?nu",
"Npi0_1prong==1 and [ [tauMinusMCMode == 163 and Chargein1Prong == -1 ] or [tauPlusMCMode == 163 and Chargein1Prong == +1 ]]",
path=myPath,
dmID=5,
)
ma.copyLists(
"tau-:1prong",
["tau-:e_1prong", "tau-:mu_1prong", "tau-:pi_1prong", "tau-:k_1prong", "tau-:rho_1prong"],
path=myPath,
)
va.addAlias("dmIDTag", "daughter(1, extraInfo(decayModeID))")
va.addAlias("Ntau_1prong", "countInList(tau-:1prong)")
ma.reconstructDecay("vpho:all -> tau+:3prong tau-:1prong", "", path=myPath)
va.addAlias("Nvpho", "countInList(vpho:all)")
va.addAlias("missingPtCMS", "formula(missingMomentumOfEventCMS*sin(missingMomentumOfEventCMS_theta))")
eventVariables = [
"tauPlusMCMode",
"tauMinusMCMode",
"dmIDTag",
"thrust",
"visibleEnergyOfEventCMS",
"missingMomentumOfEvent",
"missingMomentumOfEvent_theta",
"missingMomentumOfEventCMS",
"missingMomentumOfEventCMS_theta",
"missingPtCMS",
"totalPhotonsEnergyOfEvent",
"missingMass2OfEvent",
"trackInParaThrust",
"trackInAntiThrust",
"n_pi_in_para_evt",
"n_pi_in_anti_evt",
"pi0InParaThrust",
"pi0InAntiThrust",
]
# Tau 3prong mass variables
va.addAlias("3prong_M_12", "daughterInvM(0, 1)") # pi+ pi+ same charge combination
va.addAlias("3prong_M_23", "daughterInvM(1, 2)") # slow pi+ pi- combination
va.addAlias("3prong_M_31", "daughterInvM(0, 2)") # fast pi+ pi- combination
va.addAlias("3prong_M_123", "daughterInvM(0, 1, 2)") # pi+ pi+ pi- combination
# momentum of pi-:1prong
va.addAlias("pi_1prong_p", "useCMSFrame(daughter(0, p))")
# pValue of pi-:1prong
va.addAlias("pi_1prong_pValue", "daughter(0, pValue)")
# PID for 1prong side
pid_1prong_daughter = vu.create_aliases(vc.pid, "daughter(0, {variable})", "1prong_daughter")
# Invmass for 1prong and 3prong
invmass_1prong = [
"pi_1prong_p",
"pi_1prong_pValue",
"1prong_rho_mass",
"1prong_rho_asym",
"1prong_pi0_mass",
"1prong_Egamma_1",
"1prong_Egamma_2",
]
invmass_3prong = ["3prong_M_12", "3prong_M_23", "3prong_M_31", "3prong_M_123"]
# These variables are used for Taudecaymode 163
ECLVariables = [
"clusterE",
"clusterLAT",
"clusterSecondMoment",
"clusterE1E9",
"clusterE9E25",
"clusterAbsZernikeMoment40",
"clusterAbsZernikeMoment51",
]
kinematics_3prong = vu.create_aliases(vc.kinematics, "useCMSFrame({variable})", "3prong")
variableList = (
vu.create_aliases_for_selected(list_of_variables=eventVariables, decay_string="^vpho")
+ vu.create_aliases_for_selected(list_of_variables=invmass_3prong, decay_string="vpho -> ^tau+ tau-")
+ vu.create_aliases_for_selected(
list_of_variables=kinematics_3prong + ["p_rank"] + ["pValue"],
decay_string="vpho -> [tau+ -> ^pi+ ^pi- ^pi+] tau-",
prefix=["pi1", "pi2", "pi3"],
)
+ vu.create_aliases_for_selected(
list_of_variables=invmass_1prong, # Here, if the event doesn't have pi0, then it will be NaN, but there is a warning issued in basf2 processing.
decay_string="vpho -> tau+ ^tau-",
) # [WARNING] Daughter index out of range to avoid this warning print we use max_repetitions = 3
+ vu.create_aliases_for_selected(
list_of_variables=ECLVariables, decay_string="vpho -> tau+ [tau- -> pi- [pi0 -> ^gamma ^gamma]]"
)
+ vu.create_aliases_for_selected(list_of_variables=pid_1prong_daughter, decay_string="vpho -> tau+ ^tau-")
)
self.variables_to_validation_ntuple(
decay_str="vpho:all",
variables=variableList,
path=myPath,
)
return myPath
@property
def analysis_validation_histograms(self) -> List[Histogram]:
return [
## Electron channel
Histogram(
name="Thrust",
title="Thrust",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="thrust"),
label="Thrust",
unit="",
bins=50,
scope=(0.6, 1.0),
),
hist_components=[
HistComponent(
label="Electron_channel",
additional_cut_str="dmIDTag == 1",
),
HistComponent(
label="Muon_channel",
additional_cut_str="dmIDTag == 2",
),
HistComponent(
label="Pion_channel",
additional_cut_str="dmIDTag == 3",
),
HistComponent(
label="Kaon_channel",
additional_cut_str="dmIDTag == 4",
),
],
),
Histogram(
name="Visible_Energy",
title=r"$E_{vis}$",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="visibleEnergyOfEventCMS"),
label=r"$E_{visible}$ in CMS",
unit="GeV",
bins=60,
scope=(0.0, 12.0),
),
hist_components=[
HistComponent(
label="Electron_channel",
additional_cut_str="dmIDTag == 1",
),
HistComponent(
label="Muon_channel",
additional_cut_str="dmIDTag == 2",
),
HistComponent(
label="Pion_channel",
additional_cut_str="dmIDTag == 3",
),
HistComponent(
label="Kaon_channel",
additional_cut_str="dmIDTag == 4",
),
],
),
Histogram(
name="Missing_Mass2",
title=r"$M^2_{miss}$",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="missingMass2OfEvent"),
label=r"$M^2_{miss}$",
unit=r"$GeV^2 / c^4$",
bins=50,
scope=(-30.0, 70.0),
),
hist_components=[
HistComponent(
label="Electron_channel",
additional_cut_str="dmIDTag == 1",
),
HistComponent(
label="Muon_channel",
additional_cut_str="dmIDTag == 2",
),
HistComponent(
label="Pion_channel",
additional_cut_str="dmIDTag == 3",
),
HistComponent(
label="Kaon_channel",
additional_cut_str="dmIDTag == 4",
),
],
),
Histogram(
name="Missing_PtCMS",
title=r"$Pt_{miss}\ (in\ CMS)$",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="missingPtCMS"),
label=r"$Pt_{miss}\ (in\ CMS)$",
unit="GeV/c",
bins=60,
scope=(0.0, 6.0),
),
hist_components=[
HistComponent(
label="Electron_channel",
additional_cut_str="dmIDTag == 1",
),
HistComponent(
label="Muon_channel",
additional_cut_str="dmIDTag == 2",
),
HistComponent(
label="Pion_channel",
additional_cut_str="dmIDTag == 3",
),
HistComponent(
label="Kaon_channel",
additional_cut_str="dmIDTag == 4",
),
],
),
Histogram(
name="M_123",
title=r"$M_{123}$",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="tau_3prong_M_123"),
label=r"$M_{123}$",
unit=r"GeV/$c^2$",
bins=60,
scope=(0.0, 1.8),
),
hist_components=[
HistComponent(
label="Electron_channel",
additional_cut_str="dmIDTag == 1",
),
HistComponent(
label="Muon_channel",
additional_cut_str="dmIDTag == 2",
),
HistComponent(
label="Pion_channel",
additional_cut_str="dmIDTag == 3",
),
HistComponent(
label="Kaon_channel",
additional_cut_str="dmIDTag == 4",
),
],
),
Histogram(
name="M_12",
title=r"$M_{12}$",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="tau_3prong_M_12"),
label=r"$M_{\pi^{-} \pi^{-}}$",
unit=r"GeV/$c^2$",
bins=60,
scope=(0.0, 1.8),
),
hist_components=[
HistComponent(
label="Electron_channel",
additional_cut_str="dmIDTag == 1",
),
HistComponent(
label="Muon_channel",
additional_cut_str="dmIDTag == 2",
),
HistComponent(
label="Pion_channel",
additional_cut_str="dmIDTag == 3",
),
HistComponent(
label="Kaon_channel",
additional_cut_str="dmIDTag == 4",
),
],
),
Histogram(
name="M_23",
title=r"$M_{23}$",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="tau_3prong_M_23"),
label=r"$M_{\pi^{-}_{slow} \pi^{+}}$",
unit=r"GeV/$c^2$",
bins=60,
scope=(0.0, 1.8),
),
hist_components=[
HistComponent(
label="Electron_channel",
additional_cut_str="dmIDTag == 1",
),
HistComponent(
label="Muon_channel",
additional_cut_str="dmIDTag == 2",
),
HistComponent(
label="Pion_channel",
additional_cut_str="dmIDTag == 3",
),
HistComponent(
label="Kaon_channel",
additional_cut_str="dmIDTag == 4",
),
],
),
Histogram(
name="M_31",
title=r"$M_{31}$",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="tau_3prong_M_31"),
label=r"$M_{\pi^{-}_{fast} \pi^{+}}$",
unit=r"GeV/$c^2$",
bins=60,
scope=(0.0, 1.8),
),
hist_components=[
HistComponent(
label="Electron_channel",
additional_cut_str="dmIDTag == 1",
),
HistComponent(
label="Muon_channel",
additional_cut_str="dmIDTag == 2",
),
HistComponent(
label="Pion_channel",
additional_cut_str="dmIDTag == 3",
),
HistComponent(
label="Kaon_channel",
additional_cut_str="dmIDTag == 4",
),
],
),
Histogram(
name="Momentum_1prong",
title=r"$P_{1prong}$",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="tau_pi_1prong_p"),
label=r"$Momentum_{1prong}$",
unit="GeV/c",
bins=60,
scope=(0.0, 6.0),
),
hist_components=[
HistComponent(
label="Electron_channel",
additional_cut_str="dmIDTag == 1",
),
HistComponent(
label="Muon_channel",
additional_cut_str="dmIDTag == 2",
),
HistComponent(
label="Pion_channel",
additional_cut_str="dmIDTag == 3",
),
HistComponent(
label="Kaon_channel",
additional_cut_str="dmIDTag == 4",
),
],
),
Histogram(
name="Momentum_3prong-track1",
title=r"$P_{3prong-track1}$",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="pi1_3prong_p"),
label=r"$Momentum_{3prong-track1}$",
unit="GeV/c",
bins=60,
scope=(0.0, 6.0),
),
hist_components=[
HistComponent(
label="Electron_channel",
additional_cut_str="dmIDTag == 1",
),
HistComponent(
label="Muon_channel",
additional_cut_str="dmIDTag == 2",
),
HistComponent(
label="Pion_channel",
additional_cut_str="dmIDTag == 3",
),
HistComponent(
label="Kaon_channel",
additional_cut_str="dmIDTag == 4",
),
],
),
Histogram(
name="Momentum_3prong-track2",
title=r"$P_{3prong-track2}$",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="pi2_3prong_p"),
label=r"$Momentum_{3prong-track2}$",
unit="GeV/c",
bins=60,
scope=(0.0, 6.0),
),
hist_components=[
HistComponent(
label="Electron_channel",
additional_cut_str="dmIDTag == 1",
),
HistComponent(
label="Muon_channel",
additional_cut_str="dmIDTag == 2",
),
HistComponent(
label="Pion_channel",
additional_cut_str="dmIDTag == 3",
),
HistComponent(
label="Kaon_channel",
additional_cut_str="dmIDTag == 4",
),
],
),
Histogram(
name="Momentum_3prong-track3",
title=r"$P_{3prong-track3}$",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="pi3_3prong_p"),
label=r"$Momentum_{3prong-track3}$",
unit="GeV/c",
bins=60,
scope=(0.0, 6.0),
),
hist_components=[
HistComponent(
label="Electron_channel",
additional_cut_str="dmIDTag == 1",
),
HistComponent(
label="Muon_channel",
additional_cut_str="dmIDTag == 2",
),
HistComponent(
label="Pion_channel",
additional_cut_str="dmIDTag == 3",
),
HistComponent(
label="Kaon_channel",
additional_cut_str="dmIDTag == 4",
),
],
),
Histogram(
name="Electron_ID",
title="electronID",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="tau_1prong_daughter_electronID"),
label="electronID",
unit="",
bins=50,
scope=(0.0, 1.0),
),
hist_components=[
HistComponent(
label="Electron_channel",
additional_cut_str="dmIDTag == 1",
),
],
),
Histogram(
name="Muon_ID",
title="muonID",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="tau_1prong_daughter_muonID"),
label="muonID",
unit="",
bins=50,
scope=(0.0, 1.0),
),
hist_components=[
HistComponent(
label="Muon_channel",
additional_cut_str="dmIDTag == 2",
),
],
),
Histogram(
name="Pion_ID",
title="pionID",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="tau_1prong_daughter_pionID"),
label="pionID",
unit="",
bins=50,
scope=(0.0, 1.0),
),
hist_components=[
HistComponent(
label="Pion_channel",
additional_cut_str="dmIDTag == 3",
),
],
),
Histogram(
name="Kaon_ID",
title="kaonID",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="tau_1prong_daughter_kaonID"),
label="kaonID",
unit="",
bins=50,
scope=(0.0, 1.0),
),
hist_components=[
HistComponent(
label="Kaon_channel",
additional_cut_str="dmIDTag == 4",
),
],
),
## rho channel
Histogram(
name="Rho_Mass",
title=r"$M_{\rho}$",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="tau_1prong_rho_mass"),
label=r"$M_{\rho}$",
unit=r"GeV/$c^2$",
bins=100,
scope=(0.0, 1.8),
),
hist_components=[
HistComponent(
label="rho_channel",
additional_cut_str="dmIDTag == 5",
),
],
),
Histogram(
name="Pi0_Mass",
title=r"$M_{\pi^0}$",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="tau_1prong_pi0_mass"),
label=r"$M_{\pi^0}$",
unit=r"GeV/$c^2$",
bins=100,
scope=(0.0, 1.8),
),
hist_components=[
HistComponent(
label="rho_channel",
additional_cut_str="dmIDTag == 5",
),
],
),
Histogram(
name="Egamma_1",
title=r"$E_{\gamma\ 1}$",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="tau_1prong_Egamma_1"),
label=r"$E_{\gamma\ 1}$",
unit="GeV",
bins=100,
scope=(0.0, 10.0),
),
hist_components=[
HistComponent(
label="rho_channel",
additional_cut_str="dmIDTag == 5",
),
],
),
Histogram(
name="Egamma_2",
title=r"$E_{\gamma\ 2}$",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="tau_1prong_Egamma_2"),
label=r"$E_{\gamma\ 2}$",
unit="GeV",
bins=100,
scope=(0.0, 10.0),
),
hist_components=[
HistComponent(
label="rho_channel",
additional_cut_str="dmIDTag == 5",
),
],
),
Histogram(
name="Cluster_LAT_1",
title="Cluster LAT 1",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="tau_pi0_gamma_0_clusterLAT"),
label="Cluster LAT 1",
unit="",
bins=10,
scope=(0.0, 1.0),
),
hist_components=[
HistComponent(
label="rho_channel",
additional_cut_str="dmIDTag == 5",
),
],
),
Histogram(
name="Cluster_LAT_2",
title="Cluster LAT 2",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="tau_pi0_gamma_1_clusterLAT"),
label="Cluster LAT 2",
unit="",
bins=10,
scope=(0.0, 1.0),
),
hist_components=[
HistComponent(
label="rho_channel",
additional_cut_str="dmIDTag == 5",
),
],
),
Histogram(
name="Cluster_SecondMoment_1",
title="Cluster Second Moment 1",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="tau_pi0_gamma_0_clusterSecondMoment"),
label="Cluster Second Moment 1",
unit="",
bins=100,
scope=(0.0, 1.0),
),
hist_components=[
HistComponent(
label="rho_channel",
additional_cut_str="dmIDTag == 5",
),
],
),
Histogram(
name="Cluster_SecondMoment_2",
title="Cluster Second Moment 2",
hist_variable=HistVariable(
df_label=makeROOTCompatible(variable="tau_pi0_gamma_1_clusterSecondMoment"),
label="Cluster Second Moment 2",
unit="",
bins=100,
scope=(0.0, 1.0),
),
hist_components=[
HistComponent(
label="rho_channel",
additional_cut_str="dmIDTag == 5",
),
],
),
]
[docs]
def get_number_of_signal_for_efficiency(self, df: pd.DataFrame) -> float:
electron_channel = (df["dmIDTag"] == 1).sum()
muon_channel = (df["dmIDTag"] == 2).sum()
kaon_channel = (df["dmIDTag"] == 3).sum()
pion_channel = (df["dmIDTag"] == 4).sum()
rho_channel = (df["dmIDTag"] == 5).sum()
return electron_channel + muon_channel + kaon_channel + pion_channel + rho_channel