Commit a420a5bb authored by Tomasz Bold's avatar Tomasz Bold Committed by Adam Edward Barton
Browse files

Integrate nav conversion with transform

parent 737ea621
......@@ -10,8 +10,8 @@ class TrigDecisionMaker( TrigDec__TrigDecisionMaker ):
super( TrigDecisionMaker, self ).__init__( name )
log = logging.getLogger( 'TrigDecisionMaker' )
from AthenaConfiguration.AllConfigFlags import ConfigFlags
log.info("Setting UseNewConfig to %s (based off of ConfigFlags.Trigger.doEDMVersionConversion)", ConfigFlags.Trigger.doEDMVersionConversion)
self.Lvl1ResultAccessTool.UseNewConfig = ConfigFlags.Trigger.doEDMVersionConversion
log.info("Setting UseNewConfig to %s (based off of ConfigFlags.Trigger.doConfigVersionConversion)", ConfigFlags.Trigger.doConfigVersionConversion)
self.Lvl1ResultAccessTool.UseNewConfig = ConfigFlags.Trigger.doConfigVersionConversion
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
if hasattr(svcMgr,'DSConfigSvc'):
# this case is still needed for reading Run 2 configuration from the TriggerDB
......
......@@ -15,7 +15,10 @@ atlas_add_component( TrigNavTools
LINK_LIBRARIES TrigNavToolsLib )
# Install files from the package:
atlas_install_python_modules( python/__init__.py python/TrigNavToolsConfig.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
atlas_install_joboptions( share/*.py )
atlas_install_scripts( share/RunNavDump.py )
atlas_add_test(NavConverterTest
SCRIPT python -m TrigNavTools.NavConverterConfig
POST_EXEC_SCRIPT nopost.sh)
\ No newline at end of file
#
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
#
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
from TrigEDMConfig.TriggerEDM import getTriggerEDMList
def createNavConverterAlg():
cnvAlg = CompFactory.Run2ToRun3TrigNavConverter("TrigRun2ToRun3NavConverter")
cnvAlg.Rois = ["forID","forID1","forID2","forMS","forSA","forTB","forMT","forCB"]
cnvAlg.Chains = ["HLT_mu4"] #TODO expand or replace with wildcard covering all chains
cnvAlg.Collections = [ x.split("#")[0] for x in getTriggerEDMList("AODCONV", 2) if "Aux" not in x]
cnvAlg.TrigNavWriteKey = "HLTNav_R2ToR3"
cnvAlg.TrigSummaryWriteKey = "HLTNav_R2ToR3Summary"
return cnvAlg
def NavConverterCfg(flags):
acc = ComponentAccumulator()
from TrigConfigSvc.TrigConfigSvcCfg import HLTConfigSvcCfg
configSvcAcc = HLTConfigSvcCfg(flags)
service = configSvcAcc.getService("HLTConfigSvc") #TODO fetching the HLTConfigSvc should rely on the fact that it
acc.merge(configSvcAcc)
cnvAlg = createNavConverterAlg()
cnvAlg.HLTConfigSvc = service
acc.addEventAlgo(cnvAlg)
return acc
if __name__ == "__main__":
from AthenaConfiguration.AllConfigFlags import ConfigFlags
ConfigFlags.lock()
acc = NavConverterCfg(ConfigFlags)
acc.printConfig(withDetails=True, summariseProps=True)
acc.wasMerged()
......@@ -54,7 +54,7 @@ if __name__=='__main__':
"xAOD::TrigCompositeContainer#HLTNav_Summary", "xAOD::TrigCompositeAuxContainer#HLTNav_SummaryAux."]
outputCfg = OutputStreamCfg(ConfigFlags, outputType, ItemList=toRecord, disableEventTag=True)
streamAlg = outputCfg.getEventAlgo("OutputStream"+outputType)
# need to expand possble options for the OutputStreamCfg to be able to pass also the metadata containers
# need to expand possible options for the OutputStreamCfg to be able to pass also the metadata containers
streamAlg.MetadataItemList += ["xAOD::TriggerMenuContainer#TriggerMenu", "xAOD::TriggerMenuAuxContainer#TriggerMenuAux."]
streamAlg.TakeItemsFromInput = True
cfg.addPublicTool(CompFactory.xAODMaker.TriggerMenuMetaDataTool("TriggerMenuMetaDataTool"))
......
......@@ -40,7 +40,7 @@ public:
private:
SG::ReadHandleKey<xAOD::TrigNavigation> m_trigNavKey { this, "TrigNavReadKey", "TrigNavigation"};
Gaudi::Property<bool> m_doPrint{ this, "doPrint", true };
Gaudi::Property<bool> m_doPrint{ this, "doPrint", false };
Gaudi::Property<std::vector<std::string>> m_collectionsToSave{ this, "Collections", {} };
Gaudi::Property<std::vector<std::string>> m_chainsToSave{ this, "Chains", {} };
Gaudi::Property<std::vector<std::string>> m_roisToSave{ this, "Rois", {} };
......
......@@ -301,29 +301,29 @@ TriggerHLTList = [
#muons
#L2 Muons
('xAOD::L2StandAloneMuonContainer#HLT_MuonL2SAInfo', 'BS ESD AODFULL', 'Muon'),
('xAOD::L2StandAloneMuonAuxContainer#HLT_MuonL2SAInfoAux' + addL2saVars, 'BS ESD AODFULL AODSLIM', 'Muon'),
('xAOD::L2CombinedMuonContainer#HLT_MuonL2CBInfo', 'BS ESD AODFULL', 'Muon'), #fp
('xAOD::L2CombinedMuonAuxContainer#HLT_MuonL2CBInfoAux.', 'BS ESD AODFULL', 'Muon'), #fp
('xAOD::L2StandAloneMuonContainer#HLT_MuonL2SAInfo', 'BS ESD AODFULL AODCONV', 'Muon'),
('xAOD::L2StandAloneMuonAuxContainer#HLT_MuonL2SAInfoAux' + addL2saVars, 'BS ESD AODFULL AODSLIM AODCONV', 'Muon'),
('xAOD::L2CombinedMuonContainer#HLT_MuonL2CBInfo', 'BS ESD AODFULL AODCONV', 'Muon'), #fp
('xAOD::L2CombinedMuonAuxContainer#HLT_MuonL2CBInfoAux.', 'BS ESD AODFULL AODCONV', 'Muon'), #fp
('xAOD::L2IsoMuonContainer#HLT_MuonL2ISInfo', 'BS ESD', 'Muon'), #fp
('xAOD::L2IsoMuonAuxContainer#HLT_MuonL2ISInfoAux.', 'BS ESD', 'Muon'), #fp
#MuonEFInfo
('xAOD::MuonContainer#HLT_MuonEFInfo', 'BS ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Muon'),
('xAOD::MuonAuxContainer#HLT_MuonEFInfoAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Muon'),
('xAOD::MuonContainer#HLT_MuonEFInfo', 'BS ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM AODCONV', 'Muon'),
('xAOD::MuonAuxContainer#HLT_MuonEFInfoAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM AODCONV', 'Muon'),
('xAOD::TrackParticleContainer#HLT_MuonEFInfo_CombTrackParticles', 'BS ESD AODFULL', 'Muon'),#fp
('xAOD::TrackParticleAuxContainer#HLT_MuonEFInfo_CombTrackParticlesAux'+RemoveIDVariables, 'BS ESD AODFULL','Muon'),#fp
('xAOD::TrackParticleContainer#HLT_MuonEFInfo_ExtrapTrackParticles', 'BS ESD AODFULL', 'Muon'),#fp
('xAOD::TrackParticleAuxContainer#HLT_MuonEFInfo_ExtrapTrackParticlesAux'+RemoveIDVariables, 'BS ESD AODFULL', 'Muon'),#fp
('xAOD::MuonContainer#HLT_MuonEFInfo_FullScan', 'BS ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Muon'),
('xAOD::MuonAuxContainer#HLT_MuonEFInfo_FullScanAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Muon'),
('xAOD::MuonContainer#HLT_MuonEFInfo_FullScan', 'BS ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM AODCONV', 'Muon'),
('xAOD::MuonAuxContainer#HLT_MuonEFInfo_FullScanAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM AODCONV', 'Muon'),
('xAOD::TrackParticleContainer#HLT_MuonEFInfo_ExtrapTrackParticles_FullScan', 'BS ESD AODFULL', 'Muon'),#fp
('xAOD::TrackParticleContainer#HLT_MuonEFInfo_CombTrackParticles_FullScan', 'BS ESD AODFULL', 'Muon'),#fp
('xAOD::MuonContainer#HLT_MuonEFInfo_MSonlyTrackParticles_FullScan', 'BS ESD AODFULL', 'Muon'),
('xAOD::MuonContainer#HLT_MuonEFInfo_MSonlyTrackParticles_FullScan', 'BS ESD AODFULL AODCONV', 'Muon'),
('xAOD::TrackParticleAuxContainer#HLT_MuonEFInfo_ExtrapTrackParticles_FullScanAux'+RemoveIDVariables, 'BS ESD AODFULL', 'Muon'),#fp
('xAOD::TrackParticleAuxContainer#HLT_MuonEFInfo_CombTrackParticles_FullScanAux'+RemoveIDVariables, 'BS ESD AODFULL','Muon'),#fp
('xAOD::MuonAuxContainer#HLT_MuonEFInfo_MSonlyTrackParticles_FullScanAux.', 'BS ESD AODFULL', 'Muon'),
......@@ -933,7 +933,12 @@ TriggerResultsList=[
# ('HLT::HLTResult#HLTResult_EF' , 'ESD AODFULL AODSLIM', 'Steer'),#still needed for Run2?
('HLT::HLTResult#HLTResult_HLT', 'ESD', 'Steer'),
('xAOD::TrigNavigation#TrigNavigation' , 'ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Steer'),
('xAOD::TrigNavigationAuxInfo#TrigNavigationAux.','ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Steer')
('xAOD::TrigNavigationAuxInfo#TrigNavigationAux.','ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Steer'),
('xAOD::TrigCompositeContainer#HLTNav_R2ToR3Summary', 'ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Steer'),
('xAOD::TrigCompositeAuxContainer#HLTNav_R2ToR3SummaryAux.', 'ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Steer'),
('xAOD::TrigCompositeContainer#HLTNav_R2ToR3', 'ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Steer'),
('xAOD::TrigCompositeAuxContainer#HLTNav_R2ToR3Aux.', 'ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Steer'),
]
......
......@@ -681,6 +681,12 @@ TriggerHLTListRun3 = [
('xAOD::TrigCompositeAuxContainer#HLT_dEdxHitAux.hit_trkid.hit_dedx.hit_tot.hit_trkchi2.hit_trkndof.hit_iblovfl.hit_loc.hit_layer', 'BS ESD AODFULL', 'ID'),
('xAOD::TrigCompositeContainer#HLT_HPtdEdx', 'BS ESD AODFULL AODSLIM', 'ID'),
('xAOD::TrigCompositeAuxContainer#HLT_dEdxTrkAux.trk_pt.trk_eta.trk_a0beam.trk_dedx.trk_n_hdedx_hits.trk_n_hits_innermost.trk_n_hits_inner.trk_n_hits_pix.trk_n_hits_sct', 'BS ESD AODFULL AODSLIM', 'ID'),
('xAOD::TrigCompositeContainer#HLTNav_R2ToR3Summary', 'ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Steer'),
('xAOD::TrigCompositeAuxContainer#HLTNav_R2ToR3SummaryAux.', 'ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Steer'),
('xAOD::TrigCompositeContainer#HLTNav_R2ToR3', 'ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Steer'),
('xAOD::TrigCompositeAuxContainer#HLTNav_R2ToR3Aux.', 'ESD AODFULL AODSLIM AODVERYSLIM AODBLSSLIM', 'Steer'),
]
# HLTNav_* object list is built dynamically during job configuration, here we only define its output targets
......
......@@ -42,7 +42,7 @@ def main():
file_types = TriggerSerializable[1].split(" ")
allowed_file_types = ("", "BS", "DS", "ESD", "AODFULL", "AODSLIM", "AODVERYSLIM", "AODBLSSLIM")
allowed_file_types = ("", "BS", "DS", "ESD", "AODFULL", "AODSLIM", "AODVERYSLIM", "AODBLSSLIM", "AODCONV")
for file_type in file_types:
if file_type not in allowed_file_types:
......
......@@ -213,6 +213,12 @@ class TrigDecisionGetterRun1or2(Configured):
from TrigDecisionMaker.TrigDecisionMakerConfig import WriteTrigDecision
trigDecWriter = WriteTrigDecision() # noqa: F841
if (ConfigFlags.Trigger.EDMVersion == 1 or ConfigFlags.Trigger.EDMVersion == 2) and ConfigFlags.Trigger.doEDMVersionConversion:
from TrigNavTools.NavConverterConfig import createNavConverterAlg
navCnvAlg = createNavConverterAlg()
navCnvAlg.HLTConfigSvc = "HLTConfigSvcRun3"
navCnvAlg.ExtraInputs += [("TrigBSExtractionOutput", "StoreGateSvc+TrigBSExtractionOutput")]
topSequence += navCnvAlg
# WritexAODTrigDecision() is called within WriteTrigDecision()
......
......@@ -101,6 +101,7 @@ def createTriggerFlags():
flags.addFlag('Trigger.EDMVersion', lambda prevFlags: EDMVersion(prevFlags))
flags.addFlag('Trigger.doEDMVersionConversion', True)
flags.addFlag('Trigger.doConfigVersionConversion', True)
# enables additional algorithms colecting MC truth infrmation (this is only used by IDso maybe we need Trigger.ID.doTruth only?)
flags.addFlag('Trigger.doTruth', False)
......
......@@ -369,7 +369,8 @@ class TriggerConfigGetter(Configured):
writeMenuJSON = False # Run3 offline xAOD metadata summary format
from AthenaConfiguration.AllConfigFlags import ConfigFlags
if ConfigFlags.Trigger.EDMVersion == 1 or ConfigFlags.Trigger.EDMVersion == 2:
if ConfigFlags.Trigger.doEDMVersionConversion:
if ConfigFlags.Trigger.doConfigVersionConversion:
log.info("Configuring Run2 to Run3 configuration metadata conversion")
# also save the menu in JSON format
from RecExConfig.AutoConfiguration import GetRunNumber, GetLBNumber
dbKeys = fetchRun3ConfigFiles(isMC=self.readMC, run=GetRunNumber(), lb=GetLBNumber())
......@@ -396,6 +397,7 @@ class TriggerConfigGetter(Configured):
menuwriter.KeyWriterTool = TrigConf__KeyWriterTool('KeyWriterToolOffline')
writeMenuJSON = True
topAlgs += menuwriter
else:
from TrigConfxAOD.TrigConfxAODConf import TrigConf__xAODMenuWriter
topAlgs += TrigConf__xAODMenuWriter( OverwriteEventObj = True )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment