From 884d586415a3dadaf61b031d17556362d7aa0d52 Mon Sep 17 00:00:00 2001 From: Ernest Olivart <ernest.olivart.pino@cern.ch> Date: Wed, 18 Dec 2024 14:34:41 +0100 Subject: [PATCH 1/7] Added codes for MC samples for b2xll W31.34 --- b2xll_MC24_W31_34/electrons/dv_BuToKpEE.py | 367 +++++++++++++ b2xll_MC24_W31_34/electrons/dv_BuToPipEE.py | 455 ++++++++++++++++ b2xll_MC24_W31_34/electrons/dv_LbToPpKmEE.py | 277 ++++++++++ b2xll_MC24_W31_34/electrons/dv_LbToPpPimEE.py | 487 +++++++++++++++++ b2xll_MC24_W31_34/info.yaml | 27 + b2xll_MC24_W31_34/muons/dv_BuToKpMuMu.py | 402 ++++++++++++++ b2xll_MC24_W31_34/muons/dv_BuToPipMuMu.py | 489 +++++++++++++++++ b2xll_MC24_W31_34/muons/dv_LbToPpKmMuMu.py | 309 +++++++++++ b2xll_MC24_W31_34/muons/dv_LbToPpPimMuMu.py | 513 ++++++++++++++++++ b2xll_MC24_W31_34/muons/line_configs.py | 29 + 10 files changed, 3355 insertions(+) create mode 100644 b2xll_MC24_W31_34/electrons/dv_BuToKpEE.py create mode 100644 b2xll_MC24_W31_34/electrons/dv_BuToPipEE.py create mode 100644 b2xll_MC24_W31_34/electrons/dv_LbToPpKmEE.py create mode 100644 b2xll_MC24_W31_34/electrons/dv_LbToPpPimEE.py create mode 100644 b2xll_MC24_W31_34/info.yaml create mode 100644 b2xll_MC24_W31_34/muons/dv_BuToKpMuMu.py create mode 100644 b2xll_MC24_W31_34/muons/dv_BuToPipMuMu.py create mode 100644 b2xll_MC24_W31_34/muons/dv_LbToPpKmMuMu.py create mode 100644 b2xll_MC24_W31_34/muons/dv_LbToPpPimMuMu.py create mode 100644 b2xll_MC24_W31_34/muons/line_configs.py diff --git a/b2xll_MC24_W31_34/electrons/dv_BuToKpEE.py b/b2xll_MC24_W31_34/electrons/dv_BuToKpEE.py new file mode 100644 index 0000000000..3c78fd25d7 --- /dev/null +++ b/b2xll_MC24_W31_34/electrons/dv_BuToKpEE.py @@ -0,0 +1,367 @@ +from GaudiKernel.SystemOfUnits import GeV +from PyConf.reading import get_particles, get_pvs, get_mc_particles +from PyConf.Algorithms import ThOrParticleSelection +from IsolationTools import VertexAndConeIsolation +from Hlt2Conf.algorithms_thor import ParticleCombiner +import Functors as F +from FunTuple import FunctorCollection +from FunTuple import FunTuple_Particles as Funtuple +from FunTuple import FunTuple_MCParticles as FuntupleMC +import FunTuple.functorcollections as FC +from DaVinci.algorithms import create_lines_filter +from DaVinci import Options, make_config +from DaVinciMCTools import MCTruthAndBkgCat +from DecayTreeFitter import DecayTreeFitter +from DaVinciTools import SubstitutePID +from FunTuple.functorcollections import Kinematics, MCKinematics, MCVertexInfo, MCHierarchy, EventInfo, SelectionInfo + +from PyConf.application import metainfo_repos +metainfo_repos.global_bind(extra_central_tags=['commissioning']) + + +def variables_MC(mctruth): + # Returns the variables for the Monte Carlo simulation + # mctruth = MCTruthAndBkgCat(input_particles=particles, name='MCTruthAndBkgCat_{hash}') from DaVinciMCTools + + mcvars = FC.MCKinematics(mctruth_alg=mctruth) + mcvars += FC.MCHierarchy(mctruth_alg=mctruth) + mcvars += FC.MCPromptDecay(mctruth_alg=mctruth) + mcvars += FC.MCVertexInfo(mctruth_alg=mctruth) + + return mcvars + +def make_DTF_vars(particles,constraints,name='DTF', pvs=None, substitutions=None, dtfname='DTF_{hash}',extravars=True): + + if pvs is None: + DTF = DecayTreeFitter( + name=dtfname, + input_particles=particles, + mass_constraints=constraints, + substitutions=substitutions + ) + else: + DTF = DecayTreeFitter( + name=dtfname, + input_particles=particles, + input_pvs=pvs, + mass_constraints=constraints, + substitutions=substitutions + ) + + vars = FunctorCollection({ + f'{name}_MASS': DTF(F.MASS), + }) + + if extravars: + vars+=FunctorCollection({ + f'{name}_P': DTF(F.P), + f'{name}_PX': DTF(F.PX), + f'{name}_PY': DTF(F.PY), + f'{name}_PZ': DTF(F.PZ), + f'{name}_PT': DTF(F.PT), + f'{name}_ENERGY': DTF(F.ENERGY), + f'{name}_CHI2DOF': DTF(F.CHI2DOF) + }) + + return vars + +def main(options: Options): + + ####################################### + # B+ -> K+ e+ e- # + ####################################### + + fields = { + 'Bu' : "[B+ -> J/psi(1S) K+]CC", + 'Jpsi': "[B+ -> ^J/psi(1S) K+]CC", + 'Kp' : "[B+ -> J/psi(1S) ^K+]CC", + 'ep' : "[B+ -> (J/psi(1S) -> ^e+ e-) K+]CC", + 'em' : "[B+ -> (J/psi(1S) -> e+ ^e-) K+]CC" + } + + FILTER_TREE = lambda id: F.FILTER(F.IS_ABS_ID(id)) @ F.GET_ALL_DESCENDANTS() + + line = "Hlt2RD_BuToKpEE" + long_track_iso = "LongTrackIsolation" + neutral_iso = "NeutralIsolation" + + input_data = get_particles(f"/Event/HLT2/{line}/Particles") + + b_cciso_data = get_particles( + f"/Event/HLT2/{line}/B_{long_track_iso}/Particles" + ) + b_nciso_data = get_particles( + f"/Event/HLT2/{line}/B_{neutral_iso}/Particles" + ) + + pvs = get_pvs() + + b_charge_iso = VertexAndConeIsolation( + name="BIso05", + reference_particles=input_data, + related_particles=b_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + b_neutral_iso = VertexAndConeIsolation( + name="BIso10", + reference_particles=input_data, + related_particles=b_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + b_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=b_charge_iso, + neutral_cone_isolation_alg=b_neutral_iso, + array_indx_name="Bu_cone_indx", + ) + + b_fixpv_iso = VertexAndConeIsolation( + name="BIsoFixPV", + reference_particles=input_data, + related_particles=b_cciso_data, + cut=(F.SHARE_BPV(pvs) | (F.MINIPCHI2CUT(pvs, 9.0) @ F.FORWARDARG1())), + ) + + b_fix_pv_iso_variables = FC.ParticleIsolation( + isolation_alg=b_fixpv_iso, array_indx_name="Bu_FixPV_indx" + ) + + b_mass_constraint_iso = VertexAndConeIsolation( + name="BIsoMassConstraint", + reference_particles=input_data, + related_particles=b_nciso_data, + cut=(F.COMB_MASS() < 8 * GeV), + ) + + b_mass_constraint_iso_variables = FC.ParticleIsolation( + isolation_alg=b_mass_constraint_iso, array_indx_name="Bu_MassConstraint_indx" + ) + + b_vtxiso_onetrack_data = ParticleCombiner( + [input_data, b_cciso_data], + name="B2K_One_extra_track_combination", + DecayDescriptor="[B*0 -> B+ pi-]cc", + CombinationCut=F.ALL, + CompositeCut=F.ALL, + ) + + b_vtxiso_twotracks_data = ParticleCombiner( + [input_data, b_cciso_data, b_cciso_data], + name="B2K_Two_extra_tracks_combination", + DecayDescriptor="[B*+ -> B+ pi- pi+]cc", + CombinationCut=F.ALL, + CompositeCut=F.ALL, + ) + + b_vtxiso_onetrack = VertexAndConeIsolation( + name="OneTrack", + reference_particles=input_data, + related_particles=b_vtxiso_onetrack_data, + cut=(F.CHI2() @ F.FORWARDARG1() < 9.0), + ) + + b_vtxiso_twotracks = VertexAndConeIsolation( + name="TwoTracks", + reference_particles=input_data, + related_particles=b_vtxiso_twotracks_data, + cut=(F.CHI2() @ F.FORWARDARG1() < 15.0), + ) + + b_vtxiso_onetrack_variables = FC.VertexIsolation(isolation_alg=b_vtxiso_onetrack) + + b_vtxiso_twotracks_variables = FC.VertexIsolation(isolation_alg=b_vtxiso_twotracks) + + variables_all = FunctorCollection({ + "ID": F.PARTICLE_ID, # PDG ID of the particle + "Q": F.CHARGE, # Electric charge + "ETA": F.ETA, # Pseudorapidity + "PHI": F.PHI, # Azimuthal angle + "CHI2": F.CHI2, # χ² + "CHI2DOF": F.CHI2DOF, # χ² degrees of freedom + "OWNPVIP": F.OWNPVIP, # Impact parameter wrt own PV + "OWNPVIPCHI2": F.OWNPVIPCHI2, # Impact parameter χ² wrt own PV + + }) + + variables_all += FC.Kinematics() + + composite_variables = FunctorCollection({ + "END_VX": F.END_VX, # x-coordinate of decay vertex + "END_VY": F.END_VY, # y-coordinate of decay vertex + "END_VZ": F.END_VZ, # z-coordinate of decay vertex + # OWNPV values + "OWNPV_X": F.OWNPVX, # x-coordinate of best PV + "OWNPV_Y": F.OWNPVY, # y-coordinate of best PV + "OWNPV_Z": F.OWNPVZ, # z-coordinate of best PV + "OWNPV_NDOF": F.NDOF @ F.OWNPV, + "OWNPV_DIRA": F.OWNPVDIRA, # Direction angle cosine wrt own PV + "OWNPV_FD": F.OWNPVFD, # Flight distance wrt own PV + "OWNPV_FDCHI2": F.OWNPVFDCHI2, # Flight distance χ² wrt own PV + "OWNPV_VDRHO": F.OWNPVVDRHO, # Radial flight distance wrt own PV + "OWNPV_VDZ": F.OWNPVVDZ, # z-direction flight distance + "OWNPV_LTIME": F.OWNPVLTIME, # Proper lifetime + "OWNPV_DLS": F.OWNPVDLS, # Decay length significance + # DOCA + "DOCA12": F.DOCA(1, 2), # DOCA between first and second daughter + "DOCA12CHI2": F.DOCACHI2(1, 2), # DOCA χ² between first and second daughter + # Daughter Max, Min and Sums + "MAX_PT": F.MAX(F.PT), # Maximum PT of daughters + "MIN_PT": F.MIN(F.PT), # Minimum PT of daughters + "SUM_PT": F.SUM(F.PT), # Sum of daughters' PT + "MAX_P": F.MAX(F.P), # Maximum momentum of daughters + "MIN_P": F.MIN(F.P), # Minimum momentum of daughters + "SUM_P": F.SUM(F.P), # Sum of daughters' momentum + "MAX_OWNPVIPCHI2": F.MAX(F.OWNPVIPCHI2), # Max IP χ² of daughters + "MIN_OWNPVIPCHI2": F.MIN(F.OWNPVIPCHI2), # Min IP χ² of daughters + "SUM_OWNPVIPCHI2": F.SUM(F.OWNPVIPCHI2), # Sum of daughters' IP χ² + "MAXDOCACHI2": F.MAXDOCACHI2, # Maximum DOCA χ² between any daughters + "MAXDOCA": F.MAXDOCA, # Maximum DOCA between any daughters + "MAXSDOCACHI2": F.MAXSDOCACHI2, # Maximum signed DOCA χ² + "MAXSDOCA": F.MAXSDOCA, # Maximum signed DOCA + + }) + + variables_extra = FunctorCollection({ + 'BPVIPCHI2': F.BPVIPCHI2(pvs), + 'BPVIP': F.BPVIP(pvs), + 'BPVX': F.BPVX(pvs), + 'BPVY': F.BPVY(pvs), + 'BPVZ': F.BPVZ(pvs), + 'KEY': F.OBJECT_KEY, + 'ALLPV_FD' : F.ALLPV_FD(pvs), + 'ALLPV_IP' : F.ALLPV_IP(pvs), + "BPVFDCHI2": F.BPVFDCHI2(pvs), + "BPVFD": F.BPVFD(pvs), + 'BPVLTIME': F.BPVLTIME(pvs), + "BPVDIRA": F.BPVDIRA(pvs), + "BPVVDRHO": F.BPVVDRHO(pvs), + "BPVVDZ": F.BPVVDZ(pvs), + "MAX_BPVIPCHI2": F.MAX(F.BPVIPCHI2(pvs)), + "MIN_BPVIPCHI2": F.MIN(F.BPVIPCHI2(pvs)), + }) + + charged_variables = FC.ChargedCaloInfo(extra_info=True) + + variables_extra_children = FunctorCollection({ + 'BPVIPCHI2': F.BPVIPCHI2(pvs), + 'BPVIP': F.BPVIP(pvs), + 'BPVX': F.BPVX(pvs), + 'BPVY': F.BPVY(pvs), + 'BPVZ': F.BPVZ(pvs), + 'KEY': F.OBJECT_KEY, + "MINIPCHI2": F.MINIPCHI2(pvs) + }) + + charged_extra = FunctorCollection({ + 'CLUSTERMATCH': F.CLUSTERMATCH_CHI2, + 'NHITS': F.VALUE_OR(-1) @ F.NHITS @ F.TRACK, + 'NVPHITS': F.VALUE_OR(-1) @ F.NVPHITS @ F.TRACK, + 'NFTHITS': F.VALUE_OR(-1) @ F.NFTHITS @ F.TRACK, + 'NDOF': F.VALUE_OR(-1) @ F.NDOF @ F.TRACK, + 'QOVERP': F.QOVERP @ F.TRACK, + 'TRACKHASVELO': F.VALUE_OR(-1) @ F.TRACKHASVELO @ F.TRACK, + 'TRACKHASUT': F.VALUE_OR(-1) @ F.TRACKHASUT @ F.TRACK, + 'TRACK_P': F.TRACK_P @ F.TRACK, + 'TX': F.TX, + 'TY': F.TY, + 'RICH_DLL_BT': F.RICH_DLL_BT, + 'RICH_DLL_E': F.RICH_DLL_E, + 'RICH_DLL_K': F.RICH_DLL_K, + 'RICH_DLL_MU': F.RICH_DLL_MU, + 'RICH_DLL_P': F.RICH_DLL_P, + 'RICH_DLL_PI': F.RICH_DLL_PI, + "PPHASRICH" : F.PPHASRICH @ F.PROTOPARTICLE, + "RICH1_GAS_USED" : F.RICH1_GAS_USED, + "RICH2_GAS_USED" : F.RICH2_GAS_USED, + "RICH_SCALED_DLL_E" : F.RICH_SCALED_DLL_E, + "RICH_SCALED_DLL_MU" : F.RICH_SCALED_DLL_MU, + "RICH_THRESHOLD_DE" : F.RICH_THRESHOLD_DE, + "RICH_THRESHOLD_EL" : F.RICH_THRESHOLD_EL, + "RICH_THRESHOLD_KA" : F.RICH_THRESHOLD_KA, + "RICH_THRESHOLD_MU" : F.RICH_THRESHOLD_MU, + "RICH_THRESHOLD_PI" : F.RICH_THRESHOLD_PI, + "RICH_THRESHOLD_PR" : F.RICH_THRESHOLD_PR + }) + + charged_extra += FC.ParticleID(extra_info=True) + + Hlt1_decisions = [ + 'Hlt1DisplacedDielectron', + 'Hlt1DisplacedLeptons', + 'Hlt1SingleHighEt', + 'Hlt1SingleHighPtElectron', + 'Hlt1TrackElectronMVA', + 'Hlt1TrackMVA', + 'Hlt1TwoTrackMVA' + ] + + # MISSING HLT VARIABLES + variables_all += FC.HltTisTos( + selection_type="Hlt1", + trigger_lines=[f"{x}Decision" for x in Hlt1_decisions], + data=input_data) + + event_info = EventInfo() + event_info += FunctorCollection({ + "NPV": F.SIZE(pvs), # Number of primary vertices + "ALLPVX[NPVs]": F.ALLPVX(pvs), # x-coordinates of all PVs + "ALLPVY[NPVs]": F.ALLPVY(pvs), # y-coordinates of all PVs + "ALLPVZ[NPVs]": F.ALLPVZ(pvs), # z-coordinates of all PVs + }) + event_info += FC.RecSummary() # Reconstruction summary, nLongTracks, nDownstreamTracks + event_info += FC.LHCInfo() # LHC running conditions, FillNumber, LHC energy + event_info += SelectionInfo(selection_type='Hlt1', trigger_lines=Hlt1_decisions) + event_info += SelectionInfo(selection_type='Hlt2', trigger_lines=[line]) + + simulation = options.simulation + + if simulation: + MCTRUTH = MCTruthAndBkgCat(input_particles=input_data, name="MCTruthAndBkgCat_{hash}") + variables_mc = variables_MC(MCTRUTH) + variables_all += variables_mc + + variables = { 'Bu' : variables_all+variables_extra + + composite_variables + + b_cone_iso_variables + + b_fix_pv_iso_variables + + b_mass_constraint_iso_variables + + b_vtxiso_onetrack_variables + + b_vtxiso_twotracks_variables, + 'Jpsi' : variables_all+variables_extra+composite_variables, + 'Kp' : variables_all+variables_extra_children+charged_extra, + 'ep': variables_all+variables_extra_children+charged_variables+charged_extra, + 'em': variables_all+variables_extra_children+charged_variables+charged_extra} + + if simulation: + variables["Bu"].update({"BKGCAT":MCTRUTH.BkgCat}) + + for particl in variables: + variables[particl] += make_DTF_vars(input_data,["J/psi(1S)"],name='DTF_JpsiConstr') + variables[particl] += make_DTF_vars(input_data,["B+"],name='DTF_BConstr') + variables[particl] += make_DTF_vars(input_data,["J/psi(1S)"],name='DTFPV_JpsiConstr', pvs=pvs) + variables[particl] += make_DTF_vars(input_data,["B+"],name='DTFPV_BConstr', pvs=pvs) + variables[particl] += make_DTF_vars(input_data,[],name='DTFPV', pvs=pvs) + variables[particl] += make_DTF_vars(input_data,["psi(2S)"],name='DTF_psi2SConstr',substitutions=['B+ -> J/psi(1S){{psi(2S)}} K+']) + variables[particl] += make_DTF_vars(input_data,["psi(2S)"],name='DTFPV_psi2SConstr',pvs=pvs,substitutions=['B+ -> J/psi(1S){{psi(2S)}} K+']) + variables[particl] += make_DTF_vars(input_data,["J/psi(1S)"],name='DTFPV_JpsiConstr_KToPi',substitutions=['B+ -> J/psi(1S) K+{{pi+}}'], pvs=pvs,extravars=False) + variables[particl] += make_DTF_vars(input_data,[],name='DTFPV_KToPi',substitutions=['B+ -> J/psi(1S) K+{{pi+}}'], pvs=pvs,extravars=False) + variables[particl] += make_DTF_vars(input_data,["J/psi(1S)"],name='DTF_JpsiConstr_KToPi',substitutions=['B+ -> J/psi(1S) K+{{pi+}}']) #*** + variables[particl] += make_DTF_vars(input_data,["psi(2S)"],name='DTF_psi2SConstr_KToPi',substitutions=['B+ -> J/psi(1S){{psi(2S)}} K+{{pi+}}']) #*** + variables[particl] += make_DTF_vars(input_data,["psi(2S)"],name='DTFPV_psi2SConstr_KToPi',substitutions=['B+ -> J/psi(1S){{psi(2S)}} K+{{pi+}}'], pvs=pvs,extravars=False) #*** + + tuple_b2K = Funtuple( + name='BuToKpEE', + tuple_name='DecayTree', + fields=fields, + variables=variables, + event_variables=event_info, + inputs=input_data + ) + + filter_b2K = create_lines_filter(name=f"HLT_PASS('{line}')",lines=[line]) + + algs = {"tuple_b2K": [filter_b2K, tuple_b2K] + } + + return make_config(options, algs) diff --git a/b2xll_MC24_W31_34/electrons/dv_BuToPipEE.py b/b2xll_MC24_W31_34/electrons/dv_BuToPipEE.py new file mode 100644 index 0000000000..daa0a501df --- /dev/null +++ b/b2xll_MC24_W31_34/electrons/dv_BuToPipEE.py @@ -0,0 +1,455 @@ +from GaudiKernel.SystemOfUnits import GeV +from PyConf.reading import get_particles, get_pvs, get_mc_particles +from PyConf.Algorithms import ThOrParticleSelection +from IsolationTools import VertexAndConeIsolation +from Hlt2Conf.algorithms_thor import ParticleCombiner +import Functors as F +from FunTuple import FunctorCollection +from FunTuple import FunTuple_Particles as Funtuple +from FunTuple import FunTuple_MCParticles as FuntupleMC +import FunTuple.functorcollections as FC +from DaVinci.algorithms import create_lines_filter +from DaVinci import Options, make_config +from DaVinciMCTools import MCTruthAndBkgCat +from DecayTreeFitter import DecayTreeFitter +from DaVinciTools import SubstitutePID +from FunTuple.functorcollections import Kinematics, MCKinematics, MCVertexInfo, MCHierarchy, EventInfo, SelectionInfo + +from PyConf.application import metainfo_repos +metainfo_repos.global_bind(extra_central_tags=['commissioning']) + + +def variables_MC(mctruth): + # Returns the variables for the Monte Carlo simulation + # mctruth = MCTruthAndBkgCat(input_particles=particles, name='MCTruthAndBkgCat_{hash}') from DaVinciMCTools + + mcvars = FC.MCKinematics(mctruth_alg=mctruth) + mcvars += FC.MCHierarchy(mctruth_alg=mctruth) + mcvars += FC.MCPromptDecay(mctruth_alg=mctruth) + mcvars += FC.MCVertexInfo(mctruth_alg=mctruth) + + return mcvars + +def make_DTF_vars(particles,constraints,name='DTF', pvs=None, substitutions=None, dtfname='DTF_{hash}',extravars=True): + + if pvs is None: + DTF = DecayTreeFitter( + name=dtfname, + input_particles=particles, + mass_constraints=constraints, + substitutions=substitutions + ) + else: + DTF = DecayTreeFitter( + name=dtfname, + input_particles=particles, + input_pvs=pvs, + mass_constraints=constraints, + substitutions=substitutions + ) + + vars = FunctorCollection({ + f'{name}_MASS': DTF(F.MASS), + }) + + if extravars: + vars+=FunctorCollection({ + f'{name}_P': DTF(F.P), + f'{name}_PX': DTF(F.PX), + f'{name}_PY': DTF(F.PY), + f'{name}_PZ': DTF(F.PZ), + f'{name}_PT': DTF(F.PT), + f'{name}_ENERGY': DTF(F.ENERGY), + f'{name}_CHI2DOF': DTF(F.CHI2DOF) + }) + + return vars + +def main(options: Options): + + ####################################### + # B+ -> pi+ e+ e- # + ####################################### + + fields = { + 'Bu' : '[B+ -> (J/psi(1S) -> e+ e- ) pi+]CC', + 'Jpsi': '[B+ -> ^(J/psi(1S) -> e+ e-) pi+]CC', + 'Pip' : '[B+ -> (J/psi(1S) -> e+ e-) ^pi+]CC', + 'ep' : '[B+ -> (J/psi(1S) ->^e+ e-) pi+]CC', + 'em' : '[B+ -> (J/psi(1S) -> e+ ^e-) pi+]CC', + } + + FILTER_TREE = lambda id: F.FILTER(F.IS_ABS_ID(id)) @ F.GET_ALL_DESCENDANTS() + + line = "Hlt2RD_BuToPipEE" + long_track_iso = "LongTrackIsolation" + neutral_iso = "NeutralIsolation" + + input_data = get_particles(f"/Event/HLT2/{line}/Particles") + b2piee_pi_data = ThOrParticleSelection( + InputParticles=input_data, Functor=FILTER_TREE("pi+") + ).OutputSelection + b2piee_ep_data = ThOrParticleSelection( + InputParticles=input_data, Functor=FILTER_TREE("e+") + ).OutputSelection + b2piee_em_data = ThOrParticleSelection( + InputParticles=input_data, Functor=FILTER_TREE("e-") + ).OutputSelection + + b_cciso_data = get_particles( + f"/Event/HLT2/{line}/B_{long_track_iso}/Particles" + ) + pi_cciso_data = get_particles( + f"/Event/HLT2/{line}/pi+_{long_track_iso}/Particles" + ) + ep_cciso_data = get_particles( + f"/Event/HLT2/{line}/e+_{long_track_iso}/Particles" + ) + em_cciso_data = get_particles( + f"/Event/HLT2/{line}/e-_{long_track_iso}/Particles" + ) + b_nciso_data = get_particles( + f"/Event/HLT2/{line}/B_{neutral_iso}/Particles" + ) + pi_nciso_data = get_particles( + f"/Event/HLT2/{line}/pi+_{neutral_iso}/Particles" + ) + ep_nciso_data = get_particles( + f"/Event/HLT2/{line}/e+_{neutral_iso}/Particles" + ) + em_nciso_data = get_particles( + f"/Event/HLT2/{line}/e-_{neutral_iso}/Particles" + ) + + pvs = get_pvs() + + b_charge_iso = VertexAndConeIsolation( + name="BIso05", + reference_particles=input_data, + related_particles=b_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + b_neutral_iso = VertexAndConeIsolation( + name="BIso10", + reference_particles=input_data, + related_particles=b_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + b_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=b_charge_iso, + neutral_cone_isolation_alg=b_neutral_iso, + array_indx_name="Bu_cone_indx", + ) + + ep_charge_iso = VertexAndConeIsolation( + name="EpIso05", + reference_particles=b2piee_ep_data, + related_particles=ep_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + ep_neutral_iso = VertexAndConeIsolation( + name="EpIso10", + reference_particles=b2piee_ep_data, + related_particles=ep_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + ep_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=ep_charge_iso, + neutral_cone_isolation_alg=ep_neutral_iso, + array_indx_name="Ep_cone_indx", + ) + + em_charge_iso = VertexAndConeIsolation( + name="EmIso05", + reference_particles=b2piee_em_data, + related_particles=em_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + em_neutral_iso = VertexAndConeIsolation( + name="EmIso10", + reference_particles=b2piee_em_data, + related_particles=em_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + em_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=em_charge_iso, + neutral_cone_isolation_alg=em_neutral_iso, + array_indx_name="Em_cone_indx", + ) + + pi_charge_iso = VertexAndConeIsolation( + name="PipIso05", + reference_particles=b2piee_pi_data, + related_particles=pi_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + pi_neutral_iso = VertexAndConeIsolation( + name="PipIso10", + reference_particles=b2piee_pi_data, + related_particles=pi_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + + pi_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=pi_charge_iso, + neutral_cone_isolation_alg=pi_neutral_iso, + array_indx_name="Pip_cone_indx", + ) + + b_fixpv_iso = VertexAndConeIsolation( + name="BIsoFixPV", + reference_particles=input_data, + related_particles=b_cciso_data, + cut=(F.SHARE_BPV(pvs) | (F.MINIPCHI2CUT(pvs, 9.0) @ F.FORWARDARG1())), + ) + + b_fix_pv_iso_variables = FC.ParticleIsolation( + isolation_alg=b_fixpv_iso, array_indx_name="Bu_FixPV_indx" + ) + + b_mass_constraint_iso = VertexAndConeIsolation( + name="BIsoMassConstraint", + reference_particles=input_data, + related_particles=b_nciso_data, + cut=(F.COMB_MASS() < 8 * GeV), + ) + + b_mass_constraint_iso_variables = FC.ParticleIsolation( + isolation_alg=b_mass_constraint_iso, array_indx_name="Bu_MassConstraint_indx" + ) + + b_vtxiso_onetrack_data = ParticleCombiner( + [input_data, b_cciso_data], + name="B2pi_One_extra_track_combination", + DecayDescriptor="[B*0 -> B+ pi-]cc", + CombinationCut=F.ALL, + CompositeCut=F.ALL, + ) + + b_vtxiso_twotracks_data = ParticleCombiner( + [input_data, b_cciso_data, b_cciso_data], + name="B2pi_Two_extra_tracks_combination", + DecayDescriptor="[B*+ -> B+ pi- pi+]cc", + CombinationCut=F.ALL, + CompositeCut=F.ALL, + ) + + b_vtxiso_onetrack = VertexAndConeIsolation( + name="OneTrack", + reference_particles=input_data, + related_particles=b_vtxiso_onetrack_data, + cut=(F.CHI2() @ F.FORWARDARG1() < 9.0), + ) + + b_vtxiso_twotracks = VertexAndConeIsolation( + name="TwoTracks", + reference_particles=input_data, + related_particles=b_vtxiso_twotracks_data, + cut=(F.CHI2() @ F.FORWARDARG1() < 15.0), + ) + + b_vtxiso_onetrack_variables = FC.VertexIsolation(isolation_alg=b_vtxiso_onetrack) + + b_vtxiso_twotracks_variables = FC.VertexIsolation(isolation_alg=b_vtxiso_twotracks) + + variables_all = FunctorCollection({ + "ID": F.PARTICLE_ID, # PDG ID of the particle + "Q": F.CHARGE, # Electric charge + "ETA": F.ETA, # Pseudorapidity + "PHI": F.PHI, # Azimuthal angle + "CHI2": F.CHI2, # χ² + "CHI2DOF": F.CHI2DOF, # χ² degrees of freedom + "OWNPVIP": F.OWNPVIP, # Impact parameter wrt own PV + "OWNPVIPCHI2": F.OWNPVIPCHI2, # Impact parameter χ² wrt own PV + + }) + + variables_all += FC.Kinematics() + + composite_variables = FunctorCollection({ + "END_VX": F.END_VX, # x-coordinate of decay vertex + "END_VY": F.END_VY, # y-coordinate of decay vertex + "END_VZ": F.END_VZ, # z-coordinate of decay vertex + # OWNPV values + "OWNPV_X": F.OWNPVX, # x-coordinate of best PV + "OWNPV_Y": F.OWNPVY, # y-coordinate of best PV + "OWNPV_Z": F.OWNPVZ, # z-coordinate of best PV + "OWNPV_NDOF": F.NDOF @ F.OWNPV, + "OWNPV_DIRA": F.OWNPVDIRA, # Direction angle cosine wrt own PV + "OWNPV_FD": F.OWNPVFD, # Flight distance wrt own PV + "OWNPV_FDCHI2": F.OWNPVFDCHI2, # Flight distance χ² wrt own PV + "OWNPV_VDRHO": F.OWNPVVDRHO, # Radial flight distance wrt own PV + "OWNPV_VDZ": F.OWNPVVDZ, # z-direction flight distance + "OWNPV_LTIME": F.OWNPVLTIME, # Proper lifetime + "OWNPV_DLS": F.OWNPVDLS, # Decay length significance + # DOCA + "DOCA12": F.DOCA(1, 2), # DOCA between first and second daughter + "DOCA12CHI2": F.DOCACHI2(1, 2), # DOCA χ² between first and second daughter + # Daughter Max, Min and Sums + "MAX_PT": F.MAX(F.PT), # Maximum PT of daughters + "MIN_PT": F.MIN(F.PT), # Minimum PT of daughters + "SUM_PT": F.SUM(F.PT), # Sum of daughters' PT + "MAX_P": F.MAX(F.P), # Maximum momentum of daughters + "MIN_P": F.MIN(F.P), # Minimum momentum of daughters + "SUM_P": F.SUM(F.P), # Sum of daughters' momentum + "MAX_OWNPVIPCHI2": F.MAX(F.OWNPVIPCHI2), # Max IP χ² of daughters + "MIN_OWNPVIPCHI2": F.MIN(F.OWNPVIPCHI2), # Min IP χ² of daughters + "SUM_OWNPVIPCHI2": F.SUM(F.OWNPVIPCHI2), # Sum of daughters' IP χ² + "MAXDOCACHI2": F.MAXDOCACHI2, # Maximum DOCA χ² between any daughters + "MAXDOCA": F.MAXDOCA, # Maximum DOCA between any daughters + "MAXSDOCACHI2": F.MAXSDOCACHI2, # Maximum signed DOCA χ² + "MAXSDOCA": F.MAXSDOCA, # Maximum signed DOCA + + }) + + variables_extra = FunctorCollection({ + 'BPVIPCHI2': F.BPVIPCHI2(pvs), + 'BPVIP': F.BPVIP(pvs), + 'BPVX': F.BPVX(pvs), + 'BPVY': F.BPVY(pvs), + 'BPVZ': F.BPVZ(pvs), + 'KEY': F.OBJECT_KEY, + 'ALLPV_FD' : F.ALLPV_FD(pvs), + 'ALLPV_IP' : F.ALLPV_IP(pvs), + "BPVFDCHI2": F.BPVFDCHI2(pvs), + "BPVFD": F.BPVFD(pvs), + 'BPVLTIME': F.BPVLTIME(pvs), + "BPVDIRA": F.BPVDIRA(pvs), + "BPVVDRHO": F.BPVVDRHO(pvs), + "BPVVDZ": F.BPVVDZ(pvs), + "MAX_BPVIPCHI2": F.MAX(F.BPVIPCHI2(pvs)), + "MIN_BPVIPCHI2": F.MIN(F.BPVIPCHI2(pvs)), + }) + + charged_variables = FC.ChargedCaloInfo(extra_info=True) + + variables_extra_children = FunctorCollection({ + 'BPVIPCHI2': F.BPVIPCHI2(pvs), + 'BPVIP': F.BPVIP(pvs), + 'BPVX': F.BPVX(pvs), + 'BPVY': F.BPVY(pvs), + 'BPVZ': F.BPVZ(pvs), + 'KEY': F.OBJECT_KEY, + "MINIPCHI2": F.MINIPCHI2(pvs) + }) + + charged_extra = FunctorCollection({ + 'CLUSTERMATCH': F.CLUSTERMATCH_CHI2, + 'NHITS': F.VALUE_OR(-1) @ F.NHITS @ F.TRACK, + 'NVPHITS': F.VALUE_OR(-1) @ F.NVPHITS @ F.TRACK, + 'NFTHITS': F.VALUE_OR(-1) @ F.NFTHITS @ F.TRACK, + 'NDOF': F.VALUE_OR(-1) @ F.NDOF @ F.TRACK, + 'QOVERP': F.QOVERP @ F.TRACK, + 'TRACKHASVELO': F.VALUE_OR(-1) @ F.TRACKHASVELO @ F.TRACK, + 'TRACKHASUT': F.VALUE_OR(-1) @ F.TRACKHASUT @ F.TRACK, + 'TRACK_P': F.TRACK_P @ F.TRACK, + 'TX': F.TX, + 'TY': F.TY, + 'RICH_DLL_BT': F.RICH_DLL_BT, + 'RICH_DLL_E': F.RICH_DLL_E, + 'RICH_DLL_K': F.RICH_DLL_K, + 'RICH_DLL_MU': F.RICH_DLL_MU, + 'RICH_DLL_P': F.RICH_DLL_P, + 'RICH_DLL_PI': F.RICH_DLL_PI, + "PPHASRICH" : F.PPHASRICH @ F.PROTOPARTICLE, + "RICH1_GAS_USED" : F.RICH1_GAS_USED, + "RICH2_GAS_USED" : F.RICH2_GAS_USED, + "RICH_SCALED_DLL_E" : F.RICH_SCALED_DLL_E, + "RICH_SCALED_DLL_MU" : F.RICH_SCALED_DLL_MU, + "RICH_THRESHOLD_DE" : F.RICH_THRESHOLD_DE, + "RICH_THRESHOLD_EL" : F.RICH_THRESHOLD_EL, + "RICH_THRESHOLD_KA" : F.RICH_THRESHOLD_KA, + "RICH_THRESHOLD_MU" : F.RICH_THRESHOLD_MU, + "RICH_THRESHOLD_PI" : F.RICH_THRESHOLD_PI, + "RICH_THRESHOLD_PR" : F.RICH_THRESHOLD_PR + }) + + charged_extra += FC.ParticleID(extra_info=True) + + Hlt1_decisions = [ + 'Hlt1DisplacedDielectron', + 'Hlt1DisplacedLeptons', + 'Hlt1SingleHighEt', + 'Hlt1SingleHighPtElectron', + 'Hlt1TrackElectronMVA', + 'Hlt1TrackMVA', + 'Hlt1TwoTrackMVA' + ] + + # MISSING HLT VARIABLES + variables_all += FC.HltTisTos( + selection_type="Hlt1", + trigger_lines=[f"{x}Decision" for x in Hlt1_decisions], + data=input_data) + + event_info = EventInfo() + event_info += FunctorCollection({ + "NPV": F.SIZE(pvs), # Number of primary vertices + "ALLPVX[NPVs]": F.ALLPVX(pvs), # x-coordinates of all PVs + "ALLPVY[NPVs]": F.ALLPVY(pvs), # y-coordinates of all PVs + "ALLPVZ[NPVs]": F.ALLPVZ(pvs), # z-coordinates of all PVs + }) + event_info += FC.RecSummary() # Reconstruction summary, nLongTracks, nDownstreamTracks + event_info += FC.LHCInfo() # LHC running conditions, FillNumber, LHC energy + event_info += SelectionInfo(selection_type='Hlt1', trigger_lines=Hlt1_decisions) + event_info += SelectionInfo(selection_type='Hlt2', trigger_lines=[line]) + + simulation = options.simulation + + if simulation: + MCTRUTH = MCTruthAndBkgCat(input_particles=input_data, name="MCTruthAndBkgCat_{hash}") + variables_mc = variables_MC(MCTRUTH) + variables_all += variables_mc + + variables = { 'Bu' : variables_all+variables_extra + + composite_variables + + b_cone_iso_variables + + b_fix_pv_iso_variables + + b_mass_constraint_iso_variables + + b_vtxiso_onetrack_variables + + b_vtxiso_twotracks_variables, + 'Jpsi' : variables_all+variables_extra+composite_variables, + 'Pip' : variables_all+variables_extra_children+charged_extra+pi_cone_iso_variables, + 'ep': variables_all+variables_extra_children+charged_variables+charged_extra+ep_cone_iso_variables, + 'em': variables_all+variables_extra_children+charged_variables+charged_extra+em_cone_iso_variables } + + if simulation: + variables["Bu"].update({"BKGCAT":MCTRUTH.BkgCat}) + + for particl in variables: + variables[particl] += make_DTF_vars(input_data,["J/psi(1S)"],name='DTF_JpsiConstr') + variables[particl] += make_DTF_vars(input_data,["B+"],name='DTF_BConstr') + variables[particl] += make_DTF_vars(input_data,["J/psi(1S)"],name='DTFPV_JpsiConstr', pvs=pvs) + variables[particl] += make_DTF_vars(input_data,["B+"],name='DTFPV_BConstr', pvs=pvs) + variables[particl] += make_DTF_vars(input_data,[],name='DTFPV', pvs=pvs) + variables[particl] += make_DTF_vars(input_data,["psi(2S)"],name='DTF_psi2SConstr',substitutions=['B+ -> J/psi(1S){{psi(2S)}} pi+']) + variables[particl] += make_DTF_vars(input_data,["psi(2S)"],name='DTFPV_psi2SConstr',pvs=pvs,substitutions=['B+ -> J/psi(1S){{psi(2S)}} pi+']) + variables[particl] += make_DTF_vars(input_data,["J/psi(1S)"],name='DTFPV_JpsiConstr_PiToK',substitutions=['B+ -> J/psi(1S) pi+{{K+}}'], pvs=pvs,extravars=False) + variables[particl] += make_DTF_vars(input_data,[],name='DTFPV_PiToK',substitutions=['B+ -> J/psi(1S) pi+{{K+}}'], pvs=pvs,extravars=False) + variables[particl] += make_DTF_vars(input_data,["J/psi(1S)"],name='DTF_JpsiConstr_PiToK',substitutions=['B+ -> J/psi(1S) pi+{{K+}}']) #*** + variables[particl] += make_DTF_vars(input_data,["psi(2S)"],name='DTF_psi2SConstr_PiToK',substitutions=['B+ -> J/psi(1S){{psi(2S)}} pi+{{K+}}']) #*** + variables[particl] += make_DTF_vars(input_data,["psi(2S)"],name='DTFPV_psi2SConstr_PiToK',substitutions=['B+ -> J/psi(1S){{psi(2S)}} pi+{{K+}}'], pvs=pvs,extravars=False) #*** + + tuple_b2pi = Funtuple( + name='BuToPipEE', + tuple_name='DecayTree', + fields=fields, + variables=variables, + event_variables=event_info, + inputs=input_data + ) + + filter_b2pi = create_lines_filter(name=f"HLT_PASS('{line}')",lines=[line]) + + algs = {"tuple_b2pi": [filter_b2pi, tuple_b2pi] + } + + return make_config(options, algs) diff --git a/b2xll_MC24_W31_34/electrons/dv_LbToPpKmEE.py b/b2xll_MC24_W31_34/electrons/dv_LbToPpKmEE.py new file mode 100644 index 0000000000..531e4b50c3 --- /dev/null +++ b/b2xll_MC24_W31_34/electrons/dv_LbToPpKmEE.py @@ -0,0 +1,277 @@ +from GaudiKernel.SystemOfUnits import GeV +from PyConf.reading import get_particles, get_pvs, get_mc_particles +from PyConf.Algorithms import ThOrParticleSelection +from IsolationTools import VertexAndConeIsolation +from Hlt2Conf.algorithms_thor import ParticleCombiner +import Functors as F +from FunTuple import FunctorCollection +from FunTuple import FunTuple_Particles as Funtuple +from FunTuple import FunTuple_MCParticles as FuntupleMC +import FunTuple.functorcollections as FC +from DaVinci.algorithms import create_lines_filter +from DaVinci import Options, make_config +from DaVinciMCTools import MCTruthAndBkgCat +from DecayTreeFitter import DecayTreeFitter +from DaVinciTools import SubstitutePID +from FunTuple.functorcollections import Kinematics, MCKinematics, MCVertexInfo, MCHierarchy, EventInfo, SelectionInfo + +from PyConf.application import metainfo_repos +metainfo_repos.global_bind(extra_central_tags=['commissioning']) + + +def variables_MC(mctruth): + # Returns the variables for the Monte Carlo simulation + # mctruth = MCTruthAndBkgCat(input_particles=particles, name='MCTruthAndBkgCat_{hash}') from DaVinciMCTools + + mcvars = FC.MCKinematics(mctruth_alg=mctruth) + mcvars += FC.MCHierarchy(mctruth_alg=mctruth) + mcvars += FC.MCPromptDecay(mctruth_alg=mctruth) + mcvars += FC.MCVertexInfo(mctruth_alg=mctruth) + + return mcvars + +def make_DTF_vars(particles,constraints,name='DTF', pvs=None, substitutions=None, dtfname='DTF_{hash}',extravars=True): + + if pvs is None: + DTF = DecayTreeFitter( + name=dtfname, + input_particles=particles, + mass_constraints=constraints, + substitutions=substitutions + ) + else: + DTF = DecayTreeFitter( + name=dtfname, + input_particles=particles, + input_pvs=pvs, + mass_constraints=constraints, + substitutions=substitutions + ) + + vars = FunctorCollection({ + f'{name}_MASS': DTF(F.MASS), + }) + + if extravars: + vars+=FunctorCollection({ + f'{name}_P': DTF(F.P), + f'{name}_PX': DTF(F.PX), + f'{name}_PY': DTF(F.PY), + f'{name}_PZ': DTF(F.PZ), + f'{name}_PT': DTF(F.PT), + f'{name}_ENERGY': DTF(F.ENERGY), + f'{name}_CHI2DOF': DTF(F.CHI2DOF) + }) + + return vars + +def main(options: Options): + + ####################################### + # Lb -> p K- e+ e- # + ####################################### + + fields = { + "Lb" : "[Lambda_b0 -> J/psi(1S) Lambda(1520)0]CC", + "Jpsi": "[Lambda_b0 -> ^J/psi(1S) Lambda(1520)0]CC", + "Lb_1520": "[Lambda_b0 -> J/psi(1S) ^Lambda(1520)0]CC", + "Pp" : "[Lambda_b0 -> J/psi(1S) (Lambda(1520)0-> ^p+ K-)]CC", + "Km" : "[Lambda_b0 -> J/psi(1S) (Lambda(1520)0-> p+ ^K-)]CC", + "ep" : "[Lambda_b0 -> (J/psi(1S)-> ^e+ e-) Lambda(1520)0]CC", + "em" : "[Lambda_b0 -> (J/psi(1S)-> e+ ^e-) Lambda(1520)0]CC" + } + + line = "Hlt2RD_LambdabToPKEE" + input_data = get_particles(f"/Event/HLT2/{line}/Particles") + + pvs = get_pvs() + + variables_all = FunctorCollection({ + "ID": F.PARTICLE_ID, # PDG ID of the particle + "Q": F.CHARGE, # Electric charge + "ETA": F.ETA, # Pseudorapidity + "PHI": F.PHI, # Azimuthal angle + "CHI2": F.CHI2, # χ² + "CHI2DOF": F.CHI2DOF, # χ² degrees of freedom + "OWNPVIP": F.OWNPVIP, # Impact parameter wrt own PV + "OWNPVIPCHI2": F.OWNPVIPCHI2, # Impact parameter χ² wrt own PV + + }) + + variables_all += FC.Kinematics() + + composite_variables = FunctorCollection({ + "END_VX": F.END_VX, # x-coordinate of decay vertex + "END_VY": F.END_VY, # y-coordinate of decay vertex + "END_VZ": F.END_VZ, # z-coordinate of decay vertex + # OWNPV values + "OWNPV_X": F.OWNPVX, # x-coordinate of best PV + "OWNPV_Y": F.OWNPVY, # y-coordinate of best PV + "OWNPV_Z": F.OWNPVZ, # z-coordinate of best PV + "OWNPV_NDOF": F.NDOF @ F.OWNPV, + "OWNPV_DIRA": F.OWNPVDIRA, # Direction angle cosine wrt own PV + "OWNPV_FD": F.OWNPVFD, # Flight distance wrt own PV + "OWNPV_FDCHI2": F.OWNPVFDCHI2, # Flight distance χ² wrt own PV + "OWNPV_VDRHO": F.OWNPVVDRHO, # Radial flight distance wrt own PV + "OWNPV_VDZ": F.OWNPVVDZ, # z-direction flight distance + "OWNPV_LTIME": F.OWNPVLTIME, # Proper lifetime + "OWNPV_DLS": F.OWNPVDLS, # Decay length significance + # DOCA + "DOCA12": F.DOCA(1, 2), # DOCA between first and second daughter + "DOCA12CHI2": F.DOCACHI2(1, 2), # DOCA χ² between first and second daughter + # Daughter Max, Min and Sums + "MAX_PT": F.MAX(F.PT), # Maximum PT of daughters + "MIN_PT": F.MIN(F.PT), # Minimum PT of daughters + "SUM_PT": F.SUM(F.PT), # Sum of daughters' PT + "MAX_P": F.MAX(F.P), # Maximum momentum of daughters + "MIN_P": F.MIN(F.P), # Minimum momentum of daughters + "SUM_P": F.SUM(F.P), # Sum of daughters' momentum + "MAX_OWNPVIPCHI2": F.MAX(F.OWNPVIPCHI2), # Max IP χ² of daughters + "MIN_OWNPVIPCHI2": F.MIN(F.OWNPVIPCHI2), # Min IP χ² of daughters + "SUM_OWNPVIPCHI2": F.SUM(F.OWNPVIPCHI2), # Sum of daughters' IP χ² + "MAXDOCACHI2": F.MAXDOCACHI2, # Maximum DOCA χ² between any daughters + "MAXDOCA": F.MAXDOCA, # Maximum DOCA between any daughters + "MAXSDOCACHI2": F.MAXSDOCACHI2, # Maximum signed DOCA χ² + "MAXSDOCA": F.MAXSDOCA, # Maximum signed DOCA + + }) + + variables_extra = FunctorCollection({ + 'BPVIPCHI2': F.BPVIPCHI2(pvs), + 'BPVIP': F.BPVIP(pvs), + 'BPVX': F.BPVX(pvs), + 'BPVY': F.BPVY(pvs), + 'BPVZ': F.BPVZ(pvs), + 'KEY': F.OBJECT_KEY, + 'ALLPV_FD' : F.ALLPV_FD(pvs), + 'ALLPV_IP' : F.ALLPV_IP(pvs), + "BPVFDCHI2": F.BPVFDCHI2(pvs), + "BPVFD": F.BPVFD(pvs), + 'BPVLTIME': F.BPVLTIME(pvs), + "BPVDIRA": F.BPVDIRA(pvs), + "BPVVDRHO": F.BPVVDRHO(pvs), + "BPVVDZ": F.BPVVDZ(pvs), + "MAX_BPVIPCHI2": F.MAX(F.BPVIPCHI2(pvs)), + "MIN_BPVIPCHI2": F.MIN(F.BPVIPCHI2(pvs)), + }) + + charged_variables = FC.ChargedCaloInfo(extra_info=True) + + variables_extra_children = FunctorCollection({ + 'BPVIPCHI2': F.BPVIPCHI2(pvs), + 'BPVIP': F.BPVIP(pvs), + 'BPVX': F.BPVX(pvs), + 'BPVY': F.BPVY(pvs), + 'BPVZ': F.BPVZ(pvs), + 'KEY': F.OBJECT_KEY, + "MINIPCHI2": F.MINIPCHI2(pvs) + }) + + charged_extra = FunctorCollection({ + 'CLUSTERMATCH': F.CLUSTERMATCH_CHI2, + 'NHITS': F.VALUE_OR(-1) @ F.NHITS @ F.TRACK, + 'NVPHITS': F.VALUE_OR(-1) @ F.NVPHITS @ F.TRACK, + 'NFTHITS': F.VALUE_OR(-1) @ F.NFTHITS @ F.TRACK, + 'NDOF': F.VALUE_OR(-1) @ F.NDOF @ F.TRACK, + 'QOVERP': F.QOVERP @ F.TRACK, + 'TRACKHASVELO': F.VALUE_OR(-1) @ F.TRACKHASVELO @ F.TRACK, + 'TRACKHASUT': F.VALUE_OR(-1) @ F.TRACKHASUT @ F.TRACK, + 'TRACK_P': F.TRACK_P @ F.TRACK, + 'TX': F.TX, + 'TY': F.TY, + 'RICH_DLL_BT': F.RICH_DLL_BT, + 'RICH_DLL_E': F.RICH_DLL_E, + 'RICH_DLL_K': F.RICH_DLL_K, + 'RICH_DLL_MU': F.RICH_DLL_MU, + 'RICH_DLL_P': F.RICH_DLL_P, + 'RICH_DLL_PI': F.RICH_DLL_PI, + "PPHASRICH" : F.PPHASRICH @ F.PROTOPARTICLE, + "RICH1_GAS_USED" : F.RICH1_GAS_USED, + "RICH2_GAS_USED" : F.RICH2_GAS_USED, + "RICH_SCALED_DLL_E" : F.RICH_SCALED_DLL_E, + "RICH_SCALED_DLL_MU" : F.RICH_SCALED_DLL_MU, + "RICH_THRESHOLD_DE" : F.RICH_THRESHOLD_DE, + "RICH_THRESHOLD_EL" : F.RICH_THRESHOLD_EL, + "RICH_THRESHOLD_KA" : F.RICH_THRESHOLD_KA, + "RICH_THRESHOLD_MU" : F.RICH_THRESHOLD_MU, + "RICH_THRESHOLD_PI" : F.RICH_THRESHOLD_PI, + "RICH_THRESHOLD_PR" : F.RICH_THRESHOLD_PR + }) + + charged_extra += FC.ParticleID(extra_info=True) + + Hlt1_decisions = [ + 'Hlt1DisplacedDielectron', + 'Hlt1DisplacedLeptons', + 'Hlt1SingleHighEt', + 'Hlt1SingleHighPtElectron', + 'Hlt1TrackElectronMVA', + 'Hlt1TrackMVA', + 'Hlt1TwoTrackMVA' + ] + + # MISSING HLT VARIABLES + variables_all += FC.HltTisTos( + selection_type="Hlt1", + trigger_lines=[f"{x}Decision" for x in Hlt1_decisions], + data=input_data) + + event_info = EventInfo() + event_info += FunctorCollection({ + "NPV": F.SIZE(pvs), # Number of primary vertices + "ALLPVX[NPVs]": F.ALLPVX(pvs), # x-coordinates of all PVs + "ALLPVY[NPVs]": F.ALLPVY(pvs), # y-coordinates of all PVs + "ALLPVZ[NPVs]": F.ALLPVZ(pvs), # z-coordinates of all PVs + }) + event_info += FC.RecSummary() # Reconstruction summary, nLongTracks, nDownstreamTracks + event_info += FC.LHCInfo() # LHC running conditions, FillNumber, LHC energy + event_info += SelectionInfo(selection_type='Hlt1', trigger_lines=Hlt1_decisions) + event_info += SelectionInfo(selection_type='Hlt2', trigger_lines=[line]) + + simulation = options.simulation + + if simulation: + MCTRUTH = MCTruthAndBkgCat(input_particles=input_data, name="MCTruthAndBkgCat_{hash}") + variables_mc = variables_MC(MCTRUTH) + variables_all += variables_mc + + variables = { "Lb": variables_all+variables_extra+composite_variables, + "Jpsi" : variables_all+variables_extra+composite_variables, + "Lb_1520": variables_all+variables_extra+composite_variables, + "Pp" : variables_all+variables_extra_children+charged_extra, + "Km" : variables_all+variables_extra_children+charged_extra, + "ep": variables_all+variables_extra_children+charged_variables+charged_extra, + "em": variables_all+variables_extra_children+charged_variables+charged_extra} + + if simulation: + variables["Lb"].update({"BKGCAT":MCTRUTH.BkgCat}) + + for particl in variables: + variables[particl] += make_DTF_vars(input_data,["J/psi(1S)"],name='DTF_JpsiConstr') + variables[particl] += make_DTF_vars(input_data,["Lambda_b0"],name='DTF_LbConstr') + variables[particl] += make_DTF_vars(input_data,["J/psi(1S)"],name='DTFPV_JpsiConstr', pvs=pvs) + variables[particl] += make_DTF_vars(input_data,["Lambda_b0"],name='DTFPV_LbConstr', pvs=pvs) + variables[particl] += make_DTF_vars(input_data,[],name='DTFPV', pvs=pvs) + variables[particl] += make_DTF_vars(input_data,["psi(2S)"],name='DTF_psi2SConstr',substitutions=['Lambda_b0 -> J/psi(1S){{psi(2S)}} Lambda(1520)0']) + variables[particl] += make_DTF_vars(input_data,["psi(2S)"],name='DTFPV_psi2SConstr',pvs=pvs,substitutions=['Lambda_b0 -> J/psi(1S){{psi(2S)}} Lambda(1520)0']) + variables[particl] += make_DTF_vars(input_data,["J/psi(1S)"],name='DTFPV_JpsiConstr_KToPi',substitutions=['Lambda_b0 -> J/psi(1S) (Lambda(1520)0-> p+ K-{{pi-}})'], pvs=pvs,extravars=False) + variables[particl] += make_DTF_vars(input_data,[],name='DTFPV_KToPi',substitutions=['Lambda_b0 -> J/psi(1S) (Lambda(1520)0-> p+ K-{{pi-}})'], pvs=pvs,extravars=False) + variables[particl] += make_DTF_vars(input_data,["J/psi(1S)"],name='DTF_JpsiConstr_KToPi',substitutions=['Lambda_b0 -> J/psi(1S) (Lambda(1520)0-> p+ K-{{pi-}})']) #*** + variables[particl] += make_DTF_vars(input_data,["psi(2S)"],name='DTF_psi2SConstr_KToPi',substitutions=['Lambda_b0 -> J/psi(1S){{psi(2S)}} (Lambda(1520)0-> p+ K-{{pi-}})']) #*** + variables[particl] += make_DTF_vars(input_data,["psi(2S)"],name='DTFPV_psi2SConstr_KToPi',substitutions=['Lambda_b0 -> J/psi(1S){{psi(2S)}} (Lambda(1520)0-> p+ K-{{pi-}})'], pvs=pvs,extravars=False) #*** + + tuple_lb2pK = Funtuple( + name='LbToPpKmEE', + tuple_name='DecayTree', + fields=fields, + variables=variables, + event_variables=event_info, + inputs=input_data + ) + + filter_lb2pK = create_lines_filter(name=f"HLT_PASS('{line}')",lines=[line]) + + algs = {"tuple_lb2pK": [filter_lb2pK, tuple_lb2pK] + } + + return make_config(options, algs) diff --git a/b2xll_MC24_W31_34/electrons/dv_LbToPpPimEE.py b/b2xll_MC24_W31_34/electrons/dv_LbToPpPimEE.py new file mode 100644 index 0000000000..1e810a5ab8 --- /dev/null +++ b/b2xll_MC24_W31_34/electrons/dv_LbToPpPimEE.py @@ -0,0 +1,487 @@ +from GaudiKernel.SystemOfUnits import GeV +from PyConf.reading import get_particles, get_pvs, get_mc_particles +from PyConf.Algorithms import ThOrParticleSelection +from IsolationTools import VertexAndConeIsolation +from Hlt2Conf.algorithms_thor import ParticleCombiner +import Functors as F +from FunTuple import FunctorCollection +from FunTuple import FunTuple_Particles as Funtuple +from FunTuple import FunTuple_MCParticles as FuntupleMC +import FunTuple.functorcollections as FC +from DaVinci.algorithms import create_lines_filter +from DaVinci import Options, make_config +from DaVinciMCTools import MCTruthAndBkgCat +from DecayTreeFitter import DecayTreeFitter +from DaVinciTools import SubstitutePID +from FunTuple.functorcollections import Kinematics, MCKinematics, MCVertexInfo, MCHierarchy, EventInfo, SelectionInfo + +from PyConf.application import metainfo_repos +metainfo_repos.global_bind(extra_central_tags=['commissioning']) + + +def variables_MC(mctruth): + # Returns the variables for the Monte Carlo simulation + # mctruth = MCTruthAndBkgCat(input_particles=particles, name='MCTruthAndBkgCat_{hash}') from DaVinciMCTools + + mcvars = FC.MCKinematics(mctruth_alg=mctruth) + mcvars += FC.MCHierarchy(mctruth_alg=mctruth) + mcvars += FC.MCPromptDecay(mctruth_alg=mctruth) + mcvars += FC.MCVertexInfo(mctruth_alg=mctruth) + + return mcvars + +def make_DTF_vars(particles,constraints,name='DTF', pvs=None, substitutions=None, dtfname='DTF_{hash}',extravars=True): + + if pvs is None: + DTF = DecayTreeFitter( + name=dtfname, + input_particles=particles, + mass_constraints=constraints, + substitutions=substitutions + ) + else: + DTF = DecayTreeFitter( + name=dtfname, + input_particles=particles, + input_pvs=pvs, + mass_constraints=constraints, + substitutions=substitutions + ) + + vars = FunctorCollection({ + f'{name}_MASS': DTF(F.MASS), + }) + + if extravars: + vars+=FunctorCollection({ + f'{name}_P': DTF(F.P), + f'{name}_PX': DTF(F.PX), + f'{name}_PY': DTF(F.PY), + f'{name}_PZ': DTF(F.PZ), + f'{name}_PT': DTF(F.PT), + f'{name}_ENERGY': DTF(F.ENERGY), + f'{name}_CHI2DOF': DTF(F.CHI2DOF) + }) + + return vars + +def main(options: Options): + + ####################################### + # Lb -> p pi- e+ e- # + ####################################### + + fields = { + "Lb" : "[Lambda_b0 -> (J/psi(1S) -> e+ e- ) p+ pi-]CC", + "Jpsi": "[Lambda_b0 -> ^(J/psi(1S) -> e+ e-) p+ pi-]CC", + "Pp" : "[Lambda_b0 -> (J/psi(1S) -> e+ e-) ^p+ pi-]CC", + "Pim" : "[Lambda_b0 -> (J/psi(1S) -> e+ e-) p+ ^pi-]CC", + "ep" : "[Lambda_b0 -> (J/psi(1S) ->^e+ e-) p+ pi-]CC", + "em" : "[Lambda_b0 -> (J/psi(1S) -> e+ ^e-) p+ pi-]CC" + } + + FILTER_TREE = lambda id: F.FILTER(F.IS_ABS_ID(id)) @ F.GET_ALL_DESCENDANTS() + + line = "Hlt2RD_LbToPpPimEE" + long_track_iso = "LongTrackIsolation" + neutral_iso = "NeutralIsolation" + + input_data = get_particles(f"/Event/HLT2/{line}/Particles") + lb2ppimee_p_data = ThOrParticleSelection( + InputParticles=input_data, Functor=FILTER_TREE("p+") + ).OutputSelection + lb2ppimee_pim_data = ThOrParticleSelection( + InputParticles=input_data, Functor=FILTER_TREE("pi-") + ).OutputSelection + lb2ppimee_ep_data = ThOrParticleSelection( + InputParticles=input_data, Functor=FILTER_TREE("e+") + ).OutputSelection + lb2ppimee_em_data = ThOrParticleSelection( + InputParticles=input_data, Functor=FILTER_TREE("e-") + ).OutputSelection + + lb_cciso_data = get_particles( + f"/Event/HLT2/{line}/lb0_{long_track_iso}/Particles" + ) + p_cciso_data = get_particles( + f"/Event/HLT2/{line}/p+_{long_track_iso}/Particles" + ) + pi_cciso_data = get_particles( + f"/Event/HLT2/{line}/pi-_{long_track_iso}/Particles" + ) + ep_cciso_data = get_particles( + f"/Event/HLT2/{line}/e+_{long_track_iso}/Particles" + ) + em_cciso_data = get_particles( + f"/Event/HLT2/{line}/e-_{long_track_iso}/Particles" + ) + lb_nciso_data = get_particles( + f"/Event/HLT2/{line}/lb0_{neutral_iso}/Particles" + ) + p_nciso_data = get_particles( + f"/Event/HLT2/{line}/p+_{neutral_iso}/Particles" + ) + pi_nciso_data = get_particles( + f"/Event/HLT2/{line}/pi-_{neutral_iso}/Particles" + ) + ep_nciso_data = get_particles( + f"/Event/HLT2/{line}/e+_{neutral_iso}/Particles" + ) + em_nciso_data = get_particles( + f"/Event/HLT2/{line}/e-_{neutral_iso}/Particles" + ) + + pvs = get_pvs() + + lb_charge_iso = VertexAndConeIsolation( + name="LbIso05", + reference_particles=input_data, + related_particles=lb_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + lb_neutral_iso = VertexAndConeIsolation( + name="LbIso10", + reference_particles=input_data, + related_particles=lb_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + lb_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=lb_charge_iso, + neutral_cone_isolation_alg=lb_neutral_iso, + array_indx_name="Lb_cone_indx", + ) + + ep_charge_iso = VertexAndConeIsolation( + name="EpIso05", + reference_particles=lb2ppimee_ep_data, + related_particles=ep_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + ep_neutral_iso = VertexAndConeIsolation( + name="EpIso10", + reference_particles=lb2ppimee_ep_data, + related_particles=ep_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + ep_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=ep_charge_iso, + neutral_cone_isolation_alg=ep_neutral_iso, + array_indx_name="Ep_cone_indx", + ) + + em_charge_iso = VertexAndConeIsolation( + name="EmIso05", + reference_particles=lb2ppimee_em_data, + related_particles=em_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + em_neutral_iso = VertexAndConeIsolation( + name="EmIso10", + reference_particles=lb2ppimee_em_data, + related_particles=em_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + em_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=em_charge_iso, + neutral_cone_isolation_alg=em_neutral_iso, + array_indx_name="Em_cone_indx", + ) + + pi_charge_iso = VertexAndConeIsolation( + name="PimIso05", + reference_particles=lb2ppimee_pim_data, + related_particles=pi_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + pi_neutral_iso = VertexAndConeIsolation( + name="PimIso10", + reference_particles=lb2ppimee_pim_data, + related_particles=pi_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + + pi_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=pi_charge_iso, + neutral_cone_isolation_alg=pi_neutral_iso, + array_indx_name="Pim_cone_indx", + ) + + p_charge_iso = VertexAndConeIsolation( + name="PpIso05", + reference_particles=lb2ppimee_p_data, + related_particles=p_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + p_neutral_iso = VertexAndConeIsolation( + name="PpIso10", + reference_particles=lb2ppimee_p_data, + related_particles=p_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + + p_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=p_charge_iso, + neutral_cone_isolation_alg=p_neutral_iso, + array_indx_name="Pp_cone_indx", + ) + + lb_fixpv_iso = VertexAndConeIsolation( + name="LbIsoFixPV", + reference_particles=input_data, + related_particles=lb_cciso_data, + cut=(F.SHARE_BPV(pvs) | (F.MINIPCHI2CUT(pvs, 9.0) @ F.FORWARDARG1())), + ) + + lb_fix_pv_iso_variables = FC.ParticleIsolation( + isolation_alg=lb_fixpv_iso, array_indx_name="Lb_FixPV_indx" + ) + + lb_mass_constraint_iso = VertexAndConeIsolation( + name="LbIsoMassConstraint", + reference_particles=input_data, + related_particles=lb_nciso_data, + cut=(F.COMB_MASS() < 8 * GeV), + ) + + lb_mass_constraint_iso_variables = FC.ParticleIsolation( + isolation_alg=lb_mass_constraint_iso, array_indx_name="Lb_MassConstraint_indx" + ) + + lb_vtxiso_onetrack_data = ParticleCombiner( + [input_data, lb_cciso_data], + name="lb_One_extra_track_combination", + DecayDescriptor="[Xi_bc+ -> Lambda_b0 pi+]cc", + CombinationCut=F.ALL, + CompositeCut=F.ALL, + ) + + lb_vtxiso_twotracks_data = ParticleCombiner( + [input_data, lb_cciso_data, lb_cciso_data], + name="lb_Two_extra_tracks_combination", + DecayDescriptor="[Xi_bc0 -> Lambda_b0 pi+ pi-]cc", + CombinationCut=F.ALL, + CompositeCut=F.ALL, + ) + + lb_vtxiso_onetrack = VertexAndConeIsolation( + name="OneTrack", + reference_particles=input_data, + related_particles=lb_vtxiso_onetrack_data, + cut=(F.CHI2() @ F.FORWARDARG1() < 9.0), + ) + + lb_vtxiso_twotracks = VertexAndConeIsolation( + name="TwoTracks", + reference_particles=input_data, + related_particles=lb_vtxiso_twotracks_data, + cut=(F.CHI2() @ F.FORWARDARG1() < 15.0), + ) + + lb_vtxiso_onetrack_variables = FC.VertexIsolation(isolation_alg=lb_vtxiso_onetrack) + + lb_vtxiso_twotracks_variables = FC.VertexIsolation(isolation_alg=lb_vtxiso_twotracks) + + variables_all = FunctorCollection({ + "ID": F.PARTICLE_ID, # PDG ID of the particle + "Q": F.CHARGE, # Electric charge + "ETA": F.ETA, # Pseudorapidity + "PHI": F.PHI, # Azimuthal angle + "CHI2": F.CHI2, # χ² + "CHI2DOF": F.CHI2DOF, # χ² degrees of freedom + "OWNPVIP": F.OWNPVIP, # Impact parameter wrt own PV + "OWNPVIPCHI2": F.OWNPVIPCHI2, # Impact parameter χ² wrt own PV + + }) + + variables_all += FC.Kinematics() + + composite_variables = FunctorCollection({ + "END_VX": F.END_VX, # x-coordinate of decay vertex + "END_VY": F.END_VY, # y-coordinate of decay vertex + "END_VZ": F.END_VZ, # z-coordinate of decay vertex + # OWNPV values + "OWNPV_X": F.OWNPVX, # x-coordinate of best PV + "OWNPV_Y": F.OWNPVY, # y-coordinate of best PV + "OWNPV_Z": F.OWNPVZ, # z-coordinate of best PV + "OWNPV_NDOF": F.NDOF @ F.OWNPV, + "OWNPV_DIRA": F.OWNPVDIRA, # Direction angle cosine wrt own PV + "OWNPV_FD": F.OWNPVFD, # Flight distance wrt own PV + "OWNPV_FDCHI2": F.OWNPVFDCHI2, # Flight distance χ² wrt own PV + "OWNPV_VDRHO": F.OWNPVVDRHO, # Radial flight distance wrt own PV + "OWNPV_VDZ": F.OWNPVVDZ, # z-direction flight distance + "OWNPV_LTIME": F.OWNPVLTIME, # Proper lifetime + "OWNPV_DLS": F.OWNPVDLS, # Decay length significance + # DOCA + "DOCA12": F.DOCA(1, 2), # DOCA between first and second daughter + "DOCA12CHI2": F.DOCACHI2(1, 2), # DOCA χ² between first and second daughter + # Daughter Max, Min and Sums + "MAX_PT": F.MAX(F.PT), # Maximum PT of daughters + "MIN_PT": F.MIN(F.PT), # Minimum PT of daughters + "SUM_PT": F.SUM(F.PT), # Sum of daughters' PT + "MAX_P": F.MAX(F.P), # Maximum momentum of daughters + "MIN_P": F.MIN(F.P), # Minimum momentum of daughters + "SUM_P": F.SUM(F.P), # Sum of daughters' momentum + "MAX_OWNPVIPCHI2": F.MAX(F.OWNPVIPCHI2), # Max IP χ² of daughters + "MIN_OWNPVIPCHI2": F.MIN(F.OWNPVIPCHI2), # Min IP χ² of daughters + "SUM_OWNPVIPCHI2": F.SUM(F.OWNPVIPCHI2), # Sum of daughters' IP χ² + "MAXDOCACHI2": F.MAXDOCACHI2, # Maximum DOCA χ² between any daughters + "MAXDOCA": F.MAXDOCA, # Maximum DOCA between any daughters + "MAXSDOCACHI2": F.MAXSDOCACHI2, # Maximum signed DOCA χ² + "MAXSDOCA": F.MAXSDOCA, # Maximum signed DOCA + + }) + + variables_extra = FunctorCollection({ + 'BPVIPCHI2': F.BPVIPCHI2(pvs), + 'BPVIP': F.BPVIP(pvs), + 'BPVX': F.BPVX(pvs), + 'BPVY': F.BPVY(pvs), + 'BPVZ': F.BPVZ(pvs), + 'KEY': F.OBJECT_KEY, + 'ALLPV_FD' : F.ALLPV_FD(pvs), + 'ALLPV_IP' : F.ALLPV_IP(pvs), + "BPVFDCHI2": F.BPVFDCHI2(pvs), + "BPVFD": F.BPVFD(pvs), + 'BPVLTIME': F.BPVLTIME(pvs), + "BPVDIRA": F.BPVDIRA(pvs), + "BPVVDRHO": F.BPVVDRHO(pvs), + "BPVVDZ": F.BPVVDZ(pvs), + "MAX_BPVIPCHI2": F.MAX(F.BPVIPCHI2(pvs)), + "MIN_BPVIPCHI2": F.MIN(F.BPVIPCHI2(pvs)), + }) + + charged_variables = FC.ChargedCaloInfo(extra_info=True) + + variables_extra_children = FunctorCollection({ + 'BPVIPCHI2': F.BPVIPCHI2(pvs), + 'BPVIP': F.BPVIP(pvs), + 'BPVX': F.BPVX(pvs), + 'BPVY': F.BPVY(pvs), + 'BPVZ': F.BPVZ(pvs), + 'KEY': F.OBJECT_KEY, + "MINIPCHI2": F.MINIPCHI2(pvs) + }) + + charged_extra = FunctorCollection({ + 'CLUSTERMATCH': F.CLUSTERMATCH_CHI2, + 'NHITS': F.VALUE_OR(-1) @ F.NHITS @ F.TRACK, + 'NVPHITS': F.VALUE_OR(-1) @ F.NVPHITS @ F.TRACK, + 'NFTHITS': F.VALUE_OR(-1) @ F.NFTHITS @ F.TRACK, + 'NDOF': F.VALUE_OR(-1) @ F.NDOF @ F.TRACK, + 'QOVERP': F.QOVERP @ F.TRACK, + 'TRACKHASVELO': F.VALUE_OR(-1) @ F.TRACKHASVELO @ F.TRACK, + 'TRACKHASUT': F.VALUE_OR(-1) @ F.TRACKHASUT @ F.TRACK, + 'TRACK_P': F.TRACK_P @ F.TRACK, + 'TX': F.TX, + 'TY': F.TY, + 'RICH_DLL_BT': F.RICH_DLL_BT, + 'RICH_DLL_E': F.RICH_DLL_E, + 'RICH_DLL_K': F.RICH_DLL_K, + 'RICH_DLL_MU': F.RICH_DLL_MU, + 'RICH_DLL_P': F.RICH_DLL_P, + 'RICH_DLL_PI': F.RICH_DLL_PI, + "PPHASRICH" : F.PPHASRICH @ F.PROTOPARTICLE, + "RICH1_GAS_USED" : F.RICH1_GAS_USED, + "RICH2_GAS_USED" : F.RICH2_GAS_USED, + "RICH_SCALED_DLL_E" : F.RICH_SCALED_DLL_E, + "RICH_SCALED_DLL_MU" : F.RICH_SCALED_DLL_MU, + "RICH_THRESHOLD_DE" : F.RICH_THRESHOLD_DE, + "RICH_THRESHOLD_EL" : F.RICH_THRESHOLD_EL, + "RICH_THRESHOLD_KA" : F.RICH_THRESHOLD_KA, + "RICH_THRESHOLD_MU" : F.RICH_THRESHOLD_MU, + "RICH_THRESHOLD_PI" : F.RICH_THRESHOLD_PI, + "RICH_THRESHOLD_PR" : F.RICH_THRESHOLD_PR + }) + + charged_extra += FC.ParticleID(extra_info=True) + + Hlt1_decisions = [ + 'Hlt1DisplacedDielectron', + 'Hlt1DisplacedLeptons', + 'Hlt1SingleHighEt', + 'Hlt1SingleHighPtElectron', + 'Hlt1TrackElectronMVA', + 'Hlt1TrackMVA', + 'Hlt1TwoTrackMVA' + ] + + # MISSING HLT VARIABLES + variables_all += FC.HltTisTos( + selection_type="Hlt1", + trigger_lines=[f"{x}Decision" for x in Hlt1_decisions], + data=input_data) + + event_info = EventInfo() + event_info += FunctorCollection({ + "NPV": F.SIZE(pvs), # Number of primary vertices + "ALLPVX[NPVs]": F.ALLPVX(pvs), # x-coordinates of all PVs + "ALLPVY[NPVs]": F.ALLPVY(pvs), # y-coordinates of all PVs + "ALLPVZ[NPVs]": F.ALLPVZ(pvs), # z-coordinates of all PVs + }) + event_info += FC.RecSummary() # Reconstruction summary, nLongTracks, nDownstreamTracks + event_info += FC.LHCInfo() # LHC running conditions, FillNumber, LHC energy + event_info += SelectionInfo(selection_type='Hlt1', trigger_lines=Hlt1_decisions) + event_info += SelectionInfo(selection_type='Hlt2', trigger_lines=[line]) + + simulation = options.simulation + + if simulation: + MCTRUTH = MCTruthAndBkgCat(input_particles=input_data, name="MCTruthAndBkgCat_{hash}") + variables_mc = variables_MC(MCTRUTH) + variables_all += variables_mc + + variables = { "Lb": variables_all+variables_extra + + composite_variables + + lb_cone_iso_variables + + lb_fix_pv_iso_variables + + lb_mass_constraint_iso_variables + + lb_vtxiso_onetrack_variables + + lb_vtxiso_twotracks_variables, + "Jpsi" : variables_all+variables_extra+composite_variables, + "Pp" : variables_all+variables_extra_children+charged_extra+p_cone_iso_variables, + "Pim" : variables_all+variables_extra_children+charged_extra+pi_cone_iso_variables, + "ep": variables_all+variables_extra_children+charged_variables+charged_extra+ep_cone_iso_variables, + "em": variables_all+variables_extra_children+charged_variables+charged_extra+em_cone_iso_variables} + + if simulation: + variables["Lb"].update({"BKGCAT":MCTRUTH.BkgCat}) + + for particl in variables: + variables[particl] += make_DTF_vars(input_data,["J/psi(1S)"],name='DTF_JpsiConstr') + variables[particl] += make_DTF_vars(input_data,["Lambda_b0"],name='DTF_LbConstr') + variables[particl] += make_DTF_vars(input_data,["J/psi(1S)"],name='DTFPV_JpsiConstr', pvs=pvs) + variables[particl] += make_DTF_vars(input_data,["Lambda_b0"],name='DTFPV_LbConstr', pvs=pvs) + variables[particl] += make_DTF_vars(input_data,[],name='DTFPV', pvs=pvs) + variables[particl] += make_DTF_vars(input_data,["psi(2S)"],name='DTF_psi2SConstr',substitutions=['Lambda_b0 -> J/psi(1S){{psi(2S)}} p+ pi-']) + variables[particl] += make_DTF_vars(input_data,["psi(2S)"],name='DTFPV_psi2SConstr',pvs=pvs,substitutions=['Lambda_b0 -> J/psi(1S){{psi(2S)}} p+ pi-']) + variables[particl] += make_DTF_vars(input_data,["J/psi(1S)"],name='DTFPV_JpsiConstr_PiToK',substitutions=['Lambda_b0 -> J/psi(1S) p+ pi-{{K-}}'], pvs=pvs,extravars=False) + variables[particl] += make_DTF_vars(input_data,[],name='DTFPV_PiToK',substitutions=['Lambda_b0 -> J/psi(1S) p+ pi-{{K-}}'], pvs=pvs,extravars=False) + variables[particl] += make_DTF_vars(input_data,["J/psi(1S)"],name='DTF_JpsiConstr_PiToK',substitutions=['Lambda_b0 -> J/psi(1S) p+ pi-{{K-}}']) #*** + variables[particl] += make_DTF_vars(input_data,["psi(2S)"],name='DTF_psi2SConstr_PiToK',substitutions=['Lambda_b0 -> J/psi(1S){{psi(2S)}} p+ pi-{{K-}}']) #*** + variables[particl] += make_DTF_vars(input_data,["psi(2S)"],name='DTFPV_psi2SConstr_PiToK',substitutions=['Lambda_b0 -> J/psi(1S){{psi(2S)}} p+ pi-{{K-}}'], pvs=pvs,extravars=False) #*** + + tuple_lb2ppi = Funtuple( + name='LbToPpPimEE', + tuple_name='DecayTree', + fields=fields, + variables=variables, + event_variables=event_info, + inputs=input_data + ) + + filter_lb2ppi = create_lines_filter(name=f"HLT_PASS('{line}')",lines=[line]) + + algs = {"tuple_lb2ppi": [filter_lb2ppi, tuple_lb2ppi] + } + + return make_config(options, algs) diff --git a/b2xll_MC24_W31_34/info.yaml b/b2xll_MC24_W31_34/info.yaml new file mode 100644 index 0000000000..4fb1050f33 --- /dev/null +++ b/b2xll_MC24_W31_34/info.yaml @@ -0,0 +1,27 @@ +defaults: + inform: + - ernest.olivart.pino@cern.ch + wg: RD + +MagUp_BuToKpEE_bu2kee_2024.W31.34_Nu6.3_Tuple: + application: "DaVinci/v64r13" + input: + bk_query: "/MC/2024/12123001/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/HLT2.DST" + dq_flags: + - UNCHECKED + - OK + n_test_lfns: 4 + output: MC24_BuToKpEE_bu2kee.ROOT + options: + entrypoint: mc_samples.electrons.dv_BuToKpEE:main + extra_options: + input_raw_format: 0.5 + input_type: ROOT + output_type: ROOT + simulation: True + data_type: "Upgrade" + conditions_version: master + dddb_tag: dddb-20240427 + conddb_tag: sim10-2024.Q3.4-v1.3-mu100 + input_process: "Hlt2" + input_stream: "rd" \ No newline at end of file diff --git a/b2xll_MC24_W31_34/muons/dv_BuToKpMuMu.py b/b2xll_MC24_W31_34/muons/dv_BuToKpMuMu.py new file mode 100644 index 0000000000..3f309ce065 --- /dev/null +++ b/b2xll_MC24_W31_34/muons/dv_BuToKpMuMu.py @@ -0,0 +1,402 @@ +from GaudiKernel.SystemOfUnits import GeV, MeV +from PyConf.reading import get_particles, get_pvs, get_mc_particles +from PyConf.Algorithms import ThOrParticleSelection +from IsolationTools import VertexAndConeIsolation +from Hlt2Conf.algorithms_thor import ParticleCombiner, ParticleFilter +import Functors as F +from FunTuple import FunctorCollection +from FunTuple import FunTuple_Particles as Funtuple +from FunTuple import FunTuple_MCParticles as FuntupleMC +import FunTuple.functorcollections as FC +from DaVinci.algorithms import create_lines_filter#, add_filter +from DaVinci import Options, make_config +from DaVinciMCTools import MCTruthAndBkgCat +from DecayTreeFitter import DecayTreeFitter +from DaVinciTools import SubstitutePID +from FunTuple.functorcollections import Kinematics, MCKinematics, MCVertexInfo, MCHierarchy, EventInfo, SelectionInfo + +from .line_configs import line_configs_dict + +from PyConf.application import metainfo_repos +metainfo_repos.global_bind(extra_central_tags=['commissioning']) + + +def variables_MC(mctruth): + # Returns the variables for the Monte Carlo simulation + # mctruth = MCTruthAndBkgCat(input_particles=particles, name='MCTruthAndBkgCat_{hash}') from DaVinciMCTools + + mcvars = FC.MCKinematics(mctruth_alg=mctruth) + mcvars += FC.MCHierarchy(mctruth_alg=mctruth) + mcvars += FC.MCPromptDecay(mctruth_alg=mctruth) + mcvars += FC.MCVertexInfo(mctruth_alg=mctruth) + + return mcvars + +def make_DTF_vars(particles,constraints,name='DTF', pvs=None, substitutions=None, dtfname='DTF_{hash}',extravars=True): + + if pvs is None: + DTF = DecayTreeFitter( + name=dtfname, + input_particles=particles, + mass_constraints=constraints, + substitutions=substitutions + ) + else: + DTF = DecayTreeFitter( + name=dtfname, + input_particles=particles, + input_pvs=pvs, + mass_constraints=constraints, + substitutions=substitutions + ) + + vars = FunctorCollection({ + f'{name}_MASS': DTF(F.MASS), + }) + + if extravars: + vars+=FunctorCollection({ + f'{name}_P': DTF(F.P), + f'{name}_PX': DTF(F.PX), + f'{name}_PY': DTF(F.PY), + f'{name}_PZ': DTF(F.PZ), + f'{name}_PT': DTF(F.PT), + f'{name}_ENERGY': DTF(F.ENERGY), + f'{name}_CHI2DOF': DTF(F.CHI2DOF) + }) + + return vars + +def main(options: Options): + + ####################################### + # B+ -> K+ mu+ mu- # + ####################################### + + pvs = get_pvs() + + FILTER_TREE = lambda id: F.FILTER(F.IS_ABS_ID(id)) @ F.GET_ALL_DESCENDANTS() + + line_b2K = 'Hlt2RD_BuToHpMuMu_Incl' + long_track_iso = "LongTrackIsolation" + neutral_iso = "NeutralIsolation" + + hlt2_line_b2K = "BuToHpMuMu_Incl" + config = line_configs_dict[ hlt2_line_b2K ] + fields_b2K = { field : dict.get('Descriptor') for field , dict in config.get('fields').items() } + if 'Hlt2RD_BuToHpMuMu_Incl' in line_b2K: + input_data_b2K_raw = get_particles(f"/Event/HLT2/{line_b2K}/Particles") + + if config.get( 'SubstitutePID' ) is not None: + input_data_b2K_raw = SubstitutePID( + "SubstitutePID" , + input_data_b2K_raw , + substitutions = [ config.get( 'SubstitutePID' ) ], + ).Particles + + CHILD_HAD = lambda func: F.CHILD(2, func) + + input_data_b2K = ParticleFilter(Input=input_data_b2K_raw, + Cut=F.FILTER(F.require_all(CHILD_HAD( F.MINIPCHI2(pvs) >9. ), CHILD_HAD( F.PID_K>-5. )))) + + b_cciso_data = get_particles( + f"/Event/HLT2/{line_b2K}/B_{long_track_iso}/Particles" + ) + b_nciso_data = get_particles( + f"/Event/HLT2/{line_b2K}/B_{neutral_iso}/Particles" + ) + + b_charge_iso = VertexAndConeIsolation( + name="BIso05", + reference_particles=input_data_b2K, + related_particles=b_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + b_neutral_iso = VertexAndConeIsolation( + name="BIso10", + reference_particles=input_data_b2K, + related_particles=b_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + b_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=b_charge_iso, + neutral_cone_isolation_alg=b_neutral_iso, + array_indx_name="Bu_cone_indx", + ) + + b_fixpv_iso = VertexAndConeIsolation( + name="BIsoFixPV", + reference_particles=input_data_b2K, + related_particles=b_cciso_data, + cut=(F.SHARE_BPV(pvs) | (F.MINIPCHI2CUT(pvs, 9.0) @ F.FORWARDARG1())), + ) + + b_fix_pv_iso_variables = FC.ParticleIsolation( + isolation_alg=b_fixpv_iso, array_indx_name="Bu_FixPV_indx" + ) + + b_mass_constraint_iso = VertexAndConeIsolation( + name="BIsoMassConstraint", + reference_particles=input_data_b2K, + related_particles=b_nciso_data, + cut=(F.COMB_MASS() < 8 * GeV), + ) + + b_mass_constraint_iso_variables = FC.ParticleIsolation( + isolation_alg=b_mass_constraint_iso, array_indx_name="Bu_MassConstraint_indx" + ) + + b_vtxiso_onetrack_data = ParticleCombiner( + [input_data_b2K, b_cciso_data], + name="B2K_One_extra_track_combination", + DecayDescriptor="[B*0 -> B+ pi-]cc", + CombinationCut=F.ALL, + CompositeCut=F.ALL, + ) + + b_vtxiso_twotracks_data = ParticleCombiner( + [input_data_b2K, b_cciso_data, b_cciso_data], + name="B2K_Two_extra_tracks_combination", + DecayDescriptor="[B*+ -> B+ pi- pi+]cc", + CombinationCut=F.ALL, + CompositeCut=F.ALL, + ) + + b_vtxiso_onetrack = VertexAndConeIsolation( + name="OneTrack", + reference_particles=input_data_b2K, + related_particles=b_vtxiso_onetrack_data, + cut=(F.CHI2() @ F.FORWARDARG1() < 9.0), + ) + + b_vtxiso_twotracks = VertexAndConeIsolation( + name="TwoTracks", + reference_particles=input_data_b2K, + related_particles=b_vtxiso_twotracks_data, + cut=(F.CHI2() @ F.FORWARDARG1() < 15.0), + ) + + b_vtxiso_onetrack_variables = FC.VertexIsolation(isolation_alg=b_vtxiso_onetrack) + + b_vtxiso_twotracks_variables = FC.VertexIsolation(isolation_alg=b_vtxiso_twotracks) + + variables_all = FunctorCollection({ + "ID": F.PARTICLE_ID, # PDG ID of the particle + "Q": F.CHARGE, # Electric charge + "ETA": F.ETA, # Pseudorapidity + "PHI": F.PHI, # Azimuthal angle + "CHI2": F.CHI2, # χ² + "CHI2DOF": F.CHI2DOF, # χ² degrees of freedom + "OWNPVIP": F.OWNPVIP, # Impact parameter wrt own PV + "OWNPVIPCHI2": F.OWNPVIPCHI2, # Impact parameter χ² wrt own PV + + }) + + variables_all += FC.Kinematics() + + composite_variables = FunctorCollection({ + #"VTXCHI2NDOF": F.CHI2DOF, # Vertex fit χ²/ndf + "END_VX": F.END_VX, # x-coordinate of decay vertex + "END_VY": F.END_VY, # y-coordinate of decay vertex + "END_VZ": F.END_VZ, # z-coordinate of decay vertex + #"ENDVERTEX": F.ENDVERTEX, # wtf does this do? + # OWNPV values + "OWNPV_X": F.OWNPVX, # x-coordinate of best PV + "OWNPV_Y": F.OWNPVY, # y-coordinate of best PV + "OWNPV_Z": F.OWNPVZ, # z-coordinate of best PV + "OWNPV_NDOF": F.NDOF @ F.OWNPV, + "OWNPV_DIRA": F.OWNPVDIRA, # Direction angle cosine wrt own PV + "OWNPV_FD": F.OWNPVFD, # Flight distance wrt own PV + "OWNPV_FDCHI2": F.OWNPVFDCHI2, # Flight distance χ² wrt own PV + "OWNPV_VDRHO": F.OWNPVVDRHO, # Radial flight distance wrt own PV + "OWNPV_VDZ": F.OWNPVVDZ, # z-direction flight distance + "OWNPV_LTIME": F.OWNPVLTIME, # Proper lifetime + "OWNPV_DLS": F.OWNPVDLS, # Decay length significance + # DOCA + "DOCA12": F.DOCA(1, 2), # DOCA between first and second daughter + "DOCA12CHI2": F.DOCACHI2(1, 2), # DOCA χ² between first and second daughter + # Daughter Max, Min and Sums + "MAX_PT": F.MAX(F.PT), # Maximum PT of daughters + "MIN_PT": F.MIN(F.PT), # Minimum PT of daughters + "SUM_PT": F.SUM(F.PT), # Sum of daughters' PT + "MAX_P": F.MAX(F.P), # Maximum momentum of daughters + "MIN_P": F.MIN(F.P), # Minimum momentum of daughters + "SUM_P": F.SUM(F.P), # Sum of daughters' momentum + "MAX_OWNPVIPCHI2": F.MAX(F.OWNPVIPCHI2), # Max IP χ² of daughters + "MIN_OWNPVIPCHI2": F.MIN(F.OWNPVIPCHI2), # Min IP χ² of daughters + "SUM_OWNPVIPCHI2": F.SUM(F.OWNPVIPCHI2), # Sum of daughters' IP χ² + "MAXDOCACHI2": F.MAXDOCACHI2, # Maximum DOCA χ² between any daughters + "MAXDOCA": F.MAXDOCA, # Maximum DOCA between any daughters + "MAXSDOCACHI2": F.MAXSDOCACHI2, # Maximum signed DOCA χ² + "MAXSDOCA": F.MAXSDOCA, # Maximum signed DOCA + + }) + + variables_extra = FunctorCollection({ + 'BPVIPCHI2': F.BPVIPCHI2(pvs), + 'BPVIP': F.BPVIP(pvs), + 'BPVX': F.BPVX(pvs), + 'BPVY': F.BPVY(pvs), + 'BPVZ': F.BPVZ(pvs), + 'KEY': F.OBJECT_KEY, + 'ALLPV_FD' : F.ALLPV_FD(pvs), + 'ALLPV_IP' : F.ALLPV_IP(pvs), + "BPVFDCHI2": F.BPVFDCHI2(pvs), + "BPVFD": F.BPVFD(pvs), + 'BPVLTIME': F.BPVLTIME(pvs), + "BPVDIRA": F.BPVDIRA(pvs), + "BPVVDRHO": F.BPVVDRHO(pvs), + "BPVVDZ": F.BPVVDZ(pvs), + "MAX_BPVIPCHI2": F.MAX(F.BPVIPCHI2(pvs)), + "MIN_BPVIPCHI2": F.MIN(F.BPVIPCHI2(pvs)), + }) + + charged_variables = FC.ChargedCaloInfo(extra_info=True) + + variables_extra_children = FunctorCollection({ + 'BPVIPCHI2': F.BPVIPCHI2(pvs), + 'BPVIP': F.BPVIP(pvs), + 'BPVX': F.BPVX(pvs), + 'BPVY': F.BPVY(pvs), + 'BPVZ': F.BPVZ(pvs), + 'KEY': F.OBJECT_KEY, + "MINIPCHI2": F.MINIPCHI2(pvs) + }) + + charged_extra = FunctorCollection({ + 'CLUSTERMATCH': F.CLUSTERMATCH_CHI2, + 'NHITS': F.VALUE_OR(-1) @ F.NHITS @ F.TRACK, + 'NVPHITS': F.VALUE_OR(-1) @ F.NVPHITS @ F.TRACK, + 'NFTHITS': F.VALUE_OR(-1) @ F.NFTHITS @ F.TRACK, + 'NDOF': F.VALUE_OR(-1) @ F.NDOF @ F.TRACK, + 'QOVERP': F.QOVERP @ F.TRACK, + 'TRACKHASVELO': F.VALUE_OR(-1) @ F.TRACKHASVELO @ F.TRACK, + 'TRACKHASUT': F.VALUE_OR(-1) @ F.TRACKHASUT @ F.TRACK, + 'TX': F.TX, + 'TY': F.TY, + 'RICH_DLL_BT': F.RICH_DLL_BT, + "RICH_DLL_D" : F.RICH_DLL_D, + 'RICH_DLL_E': F.RICH_DLL_E, + 'RICH_DLL_K': F.RICH_DLL_K, + 'RICH_DLL_MU': F.RICH_DLL_MU, + 'RICH_DLL_P': F.RICH_DLL_P, + 'RICH_DLL_PI': F.RICH_DLL_PI, + "PPHASRICH" : F.PPHASRICH @ F.PROTOPARTICLE, + "RICH1_GAS_USED" : F.RICH1_GAS_USED, + "RICH2_GAS_USED" : F.RICH2_GAS_USED, + "RICH_SCALED_DLL_E" : F.RICH_SCALED_DLL_E, + "RICH_SCALED_DLL_MU" : F.RICH_SCALED_DLL_MU, + "RICH_THRESHOLD_DE" : F.RICH_THRESHOLD_DE, + "RICH_THRESHOLD_EL" : F.RICH_THRESHOLD_EL, + "RICH_THRESHOLD_KA" : F.RICH_THRESHOLD_KA, + "RICH_THRESHOLD_MU" : F.RICH_THRESHOLD_MU, + "RICH_THRESHOLD_PI" : F.RICH_THRESHOLD_PI, + "RICH_THRESHOLD_PR" : F.RICH_THRESHOLD_PR + }) + + charged_extra += FC.ParticleID(extra_info=True) + + muon_extra = FunctorCollection({ + "PPHASMUONINFO": F.PPHASMUONINFO @ F.PROTOPARTICLE, + "INMUON" : F.INMUON, + "ISMUON" : F.ISMUON, + "ISMUONTIGHT" : F.ISMUONTIGHT, + }) + + Hlt1_decisions = [ + 'Hlt1LowPtMuon', + 'Hlt1SingleHighPtMuon', + 'Hlt1TrackMuonMVA', + 'Hlt1DiMuonLowMass', + 'Hlt1DiMuonHighMass', + 'Hlt1DiMuonDisplaced', + 'Hlt1DiMuonSoft' + 'Hlt1TrackMVA', + 'Hlt1TwoTrackMVA', + "Hlt1TrackMVADecision", + "Hlt1TwoTrackMVADecision", + "Hlt1DisplacedLeptonsDecision", + "Hlt1SingleHighEtDecision", + 'Hlt1DiMuonHighMassDecision', + 'Hlt1DiMuonLowMassDecision', + 'Hlt1DiMuonSoftDecision', + 'Hlt1LowPtMuonDecision', + 'Hlt1LowPtDiMuonDecision', + 'Hlt1SingleHighPtMuonDecision', + 'Hlt1TrackMuonMVADecision', + 'Hlt1OneMuonTrackLineDecision', + 'Hlt1DiMuonNoIPDecision', + 'Hlt1DiMuonNoIP_ssDecision' + ] + + # MISSING HLT VARIABLES + variables_all += FC.HltTisTos( + selection_type="Hlt1", + trigger_lines=[f"{x}Decision" for x in Hlt1_decisions], + data=input_data_b2K) + + event_info_b2K = EventInfo() + event_info_b2K += FunctorCollection({ + "NPV": F.SIZE(pvs), # Number of primary vertices + "ALLPVX[NPVs]": F.ALLPVX(pvs), # x-coordinates of all PVs + "ALLPVY[NPVs]": F.ALLPVY(pvs), # y-coordinates of all PVs + "ALLPVZ[NPVs]": F.ALLPVZ(pvs), # z-coordinates of all PVs + }) + event_info_b2K += FC.RecSummary() # Reconstruction summary, nLongTracks, nDownstreamTracks + event_info_b2K += FC.LHCInfo() # LHC running conditions, FillNumber, LHC energy + event_info_b2K += SelectionInfo(selection_type='Hlt1', trigger_lines=Hlt1_decisions) + event_info_b2K += SelectionInfo(selection_type='Hlt2', trigger_lines=[line_b2K]) + + simulation = options.simulation + + if simulation: + MCTRUTH = MCTruthAndBkgCat(input_particles=input_data_b2K, name="MCTruthAndBkgCat_{hash}") + variables_mc = variables_MC(MCTRUTH) + variables_all += variables_mc + + variables_b2K = { 'Bu' : variables_all+variables_extra + + composite_variables + + b_cone_iso_variables + + b_fix_pv_iso_variables + + b_mass_constraint_iso_variables + + b_vtxiso_onetrack_variables + + b_vtxiso_twotracks_variables, + 'Jpsi' : variables_all+variables_extra+composite_variables, + 'Kp' : variables_all+variables_extra_children+charged_extra, + 'Mup': variables_all+variables_extra_children+charged_variables+charged_extra+muon_extra, + 'Mum': variables_all+variables_extra_children+charged_variables+charged_extra+muon_extra} + + if simulation: + variables_b2K["Bu"].update({"BKGCAT":MCTRUTH.BkgCat}) + + for particl in variables_b2K: + variables_b2K[particl] += make_DTF_vars(input_data_b2K,["J/psi(1S)"],name='DTF_JpsiConstr') + variables_b2K[particl] += make_DTF_vars(input_data_b2K,["B+"],name='DTF_BConstr') + variables_b2K[particl] += make_DTF_vars(input_data_b2K,["J/psi(1S)"],name='DTFPV_JpsiConstr', pvs=pvs) + variables_b2K[particl] += make_DTF_vars(input_data_b2K,["B+"],name='DTFPV_BConstr', pvs=pvs) + variables_b2K[particl] += make_DTF_vars(input_data_b2K,[],name='DTFPV', pvs=pvs) + variables_b2K[particl] += make_DTF_vars(input_data_b2K,["psi(2S)"],name='DTF_psi2SConstr',substitutions=['B+ -> J/psi(1S){{psi(2S)}} K+']) + variables_b2K[particl] += make_DTF_vars(input_data_b2K,["psi(2S)"],name='DTFPV_psi2SConstr',pvs=pvs,substitutions=['B+ -> J/psi(1S){{psi(2S)}} K+']) + variables_b2K[particl] += make_DTF_vars(input_data_b2K,["J/psi(1S)"],name='DTFPV_JpsiConstr_KToPi',substitutions=['B+ -> J/psi(1S) K+{{pi+}}'], pvs=pvs,extravars=False) + variables_b2K[particl] += make_DTF_vars(input_data_b2K,[],name='DTFPV_KToPi',substitutions=['B+ -> J/psi(1S) K+{{pi+}}'], pvs=pvs,extravars=False) + variables_b2K[particl] += make_DTF_vars(input_data_b2K,["J/psi(1S)"],name='DTF_JpsiConstr_KToPi',substitutions=['B+ -> J/psi(1S) K+{{pi+}}']) #*** + variables_b2K[particl] += make_DTF_vars(input_data_b2K,["psi(2S)"],name='DTF_psi2SConstr_KToPi',substitutions=['B+ -> J/psi(1S){{psi(2S)}} K+{{pi+}}']) #*** + variables_b2K[particl] += make_DTF_vars(input_data_b2K,["psi(2S)"],name='DTFPV_psi2SConstr_KToPi',substitutions=['B+ -> J/psi(1S){{psi(2S)}} K+{{pi+}}'], pvs=pvs,extravars=False) #*** + + tuple_b2K = Funtuple( + name='BuToKpMuMu', + tuple_name='DecayTree', + fields=fields_b2K, + variables=variables_b2K, + event_variables=event_info_b2K, + inputs=input_data_b2K + ) + + filter_b2K = create_lines_filter(name=f"HLT_PASS('{line_b2K}')",lines=[line_b2K]) + + algs = {"tuple_b2K": [filter_b2K, tuple_b2K] + } + + return make_config(options, algs) diff --git a/b2xll_MC24_W31_34/muons/dv_BuToPipMuMu.py b/b2xll_MC24_W31_34/muons/dv_BuToPipMuMu.py new file mode 100644 index 0000000000..791b27b34a --- /dev/null +++ b/b2xll_MC24_W31_34/muons/dv_BuToPipMuMu.py @@ -0,0 +1,489 @@ +from GaudiKernel.SystemOfUnits import GeV, MeV +from PyConf.reading import get_particles, get_pvs, get_mc_particles +from PyConf.Algorithms import ThOrParticleSelection +from IsolationTools import VertexAndConeIsolation +from Hlt2Conf.algorithms_thor import ParticleCombiner, ParticleFilter +import Functors as F +from FunTuple import FunctorCollection +from FunTuple import FunTuple_Particles as Funtuple +from FunTuple import FunTuple_MCParticles as FuntupleMC +import FunTuple.functorcollections as FC +from DaVinci.algorithms import create_lines_filter#, add_filter +from DaVinci import Options, make_config +from DaVinciMCTools import MCTruthAndBkgCat +from DecayTreeFitter import DecayTreeFitter +from DaVinciTools import SubstitutePID +from FunTuple.functorcollections import Kinematics, MCKinematics, MCVertexInfo, MCHierarchy, EventInfo, SelectionInfo + +from .line_configs import line_configs_dict + +from PyConf.application import metainfo_repos +metainfo_repos.global_bind(extra_central_tags=['commissioning']) + + +def variables_MC(mctruth): + # Returns the variables for the Monte Carlo simulation + # mctruth = MCTruthAndBkgCat(input_particles=particles, name='MCTruthAndBkgCat_{hash}') from DaVinciMCTools + + mcvars = FC.MCKinematics(mctruth_alg=mctruth) + mcvars += FC.MCHierarchy(mctruth_alg=mctruth) + mcvars += FC.MCPromptDecay(mctruth_alg=mctruth) + mcvars += FC.MCVertexInfo(mctruth_alg=mctruth) + + return mcvars + +def make_DTF_vars(particles,constraints,name='DTF', pvs=None, substitutions=None, dtfname='DTF_{hash}',extravars=True): + + if pvs is None: + DTF = DecayTreeFitter( + name=dtfname, + input_particles=particles, + mass_constraints=constraints, + substitutions=substitutions + ) + else: + DTF = DecayTreeFitter( + name=dtfname, + input_particles=particles, + input_pvs=pvs, + mass_constraints=constraints, + substitutions=substitutions + ) + + vars = FunctorCollection({ + f'{name}_MASS': DTF(F.MASS), + }) + + if extravars: + vars+=FunctorCollection({ + f'{name}_P': DTF(F.P), + f'{name}_PX': DTF(F.PX), + f'{name}_PY': DTF(F.PY), + f'{name}_PZ': DTF(F.PZ), + f'{name}_PT': DTF(F.PT), + f'{name}_ENERGY': DTF(F.ENERGY), + f'{name}_CHI2DOF': DTF(F.CHI2DOF) + }) + + return vars + +def main(options: Options): + + ####################################### + # B+ -> pi+ mu+ mu- # + ####################################### + + pvs = get_pvs() + + fields_b2pi = { + 'Bu' : "[B+ -> J/psi(1S) pi+]CC", + 'Jpsi': "[B+ -> ^J/psi(1S) pi+]CC", + 'Pip' : "[B+ -> J/psi(1S) ^pi+]CC", + 'Mup' : "[B+ -> (J/psi(1S) -> ^mu+ mu-) pi+]CC", + 'Mum' : "[B+ -> (J/psi(1S) -> mu+ ^mu-) pi+]CC" + } + + FILTER_TREE = lambda id: F.FILTER(F.IS_ABS_ID(id)) @ F.GET_ALL_DESCENDANTS() + + line_b2pi = "Hlt2RD_BuToHpMuMu_Incl" + long_track_iso = "LongTrackIsolation" + neutral_iso = "NeutralIsolation" + + input_data_b2pi_raw = get_particles(f"/Event/HLT2/{line_b2pi}/Particles") + + CHILD_HAD = lambda func: F.CHILD(2, func) + + input_data_b2pi = ParticleFilter(Input=input_data_b2pi_raw, + Cut=F.FILTER(F.require_all(CHILD_HAD( F.MINIPCHI2(pvs) >9. ), CHILD_HAD( F.PID_K <5. )))) + + b2pimumu_pi_data = ThOrParticleSelection( + InputParticles=input_data_b2pi, Functor=FILTER_TREE("pi+") + ).OutputSelection + b2pimumu_mup_data = ThOrParticleSelection( + InputParticles=input_data_b2pi, Functor=FILTER_TREE("mu+") + ).OutputSelection + b2pimumu_mum_data = ThOrParticleSelection( + InputParticles=input_data_b2pi, Functor=FILTER_TREE("mu-") + ).OutputSelection + + b_cciso_data = get_particles( + f"/Event/HLT2/{line_b2pi}/B_{long_track_iso}/Particles" + ) + pi_cciso_data = get_particles( + f"/Event/HLT2/{line_b2pi}/pi+_{long_track_iso}/Particles" + ) + mup_cciso_data = get_particles( + f"/Event/HLT2/{line_b2pi}/mu+_{long_track_iso}/Particles" + ) + mum_cciso_data = get_particles( + f"/Event/HLT2/{line_b2pi}/mu-_{long_track_iso}/Particles" + ) + b_nciso_data = get_particles( + f"/Event/HLT2/{line_b2pi}/B_{neutral_iso}/Particles" + ) + pi_nciso_data = get_particles( + f"/Event/HLT2/{line_b2pi}/pi+_{neutral_iso}/Particles" + ) + mup_nciso_data = get_particles( + f"/Event/HLT2/{line_b2pi}/mu+_{neutral_iso}/Particles" + ) + mum_nciso_data = get_particles( + f"/Event/HLT2/{line_b2pi}/mu-_{neutral_iso}/Particles" + ) + + b_charge_iso = VertexAndConeIsolation( + name="BIso05", + reference_particles=input_data_b2pi, + related_particles=b_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + b_neutral_iso = VertexAndConeIsolation( + name="BIso10", + reference_particles=input_data_b2pi, + related_particles=b_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + b_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=b_charge_iso, + neutral_cone_isolation_alg=b_neutral_iso, + array_indx_name="Bu_cone_indx", + ) + + mup_charge_iso = VertexAndConeIsolation( + name="MupIso05", + reference_particles=b2pimumu_mup_data, + related_particles=mup_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + mup_neutral_iso = VertexAndConeIsolation( + name="MupIso10", + reference_particles=b2pimumu_mup_data, + related_particles=mup_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + mup_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=mup_charge_iso, + neutral_cone_isolation_alg=mup_neutral_iso, + array_indx_name="Mup_cone_indx", + ) + + mum_charge_iso = VertexAndConeIsolation( + name="MumIso05", + reference_particles=b2pimumu_mum_data, + related_particles=mum_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + mum_neutral_iso = VertexAndConeIsolation( + name="MumIso10", + reference_particles=b2pimumu_mum_data, + related_particles=mum_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + mum_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=mum_charge_iso, + neutral_cone_isolation_alg=mum_neutral_iso, + array_indx_name="Mum_cone_indx", + ) + + pi_charge_iso = VertexAndConeIsolation( + name="PipIso05", + reference_particles=b2pimumu_pi_data, + related_particles=pi_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + pi_neutral_iso = VertexAndConeIsolation( + name="PipIso10", + reference_particles=b2pimumu_pi_data, + related_particles=pi_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + + pi_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=pi_charge_iso, + neutral_cone_isolation_alg=pi_neutral_iso, + array_indx_name="Pip_cone_indx", + ) + + b_fixpv_iso = VertexAndConeIsolation( + name="BIsoFixPV", + reference_particles=input_data_b2pi, + related_particles=b_cciso_data, + cut=(F.SHARE_BPV(pvs) | (F.MINIPCHI2CUT(pvs, 9.0) @ F.FORWARDARG1())), + ) + + b_fix_pv_iso_variables = FC.ParticleIsolation( + isolation_alg=b_fixpv_iso, array_indx_name="Bu_FixPV_indx" + ) + + b_mass_constraint_iso = VertexAndConeIsolation( + name="BIsoMassConstraint", + reference_particles=input_data_b2pi, + related_particles=b_nciso_data, + cut=(F.COMB_MASS() < 8 * GeV), + ) + + b_mass_constraint_iso_variables = FC.ParticleIsolation( + isolation_alg=b_mass_constraint_iso, array_indx_name="Bu_MassConstraint_indx" + ) + + b_vtxiso_onetrack_data = ParticleCombiner( + [input_data_b2pi, b_cciso_data], + name="B2pi_One_extra_track_combination", + DecayDescriptor="[B*0 -> B+ pi-]cc", + CombinationCut=F.ALL, + CompositeCut=F.ALL, + ) + + b_vtxiso_twotracks_data = ParticleCombiner( + [input_data_b2pi, b_cciso_data, b_cciso_data], + name="B2pi_Two_extra_tracks_combination", + DecayDescriptor="[B*+ -> B+ pi- pi+]cc", + CombinationCut=F.ALL, + CompositeCut=F.ALL, + ) + + b_vtxiso_onetrack = VertexAndConeIsolation( + name="OneTrack", + reference_particles=input_data_b2pi, + related_particles=b_vtxiso_onetrack_data, + cut=(F.CHI2() @ F.FORWARDARG1() < 9.0), + ) + + b_vtxiso_twotracks = VertexAndConeIsolation( + name="TwoTracks", + reference_particles=input_data_b2pi, + related_particles=b_vtxiso_twotracks_data, + cut=(F.CHI2() @ F.FORWARDARG1() < 15.0), + ) + + b_vtxiso_onetrack_variables = FC.VertexIsolation(isolation_alg=b_vtxiso_onetrack) + + b_vtxiso_twotracks_variables = FC.VertexIsolation(isolation_alg=b_vtxiso_twotracks) + + variables_all = FunctorCollection({ + "ID": F.PARTICLE_ID, # PDG ID of the particle + "Q": F.CHARGE, # Electric charge + "ETA": F.ETA, # Pseudorapidity + "PHI": F.PHI, # Azimuthal angle + "CHI2": F.CHI2, # χ² + "CHI2DOF": F.CHI2DOF, # χ² degrees of freedom + "OWNPVIP": F.OWNPVIP, # Impact parameter wrt own PV + "OWNPVIPCHI2": F.OWNPVIPCHI2, # Impact parameter χ² wrt own PV + + }) + + variables_all += FC.Kinematics() + + composite_variables = FunctorCollection({ + #"VTXCHI2NDOF": F.CHI2DOF, # Vertex fit χ²/ndf + "END_VX": F.END_VX, # x-coordinate of decay vertex + "END_VY": F.END_VY, # y-coordinate of decay vertex + "END_VZ": F.END_VZ, # z-coordinate of decay vertex + #"ENDVERTEX": F.ENDVERTEX, # wtf does this do? + # OWNPV values + "OWNPV_X": F.OWNPVX, # x-coordinate of best PV + "OWNPV_Y": F.OWNPVY, # y-coordinate of best PV + "OWNPV_Z": F.OWNPVZ, # z-coordinate of best PV + "OWNPV_NDOF": F.NDOF @ F.OWNPV, + "OWNPV_DIRA": F.OWNPVDIRA, # Direction angle cosine wrt own PV + "OWNPV_FD": F.OWNPVFD, # Flight distance wrt own PV + "OWNPV_FDCHI2": F.OWNPVFDCHI2, # Flight distance χ² wrt own PV + "OWNPV_VDRHO": F.OWNPVVDRHO, # Radial flight distance wrt own PV + "OWNPV_VDZ": F.OWNPVVDZ, # z-direction flight distance + "OWNPV_LTIME": F.OWNPVLTIME, # Proper lifetime + "OWNPV_DLS": F.OWNPVDLS, # Decay length significance + # DOCA + "DOCA12": F.DOCA(1, 2), # DOCA between first and second daughter + "DOCA12CHI2": F.DOCACHI2(1, 2), # DOCA χ² between first and second daughter + # Daughter Max, Min and Sums + "MAX_PT": F.MAX(F.PT), # Maximum PT of daughters + "MIN_PT": F.MIN(F.PT), # Minimum PT of daughters + "SUM_PT": F.SUM(F.PT), # Sum of daughters' PT + "MAX_P": F.MAX(F.P), # Maximum momentum of daughters + "MIN_P": F.MIN(F.P), # Minimum momentum of daughters + "SUM_P": F.SUM(F.P), # Sum of daughters' momentum + "MAX_OWNPVIPCHI2": F.MAX(F.OWNPVIPCHI2), # Max IP χ² of daughters + "MIN_OWNPVIPCHI2": F.MIN(F.OWNPVIPCHI2), # Min IP χ² of daughters + "SUM_OWNPVIPCHI2": F.SUM(F.OWNPVIPCHI2), # Sum of daughters' IP χ² + "MAXDOCACHI2": F.MAXDOCACHI2, # Maximum DOCA χ² between any daughters + "MAXDOCA": F.MAXDOCA, # Maximum DOCA between any daughters + "MAXSDOCACHI2": F.MAXSDOCACHI2, # Maximum signed DOCA χ² + "MAXSDOCA": F.MAXSDOCA, # Maximum signed DOCA + + }) + + variables_extra = FunctorCollection({ + 'BPVIPCHI2': F.BPVIPCHI2(pvs), + 'BPVIP': F.BPVIP(pvs), + 'BPVX': F.BPVX(pvs), + 'BPVY': F.BPVY(pvs), + 'BPVZ': F.BPVZ(pvs), + 'KEY': F.OBJECT_KEY, + 'ALLPV_FD' : F.ALLPV_FD(pvs), + 'ALLPV_IP' : F.ALLPV_IP(pvs), + "BPVFDCHI2": F.BPVFDCHI2(pvs), + "BPVFD": F.BPVFD(pvs), + 'BPVLTIME': F.BPVLTIME(pvs), + "BPVDIRA": F.BPVDIRA(pvs), + "BPVVDRHO": F.BPVVDRHO(pvs), + "BPVVDZ": F.BPVVDZ(pvs), + "MAX_BPVIPCHI2": F.MAX(F.BPVIPCHI2(pvs)), + "MIN_BPVIPCHI2": F.MIN(F.BPVIPCHI2(pvs)), + }) + + charged_variables = FC.ChargedCaloInfo(extra_info=True) + + variables_extra_children = FunctorCollection({ + 'BPVIPCHI2': F.BPVIPCHI2(pvs), + 'BPVIP': F.BPVIP(pvs), + 'BPVX': F.BPVX(pvs), + 'BPVY': F.BPVY(pvs), + 'BPVZ': F.BPVZ(pvs), + 'KEY': F.OBJECT_KEY, + "MINIPCHI2": F.MINIPCHI2(pvs) + }) + + charged_extra = FunctorCollection({ + 'CLUSTERMATCH': F.CLUSTERMATCH_CHI2, + 'NHITS': F.VALUE_OR(-1) @ F.NHITS @ F.TRACK, + 'NVPHITS': F.VALUE_OR(-1) @ F.NVPHITS @ F.TRACK, + 'NFTHITS': F.VALUE_OR(-1) @ F.NFTHITS @ F.TRACK, + 'NDOF': F.VALUE_OR(-1) @ F.NDOF @ F.TRACK, + 'QOVERP': F.QOVERP @ F.TRACK, + 'TRACKHASVELO': F.VALUE_OR(-1) @ F.TRACKHASVELO @ F.TRACK, + 'TRACKHASUT': F.VALUE_OR(-1) @ F.TRACKHASUT @ F.TRACK, + 'TX': F.TX, + 'TY': F.TY, + 'RICH_DLL_BT': F.RICH_DLL_BT, + "RICH_DLL_D" : F.RICH_DLL_D, + 'RICH_DLL_E': F.RICH_DLL_E, + 'RICH_DLL_K': F.RICH_DLL_K, + 'RICH_DLL_MU': F.RICH_DLL_MU, + 'RICH_DLL_P': F.RICH_DLL_P, + 'RICH_DLL_PI': F.RICH_DLL_PI, + "PPHASRICH" : F.PPHASRICH @ F.PROTOPARTICLE, + "RICH1_GAS_USED" : F.RICH1_GAS_USED, + "RICH2_GAS_USED" : F.RICH2_GAS_USED, + "RICH_SCALED_DLL_E" : F.RICH_SCALED_DLL_E, + "RICH_SCALED_DLL_MU" : F.RICH_SCALED_DLL_MU, + "RICH_THRESHOLD_DE" : F.RICH_THRESHOLD_DE, + "RICH_THRESHOLD_EL" : F.RICH_THRESHOLD_EL, + "RICH_THRESHOLD_KA" : F.RICH_THRESHOLD_KA, + "RICH_THRESHOLD_MU" : F.RICH_THRESHOLD_MU, + "RICH_THRESHOLD_PI" : F.RICH_THRESHOLD_PI, + "RICH_THRESHOLD_PR" : F.RICH_THRESHOLD_PR + }) + + charged_extra += FC.ParticleID(extra_info=True) + + muon_extra = FunctorCollection({ + "PPHASMUONINFO": F.PPHASMUONINFO @ F.PROTOPARTICLE, + "INMUON" : F.INMUON, + "ISMUON" : F.ISMUON, + "ISMUONTIGHT" : F.ISMUONTIGHT, + }) + + Hlt1_decisions = [ + 'Hlt1LowPtMuon', + 'Hlt1SingleHighPtMuon', + 'Hlt1TrackMuonMVA', + 'Hlt1DiMuonLowMass', + 'Hlt1DiMuonHighMass', + 'Hlt1DiMuonDisplaced', + 'Hlt1DiMuonSoft' + 'Hlt1TrackMVA', + 'Hlt1TwoTrackMVA', + "Hlt1TrackMVADecision", + "Hlt1TwoTrackMVADecision", + "Hlt1DisplacedLeptonsDecision", + "Hlt1SingleHighEtDecision", + 'Hlt1DiMuonHighMassDecision', + 'Hlt1DiMuonLowMassDecision', + 'Hlt1DiMuonSoftDecision', + 'Hlt1LowPtMuonDecision', + 'Hlt1LowPtDiMuonDecision', + 'Hlt1SingleHighPtMuonDecision', + 'Hlt1TrackMuonMVADecision', + 'Hlt1OneMuonTrackLineDecision', + 'Hlt1DiMuonNoIPDecision', + 'Hlt1DiMuonNoIP_ssDecision' + ] + + # MISSING HLT VARIABLES + + variables_all += FC.HltTisTos( + selection_type="Hlt1", + trigger_lines=[f"{x}Decision" for x in Hlt1_decisions], + data=input_data_b2pi) + + event_info_b2pi = EventInfo() + event_info_b2pi += FunctorCollection({ + "NPV": F.SIZE(pvs), # Number of primary vertices + "ALLPVX[NPVs]": F.ALLPVX(pvs), # x-coordinates of all PVs + "ALLPVY[NPVs]": F.ALLPVY(pvs), # y-coordinates of all PVs + "ALLPVZ[NPVs]": F.ALLPVZ(pvs), # z-coordinates of all PVs + }) + event_info_b2pi += FC.RecSummary() # Reconstruction summary, nLongTracks, nDownstreamTracks + event_info_b2pi += FC.LHCInfo() # LHC running conditions, FillNumber, LHC energy + event_info_b2pi += SelectionInfo(selection_type='Hlt1', trigger_lines=Hlt1_decisions) + event_info_b2pi += SelectionInfo(selection_type='Hlt2', trigger_lines=[line_b2pi]) + + simulation = options.simulation + + if simulation: + MCTRUTH = MCTruthAndBkgCat(input_particles=input_data_b2pi, name="MCTruthAndBkgCat_{hash}") + variables_mc = variables_MC(MCTRUTH) + variables_all += variables_mc + + variables_b2pi = { 'Bu' : variables_all+variables_extra + + composite_variables + + b_cone_iso_variables + + b_fix_pv_iso_variables + + b_mass_constraint_iso_variables + + b_vtxiso_onetrack_variables + + b_vtxiso_twotracks_variables, + 'Jpsi' : variables_all+variables_extra+composite_variables, + 'Pip' : variables_all+variables_extra_children+charged_extra+pi_cone_iso_variables, + 'Mup': variables_all+variables_extra_children+charged_variables+charged_extra+mup_cone_iso_variables+muon_extra, + 'Mum': variables_all+variables_extra_children+charged_variables+charged_extra+mum_cone_iso_variables+muon_extra} + + if simulation: + variables_b2pi["Bu"].update({"BKGCAT":MCTRUTH.BkgCat}) + + for particl in variables_b2pi: + variables_b2pi[particl] += make_DTF_vars(input_data_b2pi,["J/psi(1S)"],name='DTF_JpsiConstr') + variables_b2pi[particl] += make_DTF_vars(input_data_b2pi,["B+"],name='DTF_BConstr') + variables_b2pi[particl] += make_DTF_vars(input_data_b2pi,["J/psi(1S)"],name='DTFPV_JpsiConstr', pvs=pvs) + variables_b2pi[particl] += make_DTF_vars(input_data_b2pi,["B+"],name='DTFPV_BConstr', pvs=pvs) + variables_b2pi[particl] += make_DTF_vars(input_data_b2pi,[],name='DTFPV', pvs=pvs) + variables_b2pi[particl] += make_DTF_vars(input_data_b2pi,["psi(2S)"],name='DTF_psi2SConstr',substitutions=['B+ -> J/psi(1S){{psi(2S)}} pi+']) + variables_b2pi[particl] += make_DTF_vars(input_data_b2pi,["psi(2S)"],name='DTFPV_psi2SConstr',pvs=pvs,substitutions=['B+ -> J/psi(1S){{psi(2S)}} pi+']) + variables_b2pi[particl] += make_DTF_vars(input_data_b2pi,["J/psi(1S)"],name='DTFPV_JpsiConstr_PiToK',substitutions=['B+ -> J/psi(1S) pi+{{K+}}'], pvs=pvs,extravars=False) + variables_b2pi[particl] += make_DTF_vars(input_data_b2pi,[],name='DTFPV_PiToK',substitutions=['B+ -> J/psi(1S) pi+{{K+}}'], pvs=pvs,extravars=False) + variables_b2pi[particl] += make_DTF_vars(input_data_b2pi,["J/psi(1S)"],name='DTF_JpsiConstr_PiToK',substitutions=['B+ -> J/psi(1S) pi+{{K+}}']) #*** + variables_b2pi[particl] += make_DTF_vars(input_data_b2pi,["psi(2S)"],name='DTF_psi2SConstr_PiToK',substitutions=['B+ -> J/psi(1S){{psi(2S)}} pi+{{K+}}']) #*** + variables_b2pi[particl] += make_DTF_vars(input_data_b2pi,["psi(2S)"],name='DTFPV_psi2SConstr_PiToK',substitutions=['B+ -> J/psi(1S){{psi(2S)}} pi+{{K+}}'], pvs=pvs,extravars=False) #*** + + tuple_b2pi = Funtuple( + name='BuToPipMuMu', + tuple_name='DecayTree', + fields=fields_b2pi, + variables=variables_b2pi, + event_variables=event_info_b2pi, + inputs=input_data_b2pi + ) + + filter_b2pi = create_lines_filter(name=f"HLT_PASS('{line_b2pi}')",lines=[line_b2pi]) + + algs = {"tuple_b2pi": [filter_b2pi, tuple_b2pi] + } + + return make_config(options, algs) diff --git a/b2xll_MC24_W31_34/muons/dv_LbToPpKmMuMu.py b/b2xll_MC24_W31_34/muons/dv_LbToPpKmMuMu.py new file mode 100644 index 0000000000..30805d6445 --- /dev/null +++ b/b2xll_MC24_W31_34/muons/dv_LbToPpKmMuMu.py @@ -0,0 +1,309 @@ +from GaudiKernel.SystemOfUnits import GeV, MeV +from PyConf.reading import get_particles, get_pvs, get_mc_particles +from PyConf.Algorithms import ThOrParticleSelection +from IsolationTools import VertexAndConeIsolation +from Hlt2Conf.algorithms_thor import ParticleCombiner, ParticleFilter +import Functors as F +from FunTuple import FunctorCollection +from FunTuple import FunTuple_Particles as Funtuple +from FunTuple import FunTuple_MCParticles as FuntupleMC +import FunTuple.functorcollections as FC +from DaVinci.algorithms import create_lines_filter#, add_filter +from DaVinci import Options, make_config +from DaVinciMCTools import MCTruthAndBkgCat +from DecayTreeFitter import DecayTreeFitter +from DaVinciTools import SubstitutePID +from FunTuple.functorcollections import Kinematics, MCKinematics, MCVertexInfo, MCHierarchy, EventInfo, SelectionInfo + +from .line_configs import line_configs_dict + +from PyConf.application import metainfo_repos +metainfo_repos.global_bind(extra_central_tags=['commissioning']) + + +def variables_MC(mctruth): + # Returns the variables for the Monte Carlo simulation + # mctruth = MCTruthAndBkgCat(input_particles=particles, name='MCTruthAndBkgCat_{hash}') from DaVinciMCTools + + mcvars = FC.MCKinematics(mctruth_alg=mctruth) + mcvars += FC.MCHierarchy(mctruth_alg=mctruth) + mcvars += FC.MCPromptDecay(mctruth_alg=mctruth) + mcvars += FC.MCVertexInfo(mctruth_alg=mctruth) + + return mcvars + +def make_DTF_vars(particles,constraints,name='DTF', pvs=None, substitutions=None, dtfname='DTF_{hash}',extravars=True): + + if pvs is None: + DTF = DecayTreeFitter( + name=dtfname, + input_particles=particles, + mass_constraints=constraints, + substitutions=substitutions + ) + else: + DTF = DecayTreeFitter( + name=dtfname, + input_particles=particles, + input_pvs=pvs, + mass_constraints=constraints, + substitutions=substitutions + ) + + vars = FunctorCollection({ + f'{name}_MASS': DTF(F.MASS), + }) + + if extravars: + vars+=FunctorCollection({ + f'{name}_P': DTF(F.P), + f'{name}_PX': DTF(F.PX), + f'{name}_PY': DTF(F.PY), + f'{name}_PZ': DTF(F.PZ), + f'{name}_PT': DTF(F.PT), + f'{name}_ENERGY': DTF(F.ENERGY), + f'{name}_CHI2DOF': DTF(F.CHI2DOF) + }) + + return vars + +def main(options: Options): + + ####################################### + # Lb -> p K- mu+ mu- # + ####################################### + + pvs = get_pvs() + + fields_lb2pK = { + "Lb" : "[Lambda_b0 -> J/psi(1S) Lambda(1520)0]CC", + "Jpsi": "[Lambda_b0 -> ^J/psi(1S) Lambda(1520)0]CC", + "Lb_1520": "[Lambda_b0 -> J/psi(1S) ^Lambda(1520)0]CC", + "Pp" : "[Lambda_b0 -> J/psi(1S) (Lambda(1520)0-> ^p+ K-)]CC", + "Km" : "[Lambda_b0 -> J/psi(1S) (Lambda(1520)0-> p+ ^K-)]CC", + "Mup" : "[Lambda_b0 -> (J/psi(1S)-> ^mu+ mu-) Lambda(1520)0]CC", + "Mum" : "[Lambda_b0 -> (J/psi(1S)-> mu+ ^mu-) Lambda(1520)0]CC" + } + + FILTER_TREE = lambda id: F.FILTER(F.IS_ABS_ID(id)) @ F.GET_ALL_DESCENDANTS() + + line_lb2pK = "Hlt2RD_LambdabToPKMuMu" + long_track_iso = "LongTrackIsolation" + neutral_iso = "NeutralIsolation" + + input_data_lb2pK = get_particles(f"/Event/HLT2/{line_lb2pK}/Particles") + + variables_all = FunctorCollection({ + "ID": F.PARTICLE_ID, # PDG ID of the particle + "Q": F.CHARGE, # Electric charge + "ETA": F.ETA, # Pseudorapidity + "PHI": F.PHI, # Azimuthal angle + "CHI2": F.CHI2, # χ² + "CHI2DOF": F.CHI2DOF, # χ² degrees of freedom + "OWNPVIP": F.OWNPVIP, # Impact parameter wrt own PV + "OWNPVIPCHI2": F.OWNPVIPCHI2, # Impact parameter χ² wrt own PV + + }) + + variables_all += FC.Kinematics() + + composite_variables = FunctorCollection({ + #"VTXCHI2NDOF": F.CHI2DOF, # Vertex fit χ²/ndf + "END_VX": F.END_VX, # x-coordinate of decay vertex + "END_VY": F.END_VY, # y-coordinate of decay vertex + "END_VZ": F.END_VZ, # z-coordinate of decay vertex + #"ENDVERTEX": F.ENDVERTEX, # wtf does this do? + # OWNPV values + "OWNPV_X": F.OWNPVX, # x-coordinate of best PV + "OWNPV_Y": F.OWNPVY, # y-coordinate of best PV + "OWNPV_Z": F.OWNPVZ, # z-coordinate of best PV + "OWNPV_NDOF": F.NDOF @ F.OWNPV, + "OWNPV_DIRA": F.OWNPVDIRA, # Direction angle cosine wrt own PV + "OWNPV_FD": F.OWNPVFD, # Flight distance wrt own PV + "OWNPV_FDCHI2": F.OWNPVFDCHI2, # Flight distance χ² wrt own PV + "OWNPV_VDRHO": F.OWNPVVDRHO, # Radial flight distance wrt own PV + "OWNPV_VDZ": F.OWNPVVDZ, # z-direction flight distance + "OWNPV_LTIME": F.OWNPVLTIME, # Proper lifetime + "OWNPV_DLS": F.OWNPVDLS, # Decay length significance + # DOCA + "DOCA12": F.DOCA(1, 2), # DOCA between first and second daughter + "DOCA12CHI2": F.DOCACHI2(1, 2), # DOCA χ² between first and second daughter + # Daughter Max, Min and Sums + "MAX_PT": F.MAX(F.PT), # Maximum PT of daughters + "MIN_PT": F.MIN(F.PT), # Minimum PT of daughters + "SUM_PT": F.SUM(F.PT), # Sum of daughters' PT + "MAX_P": F.MAX(F.P), # Maximum momentum of daughters + "MIN_P": F.MIN(F.P), # Minimum momentum of daughters + "SUM_P": F.SUM(F.P), # Sum of daughters' momentum + "MAX_OWNPVIPCHI2": F.MAX(F.OWNPVIPCHI2), # Max IP χ² of daughters + "MIN_OWNPVIPCHI2": F.MIN(F.OWNPVIPCHI2), # Min IP χ² of daughters + "SUM_OWNPVIPCHI2": F.SUM(F.OWNPVIPCHI2), # Sum of daughters' IP χ² + "MAXDOCACHI2": F.MAXDOCACHI2, # Maximum DOCA χ² between any daughters + "MAXDOCA": F.MAXDOCA, # Maximum DOCA between any daughters + "MAXSDOCACHI2": F.MAXSDOCACHI2, # Maximum signed DOCA χ² + "MAXSDOCA": F.MAXSDOCA, # Maximum signed DOCA + + }) + + variables_extra = FunctorCollection({ + 'BPVIPCHI2': F.BPVIPCHI2(pvs), + 'BPVIP': F.BPVIP(pvs), + 'BPVX': F.BPVX(pvs), + 'BPVY': F.BPVY(pvs), + 'BPVZ': F.BPVZ(pvs), + 'KEY': F.OBJECT_KEY, + 'ALLPV_FD' : F.ALLPV_FD(pvs), + 'ALLPV_IP' : F.ALLPV_IP(pvs), + "BPVFDCHI2": F.BPVFDCHI2(pvs), + "BPVFD": F.BPVFD(pvs), + 'BPVLTIME': F.BPVLTIME(pvs), + "BPVDIRA": F.BPVDIRA(pvs), + "BPVVDRHO": F.BPVVDRHO(pvs), + "BPVVDZ": F.BPVVDZ(pvs), + "MAX_BPVIPCHI2": F.MAX(F.BPVIPCHI2(pvs)), + "MIN_BPVIPCHI2": F.MIN(F.BPVIPCHI2(pvs)), + }) + + charged_variables = FC.ChargedCaloInfo(extra_info=True) + + variables_extra_children = FunctorCollection({ + 'BPVIPCHI2': F.BPVIPCHI2(pvs), + 'BPVIP': F.BPVIP(pvs), + 'BPVX': F.BPVX(pvs), + 'BPVY': F.BPVY(pvs), + 'BPVZ': F.BPVZ(pvs), + 'KEY': F.OBJECT_KEY, + "MINIPCHI2": F.MINIPCHI2(pvs) + }) + + charged_extra = FunctorCollection({ + 'CLUSTERMATCH': F.CLUSTERMATCH_CHI2, + 'NHITS': F.VALUE_OR(-1) @ F.NHITS @ F.TRACK, + 'NVPHITS': F.VALUE_OR(-1) @ F.NVPHITS @ F.TRACK, + 'NFTHITS': F.VALUE_OR(-1) @ F.NFTHITS @ F.TRACK, + 'NDOF': F.VALUE_OR(-1) @ F.NDOF @ F.TRACK, + 'QOVERP': F.QOVERP @ F.TRACK, + 'TRACKHASVELO': F.VALUE_OR(-1) @ F.TRACKHASVELO @ F.TRACK, + 'TRACKHASUT': F.VALUE_OR(-1) @ F.TRACKHASUT @ F.TRACK, + 'TX': F.TX, + 'TY': F.TY, + 'RICH_DLL_BT': F.RICH_DLL_BT, + "RICH_DLL_D" : F.RICH_DLL_D, + 'RICH_DLL_E': F.RICH_DLL_E, + 'RICH_DLL_K': F.RICH_DLL_K, + 'RICH_DLL_MU': F.RICH_DLL_MU, + 'RICH_DLL_P': F.RICH_DLL_P, + 'RICH_DLL_PI': F.RICH_DLL_PI, + "PPHASRICH" : F.PPHASRICH @ F.PROTOPARTICLE, + "RICH1_GAS_USED" : F.RICH1_GAS_USED, + "RICH2_GAS_USED" : F.RICH2_GAS_USED, + "RICH_SCALED_DLL_E" : F.RICH_SCALED_DLL_E, + "RICH_SCALED_DLL_MU" : F.RICH_SCALED_DLL_MU, + "RICH_THRESHOLD_DE" : F.RICH_THRESHOLD_DE, + "RICH_THRESHOLD_EL" : F.RICH_THRESHOLD_EL, + "RICH_THRESHOLD_KA" : F.RICH_THRESHOLD_KA, + "RICH_THRESHOLD_MU" : F.RICH_THRESHOLD_MU, + "RICH_THRESHOLD_PI" : F.RICH_THRESHOLD_PI, + "RICH_THRESHOLD_PR" : F.RICH_THRESHOLD_PR + }) + + charged_extra += FC.ParticleID(extra_info=True) + + muon_extra = FunctorCollection({ + "PPHASMUONINFO": F.PPHASMUONINFO @ F.PROTOPARTICLE, + "INMUON" : F.INMUON, + "ISMUON" : F.ISMUON, + "ISMUONTIGHT" : F.ISMUONTIGHT, + }) + + Hlt1_decisions = [ + 'Hlt1LowPtMuon', + 'Hlt1SingleHighPtMuon', + 'Hlt1TrackMuonMVA', + 'Hlt1DiMuonLowMass', + 'Hlt1DiMuonHighMass', + 'Hlt1DiMuonDisplaced', + 'Hlt1DiMuonSoft' + 'Hlt1TrackMVA', + 'Hlt1TwoTrackMVA', + "Hlt1TrackMVADecision", + "Hlt1TwoTrackMVADecision", + "Hlt1DisplacedLeptonsDecision", + "Hlt1SingleHighEtDecision", + 'Hlt1DiMuonHighMassDecision', + 'Hlt1DiMuonLowMassDecision', + 'Hlt1DiMuonSoftDecision', + 'Hlt1LowPtMuonDecision', + 'Hlt1LowPtDiMuonDecision', + 'Hlt1SingleHighPtMuonDecision', + 'Hlt1TrackMuonMVADecision', + 'Hlt1OneMuonTrackLineDecision', + 'Hlt1DiMuonNoIPDecision', + 'Hlt1DiMuonNoIP_ssDecision' + ] + + # MISSING HLT VARIABLES + variables_all += FC.HltTisTos( + selection_type="Hlt1", + trigger_lines=[f"{x}Decision" for x in Hlt1_decisions], + data=input_data_lb2pK) + + event_info_lb2pK = EventInfo() + event_info_lb2pK += FunctorCollection({ + "NPV": F.SIZE(pvs), # Number of primary vertices + "ALLPVX[NPVs]": F.ALLPVX(pvs), # x-coordinates of all PVs + "ALLPVY[NPVs]": F.ALLPVY(pvs), # y-coordinates of all PVs + "ALLPVZ[NPVs]": F.ALLPVZ(pvs), # z-coordinates of all PVs + }) + event_info_lb2pK += FC.RecSummary() # Reconstruction summary, nLongTracks, nDownstreamTracks + event_info_lb2pK += FC.LHCInfo() # LHC running conditions, FillNumber, LHC energy + event_info_lb2pK += SelectionInfo(selection_type='Hlt1', trigger_lines=Hlt1_decisions) + event_info_lb2pK += SelectionInfo(selection_type='Hlt2', trigger_lines=[line_lb2pK]) + + simulation = options.simulation + + if simulation: + MCTRUTH = MCTruthAndBkgCat(input_particles=input_data_lb2pK, name="MCTruthAndBkgCat_{hash}") + variables_mc = variables_MC(MCTRUTH) + variables_all += variables_mc + + variables_lb2pK = { "Lb": variables_all+variables_extra+composite_variables, + "Jpsi" : variables_all+variables_extra+composite_variables, + "Lb_1520": variables_all+variables_extra+composite_variables, + "Pp" : variables_all+variables_extra_children+charged_extra, + "Km" : variables_all+variables_extra_children+charged_extra, + "Mup": variables_all+variables_extra_children+charged_variables+charged_extra+muon_extra, + "Mum": variables_all+variables_extra_children+charged_variables+charged_extra+muon_extra} + + if simulation: + variables_lb2pK["Lb"].update({"BKGCAT":MCTRUTH.BkgCat}) + + for particl in variables_lb2pK: + variables_lb2pK[particl] += make_DTF_vars(input_data_lb2pK,["J/psi(1S)"],name='DTF_JpsiConstr') + variables_lb2pK[particl] += make_DTF_vars(input_data_lb2pK,["Lambda_b0"],name='DTF_LbConstr') + variables_lb2pK[particl] += make_DTF_vars(input_data_lb2pK,["J/psi(1S)"],name='DTFPV_JpsiConstr', pvs=pvs) + variables_lb2pK[particl] += make_DTF_vars(input_data_lb2pK,["Lambda_b0"],name='DTFPV_LbConstr', pvs=pvs) + variables_lb2pK[particl] += make_DTF_vars(input_data_lb2pK,[],name='DTFPV', pvs=pvs) + variables_lb2pK[particl] += make_DTF_vars(input_data_lb2pK,["psi(2S)"],name='DTF_psi2SConstr',substitutions=['Lambda_b0 -> J/psi(1S){{psi(2S)}} Lambda(1520)0']) + variables_lb2pK[particl] += make_DTF_vars(input_data_lb2pK,["psi(2S)"],name='DTFPV_psi2SConstr',pvs=pvs,substitutions=['Lambda_b0 -> J/psi(1S){{psi(2S)}} Lambda(1520)0']) + variables_lb2pK[particl] += make_DTF_vars(input_data_lb2pK,["J/psi(1S)"],name='DTFPV_JpsiConstr_KToPi',substitutions=['Lambda_b0 -> J/psi(1S) (Lambda(1520)0-> p+ K-{{pi-}})'], pvs=pvs,extravars=False) + variables_lb2pK[particl] += make_DTF_vars(input_data_lb2pK,[],name='DTFPV_KToPi',substitutions=['Lambda_b0 -> J/psi(1S) (Lambda(1520)0-> p+ K-{{pi-}})'], pvs=pvs,extravars=False) + variables_lb2pK[particl] += make_DTF_vars(input_data_lb2pK,["J/psi(1S)"],name='DTF_JpsiConstr_KToPi',substitutions=['Lambda_b0 -> J/psi(1S) (Lambda(1520)0-> p+ K-{{pi-}})']) #*** + variables_lb2pK[particl] += make_DTF_vars(input_data_lb2pK,["psi(2S)"],name='DTF_psi2SConstr_KToPi',substitutions=['Lambda_b0 -> J/psi(1S){{psi(2S)}} (Lambda(1520)0-> p+ K-{{pi-}})']) #*** + variables_lb2pK[particl] += make_DTF_vars(input_data_lb2pK,["psi(2S)"],name='DTFPV_psi2SConstr_KToPi',substitutions=['Lambda_b0 -> J/psi(1S){{psi(2S)}} (Lambda(1520)0-> p+ K-{{pi-}})'], pvs=pvs,extravars=False) #*** + + tuple_lb2pK = Funtuple( + name='LbToPpKmMuMu', + tuple_name='DecayTree', + fields=fields_lb2pK, + variables=variables_lb2pK, + event_variables=event_info_lb2pK, + inputs=input_data_lb2pK + ) + + filter_lb2pK = create_lines_filter(name=f"HLT_PASS('{line_lb2pK}')",lines=[line_lb2pK]) + + algs = {"tuple_lb2pK": [filter_lb2pK, tuple_lb2pK] + } + + return make_config(options, algs) diff --git a/b2xll_MC24_W31_34/muons/dv_LbToPpPimMuMu.py b/b2xll_MC24_W31_34/muons/dv_LbToPpPimMuMu.py new file mode 100644 index 0000000000..590e2eebe8 --- /dev/null +++ b/b2xll_MC24_W31_34/muons/dv_LbToPpPimMuMu.py @@ -0,0 +1,513 @@ +from GaudiKernel.SystemOfUnits import GeV, MeV +from PyConf.reading import get_particles, get_pvs, get_mc_particles +from PyConf.Algorithms import ThOrParticleSelection +from IsolationTools import VertexAndConeIsolation +from Hlt2Conf.algorithms_thor import ParticleCombiner, ParticleFilter +import Functors as F +from FunTuple import FunctorCollection +from FunTuple import FunTuple_Particles as Funtuple +from FunTuple import FunTuple_MCParticles as FuntupleMC +import FunTuple.functorcollections as FC +from DaVinci.algorithms import create_lines_filter#, add_filter +from DaVinci import Options, make_config +from DaVinciMCTools import MCTruthAndBkgCat +from DecayTreeFitter import DecayTreeFitter +from DaVinciTools import SubstitutePID +from FunTuple.functorcollections import Kinematics, MCKinematics, MCVertexInfo, MCHierarchy, EventInfo, SelectionInfo + +from .line_configs import line_configs_dict + +from PyConf.application import metainfo_repos +metainfo_repos.global_bind(extra_central_tags=['commissioning']) + + +def variables_MC(mctruth): + # Returns the variables for the Monte Carlo simulation + # mctruth = MCTruthAndBkgCat(input_particles=particles, name='MCTruthAndBkgCat_{hash}') from DaVinciMCTools + + mcvars = FC.MCKinematics(mctruth_alg=mctruth) + mcvars += FC.MCHierarchy(mctruth_alg=mctruth) + mcvars += FC.MCPromptDecay(mctruth_alg=mctruth) + mcvars += FC.MCVertexInfo(mctruth_alg=mctruth) + + return mcvars + +def make_DTF_vars(particles,constraints,name='DTF', pvs=None, substitutions=None, dtfname='DTF_{hash}',extravars=True): + + if pvs is None: + DTF = DecayTreeFitter( + name=dtfname, + input_particles=particles, + mass_constraints=constraints, + substitutions=substitutions + ) + else: + DTF = DecayTreeFitter( + name=dtfname, + input_particles=particles, + input_pvs=pvs, + mass_constraints=constraints, + substitutions=substitutions + ) + + vars = FunctorCollection({ + f'{name}_MASS': DTF(F.MASS), + }) + + if extravars: + vars+=FunctorCollection({ + f'{name}_P': DTF(F.P), + f'{name}_PX': DTF(F.PX), + f'{name}_PY': DTF(F.PY), + f'{name}_PZ': DTF(F.PZ), + f'{name}_PT': DTF(F.PT), + f'{name}_ENERGY': DTF(F.ENERGY), + f'{name}_CHI2DOF': DTF(F.CHI2DOF) + }) + + return vars + +def main(options: Options): + + ####################################### + # Lb -> p pi- mu+ mu- # + ####################################### + + pvs = get_pvs() + + fields_lb2ppi = { + "Lb" : "[Lambda_b0 -> (J/psi(1S) -> mu+ mu- ) p+ pi-]CC", + "Jpsi": "[Lambda_b0 -> ^(J/psi(1S) -> mu+ mu-) p+ pi-]CC", + "Pp" : "[Lambda_b0 -> (J/psi(1S) -> mu+ mu-) ^p+ pi-]CC", + "Pim" : "[Lambda_b0 -> (J/psi(1S) -> mu+ mu-) p+ ^pi-]CC", + "Mup" : "[Lambda_b0 -> (J/psi(1S) ->^mu+ mu-) p+ pi-]CC", + "Mum" : "[Lambda_b0 -> (J/psi(1S) -> mu+ ^mu-) p+ pi-]CC" + } + + FILTER_TREE = lambda id: F.FILTER(F.IS_ABS_ID(id)) @ F.GET_ALL_DESCENDANTS() + + line_lb2ppi = "Hlt2RD_LbToPpPimMuMu" + long_track_iso = "LongTrackIsolation" + neutral_iso = "NeutralIsolation" + + input_data_lb2ppi = get_particles(f"/Event/HLT2/{line_lb2ppi}/Particles") + lb2ppimmumu_p_data = ThOrParticleSelection( + InputParticles=input_data_lb2ppi, Functor=FILTER_TREE("p+") + ).OutputSelection + lb2ppimmumu_pim_data = ThOrParticleSelection( + InputParticles=input_data_lb2ppi, Functor=FILTER_TREE("pi-") + ).OutputSelection + lb2ppimmumu_mup_data = ThOrParticleSelection( + InputParticles=input_data_lb2ppi, Functor=FILTER_TREE("mu+") + ).OutputSelection + lb2ppimmumu_mum_data = ThOrParticleSelection( + InputParticles=input_data_lb2ppi, Functor=FILTER_TREE("mu-") + ).OutputSelection + + lb_cciso_data = get_particles( + f"/Event/HLT2/{line_lb2ppi}/lb0_{long_track_iso}/Particles" + ) + p_cciso_data = get_particles( + f"/Event/HLT2/{line_lb2ppi}/p+_{long_track_iso}/Particles" + ) + pi_cciso_data = get_particles( + f"/Event/HLT2/{line_lb2ppi}/pi-_{long_track_iso}/Particles" + ) + mup_cciso_data = get_particles( + f"/Event/HLT2/{line_lb2ppi}/mu+_{long_track_iso}/Particles" + ) + mum_cciso_data = get_particles( + f"/Event/HLT2/{line_lb2ppi}/mu-_{long_track_iso}/Particles" + ) + lb_nciso_data = get_particles( + f"/Event/HLT2/{line_lb2ppi}/lb0_{neutral_iso}/Particles" + ) + p_nciso_data = get_particles( + f"/Event/HLT2/{line_lb2ppi}/p+_{neutral_iso}/Particles" + ) + pi_nciso_data = get_particles( + f"/Event/HLT2/{line_lb2ppi}/pi-_{neutral_iso}/Particles" + ) + mup_nciso_data = get_particles( + f"/Event/HLT2/{line_lb2ppi}/mu+_{neutral_iso}/Particles" + ) + mum_nciso_data = get_particles( + f"/Event/HLT2/{line_lb2ppi}/mu-_{neutral_iso}/Particles" + ) + + lb_charge_iso = VertexAndConeIsolation( + name="LbIso05", + reference_particles=input_data_lb2ppi, + related_particles=lb_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + lb_neutral_iso = VertexAndConeIsolation( + name="LbIso10", + reference_particles=input_data_lb2ppi, + related_particles=lb_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + lb_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=lb_charge_iso, + neutral_cone_isolation_alg=lb_neutral_iso, + array_indx_name="Lb_cone_indx", + ) + + mup_charge_iso = VertexAndConeIsolation( + name="MupIso05", + reference_particles=lb2ppimmumu_mup_data, + related_particles=mup_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + mup_neutral_iso = VertexAndConeIsolation( + name="MupIso10", + reference_particles=lb2ppimmumu_mup_data, + related_particles=mup_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + mup_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=mup_charge_iso, + neutral_cone_isolation_alg=mup_neutral_iso, + array_indx_name="Mup_cone_indx", + ) + + mum_charge_iso = VertexAndConeIsolation( + name="MumIso05", + reference_particles=lb2ppimmumu_mum_data, + related_particles=mum_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + mum_neutral_iso = VertexAndConeIsolation( + name="MumIso10", + reference_particles=lb2ppimmumu_mum_data, + related_particles=mum_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + mum_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=mum_charge_iso, + neutral_cone_isolation_alg=mum_neutral_iso, + array_indx_name="Mum_cone_indx", + ) + + pi_charge_iso = VertexAndConeIsolation( + name="PimIso05", + reference_particles=lb2ppimmumu_pim_data, + related_particles=pi_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + pi_neutral_iso = VertexAndConeIsolation( + name="PimIso10", + reference_particles=lb2ppimmumu_pim_data, + related_particles=pi_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + + pi_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=pi_charge_iso, + neutral_cone_isolation_alg=pi_neutral_iso, + array_indx_name="Pim_cone_indx", + ) + + p_charge_iso = VertexAndConeIsolation( + name="PpIso05", + reference_particles=lb2ppimmumu_p_data, + related_particles=p_cciso_data, + cut=(F.SQRT @ F.DR2 < 0.5), + ) + + p_neutral_iso = VertexAndConeIsolation( + name="PpIso10", + reference_particles=lb2ppimmumu_p_data, + related_particles=p_nciso_data, + cut=(F.SQRT @ F.DR2 < 1.0), + ) + + + p_cone_iso_variables = FC.ConeIsolation( + charged_cone_isolation_alg=p_charge_iso, + neutral_cone_isolation_alg=p_neutral_iso, + array_indx_name="Pp_cone_indx", + ) + + lb_fixpv_iso = VertexAndConeIsolation( + name="LbIsoFixPV", + reference_particles=input_data_lb2ppi, + related_particles=lb_cciso_data, + cut=(F.SHARE_BPV(pvs) | (F.MINIPCHI2CUT(pvs, 9.0) @ F.FORWARDARG1())), + ) + + lb_fix_pv_iso_variables = FC.ParticleIsolation( + isolation_alg=lb_fixpv_iso, array_indx_name="Lb_FixPV_indx" + ) + + lb_mass_constraint_iso = VertexAndConeIsolation( + name="LbIsoMassConstraint", + reference_particles=input_data_lb2ppi, + related_particles=lb_nciso_data, + cut=(F.COMB_MASS() < 8 * GeV), + ) + + lb_mass_constraint_iso_variables = FC.ParticleIsolation( + isolation_alg=lb_mass_constraint_iso, array_indx_name="Lb_MassConstraint_indx" + ) + + lb_vtxiso_onetrack_data = ParticleCombiner( + [input_data_lb2ppi, lb_cciso_data], + name="lb_One_extra_track_combination", + DecayDescriptor="[Xi_bc+ -> Lambda_b0 pi+]cc", + CombinationCut=F.ALL, + CompositeCut=F.ALL, + ) + + lb_vtxiso_twotracks_data = ParticleCombiner( + [input_data_lb2ppi, lb_cciso_data, lb_cciso_data], + name="lb_Two_extra_tracks_combination", + DecayDescriptor="[Xi_bc0 -> Lambda_b0 pi+ pi-]cc", + CombinationCut=F.ALL, + CompositeCut=F.ALL, + ) + + lb_vtxiso_onetrack = VertexAndConeIsolation( + name="OneTrack", + reference_particles=input_data_lb2ppi, + related_particles=lb_vtxiso_onetrack_data, + cut=(F.CHI2() @ F.FORWARDARG1() < 9.0), + ) + + lb_vtxiso_twotracks = VertexAndConeIsolation( + name="TwoTracks", + reference_particles=input_data_lb2ppi, + related_particles=lb_vtxiso_twotracks_data, + cut=(F.CHI2() @ F.FORWARDARG1() < 15.0), + ) + + lb_vtxiso_onetrack_variables = FC.VertexIsolation(isolation_alg=lb_vtxiso_onetrack) + + lb_vtxiso_twotracks_variables = FC.VertexIsolation(isolation_alg=lb_vtxiso_twotracks) + + variables_all = FunctorCollection({ + "ID": F.PARTICLE_ID, # PDG ID of the particle + "Q": F.CHARGE, # Electric charge + "ETA": F.ETA, # Pseudorapidity + "PHI": F.PHI, # Azimuthal angle + "CHI2": F.CHI2, # χ² + "CHI2DOF": F.CHI2DOF, # χ² degrees of freedom + "OWNPVIP": F.OWNPVIP, # Impact parameter wrt own PV + "OWNPVIPCHI2": F.OWNPVIPCHI2, # Impact parameter χ² wrt own PV + + }) + + variables_all += FC.Kinematics() + + composite_variables = FunctorCollection({ + #"VTXCHI2NDOF": F.CHI2DOF, # Vertex fit χ²/ndf + "END_VX": F.END_VX, # x-coordinate of decay vertex + "END_VY": F.END_VY, # y-coordinate of decay vertex + "END_VZ": F.END_VZ, # z-coordinate of decay vertex + #"ENDVERTEX": F.ENDVERTEX, # wtf does this do? + # OWNPV values + "OWNPV_X": F.OWNPVX, # x-coordinate of best PV + "OWNPV_Y": F.OWNPVY, # y-coordinate of best PV + "OWNPV_Z": F.OWNPVZ, # z-coordinate of best PV + "OWNPV_NDOF": F.NDOF @ F.OWNPV, + "OWNPV_DIRA": F.OWNPVDIRA, # Direction angle cosine wrt own PV + "OWNPV_FD": F.OWNPVFD, # Flight distance wrt own PV + "OWNPV_FDCHI2": F.OWNPVFDCHI2, # Flight distance χ² wrt own PV + "OWNPV_VDRHO": F.OWNPVVDRHO, # Radial flight distance wrt own PV + "OWNPV_VDZ": F.OWNPVVDZ, # z-direction flight distance + "OWNPV_LTIME": F.OWNPVLTIME, # Proper lifetime + "OWNPV_DLS": F.OWNPVDLS, # Decay length significance + # DOCA + "DOCA12": F.DOCA(1, 2), # DOCA between first and second daughter + "DOCA12CHI2": F.DOCACHI2(1, 2), # DOCA χ² between first and second daughter + # Daughter Max, Min and Sums + "MAX_PT": F.MAX(F.PT), # Maximum PT of daughters + "MIN_PT": F.MIN(F.PT), # Minimum PT of daughters + "SUM_PT": F.SUM(F.PT), # Sum of daughters' PT + "MAX_P": F.MAX(F.P), # Maximum momentum of daughters + "MIN_P": F.MIN(F.P), # Minimum momentum of daughters + "SUM_P": F.SUM(F.P), # Sum of daughters' momentum + "MAX_OWNPVIPCHI2": F.MAX(F.OWNPVIPCHI2), # Max IP χ² of daughters + "MIN_OWNPVIPCHI2": F.MIN(F.OWNPVIPCHI2), # Min IP χ² of daughters + "SUM_OWNPVIPCHI2": F.SUM(F.OWNPVIPCHI2), # Sum of daughters' IP χ² + "MAXDOCACHI2": F.MAXDOCACHI2, # Maximum DOCA χ² between any daughters + "MAXDOCA": F.MAXDOCA, # Maximum DOCA between any daughters + "MAXSDOCACHI2": F.MAXSDOCACHI2, # Maximum signed DOCA χ² + "MAXSDOCA": F.MAXSDOCA, # Maximum signed DOCA + + }) + + variables_extra = FunctorCollection({ + 'BPVIPCHI2': F.BPVIPCHI2(pvs), + 'BPVIP': F.BPVIP(pvs), + 'BPVX': F.BPVX(pvs), + 'BPVY': F.BPVY(pvs), + 'BPVZ': F.BPVZ(pvs), + 'KEY': F.OBJECT_KEY, + 'ALLPV_FD' : F.ALLPV_FD(pvs), + 'ALLPV_IP' : F.ALLPV_IP(pvs), + "BPVFDCHI2": F.BPVFDCHI2(pvs), + "BPVFD": F.BPVFD(pvs), + 'BPVLTIME': F.BPVLTIME(pvs), + "BPVDIRA": F.BPVDIRA(pvs), + "BPVVDRHO": F.BPVVDRHO(pvs), + "BPVVDZ": F.BPVVDZ(pvs), + "MAX_BPVIPCHI2": F.MAX(F.BPVIPCHI2(pvs)), + "MIN_BPVIPCHI2": F.MIN(F.BPVIPCHI2(pvs)), + }) + + charged_variables = FC.ChargedCaloInfo(extra_info=True) + + variables_extra_children = FunctorCollection({ + 'BPVIPCHI2': F.BPVIPCHI2(pvs), + 'BPVIP': F.BPVIP(pvs), + 'BPVX': F.BPVX(pvs), + 'BPVY': F.BPVY(pvs), + 'BPVZ': F.BPVZ(pvs), + 'KEY': F.OBJECT_KEY, + "MINIPCHI2": F.MINIPCHI2(pvs) + }) + + charged_extra = FunctorCollection({ + 'CLUSTERMATCH': F.CLUSTERMATCH_CHI2, + 'NHITS': F.VALUE_OR(-1) @ F.NHITS @ F.TRACK, + 'NVPHITS': F.VALUE_OR(-1) @ F.NVPHITS @ F.TRACK, + 'NFTHITS': F.VALUE_OR(-1) @ F.NFTHITS @ F.TRACK, + 'NDOF': F.VALUE_OR(-1) @ F.NDOF @ F.TRACK, + 'QOVERP': F.QOVERP @ F.TRACK, + 'TRACKHASVELO': F.VALUE_OR(-1) @ F.TRACKHASVELO @ F.TRACK, + 'TRACKHASUT': F.VALUE_OR(-1) @ F.TRACKHASUT @ F.TRACK, + 'TX': F.TX, + 'TY': F.TY, + 'RICH_DLL_BT': F.RICH_DLL_BT, + "RICH_DLL_D" : F.RICH_DLL_D, + 'RICH_DLL_E': F.RICH_DLL_E, + 'RICH_DLL_K': F.RICH_DLL_K, + 'RICH_DLL_MU': F.RICH_DLL_MU, + 'RICH_DLL_P': F.RICH_DLL_P, + 'RICH_DLL_PI': F.RICH_DLL_PI, + "PPHASRICH" : F.PPHASRICH @ F.PROTOPARTICLE, + "RICH1_GAS_USED" : F.RICH1_GAS_USED, + "RICH2_GAS_USED" : F.RICH2_GAS_USED, + "RICH_SCALED_DLL_E" : F.RICH_SCALED_DLL_E, + "RICH_SCALED_DLL_MU" : F.RICH_SCALED_DLL_MU, + "RICH_THRESHOLD_DE" : F.RICH_THRESHOLD_DE, + "RICH_THRESHOLD_EL" : F.RICH_THRESHOLD_EL, + "RICH_THRESHOLD_KA" : F.RICH_THRESHOLD_KA, + "RICH_THRESHOLD_MU" : F.RICH_THRESHOLD_MU, + "RICH_THRESHOLD_PI" : F.RICH_THRESHOLD_PI, + "RICH_THRESHOLD_PR" : F.RICH_THRESHOLD_PR + }) + + charged_extra += FC.ParticleID(extra_info=True) + + muon_extra = FunctorCollection({ + "PPHASMUONINFO": F.PPHASMUONINFO @ F.PROTOPARTICLE, + "INMUON" : F.INMUON, + "ISMUON" : F.ISMUON, + "ISMUONTIGHT" : F.ISMUONTIGHT, + }) + + Hlt1_decisions = [ + 'Hlt1LowPtMuon', + 'Hlt1SingleHighPtMuon', + 'Hlt1TrackMuonMVA', + 'Hlt1DiMuonLowMass', + 'Hlt1DiMuonHighMass', + 'Hlt1DiMuonDisplaced', + 'Hlt1DiMuonSoft' + 'Hlt1TrackMVA', + 'Hlt1TwoTrackMVA', + "Hlt1TrackMVADecision", + "Hlt1TwoTrackMVADecision", + "Hlt1DisplacedLeptonsDecision", + "Hlt1SingleHighEtDecision", + 'Hlt1DiMuonHighMassDecision', + 'Hlt1DiMuonLowMassDecision', + 'Hlt1DiMuonSoftDecision', + 'Hlt1LowPtMuonDecision', + 'Hlt1LowPtDiMuonDecision', + 'Hlt1SingleHighPtMuonDecision', + 'Hlt1TrackMuonMVADecision', + 'Hlt1OneMuonTrackLineDecision', + 'Hlt1DiMuonNoIPDecision', + 'Hlt1DiMuonNoIP_ssDecision' + ] + + # MISSING HLT VARIABLES + variables_all += FC.HltTisTos( + selection_type="Hlt1", + trigger_lines=[f"{x}Decision" for x in Hlt1_decisions], + data=input_data_lb2ppi) + + event_info_lb2ppi = EventInfo() + event_info_lb2ppi += FunctorCollection({ + "NPV": F.SIZE(pvs), # Number of primary vertices + "ALLPVX[NPVs]": F.ALLPVX(pvs), # x-coordinates of all PVs + "ALLPVY[NPVs]": F.ALLPVY(pvs), # y-coordinates of all PVs + "ALLPVZ[NPVs]": F.ALLPVZ(pvs), # z-coordinates of all PVs + }) + event_info_lb2ppi += FC.RecSummary() # Reconstruction summary, nLongTracks, nDownstreamTracks + event_info_lb2ppi += FC.LHCInfo() # LHC running conditions, FillNumber, LHC energy + event_info_lb2ppi += SelectionInfo(selection_type='Hlt1', trigger_lines=Hlt1_decisions) + event_info_lb2ppi += SelectionInfo(selection_type='Hlt2', trigger_lines=[line_lb2ppi]) + + simulation = options.simulation + + if simulation: + MCTRUTH = MCTruthAndBkgCat(input_particles=input_data_lb2ppi, name="MCTruthAndBkgCat_{hash}") + variables_mc = variables_MC(MCTRUTH) + variables_all += variables_mc + + variables_lb2ppi = { "Lb": variables_all+variables_extra + + lb_cone_iso_variables + + lb_fix_pv_iso_variables + + lb_mass_constraint_iso_variables + + lb_vtxiso_onetrack_variables + + lb_vtxiso_twotracks_variables, + "Jpsi" : variables_all+variables_extra, + "Pp" : variables_all+variables_extra_children+charged_extra+p_cone_iso_variables, + "Pim" : variables_all+variables_extra_children+charged_extra+pi_cone_iso_variables, + "Mup": variables_all+variables_extra_children+charged_variables+charged_extra+mup_cone_iso_variables+muon_extra, + "Mum": variables_all+variables_extra_children+charged_variables+charged_extra+mum_cone_iso_variables+muon_extra} + + if simulation: + variables_lb2ppi["Lb"].update({"BKGCAT":MCTRUTH.BkgCat}) + + for particl in variables_lb2ppi: + variables_lb2ppi[particl] += make_DTF_vars(input_data_lb2ppi,["J/psi(1S)"],name='DTF_JpsiConstr') + variables_lb2ppi[particl] += make_DTF_vars(input_data_lb2ppi,["Lambda_b0"],name='DTF_LbConstr') + variables_lb2ppi[particl] += make_DTF_vars(input_data_lb2ppi,["J/psi(1S)"],name='DTFPV_JpsiConstr', pvs=pvs) + variables_lb2ppi[particl] += make_DTF_vars(input_data_lb2ppi,["Lambda_b0"],name='DTFPV_LbConstr', pvs=pvs) + variables_lb2ppi[particl] += make_DTF_vars(input_data_lb2ppi,[],name='DTFPV', pvs=pvs) + variables_lb2ppi[particl] += make_DTF_vars(input_data_lb2ppi,["psi(2S)"],name='DTF_psi2SConstr',substitutions=['Lambda_b0 -> J/psi(1S){{psi(2S)}} p+ pi-']) + variables_lb2ppi[particl] += make_DTF_vars(input_data_lb2ppi,["psi(2S)"],name='DTFPV_psi2SConstr',pvs=pvs,substitutions=['Lambda_b0 -> J/psi(1S){{psi(2S)}} p+ pi-']) + variables_lb2ppi[particl] += make_DTF_vars(input_data_lb2ppi,["J/psi(1S)"],name='DTFPV_JpsiConstr_PiToK',substitutions=['Lambda_b0 -> J/psi(1S) p+ pi-{{K-}}'], pvs=pvs,extravars=False) + variables_lb2ppi[particl] += make_DTF_vars(input_data_lb2ppi,[],name='DTFPV_PiToK',substitutions=['Lambda_b0 -> J/psi(1S) p+ pi-{{K-}}'], pvs=pvs,extravars=False) + variables_lb2ppi[particl] += make_DTF_vars(input_data_lb2ppi,["J/psi(1S)"],name='DTF_JpsiConstr_PiToK',substitutions=['Lambda_b0 -> J/psi(1S) p+ pi-{{K-}}']) #*** + variables_lb2ppi[particl] += make_DTF_vars(input_data_lb2ppi,["psi(2S)"],name='DTF_psi2SConstr_PiToK',substitutions=['Lambda_b0 -> J/psi(1S){{psi(2S)}} p+ pi-{{K-}}']) #*** + variables_lb2ppi[particl] += make_DTF_vars(input_data_lb2ppi,["psi(2S)"],name='DTFPV_psi2SConstr_PiToK',substitutions=['Lambda_b0 -> J/psi(1S){{psi(2S)}} p+ pi-{{K-}}'], pvs=pvs,extravars=False) #*** + + tuple_lb2ppi = Funtuple( + name='LbToPpPimMuMu', + tuple_name='DecayTree', + fields=fields_lb2ppi, + variables=variables_lb2ppi, + event_variables=event_info_lb2ppi, + inputs=input_data_lb2ppi + ) + + filter_lb2ppi = create_lines_filter(name=f"HLT_PASS('{line_lb2ppi}')",lines=[line_lb2ppi]) + + algs = {"tuple_lb2ppi": [filter_lb2ppi, tuple_lb2ppi] + } + + return make_config(options, algs) diff --git a/b2xll_MC24_W31_34/muons/line_configs.py b/b2xll_MC24_W31_34/muons/line_configs.py new file mode 100644 index 0000000000..cf74cf093d --- /dev/null +++ b/b2xll_MC24_W31_34/muons/line_configs.py @@ -0,0 +1,29 @@ +line_configs_dict = { + + + 'BuToHpMuMu_Incl' : { + + 'SubstitutePID' : "[B+ -> (J/psi(1S) -> mu+ mu-) pi+{{K+}}]CC" , + + 'fields' : { + 'Bu' : { "Descriptor" : "[B+ -> (J/psi(1S) -> mu+ mu-) K+]CC" , "Type" : "Composite" , 'Isolation' : { 'bhead_label_decay' : 'B+' , 'BCharged' : True } , } , + 'Jpsi' : { "Descriptor" : "[B+ -> ^(J/psi(1S) -> mu+ mu-) K+]CC" , "Type" : "Composite" , } , + 'Kp' : { "Descriptor" : "[B+ -> (J/psi(1S) -> mu+ mu-) ^K+]CC" , "Type" : "Track" , } , + 'Mup' : { "Descriptor" : "[B+ -> (J/psi(1S) -> ^mu+ mu-) K+]CC" , "Type" : "Track" , } , + 'Mum' : { "Descriptor" : "[B+ -> (J/psi(1S) -> mu+ ^mu-) K+]CC" , "Type" : "Track" , } , + } , + + 'DTF' : { + 'vars' : { + "Bp" : { "mass_constraints" : ["B+"] , } , + + "Jpsi" : { "mass_constraints" : ["J/psi(1S)"] , } , + "psi2S" : { "mass_constraints" : ["psi(2S)"] , "substitutions" : ["[B+ -> J/psi(1S){{psi(2S)}} K+]CC"] , } , + + } , + 'fields' : [ "Bp" , "Jpsi" ] + } , + + } + +} \ No newline at end of file -- GitLab From 0e5e2f23e3bd1b407ec8bf8bfd97f79aa4248504 Mon Sep 17 00:00:00 2001 From: Ernest Olivart <ernest.olivart.pino@cern.ch> Date: Wed, 18 Dec 2024 14:39:45 +0100 Subject: [PATCH 2/7] deleted unused folder --- vcbLcst2017/DV_MC_2017_Lc1_Lcmu.py | 331 --------------------------- vcbLcst2017/DV_MC_2017_Lc2_Lcmu.py | 331 --------------------------- vcbLcst2017/DV_MC_2017_Lc3_Lcmu.py | 347 ----------------------------- vcbLcst2017/DV_MC_2017_Lc4_Lcmu.py | 331 --------------------------- vcbLcst2017/info.yaml | 39 ---- 5 files changed, 1379 deletions(-) delete mode 100644 vcbLcst2017/DV_MC_2017_Lc1_Lcmu.py delete mode 100644 vcbLcst2017/DV_MC_2017_Lc2_Lcmu.py delete mode 100644 vcbLcst2017/DV_MC_2017_Lc3_Lcmu.py delete mode 100644 vcbLcst2017/DV_MC_2017_Lc4_Lcmu.py delete mode 100644 vcbLcst2017/info.yaml diff --git a/vcbLcst2017/DV_MC_2017_Lc1_Lcmu.py b/vcbLcst2017/DV_MC_2017_Lc1_Lcmu.py deleted file mode 100644 index b5f0c26784..0000000000 --- a/vcbLcst2017/DV_MC_2017_Lc1_Lcmu.py +++ /dev/null @@ -1,331 +0,0 @@ -################## -nEvt = -1 -MODE = 'MC' -################## - -from Gaudi.Configuration import * -from Configurables import DecayTreeTuple, MCDecayTreeTuple, DaVinci, GaudiSequencer, DaVinciInit, XmlParserSvc, OfflineVertexFitter -from Configurables import LoKi__HDRFilter as StripFilter -from Configurables import FilterDesktop, FilterInTrees, PrintDecayTree, CombineParticles, OfflineVertexFitter, CheckPV, CondDB - -from DecayTreeTuple.Configuration import * -from PhysSelPython.Wrappers import DataOnDemand -from PhysConf.Selections import Selection, SelectionSequence, AutomaticData, CombineSelection - -from StandardParticles import StdNoPIDsPions as Pions -from StandardParticles import StdNoPIDsKaons as Kaons -from StandardParticles import StdNoPIDsProtons as Protons -from StandardParticles import StdLoosePions as LoosePions - -import GaudiKernel.SystemOfUnits as Units - - -Lb_comb = "(AMAXDOCA('') <0.5*mm)" -cut_Lb = "(BPVDIRA > 0.999) & (MM>2*GeV) & (MM<8*GeV)" -Lc_comb = "ADAMASS('Lambda_c+')<80*MeV" - -cut_mu ={'mu-': "(PT > 1000*MeV) & (P > 6000*MeV) & (TRCHI2DOF < 3)"} - - - -cut_Lc = "(VFASPF(VCHI2/VDOF) < 6) & (BPVVDCHI2 > 25)" -cut_Kppi = {'K-' : "(PT > 250*MeV) & (P > 2000*MeV) & (TRCHI2DOF < 3)", - 'p+' : "(PT > 250*MeV) & (P > 8000*MeV) & (TRCHI2DOF < 3)", - 'pi+': "(PT > 250*MeV) & (P > 2000*MeV) & (TRCHI2DOF < 3)"} - - -Particles = 'Phys/B2DMuNuX_Lc/Particles' - -mu_list = FilterInTrees('mu_list',Code="'mu-'==ABSID") -mu_sel = Selection('mu_sel', - Algorithm=mu_list, - RequiredSelections=[AutomaticData(Location=Particles)]) - -pkpi_list = FilterInTrees('pkpi_list',Code="DECTREE('[Lambda_c+ -> p+ K- pi+]CC')") - -pkpi_sel = Selection('pkpi_sel', - Algorithm = pkpi_list, - RequiredSelections=[AutomaticData(Location=Particles)]) - -Lb2Lcmu = CombineParticles('Lb2Lcmu', - DecayDescriptors = ['[Lambda_b0 -> Lambda_c+ mu-]cc','[Lambda_b0 -> Lambda_c+ mu+]cc'], - CombinationCut="(AM<6.2*GeV)", - DaughtersCuts=cut_mu, - MotherCut = cut_Lb, - ReFitPVs = True) - -Lb2Lcmu_sel = Selection('Lb2Lcmu_sel', - Algorithm = Lb2Lcmu, - RequiredSelections=[mu_sel,pkpi_sel]) - -Lb2Lcmu_selseq = SelectionSequence('Lb2Lcmu_selseq', TopSelection = Lb2Lcmu_sel) - - -from StrippingConf.Configuration import StrippingConf, StrippingStream -from StrippingSettings.Utils import strippingConfiguration -from StrippingArchive.Utils import buildStreams -from StrippingArchive import strippingArchive -import shelve - -strippingVersion = 'stripping29r2' -config_db = strippingConfiguration(strippingVersion) -config = dict(config_db) # need to do this since the config_db is read-only -config['B2DMuNuX']['CONFIG']['UseNoPIDsInputs'] = True -config['B2DMuNuX']['CONFIG']['MuonPIDmu'] = -1000. -config['B2DMuNuX']['CONFIG']['ProtonPIDp'] = -1000. -config['B2DMuNuX']['CONFIG']['ProtonPIDpK'] = -1000. -config['B2DMuNuX']['CONFIG']['KaonPIDK'] = -1000. -config['B2DMuNuX']['CONFIG']['PionPIDK'] = 1000. -config['B2DMuNuX']['CONFIG']['ElectronPIDe'] = -1000. -config['B2DMuNuX']['CONFIG']['HLT2'] = "HLT_PASS_RE('Hlt2.*Decision')" -config['B2DMuNuX']['CONFIG']['TTSpecs'] = {} -config_db_updated = shelve.open('tmp_stripping_config.db') -config_db_updated.update(config) - - -#####get the line builders from the archive -archive = strippingArchive(strippingVersion) -myWG = "Semileptonic" - -streams = buildStreams(stripping = config_db_updated, archive = archive, WGs = myWG) - - -from Configurables import ProcStatusCheck -filterBadEvents = ProcStatusCheck() -sc = StrippingConf( Streams = streams, - MaxCandidates = 2000, - AcceptBadEvents = False, - BadEventSelection = filterBadEvents, - TESPrefix = 'Strip' ) - -from Configurables import StrippingReport -sr = StrippingReport(Selections = sc.selections()) -sr.OnlyPositive = False - -from Configurables import EventNodeKiller -eventNodeKiller = EventNodeKiller('Stripkiller') -eventNodeKiller.Nodes = [ '/Event/AllStreams', '/Event/Strip' ] - -from DSTWriters.microdstelements import * -from DSTWriters.Configuration import (SelDSTWriter, - stripDSTStreamConf, - stripDSTElements - ) -SelDSTWriterElements = { - 'default' : stripDSTElements() - } -SelDSTWriterConf = { - 'default' : stripDSTStreamConf() - } -dstWriter = SelDSTWriter( "MyDSTWriter", - StreamConf = SelDSTWriterConf, - MicroDSTElements = SelDSTWriterElements, - OutputFileSuffix ='MC', - SelectionSequences = sc.activeStreams() - ) - -########################### -from Gaudi.Configuration import * -from Configurables import DecayTreeTuple, LoKi__Hybrid__TupleTool, TupleToolDecay, TupleToolTrigger, TupleToolANNPID,L0TriggerTisTos, Hlt2TriggerTisTos, TriggerTisTos -from Configurables import TupleToolTISTOS,TupleToolKinematic,TupleToolTrackInfo, TupleToolEventInfo, TupleToolRecoStats, TupleToolPid, TupleToolAngles,TupleToolPrimaries -from Configurables import MCDecayTreeTuple, LoKi__Hybrid__MCTupleTool, MCTupleToolKinematic -tuple_Lcmu = DecayTreeTuple( 'tuple_Lcmu' ) - -tupletoolList = ["TupleToolKinematic", - "TupleToolGeometry", - "TupleToolPrimaries", - "TupleToolRecoStats", - "TupleToolAngles", - "TupleToolPid", - "TupleToolANNPID", - "TupleToolTrigger", - "TupleToolTrackInfo", - "TupleToolEventInfo"]; - -TISTOSTool = TupleToolTISTOS('TISTOSTool') -TISTOSTool.VerboseL0 = 1 -TISTOSTool.VerboseHlt1 = 1 -TISTOSTool.VerboseHlt2 = 1 -triggerList = ['L0MuonDecision', - 'L0HadronDecision', - 'Hlt1SingleMuonNoIPDecision', - 'Hlt1SingleMuonHighPTDecision', - 'Hlt1TrackAllL0Decision', - 'Hlt1TrackMVADecision', - 'Hlt1TrackMuonMVADecision', - 'Hlt1TwoTrackMVADecision', - 'Hlt1TrackMVADecision', - 'Hlt1TrackMuonDecision', - 'Hlt2SingleMuonDecision', - 'Hlt2TopoMu2BodyDecision', - 'Hlt2TopoMu3BodyDecision', - 'Hlt2TopoMu4BodyDecision', - 'Hlt2Topo2BodyDecision', - 'Hlt2Topo3BodyDecision', - 'Hlt2Topo4BodyDecision'] - - -TISTOSTool = TupleToolTISTOS('TISTOSTool') -TISTOSTool.VerboseL0 = True -TISTOSTool.VerboseHlt1 = True -TISTOSTool.VerboseHlt2 = True -TISTOSTool.TriggerList = triggerList[:] -TISTOSTool.addTool(L0TriggerTisTos()) -TISTOSTool.addTool( TriggerTisTos, name="TriggerTisTos") -TISTOSTool.TriggerTisTos.TOSFracEcal = 0. -TISTOSTool.TriggerTisTos.TOSFracHcal = 0. -TISTOSTool.TriggerTisTos.TOSFracMuon = 0. - -HltTT = Hlt2TriggerTisTos() -HltTT.TOSFracEcal = 0. -HltTT.TOSFracHcal = 0. -HltTT.TOSFracMuon = 0. -HltTT.TISFracEcal = 0. -HltTT.TISFracHcal = 0. -TISTOSTool.addTool(HltTT) - - -tuple_Lcmu.Decay = '[Lambda_b0 -> ^(Lambda_c+ -> ^K- ^p+ ^pi+) ^mu-]CC' -tuple_Lcmu.Branches = { - "Lb" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ pi+) mu-]CC", - "Lc" : "[Lambda_b0 -> ^(Lambda_c+ -> K- p+ pi+) mu-]CC", - "Kminus" : "[Lambda_b0 -> (Lambda_c+ -> ^K- p+ pi+) mu-]CC", - "muminus" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ pi+) ^mu-]CC", - "piplus" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ ^pi+) mu-]CC", - "pplus" : "[Lambda_b0 -> (Lambda_c+ -> K- ^p+ pi+) mu-]CC", -} - -tuple_Lcmu.ToolList = tupletoolList[:] - -tuple_Lcmu.addTupleTool(TupleToolDecay, name="Kminus") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="muminus") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="piplus") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="Lb") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="Lc") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="pplus") - -tuple_Lcmu.muminus.addTupleTool(TISTOSTool, name="TISTOSTool") -tuple_Lcmu.Lc.addTupleTool(TISTOSTool, name="TISTOSTool") -tuple_Lcmu.Lb.addTupleTool(TISTOSTool, name="TISTOSTool") - -tuple_Lcmu.addTool(TupleToolKinematic) -tuple_Lcmu.TupleToolKinematic.Verbose = 1 -tuple_Lcmu.ReFitPVs = True - -LoKi_Mu = LoKi__Hybrid__TupleTool("LoKi_Mu") -LoKi_Mu.Variables = {"NSHAREDMU" : "NSHAREDMU", - "TRCHI2DOF" : "TRCHI2DOF" - } - -LoKi_Lb = LoKi__Hybrid__TupleTool("LoKi_Lb") -LoKi_Lb.Variables = {"Best_PV_CORRM" : "BPVCORRM", - "Best_PV_Eta" : "BPVETA", - "BPVDIRA" : "BPVDIRA", - "MM" : "MM"} - - - -#tuple_Lcmu.muminus.ToolList += ["LoKi::Hybrid::TupleTool/LoKi_Mu"] -tuple_Lcmu.muminus.addTupleTool(LoKi_Mu) -tuple_Lcmu.Lb.addTupleTool(LoKi_Lb) - - -from Configurables import MCMatchObjP2MCRelator - -mctruth = tuple_Lcmu.addTupleTool("TupleToolMCTruth") -default_rel_locs = MCMatchObjP2MCRelator().getDefaultProperty('RelTableLocations') -rel_locs = [loc for loc in default_rel_locs if 'Turbo' not in loc] -#mctruth.IP2MCPAssociatorType = 'MCMatchObjP2MCRelator' -mctruth.ToolList = ['MCTupleToolKinematic','MCTupleToolHierarchy'] -mctruth.addTool(MCMatchObjP2MCRelator) -mctruth.MCMatchObjP2MCRelator.RelTableLocations = rel_locs -mctruth.Verbose=True - - -from Configurables import TupleToolMCTruth, TupleToolMCBackgroundInfo, BackgroundCategory -tuple_Lcmu.addTupleTool(TupleToolMCTruth, name = "TruthTool") -tuple_Lcmu.addTupleTool(TupleToolMCBackgroundInfo,name="TupleToolMCBackgroundInfo"); - - - - - - - - -tuple_Lcmu_WSmu = tuple_Lcmu.clone("tuple_Lcmu_WSmu") -tuple_Lcmu_WSmu.Decay = '[Lambda_b0 -> ^(Lambda_c+ -> ^K- ^p+ ^pi+) ^mu+]CC' -tuple_Lcmu_WSmu.Branches = { - "M" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ pi+) mu+]CC", - "Lc" : "[Lambda_b0 -> ^(Lambda_c+ -> K- p+ pi+) mu+]CC", - "Kminus" : "[Lambda_b0 -> (Lambda_c+ -> ^K- p+ pi+) mu+]CC", - "muminus" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ pi+) ^mu+]CC", - "piplus" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ ^pi+) mu+]CC", - "pplus" : "[Lambda_b0 -> (Lambda_c+ -> K- ^p+ pi+) mu+]CC", -} - - -LoKi_Photos = LoKi__Hybrid__MCTupleTool("LoKi_Photos") -LoKi_Photos.Variables = { - "nPhotons" : "MCNINTREE ( ('gamma'==MCABSID) )", - "MC_PT" : "MCPT", - "MC_THETA" : "MCTHETA", - "MC_ETA" : "MCETA", - "MC_ABSID" : "MCABSID" - } - -################################## -# MC Tuples # -################################## - -mctuple_Lcpipi = MCDecayTreeTuple("mctuple_Lcpipi") -mctuple_Lcpipi.Decay = "[Lambda_b0 ==> ^(Lambda_c(2595)+ ==> ^(Lambda_c+ ==> ^p+ ^K- ^pi+) ^pi+ ^pi-) ^mu- ^nu_mu~]CC" -mctuple_Lcpipi.Branches = { - 'Lb' : "[Lambda_b0 ==> (Lambda_c(2595)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'Lcst' : "[Lambda_b0 ==> ^(Lambda_c(2595)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'Lc' : "[Lambda_b0 ==> (Lambda_c(2595)+ ==> ^(Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'muminus' : "[Lambda_b0 ==> (Lambda_c(2595)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) ^mu- nu_mu~ {X} {X} {X} {X}]CC", - 'nu' : "[Lambda_b0 ==> (Lambda_c(2595)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- ^nu_mu~ {X} {X} {X} {X}]CC", - 'pplus' : "[Lambda_b0 ==> (Lambda_c(2595)+ ==> (Lambda_c+ ==> ^p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'Kminus' : "[Lambda_b0 ==> (Lambda_c(2595)+ ==> (Lambda_c+ ==> p+ ^K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'piplus' : "[Lambda_b0 ==> (Lambda_c(2595)+ ==> (Lambda_c+ ==> p+ K- ^pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'pi1' : "[Lambda_b0 ==> (Lambda_c(2595)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) ^pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'pi2' : "[Lambda_b0 ==> (Lambda_c(2595)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ ^pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC" - } - -mctuple_Lcpipi.addTool(MCTupleToolKinematic()) -mctuple_Lcpipi.MCTupleToolKinematic.Verbose=True -mctuple_Lcpipi.addTupleTool(LoKi_Photos) -mctuple_Lcpipi.ToolList = [ "MCTupleToolHierarchy", - "MCTupleToolKinematic", - "LoKi::Hybrid::MCTupleTool/LoKi_Photos" - ] - -########################### - - -tuple_Lcmu.Inputs = [Lb2Lcmu_selseq.outputLocation()] -tuple_Lcmu_WSmu.Inputs = [Lb2Lcmu_selseq.outputLocation()] - -from Configurables import DaVinci, DaVinciInit, XmlParserSvc -dv = DaVinci() -# dv.Simulation = True -# dv.Lumi = False -dv.appendToMainSequence([eventNodeKiller]) -dv.appendToMainSequence([sc.sequence()]) -dv.appendToMainSequence([ Lb2Lcmu_selseq.sequence(), tuple_Lcmu,tuple_Lcmu_WSmu,mctuple_Lcpipi]) -dv.UserAlgorithms = [Lb2Lcmu_selseq, tuple_Lcmu, tuple_Lcmu_WSmu, mctuple_Lcpipi] -# dv.TupleFile = "2017_Lc4_Lcmu_MCTuple.root" -# dv.DataType = "2017" -# dv.PrintFreq = 100 -# dv.EvtMax = nEvt - -MessageSvc().Format = "% F%60W%S%7W%R%T %0W%M" -DaVinciInit().OutputLevel = ERROR -MessageSvc().OutputLevel = 4 -ToolSvc().OutputLevel = 4 - - -# from Gaudi.Configuration import * -# from GaudiConf import IOHelper -# IOHelper().inputFiles(['/afs/cern.ch/user/x/xliang/cernBox/DVtest/Lc4.dst'],clear=True) diff --git a/vcbLcst2017/DV_MC_2017_Lc2_Lcmu.py b/vcbLcst2017/DV_MC_2017_Lc2_Lcmu.py deleted file mode 100644 index 0968782409..0000000000 --- a/vcbLcst2017/DV_MC_2017_Lc2_Lcmu.py +++ /dev/null @@ -1,331 +0,0 @@ -################## -nEvt = -1 -MODE = 'MC' -################## - -from Gaudi.Configuration import * -from Configurables import DecayTreeTuple, MCDecayTreeTuple, DaVinci, GaudiSequencer, DaVinciInit, XmlParserSvc, OfflineVertexFitter -from Configurables import LoKi__HDRFilter as StripFilter -from Configurables import FilterDesktop, FilterInTrees, PrintDecayTree, CombineParticles, OfflineVertexFitter, CheckPV, CondDB - -from DecayTreeTuple.Configuration import * -from PhysSelPython.Wrappers import DataOnDemand -from PhysConf.Selections import Selection, SelectionSequence, AutomaticData, CombineSelection - -from StandardParticles import StdNoPIDsPions as Pions -from StandardParticles import StdNoPIDsKaons as Kaons -from StandardParticles import StdNoPIDsProtons as Protons -from StandardParticles import StdLoosePions as LoosePions - -import GaudiKernel.SystemOfUnits as Units - - -Lb_comb = "(AMAXDOCA('') <0.5*mm)" -cut_Lb = "(BPVDIRA > 0.999) & (MM>2*GeV) & (MM<8*GeV)" -Lc_comb = "ADAMASS('Lambda_c+')<80*MeV" - -cut_mu ={'mu-': "(PT > 1000*MeV) & (P > 6000*MeV) & (TRCHI2DOF < 3)"} - - - -cut_Lc = "(VFASPF(VCHI2/VDOF) < 6) & (BPVVDCHI2 > 25)" -cut_Kppi = {'K-' : "(PT > 250*MeV) & (P > 2000*MeV) & (TRCHI2DOF < 3)", - 'p+' : "(PT > 250*MeV) & (P > 8000*MeV) & (TRCHI2DOF < 3)", - 'pi+': "(PT > 250*MeV) & (P > 2000*MeV) & (TRCHI2DOF < 3)"} - - -Particles = 'Phys/B2DMuNuX_Lc/Particles' - -mu_list = FilterInTrees('mu_list',Code="'mu-'==ABSID") -mu_sel = Selection('mu_sel', - Algorithm=mu_list, - RequiredSelections=[AutomaticData(Location=Particles)]) - -pkpi_list = FilterInTrees('pkpi_list',Code="DECTREE('[Lambda_c+ -> p+ K- pi+]CC')") - -pkpi_sel = Selection('pkpi_sel', - Algorithm = pkpi_list, - RequiredSelections=[AutomaticData(Location=Particles)]) - -Lb2Lcmu = CombineParticles('Lb2Lcmu', - DecayDescriptors = ['[Lambda_b0 -> Lambda_c+ mu-]cc','[Lambda_b0 -> Lambda_c+ mu+]cc'], - CombinationCut="(AM<6.2*GeV)", - DaughtersCuts=cut_mu, - MotherCut = cut_Lb, - ReFitPVs = True) - -Lb2Lcmu_sel = Selection('Lb2Lcmu_sel', - Algorithm = Lb2Lcmu, - RequiredSelections=[mu_sel,pkpi_sel]) - -Lb2Lcmu_selseq = SelectionSequence('Lb2Lcmu_selseq', TopSelection = Lb2Lcmu_sel) - - -from StrippingConf.Configuration import StrippingConf, StrippingStream -from StrippingSettings.Utils import strippingConfiguration -from StrippingArchive.Utils import buildStreams -from StrippingArchive import strippingArchive -import shelve - -strippingVersion = 'stripping29r2' -config_db = strippingConfiguration(strippingVersion) -config = dict(config_db) # need to do this since the config_db is read-only -config['B2DMuNuX']['CONFIG']['UseNoPIDsInputs'] = True -config['B2DMuNuX']['CONFIG']['MuonPIDmu'] = -1000. -config['B2DMuNuX']['CONFIG']['ProtonPIDp'] = -1000. -config['B2DMuNuX']['CONFIG']['ProtonPIDpK'] = -1000. -config['B2DMuNuX']['CONFIG']['KaonPIDK'] = -1000. -config['B2DMuNuX']['CONFIG']['PionPIDK'] = 1000. -config['B2DMuNuX']['CONFIG']['ElectronPIDe'] = -1000. -config['B2DMuNuX']['CONFIG']['HLT2'] = "HLT_PASS_RE('Hlt2.*Decision')" -config['B2DMuNuX']['CONFIG']['TTSpecs'] = {} -config_db_updated = shelve.open('tmp_stripping_config.db') -config_db_updated.update(config) - - -#####get the line builders from the archive -archive = strippingArchive(strippingVersion) -myWG = "Semileptonic" - -streams = buildStreams(stripping = config_db_updated, archive = archive, WGs = myWG) - - -from Configurables import ProcStatusCheck -filterBadEvents = ProcStatusCheck() -sc = StrippingConf( Streams = streams, - MaxCandidates = 2000, - AcceptBadEvents = False, - BadEventSelection = filterBadEvents, - TESPrefix = 'Strip' ) - -from Configurables import StrippingReport -sr = StrippingReport(Selections = sc.selections()) -sr.OnlyPositive = False - -from Configurables import EventNodeKiller -eventNodeKiller = EventNodeKiller('Stripkiller') -eventNodeKiller.Nodes = [ '/Event/AllStreams', '/Event/Strip' ] - -from DSTWriters.microdstelements import * -from DSTWriters.Configuration import (SelDSTWriter, - stripDSTStreamConf, - stripDSTElements - ) -SelDSTWriterElements = { - 'default' : stripDSTElements() - } -SelDSTWriterConf = { - 'default' : stripDSTStreamConf() - } -dstWriter = SelDSTWriter( "MyDSTWriter", - StreamConf = SelDSTWriterConf, - MicroDSTElements = SelDSTWriterElements, - OutputFileSuffix ='MC', - SelectionSequences = sc.activeStreams() - ) - -########################### -from Gaudi.Configuration import * -from Configurables import DecayTreeTuple, LoKi__Hybrid__TupleTool, TupleToolDecay, TupleToolTrigger, TupleToolANNPID,L0TriggerTisTos, Hlt2TriggerTisTos, TriggerTisTos -from Configurables import TupleToolTISTOS,TupleToolKinematic,TupleToolTrackInfo, TupleToolEventInfo, TupleToolRecoStats, TupleToolPid, TupleToolAngles,TupleToolPrimaries -from Configurables import MCDecayTreeTuple, LoKi__Hybrid__MCTupleTool, MCTupleToolKinematic -tuple_Lcmu = DecayTreeTuple( 'tuple_Lcmu' ) - -tupletoolList = ["TupleToolKinematic", - "TupleToolGeometry", - "TupleToolPrimaries", - "TupleToolRecoStats", - "TupleToolAngles", - "TupleToolPid", - "TupleToolANNPID", - "TupleToolTrigger", - "TupleToolTrackInfo", - "TupleToolEventInfo"]; - -TISTOSTool = TupleToolTISTOS('TISTOSTool') -TISTOSTool.VerboseL0 = 1 -TISTOSTool.VerboseHlt1 = 1 -TISTOSTool.VerboseHlt2 = 1 -triggerList = ['L0MuonDecision', - 'L0HadronDecision', - 'Hlt1SingleMuonNoIPDecision', - 'Hlt1SingleMuonHighPTDecision', - 'Hlt1TrackAllL0Decision', - 'Hlt1TrackMVADecision', - 'Hlt1TrackMuonMVADecision', - 'Hlt1TwoTrackMVADecision', - 'Hlt1TrackMVADecision', - 'Hlt1TrackMuonDecision', - 'Hlt2SingleMuonDecision', - 'Hlt2TopoMu2BodyDecision', - 'Hlt2TopoMu3BodyDecision', - 'Hlt2TopoMu4BodyDecision', - 'Hlt2Topo2BodyDecision', - 'Hlt2Topo3BodyDecision', - 'Hlt2Topo4BodyDecision'] - - -TISTOSTool = TupleToolTISTOS('TISTOSTool') -TISTOSTool.VerboseL0 = True -TISTOSTool.VerboseHlt1 = True -TISTOSTool.VerboseHlt2 = True -TISTOSTool.TriggerList = triggerList[:] -TISTOSTool.addTool(L0TriggerTisTos()) -TISTOSTool.addTool( TriggerTisTos, name="TriggerTisTos") -TISTOSTool.TriggerTisTos.TOSFracEcal = 0. -TISTOSTool.TriggerTisTos.TOSFracHcal = 0. -TISTOSTool.TriggerTisTos.TOSFracMuon = 0. - -HltTT = Hlt2TriggerTisTos() -HltTT.TOSFracEcal = 0. -HltTT.TOSFracHcal = 0. -HltTT.TOSFracMuon = 0. -HltTT.TISFracEcal = 0. -HltTT.TISFracHcal = 0. -TISTOSTool.addTool(HltTT) - - -tuple_Lcmu.Decay = '[Lambda_b0 -> ^(Lambda_c+ -> ^K- ^p+ ^pi+) ^mu-]CC' -tuple_Lcmu.Branches = { - "Lb" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ pi+) mu-]CC", - "Lc" : "[Lambda_b0 -> ^(Lambda_c+ -> K- p+ pi+) mu-]CC", - "Kminus" : "[Lambda_b0 -> (Lambda_c+ -> ^K- p+ pi+) mu-]CC", - "muminus" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ pi+) ^mu-]CC", - "piplus" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ ^pi+) mu-]CC", - "pplus" : "[Lambda_b0 -> (Lambda_c+ -> K- ^p+ pi+) mu-]CC", -} - -tuple_Lcmu.ToolList = tupletoolList[:] - -tuple_Lcmu.addTupleTool(TupleToolDecay, name="Kminus") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="muminus") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="piplus") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="Lb") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="Lc") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="pplus") - -tuple_Lcmu.muminus.addTupleTool(TISTOSTool, name="TISTOSTool") -tuple_Lcmu.Lc.addTupleTool(TISTOSTool, name="TISTOSTool") -tuple_Lcmu.Lb.addTupleTool(TISTOSTool, name="TISTOSTool") - -tuple_Lcmu.addTool(TupleToolKinematic) -tuple_Lcmu.TupleToolKinematic.Verbose = 1 -tuple_Lcmu.ReFitPVs = True - -LoKi_Mu = LoKi__Hybrid__TupleTool("LoKi_Mu") -LoKi_Mu.Variables = {"NSHAREDMU" : "NSHAREDMU", - "TRCHI2DOF" : "TRCHI2DOF" - } - -LoKi_Lb = LoKi__Hybrid__TupleTool("LoKi_Lb") -LoKi_Lb.Variables = {"Best_PV_CORRM" : "BPVCORRM", - "Best_PV_Eta" : "BPVETA", - "BPVDIRA" : "BPVDIRA", - "MM" : "MM"} - - - -#tuple_Lcmu.muminus.ToolList += ["LoKi::Hybrid::TupleTool/LoKi_Mu"] -tuple_Lcmu.muminus.addTupleTool(LoKi_Mu) -tuple_Lcmu.Lb.addTupleTool(LoKi_Lb) - - -from Configurables import MCMatchObjP2MCRelator - -mctruth = tuple_Lcmu.addTupleTool("TupleToolMCTruth") -default_rel_locs = MCMatchObjP2MCRelator().getDefaultProperty('RelTableLocations') -rel_locs = [loc for loc in default_rel_locs if 'Turbo' not in loc] -#mctruth.IP2MCPAssociatorType = 'MCMatchObjP2MCRelator' -mctruth.ToolList = ['MCTupleToolKinematic','MCTupleToolHierarchy'] -mctruth.addTool(MCMatchObjP2MCRelator) -mctruth.MCMatchObjP2MCRelator.RelTableLocations = rel_locs -mctruth.Verbose=True - - -from Configurables import TupleToolMCTruth, TupleToolMCBackgroundInfo, BackgroundCategory -tuple_Lcmu.addTupleTool(TupleToolMCTruth, name = "TruthTool") -tuple_Lcmu.addTupleTool(TupleToolMCBackgroundInfo,name="TupleToolMCBackgroundInfo"); - - - - - - - - -tuple_Lcmu_WSmu = tuple_Lcmu.clone("tuple_Lcmu_WSmu") -tuple_Lcmu_WSmu.Decay = '[Lambda_b0 -> ^(Lambda_c+ -> ^K- ^p+ ^pi+) ^mu+]CC' -tuple_Lcmu_WSmu.Branches = { - "M" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ pi+) mu+]CC", - "Lc" : "[Lambda_b0 -> ^(Lambda_c+ -> K- p+ pi+) mu+]CC", - "Kminus" : "[Lambda_b0 -> (Lambda_c+ -> ^K- p+ pi+) mu+]CC", - "muminus" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ pi+) ^mu+]CC", - "piplus" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ ^pi+) mu+]CC", - "pplus" : "[Lambda_b0 -> (Lambda_c+ -> K- ^p+ pi+) mu+]CC", -} - - -LoKi_Photos = LoKi__Hybrid__MCTupleTool("LoKi_Photos") -LoKi_Photos.Variables = { - "nPhotons" : "MCNINTREE ( ('gamma'==MCABSID) )", - "MC_PT" : "MCPT", - "MC_THETA" : "MCTHETA", - "MC_ETA" : "MCETA", - "MC_ABSID" : "MCABSID" - } - -################################## -# MC Tuples # -################################## - -mctuple_Lcpipi = MCDecayTreeTuple("mctuple_Lcpipi") -mctuple_Lcpipi.Decay = "[Lambda_b0 ==> ^(Lambda_c(2625)+ ==> ^(Lambda_c+ ==> ^p+ ^K- ^pi+) ^pi+ ^pi-) ^mu- ^nu_mu~]CC" -mctuple_Lcpipi.Branches = { - 'Lb' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'Lcst' : "[Lambda_b0 ==> ^(Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'Lc' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> ^(Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'muminus' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) ^mu- nu_mu~ {X} {X} {X} {X}]CC", - 'nu' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- ^nu_mu~ {X} {X} {X} {X}]CC", - 'pplus' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> ^p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'Kminus' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ ^K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'piplus' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- ^pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'pi1' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) ^pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'pi2' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ ^pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC" - } - -mctuple_Lcpipi.addTool(MCTupleToolKinematic()) -mctuple_Lcpipi.MCTupleToolKinematic.Verbose=True -mctuple_Lcpipi.addTupleTool(LoKi_Photos) -mctuple_Lcpipi.ToolList = [ "MCTupleToolHierarchy", - "MCTupleToolKinematic", - "LoKi::Hybrid::MCTupleTool/LoKi_Photos" - ] - -########################### - - -tuple_Lcmu.Inputs = [Lb2Lcmu_selseq.outputLocation()] -tuple_Lcmu_WSmu.Inputs = [Lb2Lcmu_selseq.outputLocation()] - -from Configurables import DaVinci, DaVinciInit, XmlParserSvc -dv = DaVinci() -# dv.Simulation = True -# dv.Lumi = False -dv.appendToMainSequence([eventNodeKiller]) -dv.appendToMainSequence([sc.sequence()]) -dv.appendToMainSequence([ Lb2Lcmu_selseq.sequence(), tuple_Lcmu,tuple_Lcmu_WSmu,mctuple_Lcpipi]) -dv.UserAlgorithms = [Lb2Lcmu_selseq, tuple_Lcmu, tuple_Lcmu_WSmu, mctuple_Lcpipi] -# dv.TupleFile = "2017_Lc4_Lcmu_MCTuple.root" -# dv.DataType = "2017" -# dv.PrintFreq = 100 -# dv.EvtMax = nEvt - -MessageSvc().Format = "% F%60W%S%7W%R%T %0W%M" -DaVinciInit().OutputLevel = ERROR -MessageSvc().OutputLevel = 4 -ToolSvc().OutputLevel = 4 - - -# from Gaudi.Configuration import * -# from GaudiConf import IOHelper -# IOHelper().inputFiles(['/afs/cern.ch/user/x/xliang/cernBox/DVtest/Lc4.dst'],clear=True) diff --git a/vcbLcst2017/DV_MC_2017_Lc3_Lcmu.py b/vcbLcst2017/DV_MC_2017_Lc3_Lcmu.py deleted file mode 100644 index 37c24c8721..0000000000 --- a/vcbLcst2017/DV_MC_2017_Lc3_Lcmu.py +++ /dev/null @@ -1,347 +0,0 @@ -################## -nEvt = -1 -MODE = 'MC' -################## - -from Gaudi.Configuration import * -from Configurables import DecayTreeTuple, MCDecayTreeTuple, DaVinci, GaudiSequencer, DaVinciInit, XmlParserSvc, OfflineVertexFitter -from Configurables import LoKi__HDRFilter as StripFilter -from Configurables import FilterDesktop, FilterInTrees, PrintDecayTree, CombineParticles, OfflineVertexFitter, CheckPV, CondDB - -from DecayTreeTuple.Configuration import * -from PhysSelPython.Wrappers import DataOnDemand -from PhysConf.Selections import Selection, SelectionSequence, AutomaticData, CombineSelection - -from StandardParticles import StdNoPIDsPions as Pions -from StandardParticles import StdNoPIDsKaons as Kaons -from StandardParticles import StdNoPIDsProtons as Protons -from StandardParticles import StdLoosePions as LoosePions - -import GaudiKernel.SystemOfUnits as Units - - -Lb_comb = "(AMAXDOCA('') <0.5*mm)" -cut_Lb = "(BPVDIRA > 0.999) & (MM>2*GeV) & (MM<8*GeV)" -Lc_comb = "ADAMASS('Lambda_c+')<80*MeV" - -cut_mu ={'mu-': "(PT > 1000*MeV) & (P > 6000*MeV) & (TRCHI2DOF < 3)"} - - - -cut_Lc = "(VFASPF(VCHI2/VDOF) < 6) & (BPVVDCHI2 > 25)" -cut_Kppi = {'K-' : "(PT > 250*MeV) & (P > 2000*MeV) & (TRCHI2DOF < 3)", - 'p+' : "(PT > 250*MeV) & (P > 8000*MeV) & (TRCHI2DOF < 3)", - 'pi+': "(PT > 250*MeV) & (P > 2000*MeV) & (TRCHI2DOF < 3)"} - - -Particles = 'Phys/B2DMuNuX_Lc/Particles' - -mu_list = FilterInTrees('mu_list',Code="'mu-'==ABSID") -mu_sel = Selection('mu_sel', - Algorithm=mu_list, - RequiredSelections=[AutomaticData(Location=Particles)]) - -pkpi_list = FilterInTrees('pkpi_list',Code="DECTREE('[Lambda_c+ -> p+ K- pi+]CC')") - -pkpi_sel = Selection('pkpi_sel', - Algorithm = pkpi_list, - RequiredSelections=[AutomaticData(Location=Particles)]) - -Lb2Lcmu = CombineParticles('Lb2Lcmu', - DecayDescriptors = ['[Lambda_b0 -> Lambda_c+ mu-]cc','[Lambda_b0 -> Lambda_c+ mu+]cc'], - CombinationCut="(AM<6.2*GeV)", - DaughtersCuts=cut_mu, - MotherCut = cut_Lb, - ReFitPVs = True) - -Lb2Lcmu_sel = Selection('Lb2Lcmu_sel', - Algorithm = Lb2Lcmu, - RequiredSelections=[mu_sel,pkpi_sel]) - -Lb2Lcmu_selseq = SelectionSequence('Lb2Lcmu_selseq', TopSelection = Lb2Lcmu_sel) - - -from StrippingConf.Configuration import StrippingConf, StrippingStream -from StrippingSettings.Utils import strippingConfiguration -from StrippingArchive.Utils import buildStreams -from StrippingArchive import strippingArchive -import shelve - -strippingVersion = 'stripping29r2' -config_db = strippingConfiguration(strippingVersion) -config = dict(config_db) # need to do this since the config_db is read-only -config['B2DMuNuX']['CONFIG']['UseNoPIDsInputs'] = True -config['B2DMuNuX']['CONFIG']['MuonPIDmu'] = -1000. -config['B2DMuNuX']['CONFIG']['ProtonPIDp'] = -1000. -config['B2DMuNuX']['CONFIG']['ProtonPIDpK'] = -1000. -config['B2DMuNuX']['CONFIG']['KaonPIDK'] = -1000. -config['B2DMuNuX']['CONFIG']['PionPIDK'] = 1000. -config['B2DMuNuX']['CONFIG']['ElectronPIDe'] = -1000. -config['B2DMuNuX']['CONFIG']['HLT2'] = "HLT_PASS_RE('Hlt2.*Decision')" -config['B2DMuNuX']['CONFIG']['TTSpecs'] = {} -config_db_updated = shelve.open('tmp_stripping_config.db') -config_db_updated.update(config) - - -#####get the line builders from the archive -archive = strippingArchive(strippingVersion) -myWG = "Semileptonic" - -streams = buildStreams(stripping = config_db_updated, archive = archive, WGs = myWG) - - -from Configurables import ProcStatusCheck -filterBadEvents = ProcStatusCheck() -sc = StrippingConf( Streams = streams, - MaxCandidates = 2000, - AcceptBadEvents = False, - BadEventSelection = filterBadEvents, - TESPrefix = 'Strip' ) - -from Configurables import StrippingReport -sr = StrippingReport(Selections = sc.selections()) -sr.OnlyPositive = False - -from Configurables import EventNodeKiller -eventNodeKiller = EventNodeKiller('Stripkiller') -eventNodeKiller.Nodes = [ '/Event/AllStreams', '/Event/Strip' ] - -from DSTWriters.microdstelements import * -from DSTWriters.Configuration import (SelDSTWriter, - stripDSTStreamConf, - stripDSTElements - ) -SelDSTWriterElements = { - 'default' : stripDSTElements() - } -SelDSTWriterConf = { - 'default' : stripDSTStreamConf() - } -dstWriter = SelDSTWriter( "MyDSTWriter", - StreamConf = SelDSTWriterConf, - MicroDSTElements = SelDSTWriterElements, - OutputFileSuffix ='MC', - SelectionSequences = sc.activeStreams() - ) - -########################### -from Gaudi.Configuration import * -from Configurables import DecayTreeTuple, LoKi__Hybrid__TupleTool, TupleToolDecay, TupleToolTrigger, TupleToolANNPID,L0TriggerTisTos, Hlt2TriggerTisTos, TriggerTisTos -from Configurables import TupleToolTISTOS,TupleToolKinematic,TupleToolTrackInfo, TupleToolEventInfo, TupleToolRecoStats, TupleToolPid, TupleToolAngles,TupleToolPrimaries -from Configurables import MCDecayTreeTuple, LoKi__Hybrid__MCTupleTool, MCTupleToolKinematic -tuple_Lcmu = DecayTreeTuple( 'tuple_Lcmu' ) - -tupletoolList = ["TupleToolKinematic", - "TupleToolGeometry", - "TupleToolPrimaries", - "TupleToolRecoStats", - "TupleToolAngles", - "TupleToolPid", - "TupleToolANNPID", - "TupleToolTrigger", - "TupleToolTrackInfo", - "TupleToolEventInfo"]; - -TISTOSTool = TupleToolTISTOS('TISTOSTool') -TISTOSTool.VerboseL0 = 1 -TISTOSTool.VerboseHlt1 = 1 -TISTOSTool.VerboseHlt2 = 1 -triggerList = ['L0MuonDecision', - 'L0HadronDecision', - 'Hlt1SingleMuonNoIPDecision', - 'Hlt1SingleMuonHighPTDecision', - 'Hlt1TrackAllL0Decision', - 'Hlt1TrackMVADecision', - 'Hlt1TrackMuonMVADecision', - 'Hlt1TwoTrackMVADecision', - 'Hlt1TrackMVADecision', - 'Hlt1TrackMuonDecision', - 'Hlt2SingleMuonDecision', - 'Hlt2TopoMu2BodyDecision', - 'Hlt2TopoMu3BodyDecision', - 'Hlt2TopoMu4BodyDecision', - 'Hlt2Topo2BodyDecision', - 'Hlt2Topo3BodyDecision', - 'Hlt2Topo4BodyDecision'] - - -TISTOSTool = TupleToolTISTOS('TISTOSTool') -TISTOSTool.VerboseL0 = True -TISTOSTool.VerboseHlt1 = True -TISTOSTool.VerboseHlt2 = True -TISTOSTool.TriggerList = triggerList[:] -TISTOSTool.addTool(L0TriggerTisTos()) -TISTOSTool.addTool( TriggerTisTos, name="TriggerTisTos") -TISTOSTool.TriggerTisTos.TOSFracEcal = 0. -TISTOSTool.TriggerTisTos.TOSFracHcal = 0. -TISTOSTool.TriggerTisTos.TOSFracMuon = 0. - -HltTT = Hlt2TriggerTisTos() -HltTT.TOSFracEcal = 0. -HltTT.TOSFracHcal = 0. -HltTT.TOSFracMuon = 0. -HltTT.TISFracEcal = 0. -HltTT.TISFracHcal = 0. -TISTOSTool.addTool(HltTT) - - -tuple_Lcmu.Decay = '[Lambda_b0 -> ^(Lambda_c+ -> ^K- ^p+ ^pi+) ^mu-]CC' -tuple_Lcmu.Branches = { - "Lb" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ pi+) mu-]CC", - "Lc" : "[Lambda_b0 -> ^(Lambda_c+ -> K- p+ pi+) mu-]CC", - "Kminus" : "[Lambda_b0 -> (Lambda_c+ -> ^K- p+ pi+) mu-]CC", - "muminus" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ pi+) ^mu-]CC", - "piplus" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ ^pi+) mu-]CC", - "pplus" : "[Lambda_b0 -> (Lambda_c+ -> K- ^p+ pi+) mu-]CC", -} - -tuple_Lcmu.ToolList = tupletoolList[:] - -tuple_Lcmu.addTupleTool(TupleToolDecay, name="Kminus") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="muminus") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="piplus") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="Lb") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="Lc") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="pplus") - -tuple_Lcmu.muminus.addTupleTool(TISTOSTool, name="TISTOSTool") -tuple_Lcmu.Lc.addTupleTool(TISTOSTool, name="TISTOSTool") -tuple_Lcmu.Lb.addTupleTool(TISTOSTool, name="TISTOSTool") - -tuple_Lcmu.addTool(TupleToolKinematic) -tuple_Lcmu.TupleToolKinematic.Verbose = 1 -tuple_Lcmu.ReFitPVs = True - -LoKi_Mu = LoKi__Hybrid__TupleTool("LoKi_Mu") -LoKi_Mu.Variables = {"NSHAREDMU" : "NSHAREDMU", - "TRCHI2DOF" : "TRCHI2DOF" - } - -LoKi_Lb = LoKi__Hybrid__TupleTool("LoKi_Lb") -LoKi_Lb.Variables = {"Best_PV_CORRM" : "BPVCORRM", - "Best_PV_Eta" : "BPVETA", - "BPVDIRA" : "BPVDIRA", - "MM" : "MM"} - - - -#tuple_Lcmu.muminus.ToolList += ["LoKi::Hybrid::TupleTool/LoKi_Mu"] -tuple_Lcmu.muminus.addTupleTool(LoKi_Mu) -tuple_Lcmu.Lb.addTupleTool(LoKi_Lb) - - -from Configurables import MCMatchObjP2MCRelator - -mctruth = tuple_Lcmu.addTupleTool("TupleToolMCTruth") -default_rel_locs = MCMatchObjP2MCRelator().getDefaultProperty('RelTableLocations') -rel_locs = [loc for loc in default_rel_locs if 'Turbo' not in loc] -#mctruth.IP2MCPAssociatorType = 'MCMatchObjP2MCRelator' -mctruth.ToolList = ['MCTupleToolKinematic','MCTupleToolHierarchy'] -mctruth.addTool(MCMatchObjP2MCRelator) -mctruth.MCMatchObjP2MCRelator.RelTableLocations = rel_locs -mctruth.Verbose=True - - -from Configurables import TupleToolMCTruth, TupleToolMCBackgroundInfo, BackgroundCategory -tuple_Lcmu.addTupleTool(TupleToolMCTruth, name = "TruthTool") -tuple_Lcmu.addTupleTool(TupleToolMCBackgroundInfo,name="TupleToolMCBackgroundInfo"); - - - - - - - - -tuple_Lcmu_WSmu = tuple_Lcmu.clone("tuple_Lcmu_WSmu") -tuple_Lcmu_WSmu.Decay = '[Lambda_b0 -> ^(Lambda_c+ -> ^K- ^p+ ^pi+) ^mu+]CC' -tuple_Lcmu_WSmu.Branches = { - "M" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ pi+) mu+]CC", - "Lc" : "[Lambda_b0 -> ^(Lambda_c+ -> K- p+ pi+) mu+]CC", - "Kminus" : "[Lambda_b0 -> (Lambda_c+ -> ^K- p+ pi+) mu+]CC", - "muminus" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ pi+) ^mu+]CC", - "piplus" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ ^pi+) mu+]CC", - "pplus" : "[Lambda_b0 -> (Lambda_c+ -> K- ^p+ pi+) mu+]CC", -} - - -LoKi_Photos = LoKi__Hybrid__MCTupleTool("LoKi_Photos") -LoKi_Photos.Variables = { - "nPhotons" : "MCNINTREE ( ('gamma'==MCABSID) )", - "MC_PT" : "MCPT", - "MC_THETA" : "MCTHETA", - "MC_ETA" : "MCETA", - "MC_ABSID" : "MCABSID" - } - -################################## -# MC Tuples # -################################## - -mctuple_Lcpipi = MCDecayTreeTuple("mctuple_Lcpipi") -mctuple_Lcpipi.Decay = "[Lambda_b0 ==> ^(Lambda_c(2625)+ ==> ^(Lambda_c+ ==> ^p+ ^K- ^pi+) ^pi+ ^pi-) ^mu- ^nu_mu~]CC" -mctuple_Lcpipi.Branches = { - 'Lb' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'Lcst' : "[Lambda_b0 ==> ^(Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'Lc' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> ^(Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'muminus' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) ^mu- nu_mu~ {X} {X} {X} {X}]CC", - 'nu' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- ^nu_mu~ {X} {X} {X} {X}]CC", - 'pplus' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> ^p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'Kminus' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ ^K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'piplus' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- ^pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'pi1' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) ^pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'pi2' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ ^pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC" - } - -mctuple_Lcpipi.addTool(MCTupleToolKinematic()) -mctuple_Lcpipi.MCTupleToolKinematic.Verbose=True -mctuple_Lcpipi.addTupleTool(LoKi_Photos) -mctuple_Lcpipi.ToolList = [ "MCTupleToolHierarchy", - "MCTupleToolKinematic", - "LoKi::Hybrid::MCTupleTool/LoKi_Photos" - ] - - - - - - - - - - - - - - - - - -########################### - - -tuple_Lcmu.Inputs = [Lb2Lcmu_selseq.outputLocation()] -tuple_Lcmu_WSmu.Inputs = [Lb2Lcmu_selseq.outputLocation()] - -from Configurables import DaVinci, DaVinciInit, XmlParserSvc -dv = DaVinci() -#dv.Simulation = True -#dv.Lumi = False -dv.appendToMainSequence([eventNodeKiller]) -dv.appendToMainSequence([sc.sequence()]) -dv.appendToMainSequence([ Lb2Lcmu_selseq.sequence(), tuple_Lcmu,tuple_Lcmu_WSmu,mctuple_Lcpipi]) -dv.UserAlgorithms = [Lb2Lcmu_selseq, tuple_Lcmu, tuple_Lcmu_WSmu, mctuple_Lcpipi] -#dv.TupleFile = "2017_Lc3_Lcmu_MCTuple.root" -#dv.DataType = "2017" -#dv.PrintFreq = 100 -#dv.EvtMax = nEvt - -MessageSvc().Format = "% F%60W%S%7W%R%T %0W%M" -DaVinciInit().OutputLevel = ERROR -MessageSvc().OutputLevel = 4 -ToolSvc().OutputLevel = 4 - - -# from Gaudi.Configuration import * -# from GaudiConf import IOHelper -# IOHelper().inputFiles(['/afs/cern.ch/user/x/xliang/cernBox/DVtest/Lc3.dst'],clear=True) diff --git a/vcbLcst2017/DV_MC_2017_Lc4_Lcmu.py b/vcbLcst2017/DV_MC_2017_Lc4_Lcmu.py deleted file mode 100644 index 0968782409..0000000000 --- a/vcbLcst2017/DV_MC_2017_Lc4_Lcmu.py +++ /dev/null @@ -1,331 +0,0 @@ -################## -nEvt = -1 -MODE = 'MC' -################## - -from Gaudi.Configuration import * -from Configurables import DecayTreeTuple, MCDecayTreeTuple, DaVinci, GaudiSequencer, DaVinciInit, XmlParserSvc, OfflineVertexFitter -from Configurables import LoKi__HDRFilter as StripFilter -from Configurables import FilterDesktop, FilterInTrees, PrintDecayTree, CombineParticles, OfflineVertexFitter, CheckPV, CondDB - -from DecayTreeTuple.Configuration import * -from PhysSelPython.Wrappers import DataOnDemand -from PhysConf.Selections import Selection, SelectionSequence, AutomaticData, CombineSelection - -from StandardParticles import StdNoPIDsPions as Pions -from StandardParticles import StdNoPIDsKaons as Kaons -from StandardParticles import StdNoPIDsProtons as Protons -from StandardParticles import StdLoosePions as LoosePions - -import GaudiKernel.SystemOfUnits as Units - - -Lb_comb = "(AMAXDOCA('') <0.5*mm)" -cut_Lb = "(BPVDIRA > 0.999) & (MM>2*GeV) & (MM<8*GeV)" -Lc_comb = "ADAMASS('Lambda_c+')<80*MeV" - -cut_mu ={'mu-': "(PT > 1000*MeV) & (P > 6000*MeV) & (TRCHI2DOF < 3)"} - - - -cut_Lc = "(VFASPF(VCHI2/VDOF) < 6) & (BPVVDCHI2 > 25)" -cut_Kppi = {'K-' : "(PT > 250*MeV) & (P > 2000*MeV) & (TRCHI2DOF < 3)", - 'p+' : "(PT > 250*MeV) & (P > 8000*MeV) & (TRCHI2DOF < 3)", - 'pi+': "(PT > 250*MeV) & (P > 2000*MeV) & (TRCHI2DOF < 3)"} - - -Particles = 'Phys/B2DMuNuX_Lc/Particles' - -mu_list = FilterInTrees('mu_list',Code="'mu-'==ABSID") -mu_sel = Selection('mu_sel', - Algorithm=mu_list, - RequiredSelections=[AutomaticData(Location=Particles)]) - -pkpi_list = FilterInTrees('pkpi_list',Code="DECTREE('[Lambda_c+ -> p+ K- pi+]CC')") - -pkpi_sel = Selection('pkpi_sel', - Algorithm = pkpi_list, - RequiredSelections=[AutomaticData(Location=Particles)]) - -Lb2Lcmu = CombineParticles('Lb2Lcmu', - DecayDescriptors = ['[Lambda_b0 -> Lambda_c+ mu-]cc','[Lambda_b0 -> Lambda_c+ mu+]cc'], - CombinationCut="(AM<6.2*GeV)", - DaughtersCuts=cut_mu, - MotherCut = cut_Lb, - ReFitPVs = True) - -Lb2Lcmu_sel = Selection('Lb2Lcmu_sel', - Algorithm = Lb2Lcmu, - RequiredSelections=[mu_sel,pkpi_sel]) - -Lb2Lcmu_selseq = SelectionSequence('Lb2Lcmu_selseq', TopSelection = Lb2Lcmu_sel) - - -from StrippingConf.Configuration import StrippingConf, StrippingStream -from StrippingSettings.Utils import strippingConfiguration -from StrippingArchive.Utils import buildStreams -from StrippingArchive import strippingArchive -import shelve - -strippingVersion = 'stripping29r2' -config_db = strippingConfiguration(strippingVersion) -config = dict(config_db) # need to do this since the config_db is read-only -config['B2DMuNuX']['CONFIG']['UseNoPIDsInputs'] = True -config['B2DMuNuX']['CONFIG']['MuonPIDmu'] = -1000. -config['B2DMuNuX']['CONFIG']['ProtonPIDp'] = -1000. -config['B2DMuNuX']['CONFIG']['ProtonPIDpK'] = -1000. -config['B2DMuNuX']['CONFIG']['KaonPIDK'] = -1000. -config['B2DMuNuX']['CONFIG']['PionPIDK'] = 1000. -config['B2DMuNuX']['CONFIG']['ElectronPIDe'] = -1000. -config['B2DMuNuX']['CONFIG']['HLT2'] = "HLT_PASS_RE('Hlt2.*Decision')" -config['B2DMuNuX']['CONFIG']['TTSpecs'] = {} -config_db_updated = shelve.open('tmp_stripping_config.db') -config_db_updated.update(config) - - -#####get the line builders from the archive -archive = strippingArchive(strippingVersion) -myWG = "Semileptonic" - -streams = buildStreams(stripping = config_db_updated, archive = archive, WGs = myWG) - - -from Configurables import ProcStatusCheck -filterBadEvents = ProcStatusCheck() -sc = StrippingConf( Streams = streams, - MaxCandidates = 2000, - AcceptBadEvents = False, - BadEventSelection = filterBadEvents, - TESPrefix = 'Strip' ) - -from Configurables import StrippingReport -sr = StrippingReport(Selections = sc.selections()) -sr.OnlyPositive = False - -from Configurables import EventNodeKiller -eventNodeKiller = EventNodeKiller('Stripkiller') -eventNodeKiller.Nodes = [ '/Event/AllStreams', '/Event/Strip' ] - -from DSTWriters.microdstelements import * -from DSTWriters.Configuration import (SelDSTWriter, - stripDSTStreamConf, - stripDSTElements - ) -SelDSTWriterElements = { - 'default' : stripDSTElements() - } -SelDSTWriterConf = { - 'default' : stripDSTStreamConf() - } -dstWriter = SelDSTWriter( "MyDSTWriter", - StreamConf = SelDSTWriterConf, - MicroDSTElements = SelDSTWriterElements, - OutputFileSuffix ='MC', - SelectionSequences = sc.activeStreams() - ) - -########################### -from Gaudi.Configuration import * -from Configurables import DecayTreeTuple, LoKi__Hybrid__TupleTool, TupleToolDecay, TupleToolTrigger, TupleToolANNPID,L0TriggerTisTos, Hlt2TriggerTisTos, TriggerTisTos -from Configurables import TupleToolTISTOS,TupleToolKinematic,TupleToolTrackInfo, TupleToolEventInfo, TupleToolRecoStats, TupleToolPid, TupleToolAngles,TupleToolPrimaries -from Configurables import MCDecayTreeTuple, LoKi__Hybrid__MCTupleTool, MCTupleToolKinematic -tuple_Lcmu = DecayTreeTuple( 'tuple_Lcmu' ) - -tupletoolList = ["TupleToolKinematic", - "TupleToolGeometry", - "TupleToolPrimaries", - "TupleToolRecoStats", - "TupleToolAngles", - "TupleToolPid", - "TupleToolANNPID", - "TupleToolTrigger", - "TupleToolTrackInfo", - "TupleToolEventInfo"]; - -TISTOSTool = TupleToolTISTOS('TISTOSTool') -TISTOSTool.VerboseL0 = 1 -TISTOSTool.VerboseHlt1 = 1 -TISTOSTool.VerboseHlt2 = 1 -triggerList = ['L0MuonDecision', - 'L0HadronDecision', - 'Hlt1SingleMuonNoIPDecision', - 'Hlt1SingleMuonHighPTDecision', - 'Hlt1TrackAllL0Decision', - 'Hlt1TrackMVADecision', - 'Hlt1TrackMuonMVADecision', - 'Hlt1TwoTrackMVADecision', - 'Hlt1TrackMVADecision', - 'Hlt1TrackMuonDecision', - 'Hlt2SingleMuonDecision', - 'Hlt2TopoMu2BodyDecision', - 'Hlt2TopoMu3BodyDecision', - 'Hlt2TopoMu4BodyDecision', - 'Hlt2Topo2BodyDecision', - 'Hlt2Topo3BodyDecision', - 'Hlt2Topo4BodyDecision'] - - -TISTOSTool = TupleToolTISTOS('TISTOSTool') -TISTOSTool.VerboseL0 = True -TISTOSTool.VerboseHlt1 = True -TISTOSTool.VerboseHlt2 = True -TISTOSTool.TriggerList = triggerList[:] -TISTOSTool.addTool(L0TriggerTisTos()) -TISTOSTool.addTool( TriggerTisTos, name="TriggerTisTos") -TISTOSTool.TriggerTisTos.TOSFracEcal = 0. -TISTOSTool.TriggerTisTos.TOSFracHcal = 0. -TISTOSTool.TriggerTisTos.TOSFracMuon = 0. - -HltTT = Hlt2TriggerTisTos() -HltTT.TOSFracEcal = 0. -HltTT.TOSFracHcal = 0. -HltTT.TOSFracMuon = 0. -HltTT.TISFracEcal = 0. -HltTT.TISFracHcal = 0. -TISTOSTool.addTool(HltTT) - - -tuple_Lcmu.Decay = '[Lambda_b0 -> ^(Lambda_c+ -> ^K- ^p+ ^pi+) ^mu-]CC' -tuple_Lcmu.Branches = { - "Lb" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ pi+) mu-]CC", - "Lc" : "[Lambda_b0 -> ^(Lambda_c+ -> K- p+ pi+) mu-]CC", - "Kminus" : "[Lambda_b0 -> (Lambda_c+ -> ^K- p+ pi+) mu-]CC", - "muminus" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ pi+) ^mu-]CC", - "piplus" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ ^pi+) mu-]CC", - "pplus" : "[Lambda_b0 -> (Lambda_c+ -> K- ^p+ pi+) mu-]CC", -} - -tuple_Lcmu.ToolList = tupletoolList[:] - -tuple_Lcmu.addTupleTool(TupleToolDecay, name="Kminus") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="muminus") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="piplus") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="Lb") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="Lc") -tuple_Lcmu.addTupleTool(TupleToolDecay, name="pplus") - -tuple_Lcmu.muminus.addTupleTool(TISTOSTool, name="TISTOSTool") -tuple_Lcmu.Lc.addTupleTool(TISTOSTool, name="TISTOSTool") -tuple_Lcmu.Lb.addTupleTool(TISTOSTool, name="TISTOSTool") - -tuple_Lcmu.addTool(TupleToolKinematic) -tuple_Lcmu.TupleToolKinematic.Verbose = 1 -tuple_Lcmu.ReFitPVs = True - -LoKi_Mu = LoKi__Hybrid__TupleTool("LoKi_Mu") -LoKi_Mu.Variables = {"NSHAREDMU" : "NSHAREDMU", - "TRCHI2DOF" : "TRCHI2DOF" - } - -LoKi_Lb = LoKi__Hybrid__TupleTool("LoKi_Lb") -LoKi_Lb.Variables = {"Best_PV_CORRM" : "BPVCORRM", - "Best_PV_Eta" : "BPVETA", - "BPVDIRA" : "BPVDIRA", - "MM" : "MM"} - - - -#tuple_Lcmu.muminus.ToolList += ["LoKi::Hybrid::TupleTool/LoKi_Mu"] -tuple_Lcmu.muminus.addTupleTool(LoKi_Mu) -tuple_Lcmu.Lb.addTupleTool(LoKi_Lb) - - -from Configurables import MCMatchObjP2MCRelator - -mctruth = tuple_Lcmu.addTupleTool("TupleToolMCTruth") -default_rel_locs = MCMatchObjP2MCRelator().getDefaultProperty('RelTableLocations') -rel_locs = [loc for loc in default_rel_locs if 'Turbo' not in loc] -#mctruth.IP2MCPAssociatorType = 'MCMatchObjP2MCRelator' -mctruth.ToolList = ['MCTupleToolKinematic','MCTupleToolHierarchy'] -mctruth.addTool(MCMatchObjP2MCRelator) -mctruth.MCMatchObjP2MCRelator.RelTableLocations = rel_locs -mctruth.Verbose=True - - -from Configurables import TupleToolMCTruth, TupleToolMCBackgroundInfo, BackgroundCategory -tuple_Lcmu.addTupleTool(TupleToolMCTruth, name = "TruthTool") -tuple_Lcmu.addTupleTool(TupleToolMCBackgroundInfo,name="TupleToolMCBackgroundInfo"); - - - - - - - - -tuple_Lcmu_WSmu = tuple_Lcmu.clone("tuple_Lcmu_WSmu") -tuple_Lcmu_WSmu.Decay = '[Lambda_b0 -> ^(Lambda_c+ -> ^K- ^p+ ^pi+) ^mu+]CC' -tuple_Lcmu_WSmu.Branches = { - "M" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ pi+) mu+]CC", - "Lc" : "[Lambda_b0 -> ^(Lambda_c+ -> K- p+ pi+) mu+]CC", - "Kminus" : "[Lambda_b0 -> (Lambda_c+ -> ^K- p+ pi+) mu+]CC", - "muminus" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ pi+) ^mu+]CC", - "piplus" : "[Lambda_b0 -> (Lambda_c+ -> K- p+ ^pi+) mu+]CC", - "pplus" : "[Lambda_b0 -> (Lambda_c+ -> K- ^p+ pi+) mu+]CC", -} - - -LoKi_Photos = LoKi__Hybrid__MCTupleTool("LoKi_Photos") -LoKi_Photos.Variables = { - "nPhotons" : "MCNINTREE ( ('gamma'==MCABSID) )", - "MC_PT" : "MCPT", - "MC_THETA" : "MCTHETA", - "MC_ETA" : "MCETA", - "MC_ABSID" : "MCABSID" - } - -################################## -# MC Tuples # -################################## - -mctuple_Lcpipi = MCDecayTreeTuple("mctuple_Lcpipi") -mctuple_Lcpipi.Decay = "[Lambda_b0 ==> ^(Lambda_c(2625)+ ==> ^(Lambda_c+ ==> ^p+ ^K- ^pi+) ^pi+ ^pi-) ^mu- ^nu_mu~]CC" -mctuple_Lcpipi.Branches = { - 'Lb' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'Lcst' : "[Lambda_b0 ==> ^(Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'Lc' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> ^(Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'muminus' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) ^mu- nu_mu~ {X} {X} {X} {X}]CC", - 'nu' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- ^nu_mu~ {X} {X} {X} {X}]CC", - 'pplus' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> ^p+ K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'Kminus' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ ^K- pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'piplus' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- ^pi+ {X} {X} {X} {X}) pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'pi1' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) ^pi+ pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC", - 'pi2' : "[Lambda_b0 ==> (Lambda_c(2625)+ ==> (Lambda_c+ ==> p+ K- pi+ {X} {X} {X} {X}) pi+ ^pi- {X} {X} {X} {X}) mu- nu_mu~ {X} {X} {X} {X}]CC" - } - -mctuple_Lcpipi.addTool(MCTupleToolKinematic()) -mctuple_Lcpipi.MCTupleToolKinematic.Verbose=True -mctuple_Lcpipi.addTupleTool(LoKi_Photos) -mctuple_Lcpipi.ToolList = [ "MCTupleToolHierarchy", - "MCTupleToolKinematic", - "LoKi::Hybrid::MCTupleTool/LoKi_Photos" - ] - -########################### - - -tuple_Lcmu.Inputs = [Lb2Lcmu_selseq.outputLocation()] -tuple_Lcmu_WSmu.Inputs = [Lb2Lcmu_selseq.outputLocation()] - -from Configurables import DaVinci, DaVinciInit, XmlParserSvc -dv = DaVinci() -# dv.Simulation = True -# dv.Lumi = False -dv.appendToMainSequence([eventNodeKiller]) -dv.appendToMainSequence([sc.sequence()]) -dv.appendToMainSequence([ Lb2Lcmu_selseq.sequence(), tuple_Lcmu,tuple_Lcmu_WSmu,mctuple_Lcpipi]) -dv.UserAlgorithms = [Lb2Lcmu_selseq, tuple_Lcmu, tuple_Lcmu_WSmu, mctuple_Lcpipi] -# dv.TupleFile = "2017_Lc4_Lcmu_MCTuple.root" -# dv.DataType = "2017" -# dv.PrintFreq = 100 -# dv.EvtMax = nEvt - -MessageSvc().Format = "% F%60W%S%7W%R%T %0W%M" -DaVinciInit().OutputLevel = ERROR -MessageSvc().OutputLevel = 4 -ToolSvc().OutputLevel = 4 - - -# from Gaudi.Configuration import * -# from GaudiConf import IOHelper -# IOHelper().inputFiles(['/afs/cern.ch/user/x/xliang/cernBox/DVtest/Lc4.dst'],clear=True) diff --git a/vcbLcst2017/info.yaml b/vcbLcst2017/info.yaml deleted file mode 100644 index 62c4e7a7a3..0000000000 --- a/vcbLcst2017/info.yaml +++ /dev/null @@ -1,39 +0,0 @@ -defaults: - application: DaVinci/v44r7 - wg: SL - automatically_configure: yes - turbo: no - inform: - - xliang@cern.ch - -{%- set datasets = [ - - ('Lc1_MC_17', 'MagDown', 'DV_MC_2017_Lc1_Lcmu.py', '/MC/2017/Beam6500GeV-2017-MagDown-Nu1.6-25ns-Pythia8/Sim09e/Trig0x62661709/Reco17/Turbo04a-WithTurcal/Stripping29r2NoPrescalingFlagged/15576010/ALLSTREAMS.DST'), - ('Lc1_MC_17', 'MagUp', 'DV_MC_2017_Lc1_Lcmu.py', '/MC/2017/Beam6500GeV-2017-MagUp-Nu1.6-25ns-Pythia8/Sim09e/Trig0x62661709/Reco17/Turbo04a-WithTurcal/Stripping29r2NoPrescalingFlagged/15576010/ALLSTREAMS.DST'), - ('Lc1_MC_redecay_17', 'MagDown', 'DV_MC_2017_Lc1_Lcmu.py', '/MC/2017/Beam6500GeV-2017-MagDown-Nu1.6-25ns-Pythia8/Sim09k-ReDecay01/Trig0x62661709/Reco17/Turbo04a-WithTurcal/Stripping29r2NoPrescalingFlagged/15576010/ALLSTREAMS.DST'), - ('Lc1_MC_redecay_17', 'MagUp', 'DV_MC_2017_Lc1_Lcmu.py', '/MC/2017/Beam6500GeV-2017-MagUp-Nu1.6-25ns-Pythia8/Sim09k-ReDecay01/Trig0x62661709/Reco17/Turbo04a-WithTurcal/Stripping29r2NoPrescalingFlagged/15576010/ALLSTREAMS.DST'), - ('Lc2_MC_17', 'MagDown', 'DV_MC_2017_Lc2_Lcmu.py', '/MC/2017/Beam6500GeV-2017-MagDown-Nu1.6-25ns-Pythia8/Sim09e/Trig0x62661709/Reco17/Turbo04a-WithTurcal/Stripping29r2NoPrescalingFlagged/15576011/ALLSTREAMS.DST'), - ('Lc2_MC_17', 'MagUp', 'DV_MC_2017_Lc2_Lcmu.py', '/MC/2017/Beam6500GeV-2017-MagUp-Nu1.6-25ns-Pythia8/Sim09e/Trig0x62661709/Reco17/Turbo04a-WithTurcal/Stripping29r2NoPrescalingFlagged/15576011/ALLSTREAMS.DST'), - ('Lc2_MC_redecay_17', 'MagDown', 'DV_MC_2017_Lc2_Lcmu.py', '/MC/2017/Beam6500GeV-2017-MagDown-Nu1.6-25ns-Pythia8/Sim09k-ReDecay01/Trig0x62661709/Reco17/Turbo04a-WithTurcal/Stripping29r2NoPrescalingFlagged/15576011/ALLSTREAMS.DST'), - ('Lc2_MC_redecay_17', 'MagUp', 'DV_MC_2017_Lc2_Lcmu.py', '/MC/2017/Beam6500GeV-2017-MagUp-Nu1.6-25ns-Pythia8/Sim09k-ReDecay01/Trig0x62661709/Reco17/Turbo04a-WithTurcal/Stripping29r2NoPrescalingFlagged/15576011/ALLSTREAMS.DST'), - ('Lc3_MC_17', 'MagDown', 'DV_MC_2017_Lc3_Lcmu.py', '/MC/2017/Beam6500GeV-2017-MagDown-Nu1.6-25ns-Pythia8/Sim09e/Trig0x62661709/Reco17/Turbo04a-WithTurcal/Stripping29r2NoPrescalingFlagged/15576020/ALLSTREAMS.DST'), - ('Lc3_MC_17', 'MagUp', 'DV_MC_2017_Lc3_Lcmu.py', '/MC/2017/Beam6500GeV-2017-MagUp-Nu1.6-25ns-Pythia8/Sim09e/Trig0x62661709/Reco17/Turbo04a-WithTurcal/Stripping29r2NoPrescalingFlagged/15576020/ALLSTREAMS.DST'), - ('Lc3_MC_redecay_17', 'MagDown', 'DV_MC_2017_Lc3_Lcmu.py', '/MC/2017/Beam6500GeV-2017-MagDown-Nu1.6-25ns-Pythia8/Sim09k-ReDecay01/Trig0x62661709/Reco17/Turbo04a-WithTurcal/Stripping29r2NoPrescalingFlagged/15576020/ALLSTREAMS.DST'), - ('Lc3_MC_redecay_17', 'MagUp', 'DV_MC_2017_Lc3_Lcmu.py', '/MC/2017/Beam6500GeV-2017-MagUp-Nu1.6-25ns-Pythia8/Sim09k-ReDecay01/Trig0x62661709/Reco17/Turbo04a-WithTurcal/Stripping29r2NoPrescalingFlagged/15576020/ALLSTREAMS.DST'), - ('Lc4_MC_17', 'MagDown', 'DV_MC_2017_Lc4_Lcmu.py', '/MC/2017/Beam6500GeV-2017-MagDown-Nu1.6-25ns-Pythia8/Sim09e/Trig0x62661709/Reco17/Turbo04a-WithTurcal/Stripping29r2NoPrescalingFlagged/15576021/ALLSTREAMS.DST'), - ('Lc4_MC_17', 'MagUp', 'DV_MC_2017_Lc4_Lcmu.py', '/MC/2017/Beam6500GeV-2017-MagUp-Nu1.6-25ns-Pythia8/Sim09e/Trig0x62661709/Reco17/Turbo04a-WithTurcal/Stripping29r2NoPrescalingFlagged/15576021/ALLSTREAMS.DST'), - ('Lc4_MC_redecay_17', 'MagDown', 'DV_MC_2017_Lc4_Lcmu.py', '/MC/2017/Beam6500GeV-2017-MagDown-Nu1.6-25ns-Pythia8/Sim09k-ReDecay01/Trig0x62661709/Reco17/Turbo04a-WithTurcal/Stripping29r2NoPrescalingFlagged/15576021/ALLSTREAMS.DST'), - ('Lc4_MC_redecay_17', 'MagUp', 'DV_MC_2017_Lc4_Lcmu.py', '/MC/2017/Beam6500GeV-2017-MagUp-Nu1.6-25ns-Pythia8/Sim09k-ReDecay01/Trig0x62661709/Reco17/Turbo04a-WithTurcal/Stripping29r2NoPrescalingFlagged/15576021/ALLSTREAMS.DST'), - - -]%} - -{%- for mode, polarity, DVfile, BKpath in datasets %} -{{mode}}_{{polarity}}: - input: - bk_query: "{{BKpath}}" - options: - - {{DVfile}} - output: {{mode}}.root -{%- endfor %} - -- GitLab From 5f0949ab7ab13656dc1b1a536912f8933f2464b2 Mon Sep 17 00:00:00 2001 From: Ernest Olivart <ernest.olivart.pino@cern.ch> Date: Wed, 18 Dec 2024 15:34:18 +0100 Subject: [PATCH 3/7] Fixed yaml file --- b2xll_MC24_W31_34/info.yaml | 281 +++++++++++++++++++++++++++++++++++- 1 file changed, 277 insertions(+), 4 deletions(-) diff --git a/b2xll_MC24_W31_34/info.yaml b/b2xll_MC24_W31_34/info.yaml index 4fb1050f33..e6185c9bce 100644 --- a/b2xll_MC24_W31_34/info.yaml +++ b/b2xll_MC24_W31_34/info.yaml @@ -3,15 +3,94 @@ defaults: - ernest.olivart.pino@cern.ch wg: RD -MagUp_BuToKpEE_bu2kee_2024.W31.34_Nu6.3_Tuple: +{%- set b2piee_decays=[ + ("12123021","bu2piee"),("12153020","bu2pijpsi"),("12123001","bu2kee"),("12123003","bu2kee_btosllball05"),("12153001","bu2kjpsi"), + ("12123445","bu2kstee"),("12153420","bu2kstjpsi"),("11124002","bd02kst0ee"),("11124007","bd02kst0ee_flatq2"),("11124009","bd02kst0ee_flatq2_momcut"), + ("11154001","bd02kst0jpsi"),("11154002","bd02kst0jpsi_update2012"),("11154100","bd02ks0Jpsi") +]%} + +{%- set b2kee_decays=[ + ("12123001","bu2kee"),("12123003","bu2kee_btosllball05"),("12153001","bu2kjpsi") +]%} + +{%- set b2pimumu_decays=[ + ("12113024","bu2pimumu"),("12113023","bu2pimumu_Acc"),("12143010","bu2pijpsi"),("12113002","bu2kmumu"),("12113004","bu2kmumu_phsp"), + ("12143001","bu2kjpsi"),("11114002","bd02kst0mumu"),("11114014","bd02kst0mumu_flatq2_momcut"),("11144001","bd02kst0jpsi"), + ("11144002","bd02kst0jpsi_update2012"),("11144103","bd02ks0Jpsi") +]%} + +{%- set b2kmumu_decays=[ + ("12143010","bu2pijpsi"),("12113002","bu2kmumu"),("12113004","bu2kmumu_phsp"),("12143001","bu2kjpsi") +]%} + +{%- set lb2ppiee_decays=[ + ("13154041","Bs2KKJpsi"),("11154001","Bd2KstJpsi"),("11154002","Bd2KstJpsi_update2012"),("15154001","Lb2pKJpsi"), + ("11124002","Bd2Kstee"),("11124007","Bd2Kstee_flatq2"),("11124009","Bd2Kstee_flatq2_momcut"),("15124011","Lb2pKee"), + ("15124021","Lb2ppiee"),("15154021","Lb2ppiJpsi") +]%} + +{%- set lb2pkee_decays=[ + ("15154001","Lb2pKJpsi"),("15124011","Lb2pKee") +]%} + +{%- set lb2ppimumu_decays=[ + ("13144041","Bs2KKJpsi"),("11144001","Bd2KstJpsi"),("11144002","Bd2KstJpsi_update2012"),("15144001","Lb2pKJpsi"), + ("11114002","Bd2Kstmumu"),("11114014","Bd2Kstmumu_flatq2_momcut"),("15114011","Lb2pKmumu"), + ("15114021","Lb2ppimumu"),("15144021","Lb2ppiJpsi") +]%} + +{%- set lb2pkmumu_decays=[ + ("15144001","Lb2pKJpsi"),("15114011","Lb2pKmumu") +]%} + +####################################### +# B+ -> pi+ e+ e- # +# signal, misID and partrecos # +####################################### + +{%- for decayid,decayname in b2piee_decays %} + +MagUp_BuToPipEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: + application: "DaVinci/v64r13" + input: + bk_query: "/MC/2024/{{decayid}}/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/HLT2.DST" + dq_flags: + - UNCHECKED + - OK + n_test_lfns: 4 + output: MC24_BuToPipEE_{{decayname}}.ROOT + options: + entrypoint: mc_samples.electrons.dv_BuToPipEE:main + extra_options: + input_raw_format: 0.5 + input_type: ROOT + output_type: ROOT + simulation: True + data_type: "Upgrade" + conditions_version: master + dddb_tag: dddb-20240427 + conddb_tag: sim10-2024.Q3.4-v1.3-mu100 + input_process: "Hlt2" + input_stream: "rd" + +{%- endfor %} + +####################################### +# B+ -> K+ e+ e- # +# signal # +####################################### + +{%- for decayid,decayname in b2kee_decays %} + +MagUp_BuToKpEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: application: "DaVinci/v64r13" input: - bk_query: "/MC/2024/12123001/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/HLT2.DST" + bk_query: "/MC/2024/{{decayid}}/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/HLT2.DST" dq_flags: - UNCHECKED - OK n_test_lfns: 4 - output: MC24_BuToKpEE_bu2kee.ROOT + output: MC24_BuToKpEE_{{decayname}}.ROOT options: entrypoint: mc_samples.electrons.dv_BuToKpEE:main extra_options: @@ -24,4 +103,198 @@ MagUp_BuToKpEE_bu2kee_2024.W31.34_Nu6.3_Tuple: dddb_tag: dddb-20240427 conddb_tag: sim10-2024.Q3.4-v1.3-mu100 input_process: "Hlt2" - input_stream: "rd" \ No newline at end of file + input_stream: "rd" + +{%- endfor %} + +####################################### +# Lb -> p pi- e+ e- # +# signal, misID and partrecos # +####################################### + +{%- for decayid,decayname in lb2ppiee_decays %} + +MagUp_LbToPpPimEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: + application: "DaVinci/v64r13" + input: + bk_query: "/MC/2024/{{decayid}}/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/HLT2.DST" + dq_flags: + - UNCHECKED + - OK + n_test_lfns: 4 + output: MC24_LbToPpPimEE_{{decayname}}.ROOT + options: + entrypoint: mc_samples.electrons.dv_LbToPpPimEE:main + extra_options: + input_raw_format: 0.5 + input_type: ROOT + output_type: ROOT + simulation: True + data_type: "Upgrade" + conditions_version: master + dddb_tag: dddb-20240427 + conddb_tag: sim10-2024.Q3.4-v1.3-mu100 + input_process: "Hlt2" + input_stream: "rd" + +{%- endfor %} + +####################################### +# Lb -> p K- e+ e- # +# signal # +####################################### + +{%- for decayid,decayname in lb2pkee_decays %} + +MagUp_LbToPpKimEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: + application: "DaVinci/v64r13" + input: + bk_query: "/MC/2024/{{decayid}}/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/HLT2.DST" + dq_flags: + - UNCHECKED + - OK + n_test_lfns: 4 + output: MC24_LbToPpKimEE_{{decayname}}.ROOT + options: + entrypoint: mc_samples.electrons.dv_LbToPpKimEE:main + extra_options: + input_raw_format: 0.5 + input_type: ROOT + output_type: ROOT + simulation: True + data_type: "Upgrade" + conditions_version: master + dddb_tag: dddb-20240427 + conddb_tag: sim10-2024.Q3.4-v1.3-mu100 + input_process: "Hlt2" + input_stream: "rd" + +{%- endfor %} + +####################################### +# B+ -> pi+ mu+ mu- # +# signal, misID and partrecos # +####################################### + +{%- for decayid,decayname in b2pimumu_decays %} + +MagUp_BuToPipMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: + application: "DaVinci/v64r13" + input: + bk_query: "/MC/2024/{{decayid}}/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/HLT2.DST" + dq_flags: + - UNCHECKED + - OK + n_test_lfns: 4 + output: MC24_BuToPipMuMu_{{decayname}}.ROOT + options: + entrypoint: mc_samples.muons.dv_BuToPipMuMu:main + extra_options: + input_raw_format: 0.5 + input_type: ROOT + output_type: ROOT + simulation: True + data_type: "Upgrade" + conditions_version: master + dddb_tag: dddb-20240427 + conddb_tag: sim10-2024.Q3.4-v1.3-mu100 + input_process: "Hlt2" + input_stream: "rd" + +{%- endfor %} + +####################################### +# B+ -> K+ mu+ mu- # +# signal # +####################################### + +{%- for decayid,decayname in b2kmumu_decays %} + +MagUp_BuToKpMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: + application: "DaVinci/v64r13" + input: + bk_query: "/MC/2024/{{decayid}}/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/HLT2.DST" + dq_flags: + - UNCHECKED + - OK + n_test_lfns: 4 + output: MC24_BuToKpMuMu_{{decayname}}.ROOT + options: + entrypoint: mc_samples.muons.dv_BuToKpMuMu:main + extra_options: + input_raw_format: 0.5 + input_type: ROOT + output_type: ROOT + simulation: True + data_type: "Upgrade" + conditions_version: master + dddb_tag: dddb-20240427 + conddb_tag: sim10-2024.Q3.4-v1.3-mu100 + input_process: "Hlt2" + input_stream: "rd" + +{%- endfor %} + +####################################### +# Lb -> p pi- mu+ mu- # +# signal, misID and partrecos # +####################################### + +{%- for decayid,decayname in lb2ppimumu_decays %} + +MagUp_LbToPpPimMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: + application: "DaVinci/v64r13" + input: + bk_query: "/MC/2024/{{decayid}}/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/HLT2.DST" + dq_flags: + - UNCHECKED + - OK + n_test_lfns: 4 + output: MC24_LbToPpPimMuMu_{{decayname}}.ROOT + options: + entrypoint: mc_samples.muons.dv_LbToPpPimMuMu:main + extra_options: + input_raw_format: 0.5 + input_type: ROOT + output_type: ROOT + simulation: True + data_type: "Upgrade" + conditions_version: master + dddb_tag: dddb-20240427 + conddb_tag: sim10-2024.Q3.4-v1.3-mu100 + input_process: "Hlt2" + input_stream: "rd" + +{%- endfor %} + +####################################### +# Lb -> p K- mu+ mu- # +# signal # +####################################### + +{%- for decayid,decayname in lb2pkmumu_decays %} + +MagUp_LbToPpKimMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: + application: "DaVinci/v64r13" + input: + bk_query: "/MC/2024/{{decayid}}/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/HLT2.DST" + dq_flags: + - UNCHECKED + - OK + n_test_lfns: 4 + output: MC24_LbToPpKimMuMu_{{decayname}}.ROOT + options: + entrypoint: mc_samples.muons.dv_LbToPpKimMuMu:main + extra_options: + input_raw_format: 0.5 + input_type: ROOT + output_type: ROOT + simulation: True + data_type: "Upgrade" + conditions_version: master + dddb_tag: dddb-20240427 + conddb_tag: sim10-2024.Q3.4-v1.3-mu100 + input_process: "Hlt2" + input_stream: "rd" + +{%- endfor %} \ No newline at end of file -- GitLab From 39bd8465a59303d6c3a61b60bd0cd8e496f70a7c Mon Sep 17 00:00:00 2001 From: Ernest Olivart <ernest.olivart.pino@cern.ch> Date: Wed, 18 Dec 2024 15:43:10 +0100 Subject: [PATCH 4/7] Fixed bk paths (eventtype position) --- b2xll_MC24_W31_34/info.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/b2xll_MC24_W31_34/info.yaml b/b2xll_MC24_W31_34/info.yaml index e6185c9bce..39ee1f3d49 100644 --- a/b2xll_MC24_W31_34/info.yaml +++ b/b2xll_MC24_W31_34/info.yaml @@ -53,7 +53,7 @@ defaults: MagUp_BuToPipEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: application: "DaVinci/v64r13" input: - bk_query: "/MC/2024/{{decayid}}/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/HLT2.DST" + bk_query: "/MC/2024/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/{{decayid}}/HLT2.DST" dq_flags: - UNCHECKED - OK @@ -85,7 +85,7 @@ MagUp_BuToPipEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: MagUp_BuToKpEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: application: "DaVinci/v64r13" input: - bk_query: "/MC/2024/{{decayid}}/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/HLT2.DST" + bk_query: "/MC/2024/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/{{decayid}}/HLT2.DST" dq_flags: - UNCHECKED - OK @@ -117,7 +117,7 @@ MagUp_BuToKpEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: MagUp_LbToPpPimEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: application: "DaVinci/v64r13" input: - bk_query: "/MC/2024/{{decayid}}/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/HLT2.DST" + bk_query: "/MC/2024/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/{{decayid}}/HLT2.DST" dq_flags: - UNCHECKED - OK @@ -149,7 +149,7 @@ MagUp_LbToPpPimEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: MagUp_LbToPpKimEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: application: "DaVinci/v64r13" input: - bk_query: "/MC/2024/{{decayid}}/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/HLT2.DST" + bk_query: "/MC/2024/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/{{decayid}}/HLT2.DST" dq_flags: - UNCHECKED - OK @@ -181,7 +181,7 @@ MagUp_LbToPpKimEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: MagUp_BuToPipMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: application: "DaVinci/v64r13" input: - bk_query: "/MC/2024/{{decayid}}/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/HLT2.DST" + bk_query: "/MC/2024/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/{{decayid}}/HLT2.DST" dq_flags: - UNCHECKED - OK @@ -213,7 +213,7 @@ MagUp_BuToPipMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: MagUp_BuToKpMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: application: "DaVinci/v64r13" input: - bk_query: "/MC/2024/{{decayid}}/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/HLT2.DST" + bk_query: "/MC/2024/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/{{decayid}}/HLT2.DST" dq_flags: - UNCHECKED - OK @@ -245,7 +245,7 @@ MagUp_BuToKpMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: MagUp_LbToPpPimMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: application: "DaVinci/v64r13" input: - bk_query: "/MC/2024/{{decayid}}/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/HLT2.DST" + bk_query: "/MC/2024/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/{{decayid}}/HLT2.DST" dq_flags: - UNCHECKED - OK @@ -277,7 +277,7 @@ MagUp_LbToPpPimMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: MagUp_LbToPpKimMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: application: "DaVinci/v64r13" input: - bk_query: "/MC/2024/{{decayid}}/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/HLT2.DST" + bk_query: "/MC/2024/Beam6800GeV-2024.W31.34-MagUp-Nu6.3-25ns-Pythia8/Sim10d/HLT1_2024.W31.34_noUT/HLT2-2024.W31.34/{{decayid}}/HLT2.DST" dq_flags: - UNCHECKED - OK -- GitLab From cd7c110e14e5cd079a115883da24ddc16dd46c77 Mon Sep 17 00:00:00 2001 From: Ernest Olivart <ernest.olivart.pino@cern.ch> Date: Wed, 18 Dec 2024 15:48:48 +0100 Subject: [PATCH 5/7] Fixed job names (redundant year info) --- b2xll_MC24_W31_34/info.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/b2xll_MC24_W31_34/info.yaml b/b2xll_MC24_W31_34/info.yaml index 39ee1f3d49..06433f9149 100644 --- a/b2xll_MC24_W31_34/info.yaml +++ b/b2xll_MC24_W31_34/info.yaml @@ -6,7 +6,7 @@ defaults: {%- set b2piee_decays=[ ("12123021","bu2piee"),("12153020","bu2pijpsi"),("12123001","bu2kee"),("12123003","bu2kee_btosllball05"),("12153001","bu2kjpsi"), ("12123445","bu2kstee"),("12153420","bu2kstjpsi"),("11124002","bd02kst0ee"),("11124007","bd02kst0ee_flatq2"),("11124009","bd02kst0ee_flatq2_momcut"), - ("11154001","bd02kst0jpsi"),("11154002","bd02kst0jpsi_update2012"),("11154100","bd02ks0Jpsi") + ("11154001","bd02kst0jpsi"),("11154002","bd02kst0jpsi_upd12"),("11154100","bd02ks0Jpsi") ]%} {%- set b2kee_decays=[ @@ -16,7 +16,7 @@ defaults: {%- set b2pimumu_decays=[ ("12113024","bu2pimumu"),("12113023","bu2pimumu_Acc"),("12143010","bu2pijpsi"),("12113002","bu2kmumu"),("12113004","bu2kmumu_phsp"), ("12143001","bu2kjpsi"),("11114002","bd02kst0mumu"),("11114014","bd02kst0mumu_flatq2_momcut"),("11144001","bd02kst0jpsi"), - ("11144002","bd02kst0jpsi_update2012"),("11144103","bd02ks0Jpsi") + ("11144002","bd02kst0jpsi_upd12"),("11144103","bd02ks0Jpsi") ]%} {%- set b2kmumu_decays=[ @@ -24,7 +24,7 @@ defaults: ]%} {%- set lb2ppiee_decays=[ - ("13154041","Bs2KKJpsi"),("11154001","Bd2KstJpsi"),("11154002","Bd2KstJpsi_update2012"),("15154001","Lb2pKJpsi"), + ("13154041","Bs2KKJpsi"),("11154001","Bd2KstJpsi"),("11154002","Bd2KstJpsi_upd12"),("15154001","Lb2pKJpsi"), ("11124002","Bd2Kstee"),("11124007","Bd2Kstee_flatq2"),("11124009","Bd2Kstee_flatq2_momcut"),("15124011","Lb2pKee"), ("15124021","Lb2ppiee"),("15154021","Lb2ppiJpsi") ]%} @@ -34,7 +34,7 @@ defaults: ]%} {%- set lb2ppimumu_decays=[ - ("13144041","Bs2KKJpsi"),("11144001","Bd2KstJpsi"),("11144002","Bd2KstJpsi_update2012"),("15144001","Lb2pKJpsi"), + ("13144041","Bs2KKJpsi"),("11144001","Bd2KstJpsi"),("11144002","Bd2KstJpsi_upd12"),("15144001","Lb2pKJpsi"), ("11114002","Bd2Kstmumu"),("11114014","Bd2Kstmumu_flatq2_momcut"),("15114011","Lb2pKmumu"), ("15114021","Lb2ppimumu"),("15144021","Lb2ppiJpsi") ]%} -- GitLab From cabfb1114b238965757bcc07a878f050dcfd3551 Mon Sep 17 00:00:00 2001 From: Ernest Olivart <ernest.olivart.pino@cern.ch> Date: Wed, 18 Dec 2024 16:19:32 +0100 Subject: [PATCH 6/7] Fixed yaml file entrypoints --- b2xll_MC24_W31_34/info.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/b2xll_MC24_W31_34/info.yaml b/b2xll_MC24_W31_34/info.yaml index 06433f9149..570798b5e5 100644 --- a/b2xll_MC24_W31_34/info.yaml +++ b/b2xll_MC24_W31_34/info.yaml @@ -60,7 +60,7 @@ MagUp_BuToPipEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: n_test_lfns: 4 output: MC24_BuToPipEE_{{decayname}}.ROOT options: - entrypoint: mc_samples.electrons.dv_BuToPipEE:main + entrypoint: b2xll_MC24_W31_34.electrons.dv_BuToPipEE:main extra_options: input_raw_format: 0.5 input_type: ROOT @@ -92,7 +92,7 @@ MagUp_BuToKpEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: n_test_lfns: 4 output: MC24_BuToKpEE_{{decayname}}.ROOT options: - entrypoint: mc_samples.electrons.dv_BuToKpEE:main + entrypoint: b2xll_MC24_W31_34.electrons.dv_BuToKpEE:main extra_options: input_raw_format: 0.5 input_type: ROOT @@ -124,7 +124,7 @@ MagUp_LbToPpPimEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: n_test_lfns: 4 output: MC24_LbToPpPimEE_{{decayname}}.ROOT options: - entrypoint: mc_samples.electrons.dv_LbToPpPimEE:main + entrypoint: b2xll_MC24_W31_34.electrons.dv_LbToPpPimEE:main extra_options: input_raw_format: 0.5 input_type: ROOT @@ -156,7 +156,7 @@ MagUp_LbToPpKimEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: n_test_lfns: 4 output: MC24_LbToPpKimEE_{{decayname}}.ROOT options: - entrypoint: mc_samples.electrons.dv_LbToPpKimEE:main + entrypoint: b2xll_MC24_W31_34.electrons.dv_LbToPpKimEE:main extra_options: input_raw_format: 0.5 input_type: ROOT @@ -188,7 +188,7 @@ MagUp_BuToPipMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: n_test_lfns: 4 output: MC24_BuToPipMuMu_{{decayname}}.ROOT options: - entrypoint: mc_samples.muons.dv_BuToPipMuMu:main + entrypoint: b2xll_MC24_W31_34.muons.dv_BuToPipMuMu:main extra_options: input_raw_format: 0.5 input_type: ROOT @@ -220,7 +220,7 @@ MagUp_BuToKpMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: n_test_lfns: 4 output: MC24_BuToKpMuMu_{{decayname}}.ROOT options: - entrypoint: mc_samples.muons.dv_BuToKpMuMu:main + entrypoint: b2xll_MC24_W31_34.muons.dv_BuToKpMuMu:main extra_options: input_raw_format: 0.5 input_type: ROOT @@ -252,7 +252,7 @@ MagUp_LbToPpPimMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: n_test_lfns: 4 output: MC24_LbToPpPimMuMu_{{decayname}}.ROOT options: - entrypoint: mc_samples.muons.dv_LbToPpPimMuMu:main + entrypoint: b2xll_MC24_W31_34.muons.dv_LbToPpPimMuMu:main extra_options: input_raw_format: 0.5 input_type: ROOT @@ -284,7 +284,7 @@ MagUp_LbToPpKimMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: n_test_lfns: 4 output: MC24_LbToPpKimMuMu_{{decayname}}.ROOT options: - entrypoint: mc_samples.muons.dv_LbToPpKimMuMu:main + entrypoint: b2xll_MC24_W31_34.muons.dv_LbToPpKimMuMu:main extra_options: input_raw_format: 0.5 input_type: ROOT -- GitLab From 9ee5a7c0dcb5915a11768b00aeb2e114cab1d0fb Mon Sep 17 00:00:00 2001 From: Ernest Olivart <ernest.olivart.pino@cern.ch> Date: Thu, 19 Dec 2024 11:23:39 +0100 Subject: [PATCH 7/7] minor changes in the yaml file and update scripts name --- .../{dv_LbToPpKmEE.py => dv_LbToPpKimEE.py} | 0 b2xll_MC24_W31_34/info.yaml | 24 ++++++++++++------- ...dv_LbToPpKmMuMu.py => dv_LbToPpKimMuMu.py} | 0 3 files changed, 16 insertions(+), 8 deletions(-) rename b2xll_MC24_W31_34/electrons/{dv_LbToPpKmEE.py => dv_LbToPpKimEE.py} (100%) rename b2xll_MC24_W31_34/muons/{dv_LbToPpKmMuMu.py => dv_LbToPpKimMuMu.py} (100%) diff --git a/b2xll_MC24_W31_34/electrons/dv_LbToPpKmEE.py b/b2xll_MC24_W31_34/electrons/dv_LbToPpKimEE.py similarity index 100% rename from b2xll_MC24_W31_34/electrons/dv_LbToPpKmEE.py rename to b2xll_MC24_W31_34/electrons/dv_LbToPpKimEE.py diff --git a/b2xll_MC24_W31_34/info.yaml b/b2xll_MC24_W31_34/info.yaml index 570798b5e5..93f97cf16d 100644 --- a/b2xll_MC24_W31_34/info.yaml +++ b/b2xll_MC24_W31_34/info.yaml @@ -57,7 +57,7 @@ MagUp_BuToPipEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: dq_flags: - UNCHECKED - OK - n_test_lfns: 4 + n_test_lfns: 1 output: MC24_BuToPipEE_{{decayname}}.ROOT options: entrypoint: b2xll_MC24_W31_34.electrons.dv_BuToPipEE:main @@ -68,6 +68,7 @@ MagUp_BuToPipEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: simulation: True data_type: "Upgrade" conditions_version: master + geometry_version: run3/2024.Q1.2-v00.00 dddb_tag: dddb-20240427 conddb_tag: sim10-2024.Q3.4-v1.3-mu100 input_process: "Hlt2" @@ -89,7 +90,7 @@ MagUp_BuToKpEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: dq_flags: - UNCHECKED - OK - n_test_lfns: 4 + n_test_lfns: 1 output: MC24_BuToKpEE_{{decayname}}.ROOT options: entrypoint: b2xll_MC24_W31_34.electrons.dv_BuToKpEE:main @@ -100,6 +101,7 @@ MagUp_BuToKpEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: simulation: True data_type: "Upgrade" conditions_version: master + geometry_version: run3/2024.Q1.2-v00.00 dddb_tag: dddb-20240427 conddb_tag: sim10-2024.Q3.4-v1.3-mu100 input_process: "Hlt2" @@ -121,7 +123,7 @@ MagUp_LbToPpPimEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: dq_flags: - UNCHECKED - OK - n_test_lfns: 4 + n_test_lfns: 1 output: MC24_LbToPpPimEE_{{decayname}}.ROOT options: entrypoint: b2xll_MC24_W31_34.electrons.dv_LbToPpPimEE:main @@ -132,6 +134,7 @@ MagUp_LbToPpPimEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: simulation: True data_type: "Upgrade" conditions_version: master + geometry_version: run3/2024.Q1.2-v00.00 dddb_tag: dddb-20240427 conddb_tag: sim10-2024.Q3.4-v1.3-mu100 input_process: "Hlt2" @@ -153,7 +156,7 @@ MagUp_LbToPpKimEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: dq_flags: - UNCHECKED - OK - n_test_lfns: 4 + n_test_lfns: 1 output: MC24_LbToPpKimEE_{{decayname}}.ROOT options: entrypoint: b2xll_MC24_W31_34.electrons.dv_LbToPpKimEE:main @@ -164,6 +167,7 @@ MagUp_LbToPpKimEE_{{decayname}}_2024_W31_34_Nu6_3_Tuple: simulation: True data_type: "Upgrade" conditions_version: master + geometry_version: run3/2024.Q1.2-v00.00 dddb_tag: dddb-20240427 conddb_tag: sim10-2024.Q3.4-v1.3-mu100 input_process: "Hlt2" @@ -185,7 +189,7 @@ MagUp_BuToPipMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: dq_flags: - UNCHECKED - OK - n_test_lfns: 4 + n_test_lfns: 1 output: MC24_BuToPipMuMu_{{decayname}}.ROOT options: entrypoint: b2xll_MC24_W31_34.muons.dv_BuToPipMuMu:main @@ -196,6 +200,7 @@ MagUp_BuToPipMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: simulation: True data_type: "Upgrade" conditions_version: master + geometry_version: run3/2024.Q1.2-v00.00 dddb_tag: dddb-20240427 conddb_tag: sim10-2024.Q3.4-v1.3-mu100 input_process: "Hlt2" @@ -217,7 +222,7 @@ MagUp_BuToKpMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: dq_flags: - UNCHECKED - OK - n_test_lfns: 4 + n_test_lfns: 1 output: MC24_BuToKpMuMu_{{decayname}}.ROOT options: entrypoint: b2xll_MC24_W31_34.muons.dv_BuToKpMuMu:main @@ -228,6 +233,7 @@ MagUp_BuToKpMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: simulation: True data_type: "Upgrade" conditions_version: master + geometry_version: run3/2024.Q1.2-v00.00 dddb_tag: dddb-20240427 conddb_tag: sim10-2024.Q3.4-v1.3-mu100 input_process: "Hlt2" @@ -249,7 +255,7 @@ MagUp_LbToPpPimMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: dq_flags: - UNCHECKED - OK - n_test_lfns: 4 + n_test_lfns: 1 output: MC24_LbToPpPimMuMu_{{decayname}}.ROOT options: entrypoint: b2xll_MC24_W31_34.muons.dv_LbToPpPimMuMu:main @@ -260,6 +266,7 @@ MagUp_LbToPpPimMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: simulation: True data_type: "Upgrade" conditions_version: master + geometry_version: run3/2024.Q1.2-v00.00 dddb_tag: dddb-20240427 conddb_tag: sim10-2024.Q3.4-v1.3-mu100 input_process: "Hlt2" @@ -281,7 +288,7 @@ MagUp_LbToPpKimMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: dq_flags: - UNCHECKED - OK - n_test_lfns: 4 + n_test_lfns: 1 output: MC24_LbToPpKimMuMu_{{decayname}}.ROOT options: entrypoint: b2xll_MC24_W31_34.muons.dv_LbToPpKimMuMu:main @@ -292,6 +299,7 @@ MagUp_LbToPpKimMuMu_{{decayname}}_2024_W31_34_Nu6_3_Tuple: simulation: True data_type: "Upgrade" conditions_version: master + geometry_version: run3/2024.Q1.2-v00.00 dddb_tag: dddb-20240427 conddb_tag: sim10-2024.Q3.4-v1.3-mu100 input_process: "Hlt2" diff --git a/b2xll_MC24_W31_34/muons/dv_LbToPpKmMuMu.py b/b2xll_MC24_W31_34/muons/dv_LbToPpKimMuMu.py similarity index 100% rename from b2xll_MC24_W31_34/muons/dv_LbToPpKmMuMu.py rename to b2xll_MC24_W31_34/muons/dv_LbToPpKimMuMu.py -- GitLab