Skip to content
Snippets Groups Projects
Commit a7d0bb59 authored by Thomas Strebler's avatar Thomas Strebler Committed by Duc Ta
Browse files

Revert "Merge branch 'tstreble-24.0-patch-0777' into '24.0'"

Revert "Merge branch 'tstreble-24.0-patch-0777' into '24.0'"

This reverts merge request !71320
parent 8770713d
No related branches found
No related tags found
2 merge requests!714242024-05-16: merge of 24.0 into main,!71398Revert "Merge branch 'tstreble-24.0-patch-0777' into '24.0'"
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.AlgSequence import AthSequencer
from IOVDbSvc.CondDB import conddb
from AthenaCommon.Logging import logging
def CaloNoiseCondAlg(noisetype="totalNoise"):
if noisetype not in ("electronicNoise","pileupNoise","totalNoise"):
raise RuntimeError("Requested noise of unknown type %s" % noisetype)
noiseAlgName="Calo_"+noisetype+"Alg"
condSeq = AthSequencer("AthCondSeq")
if hasattr (condSeq,noiseAlgName):
return getattr(condSeq,noiseAlgName)
if (conddb.isMC):
alg = _CaloNoiseCondAlgMC(noiseAlgName,noisetype)
else:
alg = _CaloNoiseCondAlgData(noiseAlgName,noisetype)
condSeq += alg
return alg
def _CaloNoiseCondAlgMC(noiseAlgName,noisetype):
mlog = logging.getLogger('CaloNoiseCondMC')
from CaloTools.CaloToolsConf import CaloNoiseCondAlg
theCaloNoiseAlg=CaloNoiseCondAlg(noiseAlgName,OutputKey=noisetype)
from CaloTools.CaloNoiseFlags import jobproperties
if jobproperties.CaloNoiseFlags.FixedLuminosity() >= 0 :
theCaloNoiseAlg.Luminosity=jobproperties.CaloNoiseFlags.FixedLuminosity()
mlog.info(" Luminosity (in 10**33) units used for pileup noise from CaloNoiseFlags : %f", theCaloNoiseAlg.Luminosity)
else:
if jobproperties.CaloNoiseFlags.UseCaloLuminosity():
lumiFolder='/CALO/Ofl/Noise/PileUpNoiseLumi'
conddb.addFolder('CALO_OFL',lumiFolder,className="CondAttrListCollection")
mlog.info("offline mode: use luminosity from /CALO/Ofl/Noise/PileUpNoiseLumi to scale pileup noise")
theCaloNoiseAlg.LumiFolder = lumiFolder
theCaloNoiseAlg.Luminosity=-1.
else:
from AthenaCommon.BeamFlags import jobproperties
theCaloNoiseAlg.Luminosity=jobproperties.Beam.estimatedLuminosity()/1e+33
mlog.info(" Luminosity (in 10**33) units used for pileup noise from BeamFlags : %f", theCaloNoiseAlg.Luminosity)
pass
pass
theCaloNoiseAlg.LArNoiseFolder="/LAR/NoiseOfl/CellNoise"
conddb.addFolder("LAR_OFL","/LAR/NoiseOfl/CellNoise",className="CondAttrListCollection")
theCaloNoiseAlg.TileNoiseFolder="/TILE/OFL02/NOISE/CELL"
conddb.addFolder("TILE_OFL","/TILE/OFL02/NOISE/CELL",className="CondAttrListCollection")
theCaloNoiseAlg.CaloNoiseFolder="/CALO/Ofl/Noise/CellNoise"
conddb.addFolder("CALO_OFL","/CALO/Ofl/Noise/CellNoise",className="CondAttrListCollection")
return theCaloNoiseAlg
def _CaloNoiseCondAlgData(noiseAlgName,noisetype):
mlog = logging.getLogger('CaloNoiseCondData')
from CaloTools.CaloNoiseFlags import jobproperties
fixedLumi = jobproperties.CaloNoiseFlags.FixedLuminosity()
caloLumi = jobproperties.CaloNoiseFlags.UseCaloLuminosity()
from CaloTools.CaloToolsConf import CaloNoiseCondAlg
theCaloNoiseAlg=CaloNoiseCondAlg(noiseAlgName,OutputKey=noisetype)
if conddb.isOnline:
folder = "/CALO/Noise/CellNoise"
theCaloNoiseAlg.CaloNoiseFolder=folder
theCaloNoiseAlg.LArNoiseFolder=""
theCaloNoiseAlg.TileNoiseFolder=""
conddb.addFolder('CALO_ONL',folder,className="CondAttrListCollection")
if fixedLumi >= 0 :
theCaloNoiseAlg.Luminosity = fixedLumi
mlog.info("online mode: use fixed luminosity for scaling pileup noise: %f", fixedLumi)
else:
if caloLumi:
lumiFolder='/CALO/Noise/PileUpNoiseLumi'
conddb.addFolder('CALO',lumiFolder,className="CondAttrListCollection")
theCaloNoiseAlg.LumiFolder = lumiFolder
theCaloNoiseAlg.Luminosity = -1.
mlog.info("online mode: use luminosity from /CALO/Noise/PileUpNoiseLumi to scale pileup noise")
else:
theCaloNoiseAlg.Luminosity = 0.
mlog.info("online mode: ignore pileup noise")
pass
else: #regular offline mode
if conddb.dbdata=="CONDBR2": # Run2 case:
theCaloNoiseAlg.CaloNoiseFolder=""
theCaloNoiseAlg.LArNoiseFolder="/LAR/NoiseOfl/CellNoise"
theCaloNoiseAlg.TileNoiseFolder="/TILE/OFL02/NOISE/CELL"
conddb.addFolder("LAR_OFL","/LAR/NoiseOfl/CellNoise",className="CondAttrListCollection")
conddb.addFolder("TILE_OFL","/TILE/OFL02/NOISE/CELL",className="CondAttrListCollection")
from CaloRec.CaloCellFlags import jobproperties
if jobproperties.CaloCellFlags.doLArHVCorr():
mlog.info("Run2 & doLArHVCorr=True: Will rescale noise automatically for HV trips")
theCaloNoiseAlg.useHVCorr=True
from LArConditionsCommon import LArHVDB # noqa: F401
pass
pass
else: #COMP200 case:
#The noise for runs before 2012 is in different folders:
theCaloNoiseAlg.CaloNoiseFolder="/CALO/Ofl/Noise/CellNoise"
theCaloNoiseAlg.LArNoiseFolder="/LAR/NoiseOfl/CellNoise"
theCaloNoiseAlg.TileNoiseFolder="/TILE/OFL02/NOISE/CELL"
conddb.addFolder("CALO_OFL","/CALO/Ofl/Noise/CellNoise",className="CondAttrListCollection")
conddb.addFolder("LAR_OFL","/LAR/NoiseOfl/CellNoise",className="CondAttrListCollection")
conddb.addFolder("TILE_OFL","/TILE/OFL02/NOISE/CELL",className="CondAttrListCollection")
# for luminosity
if fixedLumi >= 0 :
theCaloNoiseAlg.Luminosity = fixedLumi
mlog.info("offline mode: use fixed luminosity for scaling pileup noise: %f", fixedLumi)
else:
theCaloNoiseAlg.Luminosity = -1
if caloLumi:
lumiFolder='/CALO/Ofl/Noise/PileUpNoiseLumi'
conddb.addFolder('CALO_OFL',lumiFolder,className="CondAttrListCollection")
mlog.info("offline mode: use luminosity from /CALO/Ofl/Noise/PileUpNoiseLumi to scale pileup noise")
else:
lumiFolder = '/TRIGGER/LUMI/LBLESTONL'
conddb.addFolder('TRIGGER_ONL',lumiFolder,className="CondAttrListCollection")
mlog.info("offline mode: use luminosity = f(Lumiblock) to scale pileup noise")
theCaloNoiseAlg.LumiFolder = lumiFolder
return theCaloNoiseAlg
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
""" Flags for define calo noise tool configuration
"""
#
#
__author__ = 'G.Unal'
#=======================================================================
# imports
#=======================================================================
from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
from AthenaCommon.JobProperties import jobproperties
class FixedLuminosity(JobProperty):
""" Flag to force luminosity (10**33 units) to a given value corresponding to a given mu
Lumi is related to mu by Lumi = (mu/2.3) * 25ns/BunchSpacing(ns)
BunchSpacing should be consistent with what is used from DB, as noise/sqrt(Lumi) depends on BunchSpacing
if -1 uses lumi from database (Data) or Beam properties (MC) to perform the sqrt(Lumi) pileup noise scaling
"""
statusOn = True
allowedType=['float']
StoredValue = -1.
class UseCaloLuminosity(JobProperty):
""" Flag to tell to use the luminosity normalization for pileup noise from dedicated calo folder
instead of online per LumiBlock
Only active if FixedLuminosity is not >0
"""
statusOn = True
allowedType=['bool']
StoredValue = True
class CaloNoiseFlags(JobPropertyContainer):
""" The CaloNoiseFlag container
"""
pass
# add container to jobProperties
jobproperties.add_Container(CaloNoiseFlags)
list_jobproperties = [
FixedLuminosity,UseCaloLuminosity
]
for i in list_jobproperties:
jobproperties.CaloNoiseFlags.add_JobProperty(i)
del list_jobproperties
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment