From f11a99f064b57a39f4aaee04902746001ba67590 Mon Sep 17 00:00:00 2001 From: fgravili Date: Wed, 25 May 2022 06:06:49 +0200 Subject: [PATCH 1/4] Added flag and snippet to dump NSW debugging ntuple --- .../TriggerJobOpts/share/runHLT_standalone.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py index da1db7a592b..597ea798ce9 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py @@ -30,6 +30,7 @@ class opt: doID = True # ConfigFlags.Trigger.doID doCalo = True # ConfigFlags.Trigger.doCalo doMuon = True # ConfigFlags.Trigger.doMuon + doWriteNSWDebug = False # Write out NSW ntuple for debugging purposes? doWriteRDOTrigger = False # Write out RDOTrigger? doWriteBS = True # Write out BS? doL1Unpacking = True # decode L1 data in input file if True, else setup emulation @@ -588,6 +589,11 @@ if hasattr(topSequence,"SGInputLoader"): if not hasattr(svcMgr, 'THistSvc'): from GaudiSvc.GaudiSvcConf import THistSvc svcMgr += THistSvc() + from AthenaCommon.ConcurrencyFlags import jobproperties as jp + nThreads = jp.ConcurrencyFlags.NumThreads() + if nThreads == 1 and opt.doWriteNSWDebug: + svcMgr.THistSvc.Output += [ "NSWL1Simulation DATAFILE='NSWL1Simulation.root' OPT='RECREATE'" ] + if hasattr(svcMgr.THistSvc, "Output"): from TriggerJobOpts.TriggerHistSvcConfig import setTHistSvcOutput setTHistSvcOutput(svcMgr.THistSvc.Output) @@ -622,8 +628,8 @@ if opt.doWriteBS or opt.doWriteRDOTrigger: filters = collectFilters(findSubSequence(topSequence, "HLTAllSteps")) nfilters = sum(len(v) for v in filters.values()) - nhypos = sum(len(v) for v in hypos.values()) - log.info( "Algorithms counting: Number of Filter algorithms: %d - Number of Hypo algoirthms: %d", nfilters , nhypos) + nhypos = sum(len(v) for v in hypos.values()) + log.info( "Algorithms counting: Number of Filter algorithms: %d - Number of Hypo algoirthms: %d", nfilters , nhypos) summaryMakerAlg = findAlgorithm(topSequence, "DecisionSummaryMakerAlg") hltSeeding = findAlgorithm(topSequence, "HLTSeeding") -- GitLab From e5384be945660e24ad36e075cf119e5c1725739c Mon Sep 17 00:00:00 2001 From: fgravili Date: Wed, 25 May 2022 06:08:03 +0200 Subject: [PATCH 2/4] Fixed ntuple branch names --- Trigger/TrigT1/TrigT1NSWSimTools/src/MMTriggerToolTree.cxx | 2 +- Trigger/TrigT1/TrigT1NSWSimTools/src/StripClusterTool.cxx | 2 +- Trigger/TrigT1/TrigT1NSWSimTools/src/StripSegmentTool.cxx | 2 +- Trigger/TrigT1/TrigT1NSWSimTools/src/StripTdsOfflineTool.cxx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMTriggerToolTree.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMTriggerToolTree.cxx index 526233c480d..15dbfc1f3ac 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMTriggerToolTree.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMTriggerToolTree.cxx @@ -124,7 +124,7 @@ namespace NSWL1 { m_NSWMM_dig_stripGposZ = new std::vector< std::vector >; if (m_tree) { - std::string ToolName = name().substr( name().find("::")+2,std::string::npos ); + std::string ToolName = name().substr( name().find("__")+2,std::string::npos ); const char* n = ToolName.c_str(); m_tree->Branch(TString::Format("%s_trigger_diamond_bc",n).Data(), &m_trigger_diamond_bc); diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/StripClusterTool.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/StripClusterTool.cxx index 5c6e0f9d3d4..bf4251ce14f 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/StripClusterTool.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/StripClusterTool.cxx @@ -124,7 +124,7 @@ namespace NSWL1 { m_cl_phiId= new std::vector(); if (m_tree) { - std::string ToolName = name().substr( name().find("::")+2,std::string::npos ); + std::string ToolName = name().substr( name().find("__")+2,std::string::npos ); const char* n = ToolName.c_str(); m_tree->Branch(TString::Format("%s_cl_n",n).Data(),&m_cl_n,TString::Format("%s_cl_n/i",n).Data()); m_tree->Branch(TString::Format("%s_cl_charge",n).Data(),&m_cl_charge); diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/StripSegmentTool.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/StripSegmentTool.cxx index 261a528da25..4e2c4ba553d 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/StripSegmentTool.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/StripSegmentTool.cxx @@ -324,7 +324,7 @@ namespace NSWL1 { m_seg_wedge2_size = new std::vector< int >(); if (m_tree) { - std::string ToolName = name().substr( name().find("::")+2,std::string::npos ); + std::string ToolName = name().substr( name().find("__")+2,std::string::npos ); const char* n = ToolName.c_str(); m_tree->Branch(TString::Format("%s_seg_theta",n).Data(),&m_seg_theta); m_tree->Branch(TString::Format("%s_seg_dtheta",n).Data(),&m_seg_dtheta); diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/StripTdsOfflineTool.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/StripTdsOfflineTool.cxx index 98e7555fb45..aa138b0621d 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/StripTdsOfflineTool.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/StripTdsOfflineTool.cxx @@ -94,7 +94,7 @@ namespace NSWL1 { m_strip_time= new std::vector< float >(); if (m_tree) { - std::string ToolName = name().substr( name().find("::")+2,std::string::npos ); + std::string ToolName = name().substr( name().find("__")+2,std::string::npos ); const char* n = ToolName.c_str(); m_tree->Branch(TString::Format("%s_nStripHits",n).Data(),&m_nStripHits,TString::Format("%s_nStripHits/i",n).Data()); m_tree->Branch(TString::Format("%s_charge",n).Data(),&m_stripCharge); -- GitLab From bf110a048902ccf85fd4741c33900e442778ed78 Mon Sep 17 00:00:00 2001 From: fgravili Date: Wed, 25 May 2022 15:34:18 +0200 Subject: [PATCH 3/4] Removed thread checks and switch, replaced with dedicated flag --- .../TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py index 597ea798ce9..cbc63153807 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py @@ -30,7 +30,6 @@ class opt: doID = True # ConfigFlags.Trigger.doID doCalo = True # ConfigFlags.Trigger.doCalo doMuon = True # ConfigFlags.Trigger.doMuon - doWriteNSWDebug = False # Write out NSW ntuple for debugging purposes? doWriteRDOTrigger = False # Write out RDOTrigger? doWriteBS = True # Write out BS? doL1Unpacking = True # decode L1 data in input file if True, else setup emulation @@ -589,9 +588,7 @@ if hasattr(topSequence,"SGInputLoader"): if not hasattr(svcMgr, 'THistSvc'): from GaudiSvc.GaudiSvcConf import THistSvc svcMgr += THistSvc() - from AthenaCommon.ConcurrencyFlags import jobproperties as jp - nThreads = jp.ConcurrencyFlags.NumThreads() - if nThreads == 1 and opt.doWriteNSWDebug: + if ConfigFlags.Trigger.L1MuonSim.WriteNSWDebugNtuple: svcMgr.THistSvc.Output += [ "NSWL1Simulation DATAFILE='NSWL1Simulation.root' OPT='RECREATE'" ] if hasattr(svcMgr.THistSvc, "Output"): -- GitLab From 1a385cc8a5f0eebdd07f8db5f1e53b20b886bec6 Mon Sep 17 00:00:00 2001 From: fgravili Date: Wed, 25 May 2022 15:39:07 +0200 Subject: [PATCH 4/4] Added two dedicated flags to enable storing sTGC/MM output branches, replacing hardcoded values and making an uniform usage of flags --- .../python/Lvl1MuonSimulationConfig.py | 14 +++++------ .../python/TriggerConfigFlags.py | 23 +++++++++++++------ 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1MuonSimulationConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1MuonSimulationConfig.py index d54fb9d4090..869cc8bbd88 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1MuonSimulationConfig.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1MuonSimulationConfig.py @@ -247,14 +247,14 @@ def NSWTriggerConfig(flags): from SGComps.SGInputLoaderConfig import SGInputLoaderCfg acc.merge(SGInputLoaderCfg(flags, Load=rdoInputs)) - PadTdsTool = CompFactory.NSWL1.PadTdsOfflineTool("NSWL1__PadTdsOfflineTool",DoNtuple=False, IsMC = flags.Input.isMC, sTGC_DigitContainerName="sTGC_DIGITS_L1") - PadTriggerLogicTool = CompFactory.NSWL1.PadTriggerLogicOfflineTool("NSWL1__PadTriggerLogicOfflineTool",DoNtuple=False) + PadTdsTool = CompFactory.NSWL1.PadTdsOfflineTool("NSWL1__PadTdsOfflineTool",DoNtuple=flags.Trigger.L1MuonSim.WritesTGCBranches, IsMC = flags.Input.isMC, sTGC_DigitContainerName="sTGC_DIGITS_L1") + PadTriggerLogicTool = CompFactory.NSWL1.PadTriggerLogicOfflineTool("NSWL1__PadTriggerLogicOfflineTool",DoNtuple=flags.Trigger.L1MuonSim.WritesTGCBranches) PadTriggerLookupTool = CompFactory.NSWL1.PadTriggerLookupTool("NSWL1__PadTriggerLookupTool") - StripTdsTool = CompFactory.NSWL1.StripTdsOfflineTool("NSWL1__StripTdsOfflineTool",DoNtuple=False,IsMC=flags.Input.isMC,sTGC_DigitContainerName="sTGC_DIGITS_L1") - StripClusterTool = CompFactory.NSWL1.StripClusterTool("NSWL1__StripClusterTool",DoNtuple=False,IsMC=flags.Input.isMC) - StripSegmentTool = CompFactory.NSWL1.StripSegmentTool("NSWL1__StripSegmentTool",DoNtuple=False) + StripTdsTool = CompFactory.NSWL1.StripTdsOfflineTool("NSWL1__StripTdsOfflineTool",DoNtuple=flags.Trigger.L1MuonSim.WritesTGCBranches,IsMC=flags.Input.isMC,sTGC_DigitContainerName="sTGC_DIGITS_L1") + StripClusterTool = CompFactory.NSWL1.StripClusterTool("NSWL1__StripClusterTool",DoNtuple=flags.Trigger.L1MuonSim.WritesTGCBranches,IsMC=flags.Input.isMC) + StripSegmentTool = CompFactory.NSWL1.StripSegmentTool("NSWL1__StripSegmentTool",DoNtuple=flags.Trigger.L1MuonSim.WritesTGCBranches) MMStripTdsTool = CompFactory.NSWL1.MMStripTdsOfflineTool("NSWL1__MMStripTdsOfflineTool",DoNtuple=False) - MMTriggerTool = CompFactory.NSWL1.MMTriggerTool("NSWL1__MMTriggerTool",DoNtuple=False, IsMC = flags.Input.isMC, MmDigitContainer="MM_DIGITS_L1") + MMTriggerTool = CompFactory.NSWL1.MMTriggerTool("NSWL1__MMTriggerTool",DoNtuple=flags.Trigger.L1MuonSim.WriteMMBranches, IsMC = flags.Input.isMC, MmDigitContainer="MM_DIGITS_L1") TriggerProcessorTool = CompFactory.NSWL1.TriggerProcessorTool("NSWL1__TriggerProcessorTool") dosTGC = flags.Trigger.L1MuonSim.doPadTrigger or flags.Trigger.L1MuonSim.doStripTrigger @@ -264,7 +264,7 @@ def NSWTriggerConfig(flags): nswAlg = CompFactory.NSWL1.NSWL1Simulation("NSWL1Simulation", UseLookup = False, - DoNtuple = False, + DoNtuple = flags.Trigger.L1MuonSim.WriteNSWDebugNtuple, DoMM = flags.Trigger.L1MuonSim.doMMTrigger, DoMMDiamonds = flags.Trigger.L1MuonSim.doMMTrigger, DosTGC = dosTGC, diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py index 0619d9dff49..330fc895176 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py @@ -48,6 +48,15 @@ def createTriggerFlags(doTriggerRecoFlags): # Enable NSW sTGC strip trigger flags.addFlag('Trigger.L1MuonSim.doStripTrigger', False) + # Enable Storing NSW Debug Ntuple + flags.addFlag('Trigger.L1MuonSim.WriteNSWDebugNtuple', False) + + # Enable Storing MM branches in NSW Debug Ntuple + flags.addFlag('Trigger.L1MuonSim.WriteMMBranches', False) + + # Enable Storing NSW Debug Ntuple + flags.addFlag('Trigger.L1MuonSim.WritesTGCBranches', False) + # Enable the veto mode of the NSW-TGC coincidence flags.addFlag('Trigger.L1MuonSim.NSWVetoMode', False) @@ -125,7 +134,7 @@ def createTriggerFlags(doTriggerRecoFlags): flags.addFlag('Trigger.doEDMVersionConversion', False) # Flag to control the scheduling of online Run 3 trigger navigation compactification into a single collection (uses slimming framework). - flags.addFlag('Trigger.doOnlineNavigationCompactification', True) + flags.addFlag('Trigger.doOnlineNavigationCompactification', True) # Flag to control the scheduling of offline Run 3 trigger navigation slimming in RAWtoESD, RAWtoAOD, AODtoDAOD or RAWtoALL transforms. flags.addFlag('Trigger.doNavigationSlimming', True) @@ -164,7 +173,7 @@ def createTriggerFlags(doTriggerRecoFlags): # shortcut to check if job is running in a partition (i.e. partition name is not empty) flags.addFlag('Trigger.Online.isPartition', lambda prevFlags: len(prevFlags.Trigger.Online.partitionName)>0) - + # write BS output file flags.addFlag('Trigger.writeBS', False) @@ -235,7 +244,7 @@ def createTriggerFlags(doTriggerRecoFlags): return flags def createTriggerRecoFlags(): - flags = AthConfigFlags() + flags = AthConfigFlags() # enables the correction for pileup in cell energy calibration (should it be moved to some place where other calo flags are defined?) flags.addFlag('Trigger.calo.doOffsetCorrection', True ) @@ -252,14 +261,14 @@ def createTriggerRecoFlags(): muonflags.Muon.useTGCPriorNextBC=True muonflags.Muon.MuonTrigger=True muonflags.Muon.SAMuonTrigger=True - return muonflags + return muonflags def __muon(): from MuonConfig.MuonConfigFlags import createMuonConfigFlags muonflags = createMuonConfigFlags() muonflags.Muon.useTGCPriorNextBC=True muonflags.Muon.MuonTrigger=True - return muonflags + return muonflags def __muonCombined(): from MuonCombinedConfig.MuonCombinedConfigFlags import createMuonCombinedConfigFlags @@ -278,7 +287,7 @@ def createTriggerRecoFlags(): from TrigTauRec.TrigTauConfigFlags import createTrigTauConfigFlags return createTrigTauConfigFlags() flags.addFlagsCategory('Trigger.Offline.Tau', __tau ) - #TODO come back and use systematically the same + #TODO come back and use systematically the same def __idTrk(): from TrigInDetConfig.TrigTrackingPassFlags import createTrigTrackingPassFlags @@ -313,7 +322,7 @@ def createTriggerRecoFlags(): flags.addFlagsCategory("Trigger.HTT", __httFlags, prefix=True ) return flags - + if __name__ == "__main__": import unittest -- GitLab