Exemplo n.º 1
0
def egammaTimeCorrConfig \
    (seq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName()),
    prefix = '',
    sgkey = D3PDMakerFlags.ElectronSGKey(),
     typeName = 'DataVector<xAOD::Electron_v1>',
    allowMissing = False):
    """Configure egammaTimeCorrAlg for D3PD making.

    SEQ is the Gaudi sequence to which the algorithm should be added.
    Default is that given by PreD3PDAlgSeqName.

    PREFIX is a prefix to add to the name of the algorithm scheduled.

    SGKEY/TYPENAME is the StoreGate key of the input electron container
    and the name of its type.

    If ALLOWMISSING is true, don't fail if the SG key doesn't exist.
    """

    if (not D3PDMakerFlags.MakeEgammaUserData() or
        D3PDMakerFlags.HaveEgammaUserData()):
        return

    DVGetter = D3PDMakerCoreComps.SGDataVectorGetterTool
    resolved_sgkey = resolveSGKey (typeName, sgkey)
    auxprefix = (D3PDMakerFlags.EgammaUserDataPrefix() + '_' +
                 resolved_sgkey + '_')

    algName = 'egammaTimeCorrAlg' + resolved_sgkey
    if not hasattr (seq, algName):
        
        from IOVDbSvc.CondDB import conddb
        
        conddb.addFolder("LAR_OFL","/LAR/TimeCorrectionOfl/NonRunCon <tag>LARTimeCorrectionOflNonRunCon-00</tag>",force=True)
        conddb.addFolder("LAR_OFL","/LAR/TimeCorrectionOfl/RunCon <tag>LARTimeCorrectionOflRunCon-00</tag>",force=True)
       
        from CaloClusterCorrection.CaloClusterTimeTool import GetCaloClusterTimeTool 
        myCaloClusterTimeTool=GetCaloClusterTimeTool("caloClusterTimeTool", "/LAR/TimeCorrectionOfl/NonRunCon","/LAR/TimeCorrectionOfl/RunCon")
    
        seq += egammaD3PDAnalysis.egammaTimeCorrAlg \
                (algName,
                Getter = DVGetter
                    (prefix + 'egammaTimeCorrGetter',
                    TypeName = typeName,
                    SGKey = sgkey),
                AllowMissing = allowMissing,
                AuxPrefix = auxprefix,
                CaloClusterTimeTool = myCaloClusterTimeTool,
                                    )

    return
Exemplo n.º 2
0
def PhotonTruthConfig \
        (seq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName()),
         prefix = '',
         sgkey = D3PDMakerFlags.ElectronSGKey(),
         typeName = 'ElectronContainer',
         allowMissing = False):
    """Configure PhotonTruthAlg for D3PD making.

    SEQ is the Gaudi sequence to which the algorithm should be added.
    Default is that given by PreD3PDAlgSeqName.

    PREFIX is a prefix to add to the name of the algorithm scheduled.

    SGKEY/TYPENAME is the StoreGate key of the input electron container
    and the name of its type.

    If ALLOWMISSING is true, don't fail if the SG key doesn't exist.
"""

    if not rec.doTruth():
        return

    if (not D3PDMakerFlags.MakeEgammaUserData() or
        D3PDMakerFlags.HaveEgammaUserData()):
        return

    DVGetter = D3PDMakerCoreComps.SGDataVectorGetterTool
    resolved_sgkey = resolveSGKey (typeName, sgkey)
    auxprefix = (D3PDMakerFlags.EgammaUserDataPrefix() + '_' +
                 resolved_sgkey + '_')

    from TruthD3PDMaker.MCTruthClassifierConfig \
         import D3PDMCTruthClassifier
    ptaname = 'PhotonTruthAlg_' + resolved_sgkey
    if not hasattr (seq, ptaname):
        seq += egammaD3PDAnalysis.PhotonTruthAlg \
               (ptaname,
                PhotonGetter = DVGetter
                  (prefix + 'PhotonTruthAlgGetter',
                   TypeName = typeName,
                   SGKey = sgkey),
                AllowMissing = allowMissing,
                AuxPrefix = auxprefix,
                TruthTool = egammaD3PDAnalysis.PhotonTruthTool
                  ('D3PD__PhotonTruthTool',
                   Classifier = D3PDMCTruthClassifier))

    return
