From 08085fb74231213ae208f001fa03cfc542e04d48 Mon Sep 17 00:00:00 2001
From: Daniel Johnson <daniel.johnson@cern.ch>
Date: Mon, 17 Jul 2023 18:42:45 +0100
Subject: [PATCH 1/5] Reinstate dielectron+gamma lines

---
 .../StrippingQEE/StrippingExotica.py          | 111 +++++++++++++++++-
 1 file changed, 110 insertions(+), 1 deletion(-)

diff --git a/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/StrippingExotica.py b/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/StrippingExotica.py
index e73ee74df..e804573a3 100755
--- a/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/StrippingExotica.py
+++ b/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/StrippingExotica.py
@@ -24,7 +24,9 @@ Hlt2ExoticaDisplDiMuonNoPoint
 Hlt2ExoticaPrmptDiMuonTurbo
 Hlt2ExoticaPrmptDiMuonSSTurbo
 Hlt2ExoticaPrmptDiMuonHighMass
-
+Hlt2ExoticaDisplDiELowMass
+Hlt2ExoticaPi0ToDiEGamma
+Hlt2ExoticaEtaToDiEGamma
 """
 
 from GaudiKernel.SystemOfUnits import MeV, GeV, mm, picosecond
@@ -55,6 +57,11 @@ default_config = {
       'StrippingExoticaDisplDiELine',
       'StrippingExoticaDisplDiEHighMassLine',
     ],
+    'Leptonic': [
+      'StrippingExoticaDisplDiELowMassMicroLine',
+      'StrippingExoticaPi0ToDiEGammaMicroLine',
+      'StrippingExoticaEtaToDiEGammaMicroLine'
+    ],    
     'Dimuon': [
       'StrippingExoticaDisplDiMuonLine',
       'StrippingExoticaDisplDiMuonHighMassLine',
@@ -73,6 +80,9 @@ default_config = {
       'DiRHNu'              : 1.0,
       'DisplDiE'            : 1.0,
       'DisplDiEHighMass'    : 1.0,
+      'DisplDiELowMassMicro': 1.0,
+      'Pi0ToDiEGammaMicro'  : 1.0,
+      'EtaToDiEGammaMicro'  : 1.0,      
       'DisplDiMuon'         : 1.0,
       'DisplDiMuonHighMass' : 1.0,
       'DisplDiMuonNoPoint'  : 1.0,
@@ -156,6 +166,47 @@ default_config = {
       'FDChi2'    : 0,
       'TAU'       : 1*picosecond,
     },
+    'DisplDiELowMassMicro' : {
+      'L0FILTER' : None,  #"L0_CHANNEL('Photon')|L0_CHANNEL('Electron')
+      'HLT1FILTER' : "HLT_PASS_RE('Hlt1DiElectronLowMassDecision')",
+      'HLT2FILTER' : None,
+      'TisTosSpec' : None,
+      'EProbNNe' : 0.1,
+      'EIPChi2' : 4,
+      'PT' : 1000*MeV,
+      'MMIN' : 5*MeV,
+      'MMAX' : 300*MeV
+    },
+    'Pi0ToDiEGammaMicro' : {
+      'input'       : 'Phys/StdLooseAllPhotons/Particles',
+      'L0FILTER' : None,
+      'HLT1FILTER' : "HLT_PASS_RE('Hlt1DiElectronLowMass.*Decision')",
+      'HLT2FILTER' : None,
+      'TisTosSpec' : None,
+      'EProbNNe' : 0.1,
+      'EIPChi2' : -1,
+      'EEPT' : 1000*MeV,
+      'GPT' : 500*MeV,
+      'GCL' : 0.2,
+      'PT' : 1000*MeV,
+      'MMIN' : 0*MeV,
+      'MMAX' : 300*MeV
+    },
+    'EtaToDiEGammaMicro' : {
+      'input'       : 'Phys/StdLooseAllPhotons/Particles',
+      'L0FILTER' : None,
+      'HLT1FILTER' : "HLT_PASS_RE('Hlt1DiElectronLowMass.*Decision')",
+      'HLT2FILTER' : None,
+      'TisTosSpec' : None,
+      'EProbNNe' : 0.1,
+      'EIPChi2' : -1,
+      'EEPT' : 1000*MeV,
+      'GPT' : 500*MeV,
+      'GCL' : 0.2,
+      'PT' : 1000*MeV,
+      'MMIN' : 400*MeV,
+      'MMAX' : 700*MeV
+    },    
     'DisplDiMuon': {
       # 'TOS_HLT2'  : 'Hlt2ExoticaDisplDiMuonDecision',
       'MuProbNNmu': 0.5,
@@ -364,6 +415,40 @@ def DisplDiE( conf, name, sharedDiE ):
 
   return SimpleSelection( name, FilterDesktop, sharedDiE, Code=code)
 
+def DisplDiELowMass( conf, name, sharedDiE ):
+
+  code = ("(MINTREE('e+'==ABSID,BPVIPCHI2()) > %(EIPChi2)s)"
+            "& (MINTREE('e+'==ABSID,PROBNNe) > %(EProbNNe)s)"
+            "& (PT > %(PT)s)"
+            "& (HASVERTEX)"
+            "& (M > %(MMIN)s) & (M < %(MMAX)s)")%conf
+
+  return SimpleSelection( name, FilterDesktop, sharedDiE, Code=code)
+
+def DiEGamma(conf, name, sharedDiE ):
+
+  inputs = [ AutomaticData(Location=conf['input'])  ] + sharedDiE
+
+  dc = {}
+  dc['KS0'] = ("(MINTREE('e+'==ABSID,BPVIPCHI2()) > %(EIPChi2)s)"
+          "& (MINTREE('e+'==ABSID,PROBNNe) > %(EProbNNe)s)"
+          "& (PT > %(EEPT)s)"
+          "& (HASVERTEX)")%conf
+
+  dc['gamma'] = '(PT > %(GPT)s) & (CL > %(GCL)s)'%conf
+
+  cc = "(APT > %(PT)s) &  (AM > %(MMIN)s) & (AM < %(MMAX)s)"%conf
+  mc = "(PT > %(PT)s) &  (M > %(MMIN)s) & (M < %(MMAX)s)"%conf
+
+
+
+  return SimpleSelection( name, CombineParticles, inputs,
+    DecayDescriptor = "rho(770)0 -> KS0 gamma",
+    DaughtersCuts   = dc,
+    CombinationCut  = cc,
+    MotherCut       = mc,
+  )
+
 def DisplDiMuon( conf, name, sharedDiMuon ):
   code = ("(MINTREE('mu+'==ABSID,BPVIPCHI2()) > %(MuIPChi2)s)"
           "& (MINTREE('mu+'==ABSID,PROBNNmu) > %(MuProbNNmu)s)"
@@ -486,6 +571,30 @@ class ExoticaConf(LineBuilder):
       prescale  = prescales['DisplDiEHighMass'],
     ))
 
+    self.registerLine(StrippingLine( name+'DisplDiELowMassMicroLine',
+      selection = DisplDiELowMass(config['DisplDiELowMassMicro'], 'DisplDiELowMassMicro', sharedDiE),
+      prescale  = prescales['DisplDiELowMassMicro'],
+      L0DU= config['DisplDiELowMassMicro']['L0FILTER'],
+      HLT1= config['DisplDiELowMassMicro']['HLT1FILTER'],
+      HLT2= config['DisplDiELowMassMicro']['HLT2FILTER'],
+    ))
+
+    self.registerLine(StrippingLine( name+'Pi0ToDiEGammaMicroLine',
+      selection = DiEGamma(config['Pi0ToDiEGammaMicro'], 'Pi0ToDiEGammaMicro', sharedDiE),
+      prescale  = prescales['Pi0ToDiEGammaMicro'],
+      L0DU= config['Pi0ToDiEGammaMicro']['L0FILTER'],
+      HLT1= config['Pi0ToDiEGammaMicro']['HLT1FILTER'],
+      HLT2= config['Pi0ToDiEGammaMicro']['HLT2FILTER'],
+    ))
+
+    self.registerLine(StrippingLine( name+'EtaToDiEGammaMicroLine',
+      selection = DiEGamma(config['EtaToDiEGammaMicro'], 'EtaToDiEGammaMicro', sharedDiE),
+      prescale  = prescales['EtaToDiEGammaMicro'],
+      L0DU= config['EtaToDiEGammaMicro']['L0FILTER'],
+      HLT1= config['EtaToDiEGammaMicro']['HLT1FILTER'],
+      HLT2= config['EtaToDiEGammaMicro']['HLT2FILTER'],
+    )) 
+    
     self.registerLine(StrippingLine( name+'DisplDiMuonLine',
       selection = DisplDiMuon(config['DisplDiMuon'],
                               'DisplDiMuon', sharedDiMuon),
-- 
GitLab


From 76b77c392ad554f6c574cda718b87126484135d4 Mon Sep 17 00:00:00 2001
From: Daniel Johnson <daniel.johnson@cern.ch>
Date: Mon, 17 Jul 2023 18:48:16 +0100
Subject: [PATCH 2/5] Add the photon-preservation

---
 .../StrippingQEE/StrippingExotica.py          | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/StrippingExotica.py b/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/StrippingExotica.py
index e804573a3..a13684337 100755
--- a/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/StrippingExotica.py
+++ b/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/StrippingExotica.py
@@ -518,6 +518,37 @@ def QuadMuonNoIP( conf, sharedDiMuon ):
     MotherCut       = mc,
   )
 
+#################################################################################################################################
+def _storeInputBremPhotons( linename, outputlocprefix = "Leptonic/Phys/", photonloc = "Phys/StdVeryLooseAllPhotons/Particles" ):
+    from PhysSelPython.Wrappers import FilterSelection, DataOnDemand, SelectionSequence
+    from Configurables import ( CopyParticles, ParticleCloner,
+                                ProtoParticleCloner, CaloHypoCloner,
+                                CaloClusterCloner )
+
+    cloner = CopyParticles( name = "BremPhotonClonerFor%s"%linename )
+    cloner.OutputPrefix = outputlocprefix+linename
+    cloner.InputLocation = photonloc
+
+    cloner.addTool(ParticleCloner, name="ParticleCloner")
+    cloner.ParticleCloner.ICloneProtoParticle = "ProtoParticleCloner"
+
+    cloner.addTool(ProtoParticleCloner,name="ProtoParticleCloner")
+
+    cloner.addTool(CaloHypoCloner,name="CaloHypoCloner")
+    cloner.CaloHypoCloner.CloneClustersNeuP = True
+    cloner.CaloHypoCloner.CloneDigitsNeuP   = True
+
+    cloner.addTool(CaloClusterCloner,name="CaloClusterCloner")
+    cloner.CaloClusterCloner.CloneEntriesNeuP = True
+
+    ############################################################
+    makePhotons = GaudiSequencer("For%sBremPhotonMakerAlg"%linename)
+    makePhotons.Members += [cloner]
+
+    return makePhotons
+#####################################################
+
+
 #===============================================================================
 
 class ExoticaConf(LineBuilder):
@@ -577,6 +608,7 @@ class ExoticaConf(LineBuilder):
       L0DU= config['DisplDiELowMassMicro']['L0FILTER'],
       HLT1= config['DisplDiELowMassMicro']['HLT1FILTER'],
       HLT2= config['DisplDiELowMassMicro']['HLT2FILTER'],
+      postselalg = _storeInputBremPhotons(name+'DisplDiELowMassMicroLine', outputlocprefix="Leptonic/Phys/"),
     ))
 
     self.registerLine(StrippingLine( name+'Pi0ToDiEGammaMicroLine',
@@ -585,6 +617,7 @@ class ExoticaConf(LineBuilder):
       L0DU= config['Pi0ToDiEGammaMicro']['L0FILTER'],
       HLT1= config['Pi0ToDiEGammaMicro']['HLT1FILTER'],
       HLT2= config['Pi0ToDiEGammaMicro']['HLT2FILTER'],
+      postselalg = self._storeInputBremPhotons(name+'Pi0ToDiEGammaMicroLine', outputlocprefix="Leptonic/Phys/"),
     ))
 
     self.registerLine(StrippingLine( name+'EtaToDiEGammaMicroLine',
@@ -593,6 +626,7 @@ class ExoticaConf(LineBuilder):
       L0DU= config['EtaToDiEGammaMicro']['L0FILTER'],
       HLT1= config['EtaToDiEGammaMicro']['HLT1FILTER'],
       HLT2= config['EtaToDiEGammaMicro']['HLT2FILTER'],
+      postselalg = self._storeInputBremPhotons(name+'EtaToDiEGammaMicroLine', outputlocprefix="Leptonic/Phys/"),
     )) 
     
     self.registerLine(StrippingLine( name+'DisplDiMuonLine',
-- 
GitLab


From 239bf050e13e15be1b832a2483bc340b1a63c793 Mon Sep 17 00:00:00 2001
From: Daniel Johnson <daniel.johnson@cern.ch>
Date: Mon, 17 Jul 2023 19:38:09 +0100
Subject: [PATCH 3/5] Add init.py

---
 .../python/StrippingSelections/StrippingQEE/__init__.py         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/__init__.py b/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/__init__.py
index 71c658b7e..4b6401dad 100644
--- a/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/__init__.py
+++ b/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/__init__.py
@@ -9,7 +9,7 @@
 # or submit itself to any jurisdiction.                                       #
 ###############################################################################
 
-_selections = ('StrippingB2EHNLLines', 'StrippingB2MuHNLLines', 'StrippingLambdaDecaysDM', 'StrippingLLP2Hadrons', 'StrippingALP2TauTau', 'StrippingLLP2HH')
+_selections = ('StrippingB2EHNLLines', 'StrippingB2MuHNLLines', 'StrippingLambdaDecaysDM', 'StrippingLLP2Hadrons', 'StrippingALP2TauTau', 'StrippingLLP2HH', 'StrippingExotica')
 
 for _sel in _selections :
     try :
-- 
GitLab


From 67be37cdf644d556a7eec8a9924a3c5792137cca Mon Sep 17 00:00:00 2001
From: Daniel Johnson <daniel.johnson@cern.ch>
Date: Tue, 18 Jul 2023 13:47:07 +0100
Subject: [PATCH 4/5] Fix bugs in method definition

---
 .../StrippingQEE/StrippingExotica.py          | 53 +++++++++----------
 1 file changed, 26 insertions(+), 27 deletions(-)

diff --git a/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/StrippingExotica.py b/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/StrippingExotica.py
index a13684337..137f322e9 100755
--- a/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/StrippingExotica.py
+++ b/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/StrippingExotica.py
@@ -518,42 +518,41 @@ def QuadMuonNoIP( conf, sharedDiMuon ):
     MotherCut       = mc,
   )
 
-#################################################################################################################################
-def _storeInputBremPhotons( linename, outputlocprefix = "Leptonic/Phys/", photonloc = "Phys/StdVeryLooseAllPhotons/Particles" ):
-    from PhysSelPython.Wrappers import FilterSelection, DataOnDemand, SelectionSequence
-    from Configurables import ( CopyParticles, ParticleCloner,
-                                ProtoParticleCloner, CaloHypoCloner,
-                                CaloClusterCloner )
+#===============================================================================
 
-    cloner = CopyParticles( name = "BremPhotonClonerFor%s"%linename )
-    cloner.OutputPrefix = outputlocprefix+linename
-    cloner.InputLocation = photonloc
+class ExoticaConf(LineBuilder):
 
-    cloner.addTool(ParticleCloner, name="ParticleCloner")
-    cloner.ParticleCloner.ICloneProtoParticle = "ProtoParticleCloner"
+  __configuration_keys__ = default_config['CONFIG'].keys()  # Legacy field
 
-    cloner.addTool(ProtoParticleCloner,name="ProtoParticleCloner")
+  #################################################################################################################################
+  def _storeInputBremPhotons( self, linename, outputlocprefix = "Leptonic/Phys/", photonloc = "Phys/StdVeryLooseAllPhotons/Particles" ):
+      from PhysSelPython.Wrappers import FilterSelection, DataOnDemand, SelectionSequence
+      from Configurables import ( CopyParticles, ParticleCloner,
+                                  ProtoParticleCloner, CaloHypoCloner,
+                                  CaloClusterCloner, GaudiSequencer )
 
-    cloner.addTool(CaloHypoCloner,name="CaloHypoCloner")
-    cloner.CaloHypoCloner.CloneClustersNeuP = True
-    cloner.CaloHypoCloner.CloneDigitsNeuP   = True
+      cloner = CopyParticles( name = "BremPhotonClonerFor%s"%linename )
+      cloner.OutputPrefix = outputlocprefix+linename
+      cloner.InputLocation = photonloc
 
-    cloner.addTool(CaloClusterCloner,name="CaloClusterCloner")
-    cloner.CaloClusterCloner.CloneEntriesNeuP = True
+      cloner.addTool(ParticleCloner, name="ParticleCloner")
+      cloner.ParticleCloner.ICloneProtoParticle = "ProtoParticleCloner"
 
-    ############################################################
-    makePhotons = GaudiSequencer("For%sBremPhotonMakerAlg"%linename)
-    makePhotons.Members += [cloner]
+      cloner.addTool(ProtoParticleCloner,name="ProtoParticleCloner")
 
-    return makePhotons
-#####################################################
+      cloner.addTool(CaloHypoCloner,name="CaloHypoCloner")
+      cloner.CaloHypoCloner.CloneClustersNeuP = True
+      cloner.CaloHypoCloner.CloneDigitsNeuP   = True
 
+      cloner.addTool(CaloClusterCloner,name="CaloClusterCloner")
+      cloner.CaloClusterCloner.CloneEntriesNeuP = True
 
-#===============================================================================
+      ############################################################
+      makePhotons = GaudiSequencer("For%sBremPhotonMakerAlg"%linename)
+      makePhotons.Members += [cloner]
 
-class ExoticaConf(LineBuilder):
-
-  __configuration_keys__ = default_config['CONFIG'].keys()  # Legacy field
+      return makePhotons
+  #####################################################
 
   def __init__(self, name, config):
     LineBuilder.__init__(self, name, config)
@@ -608,7 +607,7 @@ class ExoticaConf(LineBuilder):
       L0DU= config['DisplDiELowMassMicro']['L0FILTER'],
       HLT1= config['DisplDiELowMassMicro']['HLT1FILTER'],
       HLT2= config['DisplDiELowMassMicro']['HLT2FILTER'],
-      postselalg = _storeInputBremPhotons(name+'DisplDiELowMassMicroLine', outputlocprefix="Leptonic/Phys/"),
+      postselalg = self._storeInputBremPhotons(name+'DisplDiELowMassMicroLine', outputlocprefix="Leptonic/Phys/"),
     ))
 
     self.registerLine(StrippingLine( name+'Pi0ToDiEGammaMicroLine',
-- 
GitLab


From 3ca791df13f77899291830c8effb4f54d14ef988 Mon Sep 17 00:00:00 2001
From: Nathan Allen Grieser <nathan.allen.grieser@cern.ch>
Date: Tue, 18 Jul 2023 14:47:56 +0200
Subject: [PATCH 5/5] Fix copyright

---
 .../python/StrippingSelections/StrippingQEE/StrippingExotica.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/StrippingExotica.py b/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/StrippingExotica.py
index 137f322e9..9a5ea1990 100755
--- a/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/StrippingExotica.py
+++ b/Phys/StrippingSelections/python/StrippingSelections/StrippingQEE/StrippingExotica.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 ###############################################################################
-# (c) Copyright 2000-2019 CERN for the benefit of the LHCb Collaboration      #
+# (c) Copyright 2000-2023 CERN for the benefit of the LHCb Collaboration      #
 #                                                                             #
 # This software is distributed under the terms of the GNU General Public      #
 # Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   #
-- 
GitLab