From f2f0cd334abbd6ffc17f182e2024affe90ec6c55 Mon Sep 17 00:00:00 2001
From: Tomasz Bold <tomasz.bold@gmail.com>
Date: Sat, 20 Jul 2019 09:33:08 +0200
Subject: [PATCH] changes to shorten the deicsion collection names

---
 .../Egamma/ElectronSequenceSetup.py           |  2 +-
 .../Egamma/PhotonSequenceSetup.py             |  2 +-
 .../python/HLTMenuConfig/Menu/HLTCFConfig.py  |  2 +-
 .../Menu/MenuComponentsNaming.py              | 36 +++++++++----------
 .../HLTMenuConfig/Muon/MuonSequenceSetup.py   | 16 ++++-----
 5 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py
index e78adeea245..c6974051c81 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py
@@ -45,7 +45,7 @@ def fastElectronSequence(ConfigFlags):
     theElectronFex.ElectronsName=recordable("HLT_L2Electrons")
 
     # EVCreator:
-    l2ElectronViewsMaker = EventViewCreatorAlgorithm("l2ElectronViewsMaker")
+    l2ElectronViewsMaker = EventViewCreatorAlgorithm("IMl2Electron")
     l2ElectronViewsMaker.RoIsLink = "roi" # -||-
     l2ElectronViewsMaker.InViewRoIs = "EMIDRoIs" # contract with the fastCalo
     l2ElectronViewsMaker.Views = "EMElectronViews"
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonSequenceSetup.py
index 756ed2b5750..987aacd1263 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonSequenceSetup.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonSequenceSetup.py
@@ -23,7 +23,7 @@ def fastPhotonMenuSequence():
     thePhotonFex.PhotonsName="Photons"
     #thePhotonFex.RoIs="EMIDRoIs"
 
-    l2PhotonViewsMaker = EventViewCreatorAlgorithm("l2PhotonViewsMaker")
+    l2PhotonViewsMaker = EventViewCreatorAlgorithm("IMl2Photon")
     l2PhotonViewsMaker.RoIsLink = "roi"
     l2PhotonViewsMaker.InViewRoIs = "EMIDRoIs" 
     #l2PhotonViewsMaker.InViewRoIs = "EMCaloRoIs"
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
index be311ed0250..c6d9a22b06a 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
@@ -601,7 +601,7 @@ def findCFSequences(filter_name, cfseqList):
 def buildFilter(filter_name,  filter_input):
     """
      Build the FILTER
-     one filter per previous sequence at the start of the sequence: check if it exists or create a new one        
+     one filter per previous sequence at the start of the sequence: always create a new one    
      if the previous hypo has more than one output, try to get all of them
      one filter per previous sequence: 1 input/previous seq, 1 output/next seq 
     """
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponentsNaming.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponentsNaming.py
index 5b85d9c01e5..d20003aa794 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponentsNaming.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponentsNaming.py
@@ -8,43 +8,39 @@ class CFNaming(object):
     RECO_POSTFIX = "_reco"
     VIEW_POSTFIX = "_view"
     FILTER_POSTFIX = "_filter"
-
     
-    @staticmethod
-    def reduceName(line):
-        splitLine = filter( lambda x: not ( x == "from" or x == "Filter"), line.split("_") ) # eliminate common words
-        splitLine =[ k[0] for k in filter( lambda x: not ( "Step" in x[0] or "Step" in x[1]), zip(splitLine, [""]+splitLine) )] # eliminate the word contaning Step and the one after 
-        return "_".join(splitLine)
-
     @staticmethod
     def stepName(nstep):
         return "Step%i"%(nstep+1)
 
     @staticmethod
     def menuSequenceName(Hypo):
-        return ("S_" + Hypo)
+        return "S" + Hypo
 
     @staticmethod
     def filterName(ChainStepName):
