Source code for vibe.analysis_validation_modes.clustering.photonEnergyResolution

from typing import List

import basf2
import modularAnalysis as ma  # type: ignore
import variables.collections as vc  # type: ignore
import variables.utils as vu  # type: ignore

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

__all__ = [
    "photonEnergyResolution",
]


[docs] @fancy_validation_mode_header class photonEnergyResolution(ValidationModeBaseClass): name = "photonEnergyResolution" latex_str = r"$\gamma$ from $B\overline{B}$ events" plotting_strategies = ["resolution_fitting"]
[docs] def create_basf2_path(self, **kwargs): """ Reconstruction script for photons. """ main = basf2.create_path() # Filling photon lists from ECL clusters and MC (we only consider primary photons and the ones from bremsstrahlung) ma.fillParticleList("gamma:selection", "", path=main) ma.fillParticleListFromMC( "gamma:gen", "inECLAcceptance and [mcSecPhysProc == 0 or mcSecPhysProc == 3] and mcE > 0.01", path=main, skipNonPrimary=False, skipNonPrimaryDaughters=False, ) ma.matchMCTruth(list_name="gamma:selection", path=main) ma.applyCuts( "gamma:selection", "mcPDG == 22 and inECLAcceptance and [mcSecPhysProc == 0 or mcSecPhysProc == 3] and mcE > 0.01", path=main, ) self.variables_to_validation_ntuple( decay_str="gamma:selection", variables=vu.create_aliases_for_selected( self.base_particle_vars + self.cluster_vars + vc.mc_truth + vc.mc_kinematics + vc.mc_variables + [ "mcTheta", "clusterMCMatchWeight", "clusterTotalMCMatchWeight", "clusterBestMCMatchWeight", "mcSecPhysProc", ], "^gamma:selection", ["gamma"], ), path=main, ) return main
@property def base_particle_vars(self): return vc.kinematics + vc.inv_mass + vc.momentum_uncertainty + vc.pid @property def cluster_vars(self): return vc.cluster + [ "clusterE", "clusterUncorrE", "clusterThetaID", "clusterMdstIndex", "clusterCellID", "clusterSecondMoment", "clusterTrackMatch", ] @property def base_roe_vars(self): return vc.roe_multiplicities + vc.roe_kinematics + vc.extra_energy @property def analysis_validation_histograms(self) -> List[Histogram]: return [ Histogram( name="EResolution_ISRPhoton_Selection", title="Energy Resolution of ISR Photon (Selection)", particle_list="gamma:selection", hist_variable=HistVariable( df_label=makeROOTCompatible(variable="gamma_clusterE"), label="$E_{\\mathrm{reco}}^{\\gamma}$", unit="GeV", bins=3, scope=(0.0, 0.1), ), hist_components=[ HistComponent( label="Signal", additional_cut_str="gamma_isSignal == 1.0 or gamma_isSignal == 0.0", ), ], ), ]