Exemplo n.º 3
0
def TileGapConfig \
    (seq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName()),
     prefix = '',
     sgkey = 'egClusterCollection',
     typeName = 'DataVector<xAOD::CaloCluster_v1>',
     allowMissing = False):
    """Configure egammaMaxECellAlg for D3PD making.

    SEQ is the Gaudi sequence to which the algorithm should be added.
    Default is that given by PreD3PDAlgSeqName.

    PREFIX is a prefix to add to the name of the algorithm scheduled.

    SGKEY/TYPENAME is the StoreGate key of the input electron container
    and the name of its type.

    If ALLOWMISSING is true, don't fail if the SG key doesn't exist.
    """

    if (not D3PDMakerFlags.MakeEgammaUserData() or
        D3PDMakerFlags.HaveEgammaUserData()):
        return

    DVGetter = D3PDMakerCoreComps.SGDataVectorGetterTool
    resolved_sgkey = resolveSGKey (typeName, sgkey)
    auxprefix = (D3PDMakerFlags.EgammaUserDataPrefix() + '_' +
                 resolved_sgkey + '_')

    algName = 'TileGapSumAlg' + resolved_sgkey
    if not hasattr (seq, algName):

        gapsel = TileGapSelectionGetter (seq)
        myAlg = egammaD3PDAnalysis.TileGapSumAlg \
                (algName,
                 ClusterGetter = DVGetter
                    (prefix + 'TileGapAlgGetter',
                    TypeName = typeName,
                    SGKey = sgkey),
                 CellGetter = SGDataVectorGetterTool
                    (prefix + 'TileGapAlgCellGetter',
                     SGKey = gapsel.outputKey(),
                     TypeName = gapsel.outputType()),
                 AllowMissing = allowMissing,
                 AuxPrefix = auxprefix,)

        seq += myAlg

    return
Exemplo n.º 4
0
def egammaDeltaEmax2Config \
        (seq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName()),
         prefix = '',
         sgkey = D3PDMakerFlags.ElectronSGKey(),
         typeName = 'DataVector<xAOD::Electron_v1>',
         allowMissing = False):
    """Configure egammaDeltaEmax2Alg for D3PD making.

    SEQ is the Gaudi sequence to which the algorithm should be added.
    Default is that given by PreD3PDAlgSeqName.

    PREFIX is a prefix to add to the name of the algorithm scheduled.

    SGKEY/TYPENAME is the StoreGate key of the input electron container
    and the name of its type.

    If ALLOWMISSING is true, don't fail if the SG key doesn't exist.
"""

    if (not D3PDMakerFlags.MakeEgammaUserData() or
        D3PDMakerFlags.HaveEgammaUserData()):
        return

    DVGetter = D3PDMakerCoreComps.SGDataVectorGetterTool
    resolved_sgkey = resolveSGKey (typeName, sgkey)
    auxprefix = (D3PDMakerFlags.EgammaUserDataPrefix() + '_' +
                 resolved_sgkey + '_')

    emax2name = 'DeltaEmax2Alg_' + resolved_sgkey
    if not hasattr (seq, emax2name):
        highlum = False
        if typeName == 'ElectronContainer':
            from AthenaCommon.BeamFlags import jobproperties        
            if jobproperties.Beam.numberOfCollisions() >= 20 :
                highlum = True

        seq += egammaD3PDAnalysis.egammaDeltaEmax2Alg \
               (emax2name,
                Getter = DVGetter 
                  (prefix + 'DeltaEmax2Getter',
                   TypeName = typeName,
                   SGKey = sgkey),
                AllowMissing = allowMissing,
                HighLum = highlum,
                AuxPrefix = auxprefix)

    return
