Skip to content
Snippets Groups Projects

Follow-up from Analysis!977

Merged Abhijit Mathad requested to merge AM_invalidvalue_array into master
All threads resolved!
Files
2
@@ -9,12 +9,12 @@
# or submit itself to any jurisdiction. #
###############################################################################
"""
Read an HLT2 file and create an ntuple, containing a matching between
Read an HLT2 file and create an ntuple, containing a matching between
particles in the line and persistreco particles based on the VELO IDs.
rst_title: Matching example on data
rst_description: This example shows how to read an HLT2 file and create an ntuple,
containing a matching between particles in the line and persistreco
rst_description: This example shows how to read an HLT2 file and create an ntuple,
containing a matching between particles in the line and persistreco
particles based on the VELO IDs.
rst_running: lb-run DaVinci/vXXrY lbexec DaVinciExamples.tupling.option_davinci_tupling_from_hlt2_with_matching:main $DAVINCIEXAMPLESROOT/example_data/Run255620.yaml
@@ -32,7 +32,8 @@ from DaVinci import Options, make_config
from PyConf.Algorithms import FlattenDecayTree, VeloIDOverlapRelationTable
from Hlt2Conf.algorithms_thor import ParticleFilter
from Hlt2Conf.standard_particles import (make_long_electrons_with_brem)
from Hlt2Conf.standard_particles import make_long_electrons_with_brem
from GaudiKernel.SystemOfUnits import MeV
from RecoConf.reconstruction_objects import reconstruction
@@ -93,7 +94,18 @@ def main(options: Options):
long_electrons = make_long_electrons_with_brem()
relation_table_match_by_veloid = VeloIDOverlapRelationTable(
MatchFrom=basic_particles_dz_to_kpi, MatchTo=long_electrons)
MatchFrom=basic_particles_dz_to_kpi,
MatchTo=long_electrons).OutputRelations
# make electrons with some cuts
with reconstruction.bind(from_file=True, spruce=True):
long_electrons_tight_cuts = ParticleFilter(
Input=make_long_electrons_with_brem(),
Cut=F.FILTER(F.require_all(F.PT > 500. * MeV, F.PID_E > 1.)))
# make a test relation table
relation_table_match_by_veloid_tight_cuts = VeloIDOverlapRelationTable(
MatchFrom=basic_particles_dz_to_kpi,
MatchTo=long_electrons_tight_cuts).OutputRelations
my_filter = create_lines_filter(
name="HDRFilter_D0Kpi", lines=[f"{line_name}"])
@@ -101,10 +113,16 @@ def main(options: Options):
variables["piplus"] += FunctorCollection({
'Matched_to_Electron_P[nMatchTracks]':
F.MAP_INPUT_ARRAY(
Functor=F.P,
Relations=relation_table_match_by_veloid.OutputRelations),
Functor=F.P, Relations=relation_table_match_by_veloid),
"Matched_to_Electron_Weight[nMatchTracks]":
F.MAP_WEIGHT(Relations=relation_table_match_by_veloid.OutputRelations)
F.MAP_WEIGHT(Relations=relation_table_match_by_veloid),
'Matched_to_Electron_P_tight_cuts[nMatchTracks_tight_cuts]':
F.MAP_INPUT_ARRAY(
Functor=F.P, Relations=relation_table_match_by_veloid_tight_cuts),
'Matched_to_Electron_ID_tight_cuts[nMatchTracks_tight_cuts]':
F.MAP_INPUT_ARRAY(
Functor=F.PARTICLE_ID,
Relations=relation_table_match_by_veloid_tight_cuts),
})
evt_variables = FC.SelectionInfo(
Loading