From 1afdf607e2891075b7dbb1fb582e25b562b6602c Mon Sep 17 00:00:00 2001
From: FASER Reco <faserrec@lxplus784.cern.ch>
Date: Mon, 30 Jan 2023 23:23:42 +0100
Subject: [PATCH] Updates for unblinding

---
 PhysicsAnalysis/NtupleDumper/scripts/faser_ntuple_maker.py | 6 +++++-
 .../NtupleDumper/scripts/submit_faser_ntuple_maker.sh      | 7 ++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/PhysicsAnalysis/NtupleDumper/scripts/faser_ntuple_maker.py b/PhysicsAnalysis/NtupleDumper/scripts/faser_ntuple_maker.py
index a22d1edbb..27b30e25d 100755
--- a/PhysicsAnalysis/NtupleDumper/scripts/faser_ntuple_maker.py
+++ b/PhysicsAnalysis/NtupleDumper/scripts/faser_ntuple_maker.py
@@ -43,6 +43,9 @@ parser.add_argument("--isMC", action='store_true',
                     help="Running on digitised MC rather than data")
 parser.add_argument("--partial", action='store_true',
                     help="Allow partial input files")
+
+parser.add_argument("--unblind", action='store_true',
+                    help="Don't apply signal blinding (default: do)")
  
 parser.add_argument("--fluka", action='store_true',
                     help="Add FLUKA weights to ntuple")
@@ -136,6 +139,7 @@ if filepath.is_dir():
     print(f"First = {firstseg}")
     print(f"Last  = {lastseg}")
     print(f"Args  = {args.tag}")
+    print(f"Blind = {not args.unblind}")
 
     # Find any tags
     tagstr = firststem.replace(f"{firstfaser}-{firstshort}-{runstr}-{firstseg}", "")
@@ -239,7 +243,7 @@ if args.isMC:
         acc.merge(NtupleDumperAlgCfg(ConfigFlags, outfile))
 
 else:
-    acc.merge(NtupleDumperAlgCfg(ConfigFlags, outfile))
+    acc.merge(NtupleDumperAlgCfg(ConfigFlags, outfile, DoBlinding=(not args.unblind)))
 
 if not args.verbose:
     from AthenaConfiguration.ComponentFactory import CompFactory
diff --git a/PhysicsAnalysis/NtupleDumper/scripts/submit_faser_ntuple_maker.sh b/PhysicsAnalysis/NtupleDumper/scripts/submit_faser_ntuple_maker.sh
index 0e228f549..9e3273dbb 100755
--- a/PhysicsAnalysis/NtupleDumper/scripts/submit_faser_ntuple_maker.sh
+++ b/PhysicsAnalysis/NtupleDumper/scripts/submit_faser_ntuple_maker.sh
@@ -34,6 +34,7 @@ partialstr=""
 mergestr=""
 flukastr=""
 geniestr=""
+unblindstr=""
 #
 # Parse command-line options
 while [ -n "$1" ]
@@ -71,6 +72,10 @@ do
 	  geniestr="--genie";
 	  shift;;
 
+      --unblind)
+	  unblindstr="--unblind";
+	  shift;;
+
       --) # End of options
 	  shift; # Eat this
 	  break;; # And stop parsing
@@ -239,7 +244,7 @@ export EOS_MGM_URL=root://eospublic.cern.ch
 #
 # Run job
 #
-faser_ntuple_maker.py $last_file_str $partialstr $tagstr $ismc --slice $slice --files $nfiles $mergestr $flukastr $geniestr $dir_path
+faser_ntuple_maker.py $last_file_str $partialstr $tagstr $ismc --slice $slice --files $nfiles $mergestr $flukastr $geniestr $unblindstr $dir_path
 ntup_code=$?
 echo "Return code: $ntup_code"
 #
-- 
GitLab