Source code for vibe.analysis_validation_modes.physics.eetomumugamma

from typing import List
import pandas as pd

import basf2
import modularAnalysis as ma
import vertex as vx
import variables.collections as vc
import variables.utils as vu
import variables as va
from stdPi0s import stdPi0s
import numpy as np
from variables import variables as vm

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__ = [
    "eetomumugamma",
]

[docs] @fancy_validation_mode_header class eetomumugamma(ValidationModeBaseClass): name = "eetomumugamma" latex_str = r"$e^+ e^- \rightarrow \mu^+ \mu^- \gamma$"
[docs] def create_basf2_path(self): my_path = basf2.Path() M_2tracks_limit = 10.56 isr_theta = np.radians([17 , 150]) # degree #isr_cut = f"[{isr_theta[0]} < clusterTheta < {isr_theta[1]}] and[useCMSFrame(E) > 0.5]" track_cut = "[dr < 2.0] and [abs(dz) < 5.0] and [p > 1.0]" isr_cut = f"[useCMSFrame(E) > 0.5]" ntracks_cut = f"nCleanedTracks({track_cut}) == 2" nISR_cut = f"nCleanedECLClusters({isr_cut}) > 0" #ma.applyEventCuts(f"[{ntracks_cut}] and [{nISR_cut}]", path=my_path) ma.fillParticleList(f"mu+:good", track_cut, path=my_path) ma.fillParticleList(f"gamma:isr", isr_cut, path=my_path) ma.rankByHighest( f"gamma:isr", "useCMSFrame(E)", outputVariable="highestE_rank", numBest=1, path=my_path) ma.reconstructDecay( f"Z0:2mu -> mu+:good mu-:good", cut="", path=my_path, ) ma.matchMCTruth(f"Z0:2mu", path=my_path) ma.reconstructDecay(f"Z0:g_mumu -> gamma:isr Z0:2mu", cut="", path=my_path) ma.matchMCTruth(f"Z0:g_mumu", path=my_path) vm.addAlias(f'invM_mumu', "formula(daughter(1,daughterInvM(0,1)))") vm.addAlias(f"nISR", f"nParticlesInList(gamma:isr)") vm.addAlias(f"n_mu", f"nParticlesInList(mu+:good)") vm.addAlias(f"ntracks_cut" , f"nCleanedTracks({track_cut})") vm.addAlias(f"nISR_cut", f"nCleanedECLClusters({isr_cut})") vm.addAlias(f'DelPhi_mumu', "formula(daughter(1, daughterDiffOfPhi(1,0)))") vm.addAlias(f'mcDelPhi_mumu', "formula(daughter(1, mcDaughterDiffOfPhi(1,0)))") vm.addAlias(f'DelPhi_mumu_cms', "formula(daughter(1, daughterDiffOfPhiCMS(1,0)))") vm.addAlias(f'mcDelPhi_mumu_cms', "formula(daughter(1, daughterDiffOfPhiCMS(1,0)))") vm.addAlias(f'Deltheta_mumu', "formula(daughter(1, useRestFrame(daughterDiffOf(0, 1, theta))))") vm.addAlias(f'mcDeltheta_mumu', "formula(daughter(1, useRestFrame(daughterDiffOf(0, 1, mcTheta))))") del_theta = ["Deltheta_mumu", "mcDeltheta_mumu",] cms_del_theta = vu.create_aliases(del_theta, "useCMSFrame({variable})", "CMS") Inv_M = ['invM_mumu', "nISR", "n_mu", "ntracks_cut", "nISR_cut", "DelPhi_mumu", "mcDelPhi_mumu", "DelPhi_mumu_cms", "mcDelPhi_mumu_cms",] + del_theta + cms_del_theta #Inv_M = [] kinematics = vc.kinematics + ["cosTheta", "theta", "phi"] cms_kinematics = vu.create_aliases(kinematics, "useCMSFrame({variable})", "CMS") vars = list(vc.mc_kinematics + vc.mc_truth) + kinematics + cms_kinematics vars += ["charge", "mcInitial", "mcMother(PDG)", "isSignal","particleSource",] energy = "E" Dz = "dz" vm.addAlias("CMS_E", f"useCMSFrame({energy})") vm.addAlias("abs_dz", f"abs({Dz})") isr_cut_variable = ["clusterTheta", "clusterThetaID", "CMS_E", "mcISR","clusterE1E9", "clusterErrorTiming"] track_cut_variable = ["dr", "abs_dz", "theta", "clusterThetaID"] + vc.track + vc.track_hits basic_vars = [] basic_vars += vu.create_aliases_for_selected( list_of_variables = vars , decay_string = "^vpho -> ^gamma [^Z0 -> ^mu+ ^mu-]", prefix=["vpho", "isr", "Z0", "mup", "mum"] ) basic_vars += vu.create_aliases_for_selected( list_of_variables=isr_cut_variable, decay_string="vpho -> ^gamma [Z0 -> mu+ mu-]", prefix=["Isr"] ) basic_vars += vu.create_aliases_for_selected( list_of_variables=track_cut_variable, decay_string="vpho -> gamma [Z0 -> ^mu+ ^mu-]", prefix=["Mup", "Mum"] ) basic_vars += Inv_M + vc.mc_truth basic_vars += ["isSignal", "nECLOutOfTimeCrystals", "nECLOutOfTimeCrystalsBWDEndcap", "nECLOutOfTimeCrystalsBarrel", ] #basic_vars += [ f"nCleanedTracks({track_cut})", f"nCleanedECLClusters({isr_cut})"] trigger_variables = [] for trigger_line in self.output_trigger_lines: trigger_variables.append(f"L1FTDL({trigger_line})") trigger_variables.append(f"L1PSNM({trigger_line})") for trigger_line in self.input_trigger_lines: trigger_variables.append(f"L1Input({trigger_line})") trigger_variables.append("L1Trigger") trigger_variables.append("HighLevelTrigger") self.variables_to_validation_ntuple( decay_str="Z0:g_mumu", variables=basic_vars + trigger_variables, path=my_path, ) return my_path
@property def output_trigger_lines(self): return ["mu_b2b", "mu_eb2b", "eklm2", "beklm", "cdcklm1", "cdcklm2", "seklm1","seklm2", "ecleklm1","stt","syo", "syb", "yioiecl1", "fy30", "lml1", "lml2", "lml6", "lml7", "lml8", "lml9", "lml10", "lml12", "lml16", "eclmumu", "lml0", "ffy","fyo","fyb","lume", "ffo", "hie", "c4", "hie3","sttecl", "ggsel","bhapur", "lml3", "lml4", "lml5", "bha3d", "bhabha", "ssb", "eed", "fed", "yp", "bfyo", "bhie", "lml1", "hiev", "fffv", "bg", "poissonv", "random" ] @property def input_trigger_lines(self): return ["klmb2b", "eklmb2b", "ecleklm", "bha_veto", "ecl_mumu", "revo", ]