def JetVertexFractionConfig \ (seq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName()), prefix = '', sgkey = D3PDMakerFlags.JetSGKey(), typeName = 'JetCollection'): """Configure algorithms required to fill JVF information into UserData. 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 jet container and the name of its type. """ DVGetter = D3PDMakerCoreComps.SGDataVectorGetterTool if (not D3PDMakerFlags.MakeJetUserData() or D3PDMakerFlags.HaveJetUserData()): return resolved_sgkey = resolveSGKey (typeName, sgkey) jvfname = 'JetVertexFractionAlg_' + resolved_sgkey if not hasattr (seq, jvfname): # Need to rebuild track associations... from JetD3PDAnalysis.JetMomentCalcConfig import JetMomentCalcConfig JetMomentCalcConfig (resolved_sgkey, None, seq=seq) from JetMomentTools.SetupJetMomentTools\ import getJetVertexAssociationTool seq += JetD3PDAnalysis.JetVertexFractionAlg \ (jvfname, Getter = DVGetter (prefix + 'JetVertexFractionGetter', TypeName = typeName, SGKey = sgkey), JetVertexAssociationTool = # Parameters are irrelevant; these will work for any jets. getJetVertexAssociationTool ('AntiKt', 0.4, 'Topo'), UDPrefix = D3PDMakerFlags.JetUserDataPrefix())
"or, from python, in ROOT.egammaIsolationType (in egammaInterfacesEnumsDict)." ) ElectronD3PDObject.defineBlock \ (1, 'IsIso', D3PDMakerCoreComps.UserDataFillerTool, UDPrefix = D3PDMakerFlags.EgammaUserDataPrefix(), Vars = ['isIso:' + isodoc, '', 'unsigned int', ]) ############################################################################ # Jet associations # EleJetD3PDAssoc = DRAssociation(ElectronD3PDObject, 'JetCollection', D3PDMakerFlags.JetSGKey(), 0.2, 'jet_', level=2, blockname='JetMatch') EleJetD3PDAssoc.defineBlock(2, 'JetKinematics', EventCommonD3PDMaker.FourMomFillerTool, WriteE=True) #if rec.doTruth(): # JetTruthJetD3PDAssoc = DRAssociation (EleJetD3PDAssoc, # 'JetCollection', # D3PDMakerFlags.TruthJetSGKey(), # 0.2, # 'truth_',
def getJetD3PDObject(objectname='JetD3PDObject', prefix='jet_', btagleveloffset=7): object = make_SGDataVector_D3PDObject('DataVector<xAOD::Jet_v1>', D3PDMakerFlags.JetSGKey(), prefix, objectname) # object.defineHook (_fixJetTiming) # object.defineHook (_jetVertexAlgHook) # object.defineHook (_jetMomentsHook) # object.defineHook (_jetClusterMomentsHook) object.defineBlock(0, 'Kinematics', EventCommonD3PDMaker.FourMomFillerTool, WriteE=True) # object.defineBlock(1, 'OriginCorrection', # JetD3PDMaker.JetMomentFillerTool, # Moments=['EtaOrigin' , 'PhiOrigin' , 'MOrigin' # ]) # object.defineBlock(1, 'WIDTH', # JetD3PDMaker.JetMomentFillerTool, # Moments=['WIDTH' # ]) object.defineBlock(1, 'DQMoments', D3PDMakerCoreComps.AuxDataFillerTool, Vars=[ 'n90 = N90Cells < int: 0', 'Timing < float: 0', 'LArQuality < float: 0', 'OriginIndex < float: 0', 'HECQuality < float: 0', 'NegativeE < float: 0', 'AverageLArQF < float: 0', 'BCH_CORR_CELL = BchCorrCell < float:0', 'BCH_CORR_DOTX = BchCorrDotx < int:0', 'BCH_CORR_JET = BchCorrJet < int:0', 'BCH_CORR_JET_FORCELL = BchCorrJetForCell < int:0', 'NumTowers < float: 0', 'ootFracCells5 < float: 0', 'ootFracCells10 < float: 0', 'ootFracClusters5 < float: 0', 'ootFracClusters10 < float: 0', ]) # object.defineBlock(1, 'JetSamplingsFrac', # JetD3PDMaker.JetSamplingsFracFillerTool) # object.defineBlock(1, 'JetQual', # JetD3PDMaker.JetCaloUtilsFillerTool) object.defineBlock(1, 'JetQual', D3PDMakerCoreComps.AuxDataFillerTool, Vars=[ 'isBadLoose < int: 0', 'isBadMedium < int: 0', 'isBadTight < int: 0', 'isUgly < int: 0', 'hecf = HECFrac < float: 0', ]) # object.defineBlock(1, 'EMFraction', # JetD3PDMaker.JetEMFractionFillerTool) # object.defineBlock(1, 'JES', # JetD3PDMaker.JetMomentFillerTool, # Moments=[ 'Offset', 'EMJES', 'EMJES_EtaCorr','EMJESnooffset' ]) # object.defineBlock(1, 'JESMoments', # JetD3PDMaker.JetMomentFillerTool, # Moments=['LCJES', 'LCJES_EtaCorr' ]) # object.defineBlock(1, 'EMScale', # JetD3PDMaker.JetSignalStateFillerTool, # WriteE = True, # SignalStateNumber = 0, # SignalStatePrefix = 'emscale') # object.defineBlock(1, 'ActiveArea', # JetD3PDMaker.JetMomentFillerTool, # Moments=['ActiveArea', 'ActiveAreaPx', 'ActiveAreaPy', 'ActiveAreaPz', 'ActiveAreaE']) # # Including JetVertexFraction should also include JVtx and TruthMF, # # unless explicitly excluded. # def _jvfLOD (reqlev, args, hookargs): # if reqlev < 3: return False # if not 'JVtx' in hookargs['exclude']: # hookargs['include'].append ('JVtx') # if not 'TruthMF' in hookargs['exclude']: # hookargs['include'].append ('TruthMF') # return True # try: # # tracksAvailableForJets not defined in every release. Temporarily put it in # # a try / except block # from JetRec.TrackSelectionForJets import tracksAvailableForJets # dotrackVars = tracksAvailableForJets() # except: # dotrackVars = True # if dotrackVars: # object.defineBlock(_jvfLOD, 'JetVertexFraction', # JetD3PDMaker.JetVertexFractionFillerTool, # UDPrefix=D3PDMakerFlags.JetUserDataPrefix(), # ) # object.defineBlock(3, 'JVtx', # JetD3PDMaker.JetVtxFillerTool) # object.defineBlock(3, 'TruthMF', # JetD3PDMaker.JetMomentFillerTool, # Moments=['TruthMFindex','TruthMF']) # object.defineBlock(3, 'Layer', # JetD3PDMaker.JetMomentFillerTool, # Moments=['GSCFactorF','WidthFraction']) # object.defineBlock(4, 'Samplings', # JetD3PDMaker.JetSamplingsFillerTool) # object.defineBlock(4, 'JetShape', # JetD3PDMaker.JetShapeFillerTool) # object.defineBlock(4, 'Constituents', # JetD3PDMaker.JetConstituentFillerTool, # SignalStateNumber = -1, # SignalStatePrefix = 'default') # object.defineBlock(4, 'ConstituentScale', # JetD3PDMaker.JetSignalStateFillerTool, # WriteE = True, # SignalStateNumber = 2, # SignalStatePrefix = 'constscale') # object.defineBlock(5, 'JetLArHVMoment', # JetD3PDMaker.JetMomentFillerTool, # Moments=['LArBadHVEnergy','LArBadHVRatio']) # object.defineBlock(9, 'JetClusterMoment', # JetD3PDMaker.JetMomentFillerTool, # Moments=['CENTER_LAMBDA','SECOND_R','SECOND_LAMBDA', # 'CLUSTER_PT']) # 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 ---------------------------- # #if D3PDMakerFlags.DoTrigger(): # if False: # 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) # pass # ConstitAssoc = ContainedVectorMultiAssociation \ # (object, # #JetD3PDMaker.JetConstituentAssociationTool, # EventCommonD3PDMaker.NavigableConstituentAssociationTool, # 'constit_', # TypeName = 'CaloCluster', # nrowName = '', # level = 1) # ConstitAssoc.defineBlock (_constitAssocLevel, 'ConstitIndex', # D3PDMakerCoreComps.IndexFillerTool, # Target = '') # # Beam Background Identification Method # object.defineBlock( 999, 'BeamBackground', # BackgroundD3PDMaker.BeamBackgroundJetFillerTool) # #---------------- special jet moments ---------------------------- # object.defineBlock(999, 'TrackMF', # JetD3PDMaker.JetMomentFillerTool, # Moments=['TrackMFindex','TrackMF']) # object.defineBlock(999, 'TracksMoments', # JetD3PDMaker.JetMomentFillerTool, # Moments=['nTrk_pv0_1GeV', 'sumPtTrk_pv0_1GeV', 'nTrk_allpv_1GeV', 'sumPtTrk_allpv_1GeV', # 'nTrk_pv0_500MeV', 'sumPtTrk_pv0_500MeV', # 'trackWIDTH_pv0_1GeV','trackWIDTH_allpv_1GeV' # ]) # object.defineBlock(999, 'JetLabel', # JetD3PDMaker.JetMomentFillerTool, # Moments=['JetLabel']) # object.defineBlock(999, 'Special', # JetD3PDMaker.JetMomentFillerTool, # Moments=['LikeLihood_0', # 'LowEtConstituentsFrac','KtDr', # ]) # object.defineBlock(999, 'VoronoiArea', # JetD3PDMaker.JetMomentFillerTool, # Moments=['VoronoiArea', 'VoronoiAreaPx', 'VoronoiAreaPy', 'VoronoiAreaPz', 'VoronoiAreaE', # ]) # object.defineBlock(999, 'Isolation', # JetD3PDMaker.JetMomentFillerTool, # Moments=['IsoKR20Perp', 'IsoKR20Par', 'IsoKR20SumPt', 'IsoDelta2Perp', 'IsoDelta2Par', # 'IsoDelta2SumPt', 'IsoFixedCone8Perp', 'IsoFixedCone8Par', 'IsoFixedCone8SumPt', # 'IsoFixedArea13Perp', 'IsoFixedArea13Par', 'IsoFixedArea13SumPt', # 'Iso6To88Perp', 'Iso6To88Par', 'Iso6To88SumPt', # ]) # object.defineBlock(999, 'SplitInfo', # JetD3PDMaker.JetMomentFillerTool, # Moments=['SPLIT12', 'SPLIT23', 'SPLIT34']) # object.defineBlock(999, 'Uncertainties', # JetD3PDMaker.JetMomentFillerTool, # Moments=['SmearingFactor']) return object
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
def makeTrackParticleToJetAssoc(name, prefix, object_name, assoc=None, label="jet_"): if not assoc: assoc = JetD3PDMaker.FlavorAssociationTool(name + 'Assoc') return D3PDMakerCoreComps.IndexMultiAssociationFillerTool( name, Prefix="flavor_assoctrk_", Associator=assoc, Target="trk_") JetD3PDObject = make_SGDataVector_D3PDObject('JetCollection', D3PDMakerFlags.JetSGKey(), 'jet_', 'QcdJetD3PDObject') # Reconstruction versions prior to 15.6.8 didn't fill in the jet timing/quality. # Fix up such jets here. def _fixJetTiming(c, **kw): # Check version number of the input data. # If no version is found, assume old. rlist = release_version() if rlist: if rlist[0] >= 16: return if rlist[0] == 15 and rlist[1] >= 7: return if rlist[0] == 15 and rlist[1] == 6 and rlist[2] >= 8: return sgkey_in = c.Getter.SGKey