def myBjetConfig_split(theChainDef, chainDict, inputTEsEF, numberOfSubChainDicts=1): useTRT = 'noTRT' not in chainDict['chainParts']['extra'] log.debug("In myBjetConfig_split") EFChainName = "EF_bjet_" + chainDict['chainName'] chainParts = chainDict['chainParts'] btagthresh = chainParts['threshold'] gscthresh = chainParts['gscThreshold'] if ('gscThreshold' in chainParts) else '' btagmult = chainParts['multiplicity'] btagcut = chainParts['bTag'] btagcut = btagcut[1:] #----------------------------------------------------------------------------------- # Import of algs #----------------------------------------------------------------------------------- algoInstance = "EF" #-------------------- # super ROI building theSuperRoi = getSuperRoiBuilderAllTEInstance() #-------------------- # jet splitting theJetSplit = getJetSplitterAllTEInstance() #-------------------- #find jets far away from a muon (for mu-jet chains with b-jet requirements only) if any('antimatchdr' in bM for bM in chainParts['bMatching']): # Extract the dR value from the chain name here.. the deltaR value has to consist of 2 numbers deltaR = -1 for anti_match_part in chainParts['bMatching']: if 'dr' in anti_match_part: deltaR = anti_match_part.split('dr')[1][0:2] if deltaR == -1: log.error("No DeltaR cut could be extracted!") theFarawayJet = getFarawayJetFinderAllTEInstance(str(deltaR)) algoInstance = "MuJetChain" #-------------------- # Et hypo (for b-tagging) #from TrigBjetHypo.TrigBjetEtHypoConfig import getBjetEtHypoInstance theBjetEtHypo = getBjetEtHypoInstance(algoInstance, "Btagging", btagthresh + "GeV") #-------------------- # tracking if useTRT: [trkvtx, trkftf, trkprec] = TrigInDetSequence("Bjet", "bjet", "IDTrig", sequenceFlavour=["2step"]).getSequence() else: [trkvtx, trkftf, trkprec] = TrigInDetSequence("Bjet", "bjet", "IDTrig", sequenceFlavour=["2step", "noTRT"]).getSequence() # for b-tagging theBjetTracks = trkftf + trkprec # for vertexing ## theVertexTracks = trkvtx #-------------------- # primary vertexing #-------------------- # GSC if ('gscThreshold' in chainParts) and chainParts['gscThreshold']: theGSCFex = getGSCFexSplitInstance(algoInstance) #from TrigBjetHypo.TrigBjetEtHypoConfig import getBjetEtHypoInstance theGSCEtHypo = getBjetEtHypoInstance( "GSC", "Btagging", gscthresh.replace("gsc", "") + "GeV") #-------------------- # secondary vertexing theVxSecondary = TrigVxSecondaryCombo_EF() #-------------------- # bjet fex # if ('boffperf' in chainParts['bTag'] or 'bmv2c20' in chainParts['bTag']): # # Offline taggers # from TrigBjetHypo.TrigBtagFexConfig import getBtagFexSplitInstance # theBjetFex = getBtagFexSplitInstance(algoInstance,"2012","EFID") # else: # # Run 1 style taggers # from TrigBjetHypo.TrigBjetFexConfig import getBjetFexSplitInstance # theBjetFex = getBjetFexSplitInstance(algoInstance,"2012","EFID") if ('boffperf' in chainParts['bTag'] or 'bmv2c20' in chainParts['bTag'] or 'bmv2c10' in chainParts['bTag'] or 'bhmv2c10' in chainParts['bTag']): # Offline taggers theBjetFex = getBtagFexSplitInstance(algoInstance, "2012", "EFID") else: # Run 1 style taggers theBjetFex = getBjetFexSplitInstance(algoInstance, "2012", "EFID") #-------------------- # bjet hypo if ('bperf' in chainParts['bTag'] or 'boffperf' in chainParts['bTag']): # Performance chains (run 1 and run 2 style) # Runs in NoCut mode theBtagReq = getBjetHypoSplitNoCutInstance(algoInstance) elif ('bmv2c20' in chainParts['bTag']): # MV2c20 tagger series theBtagReq = getBjetHypoSplitInstance(algoInstance, "2015", btagcut) elif ('bmv2c10' in chainParts['bTag']): # MV2c10 tagger series theBtagReq = getBjetHypoSplitInstance(algoInstance, "2017", btagcut) elif ('bhmv2c10' in chainParts['bTag']): # MV2c10hybrid tagger series theBtagReq = getBjetHypoSplitInstance(algoInstance, "2018", btagcut) else: # Run 1 style chains theBtagReq = getBjetHypoSplitInstance(algoInstance, "2012", btagcut) #----------------------------------------------------------------------------------- # TE naming #----------------------------------------------------------------------------------- tracking = "IDTrig" if 'noTRT' in chainParts['extra']: tracking = "IDTrig_noTRT" jetEtHypoTE = "HLT_j" + btagthresh jetHypoTE = "HLT_j" + btagthresh + "_eta" jetSplitTE = jetHypoTE + "_jsplit" jetTrackTE = jetSplitTE + "_" + tracking if not useTRT: jetEtHypoTE = jetEtHypoTE + "_noTRT" jetSplitTE = jetSplitTE + "_noTRT" jetFarawayTE = jetSplitTE + "_faraway" gsc_jetTrackTEPreCut = "HLT_precut_gsc" + btagthresh + "_eta" + "_jsplit" + "_" + tracking gsc_jetTrackTE = "HLT_" + gscthresh + "_eta" + "_jsplit" + "_" + tracking if any('antimatch' in bM for bM in chainParts['bMatching']) and any( 'mu' in bM for bM in chainParts['bMatching']): # extract muon threshold from chainname allChainParts = chainDict['chainName'].split('_') muonthr = -1 for cp in allChainParts: if 'mu' in cp and 'antimatch' not in cp: muonthr = cp.split('mu')[ -1] # assume the last bit is the threshold break #print 'muon thr for antimatch:' + str(muonthr) muonTE = "EF_SuperEF_mu{0}_MU{1}".format(muonthr, muonthr) jetEtHypoTE = jetEtHypoTE + '_antimatchmu{0}'.format(muonthr) jetHypoTE = jetHypoTE + '_antimatchmu{0}'.format(muonthr) jetTrackTE = jetTrackTE + '_antimatchmu{0}'.format(muonthr) superTE = "HLT_super" superTrackingTE = superTE + tracking prmVertexTE = superTrackingTE + "_prmVtx" comboPrmVtxTE = prmVertexTE + "Combo" secVtxTE = jetTrackTE + "__" + "secVtx" lastTEout = "HLT_bjet_" + chainParts[ 'chainPartName'] if numberOfSubChainDicts > 1 else EFChainName if not useTRT: lastTEout = lastTEout + "_noTRT" topoThresh = chainDict['topoThreshold'] topoStartFrom = setupTopoStartFrom(topoThresh, theChainDef) if topoThresh else None if topoStartFrom: lastTEout = lastTEout + '_tsf' #----------------------------------------------------------------------------------- # sequence assembling #----------------------------------------------------------------------------------- # Vertexing part of the chain theChainDef.addSequence(theSuperRoi, inputTEsEF, superTE) theChainDef.addSequence(trkvtx, superTE, superTrackingTE) theChainDef.addSequence([EFHistoPrmVtxAllTE_Jet()], superTrackingTE, prmVertexTE) theChainDef.addSequence([EFHistoPrmVtxCombo_Jet()], [superTrackingTE, prmVertexTE], comboPrmVtxTE) # b-tagging part of the chain (requires PV) theChainDef.addSequence(theJetSplit, [inputTEsEF, comboPrmVtxTE], jetSplitTE) #theChainDef.addSequence(theFarawayJet, [muonTE, jetSplitTE], jetFarawayTE) #theChainDef.addSequence(theBjetEtHypo, jetFarawayTE, jetEtHypoTE) #theChainDef.addSequence(theBjetEtHypo, jetSplitTE, jetEtHypoTE) if any('antimatch' in bM for bM in chainParts['bMatching']) and any( 'mu' in bM for bM in chainParts['bMatching']): theChainDef.addSequence(theFarawayJet, [muonTE, jetSplitTE], jetFarawayTE) jetForTrackingEtCut = jetFarawayTE #theChainDef.addSequence(theBjetEtHypo, jetFarawayTE, jetEtHypoTE) else: jetForTrackingEtCut = jetSplitTE #theChainDef.addSequence(theBjetEtHypo, jetSplitTE, jetEtHypoTE) #Et cut before tracking theChainDef.addSequence(theBjetEtHypo, jetForTrackingEtCut, jetEtHypoTE) theChainDef.addSequence(theBjetTracks, jetEtHypoTE, jetTrackTE) theChainDef.addSequence(theVxSecondary, [jetTrackTE, comboPrmVtxTE], secVtxTE) #GSC if ('gscThreshold' in chainParts) and chainParts['gscThreshold']: log.debug("Doing GSC Calculation:" + chainParts["gscThreshold"]) theChainDef.addSequence(theGSCFex, secVtxTE, gsc_jetTrackTEPreCut) theChainDef.addSequence(theGSCEtHypo, gsc_jetTrackTEPreCut, gsc_jetTrackTE) jetsForBTagging = gsc_jetTrackTE #secVtxTE = gsc_jetTrackTE+"__"+"superVtx" else: log.debug("No GSC Calculation") jetsForBTagging = secVtxTE #secVtxTE = jetTrackTE+"__"+"superVtx" theChainDef.addSequence([theBjetFex, theBtagReq], jetsForBTagging, lastTEout, topo_start_from=topoStartFrom) theChainDef.addSignature( theChainDef.signatureList[-1]['signature_counter'] + 1, [lastTEout] * int(btagmult)) return theChainDef
# tags for bjet vertex optimisation testing ##################################################### ## Primary vertex finding optimisations ##################################################### # if 'bjetEtaHalfWidth' in dir() or # 'bjetPhiHalfWidth' in dir() or # 'bjetJetMinEt' in dir() or # 'bjetNJetsMax' in dir() or # 'bjetDynamicMinJetEt' in dir() or # 'bjetDynamicNjetsMax' in dir() or # 'bjetDynamicEtFactor' in dir(): from TrigBjetHypo.TrigSuperRoiBuilderAllTEConfig import getSuperRoiBuilderAllTEInstance theSuperRoi=getSuperRoiBuilderAllTEInstance() # Vary size of SuperRoi constituents. Suggest Eta/PhiHalfWidth = 0.1, 0.15, 0.2 if 'bjetEtaHalfWidth' in dir(): theSuperRoi.EtaHalfWidth = bjetEtaHalfWidth if 'bjetPhiHalfWidth' in dir(): theSuperRoi.PhiHalfWidth = bjetPhiHalfWidth # Raise the pT threshold of jets used to construct the super ROI. Suggest 30, 35, 40 if 'bjetJetMinEt' in dir(): theSuperRoi.JetMinEt = bjetJetMinEt # Limit number of jets used to construct the super ROI. Suggest 5, 10, 15, 20 if 'bjetNJetsMax' in dir(): theSuperRoi.NJetsMax = NJetsMax
def buildBjetChainsAllTE(theChainDef, bjetdict, numberOfSubChainDicts=1): log.debug("In buildBjetChainsAllTE") inputTEsEF = theChainDef.signatureList[-1]['listOfTriggerElements'][0] useTRT = 'noTRT' not in bjetdict[0]['chainParts']['extra'] # # Initial Config # ###############################3 # # Get the min threshold for tracking # This cut is applied after the jet splitting # So we only run precision tracking in ROIs above the minimum considered # minBTagThreshold = 1e9 for bjetPart in bjetdict: thisBTagThresholdInt = int(bjetPart['chainParts']['threshold']) if thisBTagThresholdInt < minBTagThreshold: minBTagThreshold = thisBTagThresholdInt log.debug("min jet Pt %s", minBTagThreshold) # # Configure the GSC calibration # This cut is applied after the GSC calibration # So we only btag ROIs above the minimum considered # doGSC = False minGSCThreshold = 1e9 for bjetPart in bjetdict: if ('gscThreshold' in bjetPart['chainParts']) and ( bjetPart['chainParts']['gscThreshold']): doGSC = True thisGSCThresholdInt = int( bjetPart['chainParts']['gscThreshold'].replace("gsc", "")) if thisGSCThresholdInt < minGSCThreshold: minGSCThreshold = thisGSCThresholdInt if doGSC: log.debug("Doing GSC Calculation:" + str(minGSCThreshold) + "GeV") # # Now build the chain # ###########################3 # # super ROI building # theSuperRoi = getSuperRoiBuilderAllTEInstance() superTE = "HLT_super" theChainDef.addSequence(theSuperRoi, inputTEsEF, superTE) # # PV Tracking # if useTRT: [trkvtx, trkftf, trkprec] = TrigInDetSequence("Bjet", "bjet", "IDTrig", sequenceFlavour=["2step"]).getSequence() else: [trkvtx, trkftf, trkprec] = TrigInDetSequence("Bjet", "bjet", "IDTrig", sequenceFlavour=["2step", "noTRT"]).getSequence() tracking = "IDTrig" if not useTRT: tracking = tracking + "_noTRT" superTrackingTE = superTE + tracking theChainDef.addSequence(trkvtx, superTE, superTrackingTE) # # PV Finding # prmVertexTE = superTrackingTE + "_prmVtx" theChainDef.addSequence([EFHistoPrmVtxAllTE_Jet()], superTrackingTE, prmVertexTE) comboPrmVtxTE = prmVertexTE + "Combo" theChainDef.addSequence([EFHistoPrmVtxCombo_Jet()], [superTrackingTE, prmVertexTE], comboPrmVtxTE) # # Jet splitting # # get the minimum et before gsc cut theJetSplit = getJetSplitterAllTEInstance() jetHypoTE = "HLT_j" + str(minBTagThreshold) + "_eta" jetSplitTE = jetHypoTE + "_jsplit" if not useTRT: jetSplitTE = jetSplitTE + "_noTRT" theChainDef.addSequence(theJetSplit, [inputTEsEF, comboPrmVtxTE], jetSplitTE) # # If do the btagging in away muons # algoInstance = "EF" # # Et cut berfore running precision tracking # theBjetEtHypo = getBjetEtHypoInstance(algoInstance, "Btagging", str(minBTagThreshold) + "GeV") jetEtHypoTE = "HLT_j" + str(minBTagThreshold) if not useTRT: jetEtHypoTE = jetEtHypoTE + "_noTRT" theChainDef.addSequence(theBjetEtHypo, jetSplitTE, jetEtHypoTE) # # Precision tracking # if not useTRT: jetSplitTE = jetSplitTE.replace( "_noTRT", "") # remove noTRT since we are adding tracking !!!! jetTrackTE = jetSplitTE + "_" + tracking theBjetTracks = trkftf + trkprec theChainDef.addSequence(theBjetTracks, jetEtHypoTE, jetTrackTE) # # Secondary Vertexing # theVxSecondary = TrigVxSecondaryCombo_EF() secVtxTE = jetTrackTE + "__" + "secVtx" theChainDef.addSequence(theVxSecondary, [jetTrackTE, comboPrmVtxTE], secVtxTE) # # GSC calculation # if doGSC: gsc_jetTrackTEPreCut = "HLT_precut_gsc" + str( minBTagThreshold) + "_eta" + "_jsplit" + "_" + tracking theGSCFex = getGSCFexSplitInstance(algoInstance) theChainDef.addSequence(theGSCFex, secVtxTE, gsc_jetTrackTEPreCut) algoInstance = "GSC" gsc_jetTrackTE = "HLT_gsc" + str( minGSCThreshold) + "_eta" + "_jsplit" + "_" + tracking theGSCEtHypo = getBjetEtHypoInstance(algoInstance, "Btagging", str(minGSCThreshold) + "GeV") theChainDef.addSequence(theGSCEtHypo, gsc_jetTrackTEPreCut, gsc_jetTrackTE) jetsForBTagging = gsc_jetTrackTE else: log.debug("No GSC Calculation") jetsForBTagging = secVtxTE # # the tagging fex # log.debug("Getting tagging fex") theBjetFex = getBtagFexSplitInstance(algoInstance, "2012", "EFID") btaggingTE = jetsForBTagging + "_btagged" theChainDef.addSequence(theBjetFex, jetsForBTagging, btaggingTE) # # The btagging hypo # log.debug("Getting tagging hypo") lastTEout = "HLT_" + bjetdict[0]['chainName'] if not useTRT: lastTEout = lastTEout + "_noTRT" topoThresh = bjetdict[0]['topoThreshold'] topoStartFrom = setupTopoStartFrom(topoThresh, theChainDef) if topoThresh else None if topoStartFrom: lastTEout = lastTEout + '_tsf' # # Derive multiplicity requirements # log.debug("Derive multiplicity requirements") btagReqs = [] for bjetchain in bjetdict: log.debug(bjetdict) btagCut = bjetchain['chainParts']['bTag'] mult = bjetchain['chainParts']['multiplicity'] threshold = bjetchain['chainParts']['threshold'] if 'gscThreshold' in bjetchain['chainParts']: threshold = bjetchain['chainParts']['gscThreshold'].replace( "gsc", "") btagReqs.append([threshold, btagCut, mult]) log.debug("Config the ALLTE Hypo") name = bjetdict[0]['chainName'] theBjetHypoAllTE = getBjetHypoAllTEInstance("EF", "2017", name, btagReqs) #theChainDef.signatureList[-1]['listOfTriggerElements'][0] log.debug("Adding Sequence") theChainDef.addSequence(theBjetHypoAllTE, btaggingTE, lastTEout, topo_start_from=topoStartFrom) log.debug("Adding Signature") theChainDef.addSignature( theChainDef.signatureList[-1]['signature_counter'] + 1, [lastTEout]) log.debug("Left buildBjetChainsAllTE") theChainDef.chain_name = 'HLT_' + bjetdict[0]['chainName'] return theChainDef
def myBjetConfig_split(theChainDef, chainDict, inputTEsEF,numberOfSubChainDicts=1): L2ChainName = "L2_" + chainDict['chainName'] EFChainName = "EF_" + chainDict['chainName'] HLTChainName = "HLT_" + chainDict['chainName'] chainParts = chainDict['chainParts'] btagthresh = chainParts['threshold'] btagmult = chainParts['multiplicity'] btagcut = chainParts['bTag'] btagcut = btagcut[1:] btracking = chainParts['bTracking'] #----------------------------------------------------------------------------------- # Import of algs #----------------------------------------------------------------------------------- #b jet hypo from TrigBjetHypo.TrigBjetEtHypoConfig import getBjetEtHypoInstance theEtHypo = getBjetEtHypoInstance("EF","Btagging", btagthresh+"GeV") #jet splitting from TrigBjetHypo.TrigJetSplitterAllTEConfig import getJetSplitterAllTEInstance theJetSplit=getJetSplitterAllTEInstance() # bjet eta hypo from TrigBjetHypo.TrigBjetEtaHypoConfig import getBjetEtaHypoInstance theEtaHypo = getBjetEtaHypoInstance("EF", 2.5) etaHypoCut = '2.5' # super ROI building from TrigBjetHypo.TrigSuperRoiBuilderAllTEConfig import getSuperRoiBuilderAllTEInstance theSuperRoi=getSuperRoiBuilderAllTEInstance() # tracking from InDetTrigRecExample.EFInDetConfig import TrigEFIDSequence if 'EFID' in btracking: theBjet_tracks = TrigEFIDSequence("Bjet","bjet","InsideOut").getSequence() else: from TrigFastTrackFinder.TrigFastTrackFinder_Config import TrigFastTrackFinder_Jet theTrigFastTrackFinder_Jet = [TrigFastTrackFinder_Jet()] from TrigInDetConf.TrigInDetSequence import TrigInDetSequence theFastTrackFinderxAOD = TrigInDetSequence("Bjet","bjet","FastxAOD").getSequence() theBjet_tracks = TrigEFIDSequence("Bjet","bjet","DataPrep").getSequence() theBjet_tracks += theTrigFastTrackFinder_Jet theBjet_tracks += theFastTrackFinderxAOD theBjet_tracks += TrigEFIDSequence("Bjet","bjet","InsideOutMerged").getSequence() #include new tracking for vertexing here # vertexing from TrigT2HistoPrmVtx.TrigT2HistoPrmVtxAllTEConfig import EFHistoPrmVtxAllTE_Jet from TrigT2HistoPrmVtx.TrigT2HistoPrmVtxComboConfig import EFHistoPrmVtxCombo_Jet from InDetTrigVxSecondary.InDetTrigVxSecondary_LoadTools import TrigVxSecondary_EF theVxSecondary = TrigVxSecondary_EF() from TrigBjetHypo.TrigBjetFexConfig import getBjetFexInstance theBjetFex = getBjetFexInstance("EF","2012","EFID") if ('bperf' in chainParts['bTag'] or 'boffperf' in chainParts['bTag']): from TrigBjetHypo.TrigBjetHypoConfig import getBjetHypoNoCutInstance theBtagReq = getBjetHypoNoCutInstance("EF") else: from TrigBjetHypo.TrigBjetHypoConfig import getBjetHypoInstance theBtagReq = getBjetHypoInstance("EF","2012", btagcut) #----------------------------------------------------------------------------------- # TE naming #----------------------------------------------------------------------------------- if ('EFID' in chainParts['bTracking']): tracking = 'EFID' else: tracking = "IDTrig" #etHypoTE= "HLT_bj"+btagthresh #jetSplitTE = etHypoTE+"_jsplit" #etaHypoTE = jetSplitTE+'_eta'+etaHypoCut jetSplitTE = "HLT_jsplit" etHypoTE= jetSplitTE+"_bj"+btagthresh etaHypoTE = etHypoTE+'_eta'+etaHypoCut jetTrackTE = etaHypoTE+"_"+tracking superTE = "HLT_super" superTrackingTE = superTE+tracking prmVertexTE = superTrackingTE+"_prmVtx" comboPrmVtxTE = prmVertexTE+"Combo" secVtxTE = jetTrackTE+"__"+"superVtx" lastTEout = "HLT_"+chainParts['chainPartName'] if numberOfSubChainDicts>1 else EFChainName #if (btagmult == '1'): # ef7 = 'HLT_b%s_%s_%s_VxSecondaryAndBTagHypo' % (btagthresh, btagcut, chainParts['chainPartName'].replace("_"+chainParts['bTracking'],""), ) #else: # ef7 = 'HLT_%sb%s_%s_%s_VxSecondaryAndBTagHypo' % (btagmult, btagthresh, btagcut, chainParts['chainPartName'].replace("_"+chainParts['bTracking'],"")) #----------------------------------------------------------------------------------- # sequence assembling #----------------------------------------------------------------------------------- theChainDef.addSequence(theJetSplit, inputTEsEF, jetSplitTE) theChainDef.addSequence(theEtHypo, jetSplitTE, etHypoTE) theChainDef.addSequence(theEtaHypo, etHypoTE, etaHypoTE) theChainDef.addSequence(theBjet_tracks, etaHypoTE, jetTrackTE) theChainDef.addSequence(theSuperRoi, inputTEsEF, superTE) theChainDef.addSequence(theBjet_tracks, superTE, superTrackingTE) #to be replaced with new tracking theChainDef.addSequence([EFHistoPrmVtxAllTE_Jet()], superTrackingTE, prmVertexTE) theChainDef.addSequence([EFHistoPrmVtxCombo_Jet()], [superTrackingTE,prmVertexTE], comboPrmVtxTE) #theChainDef.addSequence(theVxSecondary, [jetTrackTE,comboPrmVtxTE], secVtxTE) theChainDef.addSequence(theVxSecondary, comboPrmVtxTE, secVtxTE) theChainDef.addSequence([theBjetFex, theBtagReq], secVtxTE, lastTEout) theChainDef.addSignature(theChainDef.signatureList[-1]['signature_counter']+1, [lastTEout]*int(btagmult)) return theChainDef