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 102 of file STDM7.py.

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

◆ STDM7KernelCfg()

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

Definition at line 80 of file STDM7.py.

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

◆ STDM7SkimmingToolCfg()

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

Definition at line 10 of file STDM7.py.

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