25def PMGTruthWeightAlgCfg(flags, systematicsRegex='.*'):
26 """Decorate systematically varied generator weights to
27 'EventInfo', with a human-readable name.
28
29 With systematicsRegex set to 'None', do not add the
30 SystematicsSvc.
31
32 """
33 ca = ComponentAccumulator()
34
35
36 if systematicsRegex is not None:
37 ca.addService(
38 CompFactory.CP.SystematicsSvc(
39 name="SystematicsSvc",
40 sigmaRecommended=1,
41 systematicsRegex=systematicsRegex,
42 )
43 )
44 ca.merge(MetaDataSvcCfg(flags))
45 ca.addEventAlgo(
46 CompFactory.CP.PMGTruthWeightAlg(
47 name="PMGTruthWeightAlg",
48 truthWeightTool=CompFactory.PMGTools.PMGTruthWeightTool(
49 name="PMGTruthWeightTool"
50 ),
51 decoration = 'generatorWeight_%SYS%',
52 )
53 )
54 return ca