def __apply_configuration__(self): from HltLine.HltDecodeRaw import DecodeOT from HltLine.HltLine import Hlt1Line from Configurables import HltCosmicsOT from Hlt1Lines.Hlt1GECs import Hlt1GECUnit from HltTracking.HltSharedTracking import MinimalVelo, HltHPTTracking from HltLine.HltLine import Hlt1Member from HltLine.HltLine import Hlt1Line from HltLine.HltDecodeRaw import DecodeVELO from Configurables import LoKi__VoidFilter from HltTracking.HltPVs import PV3D from Hlt1Lines.Hlt1GECs import Hlt1GECUnit fltr_veloHits = self.__filterVeloHits("HighVeloMult", self.getProp("MinVeloHits"), self.getProp("MaxVeloHits")) fltr_veloHits_PV = self.__filterVeloHits( "HighVeloMultSinglePV", self.getProp("MinVeloHits_PV"), self.getProp("MaxVeloHits")) pvReco = PV3D('Hlt1') fltr_nPVs = LoKi__VoidFilter ( 'HighVeloMultSinglePV_NPVsFilter' , Code = " CONTAINS('%(pvLoc)s')==%(nPVs)s " \ % {"pvLoc" : pvReco.output, "nPVs": self.getProp("nPVs")}) Hlt1Line( 'HighVeloMult', prescale=self.prescale, postscale=self.postscale, ODIN=self.getProp('ODIN'), algos=[ Hlt1GECUnit( 'Activity' ) # cut on a minimum of hits in the tracking detectors , fltr_veloHits # select high velo multiplicity events ]) Hlt1Line( 'HighVeloMultSinglePV', prescale=self.prescale, postscale=self.postscale, ODIN=self.getProp('ODIN'), algos=[ Hlt1GECUnit( 'Activity' ) # cut on a minimum of hits in the tracking detectors , pvReco # Reconstruct PVs , fltr_nPVs # Filter on exactly 1 PV , fltr_veloHits_PV # select high velo multiplicity events ])
def hlt1B2GammaGammaLine_Streamer(self, name, props) : from Configurables import LoKi__HltUnit as HltUnit props['name'] = name DiPhotonUnitLineCode = """ L0CaloCandidates >> tee ( monitor( TC_SIZE > 0, '# pass CaloCandidates', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nCaloCandidates' , LoKi.Monitoring.ContextSvc ) ) >> TC_HLT1DIPHOTONMAKER( 'B_s0', '', %(GAMMA_PT_MIN)s, %(B_SUMPT_MIN)s, %(B_MASS_MIN)s, %(B_MASS_MAX)s, %(B_PT_MIN)s ) >> tee ( monitor( TC_SIZE > 0, '# pass DiPhoton', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nDiPhotons', LoKi.Monitoring.ContextSvc ) ) >> SINK ('Hlt1B2GammaGammaDecision') >> ~TC_EMPTY """ % props from Hlt1Lines.Hlt1GECs import Hlt1GECUnit from Configurables import LoKi__HltUnit as HltUnit from HltTracking.HltPVs import PV3D hlt1B2GammaGammaLine_DiPhotonUnit = HltUnit('Hlt1%sDiPhotonUnit' % name, #OutputLevel=1, Monitor=True, Preambulo=self.hlt1B2GammaGammaLine_Preambulo(props), Code=DiPhotonUnitLineCode) return [Hlt1GECUnit('Loose'), PV3D('Hlt1'), hlt1B2GammaGammaLine_DiPhotonUnit]
def hlt1TrackBlock_Streamer(self, name, props): from Hlt1Lines.Hlt1GECs import Hlt1GECUnit from Configurables import LoKi__HltUnit as HltUnit props['name'] = name lineCode = """ TrackCandidates >> FitTrack >> tee ( monitor( TC_SIZE > 0, '# pass TrackFit', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nFit' , LoKi.Monitoring.ContextSvc ) ) >> ( ( TrIDC('isVelo') > %(Velo_NHits)s ) & \ ( TrTNORMIDC > %(TrNTHits)s ) & \ ( TrNVELOMISS < %(Velo_Qcut)s ) ) >> tee ( monitor( TC_SIZE > 0, '# pass track quality', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nTrQ' , LoKi.Monitoring.ContextSvc ) ) >> ( ( TrPT > %(PT)s * MeV ) & \ ( TrP > %(P)s * MeV ) ) >> tee ( monitor( TC_SIZE > 0, '# pass P/PT', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nP' , LoKi.Monitoring.ContextSvc ) ) >> ( ( TrCHI2PDOF < %(TrChi2)s ) & \ ( Tr_HLTMIPCHI2 ( 'PV3D' ) > %(IPChi2)s ) ) >> tee ( monitor( TC_SIZE > 0, '# pass TrackChi2/IPChi2', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nChi2' , LoKi.Monitoring.ContextSvc ) ) >> SINK( 'Hlt1%(name)sDecision' ) >> ~TC_EMPTY """ % props preambulo, trackingAlgos = self.hlt1Track_Preambulo(name) hlt1TrackBlock_Unit = HltUnit('Hlt1' + name + 'Unit', Preambulo=preambulo, Code=lineCode) from HltTracking.HltPVs import PV3D return [ Hlt1GECUnit(props['GEC']), PV3D('Hlt1'), trackingAlgos, hlt1TrackBlock_Unit ]
def hltRICHMirrorBlock_Streamer( self, name, props ) : from Hlt1Lines.Hlt1GECs import Hlt1GECUnit from Configurables import LoKi__HltUnit as HltUnit props['name'] = name props['PhiCuts'] = ' | '.join(('in_range(%3.2f, TrPHI, %3.2f)' % box for box in props['Phis'])) lineCode = """ TrackCandidates >> FitTrack >> tee ( monitor( TC_SIZE > 0, '# pass TrackFit', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nFit' , LoKi.Monitoring.ContextSvc ) ) >> ( ( TrPT > %(PT)s ) & ( TrP > %(P)s ) & ( TrCHI2PDOF < %(TrChi2)s ) ) >> tee ( monitor( TC_SIZE > 0, '# pass P/PT/TrackChi2', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nP/PT/Chi2' , LoKi.Monitoring.ContextSvc ) ) >> ( ( in_range(%(MinETA)s, TrETA, %(MaxETA)s) ) & ( %(PhiCuts)s ) ) >> tee ( monitor( TC_SIZE > 0, '# pass P/PT/ETA/PHI', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , ' nP/PT/ETA/PHI', LoKi.Monitoring.ContextSvc ) ) >> SINK( 'Hlt1%(name)sDecision' ) >> (TC_SIZE > %(MinTr)s) """ % props hltRICHMirrorBlock_Unit = HltUnit( 'Hlt1'+name+'Unit', Preambulo = self.hltRICHMirror_Preambulo( name ), Code = lineCode ) from HltTracking.HltPVs import PV3D return [ Hlt1GECUnit( props[ 'GEC' ] ), PV3D('Hlt1'), hltRICHMirrorBlock_Unit ]
def singleElectron_streamer(self, properties): from Configurables import LoKi__HltUnit as HltUnit from Hlt1Lines.Hlt1GECs import Hlt1GECUnit properties['CaloCandidates'] = 'CaloCandidates' trackUnit = HltUnit( 'Hlt1%(name)sTrackStreamer' % properties, ##OutputLevel = 1 , Preambulo=self.singleElectron_preambulo(properties), Code=""" TrackCandidates >> FilterVeloL0Calo >> ( ( TrIDC('isVelo') > %(Velo_NHits)s ) & ( TrNVELOMISS < %(Velo_Qcut)s ) ) >> tee ( monitor( TC_SIZE > 0, '# pass match', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nMatched' , LoKi.Monitoring.ContextSvc ) ) >> (TrTNORMIDC > %(TrNTHits)s ) >> tee ( monitor( TC_SIZE > 0, '# pass forward', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nForward' , LoKi.Monitoring.ContextSvc ) ) >> ( ( TrPT > %(PT)s * MeV ) & ( TrP > %(P)s * MeV ) ) >> FitTrack >> tee ( monitor( TC_SIZE > 0, '# pass fit', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nFitted' , LoKi.Monitoring.ContextSvc ) ) >> ( ( TrCHI2PDOF < %(TrChi2)s ) ) >> SINK( 'Hlt1%(name)sDecision' ) >> ~TC_EMPTY """ % properties) return [ Hlt1GECUnit(properties['GEC']), self.getCaloUnit(properties), trackUnit ]
def __apply_configuration__(self): from Hlt1Lines.Hlt1GECs import Hlt1GECUnit gec = Hlt1GECUnit('Loose') from HltTracking.HltPVs import PV3D pvs = PV3D('Hlt1') from Hlt1SharedParticles import Hlt1SharedParticles sharedParticles = Hlt1SharedParticles() pions = sharedParticles.pionUnit() kaons = sharedParticles.kaonUnit() to_build = { 'Bottomonium2PhiPhi': [ gec, pvs, kaons, self.Phi_Unit(self.getProps()), self.HighPTPhi_Unit(self.getProps()), self.Bb2PhiPhi_Unit(self.getProps()) ], 'Bottomonium2KstarKstar': [ gec, pvs, kaons, pions, self.Kst_Unit(self.getProps()), self.HighPTKst_Unit(self.getProps()), self.Bb2KstKst_Unit(self.getProps()) ] } for line, algos in to_build.iteritems(): l0 = self.getProp("l0") self.build_line(line, algos, l0)
def oneTrackStreamer(self, name, props, inputParticles): from copy import deepcopy props = deepcopy(props) props['input'] = inputParticles.outputSelection() props['name'] = name from Configurables import LoKi__HltUnit as HltUnit unit = HltUnit('Hlt1%sUnit' % name, PVSelection="PV3D", Monitor=True, Code=""" SELECTION('%(input)s') >> (TRCHI2DOF < %(TrChi2)s) >> (((PT > %(MaxPT)s) & (BPVIPCHI2() > %(MinIPChi2)s)) | ( in_range( %(MinPT)s, PT, %(MaxPT)s) & (log(BPVIPCHI2()) > (%(Param1)s / ((PT / GeV - %(Param2)s) ** 2) + (%(Param3)s / %(MaxPT)s) * (%(MaxPT)s - PT) + math.log(%(MinIPChi2)s))))) >> SINK('Hlt1%(name)sDecision') >> ~TC_EMPTY """ % props, Preambulo=self.mvaPreambulo()) from Hlt1Lines.Hlt1GECs import Hlt1GECUnit from HltTracking.HltPVs import PV3D return [Hlt1GECUnit(props['GEC']), PV3D('Hlt1'), inputParticles, unit]
def __apply_configuration__(self) : from Hlt1Lines.Hlt1GECs import Hlt1GECUnit gec = Hlt1GECUnit('Loose') #from HltTracking.HltPVs import PV3D #pvs = PV3D('Hlt1') from Hlt1SharedParticles import Hlt1SharedParticles sharedParticles = Hlt1SharedParticles() protos = sharedParticles.protoParticleUnit() pions = sharedParticles.pionUnit() kaons = sharedParticles.kaonUnit() protons = sharedParticles.protonUnit() to_build = { 'SMOGKPi' : [ gec, #pvs, pions, kaons, self.KPi_Unit(self.getProps()), #self.D2KPi_Unit(self.getProps()) ] , 'SMOGKPiPi': [ gec, #pvs, pions, kaons, self.KPiPi_Unit(self.getProps()), #self.D2KPiPi_Unit(self.getProps()) ] , 'SMOGKKPi' : [ gec, #pvs, pions, kaons, self.KKPi_Unit(self.getProps()), #self.Ds2KKPi_Unit(self.getProps()) ] , 'SMOGpKPi' : [ gec, #pvs, protons, pions, kaons, self.pKPi_Unit(self.getProps()), #self.Lc2pKPi_Unit(self.getProps()) ] , 'SMOGGeneric': [ gec, pions, kaons, self.GenericKPi_Unit(self.getProps()), ] , 'SMOGSingleTrack': [ gec, pions, self.SingleTrackUnit(self.getProps()) ] } for line, algos in to_build.iteritems(): self.build_line( line, algos )
def multiDiMuon_streamer(self, properties): """ MultiDiMuon streamer starts from VeloTTCandidates but uses ComplementForward accessing directly long tracks if the velo segment was already upgraded. IsMuon is used for Long tracks, MatchVeloTTMuon for VeloTT and Velo ones. """ from Hlt1Lines.Hlt1GECs import Hlt1GECUnit from Configurables import LoKi__HltUnit as HltUnit from HltTracking.HltPVs import PV3D # Check that MuID is among the known tools if properties["MuID"] not in ["IsMuon", "IsMuonTight"]: raise KeyError( "MuID key is %(MuID)s which is not 'IsMuon' nor 'IsMuonTight', this is NOT OK." % properties) unit = HltUnit( 'Hlt1%(name)sStreamer' % properties, ##OutputLevel = 1 , Preambulo=self.diMuon_preambulo(properties), Code=""" VeloTTCandidates >> MatchVeloTTMuon >> tee ( monitor( TC_SIZE > 0, '# MatchMuon', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nMatched' , LoKi.Monitoring.ContextSvc ) ) >> ComplementForward >> tee ( monitor( TC_SIZE > 0, '# Complement', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nComp' , LoKi.Monitoring.ContextSvc ) ) >> FitTrack >> tee ( monitor( TC_SIZE > 0, '# pass fit', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nFitted' , LoKi.Monitoring.ContextSvc ) ) >> ( ( TrPT > %(PT)s * MeV ) & ( TrP > %(P)s * MeV ) ) >> tee ( monitor( TC_SIZE , 'n after P/PT' , LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE > 0, '# pass P/PT', LoKi.Monitoring.ContextSvc ) ) >> ( ( TrCHI2PDOF < %(TrChi2)s ) & ( Tr_HLTMIPCHI2( 'PV3D' ) > %(IPChi2)s ) ) >> tee ( monitor( TC_SIZE , 'n after Tr/IPChi2' , LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE > 0, '# pass Tr/IPChi2', LoKi.Monitoring.ContextSvc ) ) >> %(MuID)s >> tee ( monitor( TC_SIZE > 0, '# pass IsMuon', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nIsMuon' , LoKi.Monitoring.ContextSvc ) ) >> MakeDiMuons >> tee ( monitor( TC_SIZE > 0, '# pass vertex', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nVertices' , LoKi.Monitoring.ContextSvc ) ) >> ( RV_MASS ( 'mu+' , 'mu-' ) > %(M)s * MeV ) >> ( ( QProd == -1 ) | ( RV_MASS ( 'mu+' , 'mu-' ) > %(MSS)s * MeV ) ) >> tee ( monitor( TC_SIZE > 0, '# pass mass', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nDiMuons' , LoKi.Monitoring.ContextSvc ) ) >> SINK( 'Hlt1%(name)sDecision' ) >> TC_SIZE > %(NMinDiMu)s """ % properties) gec = properties['GEC'] return [ Hlt1GECUnit(gec), PV3D('Hlt1'), self.optionalHPT_tracking(properties['name']), unit ]
def _get_GEC(self): '''Get the GEC algorithm in a list.''' gec = self.getProp('UseGEC') if gec in ['Loose', 'Tight']: from Hlt1Lines.Hlt1GECs import Hlt1GECUnit return [Hlt1GECUnit(gec=gec)] elif not gec or gec == 'None': return [] else: raise ValueError('Unrecognized GEC value ({})!'.format(gec))
def __apply_configuration__(self): from HltLine.HltDecodeRaw import DecodeOT from HltLine.HltLine import Hlt1Line as Line from Configurables import HltCosmicsOT from Hlt1Lines.Hlt1GECs import Hlt1GECUnit Line('ActivitySPD', prescale=self.prescale, postscale=self.postscale, L0DU="( L0_DATA('Spd(Mult)') > %(pA_SpdMult)s )" % self.getProps(), algos=[]) Line('ActivityTracking', prescale=self.prescale, postscale=self.postscale, algos=[Hlt1GECUnit('Activity')]) from HltTracking.HltSharedTracking import MinimalVelo as microBiasVelo from HltLine.HltLine import Hlt1Member as Member from HltLine.HltLine import Hlt1Line as Line from HltLine.HltDecodeRaw import DecodeVELO from Configurables import LoKi__VoidFilter fltr = LoKi__VoidFilter( 'velohits', Preambulo=[ 'from LoKiPhys.decorators import *', 'from LoKiCore.functions import *' ], Code= " in_range( 5999 , CONTAINS('Raw/Velo/LiteClusters') , %(nVeloLowMultMicroBias)s ) " % self.getProps()) Line( 'ActivityVelo', prescale=self.prescale, postscale=self.postscale, # L0DU = "( L0_DATA('Spd(Mult)') < %(pA_LowMultSpd)s )" % self.getProps(), ODIN='jbit( ODIN_EVTTYP,2 )', algos=[ DecodeVELO, fltr, microBiasVelo, Member('Hlt::TrackFilter', 'All', Code=['TrALL'], InputSelection='TES:%s' % microBiasVelo.outputSelection(), OutputSelection='%Decision') ])
def diMuonDetached_streamer(self, properties): """ DiMuon streamer starts from VeloTTCandidates but uses ComplementForward accessing directly long tracks if the velo segment was already upgraded. IsMuon is used for Long tracks, MatchVeloTTMuon for VeloTT and Velo ones. """ from Hlt1Lines.Hlt1GECs import Hlt1GECUnit from Configurables import LoKi__HltUnit as HltUnit from HltTracking.HltPVs import PV3D unit = HltUnit( 'Hlt1%(name)sStreamer' % properties, ##OutputLevel = 1 , Preambulo=self.diMuon_preambulo(properties), Code=""" VeloTTCandidates >> MatchVeloTTMuon >> tee ( monitor( TC_SIZE > 0, '# MatchMuon', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nMatched' , LoKi.Monitoring.ContextSvc ) ) >> ComplementForward >> tee ( monitor( TC_SIZE > 0, '# Complement', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nComp' , LoKi.Monitoring.ContextSvc ) ) >> FitTrack >> tee ( monitor( TC_SIZE > 0, '# pass fit', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nFitted' , LoKi.Monitoring.ContextSvc ) ) >> ( ( TrPT > %(PT)s * MeV ) & ( TrP > %(P)s * MeV ) ) >> tee ( monitor( TC_SIZE , 'n after P/PT' , LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE > 0, '# pass P/PT', LoKi.Monitoring.ContextSvc ) ) >> ( ( TrCHI2PDOF < %(TrChi2)s ) & ( Tr_HLTMIPCHI2( 'PV3D' ) > %(IPChi2)s ) ) >> tee ( monitor( TC_SIZE , 'n after Tr/IPChi2' , LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE > 0, '# pass Tr/IPChi2', LoKi.Monitoring.ContextSvc ) ) >> IsMuon >> tee ( monitor( TC_SIZE > 0, '# pass IsMuon', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nIsMuon' , LoKi.Monitoring.ContextSvc ) ) >> MakeDiMuons >> tee ( monitor( TC_SIZE > 0, '# pass vertex', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nVertices' , LoKi.Monitoring.ContextSvc ) ) >> ( RV_MASS ( 'mu+' , 'mu-' ) > %(M)s * MeV ) >> ( ( QProd == -1 ) | ( RV_MASS ( 'mu+' , 'mu-' ) > %(MSS)s * MeV ) ) >> tee ( monitor( TC_SIZE > 0, '# pass mass', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nDiMuons' , LoKi.Monitoring.ContextSvc ) ) >> SINK( 'Hlt1%(name)sDecision' ) >> ~TC_EMPTY """ % properties) gec = properties['GEC'] return [ Hlt1GECUnit(gec), PV3D('Hlt1'), self.optionalHPT_tracking(properties['name']), unit ]
def hltHighPTLowMultiplicity_Streamer( self, name, props): from Hlt1Lines.Hlt1GECs import Hlt1GECUnit from HltTracking.HltPVs import PV3D from Configurables import LoKi__HltUnit as HltUnit from HltLine.HltLine import bindMembers props['name'] = name algos = [] gec = props["GEC"] algos.append( Hlt1GECUnit( props["GEC"] ) ) algos.append( PV3D('Hlt1') ) LowMultUnit = HltUnit( "Hlt1%(name)sLowMultStreamer" % props, Preambulo = self.hltLowMultiplicity_Preambulo( 'CalibHighPTLowMultTrksU1' ), Code = """ TrackCandidates >> FitTrack >> tee ( monitor( TC_SIZE , 'nFit' , LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE < %(MaxTr)s , 'nTrksLT' , LoKi.Monitoring.ContextSvc ) ) >> (TC_SIZE < %(MaxTr)s) """ % props ) algos.append( LowMultUnit ) TrackSelUnit = HltUnit( "Hlt1%(name)sTrackSelStreamer" % props, Preambulo = self.hltLowMultiplicity_Preambulo( 'CalibHighPTLowMultTrksU2' ), Code = """ TrackCandidates >> FitTrack >> tee ( monitor( TC_SIZE > 0, '# pass TrackFit', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nFit' , LoKi.Monitoring.ContextSvc ) ) >> ( ( TrPT > %(PT)s ) & ( TrP > %(P)s ) & ( TrCHI2PDOF < %(TrChi2)s ) ) >> tee ( monitor( TC_SIZE > 0, '# pass P/PT/TrackChi2', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nP/PT/Chi2' , LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nFit' , LoKi.Monitoring.ContextSvc ) ) >> SINK( 'Hlt1%(name)sDecision' ) >> (TC_SIZE > %(MinTr)s) """ % props ) algos.append( TrackSelUnit ) #return [ Hlt1GECUnit( props[ 'GEC' ] ), PV3D('Hlt1'), self.hltLowMultiplicity_Streamer( name, props)[0], hltHighPTLowMultiplicity_Unit ] return bindMembers( "Hlt1%(name)sAlgos" % props, algos ).setOutputSelection( "Hlt1%(name)sDecision" )
def singleTrackElectron_streamer(self, properties): from Configurables import LoKi__HltUnit as HltUnit from Hlt1Lines.Hlt1GECs import Hlt1GECUnit #properties[ 'CaloCandidates' ] = 'CaloCandidates' properties['CaloCandidates'] = 'TrackElectronCandidates' from Configurables import LoKi__HltUnit as HltUnit from HltTracking.Hlt1Tracking import L0CaloCandidates caloUnit = HltUnit('Hlt1%(name)sL0CaloStreamer' % properties, Preambulo=[L0CaloCandidates(properties['name'])], Code=""" L0CaloCandidates >> TC_CUT( LoKi.L0.L0CaloCut( 0, %(L0ElectronThreshold)s ), 0 ) >> tee ( monitor( TC_SIZE > 0, '# pass L0CaloCut', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nCaloCandidates' , LoKi.Monitoring.ContextSvc ) ) >> SINK( '%(CaloCandidates)s' ) >> ~TC_EMPTY """ % properties) trackUnit = HltUnit( 'Hlt1%(name)sTrackStreamer' % properties, ##OutputLevel = 1 , Preambulo=self.singleElectron_preambulo(properties), Code=""" TrackCandidates >> ( ( TrIDC('isVelo') > %(Velo_NHits)s ) & ( TrNVELOMISS < %(Velo_Qcut)s ) \ & ( Tr_HLTMIP ( 'PV3D' ) > %(IP)s * mm) ) >> (TrTNORMIDC > %(TrNTHits)s ) >> tee ( monitor( TC_SIZE > 0, '# pass forward', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nForward' , LoKi.Monitoring.ContextSvc ) ) >> ( ( TrPT > %(PT)s * MeV ) & ( TrP > %(P)s * MeV ) ) >> FitTrack >> tee ( monitor( TC_SIZE > 0, '# pass fit', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nFitted' , LoKi.Monitoring.ContextSvc ) ) >> ( ( TrCHI2PDOF < %(TrChi2)s )\ & ( Tr_HLTMIPCHI2 ( 'PV3D' ) > %(IPChi2)s ) ) >> FilterVeloL0Calo >> tee ( monitor( TC_SIZE > 0, '# pass match', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nMatched' , LoKi.Monitoring.ContextSvc ) ) >> SINK( 'Hlt1%(name)sDecision' ) >> ~TC_EMPTY """ % properties) from HltTracking.HltPVs import PV3D return [ Hlt1GECUnit(properties['GEC']), self.getCaloUnit(properties), PV3D('Hlt1'), trackUnit ]
def multiMuon_streamer(self, properties): """ MultiMuon streamer starts from VeloTTCandidates but uses ComplementForward accessing directly long tracks if the velo segment was already upgraded. IsMuon is used for Long tracks, MatchVeloTTMuon for VeloTT and Velo ones. """ from Hlt1Lines.Hlt1GECs import Hlt1GECUnit from Configurables import LoKi__HltUnit as HltUnit from HltTracking.HltPVs import PV3D unit = HltUnit( 'Hlt1%(name)sStreamer' % properties, ##OutputLevel = 1 , Preambulo=self.singleMuon_preambulo(properties), Code=""" VeloTTCandidates >> ( Tr_HLTMIP ( 'PV3D' ) > %(IP)s * mm ) >> MatchVeloTTMuon >> tee ( monitor( TC_SIZE > 0, '# MatchMuon', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nMatched' , LoKi.Monitoring.ContextSvc ) ) >> ComplementForward >> tee ( monitor( TC_SIZE > 0, '# Complement', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nComp' , LoKi.Monitoring.ContextSvc ) ) >> IsMuon >> tee ( monitor( TC_SIZE > 0, '# pass IsMuon', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nIsMuon' , LoKi.Monitoring.ContextSvc ) ) >> FitTrack >> tee ( monitor( TC_SIZE > 0, '# pass fit', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nFitted' , LoKi.Monitoring.ContextSvc ) ) >> ( ( TrPT > %(PT)s * MeV ) & ( TrP > %(P)s * MeV ) ) >> tee ( monitor( TC_SIZE , 'n after P/PT' , LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE > 0, '# pass P/PT', LoKi.Monitoring.ContextSvc ) ) >> ( TrCHI2PDOF < %(TrChi2)s ) >> tee ( monitor( TC_SIZE , 'n after TrChi2' , LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE > 0, '# pass TrChi2', LoKi.Monitoring.ContextSvc ) ) >> SINK( 'Hlt1%(name)sDecision' ) >> TC_SIZE > %(GT)s """ % properties) gec = properties['GEC'] # The final sequence of algorithms return [ Hlt1GECUnit(gec), PV3D('Hlt1'), self.optionalHPT_tracking(properties['name']), unit ]
def twoTrackStreamer(self, name, props, inputParticles): from copy import deepcopy props = deepcopy(props) props['input'] = inputParticles.outputSelection() props['name'] = name preambulo = self.mvaPreambulo() preambulo += [ "from LoKiArrayFunctors.decorators import APT, ACUTDOCACHI2", ("%(name)sCombinationConf = LoKi.Hlt1.Hlt1CombinerConf(strings(['K*(892)0 -> pi- pi+', '[K*(892)0 -> pi+ pi+]cc'])," + "((APT > %(V0PT)s) & (ACUTDOCACHI2(%(VxChi2)s,''))), ALL)") % props ] from Configurables import LoKi__HltUnit as HltUnit unit = HltUnit('Hlt1%sUnit' % name, PVSelection="PV3D", Monitor=True, Preambulo=preambulo) tool = self.classifier(unit, name, lambda: self.twoTrackVars(name)) props['tool'] = tool.getFullName() code = """ TC_HLT1COMBINER('', %(name)sCombinationConf, '%(input)s', ((PT > %(PT)s * MeV) & \ (P > %(P)s * MeV) & \ (TRCHI2DOF < %(TrChi2)s) & \ (BPVIPCHI2() > %(IPChi2)s))) >> tee(monitor(TC_SIZE > 0, '# V0', LoKi.Monitoring.ContextSvc)) >> tee(monitor(TC_SIZE , 'nV0s', LoKi.Monitoring.ContextSvc)) >> ( HASVERTEX & (VFASPF(VCHI2) < %(VxChi2)s) & \ (in_range(%(MinETA)s, BPVETA, %(MaxETA)s)) & \ (in_range(%(MinMCOR)s, BPVCORRM, %(MaxMCOR)s)) & \ (BPVDIRA > %(MinDirA)s) & \ (VALUE('%(tool)s') > %(Threshold)s)) >> SINK ('Hlt1%(name)sDecision') >> ~TC_EMPTY """ % props unit.Code = code unit.PreloadTools = [tool.getFullName()] from Hlt1Lines.Hlt1GECs import Hlt1GECUnit from HltTracking.HltPVs import PV3D return [Hlt1GECUnit(props['GEC']), PV3D('Hlt1'), inputParticles, unit]
def singleElectronPlusTrack_streamer(self, properties): from Configurables import LoKi__HltUnit as HltUnit from Hlt1Lines.Hlt1GECs import Hlt1GECUnit properties['CaloCandidates'] = 'ElectronTrackCandidates' #properties[ 'CaloCandidates' ] = 'CaloCandidates' trackUnit = HltUnit( 'Hlt1%(name)sTrackStreamer' % properties, ##OutputLevel = 1 , Preambulo=self.singleElectronPlusTrack_preambulo(properties), Code=""" TrackCandidates >> ( ( TrIDC('isVelo') > %(Velo_NHits)s ) & ( TrNVELOMISS < %(Velo_Qcut)s ) \ & ( Tr_HLTMIP ( 'PV3D' ) > %(IP)s * mm) ) >> tee ( monitor( TC_SIZE > 0, '# pass match', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nMatched' , LoKi.Monitoring.ContextSvc ) ) >> (TrTNORMIDC > %(TrNTHits)s ) >> tee ( monitor( TC_SIZE > 0, '# pass forward', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nForward' , LoKi.Monitoring.ContextSvc ) ) >> ( ( TrPT > %(PT)s * MeV ) & ( TrP > %(P)s * MeV ) ) >> FitTrack >> tee ( monitor( TC_SIZE > 0, '# pass fit', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nFitted' , LoKi.Monitoring.ContextSvc ) ) >> ( ( TrCHI2PDOF < %(TrChi2)s )\ & ( Tr_HLTMIPCHI2 ( 'PV3D' ) > %(IPChi2)s ) ) >> MakeVertex >> tee ( monitor( TC_SIZE > 0, '# pass vertex', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nVertices' , LoKi.Monitoring.ContextSvc ) ) >> ( RV_MASS ( 'e+' , 'e-' ) < %(M)s * MeV ) >> tee ( monitor( TC_SIZE > 0, '# pass mass', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nPassedMassCut' , LoKi.Monitoring.ContextSvc ) ) >> ( RV_TrHAS( MatchVeloL0CaloCands ) ) >> tee ( monitor( TC_SIZE > 0, '# has electron', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , 'nHasElectron' , LoKi.Monitoring.ContextSvc ) ) >> SINK( 'Hlt1%(name)sDecision' ) >> ~TC_EMPTY """ % properties) gec = properties['GEC'] from HltTracking.HltPVs import PV3D return [ Hlt1GECUnit(gec), self.getCaloUnit(properties), PV3D('Hlt1'), trackUnit ]
def __hlt1_monitoring(self, lines1): monSeq = Sequence("Hlt1MonitorSequence", IgnoreFilterPassed=True) l0Mon = self.__l0_monitoring("Hlt1") monSeq.Members += l0Mon # Tell the monitoring what it should expect.. # the keys are the Labels for the Histograms in the GUI # the values are the Pattern Rules to for the Decisions contributing ## Global monitor from Configurables import HltGlobalMonitor globalMon = self.__globalMonitor("Hlt1") globalMon.DecToGroup = self.__groupLines( [i.decision() for i in lines1], [ ("L0", "Hlt1L0.*Decision"), ("LumiBeamGas", "Hlt1(Lumi|BeamGas).*Decision"), ("SingleMuon", "Hlt1(Single|Track)Muon.*Decision"), ("DiMuon", "Hlt1DiMuon.*Decision"), ("TrackMVA", "Hlt1(Two)?TrackMVADecision"), ("ECAL", "Hlt1.*(Electron|Photon).*Decision"), ("LowMult", "Hlt1LowMult.*Decision"), ("Beauty", "Hlt1B2.*Decision"), ("Commissioning", "Hlt1(ODIN.*|Tell1Error|Incident)Decision"), ("MinBias", "Hlt1MB.*Decision"), ("Calibration", "Hlt1CalibTracking.*"), ("Global", ".*Global.*"), ( "Other", ".*" ) # add a 'catch all' term to pick up all remaining decisions... ]) if self.getProp("EnableGlobalMonitor"): monSeq.Members.append(globalMon) ## Mass monitor from Configurables import HltMassMonitor from DAQSys.Decoders import DecoderDB massMon = HltMassMonitor("Hlt1MassMonitor") massMon.DecReportsLocation = DecoderDB[ "HltDecReportsDecoder/Hlt1DecReportsDecoder"].listOutputs()[0] massMon.SelReportsLocation = DecoderDB[ "HltSelReportsDecoder/Hlt1SelReportsDecoder"].listOutputs()[0] massMon.Decisions = { "Jpsi": "Hlt1DiMuonHighMassDecision", "JpsiAlign": "Hlt1CalibMuonAlignJpsiDecision", "D0->Kpi(det)": 'Hlt1CalibTrackingKPiDetachedDecision', "D0->Kpi": 'Hlt1CalibTrackingKPiDecision', "D0->KK": 'Hlt1CalibTrackingKKDecision', "D0->pipi": "Hlt1CalibTrackingPiPiDecision", "phi->KK": "Hlt1IncPhiDecision" } massMon.DecisionStructure = {"Jpsi": [105.658, 105.658]} massMon.Histograms = { "Jpsi": [3010, 3190, 90], "JpsiAlign": [3010, 3190, 90], "D0->Kpi(det)": [1815, 1915, 50], "D0->Kpi": [1815, 1915, 50], "D0->KK": [1815, 1915, 50], "D0->pipi": [1815, 1915, 50], "phi->KK": [1000, 1040, 80] } if self.getProp("EnableMassMonitor"): monSeq.Members.append(massMon) # Setup the track monitoring from Configurables import Hlt1TrackMonitor import HltTracking from HltTracking.HltSharedTracking import MinimalVelo, VeloTTTracking, HltHPTTracking from Configurables import DeterministicPrescaler trackMon = Hlt1TrackMonitor("Hlt1TrackMonitor") trackMon.VeloTrackLocation = MinimalVelo.outputSelection() trackMon.VeloTTTrackLocation = VeloTTTracking.outputSelection() trackMon.ForwardTrackLocation = HltHPTTracking.outputSelection() # This is not so nice but currently unavoidable from HltTracking.Hlt1TrackNames import Hlt1TrackLoc from HltTracking.HltTrackNames import HltDefaultFitSuffix trackMon.FittedTrackLocation = Hlt1TrackLoc["FitTrack"] from Hlt1Lines.Hlt1GECs import Hlt1GECUnit gecUnit = Hlt1GECUnit(self.getProp("Hlt1TrackMonitorGEC")) prescaler = DeterministicPrescaler( "Hlt1TrackMonitorPrescaler", AcceptFraction=self.getProp("Hlt1TrackMonitorPrescale")) trackMonSeq = Sequence('Hlt1TrackMonitorSequence', Members=[gecUnit, prescaler] + HltHPTTracking.members() + [trackMon]) if self.getProp("EnableTrackMonitor"): monSeq.Members.append(trackMonSeq) return monSeq
def __apply_configuration__(self): from Hlt1Lines.Hlt1GECs import Hlt1GECUnit gec = Hlt1GECUnit('Loose') from HltTracking.HltPVs import PV3D pvs = PV3D('Hlt1') from Hlt1SharedParticles import Hlt1SharedParticles sharedParticles = Hlt1SharedParticles() pions = sharedParticles.pionUnit() kaons = sharedParticles.kaonUnit() to_build = { 'CalibTrackingKPi': [ gec, pvs, pions, kaons, self.KPi_Unit(self.getProps()), self.D2KPi_Unit(self.getProps()) ], 'CalibTrackingKPiDetached': [ gec, pvs, pions, kaons, self.KPi_Unit(self.getProps()), self.D2KPiDetached_Unit(self.getProps()) ], 'CalibTrackingKK': [ gec, pvs, kaons, self.KK_Unit(self.getProps()), self.D2KK_Unit(self.getProps()) ], 'CalibTrackingPiPi': [ gec, pvs, pions, self.PiPi_Unit(self.getProps()), self.D2PiPi_Unit(self.getProps()) ], 'B2HH_LTUNB_KPi': [ gec, pvs, pions, kaons, self.KPi_Unit(self.getProps()), self.B2KPi_Unit(self.getProps()) ], 'B2HH_LTUNB_KK': [ gec, pvs, kaons, self.KK_Unit(self.getProps()), self.B2KK_Unit(self.getProps()) ], 'B2HH_LTUNB_PiPi': [ gec, pvs, pions, self.PiPi_Unit(self.getProps()), self.B2PiPi_Unit(self.getProps()) ], 'IncPhi': [ gec, pvs, kaons, self.KK_Unit(self.getProps()), self.IncPhi_Unit(self.getProps()) ], 'B2PhiPhi_LTUNB': [ gec, pvs, kaons, self.KK_Unit(self.getProps()), self.LTUNBPhi_Unit(self.getProps()), self.B2PhiPhi_Unit(self.getProps()) ], 'B2PhiGamma_LTUNB': [ gec, pvs, kaons, self.Gamma_Unit(self.getProps()), self.KK_Unit(self.getProps()), self.LTUNBPhi_Unit(self.getProps()), self.B2PhiGamma_Unit(self.getProps()) ] } for line, algos in to_build.iteritems(): l0 = "L0_DECISION_PHYSICS" if 'Gamma' in line: l0 = "|".join([ "L0_CHANNEL('%s')" % channel for channel in ['Photon', 'Electron'] ]) self.build_line(line, algos, l0)
def vertexDisplVertex_streamer(self, properties): from Hlt1Lines.Hlt1GECs import Hlt1GECUnit from HltTracking.HltPVs import PV3D from Configurables import LoKi__HltUnit as HltUnit from HltLine.HltLine import bindMembers algos = [] gec = properties["GEC"] algos.append(Hlt1GECUnit(properties["GEC"])) algos.append(PV3D('Hlt1')) trackUnit = HltUnit( "Hlt1%(name)sTrackStreamer" % properties, Preambulo=self.vertexDisplVertex_trackPreambulo(properties), Code=""" VeloCandidates >> tee ( monitor( TC_SIZE>0, '# events pass Velo candidates', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , '# candidates pass Velo candidates', LoKi.Monitoring.ContextSvc ) ) >> ( ( TrNCONSECVELOSPACEPOINTS > %(VELO_NCSP)s ) & ( TrNVELOSPACEPOINTS > %(VELO_NSP)s ) ) >> tee ( monitor( TC_SIZE>0, '# events pass Velo spacepoints cuts', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , '# candidates pass Velo spacepoints cuts', LoKi.Monitoring.ContextSvc ) ) >> ( Tr_FASTDOCATOBEAMLINE(5.) > %(DOCABL)s ) >> tee ( monitor( TC_SIZE>0, '# events pass DOCABL cut', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , '# candidates pass DOCABL cut', LoKi.Monitoring.ContextSvc ) ) >> SINK( 'Hlt1%(name)sTracks' ) >> ~TC_EMPTY """ % properties) algos.append(trackUnit) if "TracksForVx" in properties: combinatoricsGECUnit = HltUnit("Hlt1%(name)sCombinatoricsCut" % properties, Code=""" SELECTION('Hlt1%(name)sTracks') >> monitor( TC_SIZE , Gaudi.Histo1DDef('# tracks for vertexing', 0., 100., 100 ), 'hNTracksForVertexing%(name)s' ) < %(TracksForVx)s """ % properties) algos.append(combinatoricsGECUnit) vertexUnit = HltUnit( "Hlt1%(name)sStreamer" % properties, Preambulo=self.vertexDisplVertex_vertexPreambulo(properties), Code=""" SELECTION ( 'Hlt1%(name)sTracks' ) >> MakeDisplVertices >> tee ( monitor( TC_SIZE>0, '# events pass displaced vertex making', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , '# candidates pass displaced vertex making', LoKi.Monitoring.ContextSvc ) ) >> ( VX_BEAMSPOTRHO(5.) > %(VX_RHO)s ) >> tee ( monitor( TC_SIZE>0, '# events pass RHO cut', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , '# candidates pass RHO cut', LoKi.Monitoring.ContextSvc ) ) >> LooseForward >> tee ( monitor( TC_SIZE>0, '# events pass forward', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , '# candidates pass forward', LoKi.Monitoring.ContextSvc ) ) >> HLT_TCASRVC_ANY( ( TrPT > %(Tr_PT)s ) & ( TrP > %(Tr_P)s), True ) >> tee ( monitor( TC_SIZE>0, '# events pass P, PT cut', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , '# candidates pass P, PT cut', LoKi.Monitoring.ContextSvc ) ) >> FitTracks >> tee ( monitor( TC_SIZE>0, '# events pass track fit', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , '# candidates pass track fit', LoKi.Monitoring.ContextSvc ) ) >> HLT_TCASRVC_ANY( ( TrCHI2PDOF < %(Tr_CHI2)s ), True ) >> tee ( monitor( TC_SIZE>0, '# events pass track CHI2 cut', LoKi.Monitoring.ContextSvc ) ) >> tee ( monitor( TC_SIZE , '# candidates pass track CHI2', LoKi.Monitoring.ContextSvc ) ) >> SINK( 'Hlt1%(name)sDecision' ) >> ~TC_EMPTY """ % properties) algos.append(vertexUnit) return bindMembers("Hlt1%(name)sAlgos" % properties, algos).setOutputSelection("Hlt1%(name)sDecision")