Exemple #1
0
def PunchThroughToolCfg(flags, name="ISF_PunchThroughTool", **kwargs):

    from BarcodeServices.BarcodeServicesConfigNew import BarcodeSvcCfg
    from SubDetectorEnvelopes.SubDetectorEnvelopesConfigNew import EnvelopeDefSvcCfg

    acc = RNG(flags.Random.Engine)
    kwargs.setdefault("RandomNumberService", acc.getService("AthRNGSvc"))
    kwargs.setdefault("RandomStreamName", "AthRNGSvc")  # TODO check
    kwargs.setdefault("FilenameLookupTable",
                      "CaloPunchThroughParametrisation.root")
    kwargs.setdefault("PunchThroughInitiators", [211])
    kwargs.setdefault("PunchThroughParticles", [2212, 211, 22, 11, 13])
    kwargs.setdefault("DoAntiParticles", [False, True, False, True, True])
    kwargs.setdefault("CorrelatedParticle", [211, 2212, 11, 22, 0])
    kwargs.setdefault("FullCorrelationEnergy",
                      [100000., 100000., 100000., 100000., 0.])
    kwargs.setdefault("MinEnergy", [938.3, 135.6, 50., 50., 105.7])
    kwargs.setdefault("MaxNumParticles", [-1, -1, -1, -1, -1])
    kwargs.setdefault("EnergyFactor", [1., 1., 1., 1., 1.])
    acc_bar = BarcodeSvcCfg(flags)
    kwargs.setdefault("BarcodeSvc", acc_bar.getPrimary())
    acc.merge(acc_bar)
    acc.merge(EnvelopeDefSvcCfg(flags))
    kwargs.setdefault("EnvelopeDefSvc",
                      acc.getService("AtlasGeometry_EnvelopeDefSvc"))
    kwargs.setdefault("BeamPipeRadius", 500.)
    acc.setPrivateTools(CompFactory.ISF.PunchThroughTool(name, **kwargs))
    return acc
Exemple #2
0
def fatrasG4HadIntProcessorCfg(flags,
                               name="ISF_FatrasG4HadIntProcessor",
                               **kwargs):
    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    result = ComponentAccumulator()

    result.merge(RNG(flags.Random.Engine))
    kwargs.setdefault("RandomNumberService", result.getService("AthRNGSvc"))
    kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)

    result.merge(ParticleBrokerSvcCfg(flags))
    kwargs.setdefault("ParticleBroker",
                      result.getService("ISF_ParticleBrokerSvc"))

    acc = TruthServiceCfg(flags)
    kwargs.setdefault("TruthRecordSvc", acc.getPrimary())
    result.merge(acc)

    result.merge(fatrasPhysicsValidationToolCfg(flags))
    phys_val_cfg = acc.getPublicTool('ISF_FatrasPhysicsValidationTool')
    kwargs.setdefault("PhysicsValidationTool", phys_val_cfg)

    kwargs.setdefault("ValidationMode", flags.Sim.ISF.ValidationMode)
    kwargs.setdefault("MomentumCut", flags.Sim.Fatras.MomCutOffSec)

    iFatras__G4HadIntProcessor = CompFactory.iFatras.G4HadIntProcessor
    result.addPublicTool(iFatras__G4HadIntProcessor(name=name, **kwargs))

    return result
Exemple #3
0
def fatrasHitCreatorPixelCfg(flags,
                             name="ISF_FatrasHitCreatorPixel",
                             **kwargs):
    """Return ISF_FatrasHitCreatorPixel configured with ComponentAccumulator"""
    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    result = ComponentAccumulator()

    hits_collection_name = generate_mergeable_collection_name(
        bare_collection_name="PixelHits",
        mergeable_collection_suffix="_Fatras",
        merger_input_property="PixelHits")

    result.merge(RNG(flags.Random.Engine))
    kwargs.setdefault("RandomNumberService", result.getService("AthRNGSvc"))
    kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)
    kwargs.setdefault("IdHelperName", 'PixelID')
    kwargs.setdefault("CollectionName", hits_collection_name)

    # NOTE   why it is here ?
    # FastHitConvertTool = CompFactory.FastHitConvertTool
    kwargs.setdefault("UseConditionsTool", False)

    iFatras__HitCreatorSilicon = CompFactory.iFatras.HitCreatorSilicon
    result.addPublicTool(iFatras__HitCreatorSilicon(name=name, **kwargs))
    return result
Exemple #4
0
def fatrasConversionCreatorCfg(flags,
                               name="ISF_FatrasConversionCreator",
                               **kwargs):

    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    result = ComponentAccumulator()

    result.merge(RNG(flags.Random.Engine))
    kwargs.setdefault("RandomNumberService", result.getService("AthRNGSvc"))
    kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)

    result.merge(ParticleBrokerSvcCfg(flags))
    kwargs.setdefault("ParticleBroker",
                      result.getService("ISF_ParticleBrokerSvc"))

    acc = fatrasPhysicsValidationToolCfg(flags)
    phys_val_cfg = acc.getPublicTool('ISF_FatrasPhysicsValidationTool')
    result.merge(acc)
    kwargs.setdefault("PhysicsValidationTool", phys_val_cfg)

    kwargs.setdefault("PhysicsProcessCode",
                      14)  # TODO: to be taken from central definition
    kwargs.setdefault("ValidationMode", flags.Sim.ISF.ValidationMode)

    iFatras__PhotonConversionTool = CompFactory.iFatras.PhotonConversionTool
    result.addPublicTool(iFatras__PhotonConversionTool(name=name, **kwargs))

    return result
