def addDistanceInTrain(sequence=DerivationFrameworkJob): # simple set up -- either the alg exists and contains the tool, in which case we exit if hasattr(sequence, "DistanceInTrainAugmentation"): dfjetlog.warning( "DistanceInTrainAugmentation: DistanceInTrainAugmentation already scheduled on sequence" + sequence.name) return else: isMC = False if globalflags.DataSource() == 'geant4': isMC = True distanceintrainaug = CfgMgr.DerivationFramework__CommonAugmentation( "DistanceInTrainAugmentation") sequence += distanceintrainaug distanceintrainaugtool = None from AthenaCommon.AppMgr import ToolSvc # create and add the tool to the alg if needed if hasattr(ToolSvc, "DistanceInTrainAugmentationTool"): distanceintrainaugtool = getattr( ToolSvc, "DistanceInTrainAugmentationTool") else: distanceintrainaugtool = CfgMgr.DerivationFramework__DistanceInTrainAugmentationTool( "DistanceInTrainAugmentationTool") from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool if isMC: ToolSvc += BunchCrossingTool("MC") distanceintrainaugtool.BCTool = "Trig::MCBunchCrossingTool/BunchCrossingTool" else: ToolSvc += BunchCrossingTool("LHC") distanceintrainaugtool.BCTool = "Trig::LHCBunchCrossingTool/BunchCrossingTool" ToolSvc += distanceintrainaugtool if not distanceintrainaugtool in distanceintrainaug.AugmentationTools: distanceintrainaug.AugmentationTools.append(distanceintrainaugtool)
def TrigMuonMonitoringTool(): from TrigMuonMonitoring.MuZTPChains import GetMuZTPChains from TrigMuonMonitoring.TrigMuonMonitoringConf import HLTMuonMonTool from TrigHLTMonitoring.HLTMonTriggerList import hltmonList # access to central tool HLTMuonMon = HLTMuonMonTool(name='HLTMuonMon', histoPathBase="/Trigger/HLT", TriggerStreamOfFile=getTriggerStreamOfFile(), ZTPPtCone30RelCut=0.5) HLTMuonMon.monitoring_muonNonIso = hltmonList.monitoring_muonNonIso HLTMuonMon.monitoring_muonIso = hltmonList.monitoring_muonIso HLTMuonMon.monitoring_MSonly = hltmonList.monitoring_MSonly HLTMuonMon.monitoring_muonEFFS = hltmonList.monitoring_muonEFFS HLTMuonMon.monitoring_muonLowpt = hltmonList.monitoring_muonLowpt HLTMuonMon.monitoring_muon_Support = hltmonList.monitoring_muon_Support setL2HypoTENames(HLTMuonMon, hltmonList) from RecExConfig.RecFlags import rec from AthenaCommon.BeamFlags import jobproperties if rec.doHeavyIon == True or rec.doHIP == True: HLTMuonMon.HI_pp_mode = False else: HLTMuonMon.HI_pp_mode = True from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool HLTMuonMon.BCTool = BunchCrossingTool() from AthenaCommon.AppMgr import ToolSvc #ToolSvc += HLTMuonMon; from AthenaCommon.GlobalFlags import globalflags inputDataType = str(globalflags.DataSource.StoredValue) if inputDataType == 'data': HLTMuonMon.truthmon_isData = 1 else: HLTMuonMon.truthmon_isData = 0 list = [HLTMuonMon] return list
def TrigMuonMonitoringTool(): from TrigMuonMonitoring.MuZTPChains import GetMuZTPChains from TrigMuonMonitoring.TrigMuonMonitoringConf import HLTMuonMonTool from TrigHLTMonitoring.HLTMonTriggerList import hltmonList # access to central tool HLTMuonMon = HLTMuonMonTool(name = 'HLTMuonMon', histoPathBase = "/Trigger/HLT", ZTPPtCone30RelCut = 0.5) HLTMuonMon.monitoring_muonNonIso = hltmonList.monitoring_muonNonIso HLTMuonMon.monitoring_muonIso = hltmonList.monitoring_muonIso HLTMuonMon.monitoring_MSonly = hltmonList.monitoring_MSonly HLTMuonMon.monitoring_muonEFFS = hltmonList.monitoring_muonEFFS HLTMuonMon.monitoring_muonLowpt = hltmonList.monitoring_muonLowpt HLTMuonMon.monitoring_muon_Support = hltmonList.monitoring_muon_Support setL2HypoTENames( HLTMuonMon, hltmonList) from RecExConfig.RecFlags import rec from AthenaCommon.BeamFlags import jobproperties if rec.doHeavyIon == True or rec.doHIP == True: HLTMuonMon.HI_pp_mode = False else: HLTMuonMon.HI_pp_mode = True from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool HLTMuonMon.BCTool = BunchCrossingTool() from AthenaCommon.AppMgr import ToolSvc ToolSvc += HLTMuonMon; list = [ "HLTMuonMonTool/HLTMuonMon" ]; return list
def GetFilledBunchFilterTool(): from AthenaCommon.Logging import logging fbft_local_logger = logging.getLogger('FilledBunchFilterTool') fbft_local_logger.verbose('Configuring monFilledBunchFilterTool') from AthenaMonitoring.DQMonFlags import DQMonFlags from AthenaCommon.GlobalFlags import globalflags from RecExConfig.RecFlags import rec if (rec.triggerStream() == 'CosmicCalo' or globalflags.DataSource.get_Value() == 'geant4' or 'collisions' not in DQMonFlags.monManDataType.get_Value() or DQMonFlags.disableFilledBunchFilter.get_Value()): fbft_local_logger.verbose( 'Filled bunch filter being configured to always return true') from AthenaMonitoring.AthenaMonitoringConf import DQDummyFilterTool return DQDummyFilterTool() from AthenaMonitoring.AthenaMonitoringConf import DQFilledBunchFilterTool from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool monFilledBunchFilterTool = DQFilledBunchFilterTool() monFilledBunchFilterTool.bunchCrossingTool = BunchCrossingTool() return monFilledBunchFilterTool
def CaloLumiBCIDToolDefault(name='CaloLumiBCIDToolDefault'): mlog = logging.getLogger('CaloLumiBCIDToolDefault') from CaloTools.CaloToolsConf import CaloLumiBCIDTool from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from AthenaCommon.GlobalFlags import globalflags if globalflags.DataSource() == 'data': from LumiBlockComps.LuminosityToolDefault import LuminosityToolDefault theLumiTool = LuminosityToolDefault() from AthenaCommon.AppMgr import ToolSvc ToolSvc += theLumiTool from IOVDbSvc.CondDB import conddb #conddb.addFolder("","/LAR/ElecCalibOfl/LArPileupShape<db>sqlite://;schema=/afs/cern.ch/user/g/gunal/public/DB/bcid/shape.db;dbname=COMP200</db><key>LArShape32</key><tag>LARElecCalibOflLArPileupShape-mc</tag>") #conddb.addFolder("","/LAR/ElecCalibOfl/LArPileupAverage<db>sqlite://;schema=/afs/cern.ch/user/g/gunal/public/DB/bcid/LArPileupAverage-data.db;dbname=COMP200</db><tag>LARElecCalibOflLArPileupAverage-data11-00</tag>") if athenaCommonFlags.isOnline: conddb.addFolder( "LAR_ONL", "/LAR/LArPileup/LArPileupShape<key>LArShape32</key>") conddb.addFolder("LAR_ONL", "/LAR/LArPileup/LArPileupAverage") else: conddb.addFolder( "LAR_OFL", "/LAR/ElecCalibOfl/LArPileupShape<key>LArShape32</key>") conddb.addFolder("LAR_OFL", "/LAR/ElecCalibOfl/LArPileupAverage") theTool = CaloLumiBCIDTool(name, isMC=False, LumiTool=theLumiTool, keyShape="LArShape32") else: from LArRecUtils.LArOFCToolDefault import LArOFCToolDefault theOFCTool = LArOFCToolDefault() from AthenaCommon.AppMgr import ToolSvc ToolSvc += theOFCTool from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool theBunchCrossingTool = BunchCrossingTool() from IOVDbSvc.CondDB import conddb conddb.addFolder("LAR_OFL", "/LAR/ElecCalibMC/Shape") #conddb.addFolder("","/LAR/ElecCalibMC/LArPileupAverage<db>sqlite://;schema=/afs/cern.ch/user/g/gunal/public/DB/bcid/LArPileupAverage-mc.db;dbname=OFLP200</db><tag>LARElecCalibMCLArPileupAverage-mc11b-00</tag>") conddb.addFolder("LAR_OFL", "/LAR/ElecCalibMC/LArPileupAverage") theTool = CaloLumiBCIDTool(name, isMC=True, LArOFCTool=theOFCTool, BunchCrossingTool=theBunchCrossingTool) return theTool
# TDT #from AthenaCommon.AppMgr import ToolSvc #from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool #tdt = Trig__TrigDecisionTool("TrigDecisionTool") #ToolSvc += tdt #from TrigDecisionMaker.TrigDecisionMakerConfig import WriteTrigDecision #trigDecWriter = WriteTrigDecision() from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() ToolSvc += theCaloNoiseTool # --- BunchCrossing Tool configuration --- from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool theBCTool = BunchCrossingTool() ToolSvc += theBCTool svcMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() include("LArCellRec//LArCollisionTime_jobOptions.py") from LArCafJobs.LArCafJobsConf import LArNoiseBursts topSequence += LArNoiseBursts("LArNoiseBursts") topSequence.LArNoiseBursts.ICaloNoiseTool = theCaloNoiseTool topSequence.LArNoiseBursts.BCTool = theBCTool topSequence.LArNoiseBursts.SigmaCut = 3.0 topSequence.LArNoiseBursts.NumberOfBunchesInFront = 30 conddb.addFolder("TDAQ", "/TDAQ/RunCtrl/DataTakingMode")
# Set up the filled bunch filter tool include.block('AthenaMonitoring/FilledBunchFilterTool_jobOptions.py') from AthenaCommon.Logging import logging fbft_local_logger = logging.getLogger('FilledBunchFilterTool_jobOptions') if not 'DQMonFlags' in dir(): fbft_local_logger.info( "FilledBunchFilterTool_jobOptions.py: DQMonFlags not yet imported - I import them now" ) from AthenaMonitoring.DQMonFlags import DQMonFlags if not 'monFilledBunchFilterTool' in dir(): fbft_local_logger.info('Configuring monFilledBunchFilterTool') from AthenaMonitoring.AthenaMonitoringConf import DQFilledBunchFilterTool from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool monFilledBunchFilterTool = DQFilledBunchFilterTool() monFilledBunchFilterTool.bunchCrossingTool = BunchCrossingTool() if (rec.triggerStream() == 'CosmicCalo' or globalflags.DataSource.get_Value() == 'geant4' or 'collisions' not in DQMonFlags.monManDataType.get_Value() or DQMonFlags.disableFilledBunchFilter.get_Value()): fbft_local_logger.info( 'Filled bunch filter being configured to always return true') monFilledBunchFilterTool.alwaysReturnTrue = True ToolSvc += monFilledBunchFilterTool del fbft_local_logger
if not hasattr(ToolSvc, 'L1TriggerTowerTool'): ToolSvc += CfgMgr.LVL1__L1TriggerTowerTool('L1TriggerTowerTool') job.Run2TriggerTowerMaker.ZeroSuppress = True # autoconfigure pedestal correction based on the input file if _doPC and _bunchSpacing not in (25, 50): log.warning( 'Only 25ns intra train bunch spacing currently supported. Dynamic pedestal correction is disabled!' ) _doPC = False ToolSvc.L1TriggerTowerTool.BaselineCorrection = _doPC from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool bct = BunchCrossingTool() if not hasattr(ToolSvc, bct.getName()): ToolSvc += bct else: bct = getattr(ToolSvc, bct.getName()) if _doPC and not hasattr(ToolSvc, 'L1DynamicPedestalProviderTxt'): ToolSvc += CfgMgr.LVL1__L1DynamicPedestalProviderTxt( 'L1DynamicPedestalProviderTxt', BunchCrossingTool=bct, InputFileEM_ShortGap='DynamicPedestalCorrection_SG_EM_%dns.txt' % _bunchSpacing, InputFileHAD_ShortGap='DynamicPedestalCorrection_SG_HAD_%dns.txt' % _bunchSpacing, InputFileEM_LongGap='DynamicPedestalCorrection_LG_EM_%dns.txt' % _bunchSpacing,
include("RecExCommon/RecExCommon_topOptions.py") ####################################################################### # # # Now set up the actual job... # # # ####################################################################### # Get ourselves a logger, mainly for fun: from AthenaCommon.Logging import logging logger = logging.getLogger("BunchCrossingExample") logger.info("Setting up the bunch crossing example job") # Access the algorithm sequence: from AthenaCommon.AlgSequence import AlgSequence theJob = AlgSequence() # Add the example algorithm, configuring the appropriate Trig::IBunchCrossingTool # in the process: from TrigAnalysisExamples.TrigAnalysisExamplesConf import Trig__BunchCrossingExample from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool theJob += Trig__BunchCrossingExample("BunchCrossingExample") theJob.BunchCrossingExample.BCTool = BunchCrossingTool() theJob.BunchCrossingExample.OutputLevel = DEBUG # Do some additional tweaking: from AthenaCommon.AppMgr import theApp theApp.EvtMax = athenaCommonFlags.EvtMax() ServiceMgr.MessageSvc.OutputLevel = INFO ServiceMgr.MessageSvc.defaultLimit = 10000000
if not (DQMonFlags.monManEnvironment == 'online' or globalflags.DataSource.get_Value() == 'geant4' or globalflags.DataSource.get_Value() == 'geant3'): tmp_CaloBaselineMon["useBadLBTool"]=TRUE tmp_CaloBaselineMon["useReadyFilterTool"]=TRUE tmp_CaloBaselineMon["useLArNoisyAlg"] = TRUE if rec.triggerStream()=='CosmicCalo': tmp_CaloBaselineMon["useLArCollisionFilter"] = TRUE tmp_CaloBaselineMon["pedestalMon_BCIDmin"] = 40 if rec.triggerStream()=='ZeroBias': tmp_CaloBaselineMon["bcidtoolMon_BCIDmax"] = 144 CaloBaseline = CaloBaselineMon( name = "CaloBaseline", useBadLBTool=tmp_CaloBaselineMon["useBadLBTool"], BadLBTool = GetLArBadLBFilterTool(), BunchCrossingTool=BunchCrossingTool(), useReadyFilterTool = tmp_CaloBaselineMon["useReadyFilterTool"], ReadyFilterTool = GetAtlasReadyFilterTool(), useLArCollisionFilterTool = tmp_CaloBaselineMon["useLArCollisionFilter"], useLArNoisyAlg = tmp_CaloBaselineMon["useLArNoisyAlg"], useBeamBackgroundRemoval = tmp_CaloBaselineMon["useBeamBackgroundRemoval"], pedestalMon_BCIDmin = tmp_CaloBaselineMon["pedestalMon_BCIDmin"], bcidtoolMon_BCIDmax = tmp_CaloBaselineMon["bcidtoolMon_BCIDmax"], ) #ToolSvc += CaloBaseline CaloMon.AthenaMonTools += [ CaloBaseline ]
## The reference is the Oracle DB include("LArConditionsCommon/LArConditionsCommon_comm_jobOptions.py") selection = "" conddb.addFolder( "LAR_ONL", "/LAR/ElecCalibOnl/Pedestal<key>PedestalElec</key>" + selection) conddb.addFolder( "LAR_OFL", "/LAR/ElecCalibOfl/AutoCorrs/AutoCorr<key>LArAutoCorrElec</key><tag>LARElecCalibOflAutoCorrsAutoCorr-UPD3-00</tag>" + selection) from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter cfg = TriggerConfigGetter() from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool bct = BunchCrossingTool() from LArCalibUtils.LArCalibUtilsConf import LArAutoCorrMaker LArAutoCorrMaker = LArAutoCorrMaker("LArAutoCorrMaker") LArAutoCorrMaker.KeyList = ["FREE"] LArAutoCorrMaker.events_ref = EventsRef LArAutoCorrMaker.nsigma = NSigma LArAutoCorrMaker.KeyOutput = KeyOutputAC LArAutoCorrMaker.GroupingType = GroupingType LArAutoCorrMaker.physics = 1 LArAutoCorrMaker.MinBCFromFront = 10 #LArAutoCorrMaker.OutputLevel = DEBUG LArAutoCorrMaker.BunchCrossingTool = bct topSequence += LArAutoCorrMaker # extrapolation to other gains
ToolSvc += CfgMgr.InDetGlobalBeamSpotMonTool( name="InDetGlobalBeamSpotMonTool", trackContainerName=jobConfig['TrackContainer'], vxContainerName=jobConfig['VertexContainer'], vxContainerWithBeamConstraint=jobConfig[ 'VertexContainerWithBeamConstraint'], minTracksPerVtx=jobConfig['MinTracksPerVtx'], minTrackPt=jobConfig['MinTrackPt'], useBeamspot=jobConfig['useBeamSpot']) if jobConfig['UseFilledBCIDsOnly']: print "This is AKMAKMAKM" # Selection on non-empty BCIDs #include("AthenaMonitoring/FilledBunchFilterTool_jobOptions.py") from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool bunchCrossingTool = BunchCrossingTool("LHC") # This tool is throwing tons of warnings for no good reason, make it quieter. bunchCrossingTool.OutputLevel = ERROR from AthenaMonitoring.AthenaMonitoringConf import DQFilledBunchFilterTool monFilledBunchFilterTool = DQFilledBunchFilterTool() monFilledBunchFilterTool.bunchCrossingTool = bunchCrossingTool ToolSvc += monFilledBunchFilterTool ToolSvc.InDetGlobalBeamSpotMonTool.FilterTools.append( monFilledBunchFilterTool) print ToolSvc.InDetGlobalBeamSpotMonTool # Monitoring manager and output file #from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager topSequence += CfgMgr.AthenaMonManager( name="BeamSpotMonManager",
#here are the helpers helper_collTime = AthMonitorCfgHelperOld(DQMonFlags, collTimeGroupName) #then the algorithms #from AthenaMonitoring.AthenaMonitoringConf import ExampleMonitorAlgorithm from LArMonitoring.LArMonitoringConf import LArCollisionTimeMonAlg larCollTimeMonAlg = helper_collTime.addAlgorithm(LArCollisionTimeMonAlg, "larCollTimeMonAlg") larCollTimeMonAlg.CollTimeGroupName=collTimeGroupName larCollTimeMonAlg.IsOnline = isOnline #add a tool from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool larCollTimeMonAlg.BunchCrossingTool = BunchCrossingTool() #now the groups collTimeGroup = helper_collTime.addGroup( larCollTimeMonAlg, collTimeGroupName, "/LAr/" ) #define the histograms from LArMonitoring import GlobalVariables #to define the ranges larColTime_hist_path='CollisionTime/' collTimeGroup.defineHistogram('ecTimeDiff;LArCollTime', title='LArCollisionTime - difference of avg time from ECC and ECA;<t_{C}> - <t_{A}> (ns);Number of events (weighted by energy/GeV) per ns', path=larColTime_hist_path,
#==================================================================== # FIND THE RUN NUMBER (NEEDED TO LOCATE XMLs) #==================================================================== import PyUtils.AthFile as athFile from AthenaCommon.AthenaCommonFlags import athenaCommonFlags af = athFile.fopen(svcMgr.EventSelector.InputCollections[0]) run_number = af.run_number[0] #==================================================================== # SETUP BUNCH CROSSING TOOL - WE WILL ALWAYS RUN OVER EB DATA #==================================================================== from AthenaCommon.GlobalFlags import globalflags isMC = 'IS_SIMULATION' in af.fileinfos['evt_type'] #globalflags.DataSource = 'data' globalflags.DatabaseInstance = 'CONDBR2' from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool if isMC: ToolSvc += BunchCrossingTool("MC") else: ToolSvc += BunchCrossingTool("LHC") #==================================================================== # SKIMMING TOOLS #==================================================================== # Set up your skimming tools (you can have as many as you need). # The tools must use the DerivationFrameworkInterfaces as in this example. # Currently no skimming - keep all events #==================================================================== # AUGMENTATION TOOLS # Used to decorate enhanced bias weighting quantites for rate estimations #==================================================================== # # TODO this doesn't work - component not yet exposed from EnhancedBiasWeighter.EnhancedBiasWeighterConf import EnhancedBiasWeighter TRIG1AugmentationTool = EnhancedBiasWeighter(name="TRIG1AugmentationTool")
svcMgr += THistSvc() if hasattr(runArgs, "outputNTUP_SAMPLESMONFile"): from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg CaloNoiseCondAlg(noisetype="totalNoise") from LArCafJobs.LArCafJobsConfig import DefaultShapeDumper DefaultShapeDumper('LArShapeDumper', 'FREE', noiseSignifCut=5, doShape=True, doTrigger=True, caloType='EMHECFCAL') topSequence.LArShapeDumper.TrigDecisionTool = tdt topSequence.LArShapeDumper.FileName = runArgs.outputNTUP_SAMPLESMONFile topSequence.LArShapeDumper.OutputLevel = DEBUG topSequence.LArShapeDumper.BunchCrossingTool = BunchCrossingTool() if ("Empty" in rec.triggerStream()): printfunc("LArCellsEmpty: Process only empty bunch crossings") topSequence.LArShapeDumper.onlyEmptyBC = True svcMgr.THistSvc.Output += [ "AANT DATAFILE='" + runArgs.outputNTUP_SAMPLESMONFile + "' OPT='RECREATE'" ] if hasattr(runArgs, "outputNTUP_HECNOISEFile"): from LArCafJobs.LArCafJobsConf import LArHECNoise topSequence += LArHECNoise('LArHECNoise') #topSequence.LArHECNoise.OutputLevel=DEBUG svcMgr.THistSvc.Output += [