##TODO adding recSVs and recMus changes the daughters of jet objects from smart poniters to Particles DaVinci().DataType = '2017' DaVinci().EventPreFilters = fltrs.filters('Filters') from Configurables import LumiIntegrateFSR, LumiIntegratorConf LumiIntegrateFSR('IntegrateBeamCrossing').SubtractBXTypes = ['None'] # Configure the BDT tagger. from Configurables import LoKi__BDTTag tagger = LoKi__BDTTag() tagger.NbvSelect = False tagger.Backwards = True from Configurables import ToolSvc, TriggerTisTos for stage in ('Hlt1', 'Hlt2', 'Strip/Phys'): ToolSvc().addTool(TriggerTisTos, stage + "TriggerTisTos") tool = getattr(ToolSvc(), stage + "TriggerTisTos") tool.HltDecReportsLocation = '/Event/' + stage + '/DecReports' tool.HltSelReportsLocation = '/Event/' + stage + '/SelReports' # Access to classes. from collections import OrderedDict import ROOT, array, GaudiPython from GaudiPython.Bindings import gbl STD = gbl.std LHCB = gbl.LHCb from Ntuple import Ntuple # GaudiPython configuration. gaudi = GaudiPython.AppMgr()
# file /build/jenkins-tests/workspace/nightly-builds/checkout/tmp/checkout/DBASE/Gen/DecFiles/v30r41/options/11102432.py generated: Mon, 16 Dec 2019 12:50:06 # # Event Type: 11102432 # # ASCII decay Descriptor: {[[B0]nos -> K+ pi- (pi0 -> gamma gamma)]cc, [[B0]os -> K- pi+ (pi0 -> gamma gamma)]cc} # from Configurables import Generation Generation().EventType = 11102432 Generation().SampleGenerationTool = "SignalRepeatedHadronization" from Configurables import SignalRepeatedHadronization Generation().addTool(SignalRepeatedHadronization) Generation().SignalRepeatedHadronization.ProductionTool = "PythiaProduction" from Configurables import ToolSvc from Configurables import EvtGenDecay ToolSvc().addTool(EvtGenDecay) ToolSvc( ).EvtGenDecay.UserDecayFile = "$DECFILESROOT/dkfiles/Bd_K+pi-pi0=DecProdCut,sqDalitz.dec" Generation().SignalRepeatedHadronization.CutTool = "DaughtersInLHCb" Generation().SignalRepeatedHadronization.SignalPIDList = [511, -511] Generation().PileUpTool = "FixedNInteractions"
############################################################################ ## Set properties of particles to be generated ## momentum properties ParticleGun().addTool(MomentumRange) ParticleGun().ParticleGunTool = "MomentumRange" ## number of particles (default=1) ParticleGun().addTool(FlatNParticles) ParticleGun().NumberOfParticlesTool = "FlatNParticles" ParticleGun().EventType = 52210001 ############################################################################ ## Add event decay tool (not clear if needed) ToolSvc().addTool(EvtGenDecay) ToolSvc( ).EvtGenDecay.UserDecayFile = "$DECFILESROOT/dkfiles/mu+mu-,fixP=TrkAcc.dec" ## Commented out TrackerAcceptance script as it restricts theta-phi range to LHCb #from Gaudi.Configuration import * #importOptions( "$DECFILESROOT/options/TrackersAcceptance.py" ) ## Following code is non-theta-phi related code remaining in TrackerAcceptance (unclear if necessary) from Configurables import GenInit, SimInit, GaudiSequencer GenInit("GaussGen").PrintFreq = 100 SimInit("GaussSim").PrintFreq = 100 ############################################################################## # Monopole physics
# file /build/jenkins-tests/workspace/nightly-builds/checkout/tmp/checkout/DBASE/Gen/DecFiles/v31r0/options/51000034.py generated: Fri, 05 Oct 2018 16:18:46 # # Event Type: 51000000 # # ASCII decay Descriptor: e- => ? # from Configurables import ParticleGun from Configurables import MomentumRange ParticleGun().addTool( MomentumRange ) from GaudiKernel import SystemOfUnits ParticleGun().MomentumRange.MomentumMin = 33.8*SystemOfUnits.GeV from GaudiKernel import SystemOfUnits ParticleGun().MomentumRange.MomentumMax = 33.8*SystemOfUnits.GeV ParticleGun().EventType = 51000034 ParticleGun().ParticleGunTool = "MomentumRange" ParticleGun().NumberOfParticlesTool = "FlatNParticles" ParticleGun().MomentumRange.PdgCodes = [ 11 ] from Configurables import ToolSvc from Configurables import EvtGenDecay ToolSvc().addTool( EvtGenDecay ) ToolSvc().EvtGenDecay.UserDecayFile = "$DECFILESROOT/dkfiles/e-,fixP=CaloAcc.dec" from Gaudi.Configuration import * importOptions( "$DECFILESROOT/options/CaloAcceptance.py" )
## Helper functions from Hlt1TrackNames import Hlt1Tools def to_name(key): return Hlt1Tools[key] def ConfiguredVeloL0Calo(parent, name=None, chi2=9): if name == None: name = Hlt__MatchVeloL0Calo.__name__ return Hlt1Tool(Hlt__MatchVeloL0Calo, name, MaxMatchChi2=chi2).createConfigurable(parent) ## Configure tool, set the match chi2 ConfiguredVeloL0Calo(ToolSvc(), to_name("VeloL0Calo"), 9) ## Streamer symbol def FilterVeloL0Calo(selection): return "FilterVeloL0Calo = TC_MATCHFLTR( '%s', HltTracking.Hlt1StreamerConf.VeloL0Calo )" \ % selection def MatchVeloL0CaloCands(selection): return "MatchVeloL0CaloCands = TC_MATCHCANDS( '%s', HltTracking.Hlt1StreamerConf.VeloL0Calo )" \ % selection def ConfiguredTrackL0Calo(parent, name=None, chi2=9): if name == None: name = Hlt__Track2L0CaloMatch.__name__
#Generation().SampleGenerationTool = "SignalRepeatedHadronization" #from Configurables import SignalRepeatedHadronization #Generation().addTool( SignalRepeatedHadronization ) #Generation().SignalRepeatedHadronization.ProductionTool = "PythiaProduction" #Generation().SignalRepeatedHadronization.CutTool = "DaughtersInLHCb" #Generation().SignalRepeatedHadronization.SignalPIDList = [ 511,-511 ] # Ad-hoc particle gun code from Configurables import ParticleGun pgun = ParticleGun("ParticleGun") pgun.SignalPdgCode = 511 from Configurables import ToolSvc from Configurables import EvtGenDecay ToolSvc().addTool(EvtGenDecay) ToolSvc( ).EvtGenDecay.UserDecayFile = "$DECFILESROOT/dkfiles/Bd_Kstgamma=DecProdCut.dec" pgun.DecayTool = "EvtGenDecay" pgun.GenCutTool = "DaughtersInLHCb" from Configurables import FlatNParticles pgun.NumberOfParticlesTool = "FlatNParticles" pgun.addTool(FlatNParticles, name="FlatNParticles") from Configurables import MomentumSpectrum pgun.ParticleGunTool = "MomentumSpectrum" pgun.addTool(MomentumSpectrum, name="MomentumSpectrum") pgun.MomentumSpectrum.PdgCodes = [511, -511] pgun.MomentumSpectrum.InputFile = "$PGUNSDATAROOT/data/Ebeam6500GeV/MomentumSpectrum_521.root"
# file /build/jenkins-tests/workspace/nightly-builds/checkout/tmp/checkout/DBASE/Gen/DecFiles/v30r43/options/15102430.py generated: Wed, 26 Feb 2020 18:42:35 # # Event Type: 15102430 # # ASCII decay Descriptor: [ Lambda_b0 -> p+ K- pi0 ]cc # from Configurables import Generation Generation().EventType = 15102430 Generation().SampleGenerationTool = "SignalPlain" from Configurables import SignalPlain Generation().addTool(SignalPlain) Generation().SignalPlain.ProductionTool = "PythiaProduction" from Configurables import ToolSvc from Configurables import EvtGenDecay ToolSvc().addTool(EvtGenDecay) ToolSvc( ).EvtGenDecay.UserDecayFile = "$DECFILESROOT/dkfiles/Lb_pKpi0=DecProdCut.dec" Generation().SignalPlain.CutTool = "DaughtersInLHCb" Generation().SignalPlain.SignalPIDList = [5122, -5122] Generation().PileUpTool = "FixedNInteractions"
def applyConf(self): _log.info('Apply CaloProcessor configuration for %s and %s', self.getProp('RecList'), self.getProp('PIDList')) self.printConf() knownMasks = ['3x3', '2x2', 'SwissCross'] for tag in self.getProp('ClusterEnergyMasks'): if tag not in knownMasks: raise AttributeError, 'ClusterEnergyMasks contains unknown tag' + tag + ' -should be in' + knownMasks for tag in self.getProp('ClusterPositionMasks'): if tag not in knownMasks: raise AttributeError, 'PositionEnergyMasks contains unknown tag ' + tag + ' -should be in' + knownMasks from Configurables import ( GaudiSequencer, ChargedProtoParticleAddEcalInfo, ChargedProtoParticleAddBremInfo, ChargedProtoParticleAddHcalInfo, ChargedProtoParticleAddPrsInfo, ChargedProtoParticleAddSpdInfo, ChargedProtoParticleMaker, ChargedProtoCombineDLLsAlg) fullSeq = [] if self.getName() == 'CaloProcessor' and (self.getProp('Context') == '' or self.getProp('Context') == 'CaloProcessor'): self.setProp( 'Context', 'Offline' ) # default is Offline is neither context nor name is specified # prepare the NoSpdPrs configuration if self.getProp('NoSpdPrs'): self.setProp('UseSpd', False) self.setProp('UsePrs', False) self.setProp('UseSpdE', False) self.setProp('UsePrsE', False) # configure the public getter tool from Configurables import ToolSvc, CaloGetterTool tsvc = ToolSvc() tsvc.addTool(CaloGetterTool, name="CaloGetter") tsvc.CaloGetter.DetectorMask = 12 # overwrite Reco & PID onDemand dod = self.getProp('EnableOnDemand') pdod = self.getProp('ProtoOnDemand') if dod: pdod = dod self.setProp('EnableRecoOnDemand', dod) ## define the calo sequence caloSeq = [] doReco = self.getProp('CaloReco') doPIDs = self.getProp('CaloPIDs') skipNeutrals = self.getProp('SkipNeutrals') skipCharged = self.getProp('SkipCharged') context = self.getProp('Context') # CaloReco sequence recoSeq = getAlgo(GaudiSequencer, "CaloRecoFor" + self.getName(), context) recoSeq.Members[:] = [] recList = self.getProp('RecList') # configure all components by default (DoD) forceOnDemand = self.getProp('ForceOnDemand') if forceOnDemand: self.setProp('EnableOnDemand', 'True') self.setProp('EnableRecoOnDemand', 'True') dig = self.digits() clu = self.clusters() pho = self.photons() mer = self.mergedPi0s() ele = self.electrons() # add only the requested components to the sequence if 'Digits' in recList: addAlgs(recoSeq, self.digits()) CaloDigitConf().printConf() if 'Clusters' in recList: addAlgs(recoSeq, self.clusters()) if 'Digits' not in recList: CaloDigitConf().printConf() if not skipNeutrals: if 'Photons' in recList: addAlgs(recoSeq, self.photons()) if 'MergedPi0s' in recList or 'SplitPhotons' in recList: addAlgs(recoSeq, self.mergedPi0s()) if not skipCharged: if 'Electrons' in recList: addAlgs(recoSeq, self.electrons()) # CaloPIDs sequence # pidSeq = getAlgo( GaudiSequencer , "CaloPIDsSeq" , context ) # addAlgs ( pidSeq , self.caloPIDs () ) pidSeq = self.caloPIDs() # update CaloSequence if doReco: addAlgs(caloSeq, recoSeq) if doPIDs: addAlgs(caloSeq, pidSeq) ## propagate the global properties setTheProperty(caloSeq, 'Context', self.getProp('Context')) setTheProperty(caloSeq, 'MeasureTime', self.getProp('MeasureTime')) if self.isPropertySet("OutputLevel"): setTheProperty(caloSeq, 'OutputLevel', self.getProp('OutputLevel')) ######## ProtoParticle update ########## protoSeq = [] cProtoSeq = [] nProtoSeq = [] # ProtoParticle locations nloc = self.getProp('NeutralProtoLocation') cloc = self.getProp('ChargedProtoLocation') # try automatic location if not explicit for HLT's sequence if hltContext(self.getProp('Context')): if nloc == '': if nloc.find('/') == -1: nloc = context + '/ProtoP/Neutrals' else: nloc = context.replace('/', '/ProtoP/', 1) + '/Neutrals' if cloc == '': if cloc.find('/') == -1: cloc = context + '/ProtoP/Charged' else: cloc = context.replace('/', '/ProtoP/', 1) + '/Charged' # Confuse Configurable if cloc != '': if cloc.find('/Event/') != 0: cloc = '/Event/' + cloc if nloc != '': if nloc.find('/Event/') != 0: nloc = '/Event/' + nloc # ChargedProtoParticle if not self.getProp('SkipCharged'): suffix = "For" + self.getName() ecal = getAlgo(ChargedProtoParticleAddEcalInfo, "ChargedProtoPAddEcal" + suffix, context) brem = getAlgo(ChargedProtoParticleAddBremInfo, "ChargedProtoPAddBrem" + suffix, context) hcal = getAlgo(ChargedProtoParticleAddHcalInfo, "ChargedProtoPAddHcal" + suffix, context) if not self.getProp('NoSpdPrs'): prs = getAlgo(ChargedProtoParticleAddPrsInfo, "ChargedProtoPAddPrs" + suffix, context) spd = getAlgo(ChargedProtoParticleAddSpdInfo, "ChargedProtoPAddSpd" + suffix, context) comb = getAlgo(ChargedProtoCombineDLLsAlg, "ChargedProtoPCombineDLLs" + suffix, context) # ChargedProtoP Maker on demand (not in any sequencer) #### maker = getAlgo(ChargedProtoParticleMaker, "ChargedProtoMaker", context, cloc, pdod) # protoPMaker settings (from GlobalRecoConf) from Configurables import DelegatingTrackSelector, GaudiSequencer ## ppConf = GlobalRecoConf('DummyConf',RecoSequencer=GaudiSequencer('DummySeq')) ##ttypes = ppConf.getProp('TrackTypes') ##tcuts = ppConf.getProp('TrackCuts') ttypes = self.getProp('TrackTypes') tcuts = self.getProp('TrackCuts') maker.addTool(DelegatingTrackSelector, name="TrackSelector") maker.TrackSelector.TrackTypes = ttypes from Configurables import TrackSelector for type in ttypes: maker.TrackSelector.addTool(TrackSelector, name=type) ts = getattr(maker.TrackSelector, type) ts.TrackTypes = [type] if type in tcuts: for name, cut in tcuts[type].iteritems(): ts.setProp("Min" + name, cut[0]) ts.setProp("Max" + name, cut[1]) ######################################### if cloc != '': maker.Output = cloc ## confuse configurable on purpose _locs = self.getProp('TrackLocations') _elocs = [] for l in _locs: if l.find('/Event/') != 0: l = '/Event/' + l _elocs.append(l) if not hltContext(self.getProp('Context')) and _elocs: maker.Inputs = _elocs # location if cloc != '': ecal.ProtoParticleLocation = cloc brem.ProtoParticleLocation = cloc hcal.ProtoParticleLocation = cloc if not self.getProp('NoSpdPrs'): prs.ProtoParticleLocation = cloc spd.ProtoParticleLocation = cloc comb.ProtoParticleLocation = cloc # Fill the sequence cpSeq = getAlgo(GaudiSequencer, self.getName() + "ChargedProtoPCaloUpdateSeq", context) cpSeq.Members = [ecal, brem, hcal] if not self.getProp('NoSpdPrs'): cpSeq.Members += [prs, spd] cpSeq.Members += [comb] addAlgs(protoSeq, cpSeq) addAlgs(cProtoSeq, cpSeq.Members) # NeutralProtoParticleProtoP components if not self.getProp('SkipNeutrals'): from Configurables import NeutralProtoPAlg suffix = "For" + self.getName() neutral = getAlgo(NeutralProtoPAlg, "NeutralProtoPMaker" + suffix, context) # location if nloc != '': neutral.ProtoParticleLocation = nloc # fill the sequence addAlgs(protoSeq, neutral) addAlgs(nProtoSeq, neutral) ## propagate the global properties setTheProperty(protoSeq, 'Context', self.getProp('Context')) setTheProperty(protoSeq, 'MeasureTime', self.getProp('MeasureTime')) if self.isPropertySet("OutputLevel"): setTheProperty(protoSeq, 'OutputLevel', self.getProp('OutputLevel')) setTheProperty(nProtoSeq, 'Context', self.getProp('Context')) setTheProperty(nProtoSeq, 'MeasureTime', self.getProp('MeasureTime')) if self.isPropertySet("OutputLevel"): setTheProperty(nProtoSeq, 'OutputLevel', self.getProp('OutputLevel')) setTheProperty(cProtoSeq, 'Context', self.getProp('Context')) setTheProperty(cProtoSeq, 'MeasureTime', self.getProp('MeasureTime')) if self.isPropertySet("OutputLevel"): setTheProperty(cProtoSeq, 'OutputLevel', self.getProp('OutputLevel')) # Full sequence addAlgs(fullSeq, caloSeq) addAlgs(fullSeq, protoSeq) ## define the sequencers if self.isPropertySet('Sequence'): main = self.getProp('Sequence') main.Members[:] = [] addAlgs(main, fullSeq) _log.info('Configure full sequence %s with ' % main.name()) _log.info(' Reco : %s ' % self.getProp('RecList')) _log.info(' PIDs : %s ' % self.getProp('PIDList')) _log.info(' and ProtoParticle update') if self.getProp('Verbose'): _log.info(prntCmp(main)) if self.isPropertySet('CaloSequencer'): calo = self.getProp('CaloSequencer') calo.Members[:] = [] addAlgs(calo, caloSeq) _log.info('Configure caloSequencer : %s ' % calo.name()) if self.getProp('Verbose'): _log.info(prntCmp(calo)) if self.isPropertySet('ProtoSequencer'): proto = self.getProp('ProtoSequencer') proto.Members[:] = [] addAlgs(proto, protoSeq) _log.info('Configure protoSequencer : %s ' % proto.name()) if self.getProp('Verbose'): _log.info(prntCmp(proto)) if self.isPropertySet('ChargedProtoSequencer'): cproto = self.getProp('ChargedProtoSequencer') cproto.Members[:] = [] addAlgs(cproto, cProtoSeq) _log.info('Configure chargedProtoSequencer : %s ' % cproto.name()) if self.getProp('Verbose'): _log.info(prntCmp(cproto)) if self.isPropertySet('NeutralProtoSequencer'): nproto = self.getProp('NeutralProtoSequencer') nproto.Members[:] = [] addAlgs(nproto, nProtoSeq) _log.info('Configure neutralProtoSequencer : %s ' % nproto.name()) if self.getProp('Verbose'): _log.info(prntCmp(nproto)) if self.getProp('EnableOnDemand'): _log.info("CaloProcessor onDemand enabled") if self.getProp('Verbose'): _log.info(printOnDemand())
def applyConf(self): """ Calorimeter Reconstruction Configuration """ self.printConf() _log.info('Apply CaloRecoConf configuration for %s ', self.getProp('RecList')) recList = self.getProp('RecList') skipNeutrals = self.getProp('SkipNeutrals') skipCharged = self.getProp('SkipCharged') forceOnDemand = self.getProp('ForceOnDemand') seq = [] # configure all components for DoD if forceOnDemand: _log.info('Force Data-On-Demand for all components') self.setProp('EnableRecoOnDemand', 'True') self.digits() self.clusters() self.photons() self.mergedPi0s() self.electrons() if self.getProp('NoSpdPrs'): self.setProp('UseSpd', False) self.setProp('UsePrs', False) self.setProp('UseSpdE', False) self.setProp('UsePrsE', False) # configure the public getter tool from Configurables import ToolSvc, CaloGetterTool tsvc = ToolSvc() tsvc.addTool(CaloGetterTool, name="CaloGetter") tsvc.CaloGetter.DetectorMask = 12 # add only the requested components to the sequence if 'Digits' in recList: addAlgs(seq, self.digits()) CaloDigitConf().printConf() if 'Clusters' in recList: addAlgs(seq, self.clusters()) if 'Digits' not in recList: CaloDigitConf().printConf() if not skipNeutrals: if 'Photons' in recList: addAlgs(seq, self.photons()) if 'MergedPi0s' in recList or 'SplitPhotons' in recList: addAlgs(seq, self.mergedPi0s()) if not skipCharged: if 'Electrons' in recList: addAlgs(seq, self.electrons()) setTheProperty(seq, 'Context', self.getProp('Context')) setTheProperty(seq, 'MeasureTime', self.getProp('MeasureTime')) if self.isPropertySet("OutputLevel"): setTheProperty(seq, 'OutputLevel', self.getProp('OutputLevel')) if self.isPropertySet('Sequence'): main = self.getProp('Sequence') addAlgs(main, seq) _log.info('Configure main Calo Reco Sequence : %s ' % main.name()) if self.getProp('Verbose'): _log.info(prntCmp(main)) else: _log.info('Configure Calorimeter Reco blocks ') if self.getProp('Verbose'): _log.info(prntCmp(seq)) if self.getProp('EnableRecoOnDemand'): _log.info("CaloReco onDemand enabled") if self.getProp('Verbose'): _log.info(printOnDemand())
pf.ProBestMins = [0.5, 0.5, 0.5, 0.5, 0.5] pf.EcalBest = True pf.SprRecover = False pf.TrkLnErrMax = 10 pf.TrkUpErrMax = 10 pf.TrkDnErrMax = 10 jb = HltJetBuilder('jb') jb.JetEcPath = '' jb.Inputs = [pf.Output] jb.Output = 'Phys/JB/Particles' jb.JetPtMin = 0 DaVinci().appendToMainSequence([pf, jb]) # TisTos configuration. if ((YEAR == 2017) and not TYPE == "Displ"): ToolSvc().addTool(TriggerTisTos, "Hlt1TriggerTisTos") ToolSvc( ).Hlt1TriggerTisTos.HltDecReportsLocation = '/Event/Leptons/Turbo/Hlt1/DecReports' ToolSvc( ).Hlt1TriggerTisTos.HltSelReportsLocation = '/Event/Leptons/Turbo/Hlt1/SelReports' ToolSvc().addTool(TriggerTisTos, "Hlt2TriggerTisTos") ToolSvc( ).Hlt2TriggerTisTos.HltDecReportsLocation = '/Event/Leptons/Turbo/Hlt2/DecReports' ToolSvc( ).Hlt2TriggerTisTos.HltSelReportsLocation = '/Event/Leptons/Turbo/Hlt2/SelReports' else: if TYPE == "Displ": stages = ('Hlt1', 'Hlt2', 'Strip/Phys') else: stages = ('Hlt1', 'Hlt2') for stage in stages: ToolSvc().addTool(TriggerTisTos, stage + "TriggerTisTos")