Exemple #5
0
def TileHitVecToCntToolCfg(flags, **kwargs):
    """Return component accumulator with configured private Tile hit vector to container tool

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    """

    kwargs.setdefault('name', 'TileHitVecToCntTool')
    kwargs.setdefault('RndmEvtOverlay', flags.Detector.OverlayTile)
    kwargs.setdefault('OnlyUseContainerName', not flags.Detector.OverlayTile)

    acc = ComponentAccumulator()

    from TileConditions.TileInfoLoaderConfig import TileInfoLoaderCfg
    acc.merge(TileInfoLoaderCfg(flags))

    from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
    acc.merge(TileCablingSvcCfg(flags))

    kwargs.setdefault('TileHitVectors', ['TileHitVec', 'MBTSHits'])
    kwargs.setdefault('TileHitContainer', 'TileHitCnt')

    kwargs.setdefault('DoHSTruthReconstruction',
                      flags.Digitization.DoDigiTruth)
    if kwargs['DoHSTruthReconstruction']:
        kwargs.setdefault('TileHitContainer_DigiHSTruth',
                          'TileHitCnt_DigiHSTruth')
    else:
        kwargs.setdefault('TileHitContainer_DigiHSTruth', '')

    if 'RndmSvc' not in kwargs:
        from RngComps.RandomServices import RNG
        acc.merge(RNG(flags.Random.Engine))
        kwargs['RndmSvc'] = acc.getService('AthRNGSvc')

    if kwargs['RndmEvtOverlay']:
        kwargs.setdefault('PileUp', False)
    else:
        kwargs.setdefault('PileUp', flags.Digitization.Pileup)

    if kwargs['PileUp']:
        PileUpMergeSvc = CompFactory.PileUpMergeSvc
        acc.addService(PileUpMergeSvc())

    if flags.Beam.Type == 'cosmics':
        CosmicTriggerTimeTool = CompFactory.CosmicTriggerTimeTool
        kwargs.setdefault('TriggerTimeTool', CosmicTriggerTimeTool())
        kwargs.setdefault('HitTimeFlag', 2)
        kwargs.setdefault('UseTriggerTime', True)

    if flags.Digitization.DoXingByXingPileUp:  # PileUpTool approach
        kwargs.setdefault("FirstXing", getTileFirstXing())
        kwargs.setdefault("LastXing", getTileLastXing())

    TileHitVecToCntTool = CompFactory.TileHitVecToCntTool
    acc.setPrivateTools(TileHitVecToCntTool(**kwargs))

    return acc
Exemple #6
0
def fatrasSimToolCfg(flags, name="ISF_FatrasSimTool", **kwargs):
    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    result = ComponentAccumulator()

    if "SimHitCreatorID" not in kwargs:
        acc = fatrasSimHitCreatorIDCfg(flags)
        id_cfg = acc.getPublicTool('ISF_FatrasSimHitCreatorID')
        result.merge(acc)
        kwargs.setdefault("SimHitCreatorID", id_cfg)

    acc = fatrasSimHitCreatorMSCfg(flags)
    ms_cfg = acc.getPublicTool('ISF_FatrasSimHitCreatorMS')
    result.merge(acc)
    kwargs.setdefault("SimHitCreatorMS", ms_cfg)

    acc = fatrasParticleDecayHelperCfg(flags)
    pdhelper_cfg = acc.getPublicTool('ISF_FatrasParticleDecayHelper')
    result.merge(acc)
    kwargs.setdefault("ParticleDecayHelper", pdhelper_cfg)

    acc = ParticleHelperCfg(flags)
    part_helper_cfg = acc.getPublicTool('ISF_ParticleHelper')
    result.merge(acc)
    kwargs.setdefault("ParticleHelper", part_helper_cfg)

    acc = fatrasKinematicFilterCfg(flags)
    kin_filter_cfg = acc.getPublicTool('ISF_FatrasKinematicFilter')
    result.merge(acc)
    kwargs.setdefault("TrackFilter", kin_filter_cfg)
    kwargs.setdefault("NeutralFilter", kin_filter_cfg)
    kwargs.setdefault("PhotonFilter", kin_filter_cfg)

    acc = fatrasExtrapolatorCfg(flags)
    extrapolator_cfg = acc.getPublicTool('ISF_FatrasExtrapolator')
    kwargs.setdefault("Extrapolator", extrapolator_cfg)
    result.merge(acc)

    acc = fatrasPhysicsValidationToolCfg(flags)
    phys_val_cfg = acc.getPublicTool('ISF_FatrasPhysicsValidationTool')
    result.merge(acc)
    kwargs.setdefault("PhysicsValidationTool", phys_val_cfg)

    acc = fatrasProcessSamplingToolCfg(flags)
    proc_samp_cfg = acc.getPublicTool('ISF_FatrasProcessSamplingTool')
    result.merge(acc)
    kwargs.setdefault("ProcessSamplingTool", proc_samp_cfg)

    kwargs.setdefault("OutputLevel", flags.Exec.OutputLevel)
    kwargs.setdefault("ValidationOutput", flags.Sim.ISF.ValidationMode)

    result.merge(RNG(flags.Random.Engine))
    kwargs.setdefault("RandomNumberService", result.getService("AthRNGSvc"))

    iFatras__TransportTool = CompFactory.iFatras.TransportTool
    result.addPublicTool(iFatras__TransportTool(name=name, **kwargs))
    return result
Exemple #7
0
def FastShowerCellBuilderToolBaseCfg(flags, name, **kwargs):

    acc = RNG(flags.Random.Engine)
    acc.merge(
        addFolders(flags,
                   "/GLOBAL/AtlfastII/FastCaloSimParam",
                   "GLOBAL_OFL",
                   tag="FastCaloSim_v2"))

    localFileNameList = AdditionalParticleParametrizationFileNames()
    localFileNameList.insert(0, "L1_L2_egamma_corr.config20.root")
    kwargs.setdefault("AdditionalParticleParametrizationFileNames",
                      localFileNameList)

    kwargs.setdefault("RandomService", acc.getService("AthRNGSvc"))
    kwargs.setdefault("RandomStreamName", "AthRNGSvc")
    kwargs.setdefault("DoSimulWithInnerDetectorTruthOnly", True)
    kwargs.setdefault("ID_cut_off_r", [1150])
    kwargs.setdefault("ID_cut_off_z", [3490])
    kwargs.setdefault("DoSimulWithInnerDetectorV14TruthCuts", True)
    kwargs.setdefault("DoNewEnergyEtaSelection", True)
    kwargs.setdefault("DoEnergyInterpolation", True)
    kwargs.setdefault("use_Ekin_for_depositions", True)
    kwargs.setdefault("McLocation", flags.Sim.FastShower.InputCollection)
    kwargs.setdefault("ParticleParametrizationFileName", "")
    kwargs.setdefault("Extrapolator", NITimedExtrapolatorCfg(flags))
    # New kwarg from old FastCaloSimFactory
    kwargs.setdefault("CaloEntrance", TrkDetFlags.InDetContainerName())

    #######################################################################################################
    #theFastShowerCellBuilderTool.Invisibles=[12, 14, 16, 1000022]
    #########################################################################################################

    acc.setPrivateTools(CompFactory.FastShowerCellBuilderTool(name, **kwargs))
    return acc
