def LArAutoCorrNoiseSCToolDefault(name="LArAutoCorrNoiseSCToolDefault", **kw): # call base class constructor from AthenaCommon import CfgMgr kw['name'] = name tool = CfgMgr.LArAutoCorrNoiseTool(**kw) mlog = logging.getLogger('LArAutoCorrNoiseSCToolDefault::__init__ ') mlog.info("entering") # do the configuration tool.MCSym = False tool.SuperCell = True tool.keyAutoCorr = "LArAutoCorrSC" from LArROD.LArRODFlags import larRODFlags tool.NSamples = larRODFlags.nSamples() from IOVDbSvc.CondDB import conddb if (conddb.isMC and not conddb.folderRequested('/LAR/IdentifierOfl/OnOffIdMap_SC')): conddb.addFolder( "LAR_OFL", "<tag>LARIdentifierOflOnOffIdMap_SC-000</tag>/LAR/IdentifierOfl/OnOffIdMap_SC" ) if (conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/AutoCorr')): conddb.addFolder( "LAR_OFL", "<tag>LARElecCalibMCSCAutoCorr-000</tag>/LAR/ElecCalibMCSC/AutoCorr" ) return tool
def BasicTRTFastDigitizationTool(name, **kwargs): from IOVDbSvc.CondDB import conddb if not conddb.folderRequested('/TRT/Calib/errors'): conddb.addFolderSplitOnline("TRT", "/TRT/Onl/Calib/errors", "/TRT/Calib/errors") if not conddb.folderRequested("/TRT/Calib/PID_vector"): conddb.addFolderSplitOnline("TRT", "/TRT/Onl/Calib/PID_vector", "/TRT/Calib/PID_vector") if not conddb.folderRequested("/TRT/Calib/ToT/ToTVectors"): conddb.addFolder("TRT_OFL", "/TRT/Calib/ToT/ToTVectors") if not conddb.folderRequested("/TRT/Calib/ToT/ToTValue"): conddb.addFolder("TRT_OFL", "/TRT/Calib/ToT/ToTValue") #choose random number service from Digitization.DigitizationFlags import digitizationFlags kwargs.setdefault("RndmSvc", digitizationFlags.rndmSvc()) streamName = kwargs.setdefault("RandomStreamName", "FastTRTDigitization") # set rndm seeds if not digitizationFlags.rndmSeedList.checkForExistingSeed(streamName): digitizationFlags.rndmSeedList.addSeed(streamName, 45123, 94345) from Digitization.DigitizationFlags import digitizationFlags if digitizationFlags.doXingByXingPileUp(): kwargs.setdefault("FirstXing", FastTRT_FirstXing()) kwargs.setdefault("LastXing", FastTRT_LastXing()) from AthenaCommon import CfgMgr return CfgMgr.TRTFastDigitizationTool(name, **kwargs)
def commonSCT_FastDigitizationConfig(name, **kwargs): # Setup the DCS folders and Svc used in the sctSiliconConditionsSvc from IOVDbSvc.CondDB import conddb if not conddb.folderRequested('/SCT/DCS/CHANSTAT'): conddb.addFolder("DCS_OFL", "/SCT/DCS/CHANSTAT") if not conddb.folderRequested('/SCT/DCS/MODTEMP'): conddb.addFolder("DCS_OFL", "/SCT/DCS/MODTEMP") if not conddb.folderRequested('/SCT/DCS/HV'): conddb.addFolder("DCS_OFL", "/SCT/DCS/HV") from AthenaCommon.AppMgr import ServiceMgr if not hasattr(ServiceMgr, "InDetSCT_DCSConditionsSvc"): from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_DCSConditionsSvc InDetSCT_DCSConditionsSvc = SCT_DCSConditionsSvc( name="InDetSCT_DCSConditionsSvc") ServiceMgr += InDetSCT_DCSConditionsSvc kwargs.setdefault("ClusterMaker", "FastClusterMakerTool") # Import Digitization job properties from Digitization.DigitizationFlags import digitizationFlags # set the random service, stream name streamName = kwargs.setdefault("RndmEngine", "FastSCT_Digitization") kwargs.setdefault("RndmSvc", digitizationFlags.rndmSvc()) # set rndm seeds if not digitizationFlags.rndmSeedList.checkForExistingSeed(streamName): digitizationFlags.rndmSeedList.addSeed(streamName, 49261510, 105132394) if digitizationFlags.doXingByXingPileUp(): kwargs.setdefault("FirstXing", FastSCT_FirstXing()) kwargs.setdefault("LastXing", FastSCT_LastXing()) from AthenaCommon import CfgMgr return CfgMgr.SCT_FastDigitizationTool(name, **kwargs)
def setFolders(self): from IOVDbSvc.CondDB import conddb if not conddb.folderRequested(self.channelFolder): if self.channelFolderDb is None: conddb.addFolderSplitMC(self.dbInstance, self.channelFolder, self.channelFolder, className="CondAttrListVec") else: conddb.addFolder(self.dbInstance, self.channelFolderDb, className="CondAttrListVec") if not conddb.folderRequested(self.moduleFolder): if self.moduleFolderDb is None: conddb.addFolderSplitMC(self.dbInstance, self.moduleFolder, self.moduleFolder, className="CondAttrListVec") else: conddb.addFolder(self.dbInstance, self.moduleFolderDb, className="CondAttrListVec") if not conddb.folderRequested(self.murFolder): if self.murFolderDb is None: conddb.addFolderSplitMC(self.dbInstance, self.murFolder, self.murFolder, className="CondAttrListVec") else: conddb.addFolder(self.dbInstance, self.murFolderDb, className="CondAttrListVec")
def PixelDigitizationTool(name="PixelDigitizationTool", **kwargs): kwargs.setdefault("HardScatterSplittingMode", 0) from IOVDbSvc.CondDB import conddb if conddb.dbmc == "OFLP200" and not conddb.folderRequested("/PIXEL/HitDiscCnfg"): conddb.addFolderSplitMC("PIXEL","/PIXEL/HitDiscCnfg","/PIXEL/HitDiscCnfg") if not conddb.folderRequested('PIXEL/PixReco'): conddb.addFolder('PIXEL_OFL','/PIXEL/PixReco') return BasicPixelDigitizationTool(name, **kwargs)
def fastElectronSequence(ConfigFlags): """ second step: tracking.....""" from TrigInDetConfig.InDetSetup import makeInDetAlgs RoIs = "EMIDRoIs" # contract with the fastCalo viewAlgs, viewVerify = makeInDetAlgs( whichSignature="Electron", separateTrackParticleCreator="Electron", rois=RoIs) # A simple algorithm to confirm that data has been inherited from parent view # Required to satisfy data dependencies from TriggerMenuMT.HLTMenuConfig.CommonSequences.CaloSequenceSetup import CaloMenuDefs viewVerify.DataObjects += [('xAOD::TrigEMClusterContainer', 'StoreGateSvc+' + CaloMenuDefs.L2CaloClusters), ('TrigRoiDescriptorCollection', 'StoreGateSvc+' + RoIs)] from IOVDbSvc.CondDB import conddb if not conddb.folderRequested("/PIXEL/DCS/FSMSTATUS"): viewVerify.DataObjects += [('CondAttrListCollection', 'ConditionStore+/PIXEL/DCS/FSMSTATUS')] if not conddb.folderRequested("/PIXEL/DCS/FSMSTATE"): viewVerify.DataObjects += [('CondAttrListCollection', 'ConditionStore+/PIXEL/DCS/FSMSTATE')] TrackParticlesName = "" for viewAlg in viewAlgs: if "InDetTrigTrackParticleCreatorAlg" in viewAlg.name(): TrackParticlesName = viewAlg.TrackParticlesName from TrigEgammaHypo.TrigEgammaFastElectronFexMTConfig import EgammaFastElectronFex_1 theElectronFex = EgammaFastElectronFex_1() theElectronFex.TrigEMClusterName = CaloMenuDefs.L2CaloClusters theElectronFex.TrackParticlesName = TrackParticlesName theElectronFex.ElectronsName = recordable("HLT_FastElectrons") # EVCreator: l2ElectronViewsMaker = EventViewCreatorAlgorithm("IMl2Electron") l2ElectronViewsMaker.RoIsLink = "initialRoI" l2ElectronViewsMaker.RoITool = ViewCreatorInitialROITool() l2ElectronViewsMaker.InViewRoIs = RoIs l2ElectronViewsMaker.Views = "EMElectronViews" l2ElectronViewsMaker.ViewFallThrough = True l2ElectronViewsMaker.RequireParentView = True theElectronFex.RoIs = l2ElectronViewsMaker.InViewRoIs # ATR-20453 # Until such time as FS and RoI collections do not interfere, a hacky fix #electronInViewAlgs = parOR("electronInViewAlgs", viewAlgs + [ theElectronFex ]) electronInViewAlgs = seqAND("electronInViewAlgs", viewAlgs + [theElectronFex]) l2ElectronViewsMaker.ViewNodeName = "electronInViewAlgs" electronAthSequence = seqAND("electronAthSequence", [l2ElectronViewsMaker, electronInViewAlgs]) return (electronAthSequence, l2ElectronViewsMaker, theElectronFex.ElectronsName)
def PixelDigitizationTool(name="PixelDigitizationTool", **kwargs): kwargs.setdefault("HardScatterSplittingMode", 0) from IOVDbSvc.CondDB import conddb if conddb.dbmc == "OFLP200" and not conddb.folderRequested("/PIXEL/HitDiscCnfg"): conddb.addFolderSplitMC("PIXEL", "/PIXEL/HitDiscCnfg", "/PIXEL/HitDiscCnfg") if not conddb.folderRequested("PIXEL/PixReco"): conddb.addFolder("PIXEL_OFL", "/PIXEL/PixReco") return BasicPixelDigitizationTool(name, **kwargs)
def LArOFCSCToolDefault(name="LArOFCSCToolDefault", **kw): # call base class constructor from AthenaCommon import CfgMgr kw['name'] = name tool = CfgMgr.LArOFCTool(**kw) mlog = logging.getLogger('LArOFCSCToolDefault::__init__ ') mlog.info("entering") # do the configuration if globalflags.DataSource() == 'data': return False else: tool.MCSym = False tool.IsMC = True tool.IsSuperCell = True tool.FromDatabase = False tool.keyShape = "LArShapeSC" tool.keyNoise = "LArNoiseSC" tool.keyPedestal = "LArPedestalSC" tool.UseDelta = 0 ### avoid unforseed options ### #tool.Dump = True from LArRecUtils.LArAutoCorrTotalSCToolDefault import LArAutoCorrTotalSCToolDefault theAutoCorrTool = LArAutoCorrTotalSCToolDefault() from AthenaCommon.AppMgr import ToolSvc ToolSvc += theAutoCorrTool tool.AutoCorrTool = theAutoCorrTool from IOVDbSvc.CondDB import conddb if (conddb.isMC and not conddb.folderRequested('/LAR/IdentifierOfl/OnOffIdMap_SC')): conddb.addFolder( "LAR_OFL", "<tag>LARIdentifierOflOnOffIdMap_SC-000</tag>/LAR/IdentifierOfl/OnOffIdMap_SC" ) if (conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/Pedestal')): conddb.addFolder( "LAR_OFL", "<tag>LARElecCalibMCSCPedestal-000</tag>/LAR/ElecCalibMCSC/Pedestal" ) if (conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/Noise')): conddb.addFolder( "LAR_OFL", "<tag>LARElecCalibMCSCNoise-000</tag>/LAR/ElecCalibMCSC/Noise") if (conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/Shape')): conddb.addFolder( "LAR_OFL", "<tag>LARElecCalibMCSCShape-000</tag>/LAR/ElecCalibMCSC/Shape") return tool
def setFolders(self): from IOVDbSvc.CondDB import conddb if not conddb.folderRequested(self.noiseFolder): conddb.addFolderSplitMC("SCT", self.noiseFolder, self.noiseFolder, className="CondAttrListCollection") if not conddb.folderRequested(self.gainFolder): conddb.addFolderSplitMC("SCT", self.gainFolder, self.gainFolder, className="CondAttrListCollection")
def setSCT_CablingDataBase(): from IOVDbSvc.CondDB import conddb from InDetRecExample.InDetJobProperties import InDetFlags SCTConfigurationFolderPath='/SCT/DAQ/Config/' #if its COMP200, use old folders... if (conddb.dbdata == "COMP200"): SCTConfigurationFolderPath='/SCT/DAQ/Configuration/' #...but now check if we want to override that decision with explicit flag (if there is one) try: if InDetFlags.ForceCoraCool(): SCTConfigurationFolderPath='/SCT/DAQ/Configuration/' except Exception: pass try: if InDetFlags.ForceCoolVectorPayload(): SCTConfigurationFolderPath='/SCT/DAQ/Config/' except Exception: pass try: if (InDetFlags.ForceCoolVectorPayload() and InDetFlags.ForceCoraCool()): # Setup logger from AthenaCommon.Logging import logging msg = logging.getLogger("SCT_CablingConfig") msg.setLevel(logging.INFO) msg.warning("*** SCT DB CONFIGURATION FLAG CONFLICT: Both CVP and CoraCool selected****") SCTConfigurationFolderPath='' except Exception: pass SCTRodConfigPath=SCTConfigurationFolderPath+'ROD' SCTMurConfigPath=SCTConfigurationFolderPath+'MUR' SCTRodMurConfigPath=SCTConfigurationFolderPath+'RODMUR' SCTGeogConfigPath=SCTConfigurationFolderPath+'Geog' if not conddb.folderRequested(SCTRodConfigPath): conddb.addFolderSplitMC("SCT",SCTRodConfigPath,SCTRodConfigPath, className="CondAttrListVec") if not conddb.folderRequested(SCTMurConfigPath): conddb.addFolderSplitMC("SCT", SCTMurConfigPath, SCTMurConfigPath, className="CondAttrListVec") if not conddb.folderRequested(SCTRodMurConfigPath): conddb.addFolderSplitMC("SCT",SCTRodMurConfigPath,SCTRodMurConfigPath, className="CondAttrListVec") if not conddb.folderRequested(SCTGeogConfigPath): conddb.addFolderSplitMC("SCT",SCTGeogConfigPath,SCTGeogConfigPath, className="CondAttrListVec") return SCTConfigurationFolderPath
def LuminosityToolOfflineRun2(name="LuminosityTool"): mlog = logging.getLogger(name) # Set up DB configuration from IOVDbSvc.CondDB import conddb from RecExConfig.RecFlags import rec lumiTool = LuminosityTool(name) # Check if this is express stream or bulk if rec.doExpressProcessing(): lumiFolder = "/TRIGGER/LUMI/OnlPrefLumi" if not conddb.folderRequested(lumiFolder): conddb.addFolder('TRIGGER_ONL', lumiFolder) else: lumiFolder = "/TRIGGER/OFLLUMI/OflPrefLumi" if not conddb.folderRequested(lumiFolder): conddb.addFolder('TRIGGER_OFL', lumiFolder) mlog.info("LuminosityToolOfflineRun2 requested %s", lumiFolder) lumiTool.LumiFolderName = lumiFolder mlog.info("Created Run2 %s using folder %s" % (name, lumiFolder)) # Need the calibration tool just to get the proper MuToLumi value toolName = "OnlineLumiCalibrationTool" lumiTool.OnlineLumiCalibrationTool = toolName if not hasattr(svcMgr.ToolSvc, toolName): from CoolLumiUtilities.OnlineLumiCalibrationToolDefault import OnlineLumiCalibrationToolDefault svcMgr.ToolSvc += OnlineLumiCalibrationToolDefault(toolName) mlog.info("LuminosityToolOfflineRun2 added tool %s", toolName) else: mlog.info("LuminosityToolOfflineRun2 found %s already defined!" % toolName) # Other folders needed by LuminosityTool folder = "/TRIGGER/LUMI/LBLB" if not conddb.folderRequested(folder): conddb.addFolder('TRIGGER', folder) mlog.info("LuminosityToolOfflineRun2 requested %s", folder) lumiTool.LBLBFolderName = folder # Other folder names are now blank by default return lumiTool
def FastClusterMakerTool(name="FastClusterMakerTool", **kwargs): from Digitization.DigitizationFlags import digitizationFlags #FIXME: at some point we should move away from being dependent on the experimentalDigi flags. if 'doFastSCT_Digi' in digitizationFlags.experimentalDigi( ) and not 'doFastPixelDigi' in digitizationFlags.experimentalDigi(): kwargs.setdefault("UsePixelCalibCondDB", False) kwargs.setdefault("PixelCalibSvc", "") kwargs.setdefault("PixelOfflineCalibSvc", "") else: from AthenaCommon.Include import include include("PixelConditionsServices/PixelDCSSvc_jobOptions.py") include.block("PixelConditionsServices/PixelDCSSvc_jobOptions.py") from AthenaCommon.AppMgr import ToolSvc if not hasattr(ToolSvc, "PixelRecoDbTool"): from PixelConditionsTools.PixelConditionsToolsConf import PixelRecoDbTool ToolSvc += PixelRecoDbTool() ToolSvc.PixelRecoDbTool.InputSource = 1 # setup PixelCalibDbTool in ToolSvc if not hasattr(ToolSvc, "PixelCalibDbTool"): from PixelConditionsTools.PixelConditionsToolsConf import PixelCalibDbTool ToolSvc += PixelCalibDbTool() from IOVDbSvc.CondDB import conddb if not conddb.folderRequested('/PIXEL/PixCalib'): conddb.addFolder("PIXEL_OFL", "/PIXEL/PixCalib") if not conddb.folderRequested('/PIXEL/ReadoutSpeed'): conddb.addFolder("PIXEL_OFL", "/PIXEL/ReadoutSpeed") from AthenaCommon.AppMgr import ServiceMgr if not hasattr(ServiceMgr, "PixelCalibSvc"): from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc InDetPixelCalibSvc = PixelCalibSvc() ServiceMgr += InDetPixelCalibSvc if not hasattr(ServiceMgr, "PixelSiPropertiesSvc"): from SiLorentzAngleSvc.LorentzAngleSvcSetup import lorentzAngleSvc from SiPropertiesSvc.SiPropertiesSvcConf import SiPropertiesSvc PixelSiPropertiesSvc = SiPropertiesSvc( name="PixelSiPropertiesSvc", DetectorName="Pixel", SiConditionsServices=lorentzAngleSvc.pixelSiliconConditionsSvc) ServiceMgr += PixelSiPropertiesSvc if not hasattr(ServiceMgr, "PixelOfflineCalibSvc"): from PixelConditionsServices.PixelConditionsServicesConf import PixelOfflineCalibSvc ServiceMgr += PixelOfflineCalibSvc() ServiceMgr.PixelOfflineCalibSvc.HDCFromCOOL = False from AthenaCommon import CfgMgr return CfgMgr.InDet__ClusterMakerTool(name, **kwargs)
def GetBadLBFilterTool(name, defects, alwaysReturnTrue=False, ignoreRecoverable=False, autoconfigure=True, origDbTag=None): """ Configure an instance of the bad LB filter tool. If called twice with the same options, will return the same instance. Arguments: - name: name of instance to create - defects: the defects to use for LB rejection. Tool will return false if any of these defects is present. These may be virtual defects. NOTE: the value you pass must be a 'hashable' type. The best choice is to pass a tuple; you can create a tuple from any iterable object with tuple(obj). - alwaysReturnTrue (optional; default=False): if True, the tool will never reject any LBs. - ignoreRecoverable (optional; default=False): if True, the tool will ignore defects that are marked as recoverable - autoconfigure (optional; default=True): automatically handle certain cases, e.g. Monte Carlo, where we want to always return True - origDbTag (optional): if set, will override automatic configuration of database tag (only for testing) """ import operator from AthenaMonitoring.DQMonFlags import DQMonFlags from AthenaCommon.GlobalFlags import globalflags from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.Logging import logging log = logging.getLogger('BadLBFilterTool') # if online or MC, we don't want to do any filtering, or even access # the DBs if autoconfigure and (DQMonFlags.monManEnvironment == 'online' or globalflags.DataSource.get_Value() == 'geant4' ): log.info('Disabling bad LB filter tool due to inappropriate environment; returning dummy') from AthenaMonitoring.AthenaMonitoringConf import DQDummyFilterTool monFilterTool = DQDummyFilterTool(name) ToolSvc += monFilterTool return monFilterTool from AthenaMonitoring.AthenaMonitoringConf import DQBadLBFilterTool from DQDefects import DefectsDB dbtag = _resolve_db_tag(origDbTag) dbname=_InstanceFromProjectName() ddb = DefectsDB('COOLOFL_GLOBAL/' + dbname, tag=dbtag) primary_defects = set() for defect in defects: if defect in ddb.defect_names: primary_defects.add(defect) elif defect in ddb.virtual_defect_names: primary_defects |= ddb.virtual_defect_logics(defect).primary_defects else: raise ValueError('%s is not a known defect' % defect) log.info ("Tool name %s to be configured with intolerable defects %s" % (name, list(primary_defects))) primary_defect_ids = [ddb.defect_id_map[id] for id in primary_defects] monFilterTool = DQBadLBFilterTool(name) monFilterTool.defectList = primary_defect_ids monFilterTool.alwaysReturnTrue = alwaysReturnTrue monFilterTool.ignoreRecoverable = ignoreRecoverable if globalflags.DataSource.get_Value() != 'geant4': from IOVDbSvc.CondDB import conddb if not conddb.folderRequested('/GLOBAL/DETSTATUS/DEFECTS'): conddb.addFolder('GLOBAL_OFL', '/GLOBAL/DETSTATUS/DEFECTS') ToolSvc += monFilterTool return monFilterTool
def __lblbFolderAccess( c, **kw ): __folder = "/TRIGGER/LUMI/LBLB" from IOVDbSvc.CondDB import conddb if not conddb.folderRequested( __folder ): conddb.addFolderWithTag( "TRIGGER", __folder, "HEAD" ) pass return
def OnlineLumiCalibrationToolDefault(name="OnlineLumiCalibrationTool"): mlog = logging.getLogger(name) if hasattr(svcMgr.ToolSvc, name): # re-use previously configured tool mlog.info( "OnlineLumiCalibrationToolDefault returning existing tool %s", name) return getattr(svcMgr.ToolSvc, name) # Check if this is MC, return unconfigured tool (which will do nothing) if so # Instantiate new tool, by default configuration will do nothing olcTool = OnlineLumiCalibrationTool(name) # Now configure based on the environment from IOVDbSvc.CondDB import conddb if conddb.isMC: return olcTool # Need this in both Run1 and Run2 folder = '/TDAQ/OLC/CALIBRATIONS' olcTool.CalibrationFolderName = folder # Mistakenly created as multi-version folder, must specify HEAD if not conddb.folderRequested(folder): conddb.addFolder('TDAQ', folder) mlog.info("OnlineLumiCalibrationToolDefault requested %s", folder) return olcTool
def setFolder(self): from IOVDbSvc.CondDB import conddb if not conddb.folderRequested(self.folder): if self.folderDb is None: self.folderDb = self.folder conddb.addFolder(self.dbInstance, self.folderDb, className="CondAttrListCollection")
def BunchLumisToolDefault(name="BunchLumisTool"): mlog = logging.getLogger(name) if hasattr(svcMgr.ToolSvc, name): # re-use previously configured tool mlog.info("BunchLumisToolDefault returning existing tool %s", name) return getattr(svcMgr.ToolSvc, name) # Instantiate new tool, by default configuration will do nothing blTool = BunchLumisTool(name) # Now configure based on the environment from IOVDbSvc.CondDB import conddb # Run1 if conddb.dbdata == "COMP200": folder = '/TDAQ/OLC/BUNCHLUMIS' blTool.BunchLumisFolderName = folder from IOVDbSvc.CondDB import conddb if not conddb.folderRequested(folder): from AthenaCommon.GlobalFlags import globalflags if globalflags.isOverlay(): # Load reduced channel list for overlay jobs to try to reduce COOL access # Need Lucid AND, OR, HitOR, BcmH OR, BcmV OR conddb.addFolder( 'TDAQ', '<channelSelection>101,102,103,201,211</channelSelection> /TDAQ/OLC/BUNCHLUMIS' ) else: conddb.addFolder('TDAQ', folder) mlog.info("BunchLumisToolDefault requested %s", folder) # Also take care of the FillParamsTool fpToolName = "FillParamsTool" blTool.FillParamsTool = fpToolName # Make sure tool exists also if not hasattr(svcMgr.ToolSvc, fpToolName): from CoolLumiUtilities.FillParamsToolDefault import FillParamsToolDefault svcMgr.ToolSvc += FillParamsToolDefault(fpToolName) mlog.info("BunchLumisToolDefault added tool %s", fpToolName) # Run2 - do nothing elif conddb.dbdata == "CONDBR2": pass # Unknown, complain and do nothing else: mlog.warning( "BunchLumisToolDefault can't resolve conddb.dbdata = %s, assume Run2!" % conddb.dbdata) pass return blTool
def setrunforfolder(name): if conddb.folderRequested(name): printfunc ("setting run to "+str(runN)+" and lumiblock "+str(lumiBlock)) frnTag="<forceRunNumber>"+str(runN)+"</forceRunNumber>" flbTag="<forceLumiblockNumber>"+str(lumiBlock)+"</forceLumiblockNumber>" conddb.addMarkup(name,frnTag) conddb.addMarkup(name,flbTag) global overlaylongfolders overlaylongfolders += [name]
def LArADC2MeVSCToolDefault (name="LArADC2MeVSCToolDefault", **kw): # call base class constructor from AthenaCommon import CfgMgr kw['name'] = name tool = CfgMgr.LArADC2MeVTool (**kw) mlog = logging.getLogger( 'LArADC2MeVSCToolDefault::__init__ ' ) mlog.info("entering") tool.IsSC=True tool.MCSym = False tool.UseFEBGainTresholds=True # do the configuration if globalflags.DataSource()=='data': # to be changed to True when everything is ready mlog.info("in data case") tool.UseMphysOverMcal = True tool.UseHVScaleCorr = False if larCondFlags.useLArFEBGainThresholds(): from LArRecUtils.LArFEBConfigReaderDefault import LArFEBConfigReaderDefault theLArFebConfigReader=LArFEBConfigReaderDefault() #theLArFebConfigReader.OutputLevel=DEBUG ServiceMgr.ToolSvc+=theLArFebConfigReader tool.FebConfigReader=theLArFebConfigReader tool.UseFEBGainTresholds=True else: mlog.info("in MC case") tool.UseMphysOverMcal = False tool.UseHVScaleCorr = False tool.keyADC2DAC='LArRampSC' tool.keyDAC2uA='LArDAC2uASC' tool.keyuA2MeV='LAruA2MeVSC' from IOVDbSvc.CondDB import conddb if ( conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/DAC2uA') ) : conddb.addFolder("LAR_OFL","<tag>LARElecCalibMCSCDAC2uA-000</tag>/LAR/ElecCalibMCSC/DAC2uA") if ( conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/uA2MeV') ) : conddb.addFolder("LAR_OFL","<tag>LARElecCalibMCSCuA2MeV-000</tag>/LAR/ElecCalibMCSC/uA2MeV") if ( conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/Ramp') ) : conddb.addFolder("LAR_OFL","<tag>LARElecCalibMCSCRamp-000</tag>/LAR/ElecCalibMCSC/Ramp") return tool
def adjustshortfolder(name): global overlaylongfolders if name in overlaylongfolders: printfunc("already made " + name + " long") else: if conddb.folderRequested(name): printfunc("setting " + name + " to 10s cache") conddb.addMarkup(name, "<cache>10</cache>") else: printfunc("folder " + name + " was not requested?!")
def __init__(self, name = 'ConfiguredTrigL2_Extrapolator') : Trk__Extrapolator.__init__(self, name) from AthenaCommon.AppMgr import ToolSvc from TrkDetDescrSvc.AtlasTrackingGeometrySvc import AtlasTrackingGeometrySvc from IOVDbSvc.CondDB import conddb if not (conddb.folderRequested( "/Indet/TrkErrorScaling" ) or conddb.folderRequested( "/Indet/Onl/TrkErrorScaling" )): conddb.addFolderSplitOnline("INDET", "/Indet/Onl/TrkErrorScaling", "/Indet/TrkErrorScaling" ) from TrkExSTEP_Propagator.TrkExSTEP_PropagatorConf import Trk__STEP_Propagator TrigL2_StepPropagator = Trk__STEP_Propagator(name = 'TrigL2_StepPropagator') ToolSvc += TrigL2_StepPropagator from TrkExRungeKuttaPropagator.TrkExRungeKuttaPropagatorConf import Trk__RungeKuttaPropagator TrigL2_RKPropagator = Trk__RungeKuttaPropagator(name = 'TrigL2_RKPropagator') ToolSvc += TrigL2_RKPropagator from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags if InDetTrigFlags.propagatorType() is "STEP": TrigL2_Propagator = TrigL2_StepPropagator else: TrigL2_Propagator = TrigL2_RKPropagator from AthenaCommon.AppMgr import ServiceMgr as svcMgr AtlasTrackingGeometrySvc = svcMgr.AtlasTrackingGeometrySvc from TrkExTools.TrkExToolsConf import Trk__Navigator TrigL2_Navigator = Trk__Navigator(name = 'TrigL2_Navigator',TrackingGeometrySvc = AtlasTrackingGeometrySvc) ToolSvc += TrigL2_Navigator from TrkExTools.TrkExToolsConf import Trk__MaterialEffectsUpdator TrigL2_MaterialUpdator = Trk__MaterialEffectsUpdator(name = "TrigL2_MaterialEffectsUpdator") ToolSvc += TrigL2_MaterialUpdator TrigL2_SubPropagators = [] TrigL2_SubUpdators = [] TrigL2_SubPropagators += [ TrigL2_Propagator.name() ] TrigL2_SubUpdators += [ TrigL2_MaterialUpdator.name() ] TrigL2_SubPropagators += [ TrigL2_Propagator.name() ] TrigL2_SubUpdators += [ TrigL2_MaterialUpdator.name() ] TrigL2_SubPropagators += [ TrigL2_StepPropagator.name() ] TrigL2_SubUpdators += [ TrigL2_MaterialUpdator.name() ] self.Propagators = [ TrigL2_RKPropagator, TrigL2_StepPropagator] self.MaterialEffectsUpdators = [ TrigL2_MaterialUpdator ] self.Navigator = TrigL2_Navigator self.SubPropagators = TrigL2_SubPropagators self.SubMEUpdators = TrigL2_SubUpdators
def setFolders(self): from IOVDbSvc.CondDB import conddb if ((self.readAllDBFolders and self.returnHVTemp) or (not self.readAllDBFolders and not self.returnHVTemp)): if not conddb.folderRequested(self.stateFolder): conddb.addFolder(self.dbInstance, self.stateFolder, className="CondAttrListCollection") if ((self.readAllDBFolders and self.returnHVTemp) or self.returnHVTemp): if not conddb.folderRequested(self.hvFolder): conddb.addFolder(self.dbInstance, self.hvFolder, className="CondAttrListCollection") if not conddb.folderRequested(self.tempFolder): conddb.addFolder(self.dbInstance, self.tempFolder, className="CondAttrListCollection")
def TrigConfBunchCrossingTool(): # The default name of the tool: __defaultToolName = "BunchCrossingTool" # Get ourselves a logger: from AthenaCommon.Logging import logging __logger = logging.getLogger("TrigConfBunchCrossingTool") # Check if the tool already exists. If it does, let's just return it without # any modifications: from AthenaCommon.AppMgr import ToolSvc if hasattr(ToolSvc, __defaultToolName): __logger.debug("Tool already exists, not configuring it again") return getattr(ToolSvc, __defaultToolName) # Create a new instance of the tool if it doesn't exist yet: from TrigBunchCrossingTool.TrigBunchCrossingToolConf import \ Trig__TrigConfBunchCrossingTool __tool = Trig__TrigConfBunchCrossingTool(__defaultToolName) # Create a default configuration for it: __logger.info("Set the default values for the TrigConfBunchCrossingTool " "configuration") # Check for a TrigConfigSvc: from AthenaCommon.AppMgr import ServiceMgr as svcMgr if not hasattr(svcMgr, "TrigConfigSvc"): __logger.info( "Job has no TrigConfigSvc, falling back to xAODConfigSvc") from TrigConfxAOD.TrigConfxAODConf import TrigConf__xAODConfigSvc from AthenaCommon.AppMgr import ServiceMgr cfgsvc = TrigConf__xAODConfigSvc('xAODConfigSvc') ServiceMgr += cfgsvc __tool.ConfigSvc = cfgsvc else: # We do have a TrigConfigSvc. Now make sure that DSConfigSvc has access to the BG COOL folders: from IOVDbSvc.CondDB import conddb __dbConnection = "TRIGGER" __folders = [ "LVL1/BunchGroupKey", "LVL1/BunchGroupDescription", "LVL1/BunchGroupContent" ] for f in __folders: if not conddb.folderRequested("/TRIGGER/%s" % f): __logger.info("Adding folder to IOVDbSvc: /TRIGGER/%s", f) conddb.addFolderWithTag(__dbConnection, "/TRIGGER/%s" % f, "HEAD") pass pass # Add the tool to ToolSvc and return it to the user: ToolSvc += __tool return getattr(ToolSvc, __defaultToolName)
def setAlg(self): hvFolder = "/PIXEL/DCS/HV" tempFolder = "/PIXEL/DCS/TEMPERATURE" dbInstance = "DCS_OFL" from AthenaCommon.AthenaCommonFlags import athenaCommonFlags if athenaCommonFlags.isOnline(): hvFolder = "/PIXEL/HLT/DCS/HV" tempFolder = "/PIXEL/HLT/DCS/TEMPERATURE" dbInstance = "PIXEL_ONL" from IOVDbSvc.CondDB import conddb if not conddb.folderRequested(hvFolder): conddb.addFolder(dbInstance, hvFolder, className="CondAttrListCollection") if not conddb.folderRequested(tempFolder): conddb.addFolder(dbInstance, tempFolder, className="CondAttrListCollection") from AthenaCommon.GlobalFlags import globalflags from AthenaCommon.AlgSequence import AthSequencer condSeq = AthSequencer("AthCondSeq") if not hasattr(condSeq, "PixelDCSCondHVAlg"): from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelDCSCondHVAlg condSeq += PixelDCSCondHVAlg(name="PixelDCSCondHVAlg", ReadKey=hvFolder) if not hasattr(condSeq, "PixelDCSCondTempAlg"): from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelDCSCondTempAlg condSeq += PixelDCSCondTempAlg(name="PixelDCSCondTempAlg", ReadKey=tempFolder) from AthenaCommon.AppMgr import ToolSvc if not hasattr(condSeq, "PixelSiPropertiesCondAlg"): from SiPropertiesTool.SiPropertiesToolConf import PixelSiPropertiesCondAlg condSeq += PixelSiPropertiesCondAlg( name="PixelSiPropertiesCondAlg") self.alg = getattr(condSeq, "PixelSiPropertiesCondAlg")
def setFolders(self): from IOVDbSvc.CondDB import conddb if not conddb.folderRequested(self.folder): if self.folderDb is None: self.folderDb = self.folder if self.folderTag is None: conddb.addFolder(self.dbInstance, self.folderDb, className="AthenaAttributeList") else: conddb.addFolderWithTag(self.dbInstance, self.folderDb, self.folderTag, className="AthenaAttributeList")
def TrigConfBunchCrossingTool(): # The default name of the tool: __defaultToolName = "BunchCrossingTool" # Get ourselves a logger: from AthenaCommon.Logging import logging __logger = logging.getLogger( "TrigConfBunchCrossingTool" ) # Check if the tool already exists. If it does, let's just return it without # any modifications: from AthenaCommon.AppMgr import ToolSvc if hasattr( ToolSvc, __defaultToolName ): __logger.debug( "Tool already exists, not configuring it again" ) return getattr( ToolSvc, __defaultToolName ) # Create a new instance of the tool if it doesn't exist yet: from TrigBunchCrossingTool.TrigBunchCrossingToolConf import \ Trig__TrigConfBunchCrossingTool __tool = Trig__TrigConfBunchCrossingTool( __defaultToolName ) # Create a default configuration for it: __logger.info( "Set the default values for the TrigConfBunchCrossingTool " "configuration" ) # Set up the trigger configuration service: # from AthenaCommon.AppMgr import ServiceMgr as svcMgr # if not hasattr( svcMgr, "TrigConfigSvc" ): # __logger.error( "You have to make sure that TrigConfigSvc exists to use this " # "tool!" ) # __logger.error( "Try running in a RecExCommon environment..." ) # raise NameError( "ServiceMgr.TrigConfigSvc not configured" ) # __tool.ConfigSvc = svcMgr.TrigConfigSvc # Now make sure that DSConfigSvc has access to the BG COOL folders: from IOVDbSvc.CondDB import conddb __dbConnection = "TRIGGER" __folders = [ "LVL1/BunchGroupKey", "LVL1/BunchGroupDescription", "LVL1/BunchGroupContent" ] for f in __folders: if not conddb.folderRequested( "/TRIGGER/%s" % f ): __logger.info( "Adding folder to IOVDbSvc: /TRIGGER/%s" % f ) conddb.addFolderWithTag( __dbConnection, "/TRIGGER/%s" % f, "HEAD" ) pass pass # Add the tool to ToolSvc and return it to the user: ToolSvc += __tool return getattr( ToolSvc, __defaultToolName )
def MCBunchCrossingTool(): # The default name of the tool: __defaultToolName = "BunchCrossingTool" # Get ourselves a logger: from AthenaCommon.Logging import logging __logger = logging.getLogger("MCBunchCrossingTool") # Check if the tool already exists. If it does, let's just return it without # any modifications: from AthenaCommon.AppMgr import ToolSvc if hasattr(ToolSvc, __defaultToolName): __logger.debug("Tool already exists, not configuring it again") return getattr(ToolSvc, __defaultToolName) # Create a new instance of the tool if it doesn't exist yet: from TrigBunchCrossingTool.TrigBunchCrossingToolConf import \ Trig__MCBunchCrossingTool __tool = Trig__MCBunchCrossingTool(__defaultToolName) # Create a default configuration for it: __logger.info( "Set the default values for the MCBunchCrossingTool configuration") # Add the tool to ToolSvc: ToolSvc += __tool # If this is a BS reading job (it *can* happen) then stop at # this point, as the metadata folder will not be available. from AthenaCommon.GlobalFlags import globalflags if globalflags.InputFormat() != "pool": return getattr(ToolSvc, __defaultToolName) # Now make sure the tool has access to the metadata folders: from IOVDbSvc.CondDB import conddb __dbConnection = "" __folders = ["/Digitization/Parameters"] for f in __folders: if not conddb.folderRequested(f): __logger.info("Adding folder to IOVDbSvc: %s", f) conddb.addFolderWithTag(__dbConnection, f, "HEAD") pass pass # Return the tool to the user: return getattr(ToolSvc, __defaultToolName)
def tauCoreTrackSequence(RoIs, name): tauCoreTrackSequence = seqAND(name) from TrigInDetConfig.InDetSetup import makeInDetAlgs viewAlgs, viewVerify = makeInDetAlgs( whichSignature='TauCore', separateTrackParticleCreator="TauCore", rois=RoIs) for viewAlg in viewAlgs: if "InDetTrigTrackParticleCreatorAlg" in viewAlg.name(): TrackCollection = viewAlg.TrackName if "MVA" in name: viewVerify.DataObjects += [ ('xAOD::TauJetContainer', 'StoreGateSvc+HLT_TrigTauRecMerged_CaloOnlyMVA') ] else: viewVerify.DataObjects += [ ('xAOD::TauJetContainer', 'StoreGateSvc+HLT_TrigTauRecMerged_CaloOnly') ] viewVerify.DataObjects += [ ('TrigRoiDescriptorCollection', 'StoreGateSvc+' + RoIs), ('IDCInDetBSErrContainer', 'StoreGateSvc+SCT_ByteStreamErrs') ] #For some reason not picked up properly from IOVDbSvc.CondDB import conddb if not conddb.folderRequested("PixelClustering/PixelClusNNCalib"): viewVerify.DataObjects += [('TTrainedNetworkCollection', 'ConditionStore+PixelClusterNN'), ('TTrainedNetworkCollection', 'ConditionStore+PixelClusterNNWithTrack')] tauTrackRoiUpdaterAlg = _algoTauTrackRoiUpdater(inputRoIs=RoIs, tracks=TrackCollection) viewAlgs.append(tauTrackRoiUpdaterAlg) tauCoreTrackSequence += viewAlgs sequenceOut = TrackCollection return tauCoreTrackSequence, sequenceOut
def LBDurationCondAlgDefault(): name = 'LBDurationCondAlg' condSeq = AthSequencer('AthCondSeq') if hasattr(condSeq, name): return getattr(condSeq, name) from IOVDbSvc.CondDB import conddb folder = "/TRIGGER/LUMI/LBLB" if not conddb.folderRequested(folder): conddb.addFolder('TRIGGER', folder, className='AthenaAttributeList') from LumiBlockComps.LumiBlockCompsConf import LBDurationCondAlg alg = LBDurationCondAlg(name, LBLBFolderInputKey=folder, LBDurationOutputKey='LBDurationCondData') condSeq += alg return alg
def LHCBunchCrossingTool(): # The default name of the tool: __defaultToolName = "BunchCrossingTool" # Get ourselves a logger: from AthenaCommon.Logging import logging __logger = logging.getLogger("LHCBunchCrossingTool") # Check if the tool already exists. If it does, let's just return it without # any modifications: from AthenaCommon.AppMgr import ToolSvc if hasattr(ToolSvc, __defaultToolName): __logger.debug("Tool already exists, not configuring it again") return getattr(ToolSvc, __defaultToolName) # Create a new instance of the tool if it doesn't exist yet: from TrigBunchCrossingTool.TrigBunchCrossingToolConf import \ Trig__LHCBunchCrossingTool __tool = Trig__LHCBunchCrossingTool(__defaultToolName) # Create a default configuration for it: __logger.info( "Set the default values for the LHCBunchCrossingTool configuration") # Now make sure the tool has access to the metadata folders: from IOVDbSvc.CondDB import conddb __dbConnection = "TDAQ" __folders = ["FILLPARAMS", "BUNCHDATA"] for f in __folders: if not conddb.folderRequested("/TDAQ/OLC/LHC/%s" % f): __logger.info("Adding folder to IOVDbSvc: /TDAQ/OLC/LHC/%s", f) conddb.addFolderWithTag(__dbConnection, "/TDAQ/OLC/LHC/%s" % f, "HEAD") pass pass # Add the tool to ToolSvc and return it to the user: ToolSvc += __tool return getattr(ToolSvc, __defaultToolName)
def getSecondStageBjetTracking(inputRoI, dataObjects): algSequence = [] # Second stage of Fast tracking (for precision tracking preparation) from TrigInDetConfig.InDetSetup import makeInDetAlgs viewAlgs, viewVerify = makeInDetAlgs(whichSignature='Jet', separateTrackParticleCreator="Bjet", rois=inputRoI) viewVerify.DataObjects += dataObjects # Make sure the required objects are still available at whole-event level from IOVDbSvc.CondDB import conddb from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() if not conddb.folderRequested("PixelClustering/PixelClusNNCalib"): viewVerify.DataObjects += [('TTrainedNetworkCollection', 'ConditionStore+PixelClusterNN'), ('TTrainedNetworkCollection', 'ConditionStore+PixelClusterNNWithTrack')] from AthenaCommon.GlobalFlags import globalflags if not globalflags.InputFormat.is_bytestream(): viewVerify.DataObjects += [('TRT_RDO_Container', 'StoreGateSvc+TRT_RDOs')] topSequence.SGInputLoader.Load += [('TRT_RDO_Container', 'StoreGateSvc+TRT_RDOs')] algSequence.append(seqAND("SecondStageFastTrackingSequence", viewAlgs)) # Precision Tracking from TrigInDetConfig.InDetPT import makeInDetPrecisionTracking PTTracks, PTTrackParticles, PTAlgs = makeInDetPrecisionTracking( "bjet", rois=inputRoI, inputFTFtracks="TrigFastTrackFinder_Tracks_Bjet") algSequence.append(seqAND("PrecisionTrackingSequence", PTAlgs)) return [algSequence, PTTrackParticles]
if not ('conddb' in dir()): IOVDbSvc = Service("IOVDbSvc") from IOVDbSvc.CondDB import conddb # # --- Load PixelConditionsServices # if DetFlags.haveRIO.pixel_on(): # Load pixel conditions summary service from PixelConditionsServices.PixelConditionsServicesConf import PixelConditionsSummarySvc InDetPixelConditionsSummarySvc = PixelConditionsSummarySvc() # Load pixel calibration service if not athenaCommonFlags.isOnline(): if not conddb.folderRequested('/PIXEL/PixCalib'): conddb.addFolder("PIXEL_OFL","/PIXEL/PixCalib") from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc InDetPixelCalibSvc = PixelCalibSvc() ServiceMgr += InDetPixelCalibSvc if InDetFlags.doPrintConfigurables(): print InDetPixelCalibSvc # Load pixel special pixel map services if athenaCommonFlags.isOnline() : InDetPixelConditionsSummarySvc.UseSpecialPixelMap = False else: InDetPixelConditionsSummarySvc.UseSpecialPixelMap = True if not conddb.folderRequested('/PIXEL/PixMapShort'): conddb.addFolder("PIXEL_OFL","/PIXEL/PixMapShort") if not conddb.folderRequested('/PIXEL/PixMapLong'):
except: pass #to read SCT cabling from db from SCT_Cabling.SCT_CablingConf import SCT_CablingSvc SCT_CablingSvc = SCT_CablingSvc(DataSource = "CORACOOL") ServiceMgr += SCT_CablingSvc if (InDetFlags.doPrintConfigurables()): print SCT_CablingSvc SCTRodConfigPath=SCTConfigurationFolderPath+'ROD' SCTMurConfigPath=SCTConfigurationFolderPath+'MUR' SCTRodMurConfigPath=SCTConfigurationFolderPath+'RODMUR' SCTGeogConfigPath=SCTConfigurationFolderPath+'Geog' # if not conddb.folderRequested(SCTRodConfigPath): conddb.addFolderSplitMC("SCT",SCTRodConfigPath,SCTRodConfigPath) if not conddb.folderRequested(SCTMurConfigPath): conddb.addFolderSplitMC("SCT",SCTMurConfigPath,SCTMurConfigPath) if not conddb.folderRequested(SCTRodMurConfigPath): conddb.addFolderSplitMC("SCT",SCTRodMurConfigPath,SCTRodMurConfigPath) if not conddb.folderRequested(SCTGeogConfigPath): conddb.addFolderSplitMC("SCT",SCTGeogConfigPath,SCTGeogConfigPath) # # --- TRT cabling # if DetFlags.detdescr.TRT_on() and not 'TRT_Cabling' in dir(): # if bytestream comes from real data from TRT_Cabling.TRT_CablingConf import TRT_FillCablingData_DC3 TRT_Cabling = TRT_FillCablingData_DC3()