From 5d3a7eaee9c773f0c47b80d988adb5dfbd8e69aa Mon Sep 17 00:00:00 2001
From: FaserMC <fasermc@cern.ch>
Date: Tue, 20 Sep 2022 22:01:59 +0200
Subject: [PATCH] Minor reco script updates

---
 .../Digitization/scripts/faser_digi_merge.py  |  4 +--
 .../scripts/submit_faserMDC_reco.sh           | 26 ++++++++++++-------
 .../scripts/submit_faser_reco.sh              |  2 +-
 3 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/Control/CalypsoExample/Digitization/scripts/faser_digi_merge.py b/Control/CalypsoExample/Digitization/scripts/faser_digi_merge.py
index 04705bf0..ea135db8 100755
--- a/Control/CalypsoExample/Digitization/scripts/faser_digi_merge.py
+++ b/Control/CalypsoExample/Digitization/scripts/faser_digi_merge.py
@@ -76,8 +76,8 @@ for seg in seglist:
 
     # Check if segment number exists in hits file (this is not perfect)
     segstr = f"{seg:05d}"
-    if segstr not in dirlist[seg]:
-        print(f"Segment {segstr} not in file {dirlist[seg]}!")
+    if segstr not in dirlist[seg].name:
+        print(f"Segment {segstr} not in file {dirlist[seg].name}!")
         if not args.partial: sys.exit(1) # abort
     else:
         print(f"Segment {segstr} found in file {dirlist[seg]}")
diff --git a/Control/CalypsoExample/Reconstruction/scripts/submit_faserMDC_reco.sh b/Control/CalypsoExample/Reconstruction/scripts/submit_faserMDC_reco.sh
index 5dacef1c..e4d93ba6 100755
--- a/Control/CalypsoExample/Reconstruction/scripts/submit_faserMDC_reco.sh
+++ b/Control/CalypsoExample/Reconstruction/scripts/submit_faserMDC_reco.sh
@@ -123,8 +123,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
+#source build/x86*/setup.sh
 #
 # Try to find a release tag
 cd calypso
@@ -158,11 +158,13 @@ cd "$file_stem"
 #
 # Run job
 if [[ -z "$tag" ]]; then
-    faserMDC_reco.py "--nevents=$nevents" "$file_path"
+    tagstr=""
 else
-    faserMDC_reco.py "--nevents=$nevents" "--reco=$tag" "$file_path"
+    tagstr="--reco=$tag"
 fi
 #
+faser_reco.py "--nevents=$nevents" $tagstr "$file_path" 
+#
 # Print out ending time
 date
 echo "Job finished after $SECONDS seconds"
@@ -172,26 +174,30 @@ export EOS_MGM_URL=root://eospublic.cern.ch
 #
 if ! [ -z "$outdest" ]
 then
+    echo "Output directory:"
     ls -l
-    echo "copy *-RDO.root to $outdest"
-    mkdir -p $outdest
+    echo "copy *-xAOD.root to $outdest"
+    eos mkdir -p $outdest
     # Keep this line from stopping script, so we might get a log file
-    eos cp *-xAOD.root ${outdest}/ || true
+    # || true ensures script continues even if copy fails
+    eos cp *-xAOD.root ${outdest}/ || true   
 fi
 #
-# Also copy log file
+# Copy log file second
 if ! [ -z "$logdest" ]
 then
     cd ..
+    echo "Working directory:"
     ls -l
     echo "copy $logfile to $logdest"
-    mkdir -p $logdest
+    eos mkdir -p $logdest
     eos cp $logfile $logdest/$logfile
 elif ! [ -z "$outdest" ]
 then 
     cd ..
+    echo "Working directory:"
     ls -l
     echo "copy $logfile to $outdest"
-    mkdir -p $outdest
+    eos mkdir -p $outdest
     eos cp $logfile $outdest/$logfile
 fi
diff --git a/Control/CalypsoExample/Reconstruction/scripts/submit_faser_reco.sh b/Control/CalypsoExample/Reconstruction/scripts/submit_faser_reco.sh
index 69245061..ede981d5 100755
--- a/Control/CalypsoExample/Reconstruction/scripts/submit_faser_reco.sh
+++ b/Control/CalypsoExample/Reconstruction/scripts/submit_faser_reco.sh
@@ -148,7 +148,7 @@ if [[ "$recotag" == "reco/r"???? ]]; then
 fi
 if [[ "$recotag" == "reco/p"???? ]]; then
   tag=`echo "$recotag" | cut -c 6-11`
-  echo "Found proc tag: $tag"
+  echo "Found reco tag: $tag"
 fi
 #
 # Move to the run directory
-- 
GitLab