High failure rate and incorrect results from Run3 DTF with PV constraint (and cannot check the status)
We're using the DecayTreeFitter to infer the kinematics of a track from a V0 decay, as we did in Run 1/2. The decay is built from a VELO track and a long track, so there is plenty of freedom for the fit. We can also do our own kinematic constraint, for which the results look like they make sense. However, from the DTF we get a very poor resolution, and see many, many fit failures. The degree of failure seem to indicate something is going wrong...
Let me make the remark that I couldn't find a way to actually see the (1) CHI2 and (2) Status of the DTF. These are very important to have access to!
An example options file that immediately reproduces this would be:
from DaVinci import Options, make_config
from PyConf.reading import get_particles, get_pvs, get_pvs_v1
from FunTuple import FunctorCollection as FC
from FunTuple import FunTuple_Particles as Funtuple
from FunTuple.functorcollections import SelectionInfo
from DaVinci.algorithms import create_lines_filter
from PyConf.Algorithms import FlattenDecayTree, VeloIDOverlapRelationTable
from RecoConf.reconstruction_objects import reconstruction
from Hlt2Conf.standard_particles import (make_long_pions)
from Hlt2Conf.algorithms_thor import ParticleFilter
import Functors as F
def make_tuple(v2_pvs,line):
fields = {
"KS0": "KS0 -> [pi+]CC [mu-]CC",
"pip": "KS0 -> ^[pi+]CC [mu-]CC",
"pim": "KS0 -> [pi+]CC ^[mu-]CC",
}
input_data=get_particles("/Event/HLT2/Hlt2KshortVeloLong{}/Particles".format(line))
from DecayTreeFitter import DecayTreeFitter
DTF = DecayTreeFitter(
name = 'DTF_{hash}',
input_particles = input_data,
input_pvs = v2_pvs
)
DTF_collection_daughters = (FC( {"DTF_PX": DTF(F.PX),
"DTF_PY": DTF(F.PY),
"DTF_PZ": DTF(F.PZ),
"DTF_MASS": DTF.MASS,
"DTF_PT": DTF(F.PT)}))
hlt2_line = ['Hlt2KshortVeloLong{}'.format(line)]
selinfo = SelectionInfo(selection_type="Hlt2", trigger_lines=hlt2_line)
with reconstruction.bind(from_file=True, spruce=True):
long_pions=make_long_pions()
flattened_decay_tree = FlattenDecayTree( InputParticles=input_data )
basic_particles = ParticleFilter( flattened_decay_tree.OutputParticles, F.FILTER( F.ISBASICPARTICLE ), name="MyParticleFilterThing_{hash}" )
relation_table_match_to_long = VeloIDOverlapRelationTable(MatchFrom=basic_particles, MatchTo=long_pions)
matching_variables = FC( {'MATCHLONG_P[nMatchTracks]': F.REVERSE_RANGE @ F.MAP_INPUT_ARRAY(Functor=F.P, Relations=relation_table_match_to_long.OutputRelations),
"Velo2LongMatch_WEIGHT[nMatchTracks]": F.REVERSE_RANGE @ F.MAP_WEIGHT(Relations=relation_table_match_to_long.OutputRelations),
"MATCHLONG_ID[nMatchTracks]": F.REVERSE_RANGE @ F.MAP_INPUT_ARRAY(Functor= F.PARTICLE_ID, Relations=relation_table_match_to_long.OutputRelations),
"MATCHLONG_PID_P[nMatchTracks]": F.REVERSE_RANGE @ F.MAP_INPUT_ARRAY(Functor=F.PID_P, Relations=relation_table_match_to_long.OutputRelations),
"MATCHLONG_PT[nMatchTracks]": F.REVERSE_RANGE @ F.MAP_INPUT_ARRAY(Functor=F.PT, Relations=relation_table_match_to_long.OutputRelations)} )
variables = {
"KS0": DTF_collection_daughters,
"pip" : DTF_collection_daughters,
"pim" : DTF_collection_daughters + matching_variables,
}
tuple = Funtuple(
name="DecayTreeTuple{}".format(line),
tuple_name="DecayTree",
fields=fields,
variables=variables,
event_variables= selinfo,
inputs=input_data
)
my_filter = create_lines_filter(name="HDRFilter_Hlt2KshortVeloLong{}".format(line), lines=["Hlt2KshortVeloLong{}".format(line)])
return [my_filter,tuple]
def main(options: Options):
v2_pvs = get_pvs()
name="Hlt2KshortVeloLong"
lines=["","_15","_20","_high"]
tuples={}
for l in lines:
tuples[name+l]=make_tuple(v2_pvs,l)
return make_config(options, tuples)
from DaVinci import Options
options = Options(
data_type="Upgrade",
input_type="ROOT",
simulation=False,
write_fsr=False,
ntuple_file="DVTuples.root",
input_files=["/eos/lhcb/grid/prod/lhcb/LHCb/Collision23/TRACKEFF.DST/00198132/0000/00198132_00000516_1.trackeff.dst"],
geometry_version="run3/trunk",
conditions_version="master",
python_logging_level="3",
input_raw_format=0.5,
evt_max=100000,
print_freq="10000",
input_process="TurboPass",
input_stream= "trackeff",
)
with options.apply_binds():
main(options)