Exemple #8
0
def fatrasSimHitCreatorMSCfg(flags,
                             name="ISF_FatrasSimHitCreatorMS",
                             **kwargs):
    """Return ISF_FatrasSimHitCreatorMS configured with ComponentAccumulator"""

    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    result = ComponentAccumulator()

    mergeable_collection_suffix = "_Fatras"

    mdt_hits_collection_name = generate_mergeable_collection_name(
        bare_collection_name="MDT_Hits",
        mergeable_collection_suffix=mergeable_collection_suffix,
        merger_input_property="MDTHits")

    rpc_hits_collection_name = generate_mergeable_collection_name(
        bare_collection_name="RPC_Hits",
        mergeable_collection_suffix=mergeable_collection_suffix,
        merger_input_property="RPCHits")

    tgc_hits_collection_name = generate_mergeable_collection_name(
        bare_collection_name="TGC_Hits",
        mergeable_collection_suffix=mergeable_collection_suffix,
        merger_input_property="TGCHits")

    csc_hits_collection_name = generate_mergeable_collection_name(
        bare_collection_name="CSC_Hits",
        mergeable_collection_suffix=mergeable_collection_suffix,
        merger_input_property="CSCHits")
    result.merge(RNG(flags.Random.Engine))
    kwargs.setdefault("RandomNumberService", result.getService("AthRNGSvc"))
    kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)
    #####
    # Extrapolator from ACTS to be added TODO
    # kwargs.setdefault("Extrapolator" , getPublicTool('ISF_FatrasExtrapolator'))
    #####
    kwargs.setdefault("MDTCollectionName", mdt_hits_collection_name)
    kwargs.setdefault("RPCCollectionName", rpc_hits_collection_name)
    kwargs.setdefault("TGCCollectionName", tgc_hits_collection_name)
    kwargs.setdefault("CSCCollectionName", csc_hits_collection_name)

    Muon__MuonTGMeasurementTool = CompFactory.Muon.MuonTGMeasurementTool
    muon_tgmeasurement_tool = Muon__MuonTGMeasurementTool(
        name='MuonTGMeasurementTool', UseDSManager=True)
    result.addPublicTool(muon_tgmeasurement_tool)
    kwargs.setdefault("MeasurementTool", muon_tgmeasurement_tool)

    iFatras__SimHitCreatorMS = CompFactory.iFatras.SimHitCreatorMS
    result.addPublicTool(iFatras__SimHitCreatorMS(name=name, **kwargs))
    return result
Exemple #9
0
def TileHitToTTL1Cfg(flags, **kwargs):
    """Return component accumulator with configured Tile hits to TTL1 algorithm

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    """

    kwargs.setdefault('name', 'TileHitToTTL1')
    kwargs.setdefault('TileHitContainer', 'TileHitCnt')

    acc = TileHitVecToCntCfg(flags)

    from TileConditions.TileInfoLoaderConfig import TileInfoLoaderCfg
    acc.merge(TileInfoLoaderCfg(flags))

    from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
    acc.merge(TileCablingSvcCfg(flags))

    if 'RndmSvc' not in kwargs:
        from RngComps.RandomServices import RNG
        acc.merge(RNG(flags.Random.Engine))
        kwargs['RndmSvc'] = acc.getService('AthRNGSvc')

    if 'TileBadChanTool' not in kwargs:
        from TileConditions.TileBadChannelsConfig import TileBadChanToolCfg
        badChannelsTool = acc.popToolsAndMerge(TileBadChanToolCfg(flags))
        kwargs['TileBadChanTool'] = badChannelsTool

    if 'TileCondToolEmscale' not in kwargs:
        from TileConditions.TileEMScaleConfig import TileCondToolEmscaleCfg
        kwargs['TileCondToolEmscale'] = acc.popToolsAndMerge(
            TileCondToolEmscaleCfg(flags))

    if flags.Digitization.PileUpPremixing:
        kwargs.setdefault('TileTTL1Container',
                          flags.Overlay.BkgPrefix + 'TileTTL1Cnt')
        kwargs.setdefault('TileMBTSTTL1Container',
                          flags.Overlay.BkgPrefix + 'TileTTL1MBTS')
    elif flags.Detector.OverlayTile:
        kwargs.setdefault('TileTTL1Container',
                          flags.Overlay.SigPrefix + 'TileTTL1Cnt')
        kwargs.setdefault('TileMBTSTTL1Container',
                          flags.Overlay.SigPrefix + 'TileTTL1MBTS')
    else:
        kwargs.setdefault('TileTTL1Container', 'TileTTL1Cnt')
        kwargs.setdefault('TileMBTSTTL1Container', 'TileTTL1MBTS')

    TileHitToTTL1 = CompFactory.TileHitToTTL1
    acc.addEventAlgo(TileHitToTTL1(**kwargs), primary=True)

    return acc
Exemple #10
0
def makeVertexBeamCondPositioner(ConfigFlags,
                                 name="VertexBeamCondPositioner",
                                 **kwargs):
    """Return a conditional (? todo) vertex positioner tool"""
    from RngComps.RandomServices import RNG

    acc = ComponentAccumulator()

    acc.merge(RNG(engine=ConfigFlags.Random.Engine, name="AthRNGSvc"))
    kwargs.setdefault('RandomSvc', acc.getService("AthRNGSvc"))

    from BeamSpotConditions.BeamSpotConditionsConfig import BeamSpotCondAlgCfg
    acc.merge(BeamSpotCondAlgCfg(ConfigFlags))

    acc.setPrivateTools(Simulation__VertexBeamCondPositioner(name, **kwargs))
    return acc
Exemple #11
0
def fatrasProcessSamplingToolCfg(flags,
                                 name="ISF_FatrasProcessSamplingTool",
                                 **kwargs):
    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    result = ComponentAccumulator()

    result.merge(RNG(flags.Random.Engine))
    kwargs.setdefault("RandomNumberService", result.getService("AthRNGSvc"))

    # truth record
    acc = TruthServiceCfg(flags)
    kwargs.setdefault("TruthRecordSvc", acc.getPrimary())
    result.merge(acc)

    # decays
    acc = fatrasParticleDecayHelperCfg(flags)
    pd_helper_cfg = acc.getPublicTool('ISF_FatrasParticleDecayHelper')
    result.merge(acc)
    kwargs.setdefault("ParticleDecayHelper", pd_helper_cfg)

    # photon conversion
    acc = fatrasConversionCreatorCfg(flags)
    ph_conv_cfg = acc.getPublicTool('ISF_FatrasConversionCreator')
    result.merge(acc)
    kwargs.setdefault("PhotonConversionTool", ph_conv_cfg)

    # Hadronic interactions
    acc = fatrasG4HadIntProcessorCfg(flags)
    g4had_proc_cfg = acc.getPublicTool('ISF_FatrasG4HadIntProcessor')
    result.merge(acc)
    kwargs.setdefault("HadronicInteractionProcessor", g4had_proc_cfg)
    kwargs.setdefault("HadronicInteraction", True)

    # Validation Tool
    acc = fatrasPhysicsValidationToolCfg(flags)
    phys_val_cfg = acc.getPublicTool('ISF_FatrasPhysicsValidationTool')
    result.merge(acc)
    kwargs.setdefault("PhysicsValidationTool", phys_val_cfg)
    kwargs.setdefault("ValidationMode", flags.Sim.ISF.ValidationMode)

    iFatras__ProcessSamplingTool = CompFactory.iFatras.ProcessSamplingTool
    result.addPublicTool(iFatras__ProcessSamplingTool(name=name, **kwargs))

    return result
Exemple #12
0
def fatrasMultipleScatteringSamplerGeneralMixtureCfg(
        flags, name="ISF_MultipleScatteringSamplerGeneralMixture", **kwargs):
    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    result = ComponentAccumulator()

    result.merge(RNG(flags.Random.Engine))
    kwargs.setdefault("RandomNumberService", result.getService("AthRNGSvc"))
    kwargs.setdefault("RandomStreamName",
                      flags.Sim.Fatras.TrkExRandomStreamName)

    Trk__MultipleScatteringSamplerGeneralMixture = CompFactory.Trk.MultipleScatteringSamplerGeneralMixture
    result.addPublicTool(
        Trk__MultipleScatteringSamplerGeneralMixture(name=name, **kwargs))

    return result
Exemple #13
0
def fatrasEnergyLossSamplerBetheHeitlerCfg(
        flags, name="ISF_FatrasEnergyLossSamplerBetheHeitler", **kwargs):
    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    result = ComponentAccumulator()

    result.merge(RNG(flags.Random.Engine))
    kwargs.setdefault("RandomNumberService", result.getService("AthRNGSvc"))
    kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)

    kwargs.setdefault("ScaleFactor", flags.Sim.Fatras.BetheHeitlerScale)

    iFatras__EnergyLossSamplerBetheHeitler = CompFactory.iFatras.EnergyLossSamplerBetheHeitler
    result.addPublicTool(
        iFatras__EnergyLossSamplerBetheHeitler(name=name, **kwargs))

    return result
Exemple #14
0
def fatrasEnergyLossUpdatorCfg(flags,
                               name="ISF_FatrasEnergyLossUpdator",
                               **kwargs):
    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    result = ComponentAccumulator()

    result.merge(RNG(flags.Random.Engine))
    kwargs.setdefault("RandomNumberService", result.getService("AthRNGSvc"))
    kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)

    kwargs.setdefault("UsePDG_EnergyLossFormula", True)
    kwargs.setdefault("EnergyLossDistribution", 2)

    iFatras__McEnergyLossUpdator = CompFactory.iFatras.McEnergyLossUpdator
    result.addPublicTool(iFatras__McEnergyLossUpdator(name=name, **kwargs))

    return result
Exemple #15
0
def fatrasHitCreatorTRTCfg(flags, name="ISF_FatrasHitCreatorTRT", **kwargs):
    """Return ISF_FatrasHitCreatorTRT configured with ComponentAccumulator"""
    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    result = ComponentAccumulator()

    hits_collection_name = generate_mergeable_collection_name(
        bare_collection_name="TRTUncompressedHits",
        mergeable_collection_suffix="_Fatras",
        merger_input_property="TRTUncompressedHits")
    result.merge(RNG(flags.Random.Engine))
    kwargs.setdefault("RandomNumberService", result.getService("AthRNGSvc"))
    kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)
    kwargs.setdefault("CollectionName", hits_collection_name)

    iFatras__HitCreatorTRT = CompFactory.iFatras.HitCreatorTRT
    result.addPublicTool(iFatras__HitCreatorTRT(name=name, **kwargs))
    return result
Exemple #16
0
def FastCaloSimV2ToolCfg(flags, name="ISF_FastCaloSimV2Tool", **kwargs):
    acc = ComponentAccumulator()
    kwargs.setdefault("CaloCellsOutputName", flags.Sim.FastCalo.CaloCellsName)
    kwargs.setdefault("CaloCellMakerTools_setup",
                      [EmptyCellBuilderToolCfg(flags)])
    kwargs.setdefault("CaloCellMakerTools_release", [
        CaloCellContainerFCSFinalizerToolCfg(flags),
        acc.popToolsAndMerge(FastHitConvertToolCfg(flags))
    ])
    kwargs.setdefault("FastCaloSimCaloExtrapolation",
                      FastCaloSimCaloExtrapolationCfg(flags))
    kwargs.setdefault("ParamSvc",
                      acc.popToolsAndMerge(FastCaloSimV2ParamSvcCfg(flags)))
    acc.merge(RNG(flags.Random.Engine))
    kwargs.setdefault("RandomSvc", acc.getService("AthRNGSvc"))
    kwargs.setdefault("RandomStream", "AthRNGSvc")  # TODO check
    kwargs.setdefault("PunchThroughTool",
                      acc.popToolsAndMerge(PunchThroughToolCfg(flags)))

    acc.setPrivateTools(CompFactory.ISF.FastCaloSimV2Tool(name, **kwargs))
    return acc
Exemple #17
0
def fatrasParticleDecayHelperCfg(flags,
                                 name="ISF_FatrasParticleDecayHelper",
                                 **kwargs):
    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    result = ComponentAccumulator()

    result.merge(RNG(flags.Random.Engine))
    kwargs.setdefault("RandomNumberService", result.getService("AthRNGSvc"))
    kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)
    kwargs.setdefault("G4RandomStreamName",
                      flags.Sim.Fatras.G4RandomStreamName)
    kwargs.setdefault("ValidationMode", flags.Sim.ISF.ValidationMode)

    result.merge(ParticleBrokerSvcCfg(flags))
    kwargs.setdefault("ParticleBroker",
                      result.getService("ISF_ParticleBrokerSvc"))

    acc = fatrasPdgG4ParticleCfg(flags)
    pdg_g4part_cfg = acc.getPublicTool('ISF_FatrasPdgG4Particle')
    result.merge(acc)
    kwargs.setdefault("PDGToG4ParticleConverter", pdg_g4part_cfg)

    acc = fatrasPhysicsValidationToolCfg(flags)
    phys_val_cfg = acc.getPublicTool('ISF_FatrasPhysicsValidationTool')
    result.merge(acc)
    kwargs.setdefault("PhysicsValidationTool", phys_val_cfg)

    acc = G4RunManagerHelperCfg(flags)
    g4run_man_cfg = acc.getPublicTool('ISF_G4RunManagerHelper')
    result.merge(acc)
    kwargs.setdefault("G4RunManagerHelper", g4run_man_cfg)

    iFatras__G4ParticleDecayHelper = CompFactory.iFatras.G4ParticleDecayHelper
    result.addPublicTool(iFatras__G4ParticleDecayHelper(name=name, **kwargs))

    return result
Exemple #18
0
def fatrasParametricHadIntProcessorCfg(
        flags, name="ISF_FatrasParametricHadIntProcessor", **kwargs):
    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    result = ComponentAccumulator()

    result.merge(RNG(flags.Random.Engine))
    kwargs.setdefault("RandomNumberService", result.getService("AthRNGSvc"))
    kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)

    result.merge(ParticleBrokerSvcCfg(flags))
    kwargs.setdefault("ParticleBroker",
                      result.getService("ISF_ParticleBrokerSvc"))

    acc = TruthServiceCfg(flags)
    kwargs.setdefault("TruthRecordSvc", acc.getPrimary())
    result.merge(acc)

    kwargs.setdefault("HadronicInteractionScaleFactor",
                      flags.Sim.Fatras.HadronIntProb)
    kwargs.setdefault("MinimumHadronicInitialEnergy",
                      flags.Sim.Fatras.MomCutOffSec)
    kwargs.setdefault("MinimumHadronicOutEnergy",
                      flags.Sim.Fatras.MomCutOffSec)
    kwargs.setdefault("HadronicInteractionValidation", False)
    kwargs.setdefault("PhysicsProcessCode",
                      121)  # TODO: to be taken from central definition

    result.merge(fatrasPhysicsValidationToolCfg(flags))
    phys_val_cfg = acc.getPublicTool('ISF_FatrasPhysicsValidationTool')
    kwargs.setdefault("PhysicsValidationTool", phys_val_cfg)
    kwargs.setdefault("ValidationMode", flags.Sim.ISF.ValidationMode)

    iFatras__HadIntProcessorParametric = CompFactory.iFatras.HadIntProcessorParametric
    result.setPrivateTools(iFatras__HadIntProcessorParametric(name, **kwargs))

    return result
Exemple #19
0
def DNNCaloSimSvcCfg(flags, name="ISF_DNNCaloSimSvc", **kwargs):
    acc = ComponentAccumulator()
    kwargs.setdefault("CaloCellsOutputName", flags.Sim.FastCalo.CaloCellsName)
    kwargs.setdefault("CaloCellMakerTools_setup",
                      [EmptyCellBuilderToolCfg(flags)])
    kwargs.setdefault("CaloCellMakerTools_release", [
        CaloCellContainerFinalizerToolCfg(flags),
        acc.popToolsAndMerge(FastHitConvertToolCfg(flags))
    ])  #DR needed ?
    kwargs.setdefault("ParamsInputFilename",
                      flags.Sim.FastCalo.ParamsInputFilename)
    kwargs.setdefault("FastCaloSimCaloExtrapolation",
                      FastCaloSimCaloExtrapolationCfg(flags))

    # FIXME not migrated. Remove or replace
    # register the FastCaloSim random number streams
    #from G4AtlasApps.SimFlags import simFlags
    #if not simFlags.RandomSeedList.checkForExistingSeed(ISF_FastCaloSimFlags.RandomStreamName()):
    #simFlags.RandomSeedList.addSeed( ISF_FastCaloSimFlags.RandomStreamName(), 98346412, 12461240)
    #kwargs.setdefault("RandomStream", ISF_FastCaloSimFlags.RandomStreamName())
    acc.merge(RNG(flags.Random.Engine))
    kwargs.setdefault("RandomSvc", acc.getService("AthRNGSvc"))
    acc.addService(CompFactory.ISF.DNNCaloSimSvc(name, **kwargs))
    return acc
Exemple #20
0
def fatrasMaterialUpdatorCfg(flags,
                             name="ISF_FatrasMaterialUpdator",
                             **kwargs):
    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    result = ComponentAccumulator()

    result.merge(RNG(flags.Random.Engine))
    kwargs.setdefault("RandomNumberService", result.getService("AthRNGSvc"))
    kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)

    # Geometry Svc
    acc = TrackingGeometrySvcCfg(flags)
    kwargs.setdefault("TrackingGeometrySvc", acc.getPrimary())
    result.merge(acc)

    # hadronic interactions
    kwargs.setdefault("HadronicInteraction", True)
    acc = fatrasG4HadIntProcessorCfg(flags)
    g4had_proc_cfg = acc.getPublicTool('ISF_FatrasG4HadIntProcessor')
    kwargs.setdefault("HadronicInteractionProcessor", g4had_proc_cfg)
    result.merge(acc)

    # energy loss
    kwargs.setdefault("EnergyLoss", True)
    acc = fatrasEnergyLossUpdatorCfg(flags)
    eloss_updator = acc.getPublicTool('ISF_FatrasEnergyLossUpdator')
    kwargs.setdefault("EnergyLossUpdator", eloss_updator)
    result.merge(acc)

    # mutiple scattering
    kwargs.setdefault("MultipleScattering", True)
    acc = fatrasMultipleScatteringUpdatorCfg(flags)
    multi_scattering_updator = acc.getPublicTool(
        'ISF_FatrasMultipleScatteringUpdator')
    kwargs.setdefault("MultipleScatteringUpdator", multi_scattering_updator)
    result.merge(acc)

    # photon conversion
    acc = fatrasConversionCreatorCfg(flags)
    ph_conv_cfg = acc.getPublicTool('ISF_FatrasConversionCreator')
    result.merge(acc)
    kwargs.setdefault("PhotonConversionTool", ph_conv_cfg)

    # the validation output
    kwargs.setdefault("ValidationMode", flags.Sim.ISF.ValidationMode)
    kwargs.setdefault("BremPhotonValidation", False)
    kwargs.setdefault("EnergyDepositValidation", False)

    kwargs.setdefault("MomentumCut", flags.Sim.Fatras.MomCutOffSec)
    kwargs.setdefault("MinimumBremPhotonMomentum",
                      flags.Sim.Fatras.MomCutOffSec)

    acc = fatrasPhysicsValidationToolCfg(flags)
    phys_val_cfg = acc.getPublicTool('ISF_FatrasPhysicsValidationTool')
    result.merge(acc)
    kwargs.setdefault("PhysicsValidationTool", phys_val_cfg)

    acc = fatrasProcessSamplingToolCfg(flags)
    proc_samp_cfg = acc.getPublicTool('ISF_FatrasProcessSamplingTool')
    result.merge(acc)
    kwargs.setdefault("ProcessSamplingTool", proc_samp_cfg)

    acc = fatrasParticleDecayHelperCfg(flags)
    pdhelper_cfg = acc.getPublicTool('ISF_FatrasParticleDecayHelper')
    result.merge(acc)
    kwargs.setdefault("ParticleDecayHelper", pdhelper_cfg)

    # MCTruth Process Code
    kwargs.setdefault("BremProcessCode",
                      3)  # TODO: to be taken from central definition
    acc = TrackingGeometrySvcCfg(flags)
    kwargs.setdefault("TrackingGeometrySvc", acc.getPrimary())
    result.merge(acc)

    iFatras__McMaterialEffectsUpdator = CompFactory.iFatras.McMaterialEffectsUpdator
    result.addPublicTool(iFatras__McMaterialEffectsUpdator(name=name,
                                                           **kwargs))

    return result
Exemple #21
0
def fatrasMaterialEffectsEngineCfg(flags,
                                   name="ISF_FatrasMaterialEffectsEngine",
                                   **kwargs):
    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    result = ComponentAccumulator()

    result.merge(RNG(flags.Random.Engine))
    kwargs.setdefault("RandomNumberService", result.getService("AthRNGSvc"))
    kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)

    result.merge(ParticleBrokerSvcCfg(flags))
    kwargs.setdefault("ParticleBroker",
                      result.getService("ISF_ParticleBrokerSvc"))

    acc = TruthServiceCfg(flags)
    kwargs.setdefault("TruthRecordSvc", acc.getPrimary())
    result.merge(acc)

    result.merge(fatrasProcessSamplingToolCfg(flags))
    kwargs.setdefault("ProcessSamplingTool",
                      result.getPublicTool("ISF_FatrasProcessSamplingTool"))

    result.merge(fatrasParticleDecayHelperCfg(flags))
    kwargs.setdefault("ParticleDecayHelper",
                      result.getPublicTool("ISF_FatrasParticleDecayHelper"))

    # energy loss
    result.merge(fatrasEnergyLossUpdatorCfg(flags))
    kwargs.setdefault("EnergyLossSampler",
                      result.getPublicTool("ISF_FatrasEnergyLossUpdator"))
    kwargs.setdefault("EnergyLoss", True)

    result.merge(fatrasEnergyLossSamplerBetheHeitlerCfg(flags))
    tool = result.getPublicTool("ISF_FatrasEnergyLossSamplerBetheHeitler")
    kwargs.setdefault("ElectronEnergyLossSampler", tool)
    kwargs.setdefault("UseElectronSampler", True)
    kwargs.setdefault("CreateBremPhotons", True)

    # multiple scattering
    result.merge(fatrasMultipleScatteringSamplerHighlandCfg(flags))
    tool = result.getPublicTool("ISF_MultipleScatteringSamplerHighland")
    kwargs.setdefault("MultipleScatteringSampler", tool)
    kwargs.setdefault("MultipleScattering", True)

    # the properties given throuth the JobProperties interface
    kwargs.setdefault("MomentumCut", flags.Sim.Fatras.MomCutOffSec)
    kwargs.setdefault("MinimumBremPhotonMomentum",
                      flags.Sim.Fatras.MomCutOffSec)

    # MCTruth Process Code
    kwargs.setdefault("BremProcessCode",
                      3)  # TODO: to be taken from central definition

    # the validation output
    result.merge(fatrasPhysicsValidationToolCfg(flags))
    tool = acc.getPublicTool('ISF_FatrasPhysicsValidationTool')
    kwargs.setdefault("PhysicsValidationTool", tool)
    kwargs.setdefault("ValidationMode", flags.Sim.ISF.ValidationMode)

    kwargs.setdefault("OutputPrefix", "[McME] - ")
    kwargs.setdefault("OutputPostfix", " - ")
    kwargs.setdefault("OutputLevel", flags.Exec.OutputLevel)

    iFatras__McMaterialEffectsEngine = CompFactory.iFatras.McMaterialEffectsEngine
    result.setPublicTool(iFatras__McMaterialEffectsEngine(name, **kwargs))

    return result
Exemple #22
0
def TilePulseForTileMuonReceiverCfg(flags, **kwargs):
    """Return component accumulator with configured Tile muon receiver algorithm

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    """

    kwargs.setdefault('name', 'TilePulseForTileMuonReceiver')
    kwargs.setdefault('TileHitContainer', 'TileHitCnt')
    kwargs.setdefault('MuonReceiverRawChannelContainer', 'MuRcvRawChCnt')
    kwargs.setdefault('MaskBadChannels', False)
    kwargs.setdefault('UseCoolPulseShapes', True)
    kwargs.setdefault('UseCoolPedestal', False)

    acc = TileHitVecToCntCfg(flags)

    from TileConditions.TileInfoLoaderConfig import TileInfoLoaderCfg
    acc.merge(TileInfoLoaderCfg(flags))
    infoLoader = acc.getService('TileInfoLoader')
    pedestal = infoLoader._descriptors['MuRcvPed'].default

    from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
    acc.merge(TileCablingSvcCfg(flags))

    if 'RndmSvc' not in kwargs:
        from RngComps.RandomServices import RNG
        acc.merge(RNG(flags.Random.Engine))
        kwargs['RndmSvc'] = acc.getService('AthRNGSvc')

    if 'TileCondToolNoiseSample' not in kwargs:
        from TileConditions.TileSampleNoiseConfig import TileCondToolNoiseSampleCfg
        kwargs['TileCondToolNoiseSample'] = acc.popToolsAndMerge(
            TileCondToolNoiseSampleCfg(flags))

    if 'TileCondToolEmscale' not in kwargs:
        from TileConditions.TileEMScaleConfig import TileCondToolEmscaleCfg
        kwargs['TileCondToolEmscale'] = acc.popToolsAndMerge(
            TileCondToolEmscaleCfg(flags))

    if kwargs['MaskBadChannels']:
        if 'TileBadChanTool' not in kwargs:
            from TileConditions.TileBadChannelsConfig import TileBadChanToolCfg
            badChannelsTool = acc.popToolsAndMerge(TileBadChanToolCfg(flags))
            kwargs['TileBadChanTool'] = badChannelsTool
    else:
        kwargs['TileBadChanTool'] = None

    if 'TileCondToolPulseShape' not in kwargs:
        from TileConditions.TilePulseShapeConfig import TileCondToolMuRcvPulseShapeCfg
        pulseShapeTool = acc.popToolsAndMerge(
            TileCondToolMuRcvPulseShapeCfg(flags))
        if kwargs['UseCoolPulseShapes']:
            kwargs['TileCondToolPulseShape'] = pulseShapeTool
        else:
            kwargs['TileCondToolPulseShape'] = None
    else:
        pulseShapeTool = kwargs['TileCondToolPulseShape']

    if 'TileRawChannelBuilderMF' not in kwargs:
        from TileConditions.TileOFCConfig import TileCondToolOfcCfg
        ofcTool = acc.popToolsAndMerge(
            TileCondToolOfcCfg(flags,
                               OptFilterDeltaCorrelation=True,
                               TileCondToolPulseShape=pulseShapeTool))

        from TileRecUtils.TileRawChannelBuilderMFConfig import TileRawChannelBuilderMFCfg
        rawChanBuilder = acc.popToolsAndMerge(
            TileRawChannelBuilderMFCfg(flags,
                                       MF=1,
                                       PedestalMode=0,
                                       DefaultPedestal=pedestal,
                                       TileCondToolOfcOnFly=ofcTool,
                                       TileCondToolOfc=ofcTool,
                                       TileRawChannelContainer=""))
        kwargs['TileRawChannelBuilderMF'] = rawChanBuilder

    kwargs.setdefault('IntegerDigits', not flags.Digitization.PileUpPremixing)

    if flags.Digitization.PileUpPremixing:
        kwargs.setdefault('MuonReceiverDigitsContainer',
                          flags.Overlay.BkgPrefix + 'MuRcvDigitsCnt')
    else:
        kwargs.setdefault('MuonReceiverDigitsContainer', 'MuRcvDigitsCnt')

    TilePulseForTileMuonReceiver = CompFactory.TilePulseForTileMuonReceiver
    acc.addEventAlgo(TilePulseForTileMuonReceiver(**kwargs), primary=True)

    return acc
Exemple #23
0
def TileDigitsMakerCfg(flags, **kwargs):
    """Return component accumulator with configured Tile digits maker algorithm

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    Keyword arguments:
        name -- name of TileDigitsMaker algorithm. Defaults to TileDigitsMaker.
        UseCoolPulseShapes -- flag to use pulse shape from database. Defaults to True.
        RndmEvtOverlay -- flag to add PileUp or noise by overlaying random events.
                          Defaults to Detector.OverlayTile flag.
        MaskBadChannels -- flag to mask channels tagged bad. Defaults to False.
    """

    kwargs.setdefault('name', 'TileDigitsMaker')
    kwargs.setdefault('UseCoolPulseShapes', True)
    kwargs.setdefault('MaskBadChannels', False)
    kwargs.setdefault('RndmEvtOverlay', flags.Detector.OverlayTile)
    kwargs.setdefault('OnlyUseContainerName', not flags.Detector.OverlayTile)

    acc = TileHitVecToCntCfg(flags)

    from TileConditions.TileInfoLoaderConfig import TileInfoLoaderCfg
    infoLoaderAcc = TileInfoLoaderCfg(flags)
    infoLoader = infoLoaderAcc.getPrimary()
    acc.merge(infoLoaderAcc)

    infoLoaderProperties = infoLoader._properties.items()

    if 'TileNoise' in infoLoaderProperties:
        tileNoise = infoLoaderProperties['TileNoise']
    else:
        tileNoise = infoLoader._descriptors['TileNoise'].default

    if 'TileCoherNoise' in infoLoaderProperties:
        tileCoherNoise = infoLoaderProperties['TileCoherNoise']
    else:
        tileCoherNoise = infoLoader._descriptors['TileCoherNoise'].default

    from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
    acc.merge(TileCablingSvcCfg(flags))

    if 'TileCondToolNoiseSample' not in kwargs:
        from TileConditions.TileSampleNoiseConfig import TileCondToolNoiseSampleCfg
        kwargs['TileCondToolNoiseSample'] = acc.popToolsAndMerge(
            TileCondToolNoiseSampleCfg(flags))

    if 'TileCondToolEmscale' not in kwargs:
        from TileConditions.TileEMScaleConfig import TileCondToolEmscaleCfg
        kwargs['TileCondToolEmscale'] = acc.popToolsAndMerge(
            TileCondToolEmscaleCfg(flags))

    if kwargs['RndmEvtOverlay']:
        tileNoise = False
        tileCoherNoise = False

        if flags.Overlay.DataOverlay:
            from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
            acc.merge(
                ByteStreamReadCfg(
                    flags,
                    type_names=[
                        'TileDigitsContainer/' + flags.Overlay.BkgPrefix +
                        'TileDigitsCnt', 'TileRawChannelContainer/' +
                        flags.Overlay.BkgPrefix + 'TileRawChannelCnt'
                    ]))

        from TileRecUtils.TileDQstatusConfig import TileDQstatusAlgCfg
        acc.merge(TileDQstatusAlgCfg(flags))

        kwargs[
            'InputTileDigitContainer'] = flags.Overlay.BkgPrefix + 'TileDigitsCnt'
        kwargs['TileDQstatus'] = 'TileDQstatus'

    if tileNoise or tileCoherNoise or kwargs['RndmEvtOverlay']:
        if 'RndmSvc' not in kwargs:
            from RngComps.RandomServices import RNG
            acc.merge(RNG(flags.Random.Engine))
            kwargs['RndmSvc'] = acc.getService('AthRNGSvc')
    else:
        kwargs['RndmSvc'] = None

    if kwargs['UseCoolPulseShapes']:
        if 'TileCondToolPulseShape' not in kwargs:
            from TileConditions.TilePulseShapeConfig import TileCondToolPulseShapeCfg
            pulseShapeTool = acc.popToolsAndMerge(
                TileCondToolPulseShapeCfg(flags))
            kwargs['TileCondToolPulseShape'] = pulseShapeTool
    else:
        kwargs['TileCondToolPulseShape'] = None

    if kwargs['MaskBadChannels'] or kwargs['RndmEvtOverlay']:
        if 'TileBadChanTool' not in kwargs:
            from TileConditions.TileBadChannelsConfig import TileBadChanToolCfg
            badChannelsTool = acc.popToolsAndMerge(TileBadChanToolCfg(flags))
            kwargs['TileBadChanTool'] = badChannelsTool
    else:
        kwargs['TileBadChanTool'] = None

    if flags.Digitization.PileUpPremixing:
        kwargs.setdefault('TileDigitsContainer',
                          flags.Overlay.BkgPrefix + 'TileDigitsCnt')
    else:
        kwargs.setdefault('TileDigitsContainer', 'TileDigitsCnt')

    kwargs.setdefault('DoHSTruthReconstruction',
                      flags.Digitization.DoDigiTruth)
    if kwargs['DoHSTruthReconstruction']:
        kwargs.setdefault('TileHitContainer_DigiHSTruth',
                          'TileHitCnt_DigiHSTruth')
        kwargs.setdefault('TileDigitsContainer_DigiHSTruth',
                          'TileDigitsCnt_DigiHSTruth')
    else:
        kwargs.setdefault('TileHitContainer_DigiHSTruth', '')
        kwargs.setdefault('TileDigitsContainer_DigiHSTruth', '')

    kwargs.setdefault('IntegerDigits', not flags.Digitization.PileUpPremixing)

    TileDigitsMaker = CompFactory.TileDigitsMaker
    digitsMaker = TileDigitsMaker(**kwargs)

    acc.addEventAlgo(digitsMaker, primary=True)

    return acc
