diff --git a/Hlt/RecoConf/python/RecoConf/rich_data_monitoring.py b/Hlt/RecoConf/python/RecoConf/rich_data_monitoring.py index 470fc4f33e48b8de4a6f9b2418b7283d6973155c..7a7060074c06682b450f2f80bb9d5b7d9765e474 100644 --- a/Hlt/RecoConf/python/RecoConf/rich_data_monitoring.py +++ b/Hlt/RecoConf/python/RecoConf/rich_data_monitoring.py @@ -23,12 +23,15 @@ from PyConf.Algorithms import ( Rich__Future__Rec__Moni__TrackSelEff as TrackSelEff, Rich__Future__Rec__Moni__SIMDPhotonCherenkovAngles as PhotAngles, Rich__Future__Rec__Moni__TrackRadiatorMaterial as TkMaterial, - Rich__Future__Rec__Moni__DLLs as DLLs, + Rich__Future__Rec__Moni__DLLs as DLLs, # + Rich__Future__Rec__Moni__PhotonYield as PhotonYield, + Rich__Future__Rec__Moni__GeometricalEfficiencies as GeomEffs, Rich__Future__Rec__Moni__PixelBackgrounds as PixBackgrds) from PyConf.Tools import TrackSelector -from .rich_reconstruction import get_radiator_bool_opts +from .rich_reconstruction import (get_radiator_bool_opts, + get_detector_bool_opts) ############################################################################### @@ -70,13 +73,13 @@ def default_rich_monitors(moni_set="Standard"): "Expert": [ "DecodingErrors", "RecoStats", "RichHits", "PixelClusters", "RichMaterial", "PixelBackgrounds", "TrackSelEff", - "PhotonCherenkovAngles", "DLLs" + "PhotonCherenkovAngles", "DLLs", "PhotonYields", "GeomEffs" ], # The default set of monitors "Standard": [ "DecodingErrors", "RecoStats", "RichHits", "PixelClusters", "RichMaterial", "PixelBackgrounds", "TrackSelEff", - "PhotonCherenkovAngles", "DLLs" + "PhotonCherenkovAngles", "DLLs", "PhotonYields", "GeomEffs" ], # For monitoring at the pit "OnlineMonitoring": [ @@ -173,12 +176,15 @@ def make_rich_track_monitors(conf, reco_opts, moni_opts, moni_set="Standard"): # The dict of configured monitors to return results = {} - # The radiator options - rad_opts = get_radiator_bool_opts(reco_opts) - # The track name for this configuration track_name = conf["TrackName"] + # The radiator options + rad_opts = get_radiator_bool_opts(reco_opts, track_name) + + # Detector options + det_opts = get_detector_bool_opts(reco_opts, track_name) + # Basic reco statistics key = "RecoStats" if key in monitors: @@ -213,6 +219,7 @@ def make_rich_track_monitors(conf, reco_opts, moni_opts, moni_set="Standard"): tight_sel = moni_opts["TightTrackSelection"] results[key + "Tight"] = PhotAngles( name="RiCKRes" + track_name + "Tight", + Radiators=rad_opts, TrackSelector=TrackSelector( MinPCut=tight_sel["MinP"], MinPtCut=tight_sel["MinPt"], @@ -225,6 +232,35 @@ def make_rich_track_monitors(conf, reco_opts, moni_opts, moni_set="Standard"): SummaryTracksLocation=conf["SummaryTracks"], PhotonToParentsLocation=conf["PhotonToParents"]) + # Photon Yields + key = "PhotonYields" + if key in monitors: + results["Emitted" + key] = PhotonYield( + name="RiTkEmittedYields" + track_name, + Radiators=rad_opts, + MaximumYields=(100, 800, 800), + TrackSegmentsLocation=conf["TrackSegments"], + PhotonYieldLocation=conf["EmittedYields"]) + results["Detectable" + key] = PhotonYield( + name="RiTkDetectableYields" + track_name, + Radiators=rad_opts, + TrackSegmentsLocation=conf["TrackSegments"], + PhotonYieldLocation=conf["DetectableYields"]) + results["Signal" + key] = PhotonYield( + name="RiTkSignalYields" + track_name, + Radiators=rad_opts, + TrackSegmentsLocation=conf["TrackSegments"], + PhotonYieldLocation=conf["SignalYields"]) + + # Geom. Effs. + key = "GeomEffs" + if key in monitors: + results[key] = GeomEffs( + name="RiTkGeomEffs" + track_name, + Radiators=rad_opts, + TrackSegmentsLocation=conf["TrackSegments"], + GeomEffsLocation=conf["GeomEffs"]) + # Rich material monitor key = "RichMaterial" if key in monitors: @@ -238,6 +274,7 @@ def make_rich_track_monitors(conf, reco_opts, moni_opts, moni_set="Standard"): if key in monitors: results[key] = PixBackgrds( name="RichRecPixBkgs" + track_name, + Detectors=det_opts, RichSIMDPixelSummariesLocation=conf["RichSIMDPixels"], PixelBackgroundsLocation=conf["RichPixelBackgrounds"]) diff --git a/Hlt/RecoConf/python/RecoConf/rich_mc_checking.py b/Hlt/RecoConf/python/RecoConf/rich_mc_checking.py index 522efbe3f9775a001957cbd7fcc89d6279e84464..d06b9908895c5a68e04a5ee8ce796b9b53187e54 100644 --- a/Hlt/RecoConf/python/RecoConf/rich_mc_checking.py +++ b/Hlt/RecoConf/python/RecoConf/rich_mc_checking.py @@ -19,8 +19,7 @@ from Hlt2Conf.data_from_file import mc_unpackers from .mc_checking import (make_links_lhcbids_mcparticles_tracking_system, make_links_tracks_mcparticles) -from .rich_reconstruction import (get_radiator_bool_opts, - get_detector_bool_opts) +from .rich_reconstruction import get_radiator_bool_opts from .rich_data_monitoring import default_rich_monitoring_options @@ -111,10 +110,7 @@ def make_rich_checkers(conf, reco_opts, check_opts, moni_set="Standard"): track_name = conf["TrackName"] # The radiator options - rad_opts = get_radiator_bool_opts(reco_opts) - - # Get the detector options - det_opts = get_detector_bool_opts(reco_opts) + rad_opts = get_radiator_bool_opts(reco_opts, track_name) # get the list of checkers to activate checkers = default_rich_checkers(moni_set) diff --git a/Hlt/RecoConf/python/RecoConf/rich_reconstruction.py b/Hlt/RecoConf/python/RecoConf/rich_reconstruction.py index d562228a33d36e840fa7f5030c6bebe50fcbef22..7bda4e26f1da535421d7150a7fc8a1b78fa61731 100644 --- a/Hlt/RecoConf/python/RecoConf/rich_reconstruction.py +++ b/Hlt/RecoConf/python/RecoConf/rich_reconstruction.py @@ -25,7 +25,6 @@ from PyConf.Algorithms import ( Rich__Future__Rec__EmittedPhotonYields as EmittedYields, Rich__Future__Rec__TrackEmittedCherenkovAngles as EmittedCKAngles, Rich__Future__Rec__RayTraceCherenkovCones as EmittedMassCones, - Rich__Future__Rec__DetectablePhotonYields as DetectableYields, Rich__Future__Rec__GeomEffCKMassRings as GeomEff, Rich__Future__Rec__SelectTrackSegments as SelectTrackSegments, Rich__Future__Rec__SignalPhotonYields as SignalYields, @@ -61,12 +60,6 @@ def default_rich_reco_options(): ], # The RICH radiators to use "Radiators": ["Rich1Gas", "Rich2Gas"], - # Tay tracing ring points (Max) - "NRayTracingRingPointsMax": (96, 96, 96), - # Tay tracing ring points (Min) - "NRayTracingRingPointsMin": (16, 16, 16), - # Tolerence for creating new ray traced CK rings (default 2.5% of CK theta) - "RayTracingNewCKRingTol": (0.005, 0.00125, 0.00075), # Maximum number of clusters GEC cut "MaxPixelClusters": 200000, @@ -96,6 +89,19 @@ def default_rich_reco_options(): "TrackExtrapolator": TrackSTEPExtrapolator, + # Tay tracing ring points (Max) + "NRayTracingRingPointsMax": (96, 96, 96), + + # Tay tracing ring points (Min) + "NRayTracingRingPointsMin": (16, 16, 16), + + # Tolerence for creating new ray traced CK rings (default 2.5% of CK theta) + "RayTracingNewCKRingTol": (0.005, 0.00125, 0.00075), + + # Detectable Yields Treatment + "DetectableYieldsPrecision": + "Average", + #=========================================================== # Settings for the global PID minimisation #=========================================================== @@ -151,21 +157,23 @@ def default_rich_reco_options(): ############################################################################### -def get_radiator_bool_opts(options): - # Radiators ( Aerogel not supported here ) +def get_radiator_bool_opts(options, tktype=""): + isUp = tktype == "Upstream" or tktype == "Up" + # Radiators return ( - False, # + False, # Aerogel not supported at all "Rich1Gas" in options["Radiators"], - "Rich2Gas" in options["Radiators"]) + "Rich2Gas" in options["Radiators"] and not isUp) ############################################################################### -def get_detector_bool_opts(options): - # Detectors ( Aerogel not supported here ) +def get_detector_bool_opts(options, tktype=""): + isUp = tktype == "Upstream" or tktype == "Up" + # Detectors return ("Rich1Gas" in options["Radiators"], - "Rich2Gas" in options["Radiators"]) + "Rich2Gas" in options["Radiators"] and not isUp) ############################################################################### @@ -275,7 +283,7 @@ def make_rich_tracks(track_name, input_tracks, options): results["InputTracks"] = input_tracks # The radiator options - rad_opts = get_radiator_bool_opts(options) + rad_opts = get_radiator_bool_opts(options, track_name) # Create radiator segments from input tracks segments = SegmentCreator( @@ -324,6 +332,13 @@ def make_rich_tracks(track_name, input_tracks, options): results["EmittedCKRings"] = emitMassCones.MassHypothesisRingsLocation # Detectable photon yields + if options["DetectableYieldsPrecision"] == "Full": + from PyConf.Algorithms import Rich__Future__Rec__DetectablePhotonYields as DetectableYields + elif options["DetectableYieldsPrecision"] == "Average": + from PyConf.Algorithms import Rich__Future__Rec__AverageDetectablePhotonYields as DetectableYields + else: + raise ValueError("Unknown detectable yield mode '" + + options["DetectableYieldsPrecision"] + "'") detY = DetectableYields( name="RichDetectableYields" + track_name, TrackSegmentsLocation=segments.TrackSegmentsLocation, @@ -355,8 +370,8 @@ def make_rich_tracks(track_name, input_tracks, options): DetectablePhotonYieldLocation=detY.DetectablePhotonYieldLocation, DetectablePhotonSpectraLocation=detY.DetectablePhotonSpectraLocation, GeomEffsLocation=geomEff.GeomEffsLocation) - results["SignalPhotonYields"] = sigYields.SignalPhotonYieldLocation - results["SignalPhotonSpectra"] = sigYields.SignalPhotonSpectraLocation + results["SignalYields"] = sigYields.SignalPhotonYieldLocation + results["SignalSpectra"] = sigYields.SignalPhotonSpectraLocation # Signal Cherenkov angles sigChAngles = SignalCherenkovAngles( @@ -497,7 +512,7 @@ def make_rich_pids(track_name, TrackToSegmentsLocation=track_conf["SelectedTrackToSegments"], PhotonToParentsLocation=photon_conf["PhotonToParents"], DetectablePhotonYieldLocation=track_conf["DetectableYields"], - SignalPhotonYieldLocation=track_conf["SignalPhotonYields"], + SignalPhotonYieldLocation=track_conf["SignalYields"], PhotonSignalsLocation=photon_conf["PhotonSignals"], RichSIMDPixelSummariesLocation=pixel_conf["RichSIMDPixels"]) results["SummaryTracks"] = recSum.SummaryTracksLocation diff --git a/Hlt/RecoConf/python/RecoConf/yapf4078517uuv.py b/Hlt/RecoConf/python/RecoConf/yapf4078517uuv.py new file mode 100644 index 0000000000000000000000000000000000000000..ac599073750ef212d4926072295312176a356c1c --- /dev/null +++ b/Hlt/RecoConf/python/RecoConf/yapf4078517uuv.py @@ -0,0 +1,270 @@ +############################################################################### +# (c) Copyright 2019 CERN for the benefit of the LHCb Collaboration # +# # +# This software is distributed under the terms of the GNU General Public # +# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". # +# # +# In applying this licence, CERN does not waive the privileges and immunities # +# granted to it by virtue of its status as an Intergovernmental Organization # +# or submit itself to any jurisdiction. # +############################################################################### + +from GaudiKernel.SystemOfUnits import GeV + +from PyConf import configurable +from PyConf.utilities import ConfigurationError + +from PyConf.Algorithms import ( + Rich__Future__Rec__Moni__DecodingErrors as DecodingErrors, + Rich__Future__Rec__Moni__DetectorHits as DetectorHits, + Rich__Future__SmartIDClustering as RichClustering, + Rich__Future__Rec__Moni__PixelClusters as ClusterMoni, + Rich__Future__Rec__Moni__SIMDRecoStats as RecoStats, + Rich__Future__Rec__Moni__TrackSelEff as TrackSelEff, + Rich__Future__Rec__Moni__SIMDPhotonCherenkovAngles as PhotAngles, + Rich__Future__Rec__Moni__TrackRadiatorMaterial as TkMaterial, + Rich__Future__Rec__Moni__DLLs as DLLs, Rich__Future__Rec__Moni__PhotonYield + as PhotonYield, Rich__Future__Rec__Moni__PixelBackgrounds as PixBackgrds) + +from PyConf.Tools import TrackSelector + +from .rich_reconstruction import get_radiator_bool_opts + +############################################################################### + + +def default_rich_monitoring_options(): + """ + Returns a dict of the default RICH data monitoring options + """ + + opts = { + "TightTrackSelection": { + "MinP": 10 * GeV, + "MinPt": 0.5 * GeV, + "MaxChi2": 2, + "MaxGhostProb": 0.1 + } + } + + return opts + + +############################################################################### + + +@configurable +def default_rich_monitors(moni_set="Standard"): + """ + Returns the set of monitors to activate + + Args: + moni_set (string): Monitor set to activate + + Returns: + dict of activated monitoring algorithms + """ + + monitors = { + # Activates all montiors + "Expert": [ + "DecodingErrors", "RecoStats", "RichHits", "PixelClusters", + "RichMaterial", "PixelBackgrounds", "TrackSelEff", + "PhotonCherenkovAngles", "DLLs", "PhotonYields" + ], + # The default set of monitors + "Standard": [ + "DecodingErrors", "RecoStats", "RichHits", "PixelClusters", + "RichMaterial", "PixelBackgrounds", "TrackSelEff", + "PhotonCherenkovAngles", "DLLs", "PhotonYields" + ], + # For monitoring at the pit + "OnlineMonitoring": [ + "DecodingErrors", "RecoStats", "RichHits", "PixelClusters", + "TrackSelEff", "PhotonCherenkovAngles", "DLLs" + ], + "None": [] + } + + if moni_set not in monitors.keys(): + raise ConfigurationError("Unknown histogram set " + moni_set) + + return monitors[moni_set] + + +############################################################################### + + +@configurable +def make_rich_pixel_monitors(conf, reco_opts, moni_opts, moni_set="Standard"): + """ + Returns a set of RICH pixel only level monitors (i.e. tracking free). + + Args: + conf (dict): Reconstruction configuration (data) to run monitoring on + reco_opts (dict): Reconstruction options + moni_opts (dict): Data monitoring options + moni_set (string): Monitor set to activate + + Returns: + dict of activated monitoring algorithms + """ + + # get the list of monitors to activate + monitors = default_rich_monitors(moni_set) + + # The dict of configured monitors to return + results = {} + + # Decoding errors + key = "DecodingErrors" + if key in monitors: + results[key] = DecodingErrors( + name="RichDecodingErrors", + DecodedDataLocation=conf["RichDecodedData"], + OdinLocation=conf["ODIN"]) + + # RICH hits + key = "RichHits" + if key in monitors: + results[key] = DetectorHits( + name="RichRecPixelQC", DecodedDataLocation=conf["RichDecodedData"]) + + # Rich Clustering checks + key = "PixelClusters" + if key in monitors: + # Run custom monitoring specific clustering here, to be decoupled + # from whatever the reco uses (likely no clustering). + clustering = RichClustering( + name="RichClusteringForMoni", + # Force clustering on for both RICHes + ApplyPixelClustering=(True, True), + # input data + DecodedDataLocation=conf["RichDecodedData"]) + # ... and now the monitor for these clusters + results[key] = ClusterMoni( + name="RichRecPixelClusters", + RichPixelClustersLocation=clustering.RichPixelClustersLocation) + + return results + + +############################################################################### + + +@configurable +def make_rich_track_monitors(conf, reco_opts, moni_opts, moni_set="Standard"): + """ + Returns a set of RICH track level monitors + + Args: + conf (dict): Reconstruction data configuration to run monitoring for + reco_opts (dict): Reconstruction options + moni_opts (dict): Data monitoring options + moni_set (string): Monitor set to activate + + Returns: + dict of activated monitoring algorithms + """ + + # get the list of monitors to activate + monitors = default_rich_monitors(moni_set) + + # The dict of configured monitors to return + results = {} + + # The radiator options + rad_opts = get_radiator_bool_opts(reco_opts) + + # The track name for this configuration + track_name = conf["TrackName"] + + # Basic reco statistics + key = "RecoStats" + if key in monitors: + results[key] = RecoStats( + name="RichRecoStats" + track_name, + TrackToSegmentsLocation=conf["SelectedTrackToSegments"], + TrackSegmentsLocation=conf["TrackSegments"], + CherenkovPhotonLocation=conf["CherenkovPhotons"]) + + # RICH track selection efficiencies + key = "TrackSelEff" + if key in monitors: + results[key] = TrackSelEff( + name="RichTkSelEff" + track_name, + TracksLocation=conf["InputTracks"], + RichPIDsLocation=conf["RichPIDs"]) + + # RICH cherenkov photon angles + key = "PhotonCherenkovAngles" + if key in monitors: + # Standard monitor + results[key] = PhotAngles( + name="RiCKRes" + track_name, + Radiators=rad_opts, + TracksLocation=conf["InputTracks"], + TrackSegmentsLocation=conf["TrackSegments"], + CherenkovPhotonLocation=conf["CherenkovPhotons"], + CherenkovAnglesLocation=conf["SignalCKAngles"], + SummaryTracksLocation=conf["SummaryTracks"], + PhotonToParentsLocation=conf["PhotonToParents"]) + # Tight monitor + tight_sel = moni_opts["TightTrackSelection"] + results[key + "Tight"] = PhotAngles( + name="RiCKRes" + track_name + "Tight", + TrackSelector=TrackSelector( + MinPCut=tight_sel["MinP"], + MinPtCut=tight_sel["MinPt"], + MaxChi2Cut=tight_sel["MaxChi2"], + MaxGhostProbCut=tight_sel["MaxGhostProb"]), + TracksLocation=conf["InputTracks"], + TrackSegmentsLocation=conf["TrackSegments"], + CherenkovPhotonLocation=conf["CherenkovPhotons"], + CherenkovAnglesLocation=conf["SignalCKAngles"], + SummaryTracksLocation=conf["SummaryTracks"], + PhotonToParentsLocation=conf["PhotonToParents"]) + + # Photon Yields + key = "PhotonYields" + if key in monitors: + results["Emitted" + key] = PhotonYield( + name="RiTkEmittedYields" + track_name, + Radiators=rad_opts, + MaximumYields=(100, 800, 800), + TrackSegmentsLocation=conf["TrackSegments"], + PhotonYieldLocation=conf["EmittedYields"]) + results["Detectable" + key] = PhotonYield( + name="RiTkDetectableYields" + track_name, + Radiators=rad_opts, + TrackSegmentsLocation=conf["TrackSegments"], + PhotonYieldLocation=conf["DetectableYields"]) + results["Signal" + key] = PhotonYield( + name="RiTkSignalYields" + track_name, + Radiators=rad_opts, + TrackSegmentsLocation=conf["TrackSegments"], + PhotonYieldLocation=conf["SignalYields"]) + + # Rich material monitor + key = "RichMaterial" + if key in monitors: + results[key] = TkMaterial( + name="RiTkMaterial" + track_name, + Radiators=rad_opts, + TrackSegmentsLocation=conf["TrackSegments"]) + + # Rich likelihood pixel backgrounds + key = "PixelBackgrounds" + if key in monitors: + results[key] = PixBackgrds( + name="RichRecPixBkgs" + track_name, + RichSIMDPixelSummariesLocation=conf["RichSIMDPixels"], + PixelBackgroundsLocation=conf["RichPixelBackgrounds"]) + + # RICH DLL values + key = "DLLs" + if key in monitors: + results[key] = DLLs( + name="RichDLLs" + track_name, RichPIDsLocation=conf["RichPIDs"]) + + return results