From e99bdaf4b57916e7817408226197ca7a20565fdb Mon Sep 17 00:00:00 2001 From: FaserMC <fasermc@cern.ch> Date: Sat, 17 Dec 2022 01:02:54 +0100 Subject: [PATCH] Numerous updates to scripts and log messages for mc22 --- .../CaloDigiAlgs/python/CaloDigiAlgsConfig.py | 22 +++++----- .../CaloDigiAlgs/src/CaloWaveformDigiAlg.cxx | 7 +++- .../Digitization/scripts/faser_digi.py | 2 +- .../Digitization/scripts/faser_digi_merge.py | 5 +-- .../Digitization/scripts/submit_faser_digi.sh | 40 +++++++------------ .../scripts/submit_faser_digi_merge.sh | 16 ++++---- .../scripts/submit_faser_particlegun.sh | 3 +- .../scripts/submit_faser_reco.sh | 3 +- .../python/MagFieldServicesConfig.py | 2 + .../python/ScintDigiAlgsConfig.py | 10 ++--- .../src/ScintWaveformDigiAlg.cxx | 7 +++- .../src/RawWaveformContainerCnv_p0.cxx | 4 +- .../python/WaveformDigitizationConfig.py | 10 ++++- 13 files changed, 70 insertions(+), 61 deletions(-) diff --git a/Calorimeter/CaloDigiAlgs/python/CaloDigiAlgsConfig.py b/Calorimeter/CaloDigiAlgs/python/CaloDigiAlgsConfig.py index 859ceec2..85b56fe6 100644 --- a/Calorimeter/CaloDigiAlgs/python/CaloDigiAlgsConfig.py +++ b/Calorimeter/CaloDigiAlgs/python/CaloDigiAlgsConfig.py @@ -7,7 +7,7 @@ from AthenaConfiguration.ComponentFactory import CompFactory from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg from WaveformConditionsTools.WaveformCableMappingConfig import WaveformCableMappingCfg -#from WaveformConditionsTools.WaveformDigitizationConfig import WaveformDigitizationCfg +from WaveformConditionsTools.WaveformDigitizationConfig import WaveformDigitizationCfg from IOVDbSvc.IOVDbSvcConfig import addFolders @@ -20,20 +20,22 @@ def CaloWaveformDigitizationCfg(flags, **kwargs): return acc # Define folder and tag - dbInstance = kwargs.get("dbInstance", "TRIGGER_OFL") - dbFolder = kwargs.get("dbFolder", "/WAVE/Digitization") - caloDigiTag = kwargs.pop("digiTag", "") + # dbInstance = kwargs.get("dbInstance", "TRIGGER_OFL") + # dbFolder = kwargs.get("dbFolder", "/WAVE/Digitization") + # caloDigiTag = kwargs.pop("digiTag", "") - if len(caloDigiTag) > 0: - print(f"Found digiTag={caloDigiTag}") - acc.merge(addFolders(flags, dbFolder, dbInstance, className="CondAttrListCollection", tag=caloDigiTag)) - else: - acc.merge(addFolders(flags, dbFolder, dbInstance, className="CondAttrListCollection")) + # if len(caloDigiTag) > 0: + # print(f"Found digiTag={caloDigiTag}") + # acc.merge(addFolders(flags, dbFolder, dbInstance, className="CondAttrListCollection", tag=caloDigiTag)) + # else: + # acc.merge(addFolders(flags, dbFolder, dbInstance, className="CondAttrListCollection")) + + acc.merge(WaveformDigitizationCfg(flags, **kwargs)) + kwargs.pop("digiTag") # Remove this if it is specified acc.merge(CaloWaveformDigiCfg(flags, "CaloWaveformDigiAlg", **kwargs)) acc.merge(CaloWaveformDigitizationOutputCfg(flags)) acc.merge(WaveformCableMappingCfg(flags)) - #acc.merge(WaveformDigitizationCfg(flags)) return acc diff --git a/Calorimeter/CaloDigiAlgs/src/CaloWaveformDigiAlg.cxx b/Calorimeter/CaloDigiAlgs/src/CaloWaveformDigiAlg.cxx index a44c0d2b..9f62fd57 100644 --- a/Calorimeter/CaloDigiAlgs/src/CaloWaveformDigiAlg.cxx +++ b/Calorimeter/CaloDigiAlgs/src/CaloWaveformDigiAlg.cxx @@ -72,7 +72,12 @@ CaloWaveformDigiAlg::execute(const EventContext& ctx) const { if (!m_kernel) { - ATH_MSG_INFO("Setting up calo digitization kernel"); + ATH_MSG_INFO(name() << ": initialize waveform digitization kernel"); + ATH_MSG_INFO(" Norm: " << m_digiCondTool->cb_norm(ctx)); + ATH_MSG_INFO(" Mean: " << m_digiCondTool->cb_mean(ctx)); + ATH_MSG_INFO(" Sigma: " << m_digiCondTool->cb_sigma(ctx)); + ATH_MSG_INFO(" Alpha: " << m_digiCondTool->cb_alpha(ctx)); + ATH_MSG_INFO(" N: " << m_digiCondTool->cb_n(ctx)); // Set up waveform shape m_kernel = new TF1("PDF", "[4] * ROOT::Math::crystalball_pdf(x, [0],[1],[2],[3])", 0, 1200); diff --git a/Control/CalypsoExample/Digitization/scripts/faser_digi.py b/Control/CalypsoExample/Digitization/scripts/faser_digi.py index d20e89ab..0e48e1e2 100755 --- a/Control/CalypsoExample/Digitization/scripts/faser_digi.py +++ b/Control/CalypsoExample/Digitization/scripts/faser_digi.py @@ -166,7 +166,7 @@ from CaloDigiAlgs.CaloDigiAlgsConfig import CaloWaveformDigitizationCfg acc.merge(CaloWaveformDigitizationCfg(ConfigFlags, digiTag=args.digiTag)) from ScintDigiAlgs.ScintDigiAlgsConfig import ScintWaveformDigitizationCfg -acc.merge(ScintWaveformDigitizationCfg(ConfigFlags)) +acc.merge(ScintWaveformDigitizationCfg(ConfigFlags, digiTag=args.digiTag)) # Configure verbosity if args.verbose: diff --git a/Control/CalypsoExample/Digitization/scripts/faser_digi_merge.py b/Control/CalypsoExample/Digitization/scripts/faser_digi_merge.py index 572148a1..ec595160 100755 --- a/Control/CalypsoExample/Digitization/scripts/faser_digi_merge.py +++ b/Control/CalypsoExample/Digitization/scripts/faser_digi_merge.py @@ -216,14 +216,11 @@ from FaserSCT_Digitization.FaserSCT_DigitizationConfigNew import FaserSCT_Digiti acc.merge(FaserSCT_DigitizationCfg(ConfigFlags)) # Pass something to set folder tag -if len(args.digiTag) > 0: - print(f"Using digiTag: {args.digiTag}") - from CaloDigiAlgs.CaloDigiAlgsConfig import CaloWaveformDigitizationCfg acc.merge(CaloWaveformDigitizationCfg(ConfigFlags, digiTag=args.digiTag)) from ScintDigiAlgs.ScintDigiAlgsConfig import ScintWaveformDigitizationCfg -acc.merge(ScintWaveformDigitizationCfg(ConfigFlags)) +acc.merge(ScintWaveformDigitizationCfg(ConfigFlags, digiTag=args.digiTag)) # Configure verbosity if args.verbose: diff --git a/Control/CalypsoExample/Digitization/scripts/submit_faser_digi.sh b/Control/CalypsoExample/Digitization/scripts/submit_faser_digi.sh index 76abf817..40eefbf2 100644 --- a/Control/CalypsoExample/Digitization/scripts/submit_faser_digi.sh +++ b/Control/CalypsoExample/Digitization/scripts/submit_faser_digi.sh @@ -28,13 +28,14 @@ SECONDS=0 while [ -n "$1" ] do case "$1" in - --highGain) - echo "Applying high gain settings" - highgain=1 - shift;; # This 'eats' the argument + --digiTag) + echo "Override calo digi tag with $2" + gainstr="--digiTag $2" + shift; + shift;; -g | --geom) - geom="$2"; + geomstr="--geom $2"; shift; shift;; @@ -112,7 +113,8 @@ logfile="${file_stem}.rdo.log" exec >& "${output_directory}/${logfile}" echo `date` - $HOSTNAME echo "File: $file_name" -echo "Geom: $geom" +echo "Geom: $geomstr" +echo "Gain: $gainstr" echo "Release: $release_directory" echo "Output: $output_directory" echo "Starting: $starting_directory" @@ -131,8 +133,8 @@ cd "$release_directory" # Do this by hand asetup --input=calypso/asetup.faser Athena,22.0.49 source run/setup.sh -#source build/x86*/setup.sh # +echo "ATLAS_POOLCOND_PATH = $ATLAS_POOLCOND_PATH" # # Try to find a release tag cd calypso @@ -150,6 +152,12 @@ if [[ "$recotag" == "sim/s"???? ]]; then echo "Found sim tag: $tag" fi # +if [[ -z "$tag" ]]; then + tagstr="" +else + tagstr="--tag $tag" +fi +# # Move to the run directory cd "$starting_directory" cd "$output_directory" @@ -170,24 +178,6 @@ cd "$file_stem" # # Run job # -if [[ -z "$highgain" ]]; then - gainstr="" -else - gainstr="--highCaloGain" -fi -# -if [[ -z "$geom" ]]; then - geomstr="" -else - geomstr="--geom $geom" -fi -# -if [[ -z "$tag" ]]; then - tagstr="" -else - tagstr="--tag=$tag" -fi -# faser_digi.py $geomstr $gainstr $tagstr "$file_path" # # Print out ending time diff --git a/Control/CalypsoExample/Digitization/scripts/submit_faser_digi_merge.sh b/Control/CalypsoExample/Digitization/scripts/submit_faser_digi_merge.sh index fd2fe20e..6b794633 100755 --- a/Control/CalypsoExample/Digitization/scripts/submit_faser_digi_merge.sh +++ b/Control/CalypsoExample/Digitization/scripts/submit_faser_digi_merge.sh @@ -35,10 +35,11 @@ geomstr="" while [ -n "$1" ] do case "$1" in - --highGain) - echo "Applying high gain settings" - gainstr="--highCaloGain" - shift;; # This 'eats' the argument + --digiTag) + echo "Override calo digi tag with $2" + gainstr="--digiTag $2" + shift; + shift;; --partial) echo "Allowing partial merge" @@ -143,7 +144,8 @@ logfile="${file_stem}.rdo.log" exec >& "$output_directory/$logfile" echo `date` - $HOSTNAME echo "Directory: $dir_path" -echo "Geom: $geom" +echo "Geom: $geomstr" +echo "Gain: $gainstr" echo "Slice: $slice" echo "NFiles: $nfiles" echo "Release: $release_directory" @@ -164,9 +166,9 @@ cd "$release_directory" # # Do this by hand asetup --input=calypso/asetup.faser Athena,22.0.49 -# source build/x86*/setup.sh source run/setup.sh # +echo "ATLAS_POOLCOND_PATH = $ATLAS_POOLCOND_PATH" # # Try to find a release tag cd calypso @@ -187,7 +189,7 @@ fi if [[ -z "$tag" ]]; then tagstr="" else - tagstr="-- $tag" + tagstr="--tag $tag" fi # # Move to the run directory diff --git a/Control/CalypsoExample/Generation/scripts/submit_faser_particlegun.sh b/Control/CalypsoExample/Generation/scripts/submit_faser_particlegun.sh index ec13600f..c41b9c89 100755 --- a/Control/CalypsoExample/Generation/scripts/submit_faser_particlegun.sh +++ b/Control/CalypsoExample/Generation/scripts/submit_faser_particlegun.sh @@ -140,7 +140,8 @@ cd "$release_directory" # # Do this by hand asetup --input=calypso/asetup.faser Athena,22.0.49 -source build/x86*/setup.sh +source run/setup.sh +echo "ATLAS_POOLCOND_PATH = $ATLAS_POOLCOND_PATH" # # # Try to find a release tag diff --git a/Control/CalypsoExample/Reconstruction/scripts/submit_faser_reco.sh b/Control/CalypsoExample/Reconstruction/scripts/submit_faser_reco.sh index 69245061..e5936038 100755 --- a/Control/CalypsoExample/Reconstruction/scripts/submit_faser_reco.sh +++ b/Control/CalypsoExample/Reconstruction/scripts/submit_faser_reco.sh @@ -137,7 +137,8 @@ cd "$release_directory" # Do this by hand asetup --input=calypso/asetup.faser Athena,22.0.49 source run/setup.sh -#source build/x86*/setup.sh +# +echo "ATLAS_POOLCOND_PATH = $ATLAS_POOLCOND_PATH" # # Try to find a release tag cd calypso diff --git a/MagneticField/MagFieldServices/python/MagFieldServicesConfig.py b/MagneticField/MagFieldServices/python/MagFieldServicesConfig.py index 4ebac8a5..37c0b39c 100644 --- a/MagneticField/MagFieldServices/python/MagFieldServicesConfig.py +++ b/MagneticField/MagFieldServices/python/MagFieldServicesConfig.py @@ -72,7 +72,9 @@ def MagneticFieldSvcCfg(flags, **kwargs): "name": "FaserFieldSvc", } # afsArgs.update( UseDCS = False ) + mag_field_svc = CompFactory.MagField.FaserFieldSvc(**afsArgs) + mag_field_svc.FullMapFile = "MagneticFieldMaps/FaserFieldTable_v2.root" result.addService(mag_field_svc, primary=True) # FaserFieldMapCondAlg - for reading in map diff --git a/Scintillator/ScintDigiAlgs/python/ScintDigiAlgsConfig.py b/Scintillator/ScintDigiAlgs/python/ScintDigiAlgsConfig.py index 7f65467a..538f8d2a 100644 --- a/Scintillator/ScintDigiAlgs/python/ScintDigiAlgsConfig.py +++ b/Scintillator/ScintDigiAlgs/python/ScintDigiAlgsConfig.py @@ -6,6 +6,7 @@ from AthenaConfiguration.ComponentFactory import CompFactory from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg from WaveformConditionsTools.WaveformCableMappingConfig import WaveformCableMappingCfg +from WaveformConditionsTools.WaveformDigitizationConfig import WaveformDigitizationCfg # One stop shopping for normal FASER data def ScintWaveformDigitizationCfg(flags, **kwargs): @@ -15,6 +16,9 @@ def ScintWaveformDigitizationCfg(flags, **kwargs): if not flags.Input.isMC: return acc + acc.merge(WaveformDigitizationCfg(flags, **kwargs)) + kwargs.pop("digiTag") + if "TB" in flags.GeoModel.FaserVersion: acc.merge(ScintWaveformDigiCfg(flags, "VetoWaveformDigiAlg", "Veto")) acc.merge(ScintWaveformDigiCfg(flags, "PreshowerWaveformDigiAlg", "Preshower")) @@ -27,12 +31,6 @@ def ScintWaveformDigitizationCfg(flags, **kwargs): acc.merge(ScintWaveformDigitizationOutputCfg(flags)) acc.merge(WaveformCableMappingCfg(flags)) - # Just do this here for now - dbInstance = kwargs.get("dbInstance", "TRIGGER_OFL") - dbFolder = kwargs.get("dbFolder", "/WAVE/Digitization") - from IOVDbSvc.IOVDbSvcConfig import addFolders - acc.merge(addFolders(flags, dbFolder, dbInstance, className="CondAttrListCollection")) - return acc # Return configured digitization algorithm from SIM hits diff --git a/Scintillator/ScintDigiAlgs/src/ScintWaveformDigiAlg.cxx b/Scintillator/ScintDigiAlgs/src/ScintWaveformDigiAlg.cxx index cacda620..ea03a77f 100644 --- a/Scintillator/ScintDigiAlgs/src/ScintWaveformDigiAlg.cxx +++ b/Scintillator/ScintDigiAlgs/src/ScintWaveformDigiAlg.cxx @@ -72,7 +72,12 @@ ScintWaveformDigiAlg::execute(const EventContext& ctx) const { if (!m_kernel) { - ATH_MSG_INFO("Setting up digitization kernel"); + ATH_MSG_INFO(name() << ": initialize waveform digitization kernel"); + ATH_MSG_INFO(" Norm: " << m_digiCondTool->cb_norm(ctx)); + ATH_MSG_INFO(" Mean: " << m_digiCondTool->cb_mean(ctx)); + ATH_MSG_INFO(" Sigma: " << m_digiCondTool->cb_sigma(ctx)); + ATH_MSG_INFO(" Alpha: " << m_digiCondTool->cb_alpha(ctx)); + ATH_MSG_INFO(" N: " << m_digiCondTool->cb_n(ctx)); // Set up waveform shape m_kernel = new TF1("PDF", "[4] * ROOT::Math::crystalball_pdf(x, [0],[1],[2],[3])", 0, 1200); diff --git a/Waveform/WaveEventCnv/WaveEventAthenaPool/src/RawWaveformContainerCnv_p0.cxx b/Waveform/WaveEventCnv/WaveEventAthenaPool/src/RawWaveformContainerCnv_p0.cxx index cadd7f52..5a0d8b88 100644 --- a/Waveform/WaveEventCnv/WaveEventAthenaPool/src/RawWaveformContainerCnv_p0.cxx +++ b/Waveform/WaveEventCnv/WaveEventAthenaPool/src/RawWaveformContainerCnv_p0.cxx @@ -36,8 +36,8 @@ RawWaveformContainerCnv_p0::persToTrans(const RawWaveformContainer_p0* persCont, void RawWaveformContainerCnv_p0::transToPers(const RawWaveformContainer* transCont,RawWaveformContainer_p0* persCont, MsgStream& log) { - log << MSG::ALWAYS << "transCont = " << transCont << " / persCont = " << persCont << endmsg; - log << MSG::ALWAYS << "RawWaveformContainerCnv_p0::transToPers preparing " << transCont->size() << " waveforms" << endmsg; + // log << MSG::DEBUG << "transCont = " << transCont << " / persCont = " << persCont << endmsg; + log << MSG::DEBUG << "RawWaveformContainerCnv_p0::transToPers preparing " << transCont->size() << " waveforms" << endmsg; // If trans container is empty, nothing else to do if (!transCont->size()) { diff --git a/Waveform/WaveformConditions/WaveformConditionsTools/python/WaveformDigitizationConfig.py b/Waveform/WaveformConditions/WaveformConditionsTools/python/WaveformDigitizationConfig.py index 7eb07444..569a04eb 100644 --- a/Waveform/WaveformConditions/WaveformConditionsTools/python/WaveformDigitizationConfig.py +++ b/Waveform/WaveformConditions/WaveformConditionsTools/python/WaveformDigitizationConfig.py @@ -6,7 +6,7 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory from IOVDbSvc.IOVDbSvcConfig import addFolders -def WaveformDititizationCfg(flags, **kwargs): +def WaveformDigitizationCfg(flags, **kwargs): """ Return configured ComponentAccumulator for Waveform Dititization """ @@ -16,6 +16,12 @@ def WaveformDititizationCfg(flags, **kwargs): # Probably need to figure this out! dbInstance = kwargs.get("dbInstance", "TRIGGER_OFL") dbFolder = kwargs.get("dbFolder", "/WAVE/Digitization") - acc.merge(addFolders(flags, dbFolder, dbInstance, className="CondAttrListCollection")) + caloDigiTag = kwargs.get("digiTag", "") + + if len(caloDigiTag) > 0: + acc.merge(addFolders(flags, dbFolder, dbInstance, className="CondAttrListCollection", tag=caloDigiTag)) + else: + acc.merge(addFolders(flags, dbFolder, dbInstance, className="CondAttrListCollection")) + return acc -- GitLab