Exemplo n.º 1
0
def generate_mergeable_collection_name(bare_collection_name,
                                       mergeable_collection_suffix,
                                       merger_input_property):
    """
    Generates and returns a collection name that is also registered to
    the ISF CollectionMerger algorithm.

    :param bare_collection_name: name of the collection if no merging
        is taking place.
    :param mergeable_collection_suffix: suffix to the collection in
        case merging is taking place.
    :param merger_input_property: name of the Input* property in the
        CollectionMerger algorithm to add the mergeable collection to.
    """
    if simFlags.ISFRun() and ISF_Flags.HITSMergingRequired():
        mergeable_collection = '{bare}{suffix}'.format(
            bare=bare_collection_name,
            suffix=mergeable_collection_suffix
        )

        collection_merger = getAlgorithm('ISF_CollectionMerger')
        input_attribute_name = 'Input{merger_input_property}'.format(
            merger_input_property=merger_input_property)
        merger_input_collections = getattr(collection_merger,
                                           input_attribute_name)
        merger_input_collections.append(mergeable_collection)
    else:
        mergeable_collection = bare_collection_name

    return mergeable_collection
Exemplo n.º 2
0
def generate_mergeable_collection_name(bare_collection_name,
                                       mergeable_collection_suffix,
                                       merger_input_property, region):
    """
    Generates and returns a collection name that is also registered to
    the ISF CollectionMerger algorithm.

    :param bare_collection_name: name of the collection if no merging
        is taking place.
    :param mergeable_collection_suffix: suffix to the collection in
        case merging is taking place.
    :param merger_input_property: name of the Input* property in the
        CollectionMerger algorithm to add the mergeable collection to.
    """
    hardscatterSG = "OriginalEvent_SG+"
    if simFlags.ISFRun() and ISF_Flags.HITSMergingRequired.get_Value().get(
            region, True):
        mergeable_collection = '{bare}{suffix}'.format(
            bare=bare_collection_name, suffix=mergeable_collection_suffix)

        collection_merger = getAlgorithm('ISF_CollectionMerger')
        input_attribute_name = 'Input{merger_input_property}'.format(
            merger_input_property=merger_input_property)
        merger_input_collections = getattr(collection_merger,
                                           input_attribute_name)
        merger_input_collections.append(mergeable_collection)
    elif athenaCommonFlags.DoFullChain() and DetFlags.pileup.any_on():
        mergeable_collection = hardscatterSG + bare_collection_name
    else:
        mergeable_collection = bare_collection_name

    return mergeable_collection
Exemplo n.º 3
0
def getAthenaStackingActionTool(name='G4UA::AthenaStackingActionTool',
                                **kwargs):
    from G4AtlasApps.SimFlags import simFlags
    ## Killing neutrinos
    if "ATLAS" in simFlags.SimLayout():
        kwargs.setdefault('KillAllNeutrinos', True)
    ## Neutron Russian Roulette
    if hasattr(simFlags, 'ApplyNRR') and simFlags.ApplyNRR.statusOn and \
       hasattr(simFlags, 'NRRThreshold') and simFlags.NRRThreshold.statusOn and \
       hasattr(simFlags, 'NRRWeight') and simFlags.NRRWeight.statusOn:
        if simFlags.CalibrationRun.statusOn:
            raise NotImplementedError(
                "Neutron Russian Roulette should not be used in Calibration Runs."
            )
        kwargs.setdefault('ApplyNRR', simFlags.ApplyNRR.get_Value())
        kwargs.setdefault('NRRThreshold', simFlags.NRRThreshold.get_Value())
        kwargs.setdefault('NRRWeight', simFlags.NRRWeight.get_Value())
    ## Photon Russian Roulette
    if hasattr(simFlags, 'ApplyPRR') and simFlags.ApplyPRR.statusOn and \
       hasattr(simFlags, 'PRRThreshold') and simFlags.PRRThreshold.statusOn and \
       hasattr(simFlags, 'PRRWeight') and simFlags.PRRWeight.statusOn:
        if simFlags.CalibrationRun.statusOn:
            raise NotImplementedError(
                "Photon Russian Roulette should not be used in Calibration Runs."
            )
        kwargs.setdefault('ApplyPRR', simFlags.ApplyPRR.get_Value())
        kwargs.setdefault('PRRThreshold', simFlags.PRRThreshold.get_Value())
        kwargs.setdefault('PRRWeight', simFlags.PRRWeight.get_Value())
    kwargs.setdefault('IsISFJob', simFlags.ISFRun())
    kwargs.setdefault('UseDebugAction',
                      simFlags.DebugStackingAction.get_Value())
    return CfgMgr.G4UA__AthenaStackingActionTool(name, **kwargs)
Exemplo n.º 4
0
def getBeamEffectsAlg(name="BeamEffectsAlg", **kwargs):
    from AthenaCommon.DetFlags import DetFlags
    from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
    if athenaCommonFlags.DoFullChain() and DetFlags.pileup.any_on():
        kwargs.setdefault('InputMcEventCollection',
                          'OriginalEvent_SG+GEN_EVENT')  # For Fast Chain
    else:
        kwargs.setdefault('InputMcEventCollection', 'GEN_EVENT')
    kwargs.setdefault('OutputMcEventCollection', 'BeamTruthEvent')
    from G4AtlasApps.SimFlags import simFlags
    kwargs.setdefault(
        "ISFRun", simFlags.ISFRun()
    )  #FIXME Temporary property so that we don't change the output in the initial switch to this code.
    manipulatorList = ['GenEventValidityChecker']
    if hasattr(simFlags, 'Eta') or hasattr(
            simFlags, 'LArTB_H1TableYPos'):  #FIXME Ugly hack
        # TestBeam do nothing else for now
        pass
    else:
        if simFlags.VertexTimeOffset.statusOn and simFlags.VertexTimeOffset.get_Value(
        ) != 0:
            raise RuntimeError('Vertex time offset should not be used!')
        from AthenaCommon.BeamFlags import jobproperties
        if not (simFlags.CavernBG.get_Value() == 'Read'
                or jobproperties.Beam.beamType() == "cosmics"):
            manipulatorList += ["GenEventVertexPositioner"]
        if simFlags.BeamEffectOptions.statusOn:
            manipulatorList += ["GenEventBeamEffectBooster"]
    kwargs.setdefault("GenEventManipulators", manipulatorList)
    return CfgMgr.Simulation__BeamEffectsAlg(name, **kwargs)
Exemplo n.º 5
0
def getAthenaStackingActionTool(name='G4UA::AthenaStackingActionTool',
                                **kwargs):
    from G4AtlasApps.SimFlags import simFlags
    if "ATLAS" in simFlags.SimLayout():
        kwargs.setdefault('KillAllNeutrinos', True)
    kwargs.setdefault('IsISFJob', simFlags.ISFRun())
    return CfgMgr.G4UA__AthenaStackingActionTool(name, **kwargs)