def configure(self): if self._done: log.info("configuration already done, who is calling it again?") return True self._done = True # setup configuration services from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter cfg = TriggerConfigGetter() # noqa: F841 # after the menu xml file has been created or the TriggerDB access is configured, # the COOL/SQlite db can be written from TrigConfigSvc.TrigConf2COOL import theConfCOOLWriter theConfCOOLWriter.writeConf2COOL() # preconfigure TrigDecisionTool from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool from AthenaCommon.AppMgr import ToolSvc ToolSvc += Trig__TrigDecisionTool("TrigDecisionTool") from PyUtils.MetaReaderPeekerFull import metadata if "metadata_items" in metadata and any( ('TriggerMenu' in key) for key in metadata["metadata_items"].keys()): # Use xAOD configuration. from AthenaCommon.AppMgr import ServiceMgr as svcMgr if not hasattr(svcMgr, 'xAODConfigSvc'): from TrigConfxAOD.TrigConfxAODConf import TrigConf__xAODConfigSvc svcMgr += TrigConf__xAODConfigSvc('xAODConfigSvc') ToolSvc += Trig__TrigDecisionTool("TrigDecisionTool") ToolSvc.TrigDecisionTool.TrigConfigSvc = svcMgr.xAODConfigSvc else: # Use TrigConfigSvc ToolSvc.TrigDecisionTool.TrigConfigSvc = "TrigConf::TrigConfigSvc/TrigConfigSvc" from TrigEDMConfig.TriggerEDM import EDMLibraries ToolSvc.TrigDecisionTool.Navigation.Dlls = [ e for e in EDMLibraries if 'TPCnv' not in e ] if withLVL1(): # setup Lvl1 # initialize LVL1ConfigSvc log.info("configuring lvl1") from TriggerJobOpts.Lvl1ResultBuilderGetter import Lvl1ResultBuilderGetter lvl1 = Lvl1ResultBuilderGetter() # noqa: F841 if withHLT(): # setup HLT # initialize HLT config svc log.info("configuring hlt") from TriggerJobOpts.HLTTriggerResultGetter import HLTTriggerResultGetter hlt = HLTTriggerResultGetter() # noqa: F841 #Call the tools to unpack the bytestream #bsu=ByteStreamUnpackGetter() #Call the tool to make the TrigDecision object for ESD or AOD #tdg=TrigDecisionGetter() return True
def configure(self): if self._done: log.info("configuration already done, who is calling it again?") return True self._done=True # setup configuration services from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter cfg = TriggerConfigGetter() # after the menu xml file has been created or the TriggerDB access is configured, # the COOL/SQlite db can be written from TrigConfigSvc.TrigConf2COOL import theConfCOOLWriter theConfCOOLWriter.writeConf2COOL() # preconfigure TrigDecisionTool from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool from AthenaCommon.AppMgr import ToolSvc ToolSvc += Trig__TrigDecisionTool( "TrigDecisionTool" ) # tell TDT to use TrigConfigSvc (Since 00-03-40, defaults to not use it) ToolSvc.TrigDecisionTool.TrigConfigSvc = "Trig::TrigConfigSvc/TrigConfigSvc" from TrigEDMConfig.TriggerEDM import EDMLibraries ToolSvc.TrigDecisionTool.Navigation.Dlls = [e for e in EDMLibraries if 'TPCnv' not in e] if withLVL1(): # setup Lvl1 # initialize LVL1ConfigSvc log.info("configuring lvl1") from TriggerJobOpts.Lvl1ResultBuilderGetter import Lvl1ResultBuilderGetter lvl1 = Lvl1ResultBuilderGetter() if withHLT(): # setup HLT # initialize HLT config svc log.info("configuring hlt") from TriggerJobOpts.HLTTriggerResultGetter import HLTTriggerResultGetter hlt = HLTTriggerResultGetter() #Call the tools to unpack the bytestream #bsu=ByteStreamUnpackGetter() #Call the tool to make the TrigDecision object for ESD or AOD #tdg=TrigDecisionGetter() return True
# flags needed for TriggerConfigGetter from RecExConfig.RecFlags import rec rec.readRDO = False rec.readAOD = True rec.doWriteAOD = False rec.doWriteESD = False # To read files with trigger config stored as in-file meta-data, # i.e. 13.0.40 and above: ds # To read AOD produced with 13.0.30 you need to change ds to aod: from TriggerJobOpts.TriggerFlags import TriggerFlags TriggerFlags.configurationSourceList = ['ds'] # set up trigger config service from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter cfg = TriggerConfigGetter() # list of the algorithms to be executed at run time from MissingETPerformance.MissingETPerformanceConf import MissingETPerformance topSequence.CBNT_AthenaAware += MissingETPerformance() MissingETPerformance = MissingETPerformance() ############# The properties of the MissingETPerformance Algorithm MissingETPerformance.OutputLevel = WARNING ############## trigger #whether to require a trigger from the list to have fired MissingETPerformance.FilterOnTrigger = False #List of trigger names to accept MissingETPerformance.TriggerNames = ["EF_e15_medium", "EF_e5_medium", "EF_J50"]
# might be needed for TriggerConfigGetter... from RecExConfig.RecFlags import rec rec.readRDO=False rec.readESD=True #rec.readAOD=True rec.doWriteAOD=False rec.doWriteESD=False # To read files with trigger config stored as in-file meta-data, i.e. 13.0.40 # and above: ds. To read AOD produced with 13.0.30 you need to change ds to aod: from TriggerJobOpts.TriggerFlags import TriggerFlags TriggerFlags.configurationSourceList = ['ds'] # set up trigger config service from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter cfg = TriggerConfigGetter() ########################################## # setup TTree registration Service # save ROOT histograms and Tuple from GaudiSvc.GaudiSvcConf import THistSvc ServiceMgr += THistSvc() # Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) ServiceMgr.MessageSvc.OutputLevel = INFO ServiceMgr.THistSvc.Output = [ "AANT DATAFILE='run_0152116.root' OPT='RECREATE'" ] from AnalysisTools.AnalysisToolsConf import AANTupleStream topSequence += AANTupleStream() AANTupleStream = AANTupleStream() AANTupleStream.ExtraRefNames = [ "StreamESD","Stream1" ]
# LVL1 Trigger Menu if hasattr(runArgs, "triggerConfig") and runArgs.triggerConfig!="NONE": # LVL1 Trigger Menu # PJB 9/2/2009 Setup the new triggerConfig flags here from TriggerJobOpts.TriggerFlags import TriggerFlags triggerArg = runArgs.triggerConfig #if not prefixed with LVL1: add it here Args = triggerArg.split(":") if Args[0] != "LVL1": TriggerFlags.triggerConfig ="LVL1:"+triggerArg else: TriggerFlags.triggerConfig =triggerArg overlaylog.info( 'triggerConfig argument is: %s ', TriggerFlags.triggerConfig.get_Value() ) from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter cfg = TriggerConfigGetter("HIT2RDO") printfunc ("================ DetFlags ================ ") if 'DetFlags' in dir(): overlaylog.warning("DetFlags already defined! This means DetFlags should have been fully configured already..") else: from AthenaCommon.DetFlags import DetFlags DetFlags.ID_setOn() DetFlags.Muon_setOn() DetFlags.LAr_setOn() DetFlags.Tile_setOn() if not hasattr(runArgs, "triggerConfig") or runArgs.triggerConfig=="NONE": DetFlags.LVL1_setOff() else:
def VertexGroupD3PD(alg=None, file=VertexD3PDAnalysisKeys.D3PDFileName(), treeName=VertexD3PDAnalysisKeys.D3PDTreeName(), **kw): print '[TrackD3PDMaker.VertexGroupD3PD] Vertex group D3PD settings:' print 'VertexD3PDAnalysisFlags' print VertexD3PDAnalysisFlags print 'VertexD3PDAnalysisKeys' print VertexD3PDAnalysisKeys if not alg: ## Create a new algorithm from OutputStreamAthenaPool.MultipleStreamManager import MSMgr alg = MSMgr.NewRootStream(treeName, file) ## General event information (custom options prefix: 'ei_') if VertexD3PDAnalysisFlags.useEventInfo(): from EventCommonD3PDMaker.EventInfoD3PDObject import EventInfoD3PDObject alg += EventInfoD3PDObject(**_args('ei_', kw, level=0, prefix='ei_')) ## Trigger information (custom options prefix: 'trig_') if VertexD3PDAnalysisFlags.useTrigger(): from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter cfg = TriggerConfigGetter("ReadPool") from TriggerD3PDMaker.defineTriggerBits import defineTriggerBits from TriggerD3PDMaker.TrigConfMetadata import addTrigConfMetadata from TriggerD3PDMaker.TrigDecisionD3PDObject import TrigDecisionD3PDObject alg += TrigDecisionD3PDObject(**_args('trig_', kw, level=2)) addTrigConfMetadata(alg) if VertexD3PDAnalysisFlags.useTriggerRaw(): from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter cfg = TriggerConfigGetter("ReadPool") from TriggerD3PDMaker.defineTriggerBits import defineTriggerBits from TriggerD3PDMaker.TrigConfMetadata import addTrigConfMetadata #Setup custom D3PD object with raw trigger info only (e.g. calibration_vdM streams) from D3PDMakerCoreComps.D3PDObject import make_Void_D3PDObject import TriggerD3PDMaker TrigDecisionD3PDObjectRaw = make_Void_D3PDObject( "trigRaw_", "TrigDecisionD3PDObjectRaw", default_name="TrigDecisionFillerRaw") if not VertexD3PDAnalysisFlags.useTrigger(): TrigDecisionD3PDObjectRaw.defineBlock( 0, "TriggerRawInfo", TriggerD3PDMaker.TrigDecisionFillerTool, SaveLVL1Raw=True, SaveHLTRaw=True, SaveBGCode=True) else: TrigDecisionD3PDObjectRaw.defineBlock( 0, "TriggerRawInfo", TriggerD3PDMaker.TrigDecisionFillerTool, SaveHLTRaw=True, SaveBGCode=True) #Finally add object to algorithms alg += TrigDecisionD3PDObjectRaw(**_args('trig_', kw, level=0)) if not VertexD3PDAnalysisFlags.useTrigger(): #unless we've already added it, add meta-data as well addTrigConfMetadata(alg) ## Beam background information (custom options prefix: 'bkg_') if VertexD3PDAnalysisFlags.useBackgroundWord(): from BackgroundD3PDMaker.BackgroundWordD3PDObject import BackgroundWordD3PDObject alg += BackgroundWordD3PDObject(**_args('bkg_', kw, level=0)) ## Tracks and V0 information (custom options prefix: 'trk_', and 'v0_') if VertexD3PDAnalysisFlags.useTracks(): labelDefaultVtx = VertexD3PDAnalysisKeys.LabelDefaultVtx() prefixDefaultVtx = labelDefaultVtx + '_' #Add trailing '_' import TrackD3PDMaker from TrackD3PDMaker.TrackD3PDMakerFlags import TrackD3PDFlags from TrackD3PDMaker.TrackD3PDObject import TrackD3PDObject from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags from TruthD3PDMaker.TruthD3PDMakerFlags import TruthD3PDFlags from TruthD3PDMaker.TruthD3PDMakerKeys import TruthD3PDKeys VtxD3PD_Track_Exclude = ['vx_weight'] TrackD3PDMaker.PerigeeUnbiasedIPAtPVFillerTool.DoBiased = False #Switch off biased perigee TrackParticleD3PDObjectForVertex = TrackD3PDObject( _label='trk', _prefix='trk_', _sgkey=D3PDMakerFlags.TrackSGKey(), _object_name='TrackParticleD3PDObjectForVertex', typeName='Rec::TrackParticleContainer', vertexTarget=labelDefaultVtx, vertexPrefix=prefixDefaultVtx, vertexSGKey='VxPrimaryCandidate', truthTarget=TruthD3PDFlags.GenParticleAssocLabel(), truthPrefix=TruthD3PDKeys.GenParticlePrefix(), detailedTruthPrefix='', # 'mc_detailed_' SGKeyForTruth=D3PDMakerFlags.TrackSGKey(), truthMapKey='TrackParticleTruthCollection', detailedTruthMapKey='', #'DetailedTrackTruth' flags=TrackD3PDFlags) alg += TrackParticleD3PDObjectForVertex( **_args('trk_', kw, level=8, exclude=VtxD3PD_Track_Exclude)) if VertexD3PDAnalysisFlags.useSecondaryVertex(): from TrackD3PDMaker.V0D3PDObject import V0D3PDObject alg += V0D3PDObject(**_args('v0_', kw, level=10)) ## Store beamspot information (custom option perfix: 'bs_') if VertexD3PDAnalysisFlags.useBeamspot(): from TrackD3PDMaker.BeamSpotD3PDObject import BeamSpotD3PDObject alg += BeamSpotD3PDObject(**_args('bs_', kw, level=0)) ## Store vertex information (custom options prefix: 'vtx_' or 'vtx' for BuildVertexD3PDObject) from TrackD3PDMaker.VertexD3PDObject import PrimaryVertexD3PDObject from TrackD3PDMaker.VertexD3PDObject import BuildVertexD3PDObject from InDetRecExample.InDetKeys import InDetKeys from InDetRecExample.InDetJobProperties import InDetFlags #First dump existing content labelDefaultVtx = VertexD3PDAnalysisKeys.LabelDefaultVtx() prefixDefaultVtx = labelDefaultVtx + '_' #Add trailing '_' VtxDefaultD3PDObj = BuildVertexD3PDObject( **_args('vtx', kw, _prefix=prefixDefaultVtx, _label=labelDefaultVtx, _sgkey=InDetKeys.PrimaryVertices(), trackTarget='trk', trackPrefix='trk_', trackType='Rec::TrackParticleContainer')) alg += VtxDefaultD3PDObj(**_args('vtx_', kw, level=10)) #Then also dump the other vertex collections if VertexD3PDAnalysisFlags.useAllVertexCollections: #Use non BC and split collections (sorry, no customization of parameters here) if not InDetFlags.doSplitVertexFindingForMonitoring(): #raise NameError('Requesting split vertices but algorith has not run!') #pass print( '[TrackD3PDMaker.VertexGroupD3PD] WARNING: Requested split vertices, but algorithm has not run! Skipped.' ) else: SplitPrimaryVertexD3PDObject = BuildVertexD3PDObject( _prefix='vxsplit_', _label='vxsplit', _sgkey=InDetKeys.PrimaryVerticesSplitStream(), trackTarget='trk', trackPrefix='trk_', trackType='Rec::TrackParticleContainer') alg += SplitPrimaryVertexD3PDObject(8) #Then store also non beamspot constrained ones if not InDetFlags.doVertexFindingForMonitoring(): #raise NameError('Requesting NBC vertices but algorith has not run!') #pass print( '[TrackD3PDMaker.VertexGroupD3PD] WARNING: Requested non beamspot constrained vertices, but algorithm has not run! Skipped.' ) else: NoBeamConstraintPrimaryVertexD3PDObject = BuildVertexD3PDObject( _prefix='vxnbc_', _label='vxnbc', _sgkey=InDetKeys.PrimaryVerticesWithoutBeamConstraint(), trackTarget='trk', trackPrefix='trk_', trackType='Rec::TrackParticleContainer') alg += NoBeamConstraintPrimaryVertexD3PDObject(8) ## Store truth-level information (custom options prefix: 'tuthVtx_', 'truthEvt_', 'truthPart_') if VertexD3PDAnalysisFlags.useTruth(): from TruthD3PDAnalysis.TruthD3PDAnalysisConf import D3PD__GenObjectsFilterTool trackGenObjectsFilterTool = D3PD__GenObjectsFilterTool( "trackGenObjectsFilterTool") from AthenaCommon.AppMgr import ToolSvc ToolSvc += trackGenObjectsFilterTool if (VertexD3PDAnalysisFlags.filterTightTruth()): trackGenObjectsFilterTool.SelectTruthTracks = True trackGenObjectsFilterTool.PtMin = VertexD3PDAnalysisKeys.TruthTrackCutPtMin( ) trackGenObjectsFilterTool.EtaMax = VertexD3PDAnalysisKeys.TruthTrackCutEtaMax( ) trackGenObjectsFilterTool.RemoveEmptyEvents = True trackGenObjectsFilterTool.RemoveDummyEvents = True trackGenObjectsFilterTool.RemoveInTimePileUp = False trackGenObjectsFilterTool.Remove2BCPileUp = True trackGenObjectsFilterTool.Remove800nsPileUp = True trackGenObjectsFilterTool.RemoveCavernBkg = False trackGenObjectsFilterTool.AddOnlyFirstVertex = VertexD3PDAnalysisKeys.TruthAddOnlyFirstVertex( ) else: #Use a more inclusive truth policy trackGenObjectsFilterTool.SelectTruthTracks = False trackGenObjectsFilterTool.PtMin = VertexD3PDAnalysisKeys.TruthTrackCutPtMin( ) trackGenObjectsFilterTool.EtaMax = VertexD3PDAnalysisKeys.TruthTrackCutEtaMax( ) trackGenObjectsFilterTool.RemoveEmptyEvents = True trackGenObjectsFilterTool.RemoveDummyEvents = True trackGenObjectsFilterTool.AddOnlyFirstVertex = VertexD3PDAnalysisKeys.TruthAddOnlyFirstVertex( ) from TruthD3PDMaker.GenEventD3PDObject import GenEventD3PDObject alg += GenEventD3PDObject( **_args('truthEvt_', kw, level=10, filter=trackGenObjectsFilterTool, pileup_CollectionGetterRegistry=alg.name() + '_CollectionGetterRegistry')) from TruthD3PDMaker.GenVertexD3PDObject import GenVertexD3PDObject alg += GenVertexD3PDObject(**_args( 'truthVtx_', kw, level=1, filter=trackGenObjectsFilterTool)) from TruthD3PDMaker.GenParticleD3PDObject import GenParticleD3PDObject alg += GenParticleD3PDObject(**_args( 'truthPart_', kw, level=10, filter=trackGenObjectsFilterTool)) from TruthD3PDMaker.GenParticleD3PDObject import GenTruthTrackD3PDObject alg += GenTruthTrackD3PDObject(**_args('truthTrack_', kw, level=0)) ## Dump higher level objects # Missing Energy (custom options prefix with VertexD3PDAnalysisKeys.MetCollections+'_') if VertexD3PDAnalysisFlags.useMET(): for MET in VertexD3PDAnalysisKeys.MetCollections(): VtxD3PD_Met_Key = MET VtxD3PD_Met_Prefix = MET.replace('_', '') + '_' VtxD3PD_Met_Level = 0 #Only basic info VtxD3PD_Met_Exclude = ['MET_Regions', 'L1_', 'L2_', 'EF_'] from MissingETD3PDMaker.MissingETD3PDObject import RefFinalMETD3PDObject VtxD3PD_Met_Obj = RefFinalMETD3PDObject( **_args(MET + '_', kw, level=VtxD3PD_Met_Level, sgkey=VtxD3PD_Met_Key, prefix=VtxD3PD_Met_Prefix, exclude=VtxD3PD_Met_Exclude)) alg += VtxD3PD_Met_Obj #Muons (custom options prefix VtxD3PD_Muon_Prefix -- see below [e.g. muid_, staco_, ...]) if VertexD3PDAnalysisFlags.useMuons(): from MuonD3PDMaker.MuonD3PDObject import MuonD3PDObject for Muon in VertexD3PDAnalysisKeys.MuonCollections(): VtxD3PD_Muon_Key = Muon VtxD3PD_Muon_Prefix = Muon + '_' if VtxD3PD_Muon_Key == 'MuidMuonCollection': VtxD3PD_Muon_Prefix = 'muid_' elif VtxD3PD_Muon_Key == 'StacoMuonCollection': VtxD3PD_Muon_Prefix = 'staco_' VtxD3PD_Muon_Level = 0 #Only basic info VtxD3PD_Muon_Exclude = [ 'EFCBInfo', 'EFMGInfo', 'EFMEInfo', 'L2CBInfo', 'L1Info', 'L1_', 'L2_', 'EF_' ] VtxD3PD_Muon_Obj = MuonD3PDObject( **_args(VtxD3PD_Muon_Prefix, kw, level=VtxD3PD_Muon_Level, sgkey=VtxD3PD_Muon_Key, prefix=VtxD3PD_Muon_Prefix, allowMissing=True, exclude=VtxD3PD_Muon_Exclude)) alg += VtxD3PD_Muon_Obj #Electrons (custom options prefix: 'el_') if VertexD3PDAnalysisFlags.useElectrons(): from egammaD3PDMaker.ElectronD3PDObject import ElectronD3PDObject alg += ElectronD3PDObject(**_args('el_', kw, prefix='el_', level=0)) #Photons (custom options prefix: 'ph_') if VertexD3PDAnalysisFlags.usePhotons(): from egammaD3PDMaker.PhotonD3PDObject import PhotonD3PDObject alg += PhotonD3PDObject(**_args('ph_', kw, prefix='ph_', level=0)) #Jets, JVF, b-jets (custom options prefix: 'jet_') if VertexD3PDAnalysisFlags.useJets(): from JetD3PDMaker.JetD3PDObject import JetD3PDObject from JetTagD3PDMaker.JetTagD3PDMakerKeys import JetTagD3PDKeys from JetTagD3PDMaker.AddBTagD3PDInfo import addBTagInfoToJetObject addBTagInfoToJetObject(JetD3PDObject, btagLevelOffset=0) VtxD3PD_Jet_Include = [ 'Kinematics', 'JetVertexFraction', 'JVtx', 'EMFraction', 'TrueFlavorComponents', JetTagD3PDKeys.BTagWeightsBlockName() ] for JET in VertexD3PDAnalysisKeys.JetCollections(): VtxD3PD_Jet_Prefix = JET.replace('_', '') + '_' if len(VertexD3PDAnalysisKeys.JetCollections()) == 1: #only 1 element, simplify prefix VtxD3PD_Jet_Prefix = 'jet_' alg += JetD3PDObject(**_args('jet_', kw, sgkey=JET, prefix=VtxD3PD_Jet_Prefix, level=0, include=VtxD3PD_Jet_Include)) #Taus if VertexD3PDAnalysisFlags.useTaus(): from TauD3PDMaker.TauD3PDObject import TauD3PDObject VtxD3PD_Tau_Include = ['TauPriVtx'] alg += TauD3PDObject(**_args( 'tau_', kw, prefix='tau_', level=0, include=VtxD3PD_Tau_Include)) ## Return algorithm return alg
def configure(self): if self._done: log.info("configuration already done, who is calling it again?") return True self._done = True # start with print some information what this will do log.info( "Basic configuration flags RecAlgsFlag.doTrigger: %d RecFlags.doTrigger: %d TriggerFlags.doTriggerConfigOnly %d" % (recAlgs.doTrigger(), rec.doTrigger(), TF.doTriggerConfigOnly())) log.info( "TriggerFlags: doL1Topo: %s, doLVL1: %s, doLVL2: %s, doEF: %s, doHLT: %s" % (TF.doL1Topo(), TF.doLVL1(), TF.doLVL2(), TF.doEF(), TF.doHLT())) willGenerateMenu = recAlgs.doTrigger() and ( TF.doLVL1() or TF.doLVL2() or TF.doEF() or TF.doHLT()) and not TF.doTriggerConfigOnly() willRunTriggerConfigGetter = recAlgs.doTrigger() or rec.doTrigger( ) or TF.doTriggerConfigOnly() willRunLVL1SimulationGetter = recAlgs.doTrigger( ) and not TF.doTriggerConfigOnly() willRunHLTSimulationGetter = willRunLVL1SimulationGetter and ( TF.doLVL2() or TF.doEF() or TF.doHLT()) log.info("Will run: %s%s%s%s" % ( "GenerateMenu " if willGenerateMenu else "", "TriggerConfigGetter " if willRunTriggerConfigGetter else "", "LVL1SimulationGetter " if willRunLVL1SimulationGetter else "", "HLTSimulationGetter " if willRunHLTSimulationGetter else "", )) log.info("Will not run: %s%s%s%s" % ( "GenerateMenu " if not willGenerateMenu else "", "TriggerConfigGetter " if not willRunTriggerConfigGetter else "", "LVL1SimulationGetter " if not willRunLVL1SimulationGetter else "", "HLTSimulationGetter " if not willRunHLTSimulationGetter else "", )) if recAlgs.doTrigger(): # setup the trigger from the DB if TF.readConfigFromTriggerDb(): return self.configureTriggerFromDB() if ((TF.doLVL1() == True or TF.doLVL2() == True or TF.doEF() == True or TF.doHLT() == True) and TF.doTriggerConfigOnly() == False): log.info("generating menu") # trigger menu files generation g = GenerateMenu() g.generate() # after the menu xml file has been created or the TriggerDB access is configured, # the COOL/SQlite db can be written # TB this needs to be optimized -- we do not need ti always but only when AOD or ESD are created if recAlgs.doTrigger() or rec.doTrigger() or TF.doTriggerConfigOnly(): # setup configuration services from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter cfg = TriggerConfigGetter() from TrigConfigSvc.TrigConf2COOL import theConfCOOLWriter theConfCOOLWriter.writeConf2COOL() # preconfigure TrigDecisionTool from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool from AthenaCommon.AppMgr import ToolSvc ToolSvc += Trig__TrigDecisionTool("TrigDecisionTool") # tell tdt to use TrigConfigSvc (Since TrigDecisionTool-00-03-40, defaults to not use it) ToolSvc.TrigDecisionTool.TrigConfigSvc = "Trig::TrigConfigSvc/TrigConfigSvc" from TrigEDMConfig.TriggerEDM import EDMLibraries ToolSvc.TrigDecisionTool.Navigation.Dlls = [ e for e in EDMLibraries if 'TPCnv' not in e ] # actuall trigger simulation running if recAlgs.doTrigger() and not TF.doTriggerConfigOnly(): # setup Lvl1 # initialize LVL1ConfigSvc log.info("configuring lvl1") from TriggerJobOpts.Lvl1TriggerGetter import Lvl1SimulationGetter lvl1 = Lvl1SimulationGetter() if jobproperties.Global.InputFormat() != 'bytestream' and ( TF.doLVL2 == True or TF.doEF == True or TF.doHLT == True): # Transient BS construction and intialization from ByteStreamCnvSvc import WriteByteStream StreamBS = WriteByteStream.getStream("Transient", "StreamBS") StreamBS.ForceRead = True StreamBS.ItemList += [ "DataVector<LVL1::TriggerTower>#TriggerTowers" ] StreamBS.ItemList += ["TRT_RDO_Container#TRT_RDOs"] StreamBS.ItemList += ["SCT_RDO_Container#SCT_RDOs"] StreamBS.ItemList += ["PixelRDO_Container#PixelRDOs"] # StreamBS.ItemList +=["LArRawChannelContainer#*"] StreamBS.ItemList += ["2721#*"] # StreamBS.ItemList +=["TileRawChannelContainer#*"] StreamBS.ItemList += ["2927#*"] StreamBS.ItemList += [ "2934#*" ] # added on request from: Arantxa Ruiz Martinez for TileRODMu # don't need Muons in transient BS # StreamBS.ItemList +=["MdtCsmContainer#*"] # StreamBS.ItemList +=["RpcPadContainer#*"] # StreamBS.ItemList +=["TgcRdoContainer#*"] # StreamBS.ItemList +=["CscRawDataContainer#*"] from AthenaCommon.Include import include # setup trans BS for the ID include("InDetRecExample/InDetRecCabling.py") # setup HLT # initialize HLT config svc log.info("TriggerFlags: doLVL2 %r" % TF.doLVL2()) log.info("TriggerFlags: doEF %r" % TF.doEF()) log.info("TriggerFlags: doHLT %r" % TF.doHLT()) if TF.doLVL2() == True or TF.doEF() == True or TF.doHLT() == True: log.info("configuring hlt") from TriggerJobOpts.HLTTriggerGetter import HLTSimulationGetter hlt = HLTSimulationGetter(g) else: from RegionSelector.RegSelSvcDefault import RegSelSvcDefault from AthenaCommon.AppMgr import ServiceMgr ServiceMgr += RegSelSvcDefault() ServiceMgr.RegSelSvc.enablePixel = False ServiceMgr.RegSelSvc.enableSCT = False # prepare result making of L1 from TriggerJobOpts.Lvl1ResultBuilderGetter import Lvl1ResultBuilderGetter hltouput = Lvl1ResultBuilderGetter() # prepare result making of HLT if TF.doLVL2() == True or TF.doEF() == True or TF.doHLT() or ( recAlgs.doTrigger() and TF.readBS()): from TriggerJobOpts.HLTTriggerResultGetter import HLTTriggerResultGetter hltouput = HLTTriggerResultGetter() return True
def configure(self): if self._done: log.info("configuration already done, who is calling it again?") return True self._done = True # start with print some information what this will do log.info( "Basic configuration flags RecAlgsFlag.doTrigger: %d RecFlags.doTrigger: %d TriggerFlags.doTriggerConfigOnly %d", recAlgs.doTrigger(), rec.doTrigger(), TF.doTriggerConfigOnly()) log.info( "TriggerFlags: doL1Topo: %s, doLVL1: %s, doLVL2: %s, doEF: %s, doHLT: %s, doMT: %s", TF.doL1Topo(), TF.doLVL1(), TF.doLVL2(), TF.doEF(), TF.doHLT(), TF.doMT()) # RDOtoRDOTrigger MT temporarily coded in the transform skeleton, so skip here if TF.doMT() and rec.readRDO() and rec.doWriteRDO(): log.info("Nothing happens in TriggerGetter for RDOtoRDOTrigger MT") return True else: #GenerateMenu imports slice flags, which are Menu/MenuMT dependent from TriggerMenu.menu.GenerateMenu import GenerateMenu willGenerateMenu = recAlgs.doTrigger() and ( TF.doLVL1() or TF.doLVL2() or TF.doEF() or TF.doHLT()) and not TF.doTriggerConfigOnly() willRunTriggerConfigGetter = recAlgs.doTrigger() or rec.doTrigger( ) or TF.doTriggerConfigOnly() willRunLVL1SimulationGetter = recAlgs.doTrigger( ) and not TF.doTriggerConfigOnly() willRunHLTSimulationGetter = willRunLVL1SimulationGetter and ( TF.doLVL2() or TF.doEF() or TF.doHLT()) log.info( "Will run: %s%s%s%s", "GenerateMenu " if willGenerateMenu else "", "TriggerConfigGetter " if willRunTriggerConfigGetter else "", "LVL1SimulationGetter " if willRunLVL1SimulationGetter else "", "HLTSimulationGetter " if willRunHLTSimulationGetter else "") log.info( "Will not run: %s%s%s%s", "GenerateMenu " if not willGenerateMenu else "", "TriggerConfigGetter " if not willRunTriggerConfigGetter else "", "LVL1SimulationGetter " if not willRunLVL1SimulationGetter else "", "HLTSimulationGetter " if not willRunHLTSimulationGetter else "") if recAlgs.doTrigger(): if ((TF.doLVL1() or TF.doLVL2() or TF.doEF() or TF.doHLT()) and not TF.doTriggerConfigOnly()): log.info("generating menu") # trigger menu files generation g = GenerateMenu() g.generate() # after the menu xml file has been created or the TriggerDB access is configured, # the COOL/SQlite db can be written # TB this needs to be optimized -- we do not need ti always but only when AOD or ESD are created if recAlgs.doTrigger() or rec.doTrigger() or TF.doTriggerConfigOnly(): # setup configuration services from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter cfg = TriggerConfigGetter() # noqa: F841 from TrigConfigSvc.TrigConf2COOL import theConfCOOLWriter theConfCOOLWriter.writeConf2COOL() # preconfigure TrigDecisionTool from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool from AthenaCommon.AppMgr import ToolSvc ToolSvc += Trig__TrigDecisionTool("TrigDecisionTool") from PyUtils.MetaReaderPeekerFull import metadata if "metadata_items" in metadata and any( ('TriggerMenu' in key) for key in metadata["metadata_items"].keys()): # Use xAOD configuration. from AthenaCommon.AppMgr import ServiceMgr as svcMgr if not hasattr(svcMgr, 'xAODConfigSvc'): from TrigConfxAOD.TrigConfxAODConf import TrigConf__xAODConfigSvc svcMgr += TrigConf__xAODConfigSvc('xAODConfigSvc') ToolSvc += Trig__TrigDecisionTool("TrigDecisionTool") ToolSvc.TrigDecisionTool.TrigConfigSvc = svcMgr.xAODConfigSvc else: # Use TrigConfigSvc ToolSvc.TrigDecisionTool.TrigConfigSvc = "TrigConf::TrigConfigSvc/TrigConfigSvc" from TrigEDMConfig.TriggerEDM import EDMLibraries ToolSvc.TrigDecisionTool.Navigation.Dlls = [ e for e in EDMLibraries if 'TPCnv' not in e ] # actuall trigger simulation running if recAlgs.doTrigger() and not TF.doTriggerConfigOnly(): # setup Lvl1 # initialize LVL1ConfigSvc log.info("configuring lvl1") from TriggerJobOpts.Lvl1TriggerGetter import Lvl1SimulationGetter lvl1 = Lvl1SimulationGetter() # noqa: F841 if TF.doTransientByteStream() or ( jobproperties.Global.InputFormat() != 'bytestream' and (TF.doLVL2() or TF.doEF() or TF.doHLT())): # Transient BS construction and intialization from ByteStreamCnvSvc import WriteByteStream StreamBS = WriteByteStream.getStream("Transient", "StreamBS") StreamBS.ItemList += [ "DataVector<LVL1::TriggerTower>#TriggerTowers" ] StreamBS.ItemList += ["TRT_RDO_Container#TRT_RDOs"] StreamBS.ItemList += ["SCT_RDO_Container#SCT_RDOs"] StreamBS.ItemList += ["PixelRDO_Container#PixelRDOs"] # StreamBS.ItemList +=["LArRawChannelContainer#*"] StreamBS.ItemList += ["2721#*"] # StreamBS.ItemList +=["TileRawChannelContainer#*"] StreamBS.ItemList += ["2927#*"] StreamBS.ItemList += [ "2934#*" ] # added on request from: Arantxa Ruiz Martinez for TileRODMu # don't need Muons in transient BS # StreamBS.ItemList +=["MdtCsmContainer#*"] # StreamBS.ItemList +=["RpcPadContainer#*"] # StreamBS.ItemList +=["TgcRdoContainer#*"] # StreamBS.ItemList +=["CscRawDataContainer#*"] from AthenaCommon.Include import include # setup trans BS for the ID include("InDetRecExample/InDetRecCabling.py") # setup HLT # initialize HLT config svc log.info("TriggerFlags: doLVL2 %r", TF.doLVL2()) log.info("TriggerFlags: doEF %r", TF.doEF()) log.info("TriggerFlags: doHLT %r", TF.doHLT()) if TF.doLVL2() or TF.doEF() or TF.doHLT(): log.info("configuring hlt") from TriggerJobOpts.HLTTriggerGetter import HLTSimulationGetter hlt = HLTSimulationGetter(g) # noqa: F841 else: from RegionSelector.RegSelSvcDefault import RegSelSvcDefault from AthenaCommon.AppMgr import ServiceMgr ServiceMgr += RegSelSvcDefault() ServiceMgr.RegSelSvc.enablePixel = False ServiceMgr.RegSelSvc.enableSCT = False # prepare result making of L1 from TriggerJobOpts.Lvl1ResultBuilderGetter import Lvl1ResultBuilderGetter hltouput = Lvl1ResultBuilderGetter() # prepare result making of HLT if TF.doLVL2() or TF.doEF() or TF.doHLT() or (recAlgs.doTrigger() and TF.readBS()): from TriggerJobOpts.HLTTriggerResultGetter import HLTTriggerResultGetter hltouput = HLTTriggerResultGetter() # noqa: F841 return True
# trigger configuration from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter cfg = TriggerConfigGetter('ReadPool') # TDT from AthenaCommon.AppMgr import ToolSvc from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool tdt = Trig__TrigDecisionTool("TrigDecisionTool") ToolSvc += tdt # sequence of algorithms from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() # the tutorial from TrigAnalysisExamples.TrigAnalysisExamplesConf import TriggerAnalysisTutorial tat = TriggerAnalysisTutorial() topSequence += tat # Histogram routing ServiceMgr += CfgMgr.THistSvc() ServiceMgr.THistSvc.Output += [ "file DATAFILE='TriggerAnalysisTutorial.root' TYP='ROOT' OPT='RECREATE'" ] ServiceMgr.THistSvc.Output += [ "Trigger DATAFILE='TriggerAnalysisTutorial.root' TYP='ROOT' OPT='RECREATE'" ] photons = ["L1_2EM13", "L2_2g10_mu6", "EF_2g10"] singletaus = [ "EF_tau12_loose", "EF_tau16_loose", "EF_tau16i_loose", "EF_tau20_loose",
def _initTrigHook(c, **kw): from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter cfg = TriggerConfigGetter() from TriggerMenuAnalysis.TriggerMenuAnalysisConf import RoILinksCnvTool from AthenaCommon.AppMgr import ToolSvc if not hasattr(ToolSvc, 'RoILinksCnvTool'): ToolSvc += RoILinksCnvTool('RoILinksCnvTool') import TrigJetD3PDMaker.Setup_RoILinksCnvTool_IBv3 ToolSvc.RoILinksCnvTool.Chains_Jet += [ 'L2_j.*', 'EF_j.*', 'L2_2j.*', 'EF_2j.*', 'L2_3j.*', 'EF_3j.*', 'L2_4j.*', 'EF_4j.*', 'L2_5j.*', 'EF_5j.*' ] ToolSvc.RoILinksCnvTool.Chains_Bjet = [ # these first regexps should deal with most b-jet triggers 'L2_b.*', 'EF_b.*', 'L2_2b.*', 'EF_2b.*', 'L2_3b.*', 'EF_3b.*', # some mu-jet and jet chains 'L2_mu4_j10_a4tc_EFFS', 'EF_mu4_j10_a4tc_EFFS', 'EF_mu4_j10_a4tc_EFFS_matched', 'EF_mu4_j10_a4tc_EFFS_matched', 'L2_mu4_L1J10_matched', 'EF_mu4_L1J10_matched', 'L2_mu4_L1J20_matched', 'EF_mu4_L1J20_matched', 'L2_mu4_L1J30_matched', 'EF_mu4_L1J30_matched', 'L2_mu4_L1J50_matched', 'EF_mu4_L1J50_matched', 'L2_mu4_L1J75_matched', 'EF_mu4_L1J75_matched', 'L2_mu4_j95_L1matched', 'EF_mu4_j100_a4tc_EFFS_L1matched', 'L2_mu4_j95_L1matched', 'EF_mu4_j135_a4tc_EFFS_L1matched', 'L2_mu4_j95_L1matched', 'EF_mu4_j180_a4tc_EFFS_L1matched', 'L2_4j25', 'EF_4j30_a4tc_EFFS', # for the mu-jets in the v2,v3,v4 triggers (remember to include L2 and EF) 'EF_mu4_j10_a4tc_EFFS_matched', 'EF_mu4_j20_a4tc_EFFS_matched', 'EF_mu4_MSonly_j15_a2hi_EFFS_matched', 'EF_mu4_L1J5_matched', 'EF_mu4_L1J10_matched', 'EF_mu4_L1J15_matched', 'EF_mu4_L1J20_matched', 'EF_mu4_L1J30_matched', 'EF_mu4_L1J50_matched', 'EF_mu4_L1J75_matched', 'EF_mu4_j100_a4tc_EFFS_L1matched', 'EF_mu4_j135_a4tc_EFFS_L1matched', 'EF_mu4_j180_a4tc_EFFS_L1matched', # lepton + bjet 'EF_mu24_tight_b35_mediumEF_j35_a4tchad', 'EF_e24vh_medium1_b35_mediumEF_j35_a4tchad', 'EF_mu22_j30_a4tc_EFFS', # mymujet 'EF_mu4T_j15_a4tchad_matched', 'EF_mu4T_j25_a4tchad_matched', 'EF_mu4T_j35_a4tchad_matched', 'EF_mu4T_j45_a4tchad_matched', 'EF_mu4T_j55_a4tchad_matched', 'EF_mu4T_j65_a4tchad_matched', 'EF_mu4T_j80_a4tchad_matched', 'EF_mu4T_j110_a4tchad_matched', 'EF_mu4T_j145_a4tchad_matched', 'EF_mu4T_j180_a4tchad_matched', 'EF_mu4T_j220_a4tchad_matched', 'EF_mu4T_j280_a4tchad_matched', 'EF_mu4T_j360_a4tchad_matched', # mu jet triggers with deltaR and deltaZ matching 'EF_mu4T_j15_a4tchad_matchedZ', 'EF_mu4T_j25_a4tchad_matchedZ', 'EF_mu4T_j35_a4tchad_matchedZ', 'EF_mu4T_j45_a4tchad_matchedZ', 'EF_mu4T_j55_a4tchad_matchedZ', # L1.5 for mu+jets 'EF_mu4T_j45_a4tchad_L2FS_matched', 'EF_mu4T_j55_a4tchad_L2FS_matched', 'EF_mu4T_j65_a4tchad_L2FS_matched', 'EF_mu4T_j80_a4tchad_L2FS_matched', 'EF_mu4T_j110_a4tchad_L2FS_matched', 'EF_mu4T_j145_a4tchad_L2FS_matched', 'EF_mu4T_j180_a4tchad_L2FS_matched', 'EF_mu4T_j220_a4tchad_L2FS_matched', 'EF_mu4T_j280_a4tchad_L2FS_matched', 'EF_mu4T_j360_a4tchad_L2FS_matched', 'EF_mu4T_j45_a4tchad_L2FS_matchedZ', 'EF_mu4T_j55_a4tchad_L2FS_matchedZ', # muon jets no TRT 'EF_mu4_MSonly_j15_a2hi_EFFS_L1TE10', # for L2 'L2_mu4_j10_a4tc_EFFS_matched', 'L2_mu4_j20_a4tc_EFFS_matched', 'L2_mu4_MSonly_j15_a2hi_EFFS_matched', 'L2_mu4_L1J5_matched', 'L2_mu4_L1J10_matched', 'L2_mu4_L1J15_matched', 'L2_mu4_L1J20_matched', 'L2_mu4_L1J30_matched', 'L2_mu4_L1J50_matched', 'L2_mu4_L1J75_matched', 'L2_mu4_j100_a4tc_EFFS_L1matched', 'L2_mu4_j135_a4tc_EFFS_L1matched', 'L2_mu4_j180_a4tc_EFFS_L1matched', # lepton + bjet 'L2_mu24_tight_b35_mediumEF_j35_a4tchad', 'L2_e24vh_medium1_b35_mediumEF_j35_a4tchad', 'L2_mu22_j30_a4tc_EFFS', # mymujet 'L2_mu4T_j10_c4cchad', 'L2_mu4T_j20_c4cchad', 'L2_mu4T_j30_c4cchad', 'L2_mu4T_j40_c4cchad', 'L2_mu4T_j50_c4cchad', 'L2_mu4T_j65_c4cchad', 'L2_mu4T_j80_c4cchad', 'L2_mu4T_j105_c4cchad', 'L2_mu4T_j135_c4cchad', 'L2_mu4T_j175_c4cchad', 'L2_mu4T_j215_c4cchad', 'L2_mu4T_j275_c4cchad', 'L2_mu4T_j355_c4cchad', # L1.5 for mu+jets 'L2_mu4T_j40_c4cchad_L2FS', 'L2_mu4T_j50_c4cchad_L2FS', 'L2_mu4T_j60_c4cchad_L2FS', 'L2_mu4T_j75_c4cchad_L2FS', 'L2_mu4T_j105_c4cchad_L2FS', 'L2_mu4T_j140_c4cchad_L2FS', 'L2_mu4T_j175_c4cchad_L2FS', 'L2_mu4T_j215_c4cchad_L2FS', 'L2_mu4T_j275_c4cchad_L2FS', 'L2_mu4T_j355_c4cchad_L2FS', 'L2_mu4T_j40_c4cchad_L2FS', 'L2_mu4T_j50_c4cchad_L2FS', # muon jets no TRT 'L2_mu4_MSonly_j15_a2hi_EFFS_L1TE10', ] from AthenaCommon.AlgSequence import AlgSequence from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags preseq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName()) if not hasattr(preseq, 'FlatHltNaviMaker'): from TriggerMenuAnalysis.TriggerMenuAnalysisConf import FlatHltNaviMaker preseq += FlatHltNaviMaker('FlatHltNaviMaker') return
if hasattr(overlayArgs, 'triggerConfig') and overlayArgs.triggerConfig != 'NONE': # LVL1 Trigger Menu # PJB 9/2/2009 Setup the new triggerConfig flags here from TriggerJobOpts.TriggerFlags import TriggerFlags triggerArg = overlayArgs.triggerConfig # if not prefixed with LVL1: add it here Args = triggerArg.split(':') if Args[0] != 'LVL1': TriggerFlags.triggerConfig = 'LVL1:' + triggerArg else: TriggerFlags.triggerConfig = triggerArg logOverlay.info('triggerConfig argument is: %s ', TriggerFlags.triggerConfig.get_Value()) from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter cfg = TriggerConfigGetter('HIT2RDO') # ------------------------- # Configuration # ------------------------- logOverlay.info('================ Configure ================= ') # Initialise overlay include( 'EventOverlayJobTransforms/ConfiguredOverlayMT_jobOptions.py') # noqa F821 # load the input properly include('EventOverlayJobTransforms/OverlayInput_jobOptions.py') # noqa F821 # Always schedule beam spot conditions for overlay include('Digitization/BeamSpot.py') # noqa F821