def LArOFCCondAlgCfg(flags, name='LArOFCCondAlg', **kwargs): mlog = logging.getLogger('LArOFCCondAlgCfg') mlog.info(" entering LArOFCCondAlgCfg") kwargs.setdefault('isMC', True) kwargs.setdefault('firstSample', flags.LAr.ROD.FirstSample) kwargs.setdefault('useHighestGainAutoCorr', flags.LAr.ROD.UseHighestGainAutoCorr) if flags.LAr.ROD.DoOFCPileupOptimization: if flags.LAr.ROD.NumberOfCollisions: kwargs.setdefault('Nminbias', flags.LAr.ROD.NumberOfCollisions) mlog.info("Setup LArOFCCOndAlg Nminbias %f ", flags.LAr.ROD.NumberOfCollisions) else: kwargs.setdefault('Nminbias', flags.Beam.NumberOfCollisions) mlog.info("Setup LArOFCCOndAlg Nminbias %f ", flags.Beam.NumberOfCollisions) else: kwargs.setdefault('Nminbias', 0.) mlog.info(" no pileup optimization") #The LArPileUpTool needs: Calbling, Shape, Noise, Pedestal and the (total) AutoCorr acc = LArOnOffIdMappingCfg(flags) requiredConditons = ["Shape", "Noise", "Pedestal"] acc.merge(LArElecCalibDbCfg(flags, requiredConditons)) acc.merge(LArAutoCorrTotalCondAlgCfg(flags)) LArOFCCondAlg = CompFactory.LArOFCCondAlg acc.addCondAlgo(LArOFCCondAlg(name, **kwargs)) return acc
def LArCellBuilderCfg(configFlags): result=ComponentAccumulator() result.merge(LArOnOffIdMappingCfg(configFlags)) theLArCellBuilder = LArCellBuilderFromLArRawChannelTool() theLArCellBuilder.addDeadOTX = False #Create flag? Requires bad-feb DB access result.setPrivateTools(theLArCellBuilder) return result
def LArElecCalibDBMCCfg(ConfigFlags, folders): _larCondDBFoldersMC = { "Ramp": ("LArRampMC", "/LAR/ElecCalibMC/Ramp", "LArRamp", LArRampSymAlg), "AutoCorr": ("LArAutoCorrMC", "/LAR/ElecCalibMC/AutoCorr", "LArAutoCorr", LArAutoCorrSymAlg), "DAC2uA": ("LArDAC2uAMC", "/LAR/ElecCalibMC/DAC2uA", "LArDAC2uA", LArDAC2uASymAlg), "Pedestal": ("LArPedestalMC", "/LAR/ElecCalibMC/Pedestal", "LArPedestal", None), "Noise": ("LArNoiseMC", "/LAR/ElecCalibMC/Noise", "LArNoise", LArNoiseSymAlg), "fSampl": ("LArfSamplMC", "/LAR/ElecCalibMC/fSampl", "LArfSampl", LArfSamplSymAlg), "uA2MeV": ("LAruA2MeVMC", "/LAR/ElecCalibMC/uA2MeV", "LAruA2MeV", LAruA2MeVSymAlg), "MinBias": ("LArMinBiasMC", "/LAR/ElecCalibMC/MinBias", "LArMinBias", LArMinBiasSymAlg), "Shape": ("LArShape32MC", "/LAR/ElecCalibMC/Shape", "LArShape", LArShapeSymAlg), "MinBiasAvc": ("LArMinBiasAverageMC", "/LAR/ElecCalibMC/MinBiasAverage", "LArMinBiasAverage", LArMinBiasAverageSymAlg), "MphysOverMcal": ("LArMphysOverMcalMC", "/LAR/ElecCalibMC/MphysOverMcal", "LArMphysOverMcal", LArMPhysOverMcalSymAlg), "HVScaleCorr": ("LArHVScaleCorrComplete", '/LAR/ElecCalibMC/HVScaleCorr', "LArHVScaleCorr", None) } result = ComponentAccumulator() #Add cabling from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg result.merge(LArOnOffIdMappingCfg(ConfigFlags)) LArMCSymCondAlg = CompFactory.LArMCSymCondAlg result.addCondAlgo(LArMCSymCondAlg(ReadKey="LArOnOffIdMap")) folderlist = [] for folder in folders: try: classname, fldr, key, calg = _larCondDBFoldersMC[folder] except KeyError: raise ConfigurationError( "No conditions data %s found for Monte Carlo" % folder) folderlist += [ (fldr, "LAR_OFL", classname), ] if calg is not None: result.addCondAlgo(calg(ReadKey=key, WriteKey=key + "Sym")) result.merge(addFolderList(ConfigFlags, folderlist)) return result
def LArAutoCorrNoiseCondAlgCfg(flags, name="LArAutoCorrNoiseCondAlg", **kwargs): """Return ComponentAccumulator with configured LArAutoCorrNoiseCondAlg""" LArAutoCorrNoiseCondAlg = CompFactory.LArAutoCorrNoiseCondAlg # The LArAutoCorrNoiseCondAlgCfg needs the cabling, the sym-object and the AutoCorr acc = LArOnOffIdMappingCfg(flags) acc.merge(LArMCSymCondAlgCfg(flags)) acc.merge(LArElecCalibDbCfg(flags, [ "AutoCorr", ])) kwargs.setdefault("nSampl", flags.LAr.ROD.nSamples) acc.addCondAlgo(LArAutoCorrNoiseCondAlg(name, **kwargs)) return acc
def testCfg(configFlags): result = ComponentAccumulator() from LArGeoAlgsNV.LArGMConfig import LArGMCfg from TileGeoModel.TileGMConfig import TileGMCfg result.merge(LArGMCfg(configFlags)) result.merge(TileGMCfg(configFlags)) from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg result.merge(LArOnOffIdMappingCfg(configFlags)) result.addEventAlgo(CreateDataAlg('CreateDataAlg')) CaloCellContainerAliasAlg = CompFactory.CaloCellContainerAliasAlg result.addEventAlgo( CaloCellContainerAliasAlg('aliasAlg', Cells='AllCalo', Alias='CellAlias')) result.addEventAlgo(CheckAliasAlg('CheckAliasAlg')) return result
def testCfg(configFlags): result = ComponentAccumulator() from LArGeoAlgsNV.LArGMConfig import LArGMCfg from TileGeoModel.TileGMConfig import TileGMCfg result.merge(LArGMCfg(configFlags)) result.merge(TileGMCfg(configFlags)) from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg result.merge(LArOnOffIdMappingCfg(configFlags)) result.addEventAlgo(CreateDataAlg('CreateDataAlg')) CaloThinCellsBySamplingAlg = CompFactory.CaloThinCellsBySamplingAlg result.addEventAlgo( CaloThinCellsBySamplingAlg('thinAlg', StreamName='StreamAOD', SamplingCellsName=['EMB3', 'TileGap3'])) result.addEventAlgo(CheckThinningAlg('CheckThinningAlg')) return result
def LArADC2MeVCondAlgCfg(configFlags): from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDbCfg from LArGeoAlgsNV.LArGMConfig import LArGMCfg result = ComponentAccumulator() result.merge(LArOnOffIdMappingCfg(configFlags)) result.merge(LArGMCfg(configFlags)) #Needed for identifier helpers theADC2MeVCondAlg = CompFactory.LArADC2MeVCondAlg( LArADC2MeVKey='LArADC2MeV') isMC = configFlags.Input.isMC if isMC: requiredConditions = [ "Ramp", "DAC2uA", "uA2MeV", "MphysOverMcal", "HVScaleCorr" ] theADC2MeVCondAlg.LAruA2MeVKey = "LAruA2MeVSym" theADC2MeVCondAlg.LArDAC2uAKey = "LArDAC2uASym" theADC2MeVCondAlg.LArRampKey = "LArRampSym" theADC2MeVCondAlg.LArMphysOverMcalKey = "LArMphysOverMcalSym" theADC2MeVCondAlg.LArHVScaleCorrKey = "LArHVScaleCorr" theADC2MeVCondAlg.UseFEBGainTresholds = False else: # not MC: requiredConditions = [ "Ramp", "DAC2uA", "uA2MeV", "MphysOverMcal", "HVScaleCorr" ] from LArRecUtils.LArFebConfigCondAlgConfig import LArFebConfigCondAlgCfg if 'COMP200' in configFlags.IOVDb.DatabaseInstance: # Run1 case theADC2MeVCondAlg.LAruA2MeVKey = "LAruA2MeVSym" theADC2MeVCondAlg.LArDAC2uAKey = "LArDAC2uASym" result.merge(LArFebConfigCondAlgCfg(configFlags)) result.merge(LArElecCalibDbCfg(configFlags, requiredConditions)) result.addCondAlgo(theADC2MeVCondAlg, primary=True) return result
def LArDigitThinnerCfg(flags, **kwargs): """Return ComponentAccumulator for LArDigitThinner algorithm""" # based on DefaultLArDigitThinner acc = ComponentAccumulator() if (not flags.Input.isMC) and ( not flags.Overlay.DataOverlay) and flags.Input.Format == "BS": acc.merge(LArRawDataReadingAlg(InputContainerName="FREE")) acc.merge(LArOnOffIdMappingCfg(flags)) if flags.Beam.Type == "cosmics": kwargs.setdefault("EnergyCuts_Barrel", [1000, 500, 1000, 1000]) kwargs.setdefault("EnergyCuts_Endcap", [1000, 500, 1000, 1000]) kwargs.setdefault("EnergyCut_HEC", 2000) kwargs.setdefault("EnergyCut_FCAL", 3000) else: kwargs.setdefault("EnergyCuts_Barrel", [1000, 1000, 1000, 1000]) kwargs.setdefault("EnergyCuts_Endcap", [2000, 2000, 2000, 2000]) kwargs.setdefault("EnergyCut_HEC", 5000) kwargs.setdefault("EnergyCut_FCAL", 20000) acc.addEventAlgo(CompFactory.LArDigitThinner(**kwargs)) return acc
def LArBadChannelCfg(configFlags, tag=""): result = LArOnOffIdMappingCfg(configFlags) if configFlags.Common.isOnline or configFlags.Input.isMC: foldername = "/LAR/BadChannels/BadChannels" else: foldername = "/LAR/BadChannelsOfl/BadChannels" pass if configFlags.Common.isOnline: dbname = "LAR" else: dbname = "LAR_OFL" result.merge( addFolders(configFlags, foldername + tag, detDb=dbname, className="CondAttrListCollection")) theLArBadChannelCondAlgo = LArBadChannelCondAlg(ReadKey=foldername) result.addCondAlgo(theLArBadChannelCondAlgo) return result
def LArAutoCorrTotalCondAlgCfg(flags, name='LArAutoCorrTotalCondAlg', **kwargs): mlog = logging.getLogger('LArAutoCorrTotalCondAlgCfg') mlog.info(" entering LArAutoCorrTotalCondAlgCfg") from AthenaCommon.SystemOfUnits import ns kwargs.setdefault('Nsamples', flags.LAr.ROD.nSamples) kwargs.setdefault('firstSample', flags.LAr.ROD.FirstSample) mlog.info("Nsamples %d", flags.LAr.ROD.nSamples) mlog.info("firstSample %d", flags.LAr.ROD.FirstSample) deltaBunch = int(flags.Beam.BunchSpacing / (25. * ns) + 0.5) mlog.info("DeltaBunch %d ", deltaBunch) kwargs.setdefault('deltaBunch', deltaBunch) if flags.LAr.ROD.DoOFCPileupOptimization: if flags.LAr.ROD.NumberOfCollisions: kwargs.setdefault("Nminbias", flags.LAr.ROD.NumberOfCollisions) mlog.info(" NMminBias %f", flags.LAr.ROD.NumberOfCollisions) else: kwargs.setdefault("Nminbias", flags.Beam.NumberOfCollisions) mlog.info(" NMminBias %f", flags.Beam.NumberOfCollisions) else: kwargs.setdefault('Nminbias', 0.) mlog.info(" no pileup noise in LArAutoCorrTotal ") #The LArAutoCorrTotalAlg needs cabling and #Shape, AutoCorr, Noise, Pedestal, fSampl and MinBias acc = LArOnOffIdMappingCfg(flags) requiredConditons = [ "Shape", "AutoCorr", "Noise", "Pedestal", "fSampl", "MinBias" ] acc.merge(LArElecCalibDbCfg(flags, requiredConditons)) LArAutoCorrTotalCondAlg = CompFactory.LArAutoCorrTotalCondAlg acc.addCondAlgo(LArAutoCorrTotalCondAlg(name, **kwargs)) return acc
from AthenaCommon.Configurable import Configurable Configurable.configurableRun3Behavior = 1 from AthenaConfiguration.AllConfigFlags import ConfigFlags ConfigFlags.Input.Files = [ "myRDO.pool.root", ] ConfigFlags.lock() from AthenaConfiguration.MainServicesConfig import MainServicesCfg from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg cfg = MainServicesCfg(ConfigFlags) cfg.merge(PoolReadCfg(ConfigFlags)) from LArGeoAlgsNV.LArGMConfig import LArGMCfg cfg.merge(LArGMCfg(ConfigFlags)) from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg cfg.merge(LArOnOffIdMappingCfg(ConfigFlags)) cfg.addEventAlgo( CompFactory.DumpLArRawChannels(NtupStream="LARRC", OutputFileName="", ToLog=False)) cfg.addService( CompFactory.THistSvc( Output=["LARRC DATAFILE='LARRC.root', OPT='RECREATE'"])) cfg.run(-1)
def CaloNoiseCondAlgCfg(configFlags,noisetype="totalNoise"): if noisetype not in ("electronicNoise","pileupNoise","totalNoise"): raise RuntimeError("Requested noise of unknown type %s" % noisetype) noiseAlgName="Calo_"+noisetype+"Alg" log = logging.getLogger("CaloNoiseToolCfg") result=ComponentAccumulator() isMC=configFlags.Input.isMC fixedLumi=configFlags.Calo.Noise.fixedLumiForNoise useCaloLumi=configFlags.Calo.Noise.useCaloNoiseLumi #CaloNoiseCondAlg needs Identifiers ... from AtlasGeoModel.GeoModelConfig import GeoModelCfg gms=GeoModelCfg(configFlags) result.merge(gms) #... and cabling: from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg result.merge(LArOnOffIdMappingCfg(configFlags)) theCaloNoiseAlg=CaloNoiseCondAlg(noiseAlgName,OutputKey=noisetype) if configFlags.Common.isOnline: log.info("Configuring CaloNoiseCondAlg for online case") #online mode: result.merge(addFolders(configFlags,"/CALO/Noise/CellNoise",'CALO_ONL',className="CondAttrListCollection")) theCaloNoiseAlg.CaloNoiseFolder="/CALO/Noise/CellNoise" theCaloNoiseAlg.LArNoiseFolder="" theCaloNoiseAlg.TileNoiseFolder="" if fixedLumi >= 0 : theCaloNoiseAlg.Luminosity = fixedLumi log.info("online mode: use fixed luminosity for scaling pileup noise: %f", fixedLumi) else: if useCaloLumi: lumiFolder='/CALO/Noise/PileUpNoiseLumi' result.merge(addFolders(configFlags,lumiFolder,'CALO',className="CondAttrListCollection")) theCaloNoiseAlg.LumiFolder = lumiFolder theCaloNoiseAlg.Luminosity = -1. log.info("online mode: use luminosity from /CALO/Noise/PileUpNoiseLumi to scale pileup noise") else: theCaloNoiseAlg.Luminosity = 0. log.info("online mode: ignore pileup noise") pass result.addCondAlgo(theCaloNoiseAlg) return result #The not-online case: if isMC: log.info("Configuring CaloNoiseCondAlg for MC data processing") if fixedLumi >= 0 : theCaloNoiseAlg.Luminosity=fixedLumi log.info("Luminosity (in 10**33) units used for pileup noise from CaloNoiseFlags : %f", fixedLumi) else: if useCaloLumi: lumiFolder='/CALO/Ofl/Noise/PileUpNoiseLumi' result.merge(addFolders(configFlags,lumiFolder,'CALO_OFL',className="CondAttrListCollection")) log.info("offline mode: use luminosity from /CALO/Ofl/Noise/PileuUpNoiseLumi to scale pileup noise") theCaloNoiseAlg.LumiFolder = lumiFolder theCaloNoiseAlg.Luminosity=-1. else: estimatedLumi=configFlags.Beam.estimatedLuminosity theCaloNoiseAlg.Luminosity=estimatedLumi/1e+33 log.info(" Luminosity (in 10**33) units used for pileup noise from Beam flags: %f", theCaloNoiseAlg.Luminosity) theCaloNoiseAlg.LArNoiseFolder="/LAR/NoiseOfl/CellNoise" result.merge(addFolders(configFlags,"/LAR/NoiseOfl/CellNoise","LAR_OFL",className="CondAttrListCollection")) theCaloNoiseAlg.TileNoiseFolder="/TILE/OFL02/NOISE/CELL" result.merge(addFolders(configFlags,"/TILE/OFL02/NOISE/CELL","TILE_OFL",className="CondAttrListCollection")) theCaloNoiseAlg.CaloNoiseFolder="/CALO/Ofl/Noise/CellNoise" result.merge(addFolders(configFlags,"/CALO/Ofl/Noise/CellNoise","CALO_OFL",className="CondAttrListCollection")) pass else: # Real data case: # for luminosity if fixedLumi >= 0 : theCaloNoiseAlg.Luminosity = fixedLumi log.info("offline mode: use fixed luminosity for scaling pileup noise: %f", fixedLumi) else : theCaloNoiseAlg.Luminosity = -1 if useCaloLumi: lumiFolder='/CALO/Ofl/Noise/PileUpNoiseLumi' result.merge(addFolders(configFlags,lumiFolder,'CALO_OFL',className="CondAttrListCollection")) log.info("offline mode: use luminosity from /CALO/Ofl/Noise/PileUpNoiseLumi to scale pileup noise") else: lumiFolder = '/TRIGGER/LUMI/LBLESTONL' result.merge(addFolders(configFlags,lumiFolder,'TRIGGER_ONL',className="CondAttrListCollection")) log.info("offline mode: use luminosity = f(Lumiblock) to scale pileup noise") theCaloNoiseAlg.LumiFolder = lumiFolder if configFlags.IOVDb.DatabaseInstance=="CONDBR2": # Run2 case: log.info("Configuring CaloNoiseCondAlg for Run2 real data processing") theCaloNoiseAlg.CaloNoiseFolder="" theCaloNoiseAlg.LArNoiseFolder="/LAR/NoiseOfl/CellNoise" theCaloNoiseAlg.TileNoiseFolder="/TILE/OFL02/NOISE/CELL" result.merge(addFolders(configFlags,"/LAR/NoiseOfl/CellNoise","LAR_OFL",className="CondAttrListCollection")) result.merge(addFolders(configFlags,"/TILE/OFL02/NOISE/CELL","TILE_OFL",className="CondAttrListCollection")) if configFlags.LAr.doHVCorr: log.info("Run2 & doLArHVCorr=True: Will rescale noise automatically for HV trips") theCaloNoiseAlg.useHVCorr=True from LArCalibUtils.LArHVScaleConfig import LArHVScaleCfg result.merge(LArHVScaleCfg(configFlags)) pass pass else: #COMP200 case: log.info("Configuring CaloNoiseCondAlg for Run1 real data processing") #The noise for runs before 2012 is a different folder: theCaloNoiseAlg.CaloNoiseFolder="/CALO/Ofl/Noise/CellNoise" theCaloNoiseAlg.LArNoiseFolder="/LAR/NoiseOfl/CellNoise" theCaloNoiseAlg.TileNoiseFolder="/TILE/OFL02/NOISE/CELL" result.merge(addFolders(configFlags,"/CALO/Ofl/Noise/CellNoise","CALO_OFL",className="CondAttrListCollection")) result.merge(addFolders(configFlags,"LAR_OFL","/LAR/NoiseOfl/CellNoise",className="CondAttrListCollection")) result.merge(addFolders(configFlags,"TILE_OFL","/TILE/OFL02/NOISE/CELL",className="CondAttrListCollection")) pass #end of real data case result.addCondAlgo(theCaloNoiseAlg) return result