From 2da9e37f9fd05018a9fc791553379c496e007dec Mon Sep 17 00:00:00 2001
From: FaserMC <fasermc@cern.ch>
Date: Sat, 28 Jan 2023 20:50:13 +0100
Subject: [PATCH] Update ntuple conditions

---
 PhysicsAnalysis/NtupleDumper/src/NtupleDumperAlg.cxx | 10 +++++++---
 PhysicsAnalysis/NtupleDumper/src/NtupleDumperAlg.h   |  2 ++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/PhysicsAnalysis/NtupleDumper/src/NtupleDumperAlg.cxx b/PhysicsAnalysis/NtupleDumper/src/NtupleDumperAlg.cxx
index 41e74b75b..3f476edb4 100644
--- a/PhysicsAnalysis/NtupleDumper/src/NtupleDumperAlg.cxx
+++ b/PhysicsAnalysis/NtupleDumper/src/NtupleDumperAlg.cxx
@@ -430,6 +430,8 @@ StatusCode NtupleDumperAlg::execute(const EventContext &ctx) const
     bool trig_coincidence_vetoesORpreshower_and_calo = false;
     if ( ((m_tap&2)!=0) && ((m_tap&1)!=0) ) trig_coincidence_vetoesORpreshower_and_calo = true;
 
+    bool trig_calo = (m_tap & 1);
+
     // for random trigger, store charge of scintillators in histograms
     if (trig_random) {
       // Read in Waveform containers
@@ -482,7 +484,8 @@ StatusCode NtupleDumperAlg::execute(const EventContext &ctx) const
 
       return StatusCode::SUCCESS; // finished with this randomly triiggered event
 
-    } else if ( !(trig_coincidence_preshower_and_vetoes || trig_coincidence_timing_and_vetoesORpreshower || trig_coincidence_timing_and_calo || trig_coincidence_vetoesORpreshower_and_calo) ) { 
+      // Try adding calo-only trigger
+    } else if ( !(trig_coincidence_preshower_and_vetoes || trig_coincidence_timing_and_vetoesORpreshower || trig_coincidence_timing_and_calo || trig_coincidence_vetoesORpreshower_and_calo || trig_calo) ) { 
       // don't process events that fail to activate coincidence triggers
       return StatusCode::SUCCESS;
     }
@@ -729,8 +732,9 @@ StatusCode NtupleDumperAlg::execute(const EventContext &ctx) const
   FillWaveBranches(*ecalContainer);
 
   // enforce blinding such that events that miss the veto layers and have a large calo signal are skipped and not in the output root file
-  if ( (!isMC) && m_doBlinding) {
-    if ( m_calo_total_E_EM/1000.0 > 10.0 ) { // energy is in MeV so divide by 1000 to compare to 10 GeV
+  // Only blind colliding BCIDs (+/- 1)
+  if ( (!isMC) && m_doBlinding && abs(m_distanceToCollidingBCID) <= 1) {
+    if (m_calo_total_E_EM > m_blindingCaloThreshold ) { // energy is in MeV
       if (m_wave_status[4] == 1 and m_wave_status[5] == 1 and m_wave_status[6] == 1 and m_wave_status[7] == 1 and m_wave_status[14] == 1) {  // hit status == 1 means it is below threshold. channles 4 and 5 are vetoNu, channels 6,7, and 14 are veto
         return StatusCode::SUCCESS;
       }
diff --git a/PhysicsAnalysis/NtupleDumper/src/NtupleDumperAlg.h b/PhysicsAnalysis/NtupleDumper/src/NtupleDumperAlg.h
index c5b21b976..6d4ccc381 100644
--- a/PhysicsAnalysis/NtupleDumper/src/NtupleDumperAlg.h
+++ b/PhysicsAnalysis/NtupleDumper/src/NtupleDumperAlg.h
@@ -111,6 +111,8 @@ private:
   DoubleProperty  m_genieLuminosity   { this, "GenieLuminosity", 150.0, "Genie luminosity in inverse fb." };
   DoubleProperty  m_minMomentum       { this, "MinMomentum", 50000.0, "Write out all truth particles with a momentum larger MinMomentum"};
 
+  DoubleProperty m_blindingCaloThreshold {this, "BlindingCaloThreshold", 25000.0, "Blind events with Ecal energy above threshold (in MeV)"}; 
+
   double m_baseEventCrossSection {1.0};
   const double kfemtoBarnsPerMilliBarn {1.0e12};
 
-- 
GitLab