def egammaCalcOQConfig \
        (seq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName()),
         prefix = '',
         sgkey = D3PDMakerFlags.ElectronSGKey(),
         typeName = 'ElectronContainer',
         allowMissing = False):
    """Configure egammaTopoIsoAlg for D3PD making.

    SEQ is the Gaudi sequence to which the algorithm should be added.
    Default is that given by PreD3PDAlgSeqName.

    PREFIX is a prefix to add to the name of the algorithm scheduled.

    SGKEY/TYPENAME is the StoreGate key of the input electron container
    and the name of its type.

    If ALLOWMISSING is true, don't fail if the SG key doesn't exist.
"""

    if (not D3PDMakerFlags.MakeEgammaUserData() or
        D3PDMakerFlags.HaveEgammaUserData()):
        return

    DVGetter = D3PDMakerCoreComps.SGDataVectorGetterTool
    resolved_sgkey = resolveSGKey (typeName, sgkey)
    udprefix = (D3PDMakerFlags.EgammaUserDataPrefix() + '_' +
                resolved_sgkey + '_')

    oqname = 'egammaCalcOQAlg_' + resolved_sgkey
    if not hasattr (seq, oqname):
        from AthenaCommon.AppMgr import ToolSvc
        ToolSvc += egammaOQFlagsBuilderBase()
        seq += egammaD3PDAnalysis.egammaCalcOQAlg \
               (oqname,
                egammaOQFlagsBuilder = egammaOQFlagsBuilderBase(),
                Getter = DVGetter
                  (prefix + 'egammaCalcOQGetter',
                   TypeName = typeName,
                   SGKey = sgkey),
                AllowMissing = allowMissing,
                UDPrefix = udprefix
                )

    return
Exemplo n.º 6
0
def egammaNbCellsGainAlgConfig \
    (seq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName()),
    prefix = '',
    sgkey = D3PDMakerFlags.ElectronSGKey(),
    typeName = 'ElectronContainer',
    allowMissing = False):
    """Configure egammaNbCellsGainAlg for D3PD making.

    SEQ is the Gaudi sequence to which the algorithm should be added.
    Default is that given by PreD3PDAlgSeqName.

    PREFIX is a prefix to add to the name of the algorithm scheduled.

    SGKEY/TYPENAME is the StoreGate key of the input electron container
    and the name of its type.

    If ALLOWMISSING is true, don't fail if the SG key doesn't exist.
    """

    if (not D3PDMakerFlags.MakeEgammaUserData() or
        D3PDMakerFlags.HaveEgammaUserData()):
        return

    DVGetter = D3PDMakerCoreComps.SGDataVectorGetterTool
    resolved_sgkey = resolveSGKey (typeName, sgkey)
    auxprefix = (D3PDMakerFlags.EgammaUserDataPrefix() + '_' +
                 resolved_sgkey + '_')

    algName = 'egammaNbCellsGainAlg' + resolved_sgkey
    if not hasattr (seq, algName):
        
        myAlg = egammaD3PDAnalysis.egammaNbCellsGainAlg \
                (algName,
                Getter = DVGetter
                    (prefix + 'egammaNbCellsGainAlgGetter',
                    TypeName = typeName,
                    SGKey = sgkey),
                AllowMissing = allowMissing,
                AuxPrefix = auxprefix,)

        seq += myAlg

    return
                                  TrackD3PDMaker.eProbabilityBrem,
                                  'eProbabilityBrem',
                              ])

ElectronVertAssoc = SimpleAssociation \
                    (ElectronTPAssoc,
                     TrackD3PDMaker.TrackParticleVertexAssociationTool,
                     prefix = 'vert')
ElectronVertAssoc.defineBlock(1, 'Vertex',
                              TrackD3PDMaker.VertexPositionFillerTool)

############################################################################
# From UserData
#

