From 18d86c878d9f7f82d942b6a074011373edf56fa1 Mon Sep 17 00:00:00 2001 From: Sebastien Ponce Date: Thu, 7 Mar 2024 15:42:23 +0100 Subject: [PATCH 1/3] Fixed evt_max for detdesc tests using RichRefIndexCalib.py --- Rich/Panoptes/options/RichRefIndexCalib.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Rich/Panoptes/options/RichRefIndexCalib.py b/Rich/Panoptes/options/RichRefIndexCalib.py index 3f2959f07..12c3c5ec8 100644 --- a/Rich/Panoptes/options/RichRefIndexCalib.py +++ b/Rich/Panoptes/options/RichRefIndexCalib.py @@ -13,6 +13,7 @@ import os, multiprocessing from Moore import options, run_reconstruction from Panoptes.calibration import standalone_rich_ref_index_calib from PyConf.Algorithms import Rich__Future__Rec__Calib__RefIndexCalib as RefIndexCalib +from DDDB.CheckDD4Hep import UseDD4Hep from ROOT import gROOT from Gaudi.Configuration import VERBOSE, DEBUG, INFO @@ -35,7 +36,8 @@ options.histo_file = myName + ".root" options.n_threads = (1 if options.input_type == 'ROOT' or isQMTTest else multiprocessing.cpu_count()) #options.n_threads = 1 -options.evt_max = (5000 if isQMTTest else -1) +if UseDD4Hep: + options.evt_max = (5000 if isQMTTest else -1) # Is UT active in this task ? noUT = ("noUT" in myName) -- GitLab From 64a164caf8e45301ff32dd96f96bf6a0d76a9b51 Mon Sep 17 00:00:00 2001 From: Sebastien Ponce Date: Wed, 3 Apr 2024 17:13:37 +0200 Subject: [PATCH 2/3] Adapted tests to new IOAlg --- Rich/Panoptes/options/rich1_mirror_align_task_detdesc.py | 9 +++++++-- Rich/Panoptes/options/rich2_mirror_align_task_detdesc.py | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Rich/Panoptes/options/rich1_mirror_align_task_detdesc.py b/Rich/Panoptes/options/rich1_mirror_align_task_detdesc.py index d5667062d..14f2ebf38 100644 --- a/Rich/Panoptes/options/rich1_mirror_align_task_detdesc.py +++ b/Rich/Panoptes/options/rich1_mirror_align_task_detdesc.py @@ -16,7 +16,8 @@ from GaudiKernel.SystemOfUnits import ( from Moore import ( options, - run_reconstruction, + configure_input, + configure ) from Panoptes.alignment import ( standalone_rich_mirror_align_reco, @@ -84,6 +85,9 @@ else: else: options.evt_max = iem * 1000 +# configure input +config = configure_input(options) + thisName = ("rich1_mirror_align_task_noUT" if '_noUT_' in variant else "rich1_mirror_align_task_detdesc") @@ -233,4 +237,5 @@ with track_maker.bind(use_pr_kf=True, light_reco=True, fast_reco=True),\ MirrorAlignTasks=tasks, \ EventFilter=event_filter, \ noUT=noUT): - run_reconstruction(options, standalone_rich_mirror_align_reco) + reconstruction = standalone_rich_mirror_align_reco() + config.update(configure(options, reconstruction.node)) diff --git a/Rich/Panoptes/options/rich2_mirror_align_task_detdesc.py b/Rich/Panoptes/options/rich2_mirror_align_task_detdesc.py index 3bf8ca334..624c67b95 100644 --- a/Rich/Panoptes/options/rich2_mirror_align_task_detdesc.py +++ b/Rich/Panoptes/options/rich2_mirror_align_task_detdesc.py @@ -16,7 +16,8 @@ from GaudiKernel.SystemOfUnits import ( from Moore import ( options, - run_reconstruction, + configure_input, + configure ) from Panoptes.alignment import ( standalone_rich_mirror_align_reco, @@ -84,6 +85,9 @@ else: else: options.evt_max = iem * 1000 +# configure input +config = configure_input(options) + thisName = ("rich2_mirror_align_task_noUT" if '_noUT_' in variant else "rich2_mirror_align_task_detdesc") @@ -468,4 +472,5 @@ with track_maker.bind(use_pr_kf=True, light_reco=True, fast_reco=True),\ MirrorAlignTasks=tasks, \ EventFilter=event_filter, \ noUT=noUT): - run_reconstruction(options, standalone_rich_mirror_align_reco) + reconstruction = standalone_rich_mirror_align_reco() + config.update(configure(options, reconstruction.node)) -- GitLab From 48bfdc012a70b2af1c04859a96243449de1ffa24 Mon Sep 17 00:00:00 2001 From: Sebastien Ponce Date: Thu, 4 Apr 2024 08:29:40 +0200 Subject: [PATCH 3/3] Deduplicated code between detdesc and dd4hep --- .../options/rich1_mirror_align_task.py | 67 +-- .../rich1_mirror_align_task_detdesc.py | 241 --------- .../options/rich2_mirror_align_task.py | 49 +- .../rich2_mirror_align_task_detdesc.py | 476 ------------------ Rich/Panoptes/tests/options/2022-data.py | 5 +- .../rich1_mirror_align_task_noUT_MC.qmt | 2 +- .../rich2_mirror_align_task_noUT_MC.qmt | 2 +- 7 files changed, 68 insertions(+), 774 deletions(-) delete mode 100644 Rich/Panoptes/options/rich1_mirror_align_task_detdesc.py delete mode 100644 Rich/Panoptes/options/rich2_mirror_align_task_detdesc.py diff --git a/Rich/Panoptes/options/rich1_mirror_align_task.py b/Rich/Panoptes/options/rich1_mirror_align_task.py index bb4f1a047..91b6bfd9d 100644 --- a/Rich/Panoptes/options/rich1_mirror_align_task.py +++ b/Rich/Panoptes/options/rich1_mirror_align_task.py @@ -15,8 +15,10 @@ from GaudiKernel.SystemOfUnits import ( GeV, ) from Moore import ( - options, - run_reconstruction, + options, ) +from PyConf.application import ( + configure_input, + configure, ) from Panoptes.alignment import ( standalone_rich_mirror_align_reco, @@ -32,6 +34,8 @@ from RecoConf.rich_reconstruction import ( from ruamel.yaml import ( YAML, ) +from DDDB.CheckDD4Hep import UseDD4Hep + tasks = [ 'Produce', # # fill the production set of histograms #'Monitor', # add various checking histograms @@ -67,15 +71,16 @@ with open('rich1_variant.yml') as inp: variant = yaml.load(inp) if isQMTest: - options.evt_max = 120000 - - ## use more data - more_data_Path = "mdf:root://eoslhcb.cern.ch//eos/lhcb/user/j/jreich/2022data_for_mirror_citests/" - more_data_files = [ - more_data_Path + "256276_{i}.mdf".format(i=i) for i in range(1, 127) - if i not in [8, 121] - ] - options.input_files = more_data_files + if UseDD4Hep: + options.evt_max = 120000 + + ## use more data + more_data_Path = "mdf:root://eoslhcb.cern.ch//eos/lhcb/user/j/jreich/2022data_for_mirror_citests/" + more_data_files = [ + more_data_Path + "256276_{i}.mdf".format(i=i) + for i in range(1, 127) if i not in [8, 121] + ] + options.input_files = more_data_files else: # retrieve number of events em = re.findall(r'([\d]+)k', variant)[0] @@ -85,8 +90,11 @@ else: else: options.evt_max = iem * 1000 -thisName = ("rich1_mirror_align_task_noUT" - if '_noUT_' in variant else "rich1_mirror_align_task") +# configure input +config = configure_input(options) + +thisName = ("rich1_mirror_align_task_noUT" if '_noUT_' in variant else + f"rich1_mirror_align_task{'_detdesc' if not UseDD4Hep else ''}") myName = (os.environ["QMTTEST_NAME"] if isQMTest else thisName) @@ -202,21 +210,17 @@ if '_R1_' in variant or '_R2_' in variant or '_R1M_' in variant or '_R2M_' in va if '_R2M_' in variant: line.append('Hlt1RICH2MapAlignDecision') + event_filter = [] with default_raw_event.bind(raw_event_format=0.3): - hlt1_dec_reports = HltDecReportsDecoder( RawBanks=default_raw_banks("HltDecReports"), SourceID='Hlt1') - - hlt1_filter = VoidFilter( - name='Streaming_filter', - Cut=F.DECREPORTS_FILTER( - Lines=line, - DecReports=hlt1_dec_reports.OutputHltDecReportsLocation)) - """ - print(hlt1_filter) - print(type(hlt1_filter)) - """ - event_filter = [hlt1_filter] + if UseDD4Hep: + hlt1_filter = VoidFilter( + name='Streaming_filter', + Cut=F.DECREPORTS_FILTER( + Lines=line, + DecReports=hlt1_dec_reports.OutputHltDecReportsLocation)) + event_filter = [hlt1_filter] # choose the relevant track_maker if noUT: @@ -229,9 +233,10 @@ with track_maker.bind(use_pr_kf=True, light_reco=True, fast_reco=True),\ default_rich_reco_options.bind(init_override_opts=default_reco_opts), \ default_rich_monitoring_options.bind(init_override_opts=default_moni_opts), \ alignment_rich_monitoring_options.bind(radiator='Rich1Gas', \ - init_override_opts=align_opts), \ - standalone_rich_mirror_align_reco.bind(RichGas='Rich1Gas', \ - MirrorAlignTasks=tasks, \ - EventFilter=event_filter, \ - noUT=noUT): - run_reconstruction(options, standalone_rich_mirror_align_reco) + init_override_opts=align_opts): + reconstruction = standalone_rich_mirror_align_reco( + RichGas='Rich1Gas', + MirrorAlignTasks=tasks, + EventFilter=event_filter, + noUT=noUT) + config.update(configure(options, reconstruction.node)) diff --git a/Rich/Panoptes/options/rich1_mirror_align_task_detdesc.py b/Rich/Panoptes/options/rich1_mirror_align_task_detdesc.py deleted file mode 100644 index 14f2ebf38..000000000 --- a/Rich/Panoptes/options/rich1_mirror_align_task_detdesc.py +++ /dev/null @@ -1,241 +0,0 @@ -############################################################################### -# (c) Copyright 2000-2018 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. # -############################################################################### - -import os, multiprocessing, re - -from GaudiKernel.SystemOfUnits import ( - GeV, ) - -from Moore import ( - options, - configure_input, - configure -) -from Panoptes.alignment import ( - standalone_rich_mirror_align_reco, - standalone_rich_online_align_reco, -) -from RecoConf.rich_data_monitoring import ( - default_rich_monitoring_options, - alignment_rich_monitoring_options, -) -from RecoConf.rich_reconstruction import ( - default_rich_reco_options, ) - -from ruamel.yaml import ( - YAML, ) - -tasks = [ - 'Produce', # # fill the production set of histograms - #'Monitor', # add various checking histograms - #'MapExlore', # explore tracks and photons for the HLT1 pre-selection line "map" - #'MapConstruct', # construct exploratory data structure for the HLT1 pre-selection line "map" - #'Map', # create data structure to be used in the HLT1 selection line with entire contents - #'MapUse', # use the "map" data structure a la in the HLT1 pre-selection line "map" - #'AllFillCount', # add counters for optimization of the RICH2 mirror combinations subset - #'AllFillPhi', # fill 1D phi histos for optimization of the RICH2 mirror combinations subset - #'MapPhi', # create data structure to be used in the HLT1 selection line with contents in quantiles - #'MapPhiUse', # use the "mapPhi" data structure in the HLT1 pre-selection line "mapPhi" - #'CheckRestFill',# check filling the rest of RICH2 mirror combinations along with 8 poorest - #'SkipFilled', # check filling all RICH2 mirror combinations with skipping when filled -] - -# cumulative substring with all tasks chosen -# to be included into histo_file name -histo_tasks = '' -for task in tasks: - histo_tasks += '_' + task - -isQMTest = 'QMTTEST_NAME' in os.environ - -# Override previously set defaults -# ROOT file reader currently not thread safe :( -options.n_threads = (1 if options.input_type == 'ROOT' or isQMTest else - multiprocessing.cpu_count()) - -yaml = YAML() - -# retrieve variant -with open('rich1_variant.yml') as inp: - variant = yaml.load(inp) - -if isQMTest: - # options.evt_max = 120000 - pass - ## use more data - #more_data_Path = "mdf:root://eoslhcb.cern.ch//eos/lhcb/user/j/jreich/2022data_for_mirror_citests/" - #more_data_files = [ - # more_data_Path + "256276_{i}.mdf".format(i=i) for i in range(1, 127) if i not in [8,121] - #] - #options.input_files = more_data_files -else: - # retrieve number of events - em = re.findall(r'([\d]+)k', variant)[0] - iem = int(em) - if iem == 0: - options.evt_max = 100 - else: - options.evt_max = iem * 1000 - -# configure input -config = configure_input(options) - -thisName = ("rich1_mirror_align_task_noUT" - if '_noUT_' in variant else "rich1_mirror_align_task_detdesc") - -myName = (os.environ["QMTTEST_NAME"] if isQMTest else thisName) - -noUT = "noUT" in myName - -# prepare updates: -default_reco_opts = {} -align_opts = {} - -# start updating the dicts: - -default_reco_opts.update({"PhotonSelection": 'None'}) - -align_opts.update({"Variant": variant}) - -if 'subset' in variant: - central_mirr_combs = { - "PrebookHistos": [ - ('p00', 's03'), - ('p01', 's06'), - ('p02', 's12'), - ('p03', 's09'), - ], - } - align_opts.update(central_mirr_combs) - -if 'minp40' in variant: - align_opts.update({"MinP4Align": 40. * GeV}) - -if 'theta2' in variant: - align_opts.update({"DeltaThetaRange": 0.002}) - -if 'qnt20f60' in variant: - if '1000k' in variant: - align_opts.update({"PoorestPopulation": 358.}) - elif '5000k' in variant: - align_opts.update({"PoorestPopulation": 1950.}) - -if '_phi2' in variant: - align_opts.update({"MinUsefulTracks": 2}) - -# prepare part of the overridden options in use -# to be recorded into the YAML file -align_opts_dump = alignment_rich_monitoring_options( - radiator='Rich1Gas', init_override_opts=align_opts) - -# prepare override of the default_rich_monitoring_options -default_tight_track_sel = default_rich_monitoring_options( -)["TightTrackSelection"] - -default_tight_track_sel["MinP"] = 40.0 * GeV - -default_moni_opts = { - "TightTrackSelection": default_tight_track_sel, - "UseUT": not noUT, -} - -# add overridden default_rich_monitoring_options -# to the part of the options in use to be recorded into the YAML file -align_opts_dump.update( - default_rich_monitoring_options(init_override_opts=default_moni_opts)) - -# retrieve timestamp from variant, not form file, to ensure consistency -ts = re.findall(r'[\d]{4}-[\d]{2}-[\d]{2}T[\d]{2}-[\d]{2}', variant)[0] - -# prepare options in use to be recorded into the YAML file -opts_dump = {} -opts_dump[ts] = {} -opts_dump[ts]['reco_opts'] = align_opts_dump - -# append YAML file with the part of the options in use -with open('rich1_reco_opts.yml', 'a') as out: - yaml.dump(opts_dump, out) - -# retrieve iteration number substring -with open('rich1_iter_number.yml') as inp: - iN = '_i' + str(yaml.load(inp)) - -# prepare histo_file name -if not isQMTest: - if tasks[0] == 'Produce': - options.histo_file = variant + iN + '.root' - else: - options.histo_file = variant + histo_tasks + iN + '.root' - -# by default, no additional filtering of the events -event_filter = [] - -# list of decisions with which events to take -line = [] - -# when particular decision of HLT1 line about RICH1 or RICH2 is wanted -if '_R1_' in variant or '_R2_' in variant or '_R1M_' in variant or '_R2M_' in variant: - # prepare filter for selecting events - # chosen for alignment of mirrors of particular RICH - import Functors as F - from PyConf.Algorithms import ( - VoidFilter, - HltDecReportsDecoder, - ) - from PyConf.application import ( - default_raw_banks, - default_raw_event, - ) - - # in principle, there can be any number and combination of them: - if '_R1_' in variant: - line.append('Hlt1RICH1AlignmentDecision') - if '_R2_' in variant: - line.append('Hlt1RICH2AlignmentDecision') - if '_R1M_' in variant: - line.append('Hlt1RICH1MapAlignDecision') - if '_R2M_' in variant: - line.append('Hlt1RICH2MapAlignDecision') - - with default_raw_event.bind(raw_event_format=0.3): - - hlt1_dec_reports = HltDecReportsDecoder( - RawBanks=default_raw_banks("HltDecReports"), SourceID='Hlt1') - - hlt1_filter = VoidFilter( - name='Streaming_filter', - Cut=F.DECREPORTS_FILTER( - Lines=line, - DecReports=hlt1_dec_reports.OutputHltDecReportsLocation)) - """ - print(hlt1_filter) - print(type(hlt1_filter)) - """ - event_filter = [] - -# choose the relevant track_maker -if noUT: - from RecoConf.hlt2_tracking import make_hlt2_tracks_without_UT as track_maker -else: - from RecoConf.hlt2_tracking import make_hlt2_tracks as track_maker - -# finally, run the reconstruction and histogram filling -with track_maker.bind(use_pr_kf=True, light_reco=True, fast_reco=True),\ - default_rich_reco_options.bind(init_override_opts=default_reco_opts), \ - default_rich_monitoring_options.bind(init_override_opts=default_moni_opts), \ - alignment_rich_monitoring_options.bind(radiator='Rich1Gas', \ - init_override_opts=align_opts), \ - standalone_rich_mirror_align_reco.bind(RichGas='Rich1Gas', \ - MirrorAlignTasks=tasks, \ - EventFilter=event_filter, \ - noUT=noUT): - reconstruction = standalone_rich_mirror_align_reco() - config.update(configure(options, reconstruction.node)) diff --git a/Rich/Panoptes/options/rich2_mirror_align_task.py b/Rich/Panoptes/options/rich2_mirror_align_task.py index 30b65792b..ea0b06e00 100644 --- a/Rich/Panoptes/options/rich2_mirror_align_task.py +++ b/Rich/Panoptes/options/rich2_mirror_align_task.py @@ -15,8 +15,10 @@ from GaudiKernel.SystemOfUnits import ( GeV, ) from Moore import ( - options, - run_reconstruction, + options, ) +from PyConf.application import ( + configure_input, + configure, ) from Panoptes.alignment import ( standalone_rich_mirror_align_reco, @@ -32,6 +34,8 @@ from RecoConf.rich_reconstruction import ( from ruamel.yaml import ( YAML, ) +from DDDB.CheckDD4Hep import UseDD4Hep + tasks = [ 'Produce', # # fill the production set of histograms #'Monitor', # add various checking histograms @@ -67,15 +71,16 @@ with open('rich2_variant.yml') as inp: variant = yaml.load(inp) if isQMTest: - options.evt_max = 120000 - - ## use more data - more_data_Path = "mdf:root://eoslhcb.cern.ch//eos/lhcb/user/j/jreich/2022data_for_mirror_citests/" - more_data_files = [ - more_data_Path + "256276_{i}.mdf".format(i=i) for i in range(1, 127) - if i not in [8, 121] - ] - options.input_files = more_data_files + if UseDD4Hep: + options.evt_max = 120000 + + ## use more data + more_data_Path = "mdf:root://eoslhcb.cern.ch//eos/lhcb/user/j/jreich/2022data_for_mirror_citests/" + more_data_files = [ + more_data_Path + "256276_{i}.mdf".format(i=i) + for i in range(1, 127) if i not in [8, 121] + ] + options.input_files = more_data_files else: # retrieve number of events em = re.findall(r'([\d]+)k', variant)[0] @@ -85,8 +90,11 @@ else: else: options.evt_max = iem * 1000 -thisName = ("rich2_mirror_align_task_noUT" - if '_noUT_' in variant else "rich2_mirror_align_task") +# configure input +config = configure_input(options) + +thisName = ("rich2_mirror_align_task_noUT" if '_noUT_' in variant else + f"rich2_mirror_align_task{'_detdesc' if not UseDD4Hep else ''}") myName = (os.environ["QMTTEST_NAME"] if isQMTest else thisName) @@ -451,7 +459,7 @@ if '_R1_' in variant or '_R2_' in variant or '_R1M_' in variant or '_R2M_' in va print(hlt1_filter) print(type(hlt1_filter)) """ - event_filter = [hlt1_filter] + event_filter = [hlt1_filter] if UseDD4Hep else [] # choose the relevant track_maker if noUT: @@ -464,9 +472,10 @@ with track_maker.bind(use_pr_kf=True, light_reco=True, fast_reco=True),\ default_rich_reco_options.bind(init_override_opts=default_reco_opts), \ default_rich_monitoring_options.bind(init_override_opts=default_moni_opts), \ alignment_rich_monitoring_options.bind(radiator='Rich2Gas', \ - init_override_opts=align_opts), \ - standalone_rich_mirror_align_reco.bind(RichGas='Rich2Gas', \ - MirrorAlignTasks=tasks, \ - EventFilter=event_filter, \ - noUT=noUT): - run_reconstruction(options, standalone_rich_mirror_align_reco) + init_override_opts=align_opts): + reconstruction = standalone_rich_mirror_align_reco( + RichGas='Rich2Gas', + MirrorAlignTasks=tasks, + EventFilter=event_filter, + noUT=noUT) + config.update(configure(options, reconstruction.node)) diff --git a/Rich/Panoptes/options/rich2_mirror_align_task_detdesc.py b/Rich/Panoptes/options/rich2_mirror_align_task_detdesc.py deleted file mode 100644 index 624c67b95..000000000 --- a/Rich/Panoptes/options/rich2_mirror_align_task_detdesc.py +++ /dev/null @@ -1,476 +0,0 @@ -############################################################################### -# (c) Copyright 2000-2018 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. # -############################################################################### - -import os, multiprocessing, re - -from GaudiKernel.SystemOfUnits import ( - GeV, ) - -from Moore import ( - options, - configure_input, - configure -) -from Panoptes.alignment import ( - standalone_rich_mirror_align_reco, - standalone_rich_online_align_reco, -) -from RecoConf.rich_data_monitoring import ( - default_rich_monitoring_options, - alignment_rich_monitoring_options, -) -from RecoConf.rich_reconstruction import ( - default_rich_reco_options, ) - -from ruamel.yaml import ( - YAML, ) - -tasks = [ - 'Produce', # # fill the production set of histograms - #'Monitor', # add various checking histograms - #'MapExlore', # explore tracks and photons for the HLT1 pre-selection line "map" - #'MapConstruct', # construct exploratory data structure for the HLT1 pre-selection line "map" - #'Map', # create data structure to be used in the HLT1 selection line with entire contents - #'MapUse', # use the "map" data structure a la in the HLT1 pre-selection line "map" - #'AllFillCount', # add counters for optimization of the RICH2 mirror combinations subset - #'AllFillPhi', # fill 1D phi histos for optimization of the RICH2 mirror combinations subset - #'MapPhi', # create data structure to be used in the HLT1 selection line with contents in quantiles - #'MapPhiUse', # use the "mapPhi" data structure in the HLT1 pre-selection line "mapPhi" - #'CheckRestFill',# check filling the rest of RICH2 mirror combinations along with 8 poorest - #'SkipFilled', # check filling all RICH2 mirror combinations with skipping when filled -] - -# cumulative substring with all tasks chosen -# to be included into histo_file name -histo_tasks = '' -for task in tasks: - histo_tasks += '_' + task - -isQMTest = 'QMTTEST_NAME' in os.environ - -# Override previously set defaults -# ROOT file reader currently not thread safe :( -options.n_threads = (1 if options.input_type == 'ROOT' or isQMTest else - multiprocessing.cpu_count()) - -yaml = YAML() - -# retrieve variant -with open('rich2_variant.yml') as inp: - variant = yaml.load(inp) - -if isQMTest: - #options.evt_max = 120000 - pass - ## use more data - #more_data_Path = "mdf:root://eoslhcb.cern.ch//eos/lhcb/user/j/jreich/2022data_for_mirror_citests/" - #more_data_files = [ - # more_data_Path + "256276_{i}.mdf".format(i=i) for i in range(1, 127) - #] - #options.input_files = more_data_files -else: - # retrieve number of events - em = re.findall(r'([\d]+)k', variant)[0] - iem = int(em) - if iem == 0: - options.evt_max = 100 - else: - options.evt_max = iem * 1000 - -# configure input -config = configure_input(options) - -thisName = ("rich2_mirror_align_task_noUT" - if '_noUT_' in variant else "rich2_mirror_align_task_detdesc") - -myName = (os.environ["QMTTEST_NAME"] if isQMTest else thisName) - -noUT = "noUT" in myName - -# prepare updates: -default_reco_opts = {} -align_opts = {} - -# start updating the dicts: - -default_reco_opts.update({"PhotonSelection": 'None'}) - -align_opts.update({"Variant": variant}) -if 'subset' in variant: - central_mirr_combs = { - "PrebookHistos": [ - ('p08', 's04'), - ('p08', 's08'), - ('p09', 's05'), - ('p09', 's09'), - ('p12', 's08'), - ('p12', 's09'), - ('p13', 's09'), - ('p13', 's10'), - ('p16', 's08'), - ('p16', 's12'), - ('p17', 's09'), - ('p17', 's13'), - ('p38', 's26'), - ('p38', 's30'), - ('p39', 's27'), - ('p39', 's31'), - ('p42', 's29'), - ('p42', 's30'), - ('p43', 's30'), - ('p43', 's31'), - ('p46', 's30'), - ('p46', 's34'), - ('p47', 's31'), - ('p47', 's35'), - ], - } - align_opts.update(central_mirr_combs) - -if '_phi' in variant: - optimal_mirr_combs = { - "PrebookHistos": [ - ('p00', 's00'), - ('p01', 's01'), - ('p02', 's02'), - ('p03', 's03'), - ('p04', 's00'), - ('p04', 's01'), - ('p04', 's04'), - ('p05', 's02'), - ('p05', 's05'), - ('p06', 's06'), - ('p07', 's03'), - ('p07', 's07'), - ('p08', 's04'), - ('p08', 's08'), - ('p09', 's05'), - ('p09', 's09'), - ('p10', 's06'), - ('p10', 's10'), - ('p11', 's07'), - ('p11', 's11'), - ('p12', 's08'), - ('p12', 's09'), - ('p13', 's09'), - ('p13', 's10'), - ('p14', 's10'), - ('p14', 's11'), - ('p15', 's11'), - ('p16', 's08'), - ('p16', 's12'), - ('p17', 's09'), - ('p17', 's13'), - ('p18', 's10'), - ('p18', 's14'), - ('p19', 's11'), - ('p19', 's15'), - ('p20', 's12'), - ('p20', 's16'), - ('p21', 's13'), - ('p21', 's17'), - ('p21', 's18'), - ('p22', 's14'), - ('p23', 's15'), - ('p23', 's19'), - ('p24', 's16'), - ('p25', 's17'), - ('p26', 's18'), - ('p27', 's19'), - ('p28', 's20'), - ('p29', 's21'), - ('p30', 's22'), - ('p31', 's23'), - ('p32', 's20'), - ('p32', 's24'), - ('p33', 's25'), - ('p34', 's21'), - ('p34', 's22'), - ('p34', 's26'), - ('p35', 's23'), - ('p35', 's27'), - ('p36', 's24'), - ('p36', 's28'), - ('p37', 's25'), - ('p37', 's29'), - ('p38', 's26'), - ('p38', 's30'), - ('p39', 's27'), - ('p39', 's31'), - ('p40', 's28'), - ('p41', 's28'), - ('p41', 's29'), - ('p42', 's29'), - ('p42', 's30'), - ('p43', 's30'), - ('p43', 's31'), - ('p44', 's28'), - ('p44', 's32'), - ('p45', 's29'), - ('p45', 's33'), - ('p46', 's30'), - ('p46', 's34'), - ('p47', 's31'), - ('p47', 's35'), - ('p48', 's32'), - ('p49', 's33'), - ('p49', 's36'), - ('p50', 's34'), - ('p50', 's37'), - ('p51', 's35'), - ('p51', 's38'), - ('p51', 's39'), - ('p52', 's36'), - ('p53', 's37'), - ('p54', 's38'), - ('p55', 's39'), - ], - } - align_opts.update(optimal_mirr_combs) - -if 'qnt20f60' in variant: - optimal_mirr_combs = { - "PrebookHistos": [ - ('p00', 's00'), - ('p01', 's01'), - ('p02', 's02'), - ('p03', 's03'), - ('p04', 's00'), - ('p04', 's01'), - ('p04', 's04'), - ('p05', 's02'), - ('p05', 's05'), - ('p06', 's06'), - ('p07', 's03'), - ('p07', 's07'), - ('p08', 's04'), - ('p08', 's08'), - ('p09', 's05'), - ('p09', 's09'), - ('p10', 's06'), - ('p10', 's10'), - ('p11', 's07'), - ('p11', 's11'), - ('p12', 's08'), - ('p12', 's09'), - ('p13', 's09'), - ('p13', 's10'), - ('p14', 's10'), - ('p14', 's11'), - ('p15', 's11'), - ('p16', 's08'), - ('p16', 's12'), - ('p17', 's09'), - ('p17', 's13'), - ('p18', 's10'), - ('p18', 's14'), - ('p19', 's11'), - ('p19', 's15'), - ('p20', 's12'), - ('p20', 's16'), - ('p21', 's13'), - ('p21', 's17'), - ('p21', 's18'), - ('p22', 's14'), - ('p23', 's15'), - ('p23', 's19'), - ('p24', 's16'), - ('p25', 's17'), - ('p26', 's18'), - ('p27', 's19'), - ('p28', 's20'), - ('p29', 's21'), - ('p30', 's22'), - ('p31', 's23'), - ('p32', 's20'), - ('p32', 's24'), - ('p33', 's25'), - ('p34', 's21'), - ('p34', 's22'), - ('p34', 's26'), - ('p35', 's23'), - ('p35', 's27'), - ('p36', 's24'), - ('p36', 's28'), - ('p37', 's25'), - ('p37', 's29'), - ('p38', 's26'), - ('p38', 's30'), - ('p39', 's27'), - ('p39', 's31'), - ('p40', 's28'), - ('p41', 's28'), - ('p41', 's29'), - ('p42', 's29'), - ('p42', 's30'), - ('p43', 's30'), - ('p43', 's31'), - ('p44', 's28'), - ('p44', 's32'), - ('p45', 's29'), - ('p45', 's33'), - ('p46', 's30'), - ('p46', 's34'), - ('p47', 's31'), - ('p47', 's35'), - ('p48', 's32'), - ('p49', 's33'), - ('p49', 's36'), - ('p50', 's34'), - ('p50', 's37'), - ('p51', 's35'), - ('p51', 's38'), - ('p51', 's39'), - ('p52', 's36'), - ('p53', 's37'), - ('p54', 's38'), - ('p55', 's39'), - ], - } - align_opts.update(optimal_mirr_combs) - -if 'minp60' in variant: - align_opts.update({"MinP4Align": 60. * GeV}) - -if 'theta2' in variant: - align_opts.update({"DeltaThetaRange": 0.002}) - -if not '_phi' in variant: - if '40k' in variant: - align_opts.update({"PoorestPopulation": 10.}) - elif '1000k' in variant: - align_opts.update({"PoorestPopulation": 341.}) - elif '5000k' in variant: - align_opts.update({"PoorestPopulation": 2688.}) - -if '_phi' in variant: - if '40k' in variant: - align_opts.update({"PoorestPopulation": 1.}) - elif '1000k' in variant: - align_opts.update({"PoorestPopulation": 20.}) - elif '5000k' in variant: - align_opts.update({"PoorestPopulation": 113.}) - -if 'qnt20f60' in variant: - if '5000k' in variant: - align_opts.update({"PoorestPopulation": 310.}) - -if '_phi2' in variant: - align_opts.update({"MinUsefulTracks": 2}) - -# prepare part of the overridden options in use -# to be recorded into the YAML file -align_opts_dump = alignment_rich_monitoring_options( - radiator='Rich2Gas', init_override_opts=align_opts) - -# prepare override of the default_rich_monitoring_options -default_tight_track_sel = default_rich_monitoring_options( -)["TightTrackSelection"] - -default_tight_track_sel["MinP"] = 60.0 * GeV - -default_moni_opts = { - "TightTrackSelection": default_tight_track_sel, - "UseUT": not noUT, -} - -# add overridden default_rich_monitoring_options -# to the part of the options in use to be recorded into the YAML file -align_opts_dump.update( - default_rich_monitoring_options(init_override_opts=default_moni_opts)) - -# retrieve the timestamp -ts = re.findall(r'[\d]{4}-[\d]{2}-[\d]{2}T[\d]{2}-[\d]{2}', variant)[0] - -# prepare options in use to be recorded into the YAML file -opts_dump = {} -opts_dump[ts] = {} -opts_dump[ts]['reco_opts'] = align_opts_dump - -# append YAML file with the part of the options in use -with open('rich2_reco_opts.yml', 'a') as out: - yaml.dump(opts_dump, out) - -# retrieve iteration number substring -with open('rich2_iter_number.yml') as inp: - iN = '_i' + str(yaml.load(inp)) - -# prepare histo_file name -if not isQMTest: - if tasks[0] == 'Produce': - options.histo_file = variant + iN + '.root' - else: - options.histo_file = variant + histo_tasks + iN + '.root' - -# by default, no additional filtering of the events -event_filter = [] - -# list of decisions with which events to take -line = [] - -# when particular decision of HLT1 line about RICH1 or RICH2 is wanted -if '_R1_' in variant or '_R2_' in variant or '_R1M_' in variant or '_R2M_' in variant: - # prepare filter for selecting events - # chosen for alignment of mirrors of particular RICH - import Functors as F - from PyConf.Algorithms import ( - VoidFilter, - HltDecReportsDecoder, - ) - from PyConf.application import ( - default_raw_banks, - default_raw_event, - ) - - # in principle, there can be any number and combination of them: - if '_R1_' in variant: - line.append('Hlt1RICH1AlignmentDecision') - if '_R2_' in variant: - line.append('Hlt1RICH2AlignmentDecision') - if '_R1M_' in variant: - line.append('Hlt1RICH1MapAlignDecision') - if '_R2M_' in variant: - line.append('Hlt1RICH2MapAlignDecision') - - with default_raw_event.bind(raw_event_format=0.3): - - hlt1_dec_reports = HltDecReportsDecoder( - RawBanks=default_raw_banks("HltDecReports"), SourceID='Hlt1') - - hlt1_filter = VoidFilter( - name='Streaming_filter', - Cut=F.DECREPORTS_FILTER( - Lines=line, - DecReports=hlt1_dec_reports.OutputHltDecReportsLocation)) - """ - print(hlt1_filter) - print(type(hlt1_filter)) - """ - event_filter = [] - -# choose the relevant track_maker -if noUT: - from RecoConf.hlt2_tracking import make_hlt2_tracks_without_UT as track_maker -else: - from RecoConf.hlt2_tracking import make_hlt2_tracks as track_maker - -# finally, run the reconstruction and histogram filling -with track_maker.bind(use_pr_kf=True, light_reco=True, fast_reco=True),\ - default_rich_reco_options.bind(init_override_opts=default_reco_opts), \ - default_rich_monitoring_options.bind(init_override_opts=default_moni_opts), \ - alignment_rich_monitoring_options.bind(radiator='Rich2Gas', \ - init_override_opts=align_opts), \ - standalone_rich_mirror_align_reco.bind(RichGas='Rich2Gas', \ - MirrorAlignTasks=tasks, \ - EventFilter=event_filter, \ - noUT=noUT): - reconstruction = standalone_rich_mirror_align_reco() - config.update(configure(options, reconstruction.node)) diff --git a/Rich/Panoptes/tests/options/2022-data.py b/Rich/Panoptes/tests/options/2022-data.py index d94f4031f..f7b70edb4 100644 --- a/Rich/Panoptes/tests/options/2022-data.py +++ b/Rich/Panoptes/tests/options/2022-data.py @@ -11,7 +11,6 @@ import os from Moore import options -from Configurables import LHCbApp # This script is dd4hep only @@ -25,11 +24,9 @@ options.input_files = [ # test one run #options.input_files = [ "/usera/jonesc/NFS/data/RunIII/Hlt2/LHCb/0000252186/Run_0000252186_HLT20101_20221104-114633-502.mdf"] -#options.use_iosvc = True - options.input_type = "MDF" -LHCbApp().DataType = "Upgrade" +options.data_type = "Upgrade" options.simulation = False diff --git a/Rich/Panoptes/tests/qmtest/rich1_mirror_align_task_noUT_MC.qmt b/Rich/Panoptes/tests/qmtest/rich1_mirror_align_task_noUT_MC.qmt index 5b15f1aca..a063ab5a5 100644 --- a/Rich/Panoptes/tests/qmtest/rich1_mirror_align_task_noUT_MC.qmt +++ b/Rich/Panoptes/tests/qmtest/rich1_mirror_align_task_noUT_MC.qmt @@ -22,7 +22,7 @@ Run RICH1 mirror alignment reconstruction task $PANOPTESROOT/options/rich1_variant.py $MOOREROOT/tests/options/mdf_input_and_conds.py $MOOREROOT/tests/options/download_mdf_input.py - $PANOPTESROOT/options/rich1_mirror_align_task_detdesc.py + $PANOPTESROOT/options/rich1_mirror_align_task.py ../refs/rich1_mirror_align_task_noUT_MC.ref ../refs/empty.ref diff --git a/Rich/Panoptes/tests/qmtest/rich2_mirror_align_task_noUT_MC.qmt b/Rich/Panoptes/tests/qmtest/rich2_mirror_align_task_noUT_MC.qmt index ada8434ea..a6488c552 100644 --- a/Rich/Panoptes/tests/qmtest/rich2_mirror_align_task_noUT_MC.qmt +++ b/Rich/Panoptes/tests/qmtest/rich2_mirror_align_task_noUT_MC.qmt @@ -22,7 +22,7 @@ Run RICH2 mirror alignment reconstruction task $PANOPTESROOT/options/rich2_variant.py $MOOREROOT/tests/options/mdf_input_and_conds.py $MOOREROOT/tests/options/download_mdf_input.py - $PANOPTESROOT/options/rich2_mirror_align_task_detdesc.py + $PANOPTESROOT/options/rich2_mirror_align_task.py ../refs/rich2_mirror_align_task_noUT_MC.ref ../refs/empty.ref -- GitLab