ATLAS Offline Software
HION14.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 #!/usr/bin/env python
3 
4 #====================================================================
5 # HION14.py
6 # author: Mariana Vivas <mariana.vivas.albornoz@cern.ch>
7 # Application: Open Data
8 #====================================================================
9 
10 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
11 from AthenaConfiguration.ComponentFactory import CompFactory
12 from AthenaConfiguration.Enums import MetadataCategory
13 
14 #Skiming
16  """Configure the example skimming tool"""
17  from TrigDecisionTool.TrigDecisionToolConfig import TrigDecisionToolCfg
18  acc = ComponentAccumulator()
19 
20  #Building jet skimming triggers
21  triggers = ["HLT_mb_sptrk_ion_L1ZDC_A_C_VTE50","HLT_noalg_mb_L1TE50"]
22 
23  expression = ' ( ' +' || '.join(triggers) + ' )'
24 
25  tdt = acc.getPrimaryAndMerge(TrigDecisionToolCfg(flags))
26  acc.addPublicTool(CompFactory.DerivationFramework.xAODStringSkimmingTool(name = "HION14StringSkimmingTool",
27  expression = expression,
28  TrigDecisionTool=tdt),
29  primary = True)
30  return(acc)
31 
33  """Configure the example augmentation tool"""
34  acc = ComponentAccumulator()
35 
36  # Configure the augmentation tool
37  # This adds FCalEtA, FCalEtC, ...
38  augmentation_tool = CompFactory.DerivationFramework.HIGlobalAugmentationTool(name="HION14AugmentationTool",
39  nHarmonic=5 # to capture higher-order harmonics for anisotropic flow
40  )
41  acc.addPublicTool(augmentation_tool, primary=True)
42 
43  return acc
44 
46  """Configure the example augmentation tool"""
47  acc = ComponentAccumulator()
48 
49  # Configure track selection tools
50  from InDetConfig.InDetTrackSelectionToolConfig import InDetTrackSelectionTool_HITight_Cfg
51 
52  HITightTrackSelector = acc.popToolsAndMerge(InDetTrackSelectionTool_HITight_Cfg(flags,
53  name="HITightTrackSelector",
54  minPt=100
55  )
56  )
57 
58  # Add track selection tools to the ComponentAccumulator
59  acc.addPublicTool(HITightTrackSelector)
60 
61  # Adding the decoration for HITight
62  HITightDecorator = CompFactory.DerivationFramework.InDetTrackSelectionToolWrapper(name='HION14TighDecorator',
63  TrackSelectionTool=HITightTrackSelector,
64  DecorationName='HITight',
65  ContainerName="InDetTrackParticles"
66  )
67 
68  # Merge the ComponentAccumulator returned by the decorator configuration
69  acc.addPublicTool(HITightDecorator, primary=True)
70 
71  return acc
72 
74  """Configure the example augmentation tool"""
75  acc = ComponentAccumulator()
76 
77  # Centrality tool
78  HICentralityDecorator = CompFactory.DerivationFramework.HICentralityDecorationTool(name="HION14CentralityTool")
79 
80  # Add centrality tools to the ComponentAccumulator
81  acc.addPublicTool(HICentralityDecorator, primary=True)
82 
83  return acc
84 
85 def HION14KernelCfg(flags, name='HION14Kernel', **kwargs):
86  """Configure the derivation framework driving algorithm (kernel)"""
87  acc = ComponentAccumulator()
88  skimmingTool = []
89  # Only apply the triggers to data (it doesn't work on MC for a unknown reason)
90  if not flags.Input.isMC:
91  triggers = acc.getPrimaryAndMerge(HION14SkimmingToolCfg(flags))
92  skimmingTool += [triggers]
93 
94 
95  thinningTool = []
96 
97  # Loose thinning
98  from InDetConfig.InDetTrackSelectionToolConfig import InDetTrackSelectionTool_HILoose_Cfg
99 
100  HILooseTrackSelector = acc.popToolsAndMerge(InDetTrackSelectionTool_HILoose_Cfg(flags,
101  name = "HION14TrackSelectionToolLoose",
102  minPt = 100
103  )
104  )
105 
106  acc.addPublicTool(HILooseTrackSelector)
107 
108  HION14TrackThinningTool = CompFactory.DerivationFramework.HITrackParticleThinningTool(name="HION14TrackThinningTool",
109  #InDetTrackParticlesKey="InDetTrackParticles",
110  PrimaryVertexKey="PrimaryVertices",
111  PrimaryVertexSelection="sumPt2",
112  TrackSelectionTool=HILooseTrackSelector
113  )
114 
115  acc.addPublicTool(HION14TrackThinningTool)
116  thinningTool += [HION14TrackThinningTool]
117 
118  # Muon thinning
119  muonThinningTool = CompFactory.DerivationFramework.MuonTrackParticleThinning(name="HION14MuonThinningTool",
120  MuonKey = "Muons",
121  InDetTrackParticlesKey = "InDetTrackParticles")
122 
123  acc.addPublicTool(muonThinningTool)
124  thinningTool += [muonThinningTool]
125 
126  # Truth thinning
127  if flags.Input.isMC:
128  truth_thinning_expression = "(TruthParticles.status == 1) && ( (TruthParticles.pdgId != 2112 && TruthParticles.pdgId != 2212) || TruthParticles.pt > 0.1 )"
129 
130  from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import GenericTruthThinningCfg
131 
132  HION14TruthThinningTool = acc.getPrimaryAndMerge(GenericTruthThinningCfg(flags,
133  name="HION14TruthThinningTool",
134  StreamName=kwargs['StreamName'],
135  ParticleSelectionString=truth_thinning_expression
136  )
137  )
138 
139  thinningTool += [HION14TruthThinningTool]
140 
141 
143  globalAugmentationTool = acc.getPrimaryAndMerge(HION14GlobalAugmentationToolCfg(flags))
144  tightAugmentationTool = acc.getPrimaryAndMerge(HION14TightAugmentationToolCfg(flags))
145  centralityAugmentatioTool = acc.getPrimaryAndMerge(HION14CentralityAugmentationToolCfg(flags))
146  augmentationTool = [globalAugmentationTool, tightAugmentationTool, centralityAugmentatioTool]
147 
148  DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
149  acc.addEventAlgo(DerivationKernel(name,
150  SkimmingTools= skimmingTool,
151  ThinningTools=thinningTool,
152  AugmentationTools=augmentationTool
153  ),
154  )
155 
156  return acc
157 
158 def HION14Cfg(flags):
159  acc = ComponentAccumulator()
160  acc.merge(HION14KernelCfg(flags, name="HION14Kernel", StreamName="StreamDAOD_HION14"))
161 
162  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
163  from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
164  from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
165 
166 
167  from DerivationFrameworkHI import ListSlimming
168 
169  HION14SlimmingHelper = SlimmingHelper("HION14SlimmingHelper", NamesAndTypes=flags.Input.TypedCollections, flags=flags)
170 
171  HION14SlimmingHelper.SmartCollections = ListSlimming.HION14SmartCollections()
172  # For these variables we want all the branches
173  HION14SlimmingHelper.AllVariables = ListSlimming.HION14AllVariablesGeneral()
174  # These are selected branches
175  HION14SlimmingHelper.ExtraVariables = ListSlimming.HION14ExtraContentAll()
176 
177  # Truth information
178  if flags.Input.isMC:
179  HION14SlimmingHelper.ExtraVariables +=ListSlimming.HION14ExtraContentAllTruth()
180  HION14SlimmingHelper.AllVariables += ListSlimming.HION14TruthVariablesGeneral()
181 
182 
183  HION14ItemList = HION14SlimmingHelper.GetItemList()
184 
185  acc.merge(OutputStreamCfg(flags, "DAOD_HION14", ItemList=HION14ItemList, AcceptAlgs=["HION14Kernel"]))
186  acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_HION14", AcceptAlgs=["HION14Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
187 
188  return acc
189 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.HION14.HION14TightAugmentationToolCfg
def HION14TightAugmentationToolCfg(flags)
Definition: HION14.py:45
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
python.HION14.HION14Cfg
def HION14Cfg(flags)
Definition: HION14.py:158
python.HION14.HION14CentralityAugmentationToolCfg
def HION14CentralityAugmentationToolCfg(flags)
Definition: HION14.py:73
python.TruthDerivationToolsConfig.GenericTruthThinningCfg
def GenericTruthThinningCfg(flags, name, **kwargs)
Definition: TruthDerivationToolsConfig.py:409
python.InDetTrackSelectionToolConfig.InDetTrackSelectionTool_HITight_Cfg
def InDetTrackSelectionTool_HITight_Cfg(flags, name="InDetTrackSelectionTool_HITight", **kwargs)
Definition: InDetTrackSelectionToolConfig.py:73
python.HION14.HION14SkimmingToolCfg
def HION14SkimmingToolCfg(flags)
Definition: HION14.py:15
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.TriggerInterface.TrigDecisionToolCfg
def TrigDecisionToolCfg(flags)
Definition: TriggerInterface.py:14
python.InDetTrackSelectionToolConfig.InDetTrackSelectionTool_HILoose_Cfg
def InDetTrackSelectionTool_HILoose_Cfg(flags, name="InDetTrackSelectionTool_HILoose", **kwargs)
Definition: InDetTrackSelectionToolConfig.py:68
InfileMetaDataConfig.SetupMetaDataForStreamCfg
def SetupMetaDataForStreamCfg(flags, streamName="", AcceptAlgs=None, createMetadata=None, propagateMetadataFromInput=True, *args, **kwargs)
Definition: InfileMetaDataConfig.py:219
SlimmingHelper
Definition: SlimmingHelper.py:1
python.HION14.HION14GlobalAugmentationToolCfg
def HION14GlobalAugmentationToolCfg(flags)
Definition: HION14.py:32
python.HION14.HION14KernelCfg
def HION14KernelCfg(flags, name='HION14Kernel', **kwargs)
Definition: HION14.py:85
python.HION12.DerivationKernel
DerivationKernel
Definition: HION12.py:67