Commit 7944717d authored by Alex Pearce's avatar Alex Pearce 🌈
Browse files

Merge branch 'cprouve_upstreamDiMuonRec' into 'master'

Require 2 upstream tracks in diMuon line

See merge request lhcb/Moore!290
parents 0473de95 95549f9a
......@@ -12,6 +12,7 @@ from __future__ import absolute_import, division, print_function
from GaudiKernel.SystemOfUnits import MeV, mm, GeV
from PyConf import configurable
from PyConf.application import make_odin
from PyConf.components import make_algorithm
from Moore.config import HltLine
from RecoConf.hlt1_tracking import (
require_gec,
......@@ -20,13 +21,14 @@ from RecoConf.hlt1_tracking import (
make_hlt1_fitted_tracks,
EmptyFilter,
)
from Configurables import VoidFilter
from RecoConf.hlt1_muonid import (make_muon_id, make_tracks_with_muon_id)
from RecoConf.hlt1_muonmatch import make_tracks_with_muonmatch_ipcut
from ..algorithms import (CombineTracks, Filter)
from Functors import ISMUON, CHI2DOF, MASS, P, PT, CHI2DOF, MINIPCUT, MINIPCHI2CUT, RUNNUMBER, EVENTTYPE, EVENTNUMBER, MINIP, BPVIPCHI2, DOCA, DOCACHI2
from Functors import ISMUON, CHI2DOF, MASS, P, PT, CHI2DOF, MINIPCUT, MINIPCHI2CUT, RUNNUMBER, EVENTTYPE, EVENTNUMBER, MINIP, BPVIPCHI2, DOCA, DOCACHI2, SIZE
from Functors.math import in_range
......@@ -40,14 +42,31 @@ def make_fitted_tracks_with_muon_id(velo_track_min_ip, tracking_min_pt):
# bind the muonIDs and the fitted forward tracks together
tracks_with_muon_id = make_tracks_with_muon_id(fitted_forward_tracks,
muon_ids)
# return the type needed by the muon filter, which is the zipped object of fitted forward tracks and muonIDs
return {'PrFittedForwardWithMuonID': tracks_with_muon_id}
# return:
# 1. pr upstream tracks: needed to filter for events with at least 2 upstream tracks (for building dimuon candidates)
# 2. zipped object of fitted forward tracks and muonIDs: needed by the muon filter
return {
'PrUpstream': all_tracks["Upstream"]["Pr"],
'PrFittedForwardWithMuonID': tracks_with_muon_id
}
def require_forward_tracks(tracks):
return EmptyFilter(name='require_forward_tracks', InputLocation=tracks)
def __twotracksfilter_input_transform(InputLocation):
return {"Cut": SIZE(InputLocation) > 1}
TwoTracksFilter = make_algorithm(
VoidFilter, input_transform=__twotracksfilter_input_transform)
def require_twotracks(tracks):
return TwoTracksFilter(name='require_twotracks', InputLocation=tracks)
@configurable
def prefilters(make_pvs=make_pvs):
return [require_gec(), require_pvs(make_pvs())]
......@@ -98,6 +117,11 @@ def detached_low_pt_dimuon_line(
pvs = make_pvs().location
tracks_with_muon_id = make_input_tracks(velo_track_min_ip, tracking_min_pt)
#require that the upstream track container has at least two tracks
twoupstreamtracks_rec = require_twotracks(
tracks_with_muon_id["PrUpstream"])
# functor for the selection on the individual forward fitted tracks with muonID
sel = (ISMUON) & (P > min_p) & (PT > min_pt) & MINIPCUT(
IPCut=velo_track_min_ip, Vertices=pvs) & MINIPCHI2CUT(
......@@ -120,7 +144,7 @@ def detached_low_pt_dimuon_line(
CombinationCut=CombinationCut)
return HltLine(
name=name,
algs=prefilters() + [combination_filter],
algs=prefilters() + [twoupstreamtracks_rec, combination_filter],
prescale=prescale,
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment