ISF_FastCaloSimServicesConfig.py 9.38 KB
Newer Older
Aishik Ghosh's avatar
Aishik Ghosh committed
1
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
2
3
4
5
6
7

"""
Tools configurations for ISF_FastCaloSimServices
KG Tan, 04/12/2012
"""

8
from AthenaCommon import CfgMgr
9

10
from FastChainPileup.FastChain_jobProperties import FastChain_Flags
11
12
13
14
15
16
17
#### FastCaloSimSvc
def getFastCaloSimSvc(name="ISF_FastCaloSimSvc", **kwargs):
    from ISF_FastCaloSimServices.ISF_FastCaloSimJobProperties import ISF_FastCaloSimFlags
    kwargs.setdefault("BatchProcessMcTruth"              , False                                             )
    kwargs.setdefault("SimulateUndefinedBarcodeParticles", False                                             )
    kwargs.setdefault("Identifier"                       , 'FastCaloSim'                                     )
    kwargs.setdefault("CaloCellsOutputName"              , ISF_FastCaloSimFlags.CaloCellsName()              )
18
    kwargs.setdefault("PunchThroughTool"                 , 'ISF_PunchThroughTool'             )
19
    kwargs.setdefault("DoPunchThroughSimulation"         , False                                             )
20
21
22
23
    kwargs.setdefault("ParticleBroker"                   , 'ISF_ParticleBrokerSvc'               )
    kwargs.setdefault("CaloCellMakerTools_setup"         , [ 'ISF_EmptyCellBuilderTool' ] )
    kwargs.setdefault("CaloCellMakerTools_simulate"      , [ 'ISF_FastShowerCellBuilderTool' ])
    kwargs.setdefault("CaloCellMakerTools_release"       , [ #'ISF_AddNoiseCellBuilderTool',
24
                                                             'ISF_CaloCellContainerFCSFinalizerTool',
25
26
                                                             'ISF_FastHitConvertTool' ])
    kwargs.setdefault("Extrapolator"                     , 'ISF_NITimedExtrapolator')
27
    # register the FastCaloSim random number streams
28
29
30
    from G4AtlasApps.SimFlags import simFlags
    if not simFlags.RandomSeedList.checkForExistingSeed(ISF_FastCaloSimFlags.RandomStreamName()):
        simFlags.RandomSeedList.addSeed( ISF_FastCaloSimFlags.RandomStreamName(), 98346412, 12461240 )
31
    return CfgMgr.ISF__FastCaloSimSvc(name, **kwargs )
32

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
def getFastCaloSimPileupOTSvc(name="ISF_FastCaloSimPileupOTSvc", **kwargs):
    from ISF_FastCaloSimServices.ISF_FastCaloSimJobProperties import ISF_FastCaloSimFlags
    kwargs.setdefault("BatchProcessMcTruth"              , False                                             )
    kwargs.setdefault("SimulateUndefinedBarcodeParticles", False                                             )
    kwargs.setdefault("Identifier"                       , 'FastCaloSim'                                     )
    kwargs.setdefault("CaloCellsOutputName"              , ISF_FastCaloSimFlags.CaloCellsName()+'PileUp'     )
    kwargs.setdefault("PunchThroughTool"                 , 'ISF_PunchThroughTool'             )
    kwargs.setdefault("DoPunchThroughSimulation"         , False                                             )
    #kwargs.setdefault("PUWeights"                        , FastChain_Flags.FastChainPUWeights()  )
    kwargs.setdefault("PUWeights_lar_bapre"              , FastChain_Flags.FastChainPUWeights_lar_bapre()  )
    kwargs.setdefault("PUWeights_lar_hec"                , FastChain_Flags.FastChainPUWeights_lar_hec()  )
    kwargs.setdefault("PUWeights_lar_em"                 , FastChain_Flags.FastChainPUWeights_lar_em()  )
    kwargs.setdefault("PUWeights_tile"                   , FastChain_Flags.FastChainPUWeights_tile()  )
    kwargs.setdefault("ParticleBroker"                   , 'ISF_ParticleBrokerSvc'               )
    kwargs.setdefault("CaloCellMakerTools_setup"         , [ 'ISF_EmptyCellBuilderTool' ] )
    kwargs.setdefault("CaloCellMakerTools_simulate"      , [ 'ISF_FastShowerCellBuilderTool' ])
    kwargs.setdefault("CaloCellMakerTools_release"       , [ #'ISF_AddNoiseCellBuilderTool',
50
                                                             'ISF_CaloCellContainerFCSFinalizerTool',
51
52
53
54
55
56
57
58
                                                             'ISF_FastHitConvertTool' ])
    kwargs.setdefault("Extrapolator"                     , 'ISF_NITimedExtrapolator')
    # 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 )
    return CfgMgr.ISF__FastCaloSimSvcPU(name, **kwargs )

59
60
61
#### Pileup FastCaloSim
def getFastCaloSimPileupSvc(name="ISF_FastCaloSimPileupSvc", **kwargs):
    from ISF_FastCaloSimServices.ISF_FastCaloSimJobProperties import ISF_FastCaloSimFlags
62
63
64
    kwargs.setdefault("CaloCellsOutputName"              , ISF_FastCaloSimFlags.CaloCellsName()+'PileUp'     )
    kwargs.setdefault("CaloCellMakerTools_simulate"      , [ 'ISF_PileupFastShowerCellBuilderTool' ])
    return getFastCaloSimSvc(name, **kwargs)
65
66
67
68

#### Legacy FastCaloSim
def getLegacyAFIIFastCaloSimSvc(name="ISF_LegacyAFIIFastCaloSimSvc", **kwargs):
    kwargs.setdefault("BatchProcessMcTruth" , True )
69
70
    kwargs.setdefault("ParticleBroker"                   , 'ISF_AFIIParticleBrokerSvc' )
    kwargs.setdefault("CaloCellMakerTools_simulate"      , [ 'ISF_LegacyFastShowerCellBuilderTool' ] )
71
72
73
74
    return getFastCaloSimSvc(name, **kwargs)

def getFastHitConvAlgFastCaloSimSvc(name="ISF_FastHitConvAlgFastCaloSimSvc",**kwargs):
    kwargs.setdefault("CaloCellMakerTools_release", [
75
                                                           #'ISF_AddNoiseCellBuilderTool',
76
                                                            'ISF_CaloCellContainerFCSFinalizerTool'
77
78
79
80
81
                                                    ] )
    # setup FastCaloSim hit converter and add it to the alg sequence:
    # -> creates HITS from reco cells
    from AthenaCommon.AlgSequence import AlgSequence
    topSequence=AlgSequence()
82
    from AthenaCommon.CfgGetter import getAlgorithm
83
84
85
86
87
88
89
    topSequence+=getAlgorithm('ISF_FastHitConvAlg')
    return getFastCaloSimSvc(name,**kwargs)

def getFastHitConvAlgLegacyAFIIFastCaloSimSvc(name="ISF_FastHitConvAlgLegacyAFIIFastCaloSimSvc", **kwargs):
    kwargs.setdefault("BatchProcessMcTruth" , True )
    return getFastHitConvAlgFastCaloSimSvc(name, **kwargs)

90
#### FastCaloSimV2
91
92
93
94
95
96
def getFastCaloSimV2ParamSvc(name="ISF_FastCaloSimV2ParamSvc", **kwargs):
    from ISF_FastCaloSimServices.ISF_FastCaloSimJobProperties import ISF_FastCaloSimFlags
    kwargs.setdefault("ParamsInputFilename"              , ISF_FastCaloSimFlags.ParamsInputFilename())
    kwargs.setdefault("ParamsInputObject"                , 'SelPDGID')
    return CfgMgr.ISF__FastCaloSimV2ParamSvc(name, **kwargs )

97
def getFastCaloSimSvcV2(name="ISF_FastCaloSimSvcV2", **kwargs):
98
    from ISF_FastCaloSimServices.ISF_FastCaloSimJobProperties import ISF_FastCaloSimFlags
99
100
101

    kwargs.setdefault("CaloCellsOutputName"              , ISF_FastCaloSimFlags.CaloCellsName()   )
    kwargs.setdefault("CaloCellMakerTools_setup"         , [ 'ISF_EmptyCellBuilderTool' ] )
102
    kwargs.setdefault("CaloCellMakerTools_release"       , [ 'ISF_CaloCellContainerFCSFinalizerTool',
103
                                                           'ISF_FastHitConvertTool' ])
104
    kwargs.setdefault("FastCaloSimCaloExtrapolation"     , 'FastCaloSimCaloExtrapolation')
Thomas Michael Carter's avatar
Thomas Michael Carter committed
105
    kwargs.setdefault("PunchThroughTool"                 , 'ISF_PunchThroughTool'             )
106
    kwargs.setdefault("DoPunchThroughSimulation"         , ISF_FastCaloSimFlags.DoPunchThroughSimulation())
107
    kwargs.setdefault("ParticleBroker"                   , 'ISF_AFIIParticleBrokerSvc'               )
John Chapman's avatar
John Chapman committed
108

109
    kwargs.setdefault("ParamSvc", "ISF_FastCaloSimV2ParamSvc")
110
111
112
113
    # 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 )
114

John Chapman's avatar
John Chapman committed
115
116
    kwargs.setdefault("RandomStream"                     , ISF_FastCaloSimFlags.RandomStreamName())
    kwargs.setdefault("RandomSvc"                        , simFlags.RandomSvc.get_Value() )
117
    kwargs.setdefault("ParticleTruthSvc"                 , simFlags.TruthStrategy.TruthServiceName() )
118

119
    return CfgMgr.ISF__FastCaloSimSvcV2(name, **kwargs )
120

121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#### DNNCaloSim
def getDNNCaloSimSvc(name="ISF_DNNCaloSimSvc", **kwargs):
    from ISF_FastCaloSimServices.ISF_FastCaloSimJobProperties import ISF_FastCaloSimFlags

    kwargs.setdefault("CaloCellsOutputName"              , ISF_FastCaloSimFlags.CaloCellsName()   )
    kwargs.setdefault("CaloCellMakerTools_setup"         , [ 'ISF_EmptyCellBuilderTool' ] )
    kwargs.setdefault("CaloCellMakerTools_release"       , [ 'ISF_CaloCellContainerFinalizerTool',
                                                           'ISF_FastHitConvertTool' ]) #DR needed ?
    kwargs.setdefault("ParamsInputFilename"              , ISF_FastCaloSimFlags.ParamsInputFilename())
    kwargs.setdefault("FastCaloSimCaloExtrapolation"     , 'FastCaloSimCaloExtrapolation')

    # 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 )
136

137
138
    kwargs.setdefault("RandomStream"                     , ISF_FastCaloSimFlags.RandomStreamName())
    kwargs.setdefault("RandomSvc"                        , simFlags.RandomSvc.get_Value() )
139

140
    return CfgMgr.ISF__DNNCaloSimSvc(name, **kwargs )