def CSCCondSummarySvcCfg(flags, **kwargs): result = ComponentAccumulator() result.merge(IOVDbSvcCfg(flags)) if flags.Common.isOnline: kwargs['ConditionsServices'] = [] # COOL folders not available online return CSCCondSummarySvc(**kwargs)
def LArHVDBCfg(configFlags): result=ComponentAccumulator() result.merge(IOVDbSvcCfg(configFlags)) isMC=configFlags.Input.isMC isOnline=configFlags.Common.isOnline if not isMC and not isOnline: result.merge(addFolders(configFlags,["/LAR/DCS/HV/BARREl/I16","/LAR/DCS/HV/BARREL/I8"],detDb="DCS_OFL",className="CondAttrListCollection")) result.merge(addFolders(configFlags,["/LAR/IdentifierOfl/HVLineToElectrodeMap","/LAR/HVPathologiesOfl/Pathologies"],detDb="LAR_OFL",className="AthenaAttributeList")) from LArRecUtils.LArRecUtilsConf import LArHVIdMappingAlg result.addCondAlgo(LArHVIdMappingAlg(ReadKey="/LAR/IdentifierOfl/HVLineToElectrodeMap",WriteKey="LArHVIdMap")) from LArRecUtils.LArRecUtilsConf import LArHVPathologyDbCondAlg result.addCondAlgo(LArHVPathologyDbCondAlg(PathologyFolder="/LAR/HVPathologiesOfl/Pathologies",HVMappingKey="LArHVIdMap", HVPAthologyKey="LArHVPathology")) from LArRecUtils.LArRecUtilsConf import LArHVCondAlg result.addCondAlgo(LArHVCondAlg(HVPathologies="LArHVPathology",OutputHVData="LArHVData")) from LArRecUtils.LArRecUtilsConf import LArHVScaleCorrCondAlg hvscale = LArHVScaleCorrCondAlg(keyHVdata="LArHVData",keyOutputCorr="LArHVScaleCorrRecomputed") hvscale.UndoOnlineHVCorr=True result.addCondAlgo(hvscale) if isMC: result.merge(addFolders(configFlags,detDb="LAR_OFL",folders=["/LAR/Identifier/HVLineToElectrodeMap<tag>LARHVLineToElectrodeMap-001</tag>"],className="AthenaAttributeList")) return result
def _larCablingCfg(configFlags, algo, folder): result = ComponentAccumulator() result.merge(IOVDbSvcCfg(configFlags)) #MC folder-tag hack (See also ATCONDDB-49) tagsperFolder = { "/LAR/Identifier/OnOffIdMap": "LARIdentifierOnOffIdMap-012", "/LAR/Identifier/FebRodMap": "LARIdentifierFebRodMap-005", "/LAR/Identifier/CalibIdMap": "LARIdentifierCalibIdMap-012", "/LAR/IdentifierOfl/OnOffIdMap_SC": "LARIdentifierOflOnOffIdMap_SC-000" } if configFlags.Input.isMC: db = 'LAR_OFL' if folder in tagsperFolder: ft = tagsperFolder[folder] folderwithtag = folder + "<tag>" + ft + "</tag>" else: db = 'LAR_ONL' folderwithtag = folder result.addCondAlgo(algo(ReadKey=folder), primary=True) result.merge( addFolders(configFlags, folderwithtag, className="AthenaAttributeList", detDb=db)) #print (result) return result
def RPCCondSummarySvcCfg(flags, **kwargs): result = ComponentAccumulator() result.merge(IOVDbSvcCfg(flags)) if flags.Common.isOnline: kwargs['ConditionsServices'] = [] # COOL folders not available online else: if flags.Input.isMC: kwargs['ConditionsServices'] = ['RPC_STATUSConditionsSvc'] else: kwargs['ConditionsServices'] = [ 'RPC_STATUSConditionsSvc', 'RPC_DCSConditionsSvc' ] # COOL folders not available online return RPCCondSummarySvc(**kwargs)
def writeDigitizationMetadata(ConfigFlags): from IOVDbMetaDataTools import ParameterDbFiller dbFiller = ParameterDbFiller.ParameterDbFiller() myRunNumber, myEndRunNumber = getRunNumberRangeForOutputMetadata(ConfigFlags) logDigitizationWriteMetadata.debug('ParameterDbFiller BeginRun = %s', str(myRunNumber) ) dbFiller.setBeginRun(myRunNumber) logDigitizationWriteMetadata.debug('ParameterDbFiller EndRun = %s', str(myEndRunNumber) ) dbFiller.setEndRun(myEndRunNumber) #------------------------------------------------- # Adding jobproperties to the list of MetaData #------------------------------------------------- # Here list the digitization jobproperties we want to write out as MetaData. digitMetaDataKeys = { 'doInDetNoise' : 'Digitization.DoInnerDetectorNoise', 'doCaloNoise' : 'Digitization.DoCaloNoise', 'doMuonNoise' : "Digitization.DoMuonNoise", 'bunchSpacing' : 'Beam.BunchSpacing', 'beamType' : 'Beam.Type', 'IOVDbGlobalTag' : 'IOVDb.GlobalTag', 'DetDescrVersion' : 'GeoModel.AtlasVersion' } logDigitizationWriteMetadata.info('Filling Digitization MetaData') for testKey, testFlag in digitMetaDataKeys.items(): if ConfigFlags.hasFlag(testFlag): testValue = ConfigFlags._get(testFlag) if not isinstance(testValue, str): testValue = str(testValue) dbFiller.addDigitParam(testKey, testValue) logDigitizationWriteMetadata.info('DigitizationMetaData: setting "%s" to be %s', testKey, testValue) else : logDigitizationWriteMetadata.debug('DigitizationMetaData: ConfigFlags.%s is not available.', testFlag) del digitMetaDataKeys # Bunch Structure - hardcoded for now testKey = "BeamIntensityPattern" testPattern = None # This should be replaced by a ConfigFlag testValue = str(testPattern) logDigitizationWriteMetadata.info('DigitizationMetaData: setting "%s" to be %s', testKey, testValue) dbFiller.addDigitParam64(testKey, testValue) # intraTrainBunchSpacing - hardcoded for now testKey = "intraTrainBunchSpacing" testValue = str(25) # This should be either be determined from the BeamIntensityPattern or set as ConfigFlag dbFiller.addDigitParam(testKey, testValue) logDigitizationWriteMetadata.info('DigitizationMetaData: setting "%s" to be %s', testKey, testValue) ## Digitized detector flags: add each enabled detector to the DigitizedDetectors list - might be better to determine this from the OutputStream or CA-itself? Possibly redundant info though? digiDets = [] for det in ['Pixel','SCT','TRT','BCM','Lucid','ZDC','ALFA','AFP','FwdRegion','LAr','HGTD','Tile','MDT','CSC','TGC','RPC','MM','sTGC','Truth','LVL1']: attrname = "Detector.Geometry"+det if ConfigFlags.hasFlag(attrname): testValue = ConfigFlags._get(attrname) if testValue: digiDets.append(det) else: logDigitizationWriteMetadata.info("No flag called '%s' found in ConfigFlags", attrname) logDigitizationWriteMetadata.info("Setting 'DigitizedDetectors' = %s" , repr(digiDets)) dbFiller.addDigitParam('DigitizedDetectors', repr(digiDets)) #------------------------------------------------- # Make the MetaData Db #------------------------------------------------- dbFiller.genDigitDb() from IOVDbSvc.IOVDbSvcConfig import IOVDbSvcCfg cfg = IOVDbSvcCfg(ConfigFlags) folder = "/Digitization/Parameters" dbConnection = "sqlite://;schema=DigitParams.db;dbname=DIGPARAM" cfg.getService("IOVDbSvc").Folders += [ folder + "<dbConnection>" + dbConnection + "</dbConnection>" ] cfg.getService("IOVDbSvc").FoldersToMetaData += [ folder ] #cfg.getService("IOVSvc").partialPreLoadData = True #FIXME IOVSvc missing?? return cfg
def overlayMetadataWrite(flags): """Write overlay metadata""" from IOVDbSvc.IOVDbSvcConfig import IOVDbSvcCfg acc = IOVDbSvcCfg(flags) return acc
def LArElecCalibDBRun2Cfg(ConfigFlags, condObjs): _larCondDBFoldersDataR2 = { "Ramp": ("LArRamp", "/LAR/ElecCalibFlat/Ramp", LArRampCondAlg), "DAC2uA": ("LArDAC2uA", "/LAR/ElecCalibFlat/DAC2uA", LArDAC2uACondAlg), "Pedestal": ("LArPedestal", "/LAR/ElecCalibFlat/Pedestal", LArPedestalCondAlg), "uA2MeV": ("LAruA2MeV", "/LAR/ElecCalibFlat/uA2MeV", LAruA2MeVCondAlg), "MphysOverMcal": ("LArMphysOverMcal", "/LAR/ElecCalibFlat/MphysOverMcal", LArMphysOverMcalCondAlg), "OFC": ("LArOFC", "/LAR/ElecCalibFlat/OFC", LArOFCCondAlg), "Shape": ("LArShape", "/LAR/ElecCalibFlat/Shape", LArShapeCondAlg), "HVScaleCorr": ("LArHVScaleCorr", "/LAR/ElecCalibFlat/HVScaleCorr", LArHVScaleCorrCondFlatAlg), } result = IOVDbSvcCfg(ConfigFlags) iovDbSvc = result.getService("IOVDbSvc") condLoader = result.getCondAlgo("CondInputLoader") for condData in condObjs: if condData == "fSampl" and ConfigFlags.Overlay.DataOverlay: LArMCSymCondAlg = CompFactory.LArMCSymCondAlg result.addCondAlgo(LArMCSymCondAlg(ReadKey="LArOnOffIdMap")) from IOVDbSvc.IOVDbSvcConfig import addFolders # TODO: does this need to be configurable? result.merge( addFolders( ConfigFlags, "/LAR/ElecCalibMC/fSampl", "LAR_OFL", className="LArfSamplMC", tag="LARElecCalibMCfSampl-G496-19213-FTFP_BERT_BIRK", db="OFLP200")) result.addCondAlgo( LArfSamplSymAlg(ReadKey="LArfSampl", WriteKey="LArfSamplSym")) continue try: outputKey, fldr, calg = _larCondDBFoldersDataR2[condData] except KeyError: raise ConfigurationError( "No conditions data %s found for Run-2 data" % condData) dbString = "<db>COOLONL_LAR/CONDBR2</db>" persClass = "CondAttrListCollection" #Potential special treatment for OFC/Shape: Load them from offline DB if len(ConfigFlags.LAr.OFCShapeFolder) > 0 and condData == "OFC": fldr = "/LAR/ElecCalibOfl/OFC/PhysWave/RTM/" + ConfigFlags.LAr.OFCShapeFolder dbString = "<db>COOLOFL_LAR/CONDBR2</db>" persClass = "LArOFCComplete" calg = None if ConfigFlags.Overlay.DataOverlay and ConfigFlags.LAr.OFCShapeFolder == "4samples1phase": dbString += "<tag>LARElecCalibOflOFCPhysWaveRTM4samples1phase-RUN2-UPD4-00</tag>" if len(ConfigFlags.LAr.OFCShapeFolder) > 0 and condData == "Shape": fldr = "/LAR/ElecCalibOfl/Shape/RTM/" + ConfigFlags.LAr.OFCShapeFolder dbString = "<db>COOLOFL_LAR/CONDBR2</db>" persClass = "LArShapeComplete" calg = None if ConfigFlags.Overlay.DataOverlay and ConfigFlags.LAr.OFCShapeFolder == "4samples1phase": dbString += "<tag>LARElecCalibOflShapeRTM4samples1phase-RUN2-UPD4-00</tag>" iovDbSvc.Folders.append( fldr + dbString ) # (addFolder(ConfigFlags,fldr,"LAR_ONL",'CondAttrListCollection')) condLoader.Load.append((persClass, fldr)) if calg is not None: result.addCondAlgo(calg(ReadKey=fldr, WriteKey=outputKey)) return result
def TPCnvTest(infile, keys, useGeoModelSvc=False, useIOVDbSvc=False, doPixel=False, doSCT=False, doTRT=False, doLAr=False, doTile=False, doMuon=False): # Make sure we don't have a stale file catalog. if os.path.exists('PoolFileCatalog.xml'): os.remove('PoolFileCatalog.xml') if ('ATLAS_REFERENCE_TAG' not in globals() and 'ATLAS_REFERENCE_TAG' in os.environ): ATLAS_REFERENCE_TAG = os.environ['ATLAS_REFERENCE_TAG'] # noqa: F841 refpaths = [ os.environ.get('ATLAS_REFERENCE_DATA', None), '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art', '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs', '/afs/cern.ch/atlas/maxidisk/d33/referencefiles' ] if infile.startswith('rtt:'): infile = infile[4:] infile = find_file(infile, refpaths) # Provide MC input ConfigFlags.Input.Files = [infile] ConfigFlags.GeoModel.AtlasVersion = 'ATLAS-R1-2012-03-01-00' ConfigFlags.GeoModel.Align.Dynamic = False ConfigFlags.Detector.GeometryPixel = doPixel ConfigFlags.Detector.GeometrySCT = doSCT ConfigFlags.Detector.GeometryTRT = doTRT ConfigFlags.Detector.GeometryLAr = doLAr ConfigFlags.Detector.GeometryTile = doTile ConfigFlags.Detector.GeometryMuon = doMuon ConfigFlags.lock() # Construct ComponentAccumulator acc = MainServicesCfg(ConfigFlags) acc.merge(PoolReadCfg(ConfigFlags)) if useIOVDbSvc: acc.merge(IOVDbSvcCfg(ConfigFlags)) if useGeoModelSvc: if ConfigFlags.Detector.GeometryPixel: acc.merge(PixelGeometryCfg(ConfigFlags)) useGeoModelSvc = True if ConfigFlags.Detector.GeometrySCT: acc.merge(SCT_GeometryCfg(ConfigFlags)) useGeoModelSvc = True if ConfigFlags.Detector.GeometryTRT: acc.merge(TRT_GeometryCfg(ConfigFlags)) useGeoModelSvc = True if ConfigFlags.Detector.GeometryLAr: acc.merge(LArGMCfg(ConfigFlags)) useGeoModelSvc = True if ConfigFlags.Detector.GeometryTile: acc.merge(TileGMCfg(ConfigFlags)) useGeoModelSvc = True if ConfigFlags.Detector.GeometryMuon: acc.merge(MuonGeoModelCfg(ConfigFlags)) useGeoModelSvc = True #acc.merge(ForDetGeometryCfg(ConfigFlags)) acc.merge(GeoModelCfg(ConfigFlags)) acc.getService("GeoModelSvc").IgnoreTagDifference = True acc.addEventAlgo( Dumper('dumper', ConfigFlags.Input.Files[0], keys, refpaths), 'AthAlgSeq') return acc.run(maxEvents=10)