diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index dceef2b6269abd64f657e4fc34401ae05773cf90..cb1ae28c8d1a304a899c9457fd99c61bd4ef38ba 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -20,7 +20,7 @@ from typing import Optional from GaudiKernel import SystemOfUnits # type: ignore[import] from GaudiConf.LbExec import HltSourceID # type: ignore[import] import Functors as F # type: ignore[import] -from PyConf.reading import get_odin, get_decreports, get_hlt1_selreports, get_particles, tes_root_for_tistos # type: ignore[import] +from PyConf.reading import get_odin, get_decreports, get_hlt1_selreports, get_particles, tes_root_for_tistos, get_rec_summary # type: ignore[import] from PyConf.dataflow import DataHandle # type: ignore[import] from PyConf.Algorithms import Hlt1TisTosAlg, Hlt2TisTosAlg, Hlt1TrueSimEffAlg, Hlt2TrueSimEffAlg # type: ignore[import] import DaVinciMCTools # type: ignore[import] @@ -1210,3 +1210,46 @@ def ParticleID(extra_info: bool = False) -> FunctorCollection: ) return FunctorCollection(pid_vars) + + +def RecSummary(extra_info: bool = False) -> FunctorCollection: + """ + Event-level collection of RecSummary information. Using RECSUMMARY_INFO functor. + By default, adds nPVs and number of different types of Tracks. + + Args: + extra_info (bool, optional) : If True, stores hits and Clusters in subdetectors. Defaults to False. + """ + rec_summary = get_rec_summary() + + list_recsummary_variables = [ + "nTracks", + "nPVs", + "nVeloTracks", + "nLongTracks", + "nDownstreamTracks", + "nUpstreamTracks", + "nBackTracks", + ] + additional_recsummary_variables = [ + "nFTClusters", + "nVPClusters", + "nEcalClusters", + "eCalTot", + "hCalTot", + "nRich1Hits", + "nRich2Hits", + ] + + if extra_info: + list_recsummary_variables += additional_recsummary_variables + + functor_collection = FunctorCollection( + { + recsummary_variable: F.VALUE_OR(-1) + @ F.RECSUMMARY_INFO(rec_summary, recsummary_variable) + for recsummary_variable in list_recsummary_variables + } + ) + + return functor_collection