-        return ("Filter_" + ChainStepName)
+        return "F" + ChainStepName
+
+    @staticmethod
+    def simplifyOutName( name ):
+        """Removes all HLT_decisions except the front one"""        
+        return "HLTNAV_" + name.replace("HLTNAV_", "").replace("Trig", "").replace("Alg", "")
 
     @staticmethod
     def filterOutName(filter_name, filterIn):
-        return (filter_name + "_from_" + filterIn)
+        return CFNaming.simplifyOutName("HLTNAV_" + filter_name + "__" + filterIn)
 
     @staticmethod
     def inputMakerOutName(IMname, filterOut):
-        return "%s_from_%s"%(IMname, filterOut)
-    #    return  (IMname + "_" + reduceName(filterOut))
+        return CFNaming.simplifyOutName("HLTNAV_" + IMname + "__" + filterOut)
 
     @staticmethod
     def hypoAlgOutName(HypoName, HypoInput):
-        return  (HypoName + "_from_" + HypoInput)
-    #return  (HypoName + "_" + CFNaming.reduceName(HypoInput))
+        return CFNaming.simplifyOutName("HLTNAV_" + HypoName + "__" + HypoInput)
 
     @staticmethod
     def comboHypoName(HypoName):
-        return ("ComboHypo_" + HypoName)
+        return "ComboHypo_" + HypoName
 
     @staticmethod
     def comboSequenceCopyName(SequenceName, ncopy, StepName):    
@@ -56,20 +52,20 @@ class CFNaming(object):
 
     @staticmethod
     def comboHypoOutputName(inputName):
-        return "combo_%s"%(inputName)
+        return CFNaming.simplifyOutName("HLTNAV_combo_" + inputName )
 
     @staticmethod
     def stepRecoNodeName(HLTNodeName, StepCFName):
-        return  (HLTNodeName + "_" + StepCFName)
+        return HLTNodeName + "_" + StepCFName
 
     @staticmethod
     def stepSummaryName(StepCFName):
-        return ("TriggerSummary"+ StepCFName)
+        return "TriggerSummary" + StepCFName
 
     @staticmethod
     def stepRecoName(stepName):
-        return '{}{}'.format(stepName, CFNaming.RECO_POSTFIX)
+        return stepName + CFNaming.RECO_POSTFIX
 
     @staticmethod
     def stepViewName(stepName):
-        return '{}{}'.format(stepName, CFNaming.VIEW_POSTFIX)
+        return stepName + CFNaming.VIEW_POSTFIX
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py
index b217c82ae10..e38b180636b 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py
@@ -32,7 +32,7 @@ muNames = muonNames().getNames('RoI')
 def muFastAlgSequence(ConfigFlags):
 
     ### set the EVCreator ###
-    l2MuViewsMaker = EventViewCreatorAlgorithm("l2MuViewsMaker")
+    l2MuViewsMaker = EventViewCreatorAlgorithm("IMl2Mu")
     l2MuViewsMaker.ViewFallThrough = True
     l2MuViewsMaker.RoIsLink = "initialRoI" # -||-
     l2MuViewsMaker.InViewRoIs = "MURoIs" # contract with the consumer
@@ -70,7 +70,7 @@ def muFastSequence():
 def muCombAlgSequence(ConfigFlags):
 
     ### set the EVCreator ###
-    l2muCombViewsMaker = EventViewCreatorAlgorithm("l2muCombViewsMaker")
+    l2muCombViewsMaker = EventViewCreatorAlgorithm("IMl2muComb")
     l2muCombViewsMaker.ViewFallThrough = True #if this needs to access anything from the previous step, from within the view
     l2muCombViewsMaker.RoIsLink = "roi" # -||- this NEEDS to be set. probably should be roi for anything not immediately after L1
     l2muCombViewsMaker.InViewRoIs = "EMIDRoIs" #name of the RoIS inside of the view, because in principle we can have more than one RoI/view
