ATLAS Offline Software
Loading...
Searching...
No Matches
AsgAnalysisConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3# AnaAlgorithm import(s):
4import re
5import warnings
6from enum import Enum
7
8from AnalysisAlgorithmsConfig.ConfigAccumulator import (
9 DataType,
10 ExpertModeWarning,
11 GeneratorWeightWarning,
12 Run4FallbackWarning,
13)
14from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock
15from AnalysisAlgorithmsConfig.ConfigSequence import groupBlocks
16from AthenaConfiguration.Enums import LHCPeriod
17
18try:
19 from AthenaCommon.Logging import logging
20except ImportError:
21 import logging
22
24 JETS = {'JET_'}
25 JER = {'JET_JER'}
26 FTAG = {'FT_'}
27 ELECTRONS = {'EG_', 'EL_'}
28 MUONS = {'MUON_'}
29 PHOTONS = {'EG_', 'PH_'}
30 TAUS = {'TAUS_'}
31 MET = {'MET_'}
32 TRACKS = {'TRK_'}
33 GENERATOR = {'GEN_'}
34 PRW = {'PRW_'}
35 EVENT = {'GEN_', 'PRW_'}
36
37class CommonServicesConfig (ConfigBlock) :
38 """the ConfigBlock for common services
39
40 The idea here is that all algorithms need some common services, and I should
41 provide configuration blocks for those. For now there is just a single
42 block, but in the future I might break out e.g. the systematics service.
43 """
44
45 def __init__ (self) :
46 super().__init__ ()
47 self.addOption ('runSystematics', None, type=bool,
48 info="whether to turn on the computation of systematic variations. "
49 "The default is to run them on MC.")
50 self.addOption ('filterSystematics', None, type=str,
51 info="a regexp string against which the systematics names will be "
52 "matched. Only positive matches are retained and used in the evaluation "
53 "of the various algorithms.")
54 self.addOption ('onlySystematicsCategories', None, type=list,
55 info="a list of strings defining categories of systematics to enable "
56 "(only recommended for studies / partial ntuple productions). Choose amongst: "
57 "`jets`, `JER`, `FTag`, `electrons`, `muons`, `photons`, `taus`, `met`, `tracks`, `generator`, `PRW`, `event`. "
58 "This option is overridden by `filterSystematics`.",
59 meta={'choices':(['jets', 'JER', 'FTag', 'electrons', 'muons', 'photons', 'taus', 'met', 'tracks', 'generator', 'PRW', 'event'], None)})
60 self.addOption ('systematicsHistogram', None , type=str,
61 info="the name of the histogram to which a list of executed "
62 "systematics will be printed. If left empty, the histogram is not written at all.")
63 self.addOption ('separateWeightSystematics', False, type=bool,
64 info="if `systematicsHistogram` is enabled, whether to create a separate "
65 "histogram holding only the names of weight-based systematics. This is useful "
66 "to help make histogramming frameworks more efficient by knowing in advance which "
67 "systematics need to recompute the observable and which don't.")
68 self.addOption ('metadataHistogram', 'metadata' , type=str,
69 info="the name of the metadata histogram which contains information about "
70 "data type, campaign, etc. If left empty, the histogram is not written at all.")
71 self.addOption ('enableExpertMode', False, type=bool,
72 info="allows CP experts and CPAlgorithm devs to use non-recommended configurations. "
73 "DO NOT USE FOR ANALYSIS.")
74 self.addOption ('streamName', None, type=str,
75 info="name of the output stream to save metadata histograms in.")
76 self.addOption ('setupONNX', False, type=bool,
77 info="creates an instance of `AthOnnx::OnnxRuntimeSvc`.")
78
79 def instanceName (self) :
80 """Return the instance name for this block"""
81 return '' # no instance name, this is a singleton
82
83 @staticmethod
84 def _ensureNominalAllowed (userRegex) :
85 """Make sure the systematics regex also accepts the nominal."""
86 if re.fullmatch (userRegex, '') is not None:
87 return userRegex
88 return f"(?:{userRegex})|^$"
89
90 def makeAlgs (self, config) :
91
92 sysService = config.createService( 'CP::SystematicsSvc', 'SystematicsSvc' )
93
94 # Setup stream name
95 streamName = config.requestOutputStream(self.streamName)
96
97 # Handle all possible configuration options for systematics
98 if self.runSystematics is False:
99 runSystematics = self.runSystematics
100 elif config.noSystematics() is not None:
101 # if option not set:
102 # check to see if set in config accumulator
103 self.runSystematics = not config.noSystematics()
104 runSystematics = self.runSystematics
105 else:
106 runSystematics = True
107
108 # Now update the global configuration
109 config._noSystematics = not runSystematics
110
111 if runSystematics:
112 sysService.sigmaRecommended = 1
113 if config.dataType() is DataType.Data:
114 # Only one type of allowed systematics on data: the JER variations!
116 if self.onlySystematicsCategories is not None:
117 # Convert strings to enums and validate
118 requested_categories = set()
119 for category_str in self.onlySystematicsCategories:
120 try:
121 category_enum = SystematicsCategories[category_str.upper()]
122 requested_categories |= category_enum.value
123 except KeyError:
124 raise ValueError(f"Invalid systematics category passed to option 'onlySystematicsCategories': {category_str}. Must be one of {', '.join(category.name for category in SystematicsCategories)}")
125 # Construct regex pattern as logical-OR of category names
126 if len(requested_categories):
127 sysService.systematicsRegex = "^(?=.*(" + "|".join(sorted(requested_categories)) + ")|$).*"
128 if self.filterSystematics is not None:
129 sysService.systematicsRegex = self._ensureNominalAllowed(self.filterSystematics)
130 config.createService( 'CP::SelectionNameSvc', 'SelectionNameSvc')
131
132 if self.systematicsHistogram is not None:
133 # print out all systematics
134 allSysDumper = config.createAlgorithm( 'CP::SysListDumperAlg', 'SystematicsPrinter' )
135 allSysDumper.histogramName = self.systematicsHistogram
136 allSysDumper.RootStreamName = streamName
137
139 # print out only the weight systematics (for more efficient histogramming down the line)
140 weightSysDumper = config.createAlgorithm( 'CP::SysListDumperAlg', 'OnlyWeightSystematicsPrinter' )
141 weightSysDumper.histogramName = f"{self.systematicsHistogram}OnlyWeights"
142 weightSysDumper.systematicsRegex = "^(GEN_|EL_EFF_|MUON_EFF_|PH_EFF_|TAUS_TRUEHADTAU_EFF_|FT_EFF_|JET_.*JvtEfficiency_|PRW_).*"
143 weightSysDumper.RootStreamName = streamName
144
146 # add histogram with metadata
147 if not config.flags:
148 raise ValueError ("Writing out the metadata histogram requires to pass config flags")
149 metadataHistAlg = config.createAlgorithm( 'CP::MetadataHistAlg', 'MetadataHistAlg' )
150 metadataHistAlg.histogramName = self.metadataHistogram
151 metadataHistAlg.dataType = str(config.dataType().value)
152 metadataHistAlg.campaign = str(config.dataYear()) if config.dataType() is DataType.Data else str(config.campaign().value)
153 metadataHistAlg.mcChannelNumber = str(config.dsid())
154 metadataHistAlg.RootStreamName = streamName
155 if config.dataType() is DataType.Data:
156 etag = "unavailable"
157 else:
158 from AthenaConfiguration.AutoConfigFlags import GetFileMD
159 metadata = GetFileMD(config.flags.Input.Files)
160 amiTags = metadata.get("AMITag", "not found!")
161 etag = str(amiTags.split("_")[0])
162 metadataHistAlg.etag = etag
163
165 # set any expert-mode errors to be ignored instead
166 warnings.simplefilter('ignore', ExpertModeWarning)
167 # just warning users they might be doing something dangerous
168 log = logging.getLogger('CommonServices')
169 bold = "\033[1m"
170 red = "\033[91m"
171 yellow = "\033[93m"
172 reset = "\033[0m"
173 log.warning(red +r"""
174 ________ _______ ______ _____ _______ __ __ ____ _____ ______ ______ _ _ ____ _ ______ _____
175 | ____\ \ / / __ \| ____| __ \__ __| | \/ |/ __ \| __ \| ____| | ____| \ | | /\ | _ \| | | ____| __ \
176 | |__ \ V /| |__) | |__ | |__) | | | | \ / | | | | | | | |__ | |__ | \| | / \ | |_) | | | |__ | | | |
177 | __| > < | ___/| __| | _ / | | | |\/| | | | | | | | __| | __| | . ` | / /\ \ | _ <| | | __| | | | |
178 | |____ / . \| | | |____| | \ \ | | | | | | |__| | |__| | |____ | |____| |\ |/ ____ \| |_) | |____| |____| |__| |
179 |______/_/ \_\_| |______|_| \_\ |_| |_| |_|\____/|_____/|______| |______|_| \_/_/ \_\____/|______|______|_____/
180
181"""
182 +reset)
183 log.warning(f"{bold}{yellow}These settings are not recommended for analysis. Make sure you know what you're doing, or disable them with `enableExpertMode: False` in `CommonServices`.{reset}")
184
185 if self.setupONNX:
186 config.createService('AthOnnx::OnnxRuntimeSvc', 'OnnxRuntimeSvc')
187 config.setContainerMeta ('EventInfo', 'OnnxEnabled', self.setupONNX)
188
189@groupBlocks
191 seq.append(CommonServicesConfig())
192 from AsgAnalysisAlgorithms.TruthCollectionsFixerConfig import TruthCollectionsFixerBlock
193 seq.append(TruthCollectionsFixerBlock())
194
195class IOStatsBlock(ConfigBlock):
196 """Print what branches are used in analysis"""
197
198 def __init__(self):
199 super().__init__()
200 self.addOption("printOption", "Summary", type=str,
201 info='option to pass the standard ROOT printing function. Can be `Summary`, `ByEntries` or `ByBytes`.',
202 meta={'choices':(['Summary','ByEntries','ByBytes'],1)})
203
204 def instanceName (self) :
205 """Return the instance name for this block"""
206 return '' # no instance name, this is a singleton
207
208 def makeAlgs(self, config):
209 alg = config.createAlgorithm('CP::IOStatsAlg', 'IOStatsAlg')
210 alg.printOption = self.printOption
211
212
213class PileupReweightingBlock (ConfigBlock):
214 """the ConfigBlock for pileup reweighting"""
215
216 def __init__ (self) :
217 super().__init__ ()
218 self.addOption ('campaign', None, type=None,
219 info="the MC campaign for the PRW auto-configuration.")
220 self.addOption ('files', None, type=list,
221 info="the input files being processed (list of strings). "
222 "Alternative to auto-configuration.")
223 self.addOption ('useDefaultConfig', True, type=bool,
224 info="whether to use the central PRW files.")
225 self.addOption ('GRLSuffixDict', {}, type=dict,
226 info="a year-suffix dictionary to help with autoconfiguration of "
227 "GRL-specific PRW configuration, e.g. selecting 'BjetHLT'.")
228 self.addOption ('userLumicalcFiles', None, type=list,
229 info="user-provided lumicalc files (list of strings). Alternative "
230 "to auto-configuration.")
231 self.addOption ('userLumicalcFilesPerCampaign', None, type=dict,
232 info="user-provided lumicalc files (dictionary of list of strings, "
233 "with MC campaigns as the keys). Alternative to auto-configuration.")
234 self.addOption ('userPileupConfigs', None, type=list,
235 info="user-provided PRW files (list of strings). Alternative to "
236 "auto-configuration.")
237 self.addOption ('userPileupConfigsPerCampaign', None, type=dict,
238 info="user-provided PRW files (dictionary of list of strings, with "
239 "MC campaigns as the keys).")
240 self.addOption ('postfix', '', type=str,
241 info="a postfix to apply to decorations and algorithm names. "
242 "Typically not needed unless several instances of `PileupReweighting` are scheduled.")
243 self.addOption ('alternativeConfig', False, type=bool,
244 info="whether this is used as an additional alternative config for `PileupReweighting`. "
245 "Will only store the alternative pileup weight in that case.")
246 self.addOption ('unrepresentedDataWarningThreshold', 1e-4, type=float,
247 info="suppress the unrepresented-data WARNING when the unrepresented "
248 "fraction is below this value (default 0.01%). Set to 0 to always "
249 "warn.")
250 self.addOption ('writeColumnarToolVariables', False, type=bool,
251 info="whether to add `EventInfo` variables needed for running the columnar tool(s) on the output n-tuple. (EXPERIMENTAL).",
252 expertMode=True)
253 self.addOption ('writeDetailedPileupValues', False, type=bool,
254 info="whether to write the average and actual pileup values with and without data scale factor.")
255
256 def instanceName (self) :
257 """Return the instance name for this block"""
258 return self.postfix
259
260 def makeAlgs (self, config) :
261
262 from Campaigns.Utils import Campaign
263
264 log = logging.getLogger("makePileupAnalysisSequence")
265
266 eventInfoVar = [
267 ("runNumber", "unsigned"),
268 ("eventNumber", "unsigned_long"),
269 ]
270 if config.dataType() is not DataType.Data:
271 eventInfoVar.extend([
272 ("mcChannelNumber", "unsigned"),
273 ])
274 # for now still write the average and actual pileup values until the new p-tag is available
275 eventInfoVar.extend([
276 ("averageInteractionsPerCrossing", "float"),
277 ("actualInteractionsPerCrossing", "float"),
278 ])
280 # This is not strictly necessary, as the columnar users
281 # could recreate this, but it is also a single constant int,
282 # that should compress exceedingly well.
283 eventInfoVar.extend([
284 ("eventTypeBitmask", "int"),
285 ])
286
287 if config.isPhyslite() and not self.alternativeConfig:
288 # PHYSLITE already has these variables defined, just need to copy them to the output
289 log.info("Physlite does not need pileup reweighting. Variables will be copied from input instead.")
291 log.warning("writeDetailedPileupValues is set to True, but Physlite does not have these variables. They will not be written to the output.")
292
293 eventInfoVar.extend([
294 ("correctedScaledInteractionsPerCrossing", "float"),
295 ])
296 for var_name, var_type in eventInfoVar:
297 config.addOutputVar("EventInfo", var_name, var_name, noSys=True, auxType=var_type)
298
299 if config.dataType() is not DataType.Data:
300 config.addOutputVar("EventInfo", "PileupWeight_%SYS%", "weight_pileup", auxType="float")
301 if config.geometry() is LHCPeriod.Run2:
302 config.addOutputVar("EventInfo", "beamSpotWeight", "weight_beamspot", noSys=True, auxType="float")
303 return
304
305 # check files from flags
306 if self.files is None and config.flags is not None:
307 self.files = config.flags.Input.Files
308
309 campaign = self.campaign
310 # if user didn't explicitly configure campaign, let's try setting it from metadata
311 if self.campaign is None:
312 # if we used flags, campaign is auto-determined
313 if config.campaign() is not None and config.campaign() is not Campaign.Unknown:
314 campaign = config.campaign()
315 log.info("Auto-configuring campaign for PRW from flags: %s", campaign.value)
316 elif config.dataType() is DataType.Data:
317 log.info("Inferring campaign from data year: %d", config.dataYear())
318 campaign = {
319 2015: Campaign.MC20a,
320 2016: Campaign.MC20a,
321 2017: Campaign.MC20d,
322 2018: Campaign.MC20e,
323 2022: Campaign.MC23a,
324 2023: Campaign.MC23d,
325 2024: Campaign.MC23e,
326 2025: Campaign.MC23g,
327 2026: Campaign.MC23g,
328 }.get(config.dataYear(), Campaign.Unknown)
329 else:
330 # we try to determine campaign from files if above failed
331 if self.files is not None:
332 from Campaigns.Utils import getMCCampaign
333 campaign = getMCCampaign(self.files)
334 if campaign and campaign is not Campaign.Unknown:
335 log.info("Auto-configuring campaign for PRW from files: %s", campaign.value)
336 else:
337 log.info("Campaign could not be determined.")
338
339
340 toolConfigFiles = []
341 toolLumicalcFiles = []
342
343 # PRW config files should only be configured if we run on MC
344 # Run 4 not supported yet
345 if (config.dataType() is not DataType.Data and
346 config.geometry() is not LHCPeriod.Run4):
347 # check if user provides per-campaign pileup config list
348 if self.userPileupConfigs is not None and self.userPileupConfigsPerCampaign is not None:
349 raise ValueError("Both userPileupConfigs and userPileupConfigsPerCampaign specified,"
350 " use only one of the options!")
351 if self.userPileupConfigsPerCampaign is not None:
352 if not campaign:
353 raise Exception("userPileupConfigsPerCampaign requires campaign to be configured!")
354 if campaign is Campaign.Unknown:
355 raise Exception("userPileupConfigsPerCampaign used, but campaign = Unknown!")
356 try:
357 toolConfigFiles = self.userPileupConfigsPerCampaign[campaign.value][:]
358 log.info("Using user provided per-campaign PRW configuration")
359 except KeyError as e:
360 raise KeyError(f"Unconfigured campaign {e} for userPileupConfigsPerCampaign!")
361
362 elif self.userPileupConfigs is not None:
363 toolConfigFiles = self.userPileupConfigs[:]
364 log.info("Using user provided PRW configuration")
365
366 else:
367 if self.useDefaultConfig and self.files is None:
368 raise ValueError("useDefaultConfig requires files to be configured!"
369 " Either pass them as an option or use flags.")
370
371 from PileupReweighting.AutoconfigurePRW import getConfigurationFiles
372 if campaign and campaign is not Campaign.Unknown:
373 toolConfigFiles = getConfigurationFiles(campaign=campaign,
374 files=self.files,
375 useDefaultConfig=self.useDefaultConfig,
376 data_type=config.dataType(),
377 GRLSuffixDict=self.GRLSuffixDict)
379 log.info("Auto-configuring universal/default PRW config")
380 else:
381 log.info("Auto-configuring per-sample PRW config files based on input files")
382 else:
383 log.info("No campaign specified, no PRW config files configured")
384
385
386 # check if user provides per-campaign lumical config list
387 if self.userLumicalcFilesPerCampaign is not None and self.userLumicalcFiles is not None:
388 raise ValueError("Both userLumicalcFiles and userLumicalcFilesPerCampaign specified,"
389 " use only one of the options!")
390 if self.userLumicalcFilesPerCampaign is not None:
391 if not campaign:
392 raise Exception('userLumicalcFilesPerCampaign requires campaign to be configured!')
393 if campaign is Campaign.Unknown:
394 raise Exception('userLumicalcFilesPerCampaign used, but campaign = Unknown!')
395 try:
396 toolLumicalcFiles = self.userLumicalcFilesPerCampaign[campaign.value][:]
397 log.info("Using user-provided per-campaign lumicalc files")
398 except KeyError as e:
399 raise KeyError(f"Unconfigured campaign {e} for userLumicalcFilesPerCampaign!")
400 elif self.userLumicalcFiles is not None:
401 toolLumicalcFiles = self.userLumicalcFiles[:]
402 log.info("Using user-provided lumicalc files")
403 else:
404 if campaign and campaign not in {Campaign.Unknown, Campaign.PhaseII}:
405 from PileupReweighting.AutoconfigurePRW import getLumicalcFiles
406 toolLumicalcFiles = getLumicalcFiles(campaign, self.GRLSuffixDict)
407 log.info("Using auto-configured lumicalc files")
408 else:
409 log.info("No campaign specified, no lumicalc files configured for PRW")
410
411 # Set up the only algorithm of the sequence:
412 if config.geometry() is LHCPeriod.Run4:
413 warnings.warn_explicit(
414 "Pileup reweighting is not yet supported for Run 4 geometry",
415 Run4FallbackWarning, filename="", lineno=0)
416 alg = config.createAlgorithm("CP::EventDecoratorAlg", "EventDecoratorAlg")
417 alg.uint32Decorations = {
418 "RandomRunNumber": config.flags.Input.RunNumbers[0]
419 }
420
421 else:
422 alg = config.createAlgorithm("CP::PileupReweightingAlg", "PileupReweightingAlg")
423 config.addPrivateTool("pileupReweightingTool", "CP::PileupReweightingTool")
424 alg.pileupReweightingTool.ConfigFiles = toolConfigFiles
425 if not toolConfigFiles and config.dataType() is not DataType.Data:
426 log.info("No PRW config files provided. Disabling reweighting")
427 # Setting the weight decoration to the empty string disables the reweighting
428 alg.pileupWeightDecoration = ""
429 else:
430 alg.pileupWeightDecoration = f"PileupWeight{self.postfix}_%SYS%"
431 alg.pileupReweightingTool.LumiCalcFiles = toolLumicalcFiles
432 alg.pileupReweightingTool.UnrepresentedDataWarningThreshold = (
433 self.unrepresentedDataWarningThreshold)
434
435 # pile-up values
436 if not self.alternativeConfig:
438 alg.correctedScaledAverageMuDecoration = "correctedScaledAverageInteractionsPerCrossing"
439 alg.correctedScaledActualMuDecoration = "correctedScaledActualInteractionsPerCrossing"
440 alg.correctedAverageMuDecoration = "correctedUnscaledAverageInteractionsPerCrossing"
441 alg.correctedActualMuDecoration = "correctedUnscaledActualInteractionsPerCrossing"
442
443 eventInfoVar.extend([
444 ("correctedScaledAverageInteractionsPerCrossing", "float"),
445 ("correctedScaledActualInteractionsPerCrossing", "float"),
446 ("correctedUnscaledAverageInteractionsPerCrossing", "float"),
447 ("correctedUnscaledActualInteractionsPerCrossing", "float"),
448 ])
449
450 if campaign is Campaign.MC20a:
451 config.addOutputVar("EventInfo", "correctedScaledAverageInteractionsPerCrossing", "correctedScaledInteractionsPerCrossing", noSys=True, auxType="float")
452 elif campaign >= Campaign.MC20d and config.geometry() is not LHCPeriod.Run4:
453 config.addOutputVar("EventInfo", "correctedScaledActualInteractionsPerCrossing", "correctedScaledInteractionsPerCrossing", noSys=True, auxType="float")
454 else:
455 if campaign is Campaign.MC20a:
456 alg.correctedScaledAverageMuDecoration = "correctedScaledInteractionsPerCrossing"
457 elif campaign >= Campaign.MC20d:
458 alg.correctedScaledActualMuDecoration = "correctedScaledInteractionsPerCrossing"
459 eventInfoVar.extend([
460 ("correctedScaledInteractionsPerCrossing", "float"),
461 ])
462
463 if not self.alternativeConfig:
464 for var_name, var_type in eventInfoVar:
465 config.addOutputVar("EventInfo", var_name, var_name, noSys=True, auxType=var_type)
466
467 if config.dataType() is not DataType.Data and config.geometry() is LHCPeriod.Run2:
468 config.addOutputVar("EventInfo", "beamSpotWeight", "weight_beamspot", noSys=True, auxType="float")
469
470 if config.dataType() is not DataType.Data and toolConfigFiles:
471 config.addOutputVar("EventInfo", f"PileupWeight{self.postfix}_%SYS%",
472 f"weight_pileup{self.postfix}", auxType="float")
473
474
475class GeneratorAnalysisBlock (ConfigBlock):
476 """the ConfigBlock for generator algorithms"""
477
478 def __init__ (self) :
479 super().__init__ ()
480 self.addOption ('saveCutBookkeepers', True, type=bool,
481 info="whether to save the cut bookkeepers information into the "
482 "output file.")
483 self.addOption ('runNumber', None, type=int,
484 info="the MC `runNumber`. If left empty, autoconfigure from the sample metadata.")
485 self.addOption ('cutBookkeepersSystematics', None, type=bool,
486 info="whether to also save the cut bookkeepers systematics. The "
487 "default is `None` (follows the global systematics flag). Set to "
488 "`False` or `True` to override.")
489 self.addOption ('histPattern', None, type=str,
490 info="the histogram name pattern for the cut-bookkeeper histogram names.")
491 self.addOption ('streamName', None, type=str,
492 info="name of the output stream to save the cut bookkeeper in.")
493 self.addOption ('detailedPDFinfo', False, type=bool,
494 info="save the necessary information to run the LHAPDF tool offline.")
495 self.addOption ('doPDFReweighting', False, type=bool,
496 info="perform the PDF reweighting to do the PDF sensitivity studies with the existing sample, intrinsic charm PDFs as the default here. WARNING: the reweighting closure should be validated within analysis (it has been proved to be good for Madgraph, aMC@NLO, Pythia8, Herwig, and Alpgen, but not good for Sherpa and Powheg).")
497 self.addOption ('inPDFName', None, type=str, info="PDF set the input sample was produced with, for use in PDF reweighting")
498 self.addOption ('outPDFName', [
499 "CT14nnloIC/0", "CT14nnloIC/1", "CT14nnloIC/2",
500 "CT18FC/0", "CT18FC/3", "CT18FC/6", "CT18FC/9",
501 "CT18NNLO/0", "CT18XNNLO/0",
502 "NNPDF40_nnlo_pch_as_01180/0", "NNPDF40_nnlo_as_01180/0"
503 ], type=list, info="list of PDF sets to use for PDF reweighting.")
504 self.addOption ('doHFProdFracReweighting', False, type=bool,
505 info="whether to apply HF production fraction reweighting.")
506 self.addOption ('truthParticleContainer', 'TruthParticles', type=str,
507 info="the name of the truth particle container to use for HF production fraction reweighting.")
508
509 def instanceName (self) :
510 """Return the instance name for this block"""
511 return self.streamName or "DEFAULT"
512
513 def makeAlgs (self, config) :
514
515 if config.dataType() is DataType.Data:
516 # there are no generator weights in data!
517 return
518 log = logging.getLogger('GeneratorAnalysis')
519
520 # Setup stream name
521 streamName = config.requestOutputStream(self.streamName)
522
523 if self.runNumber is None:
524 self.runNumber = config.runNumber()
525
526 if self.saveCutBookkeepers and not self.runNumber:
527 raise ValueError ("invalid run number: " + str(self.runNumber))
528
529 # Set up the CutBookkeepers algorithm:
531 alg = config.createAlgorithm('CP::AsgCutBookkeeperAlg', 'CutBookkeeperAlg')
532 alg.RootStreamName = streamName
533 alg.runNumber = self.runNumber
534 if self.cutBookkeepersSystematics is None:
535 alg.enableSystematics = not config.noSystematics()
536 else:
537 alg.enableSystematics = self.cutBookkeepersSystematics
538 if self.histPattern:
539 alg.histPattern = self.histPattern
540 config.addPrivateTool( 'truthWeightTool', 'PMGTools::PMGTruthWeightTool' )
541
542 # Set up the weights algorithm:
543 alg = config.createAlgorithm( 'CP::PMGTruthWeightAlg', 'PMGTruthWeightAlg' )
544 config.addPrivateTool( 'truthWeightTool', 'PMGTools::PMGTruthWeightTool' )
545 alg.decoration = 'generatorWeight_%SYS%'
546 config.addOutputVar ('EventInfo', 'generatorWeight_%SYS%', 'weight_mc', auxType='float')
547
549 alg = config.createAlgorithm( 'CP::PDFinfoAlg', 'PDFinfoAlg', reentrant=True )
550 for var in ["PDFID1","PDFID2","PDGID1","PDGID2","Q","X1","X2","XF1","XF2"]:
551 config.addOutputVar ('EventInfo', var, 'PDFinfo_' + var, noSys=True, auxType='int' if var in ["PDFID1","PDFID2","PDGID1","PDGID2"] else 'float')
552
554 generatorInfo = config.flags.Input.GeneratorsInfo
555 log.info(f"Loaded generator info: {generatorInfo}")
556
557 if not generatorInfo:
558 warnings.warn_explicit("No generator info found.", GeneratorWeightWarning, filename='', lineno=0)
559 elif isinstance(generatorInfo, dict):
560
561 unsupported_generators = {
562 "Sherpa": "PDF reweighting for Sherpa is not proven to be reliable. The reweighting closure should be validated within the analysis.",
563 "Powheg": "PDF reweighting for Powheg is not proven to be reliable. The reweighting closure should be validated within the analysis."
564 }
565
566 # Check for unsupported generators
567 for generator, message in unsupported_generators.items():
568 if generator in generatorInfo:
569 warnings.warn_explicit(
570 message,
571 GeneratorWeightWarning,
572 filename='',
573 lineno=0
574 )
575
576 alg = config.createAlgorithm( 'CP::PDFReweightAlg', 'PDFReweightAlg', reentrant=True )
577
578 if self.inPDFName is None:
579 log.error("Option inPDFName not specified, but is required for PDF reweighting. This means the PDF set the input dataset was generated with is determined as …")
580 else:
581 alg.inPDFName = self.inPDFName
582
583 alg.outPDFName = self.outPDFName
584
585 for pdf_set in self.outPDFName:
586 config.addOutputVar('EventInfo', f'PDFReweightSF_{pdf_set.replace("/", "_")}',
587 f'PDFReweightSF_{pdf_set.replace("/", "_")}', noSys=True, auxType='float')
588
590 generatorInfo = config.flags.Input.GeneratorsInfo
591 log.info(f"Loaded generator info: {generatorInfo}")
592
593 DSID = "000000"
594
595 if not generatorInfo:
596 warnings.warn_explicit(
597 "No generator info found.",
598 GeneratorWeightWarning, filename='', lineno=0)
599 DSID = "000000"
600 elif isinstance(generatorInfo, dict):
601 if "Pythia8" in generatorInfo:
602 DSID = "410470"
603 elif "Sherpa" in generatorInfo and "2.2.8" in generatorInfo["Sherpa"]:
604 DSID = "421152"
605 elif "Sherpa" in generatorInfo and "2.2.10" in generatorInfo["Sherpa"]:
606 DSID = "700122"
607 elif "Sherpa" in generatorInfo and "2.2.11" in generatorInfo["Sherpa"]:
608 warnings.warn_explicit(
609 "HF production fraction reweighting is not configured"
610 " for Sherpa 2.2.11. Using weights for Sherpa 2.2.10"
611 " instead.",
612 GeneratorWeightWarning, filename='', lineno=0)
613 DSID = "700122"
614 elif "Sherpa" in generatorInfo and "2.2.12" in generatorInfo["Sherpa"]:
615 warnings.warn_explicit(
616 "HF production fraction reweighting is not configured"
617 " for Sherpa 2.2.12. Using weights for Sherpa 2.2.10"
618 " instead.",
619 GeneratorWeightWarning, filename='', lineno=0)
620 DSID = "700122"
621 elif "Sherpa" in generatorInfo and "2.2.14" in generatorInfo["Sherpa"]:
622 warnings.warn_explicit(
623 "HF production fraction reweighting is not configured"
624 " for Sherpa 2.2.14. New weights need to be"
625 " calculated.",
626 GeneratorWeightWarning, filename='', lineno=0)
627 DSID = "000000"
628 elif "Sherpa" in generatorInfo and "2.2.1" in generatorInfo["Sherpa"]:
629 DSID = "410250"
630 elif "Herwig7" in generatorInfo and "7.1.3" in generatorInfo["Herwig7"]:
631 DSID = "411233"
632 elif "Herwig7" in generatorInfo and "7.2.1" in generatorInfo["Herwig7"]:
633 DSID = "600666"
634 elif "Herwig7" in generatorInfo and "7." in generatorInfo["Herwig7"]:
635 DSID = "410558"
636 elif "amc@NLO" in generatorInfo:
637 DSID = "410464"
638 else:
639 warnings.warn_explicit(
640 f"HF production fraction reweighting is not configured"
641 f" for this generator: {generatorInfo}."
642 f" New weights need to be calculated.",
643 GeneratorWeightWarning, filename='', lineno=0)
644 DSID = "000000"
645 else:
646 warnings.warn_explicit(
647 "Failed to determine generator from metadata",
648 GeneratorWeightWarning, filename='', lineno=0)
649 DSID = "000000"
650
651 log.info(f"Using HF production fraction weights calculated using DSID {DSID}")
652 if DSID == "000000":
653 warnings.warn_explicit(
654 "HF production fraction reweighting will return dummy"
655 " weights of 1.0",
656 GeneratorWeightWarning, filename='', lineno=0)
657
658 alg = config.createAlgorithm( 'CP::SysTruthWeightAlg', f'SysTruthWeightAlg_{streamName}' )
659 config.addPrivateTool( 'sysTruthWeightTool', 'PMGTools::PMGHFProductionFractionTool' )
660 alg.decoration = 'prodFracWeight_%SYS%'
661 alg.TruthParticleContainer = self.truthParticleContainer
662 alg.sysTruthWeightTool.ShowerGenerator = DSID
663 config.addOutputVar ('EventInfo', 'prodFracWeight_%SYS%', 'weight_HF_prod_frac', auxType='float')
664
665class PtEtaSelectionBlock (ConfigBlock):
666 """the ConfigBlock for a pt-eta selection"""
667
668 def __init__ (self) :
669 super().__init__ ()
670 self.addOption ('containerName', '', type=str,
671 noneAction='error',
672 info="the name of the input container.",
673 meta={'role':'containerRef'})
674 self.addOption ('selectionName', '', type=str,
675 noneAction='error',
676 info="the name of the selection to append this to. If left empty, "
677 "the cuts are applied to every "
678 "object within the container. Specifying a name (e.g. `loose`) "
679 "applies the cut only to those object who also pass that selection.",
680 meta={'role':'selection'})
681 self.addOption ('minPt', None, type=float,
682 info=r"minimum $p_\mathrm{T}$ value to cut on (in MeV).")
683 self.addOption ('maxPt', None, type=float,
684 info=r"maximum $p_\mathrm{T}$ value to cut on (in MeV).")
685 self.addOption ('minEta', None, type=float,
686 info=r"minimum $\vert\eta\vert$ value to cut on.")
687 self.addOption ('maxEta', None, type=float,
688 info=r"maximum $\vert\eta\vert$ value to cut on.")
689 self.addOption ('maxRapidity', None, type=float,
690 info="maximum rapidity value to cut on.")
691 self.addOption ('etaGapLow', None, type=float,
692 info=r"low end of the $\vert\eta\vert$ gap.")
693 self.addOption ('etaGapHigh', None, type=float,
694 info=r"high end of the $\vert\eta\vert$ gap.")
695 self.addOption ('selectionDecoration', None, type=str,
696 info="the name of the decoration to set. If `None`, will be set "
697 "to `selectPtEta` followed by the selection name.")
698 self.addOption ('useClusterEta', False, type=bool,
699 info=r"whether to use the cluster $\eta$ (`etaBE(2)`) instead of the object "
700 r"$\eta$ (for electrons and photons).")
701 self.addOption ('useDressedProperties', False, type=bool,
702 info="whether to use the dressed kinematic properties "
703 "(for truth particles only).")
704
705 def instanceName (self) :
706 """Return the instance name for this block"""
707 return self.containerName + "_" + self.selectionName
708
709 def makeAlgs (self, config) :
710
711 alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'PtEtaSelectionAlg' )
712 config.addPrivateTool( 'selectionTool', 'CP::AsgPtEtaSelectionTool' )
713 if self.minPt is not None :
714 alg.selectionTool.minPt = self.minPt
715 if self.maxPt is not None:
716 alg.selectionTool.maxPt = self.maxPt
717 if self.minEta is not None:
718 alg.selectionTool.minEta = self.minEta
719 if self.maxEta is not None :
720 alg.selectionTool.maxEta = self.maxEta
721 if self.maxRapidity is not None :
722 alg.selectionTool.maxRapidity = self.maxRapidity
723 if self.etaGapLow is not None:
724 alg.selectionTool.etaGapLow = self.etaGapLow
725 if self.etaGapHigh is not None:
726 alg.selectionTool.etaGapHigh = self.etaGapHigh
727 if self.selectionDecoration is None:
728 self.selectionDecoration = 'selectPtEta' + (f'_{self.selectionName}' if self.selectionName else '')
729 alg.selectionTool.useClusterEta = self.useClusterEta
730 alg.selectionTool.useDressedProperties = self.useDressedProperties
731 alg.selectionDecoration = self.selectionDecoration
732 alg.particles = config.readName (self.containerName)
733 alg.preselection = config.getPreselection (self.containerName, '')
734 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration)
735
736
737
738class ObjectCutFlowBlock (ConfigBlock):
739 """the ConfigBlock for an object cutflow"""
740
741 def __init__ (self) :
742 super().__init__ ()
743 self.addOption ('containerName', '', type=str,
744 noneAction='error',
745 info="the name of the input container.",
746 meta={'role':'containerRef'})
747 self.addOption ('selectionName', '', type=str,
748 noneAction='error',
749 info="the name of the selection to perform the cutflow for. If left empty, "
750 "the cutflow is "
751 "performed for every object within the container. Specifying a "
752 "name (e.g. `loose`) generates the cutflow only for those objects "
753 "that also pass that selection.",
754 meta={'role':'selection'})
755 self.addOption ('forceCutSequence', False, type=bool,
756 info="whether to force the cut sequence and not accept objects "
757 "if previous cuts failed.")
758 self.addOption ('streamName', None, type=str,
759 info="name of the output stream to save the cutflow histogram in.")
760
761 def instanceName (self) :
762 """Return the instance name for this block"""
763 return self.containerName + '_' + self.selectionName
764
765 def makeAlgs (self, config) :
766 streamName = config.requestOutputStream(self.streamName)
767
768 alg = config.createAlgorithm( 'CP::ObjectCutFlowHistAlg', 'CutFlowDumperAlg' )
769 alg.RootStreamName = streamName
770 alg.histPattern = 'cflow_' + self.containerName + "_" + self.selectionName + '_%SYS%'
771 alg.selections = config.getSelectionCutFlow (self.containerName, self.selectionName)
772 alg.input = config.readName (self.containerName)
773 alg.histTitle = "Object Cutflow: " + self.containerName + "." + self.selectionName
774 alg.forceCutSequence = self.forceCutSequence
775
776
777class EventCutFlowBlock (ConfigBlock):
778 """the ConfigBlock for an event-level cutflow"""
779
780 def __init__(self):
781 super().__init__()
782 self.addOption('selectionName', '', type=str,
783 noneAction='error',
784 info="the name of the event selection to generate cutflow histograms for. "
785 "If left blank, all selections on EventInfo will be used.",
786 meta={'role':'region'})
787 self.addOption('customSelections', [], type=None,
788 info="explicit list of selection decorations to use for the cutflow. "
789 "If provided, takes precedence over selectionName.")
790 self.addOption('cutFlowHistograms', True, type=bool,
791 info="whether to generate cutflow histograms for the selection cuts.")
792 self.addOption('cutFlowHistogramsWithSystematics', True, type=bool,
793 info="whether to generate cutflow histograms for the selection cuts "
794 "when running with systematics.")
795 self.addOption ('streamName', None, type=str,
796 info="name of the output stream to save the cut bookkeeper in.")
797
798 def instanceName(self):
799 return 'EventInfo_' + self.selectionName
800
801 def makeAlgs(self, config):
802 if not self.cutFlowHistograms:
803 return
804
805 if not config.noSystematics() and not self.cutFlowHistogramsWithSystematics:
806 return
807
808 # Setup stream name
809 streamName = config.requestOutputStream(self.streamName)
810
811 postfix = ('_' + self.selectionName) if self.selectionName else ''
812
813 alg = config.createAlgorithm('CP::EventCutFlowHistAlg', 'CutFlowDumperAlg')
814 alg.RootStreamName = streamName
815 alg.histPattern = 'cflow_EventInfo' + postfix + '_%SYS%'
816 alg.eventInfo = config.readName('EventInfo')
817 alg.histTitle = 'Event Cutflow: EventInfo.' + self.selectionName
818
819 if isinstance(self.customSelections, list) and len(self.customSelections) > 0:
820 # user provides a hardcoded list of selections
821 alg.selections = self.customSelections
822 elif self.selectionName:
823 # resolve selectionName to the list of cuts registered by EventSelectionConfig
824 alg.selections = config.getEventCutFlow(self.selectionName)
825 else:
826 # fallback: get all available selections from EventInfo
827 alg.selections = config.getSelectionCutFlow('EventInfo', '')
828
829 alg.selections = [sel + ',as_char' for sel in alg.selections]
830
831class OutputThinningBlock (ConfigBlock):
832 """the ConfigBlock for output thinning"""
833
834 def __init__ (self) :
835 super().__init__ ()
836 self.setBlockName('Thinning')
837 self.addOption ('containerName', '', type=str,
838 noneAction='error',
839 info="the name of the input container.",
840 meta={'role':'containerRef'})
841 self.addOption ('postfix', '', type=str,
842 info="a postfix to apply to decorations and algorithm names. "
843 "Typically not needed here.")
844 self.addOption ('selection', '', type=str,
845 info="the name of an optional selection decoration to use.",
846 meta={'role':'selection'})
847 self.addOption ('selectionName', '', type=str,
848 info="the name of the selection to append this to. If left empty, "
849 "the cuts are applied to every "
850 "object within the container. Specifying a name (e.g. `loose`) "
851 "applies the cut only to those object who also pass that selection.",
852 meta={'role':'selection'})
853 self.addOption ('outputName', None, type=str,
854 info="an optional name for the output container.",
855 meta={'role':'container'})
856 self.addOption ('deepCopy', False, type=bool,
857 info="run a deep copy of the container.")
858 self.addOption ('sortPt', False, type=bool,
859 info=r"whether to sort objects in $p_\mathrm{T}$.")
860 self.addOption ('noUniformSelection', False, type=bool,
861 info="do not run the union over all selections.")
862 self.addOption ('containerType', None, type=str,
863 info="the type of the container to thin. Only needed in AthenaMT, and only if subsequent code has a data dependency on the created container under that type.")
864
865 def instanceName (self) :
866 """Return the instance name for this block"""
867 return self.containerName + '_' + self.selectionName + self.postfix
868
869 def makeAlgs (self, config) :
870
871 postfix = self.postfix
872 if postfix != '' and postfix[0] != '_' :
873 postfix = '_' + postfix
874
875 selection = config.getFullSelection (self.containerName, self.selectionName)
876 if selection == '' :
877 selection = self.selection
878 elif self.selection != '' :
879 selection = selection + '&&' + self.selection
880
881 if selection != '' and not self.noUniformSelection :
882 alg = config.createAlgorithm( 'CP::AsgUnionSelectionAlg', 'UnionSelectionAlg')
883 alg.preselection = selection
884 alg.particles = config.readName (self.containerName)
885 alg.selectionDecoration = 'outputSelect' + postfix
886 config.addSelection (self.containerName, alg.selectionDecoration, selection)
887 selection = 'outputSelect' + postfix
888
889 alg = config.createAlgorithm( 'CP::AsgViewFromSelectionAlg', 'DeepCopyAlg' )
890 alg.input = config.readName (self.containerName)
891 if self.outputName is not None :
892 alg.output = self.outputName + '_%SYS%'
893 config.addOutputContainer (self.containerName, self.outputName)
894 else :
895 alg.output = config.copyName (self.containerName)
896 if self.containerType is not None :
897 alg.outputType = self.containerType
898 if selection != '' :
899 alg.selection = [selection]
900 else :
901 alg.selection = []
902 alg.deepCopy = self.deepCopy
903 if self.sortPt and not config.noSystematics() :
904 raise ValueError ("Sorting by pt is not supported with systematics")
905 alg.sortPt = self.sortPt
906
907
908class IFFLeptonDecorationBlock (ConfigBlock):
909 """the ConfigBlock for the IFF classification of leptons"""
910
911 def __init__ (self) :
912 super().__init__()
913 self.addOption ('containerName', '', type=str,
914 noneAction='error',
915 info="the name of the input electron or muon container.",
916 meta={'role':'containerRef'})
917 self.addOption ('separateChargeFlipElectrons', True, type=bool,
918 info="whether to consider charged-flip electrons as a separate class.")
919 self.addOption ('separateConversionTypes', False, type=bool,
920 info="whether to split electrons from photon conversions (`PromptPhotonConversion`, 5) "
921 "into material (`MaterialConversion`, 50) and internal (`InternalConversion`, 51) "
922 "conversions. Cases that cannot be resolved stay in class 5.")
923 self.addOption ('decoration', 'IFFClass_%SYS%', type=str,
924 info="the name of the decoration set by the IFF "
925 "`TruthClassificationTool`.")
926 self.addOption ('useDerivationClassification', False, type=bool,
927 info="whether to switch the inputs to the IFF tools from the reconstruction-step "
928 "ones to the derivation-step ones, which might be more up to date.")
929 # Always skip on data
930 self.setOptionValue('skipOnData', True)
931
932 def instanceName (self) :
933 """Return the instance name for this block"""
934 return self.containerName
935
936 def makeAlgs (self, config) :
937 particles = config.readName(self.containerName)
938
939 alg = config.createAlgorithm( 'CP::AsgClassificationDecorationAlg', 'IFFClassifierAlg' )
940 # the IFF classification tool
941 config.addPrivateTool( 'tool', 'TruthClassificationTool')
942 # label charge-flipped electrons as such
943 alg.tool.separateChargeFlipElectrons = self.separateChargeFlipElectrons
944 alg.tool.separateConversionTypes = self.separateConversionTypes
945 alg.tool.useTruthParticleDecorations = self.useDerivationClassification
946 alg.decoration = self.decoration
947 alg.particles = particles
948
949 # write the decoration only once to the output
950 config.addOutputVar(self.containerName, alg.decoration, alg.decoration.split("_%SYS%")[0], noSys=True, auxType="int")
951
952
953class MCTCLeptonDecorationBlock (ConfigBlock):
954
955 def __init__ (self) :
956 super().__init__ ()
957
958 self.addOption ("containerName", '', type=str,
959 noneAction='error',
960 info="the input lepton container, with a possible selection, "
961 "in the format `container` or `container.selection`.",
962 meta={'role':'containerRef'})
963 self.addOption ("prefix", 'MCTC_', type=str,
964 info="the prefix of the decorations based on the MCTC "
965 "classification.")
966 # Always skip on data
967 self.setOptionValue('skipOnData', True)
968
969 def instanceName (self) :
970 """Return the instance name for this block"""
971 return self.containerName
972
973 def makeAlgs (self, config) :
974 particles, selection = config.readNameAndSelection(self.containerName)
975
976 alg = config.createAlgorithm ("CP::MCTCDecorationAlg", "MCTCDecorationAlg")
977 alg.particles = particles
978 alg.preselection = selection
979 alg.affectingSystematicsFilter = '.*'
980 config.addOutputVar (self.containerName, "MCTC_isPrompt", f"{self.prefix}isPrompt", noSys=True, auxType="int")
981 config.addOutputVar (self.containerName, "MCTC_fromHadron", f"{self.prefix}fromHadron", noSys=True, auxType="int")
982 config.addOutputVar (self.containerName, "MCTC_fromBSM", f"{self.prefix}fromBSM", noSys=True, auxType="int")
983 config.addOutputVar (self.containerName, "MCTC_fromTau", f"{self.prefix}fromTau", noSys=True, auxType="int")
984
985
986class PerEventSFBlock (ConfigBlock):
987 """the ConfigBlock for the AsgEventScaleFactorAlg"""
988
989 def __init__ (self):
990 super().__init__()
991 self.addOption('algoName', None, type=str,
992 info="unique name given to the underlying algorithm computing the "
993 "per-event scale factors.")
994 self.addOption('particles', '', type=str,
995 info="the input object container, with a possible selection, in the "
996 "format `container` or `container.selection`.",
997 meta={'role':'containerRef'})
998 self.addOption('objectSF', '', type=str,
999 info="the name of the per-object SF decoration to be used.")
1000 self.addOption('eventSF', '', type=str,
1001 info="the name of the per-event SF decoration.")
1002
1003 def instanceName (self) :
1004 """Return the instance name for this block"""
1005 return self.particles + '_' + self.objectSF + '_' + self.eventSF
1006
1007 def makeAlgs(self, config):
1008 if config.dataType() is DataType.Data:
1009 return
1010 particles, selection = config.readNameAndSelection(self.particles)
1011 alg = config.createAlgorithm('CP::AsgEventScaleFactorAlg', self.algoName if self.algoName else 'AsgEventScaleFactorAlg')
1012 alg.particles = particles
1013 alg.preselection = selection
1014 alg.scaleFactorInputDecoration = self.objectSF
1015 alg.scaleFactorOutputDecoration = self.eventSF
1016
1017 config.addOutputVar('EventInfo', alg.scaleFactorOutputDecoration,
1018 alg.scaleFactorOutputDecoration.split("_%SYS%")[0], auxType="float")
1019
1020
1021class SelectionDecorationBlock (ConfigBlock):
1022 """the ConfigBlock to add selection decoration to a container"""
1023
1024 def __init__ (self) :
1025 super().__init__ ()
1026 # TODO: add info string
1027 self.addOption('containers', [], type=list,
1028 noneAction='error',
1029 info="")
1030
1031 def instanceName (self) :
1032 """Return the instance name for this block"""
1033 return ''
1034
1035 def makeAlgs(self, config):
1036 for container in self.containers:
1037 originContainerName = config.getOutputContainerOrigin(container)
1038 selectionNames = config.getSelectionNames(originContainerName)
1039 for selectionName in selectionNames:
1040 # skip default selection
1041 if selectionName == '':
1042 continue
1043 alg = config.createAlgorithm(
1044 'CP::AsgSelectionAlg',
1045 f'SelectionDecoration_{originContainerName}_{selectionName}')
1046 selectionDecoration = f'baselineSelection_{selectionName}_%SYS%'
1047 alg.selectionDecoration = f'{selectionDecoration},as_char'
1048 alg.particles = config.readName (originContainerName)
1049 alg.preselection = config.getFullSelection (originContainerName,
1050 selectionName)
1051 config.addOutputVar(
1052 originContainerName, selectionDecoration, selectionName, auxType="char")
STL class.
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:132