ATLAS Offline Software
Functions
python.STDM7 Namespace Reference

Functions

def STDM7SkimmingToolCfg (flags)
 
def STDM7KernelCfg (flags, name='STDM7Kernel', **kwargs)
 
def STDM7Cfg (flags)
 

Function Documentation

◆ STDM7Cfg()

def python.STDM7.STDM7Cfg (   flags)

Definition at line 101 of file STDM7.py.

101 def STDM7Cfg(flags):
102 
103  acc = ComponentAccumulator()
104 
105  # Get the lists of triggers needed for trigger matching.
106  # This is needed at this scope (for the slimming) and further down in the config chain
107  # for actually configuring the matching, so we create it here and pass it down
108  # TODO: this should ideally be called higher up to avoid it being run multiple times in a train
109  from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper
110  STDM7TriggerListsHelper = TriggerListsHelper(flags)
111 
112  # Common augmentations
113  acc.merge(STDM7KernelCfg(flags, name="STDM7Kernel", StreamName = 'StreamDAOD_STDM7', TriggerListsHelper = STDM7TriggerListsHelper))
114 
115  # ============================
116  # Define contents of the format
117  # =============================
118  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
119  from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
120  from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
121 
122  STDM7SlimmingHelper = SlimmingHelper("STDM7SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
123  STDM7SlimmingHelper.SmartCollections = ["EventInfo",
124  "Electrons",
125  "Photons",
126  "Muons",
127  "PrimaryVertices",
128  "InDetTrackParticles",
129  "AntiKt4EMTopoJets",
130  "AntiKt4EMPFlowJets",
131  "BTagging_AntiKt4EMPFlow",
132  "BTagging_AntiKtVR30Rmax4Rmin02Track",
133  "MET_Baseline_AntiKt4EMTopo",
134  "MET_Baseline_AntiKt4EMPFlow",
135  "TauJets"
136  # custom reconstruction for yy->WW
137  # this has not yet been migrated to master, and smart slimming is not yet available
138  # "LowPtRoITrackParticles",
139  # "LowPtRoIVertexContainer"
140  ]
141 
142  # STDM7 needs AFP information
143  STDM7SlimmingHelper.AllVariables = [ "AFPSiHitContainer",
144  "AFPToFHitContainer",
145  "AFPSiHitsClusterContainer",
146  "AFPTrackContainer",
147  "AFPToFTrackContainer",
148  "AFPProtonContainer",
149  "AFPVertexContainer"
150  ]
151 
152  excludedVertexAuxData = "-vxTrackAtVertex.-MvfFitInfo.-isInitialized.-VTAV"
153  StaticContent = []
154  StaticContent += ["xAOD::VertexContainer#SoftBVrtClusterTool_Tight_Vertices"]
155  StaticContent += ["xAOD::VertexAuxContainer#SoftBVrtClusterTool_Tight_VerticesAux." + excludedVertexAuxData]
156  StaticContent += ["xAOD::VertexContainer#SoftBVrtClusterTool_Medium_Vertices"]
157  StaticContent += ["xAOD::VertexAuxContainer#SoftBVrtClusterTool_Medium_VerticesAux." + excludedVertexAuxData]
158  StaticContent += ["xAOD::VertexContainer#SoftBVrtClusterTool_Loose_Vertices"]
159  StaticContent += ["xAOD::VertexAuxContainer#SoftBVrtClusterTool_Loose_VerticesAux." + excludedVertexAuxData]
160 
161  STDM7SlimmingHelper.StaticContent = StaticContent
162 
163  # Truth containers
164  if flags.Input.isMC:
165 
166  from DerivationFrameworkMCTruth.MCTruthCommonConfig import addTruth3ContentToSlimmerTool
167  addTruth3ContentToSlimmerTool(STDM7SlimmingHelper)
168  STDM7SlimmingHelper.AllVariables += ['TruthHFWithDecayParticles','TruthHFWithDecayVertices','TruthCharm','TruthPileupParticles','InTimeAntiKt4TruthJets','OutOfTimeAntiKt4TruthJets']
169  STDM7SlimmingHelper.ExtraVariables += ["Electrons.TruthLink",
170  "Muons.TruthLink",
171  "Photons.TruthLink",
172  "AntiKt4EMTopoJets.DFCommonJets_QGTagger_truthjet_nCharged.DFCommonJets_QGTagger_truthjet_pt.DFCommonJets_QGTagger_truthjet_eta.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt",
173  "AntiKt4EMPFlowJets.DFCommonJets_QGTagger_truthjet_nCharged.DFCommonJets_QGTagger_truthjet_pt.DFCommonJets_QGTagger_truthjet_eta.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt",
174  "TruthPrimaryVertices.t.x.y.z",
175  "InDetTrackParticles.TTVA_AMVFVertices.TTVA_AMVFWeights.eProbabilityHT.numberOfTRTHits.numberOfTRTOutliers",
176  "EventInfo.hardScatterVertexLink.timeStampNSOffset",
177  "TauJets.dRmax.etOverPtLeadTrk",
178  # "TauJets_MuonRM.dRmax.etOverPtLeadTrk", # copied from PHYS but container is not in STDM7
179  "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET.ex.ey",
180  "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_mht.ex.ey"]
181 
182  # Trigger content
183  STDM7SlimmingHelper.IncludeTriggerNavigation = False
184  STDM7SlimmingHelper.IncludeJetTriggerContent = False
185  STDM7SlimmingHelper.IncludeMuonTriggerContent = False
186  STDM7SlimmingHelper.IncludeEGammaTriggerContent = False
187  STDM7SlimmingHelper.IncludeTauTriggerContent = False
188  STDM7SlimmingHelper.IncludeEtMissTriggerContent = False
189  STDM7SlimmingHelper.IncludeBJetTriggerContent = False
190  STDM7SlimmingHelper.IncludeBPhysTriggerContent = False
191  STDM7SlimmingHelper.IncludeMinBiasTriggerContent = False
192 
193  # Trigger matching
194  # Run 2
195  if flags.Trigger.EDMVersion == 2:
196  from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddRun2TriggerMatchingToSlimmingHelper
197  AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = STDM7SlimmingHelper,
198  OutputContainerPrefix = "TrigMatch_",
199  TriggerList = STDM7TriggerListsHelper.Run2TriggerNamesTau)
200  AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = STDM7SlimmingHelper,
201  OutputContainerPrefix = "TrigMatch_",
202  TriggerList = STDM7TriggerListsHelper.Run2TriggerNamesNoTau)
203  # Run 3, or Run 2 with navigation conversion
204  if flags.Trigger.EDMVersion == 3 or (flags.Trigger.EDMVersion == 2 and flags.Trigger.doEDMVersionConversion):
205  from TrigNavSlimmingMT.TrigNavSlimmingMTConfig import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
207 
208  # Output stream
209  STDM7ItemList = STDM7SlimmingHelper.GetItemList()
210  acc.merge(OutputStreamCfg(flags, "DAOD_STDM7", ItemList=STDM7ItemList, AcceptAlgs=["STDM7Kernel"]))
211  acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_STDM7", AcceptAlgs=["STDM7Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
212 
213  return acc

