def GetFlowMomentTools(key, mod_key): mtools = [] #only compute no flow moment if subtraction actually used flow if len(HIJetFlags.HarmonicsForSubtraction()) > 0: null_mod_tool = GetNullModulator() mtools += [ MakeSubtractionTool(key, moment_name='NoVn', momentOnly=True, modulator=null_mod_tool) ] if not HIJetFlags.ExtraFlowMoments(): return mtools #only add these tools if requested by package flag for n in [2]: #if flow subtraction only used one harmonic #then extra moment for that harmonic is redundant, skip it if len(HIJetFlags.HarmonicsForSubtraction()) == 1: if n == HIJetFlags.HarmonicsForSubtraction()[0]: continue mod_tool = MakeModulatorTool(mod_key, harmonics=[n]) subtr_tool = MakeSubtractionTool(key, moment_name='V%dOnly' % n, momentOnly=True, modulator=mod_tool) mtools += [subtr_tool] return mtools
def MakeModulatorTool(mod_key, **kwargs): harmonics = [] if 'harmonics' in kwargs.keys(): harmonics = kwargs['harmonics'] else: harmonics = HIJetFlags.HarmonicsForSubtraction() tname = "Modulator_%s" % BuildHarmonicName(mod_key, harmonics=harmonics) if 'suffix' in kwargs.keys(): tname += '_%s' % kwargs['suffix'] if (len(harmonics) == 0): return GetNullModulator() if hasattr(jtm, tname): return getattr(jtm, tname) HIUEModulatorTool = CompFactory.HIUEModulatorTool mod = HIUEModulatorTool(tname) mod.EventShapeKey = mod_key for n in [2, 3, 4]: val = (n in harmonics) attr_name = 'DoV%d' % n setattr(mod, attr_name, val) jtm.add(mod) return mod