Exemple #24
0
def G4AtlasAlgBasicCfg(ConfigFlags, name="G4AtlasAlg", **kwargs):
    """Return ComponentAccumulator configured for Atlas G4 simulation, without output"""
    # wihout output
    result = DetectorGeometrySvcCfg(ConfigFlags)
    kwargs.setdefault("DetGeoSvc", result.getService("DetectorGeometrySvc"))

    kwargs.setdefault("InputTruthCollection",
                      "BeamTruthEvent")  #tocheck -are these string inputs?
    kwargs.setdefault("OutputTruthCollection", "TruthEvent")
    ## Killing neutrinos

    ## Don"t drop the GeoModel
    kwargs.setdefault("ReleaseGeoModel", ConfigFlags.Sim.ReleaseGeoModel)

    ## Record the particle flux during the simulation
    kwargs.setdefault("RecordFlux", ConfigFlags.Sim.RecordFlux)

    if ConfigFlags.Sim.FlagAbortedEvents:
        ## default false
        kwargs.setdefault("FlagAbortedEvents",
                          ConfigFlags.Sim.FlagAbortedEvents)
        if ConfigFlags.Sim.FlagAbortedEvents and ConfigFlags.Sim.KillAbortedEvents:
            print(
                "WARNING When G4AtlasAlg.FlagAbortedEvents is True G4AtlasAlg.KillAbortedEvents should be False. Setting G4AtlasAlg.KillAbortedEvents = False now."
            )
            kwargs.setdefault("KillAbortedEvents", False)

    ## default true
    kwargs.setdefault("KillAbortedEvents", ConfigFlags.Sim.KillAbortedEvents)

    from RngComps.RandomServices import RNG
    result.merge(RNG(ConfigFlags.Random.Engine, name="AthRNGSvc"))
    kwargs.setdefault("AtRndmGenSvc", result.getService("AthRNGSvc"))

    kwargs.setdefault("RandomGenerator", "athena")

    # Multi-threading settinggs
    #is_hive = (concurrencyProps.ConcurrencyFlags.NumThreads() > 0)
    is_hive = ConfigFlags.Concurrency.NumThreads > 0
    kwargs.setdefault("MultiThreading", is_hive)

    accMCTruth = MC15aPlusTruthServiceCfg(ConfigFlags)
    result.merge(accMCTruth)
    kwargs.setdefault("TruthRecordService",
                      result.getService("ISF_MC15aPlusTruthService"))
    #kwargs.setdefault("TruthRecordService", ConfigFlags.Sim.TruthStrategy) # TODO need to have manual override (simFlags.TruthStrategy.TruthServiceName())

    accGeoID = GeoIDSvcCfg(ConfigFlags)
    result.merge(accGeoID)
    kwargs.setdefault("GeoIDSvc", result.getService("ISF_GeoIDSvc"))

    #input converter
    accInputConverter = InputConverterCfg(ConfigFlags)
    result.merge(accInputConverter)
    kwargs.setdefault("InputConverter",
                      result.getService("ISF_InputConverter"))

    #sensitive detector master tool
    accSensitiveDetector = SensitiveDetectorMasterToolCfg(ConfigFlags)
    result.merge(accSensitiveDetector)
    kwargs.setdefault(
        "SenDetMasterTool", result.getPublicTool(
            "SensitiveDetectorMasterTool"))  #NOTE - is still a public tool

    #fast simulation master tool
    accFastSimulation = FastSimulationMasterToolCfg(ConfigFlags)
    result.merge(accFastSimulation)
    kwargs.setdefault(
        "FastSimMasterTool", result.getPublicTool(
            "FastSimulationMasterTool"))  # NOTE - is still a public tool

    #Write MetaData container
    result.merge(writeSimulationParametersMetadata(ConfigFlags))

    #User action services (Slow...)
    result.merge(UserActionSvcCfg(ConfigFlags))
    kwargs.setdefault("UserActionSvc",
                      result.getService("G4UA::UserActionSvc"))

    #PhysicsListSvc
    result.merge(PhysicsListSvcCfg(ConfigFlags))
    kwargs.setdefault("PhysicsListSvc", result.getService("PhysicsListSvc"))

    ## G4AtlasAlg verbosities (available domains = Navigator, Propagator, Tracking, Stepping, Stacking, Event)
    ## Set stepper verbose = 1 if the Athena logging level is <= DEBUG
    # TODO: Why does it complain that G4AtlasAlgConf.G4AtlasAlg has no "Verbosities" object? Fix.
    # FIXME GaudiConfig2 seems to fail to distinguish an empty dict {} from None
    verbosities = dict(foo="bar")
    #from AthenaCommon.AppMgr import ServiceMgr
    #if ServiceMgr.MessageSvc.OutputLevel <= 2:
    #    verbosities["Tracking"]="1"
    #    print verbosities
    kwargs.setdefault("Verbosities", verbosities)

    # Set commands for the G4AtlasAlg
    kwargs.setdefault("G4Commands", ConfigFlags.Sim.G4Commands)

    result.addEventAlgo(CompFactory.G4AtlasAlg(name, **kwargs))

    return result
Exemple #25
0
def Geant4ToolCfg(flags, name="ISF_Geant4Tool", **kwargs):
    acc = RNG(flags.Random.Engine)
    kwargs.setdefault("RandomNumberService", acc.getService("AthRNGSvc"))

    acc.merge(DetectorGeometrySvcCfg(flags))
    kwargs.setdefault("DetGeoSvc", acc.getService("DetectorGeometrySvc"))

    acc.merge(InputConverterCfg(flags))
    kwargs.setdefault("InputConverter", acc.getService("ISF_InputConverter"))

    acc.merge(ISFUserActionSvcCfg(flags))
    kwargs.setdefault("UserActionSvc",
                      acc.getService("G4UA::ISFUserActionSvc"))
    kwargs.setdefault("RecordFlux", flags.Sim.RecordFlux)

    kwargs.setdefault("MultiThreading", flags.Concurrency.NumThreads > 0)
    # Set commands for the G4AtlasAlg
    kwargs.setdefault("G4Commands", flags.Sim.G4Commands)
    kwargs.setdefault("PrintTimingInfo", flags.Sim.ISF.DoTimeMonitoring)
    tool = acc.popToolsAndMerge(SensitiveDetectorMasterToolCfg(flags))
    kwargs.setdefault("SenDetMasterTool", tool)
    tool = acc.popToolsAndMerge(FastSimulationMasterToolCfg(flags))
    kwargs.setdefault("FastSimMasterTool", tool)
    # Workaround to keep other simulation flavours working while we migrate everything to be AthenaMT-compatible.
    if flags.Sim.ISF.Simulator in [
            "FullG4", "FullG4MT", "PassBackG4", "PassBackG4MT", "G4FastCalo",
            "G4FastCaloMT"
    ]:
        acc.setPrivateTools(CompFactory.iGeant4.G4TransportTool(
            name, **kwargs))
    else:
        from ISF_FatrasServices.ISF_FatrasConfig import G4RunManagerHelperCfg
        acc.merge(G4RunManagerHelperCfg(flags))
        kwargs.setdefault("G4RunManagerHelper",
                          acc.getPublicTool("ISF_G4RunManagerHelper"))
        acc.setPrivateTools(
            CompFactory.iGeant4.G4LegacyTransportTool(name, **kwargs))
    return acc