◆ STDM7KernelCfg()

def python.STDM7.STDM7KernelCfg (   flags,
  name = 'STDM7Kernel',
**  kwargs 
)
Configure the derivation framework driving algorithm (kernel)

Definition at line 79 of file STDM7.py.

79 def STDM7KernelCfg(flags, name='STDM7Kernel', **kwargs):
80  """Configure the derivation framework driving algorithm (kernel)"""
81  acc = ComponentAccumulator()
82 
83  # Common augmentations
84  from DerivationFrameworkPhys.PhysCommonConfig import PhysCommonAugmentationsCfg
85  acc.merge(PhysCommonAugmentationsCfg(flags, TriggerListsHelper = kwargs['TriggerListsHelper']))
86 
87  # Inner detector group recommendations for indet tracks in analysis
88  # --> removed InDetTrackParticle thinning as we need all
89 
90  # Finally the kernel itself
91  thinningTools = [] # none for the moment
92  skimmingTools = [ acc.getPrimaryAndMerge(STDM7SkimmingToolCfg(flags)) ]
93 
94  DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
95  acc.addEventAlgo(DerivationKernel(name,
96  ThinningTools = thinningTools,
97  SkimmingTools = skimmingTools))
98  return acc
99 
100 

◆ STDM7SkimmingToolCfg()

def python.STDM7.STDM7SkimmingToolCfg (   flags)
Configure the STDM7 skimming tool

Definition at line 9 of file STDM7.py.

