From ce708fa6ccb166a42ea711590d177a0b8ff2c22b Mon Sep 17 00:00:00 2001 From: Richard Bonventre Date: Mon, 16 Feb 2026 11:57:38 -0600 Subject: [PATCH] Remove database default from JobConfig, add scripts --- JobConfig/common/database_empty.fcl | 2 ++ JobConfig/digitize/Digitize.fcl | 2 +- JobConfig/reco/Reco.fcl | 2 +- JobConfig/reco/RecoTrig.fcl | 2 +- JobConfig/recoMC/Reco.fcl | 2 +- Scripts/LatestDbVersion.sh | 10 ++++++++++ Scripts/addDatabase.sh | 26 ++++++++++++++++++++++++++ 7 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 JobConfig/common/database_empty.fcl create mode 100755 Scripts/LatestDbVersion.sh create mode 100755 Scripts/addDatabase.sh diff --git a/JobConfig/common/database_empty.fcl b/JobConfig/common/database_empty.fcl new file mode 100644 index 00000000..9189b21f --- /dev/null +++ b/JobConfig/common/database_empty.fcl @@ -0,0 +1,2 @@ +services.DbService.purpose: EMPTY +services.DbService.version: "" diff --git a/JobConfig/digitize/Digitize.fcl b/JobConfig/digitize/Digitize.fcl index 58253ee5..e0fbfb68 100644 --- a/JobConfig/digitize/Digitize.fcl +++ b/JobConfig/digitize/Digitize.fcl @@ -33,4 +33,4 @@ physics.end_paths : [ EndPath ] #include "Production/JobConfig/digitize/epilog.fcl" #include "mu2e-trig-config/core/trigDigiInputsEpilog.fcl" # the following is a default placeholder -#include "Production/Validation/database.fcl" +#include "Production/JobConfig/common/database_empty.fcl" diff --git a/JobConfig/reco/Reco.fcl b/JobConfig/reco/Reco.fcl index 8b895a2b..7f84d4f8 100644 --- a/JobConfig/reco/Reco.fcl +++ b/JobConfig/reco/Reco.fcl @@ -15,4 +15,4 @@ physics : { analyzers: @local::Reconstruction.analyzers } # the following is a placeholder -#include "Production/Validation/database.fcl" +#include "Production/JobConfig/common/database_empty.fcl" diff --git a/JobConfig/reco/RecoTrig.fcl b/JobConfig/reco/RecoTrig.fcl index 7fa9f5dd..20763f4c 100644 --- a/JobConfig/reco/RecoTrig.fcl +++ b/JobConfig/reco/RecoTrig.fcl @@ -40,4 +40,4 @@ physics : { trigger_paths : [ @sequence::Trig_physMenu.trigger_paths ] } # the following is a placeholder -#include "Production/Validation/database.fcl" +#include "Production/JobConfig/common/database_empty.fcl" diff --git a/JobConfig/recoMC/Reco.fcl b/JobConfig/recoMC/Reco.fcl index bae4d31e..eba46b32 100644 --- a/JobConfig/recoMC/Reco.fcl +++ b/JobConfig/recoMC/Reco.fcl @@ -16,4 +16,4 @@ physics : analyzers: @local::Reconstruction.analyzers } # the following is a placeholder -#include "Production/Validation/database.fcl" +#include "Production/JobConfig/common/database_empty.fcl" diff --git a/Scripts/LatestDbVersion.sh b/Scripts/LatestDbVersion.sh new file mode 100755 index 00000000..fe27deaf --- /dev/null +++ b/Scripts/LatestDbVersion.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# Gets the latest database version for the given purpose + +purpose="${1:-Sim_best}" + +last_line=$(dbTool print-version --purpose "$purpose" | tail -1) + +vmaj=$(echo "$last_line" | awk '{print $5}') +vmin=$(echo "$last_line" | awk '{print $6}') +echo "v${vmaj}_${vmin}" diff --git a/Scripts/addDatabase.sh b/Scripts/addDatabase.sh new file mode 100755 index 00000000..f99cf7db --- /dev/null +++ b/Scripts/addDatabase.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# creates fcl appending DbService database configuration +# Usage: ./Production/Scripts/addDatabase.sh [db purpose] [db version] + +input_path=${1} +output_path=${2} + +if [ -z "$3" ]; then + purpose="Sim_best" + echo "No purpose provided, using default: $purpose" +else + purpose="$3" +fi +if [ -z "$4" ]; then + dbversion=$(Production/Scripts/LatestDbVersion.sh "$purpose") + echo "No version provided, using latest: $dbversion" +else + dbversion="$4" +fi + +cat "$input_path" > "$output_path" +cat >> "$output_path" <