@@ -113,7 +113,7 @@ def muCombSequence():
 ######################
 def muEFSAAlgSequence(ConfigFlags):
 
-    efsaViewsMaker = EventViewCreatorAlgorithm("efsaViewsMaker")
+    efsaViewsMaker = EventViewCreatorAlgorithm("IMefsa")
     efsaViewsMaker.ViewFallThrough = True
     efsaViewsMaker.RoIsLink = "roi" # -||-
     efsaViewsMaker.InViewRoIs = "MUEFSARoIs" # contract with the consumer
@@ -175,7 +175,7 @@ def muEFCBAlgSequence(ConfigFlags):
     from TrigMuonEF.TrigMuonEFConfig import MuonFilterAlg, MergeEFMuonsAlg
     from TriggerMenuMT.HLTMenuConfig.Muon.MuonSetup import muEFCBRecoSequence, muEFInsideOutRecoSequence
     
-    efcbViewsMaker = EventViewCreatorAlgorithm("efcbtotalViewsMaker")
+    efcbViewsMaker = EventViewCreatorAlgorithm("IMefcbtotal")
     efcbViewsMaker.ViewFallThrough = True
     efcbViewsMaker.RoIsLink = "roi" # -||-
     efcbViewsMaker.InViewRoIs = "MUEFCBRoIs" # contract with the consumer
@@ -236,7 +236,7 @@ def muEFCBSequence():
 def muEFSAFSAlgSequence(ConfigFlags):
 
     from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithmWithMuons
-    efsafsInputMaker = EventViewCreatorAlgorithmWithMuons("MuonFSInputMaker", RoIsLink="initialRoI")
+    efsafsInputMaker = EventViewCreatorAlgorithmWithMuons("IMMuonFS", RoIsLink="initialRoI")
     efsafsInputMaker.InViewRoIs = "MUFSRoIs"
     efsafsInputMaker.Views = "MUFSViewRoI"
     efsafsInputMaker.CreateFSRoI=True
@@ -273,7 +273,7 @@ def muEFSAFSSequence():
 ######################
 def muEFCBFSAlgSequence(ConfigFlags):
     from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithmWithMuons
-    efcbfsInputMaker = EventViewCreatorAlgorithmWithMuons("EFCBFSInputMaker") #can we call it EFCBFSEventViewCreator?
+    efcbfsInputMaker = EventViewCreatorAlgorithmWithMuons("IMEFCBFS") #can we call it EFCBFSEventViewCreator?
     efcbfsInputMaker.ViewFallThrough = True
     efcbfsInputMaker.mergeOutputs = False
     efcbfsInputMaker.Views = "MUCBFSViews"
@@ -315,7 +315,7 @@ def muEFCBFSSequence():
 ######################
 def muIsoAlgSequence(ConfigFlags):
 
-    l2muIsoViewsMaker = EventViewCreatorAlgorithm("l2muIsoViewsMaker")
+    l2muIsoViewsMaker = EventViewCreatorAlgorithm("IMl2muIso")
     l2muIsoViewsMaker.ViewFallThrough = True
     l2muIsoViewsMaker.RoIsLink = "roi" # -||-
     l2muIsoViewsMaker.InViewRoIs = "MUIsoRoIs" # contract with the consumer
@@ -356,7 +356,7 @@ def muIsoSequence():
 ######################
 def muEFIsoAlgSequence(ConfigFlags):
     from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithmWithMuons
-    efmuIsoViewsMaker = EventViewCreatorAlgorithmWithMuons("efmuIsoViewsMaker")
+    efmuIsoViewsMaker = EventViewCreatorAlgorithmWithMuons("IMefmuIso")
     efmuIsoViewsMaker.ViewFallThrough = True
     efmuIsoViewsMaker.RoIsLink = "roi" # -||-
     efmuIsoViewsMaker.InViewRoIs = "MUEFIsoRoIs" # contract with the consumer
-- 
GitLab