ATLAS Offline Software
HION4.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 # HION4.py
3 
4 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
5 from AthenaConfiguration.ComponentFactory import CompFactory
6 from AthenaConfiguration.Enums import MetadataCategory
7 from AthenaCommon.CFElements import seqAND
8 
9 
12  """Configure the example skimming tool"""
13  acc = ComponentAccumulator()
14 
15  ExtraData = []
16  ExtraData += ['xAOD::MuonContainer/Muons']
17  ExtraData += ['xAOD::ElectronContainer/Electrons']
18  ExtraData += ['xAOD::PhotonContainer/Photons']
19  ExtraData += ['xAOD::TrackParticleContainer/InDetTrackParticles']
20 
21  acc.addSequence( seqAND("HION4Sequence") )
22  acc.getSequence("HION4Sequence").ExtraDataForDynamicConsumers = ExtraData
23  acc.getSequence("HION4Sequence").ProcessDynamicDataDependencies = True
24 
25  muonsRequirements = '(Muons.pt >= 2.0*GeV) && (abs(Muons.eta) < 2.6)'
26  muonOnlySelection = 'count('+muonsRequirements+') >= 1'
27 
28  electronsRequirements = '(Electrons.pt > 1.5*GeV) && (abs(Electrons.eta) < 2.6)'
29  electronOnlySelection = 'count('+electronsRequirements+') >= 1'
30 
31  photonsRequirements = '(Photons.pt >= 1.5*GeV)'
32  photonOnlySelection = 'count('+photonsRequirements+') >=2'
33 
34  electronPhotonSelection = '(count('+electronsRequirements+') + count('+photonsRequirements+')) >= 2'
35 
36  trackRequirements = '(InDetTrackParticles.pt >= 0.2*GeV) && (abs(InDetTrackParticles.eta) < 2.5)'
37  trackOnlySelection = '( count('+trackRequirements+') >= 2 && 5 >= count('+trackRequirements+') )'
38 
39  tightTrackRequirements = '(InDetTrackParticles.pt >= 1*GeV) && (abs(InDetTrackParticles.eta) < 2.5)'
40  tightTrackOnlySelection = '( count('+tightTrackRequirements+') == 2 )'
41 
42  objectSelection = '('+muonOnlySelection+' || '+electronOnlySelection+' || '+photonOnlySelection+' || '+electronPhotonSelection+' || '+trackOnlySelection+')'
43 
44  from DerivationFrameworkHI import ListTriggers
45  VMtrigger=ListTriggers.HION4SkimmingTriggersVM()
46  triggers=ListTriggers.HION4SkimmingTriggersALL()
47 
48  tdt = None
49  if flags.Trigger.EDMVersion != -1: # Only for files with trigger payload
50  from TrigDecisionTool.TrigDecisionToolConfig import TrigDecisionToolCfg
51  tdt = acc.getPrimaryAndMerge(TrigDecisionToolCfg(flags))
52  expression = '( (' + ' || '.join(triggers) + ') && '+objectSelection+') || ( '+ ' || '.join(VMtrigger)+ ' && '+tightTrackOnlySelection+')'
53  else:
54  expression = '( '+objectSelection+' ) || ( '+tightTrackOnlySelection+' )'
55 
56 
57  acc.addPublicTool(CompFactory.DerivationFramework.xAODStringSkimmingTool(name = "HION4StringSkimmingTool",
58  expression = expression,
59  TrigDecisionTool=tdt),
60  primary = True)
61 
62  return(acc)
63 
65  """Configure the example augmentation tool"""
66  acc = ComponentAccumulator()
67  acc.addPublicTool(CompFactory.DerivationFramework.AugmentationDeltaPoverP(name = "HION4AugmentationTool"),
68  primary = True)
69  return(acc)
70 
71 
72 def HION4KernelCfg(flags, name='HION4Kernel', **kwargs):
73  """Configure the derivation framework driving algorithm (kernel)"""
74  acc = ComponentAccumulator()
75 
76  skimmingTool = acc.getPrimaryAndMerge(HION4SkimmingToolCfg(flags))
77  acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(name, SkimmingTools = [skimmingTool]),
78  sequenceName="HION4Sequence")
79  return acc
80 
81 
82 def HION4Cfg(flags):
83 
84  acc = ComponentAccumulator()
85  acc.merge(HION4KernelCfg(flags, name="HION4Kernel",StreamName = "StreamDAOD_HION4"))
86 
87  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
88  from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
89  from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
90 
91 
93  from DerivationFrameworkHI import ListSlimming
94 
95  HION4SlimmingHelper = SlimmingHelper("HION4SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
96 
97  AllVariables = []
98  AllVariables += ListSlimming.HION4ExtraContainersElectrons()
99  AllVariables += ListSlimming.HION4ExtraContainersTrigger()
100  AllVariables += ListSlimming.HION4AllVariablesGeneral()
101 
102  HION4SlimmingHelper.SmartCollections = ListSlimming.HION4SmartCollections()
103  HION4SlimmingHelper.ExtraVariables = ListSlimming.HION4ExtraContentAll()
104  HION4SlimmingHelper.AllVariables = AllVariables
105 
106  # Add egamma trigger objects
107  HION4SlimmingHelper.IncludeEGammaTriggerContent = True
108  # Add muon trigger objects
109  HION4SlimmingHelper.IncludeMuonTriggerContent = True
110 
111  HION4ItemList = HION4SlimmingHelper.GetItemList()
112 
113  acc.merge(OutputStreamCfg(flags, "DAOD_HION4", ItemList=HION4ItemList, AcceptAlgs=["HION4Kernel"]))
114  acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_HION4", AcceptAlgs=["HION4Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
115 
116  return acc
python.HION4.HION4KernelCfg
def HION4KernelCfg(flags, name='HION4Kernel', **kwargs)
Definition: HION4.py:72
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
python.HION4.HION4SkimmingToolCfg
def HION4SkimmingToolCfg(flags)
Skiming.
Definition: HION4.py:11
python.CFElements.seqAND
def seqAND(name, subs=[])
Definition: CFElements.py:25
python.HION4.HION4AugmentationToolCfg
def HION4AugmentationToolCfg(flags)
Definition: HION4.py:64
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.HION4.HION4Cfg
def HION4Cfg(flags)
Definition: HION4.py:82
python.TriggerInterface.TrigDecisionToolCfg
def TrigDecisionToolCfg(flags)
Definition: TriggerInterface.py:14
InfileMetaDataConfig.SetupMetaDataForStreamCfg
def SetupMetaDataForStreamCfg(flags, streamName="", AcceptAlgs=None, createMetadata=None, propagateMetadataFromInput=True, *args, **kwargs)
Definition: InfileMetaDataConfig.py:222
SlimmingHelper
Definition: SlimmingHelper.py:1