Exemplo n.º 1
0
from D3PDMakerCoreComps.ContainedVectorMultiAssociation import ContainedVectorMultiAssociation
#import TrigMuonD3PDMaker
import TruthD3PDMaker

from RecExConfig.RecFlags import rec
from RecExConfig.ObjKeyStore import cfgKeyStore

from AthenaCommon.AppMgr import ToolSvc
from AthenaCommon.Include import include

from MuonD3PDMaker.MuonD3PDMakerFlags import MuonD3PDFlags


MuonD3PDObject = \
           make_SGDataVector_D3PDObject ('DataVector<xAOD::Muon_v1>',
                                         D3PDMakerFlags.MuonSGKey(),
                                         'mu_', 'MuonD3PDObject')

MuonD3PDObject.defineBlock(0,
                           'Kinematics',
                           EventCommonD3PDMaker.FourMomFillerTool,
                           WriteRect=True,
                           WriteE=True,
                           WriteM=True)
MuonD3PDObject.defineBlock(0,
                           'AllAuthor',
                           D3PDMakerCoreComps.AuxDataFillerTool,
                           Vars=['allauthor = allAuthors'])

MuonD3PDObject.defineBlock(1,
                           'Authors',
def getJetTileD3PDObject(objectname='JetTileD3PDObject',
                         prefix='jet_',
                         btagleveloffset=7):

    object = make_SGDataVector_D3PDObject('JetCollection',
                                          D3PDMakerFlags.JetSGKey(), prefix,
                                          objectname)

    object.defineHook(_fixJetTiming)

    object.defineBlock(0,
                       'Kinematics',
                       EventCommonD3PDMaker.FourMomFillerTool,
                       WriteE=True)

    object.defineBlock(1,
                       'OriginCorrection',
                       JetD3PDMaker.JetMomentFillerTool,
                       Moments=['EtaOrigin', 'PhiOrigin', 'MOrigin'])

    object.defineBlock(
        1,
        'DQMoments',
        JetD3PDMaker.JetMomentFillerTool,
        Moments=[
            'WIDTH', 'n90', 'Timing', 'LArQuality', 'nTrk', 'sumPtTrk',
            'OriginIndex', 'HECQuality', 'NegativeE', 'AverageLArQF',
            'BCH_CORR_CELL', 'BCH_CORR_DOTX', 'BCH_CORR_JET',
            'BCH_CORR_JET_FORCELL', 'ENG_BAD_CELLS', 'N_BAD_CELLS',
            'N_BAD_CELLS_CORR', 'BAD_CELLS_CORR_E', 'NumTowers',
            'ootFracCells5', 'ootFracCells10', 'ootFracClusters5',
            'ootFracClusters10'
        ])

    object.defineBlock(1, 'JetSamplingsFrac',
                       JetD3PDMaker.JetSamplingsFracFillerTool)
    object.defineBlock(1, 'JetQual', JetD3PDMaker.JetCaloUtilsFillerTool)
    object.defineBlock(1, 'EMFraction', JetD3PDMaker.JetEMFractionFillerTool)

    object.defineBlock(
        1,
        'JES',
        JetD3PDMaker.JetMomentFillerTool,
        Moments=['Offset', 'EMJES', 'EMJES_EtaCorr', 'EMJESnooffset'])

    object.defineBlock(1,
                       'EMScale',
                       JetD3PDMaker.JetSignalStateFillerTool,
                       WriteE=True,
                       SignalStateNumber=0,
                       SignalStatePrefix='emscale')

    object.defineBlock(2, 'JetTileFiller', JetD3PDMaker.JetTileCellFillerTool)

    #    object.defineBlock(3, 'JVtx',
    #                              JetD3PDMaker.JetVtxFillerTool,
    #                              JetVertexAssociationTool=_getJvfTool())

    object.defineBlock(3,
                       'Layer',
                       JetD3PDMaker.JetMomentFillerTool,
                       Moments=['GSCFactorF', 'WidthFraction'])

    object.defineBlock(4, 'Samplings', JetD3PDMaker.JetSamplingsFillerTool)

    object.defineBlock(5,
                       'JESMoments',
                       JetD3PDMaker.JetMomentFillerTool,
                       Moments=['LCJES'])
    #                              Moments=['GCWJES', 'GCWJES_EtaCorr','CB'])

    object.defineBlock(5, 'JetShape', JetD3PDMaker.JetShapeFillerTool)

    object.defineBlock(5,
                       'Constituents',
                       JetD3PDMaker.JetConstituentFillerTool,
                       SignalStateNumber=0,
                       SignalStatePrefix='emscale')

    object.defineBlock(5,
                       'ConstituentScale',
                       JetD3PDMaker.JetSignalStateFillerTool,
                       WriteE=True,
                       SignalStateNumber=2,
                       SignalStatePrefix='constscale')

    object.defineBlock(6,
                       'JetLArHVMoment',
                       JetD3PDMaker.JetMomentFillerTool,
                       Moments=['LArBadHVEnergy', 'LArBadHVRatio'])

    addBTagInfoToJetObject(object, btagleveloffset)

    # Track association cannot be done unless there are tracks.
    # As often this is not the case track association will be done only
    # if this is explicitly asked for. by defining it in the include list.
    #
    # You can also enable it by passing an argument to JetD3PDObject
    # like:
    #   AssocTrackCont_target='mytarget_'
    def _jetAssocLevel(reqlev, args):
        return args.has_key('target') or (reqlev >= 999)

    IndexMultiAssociation(object,
                          JetD3PDMaker.FlavorAssociationTool,
                          'trk',
                          prefix='flavor_assoctrk_',
                          level=_jetAssocLevel,
                          blockname='AssocTrackCont')

    object.defineBlock(10, 'JetRoIword', JetD3PDMaker.JetROIWordFillerTool)

    JetElAssoc = DRAssociation(object,
                               "ElectronContainer",
                               D3PDMakerFlags.ElectronSGKey(),
                               0.2,
                               prefix='el_',
                               matched="matched",
                               blockname="El02Match")

    JetMuAssoc = DRAssociation(object,
                               "Analysis::MuonContainer",
                               D3PDMakerFlags.MuonSGKey(),
                               0.2,
                               prefix='mu_',
                               matched="matched",
                               blockname="Mu02Match")

    #JetTrkAssoc = DRAssociation(object,"Rec::TrackParticleContainer",D3PDMakerFlags.TrackSGKey(),0.4,prefix='trk_',matched="matched",blockname="Trk04Match")

    #---------------- Trigger Object ----------------------------

    JetL1Assoc = SimpleAssociation(
        object,
        JetD3PDMaker.JetL1TriggerObjectAssociationTool,
        matched='matched',
        blockname='L1Info',
        prefix='L1_',
        MaxDR=0.6,
        ChainPattern='L1_J.*')

    JetL1Assoc.defineBlock(99,
                           'L1Kinematics',
                           EventCommonD3PDMaker.FourMomFillerTool,
                           WriteE=True,
                           WriteEt=False,
                           WriteM=False)

    JetL2Assoc = SimpleAssociation(
        object,
        JetD3PDMaker.JetL2TriggerObjectAssociationTool,
        matched='matched',
        blockname='L2Info',
        prefix='L2_',
        MaxDR=0.25,
        ChainPattern='L2_j.*')

    JetL2Assoc.defineBlock(99,
                           'L2Kinematics',
                           EventCommonD3PDMaker.FourMomFillerTool,
                           WriteE=True,
                           WriteEt=False,
                           WriteM=False)

    JetEFAssoc = SimpleAssociation(
        object,
        JetD3PDMaker.JetEFTriggerObjectAssociationTool,
        matched='matched',
        blockname='EFInfo',
        prefix='EF_',
        MaxDR=0.25,
        ChainPattern='EF_j.*')

    JetEFAssoc.defineBlock(99,
                           'EFKinematics',
                           EventCommonD3PDMaker.FourMomFillerTool,
                           WriteE=True,
                           WriteEt=False,
                           WriteM=False)


    ConstitAssoc = ContainedVectorMultiAssociation \
        (object,
         #JetD3PDMaker.JetConstituentAssociationTool,
         EventCommonD3PDMaker.NavigableConstituentAssociationTool,
         'constit_',
         TypeName = 'CaloCluster',
         nrowName = '',
         level = 1)

    ConstitAssoc.defineBlock(_constitAssocLevel,
                             'ConstitIndex',
                             D3PDMakerCoreComps.IndexFillerTool,
                             Target='')

    return object