9 def STDM7SkimmingToolCfg(flags):
10  '''Configure the STDM7 skimming tool'''
11  acc = ComponentAccumulator()
12 
13  # skim on two good leptons
14  muonsRequirements = '(Muons.pt >= 4*GeV) && (abs(Muons.eta) < 2.6)' \
15  '&& (Muons.DFCommonMuonPassPreselection) && (Muons.DFCommonMuonPassIDCuts)'
16  electronsRequirements = '(Electrons.pt > 11*GeV) && (abs(Electrons.eta) < 2.6)' \
17  '&& ((Electrons.DFCommonElectronsLHLoose) || ((Electrons.DFCommonElectronsDNNLoose) && (Electrons.pt > 15*GeV)))'
18 
19  chargedParticleRequirements = '(TruthParticles.pt > 500) && (TruthParticles.barcode < 200000)' \
20  '&& (TruthParticles.status == 1) && (TruthParticles.charge != 0)' \
21  '&& (TruthParticles.theta > 0.163803) && (TruthParticles.theta < 2.97778)' \
22  '&& (TruthParticles.HSBool)'
23  # theta selection correspond to |eta|<2.5 (minus epsilon); avoids floating point exception if theta=0 or pi
24 
25  muonOnlySelection = 'count('+muonsRequirements+') >=2'
26  electronOnlySelection = 'count('+electronsRequirements+') >= 2'
27  electronMuonSelection = '(count('+electronsRequirements+') + count('+muonsRequirements+')) >= 2'
28 
29  # for MC we may skim on the charged-particle multiplicity
30  filterVal = -1 # Todo: nChFilter flag to be implemented later
31  if filterVal > -1 and flags.Input.isMC :
32  chargedParticleSelection = 'count('+chargedParticleRequirements+') < '+str(filterVal)
33  offlineExpression = '(('+muonOnlySelection+' || '+electronOnlySelection+' || '+electronMuonSelection+') && ('+chargedParticleSelection+'))'
34  else:
35  offlineExpression = '(('+muonOnlySelection+' || '+electronOnlySelection+' || '+electronMuonSelection+'))'
36 
37  from TrigDecisionTool.TrigDecisionToolConfig import TrigDecisionToolCfg
38  tdt = acc.getPrimaryAndMerge(TrigDecisionToolCfg(flags))
39  STDM7StringSkimmingTool = CompFactory.DerivationFramework.xAODStringSkimmingTool(name = "STDM7StringSkimmingTool",
40  expression = offlineExpression,
41  TrigDecisionTool=tdt)
42  acc.addPublicTool(STDM7StringSkimmingTool)
43 
44  # require an OR of el and mu triggers, in the past we had a dedicated SM list but this should do just fine
45  from TriggerMenuMT.TriggerAPI.TriggerAPI import TriggerAPI
46  from TriggerMenuMT.TriggerAPI.TriggerEnums import TriggerPeriod, TriggerType
47  allperiods = TriggerPeriod.y2015 | TriggerPeriod.y2016 | TriggerPeriod.y2017 | TriggerPeriod.y2018 | TriggerPeriod.future2e34
48  TriggerAPI.setConfigFlags(flags)
49  trig_el = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.el, livefraction=0.8)
50  trig_mu = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.mu, livefraction=0.8)
51  trig_em = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.el, additionalTriggerType=TriggerType.mu, livefraction=0.8)
52 
53  # Read list of triggers from PHYS
54  extra_notau = []
55  from PathResolver import PathResolver
56  with open(PathResolver.FindCalibFile("DerivationFrameworkPhys/run2ExtraMatchingTriggers.txt")) as fp:
57  for line in fp:
58  line = line.strip()
59  if line == "" or line.startswith("#"):
60  continue
61  extra_notau.append(line)
62 
63 
64  trigger_names_full_notau = list(set(trig_el+trig_mu+trig_em+extra_notau))
65  STDM7TriggerSkimmingTool = CompFactory.DerivationFramework.TriggerSkimmingTool(name = "STDM7TriggerSkimmingTool",
66  OutputLevel = 0,
67  TriggerListOR = trigger_names_full_notau,
68  TriggerListAND = [] )
69  acc.addPublicTool(STDM7TriggerSkimmingTool)
70 
71  # the two skimming tools go into an AND filter combination tool
72  acc.addPublicTool(CompFactory.DerivationFramework.FilterCombinationAND("STDM7SkimmingTool",
73  FilterList = [STDM7StringSkimmingTool,STDM7TriggerSkimmingTool]),
74  primary = True)
75 
76  return(acc)
77 
78 
TrigNavSlimmingMTConfig.AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
def AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(slimmingHelper)
Definition: TrigNavSlimmingMTConfig.py:98
PathResolver::FindCalibFile
static std::string FindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.h:108
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.STDM7.STDM7KernelCfg
def STDM7KernelCfg(flags, name='STDM7Kernel', **kwargs)
Definition: STDM7.py:79
python.TriggerMatchingCommonConfig.AddRun2TriggerMatchingToSlimmingHelper
def AddRun2TriggerMatchingToSlimmingHelper(**kwargs)
Definition: TriggerMatchingCommonConfig.py:49
python.STDM7.STDM7SkimmingToolCfg
def STDM7SkimmingToolCfg(flags)
Definition: STDM7.py:9
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
python.MCTruthCommonConfig.addTruth3ContentToSlimmerTool
def addTruth3ContentToSlimmerTool(slimmer)
Definition: MCTruthCommonConfig.py:462
python.TriggerInterface.TrigDecisionToolCfg
def TrigDecisionToolCfg(flags)
Definition: TriggerInterface.py:14
python.STDM7.STDM7Cfg
def STDM7Cfg(flags)
Definition: STDM7.py:101
Trk::open
@ open
Definition: BinningType.h:40
python.PhysCommonConfig.PhysCommonAugmentationsCfg
def PhysCommonAugmentationsCfg(flags, **kwargs)
Definition: PhysCommonConfig.py:14
str
Definition: BTagTrackIpAccessor.cxx:11
InfileMetaDataConfig.SetupMetaDataForStreamCfg
def SetupMetaDataForStreamCfg(flags, streamName="", AcceptAlgs=None, createMetadata=None, propagateMetadataFromInput=True, *args, **kwargs)
Definition: InfileMetaDataConfig.py:222
SlimmingHelper
Definition: SlimmingHelper.py:1
python.HION12.DerivationKernel
DerivationKernel
Definition: HION12.py:66