if D3PDMakerFlags.HaveEgammaUserData() or D3PDMakerFlags.MakeEgammaUserData():
    ElectronD3PDObject.defineBlock \
      (1, 'UDLayer1Shape',
       D3PDMakerCoreComps.UserDataFillerTool,
       UDPrefix = D3PDMakerFlags.EgammaUserDataPrefix(),
       Vars = ['deltaEmax2', '', 'float',
               ])


    ElectronD3PDObject.defineBlock \
      (1, 'BeamSpotAndPVImpact',
       D3PDMakerCoreComps.UserDataFillerTool,
       UDPrefix = D3PDMakerFlags.EgammaUserDataPrefix(),
       Vars = ['trackd0beam:Transverse impact parameter wrt the beam spot',
               'd0beam',         'float',
               'tracksigd0beam:Uncertainty in the transverse impact parameter wrt the beam spot',
def PhotonUserDataConfig \
        (seq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName()),
         prefix = '',
         sgkey = D3PDMakerFlags.PhotonSGKey(),
         typeName = 'PhotonContainer'):
    """Configure algorithms required for D3PD making for photons.

    SEQ is the Gaudi sequence to which the algorithms should be added.
    Default is that given by PreD3PDAlgSeqName.

    PREFIX is a prefix to add to the names of the algorithms scheduled.

    SGKEY/TYPENAME is the StoreGate key of the input electron container
    and the name of its type.
"""

    DVGetter = D3PDMakerCoreComps.SGDataVectorGetterTool
    
    if (not D3PDMakerFlags.MakeEgammaUserData() or
        D3PDMakerFlags.HaveEgammaUserData()):
        return

#not use MCTruthClassifier to avoid crash
#    if rec.doTruth():
#        ptaname = prefix + 'PhotonTruthAlg'
#        if not hasattr (seq, ptaname):
#            seq += egammaD3PDAnalysis.PhotonTruthAlg \
#                   (ptaname,
#                    PhotonGetter = DVGetter
#                      (prefix + 'PhotonTruthAlgGetter',
#                       TypeName = typeName,
#                       SGKey = sgkey),
#                    UDPrefix = D3PDMakerFlags.EgammaUserDataPrefix())
#

    ptianame = prefix + 'PhotonTopoIsoAlg'
    if not hasattr (seq, ptianame):
        seq += egammaD3PDAnalysis.PhotonTopoIsoAlg \
               (ptianame,
                PhotonGetter = DVGetter
                  (prefix +'PhotonTopoIsoAlgPhotonGetter',
                   TypeName = typeName,
                   SGKey = sgkey),
                ClusterGetter = DVGetter
                  (prefix + 'PhotonTopoIsoAlgClusterGetter',
                   TypeName = 'CaloClusterContainer',
                   SGKey = D3PDMakerFlags.ClusterSGKey()),
                UDPrefix = D3PDMakerFlags.EgammaUserDataPrefix())

        
    emax2gamname = prefix + 'DeltaEmax2GamAlg'
    if not hasattr (seq, emax2gamname):
        seq += egammaD3PDAnalysis.egammaDeltaEmax2Alg \
               (emax2gamname,
                Getter = DVGetter 
                  (prefix + 'DeltaEmax2GamGetter',
                   TypeName = typeName,
                   SGKey = sgkey),
                UDPrefix = D3PDMakerFlags.EgammaUserDataPrefix())


    resname = resolveSGKey (typeName, sgkey)
    gamrawclustname = 'GamRawClusterAlg_' + resname
    if not hasattr (seq, gamrawclustname):
        seq += egammaD3PDAnalysis.RawClusterAlg \
               (gamrawclustname,
                Getter = DVGetter 
                  (prefix + 'GamRawClusterAlgGetter',
                   TypeName = typeName,
                   SGKey = sgkey),
                RawClustersName =
                  resname + D3PDMakerFlags.RawClustersSGKeySuffix(),
                RawClustersAssocName =
                  resname + D3PDMakerFlags.RawClustersAssocSGKeySuffix(),
                ClusterCorrectionTool = egammaSwToolNone())

    isoname = prefix + 'egammaIsIsoAlg'
    if not hasattr (seq, isoname):
        from egammaPIDTools.egammaIsolationMVATopToolBase \
             import egammaIsolationMVATopToolBase
        egammaIsolationMVATopToolBase ("egammaIsolationMVATopTool")

        seq += egammaD3PDAnalysis.egammaIsIsoAlg \
               (isoname,
                Getter = DVGetter
                  (prefix + 'egammaIsIsoGetter',
                   TypeName = typeName,
                   SGKey = sgkey),
                UDPrefix = D3PDMakerFlags.EgammaUserDataPrefix(),
                IsoTypes = [egammaIsolationType.iso99,
                            egammaIsolationType.iso98,
                            egammaIsolationType.iso95,
                            egammaIsolationType.iso90,

                            egammaIsolationType.caloIso99,
                            egammaIsolationType.caloIso98,
                            egammaIsolationType.caloIso95,
                            egammaIsolationType.caloIso90,
                            egammaIsolationType.caloIso80,

                            egammaIsolationType.trackIso99,
                            egammaIsolationType.trackIso98,
                            egammaIsolationType.trackIso95,

                            egammaIsolationType.likelihoodIso95,
                            egammaIsolationType.likelihoodIso90,
                            egammaIsolationType.likelihoodIso80,
                            ])