def LArOFCCondAlgDefault(): mlog = logging.getLogger('LArOFCCondAlg') mlog.info("entering LArOFCCondAlgDefault") LArOnOffIdMapping() condSeq = AthSequencer("AthCondSeq") if hasattr (condSeq,"LArOFCCondAlg"): return getattr(condSeq,"LArOFCCondAlg") theOFCCondAlg=LArOFCCondAlg() #theOFCCondAlg.MCSym = True theOFCCondAlg.isMC = True from LArROD.LArRODFlags import larRODFlags from AthenaCommon.BeamFlags import jobproperties theOFCCondAlg.firstSample = larRODFlags.firstSample() theOFCCondAlg.useHighestGainAutoCorr = larRODFlags.useHighestGainAutoCorr() if larRODFlags.doOFCPileupOptimization(): if larRODFlags.NumberOfCollisions(): theOFCCondAlg.Nminbias=larRODFlags.NumberOfCollisions() mlog.info(" setup for Ncollisions %f ", larRODFlags.NumberOfCollisions()) else: theOFCCondAlg.Nminbias=jobproperties.Beam.numberOfCollisions() mlog.info(" setup for Ncollisions %f ", jobproperties.Beam.numberOfCollisions()) else: theOFCCondAlg.Nminbias=0 mlog.info(" setup for no pileup optimization") pass condSeq+=theOFCCondAlg return theOFCCondAlg
def getLArRawChannelBuilder(name="LArRawChannelBuilder" , **kwargs): from AthenaCommon.AppMgr import ToolSvc kwargs.setdefault('LArRawChannelKey', "LArRawChannels") from Digitization.DigitizationFlags import digitizationFlags if digitizationFlags.PileUpPremixing and 'OverlayMT' in digitizationFlags.experimentalDigi(): from OverlayCommonAlgs.OverlayFlags import overlayFlags kwargs.setdefault('LArDigitKey', overlayFlags.bkgPrefix() + 'LArDigitContainer_MC') else: kwargs.setdefault('LArDigitKey', 'LArDigitContainer_MC') #Call required Cond-Algos: from LArRecUtils.LArAutoCorrTotalCondAlgDefault import LArAutoCorrTotalCondAlgDefault from LArRecUtils.LArOFCCondAlgDefault import LArOFCCondAlgDefault from LArRecUtils.LArADC2MeVCondAlgDefault import LArADC2MeVCondAlgDefault #The order matters when running w/o MT LArADC2MeVCondAlgDefault() LArAutoCorrTotalCondAlgDefault() LArOFCCondAlgDefault() kwargs.setdefault("ShapeKey","LArShapeSym") from LArROD.LArRODFlags import larRODFlags kwargs.setdefault('firstSample',larRODFlags.firstSample()) return CfgMgr.LArRawChannelBuilderAlg(name, **kwargs)
def getLArRawChannelBuilder(name="LArRawChannelBuilder", **kwargs): # Currently just for the MC case, but could easily be extended to # cover the data case. from AthenaCommon.AppMgr import ToolSvc kwargs.setdefault('LArRawChannelContainerName', "LArRawChannels") kwargs.setdefault('UseOFCTool', True) # Turn off printing for LArRoI_Map from LArRawUtils.LArRawUtilsConf import LArRoI_Map LArRoI_Map = LArRoI_Map("LArRoI_Map") ToolSvc += LArRoI_Map LArRoI_Map.Print = False from AthenaCommon.DetFlags import DetFlags if DetFlags.digitize.LAr_on(): kwargs.setdefault('DataLocation', 'LArDigitContainer_MC') kwargs.setdefault('ADC2MeVTool', 'LArADC2MeVToolDefault') kwargs.setdefault('OFCTool', 'LArOFCToolDefault') from LArROD.LArRODFlags import larRODFlags kwargs.setdefault('firstSample', larRODFlags.firstSample()) return CfgMgr.LArRawChannelBuilder(name, **kwargs)
def LArAutoCorrTotalCondAlgDefault(): mlog = logging.getLogger( 'LArAutoCorrTotalCondAlg::__init__ ' ) mlog.info("entering LArAutoCorrTotalCondAlgDefault") LArOnOffIdMapping() condSeq = AthSequencer("AthCondSeq") if hasattr (condSeq,"LArAutoCorrTotalCondAlg"): return getattr(condSeq,"LArAutoCorrTotalCondAlg") theAutoCorrTotalCondAlg=LArAutoCorrTotalCondAlg() from AthenaCommon.BeamFlags import jobproperties from LArROD.LArRODFlags import larRODFlags from AthenaCommon.SystemOfUnits import ns theAutoCorrTotalCondAlg.Nsamples = larRODFlags.nSamples() theAutoCorrTotalCondAlg.firstSample = larRODFlags.firstSample() theAutoCorrTotalCondAlg.deltaBunch = int(jobproperties.Beam.bunchSpacing()/( 25.*ns)+0.5) if larRODFlags.doOFCPileupOptimization(): if larRODFlags.NumberOfCollisions(): theAutoCorrTotalCondAlg.Nminbias=larRODFlags.NumberOfCollisions() mlog.info(" setup for Ncollisions %f deltaBunch %f", larRODFlags.NumberOfCollisions(), jobproperties.Beam.bunchSpacing()) else: theAutoCorrTotalCondAlg.Nminbias=jobproperties.Beam.numberOfCollisions() mlog.info(" setup for Ncollisions %f deltaBunch %f", jobproperties.Beam.numberOfCollisions(), jobproperties.Beam.bunchSpacing()) else: theAutoCorrTotalCondAlg.Nminbias=0 mlog.info(" setup for computing total noise autocorrelation without pileup") condSeq+=theAutoCorrTotalCondAlg return theAutoCorrTotalCondAlg
def LArAutoCorrTotalToolDefault(name="LArAutoCorrTotalToolDefault", **kw): # call base class constructor from AthenaCommon import CfgMgr kw['name'] = name tool = CfgMgr.LArAutoCorrTotalTool(**kw) mlog = logging.getLogger('LArAutoCorrTotalToolDefault::__init__ ') mlog.info("entering") # do the configuration if globalflags.DataSource() == 'data': tool.MCSym = False tool.IsMC = False tool.keyPedestal = "Pedestal" else: tool.MCSym = True tool.IsMC = True from AthenaCommon.BeamFlags import jobproperties tool.deltaBunch = int(jobproperties.Beam.bunchSpacing() / (25. * ns) + 0.5) from LArROD.LArRODFlags import larRODFlags if larRODFlags.doOFCMixedOptimization(): tool.UseMixedOFCOpt = True tool.NMinBias = jobproperties.Beam.numberOfCollisions() mlog.info( " setup for Ncollisions %f deltaBunch %f and OFC *MIXED* optimization" % (jobproperties.Beam.numberOfCollisions(), jobproperties.Beam.bunchSpacing())) else: if larRODFlags.doOFCPileupOptimization(): if larRODFlags.NumberOfCollisions(): tool.NMinBias = larRODFlags.NumberOfCollisions() mlog.info(" setup for Ncollisions %f deltaBunch %f" % (larRODFlags.NumberOfCollisions(), jobproperties.Beam.bunchSpacing())) else: tool.NMinBias = jobproperties.Beam.numberOfCollisions() mlog.info(" setup for Ncollisions %f deltaBunch %f" % (jobproperties.Beam.numberOfCollisions(), jobproperties.Beam.bunchSpacing())) else: tool.NMinBias = 0 mlog.info( " setup for computing total noise autocorrelation without pileup" ) tool.NSamples = larRODFlags.nSamples() tool.firstSample = larRODFlags.firstSample() from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault theADC2MeVTool = LArADC2MeVToolDefault() from AthenaCommon.AppMgr import ToolSvc ToolSvc += theADC2MeVTool tool.ADC2MeVTool = theADC2MeVTool return tool
def getLArRawChannelBuilder_DigiHSTruth(name="LArRawChannelBuilder_DigiHSTruth" , **kwargs): from AthenaCommon.AppMgr import ToolSvc kwargs.setdefault('LArRawChannelKey', "LArRawChannels_DigiHSTruth") kwargs.setdefault('LArDigitKey', 'LArDigitContainer_DigiHSTruth') #Call required Cond-Algos: from LArRecUtils.LArAutoCorrTotalCondAlgDefault import LArAutoCorrTotalCondAlgDefault from LArRecUtils.LArOFCCondAlgDefault import LArOFCCondAlgDefault from LArRecUtils.LArADC2MeVCondAlgDefault import LArADC2MeVCondAlgDefault #The order matters when running w/o MT LArADC2MeVCondAlgDefault() LArAutoCorrTotalCondAlgDefault() LArOFCCondAlgDefault() from LArROD.LArRODFlags import larRODFlags kwargs.setdefault('firstSample',larRODFlags.firstSample()) return CfgMgr.LArRawChannelBuilderAlg(name, **kwargs)
def LArAutoCorrTotalSCToolDefault (name="LArAutoCorrTotalSCToolDefault", **kw): # call base class constructor from AthenaCommon import CfgMgr kw['name'] = name tool = CfgMgr.LArAutoCorrTotalTool(**kw) mlog = logging.getLogger( 'LArAutoCorrTotalSCToolDefault::__init__ ' ) mlog.info("entering") tool.IsSuperCell = True # do the configuration if globalflags.DataSource()=='data': #return False tool.MCSym = False tool.IsMC = False else: tool.MCSym = False tool.IsMC = True tool.keyAutoCorr = "LArAutoCorrSC" tool.keyShape = "LArShapeSC" tool.keyNoise = "LArNoiseSC" tool.keyPedestal = "LArPedestalSC" tool.keyfSampl = "LARfSamplSC" from AthenaCommon.BeamFlags import jobproperties tool.deltaBunch = int(jobproperties.Beam.bunchSpacing()/( 25.*ns)+0.5) from LArROD.LArRODFlags import larRODFlags if larRODFlags.doOFCMixedOptimization(): tool.UseMixedOFCOpt = True tool.NMinBias=jobproperties.Beam.numberOfCollisions() print ('Number of Ncollisions : ',jobproperties.Beam.numberOfCollisions()) mlog.info(" setup for Ncollisions %f deltaBunch %f and OFC *MIXED* optimization", jobproperties.Beam.numberOfCollisions(), jobproperties.Beam.bunchSpacing()) else: if larRODFlags.doOFCPileupOptimization(): if larRODFlags.NumberOfCollisions(): tool.NMinBias=larRODFlags.NumberOfCollisions() mlog.info(" setup for Ncollisions %f deltaBunch %f", larRODFlags.NumberOfCollisions(), jobproperties.Beam.bunchSpacing()) else: tool.NMinBias=jobproperties.Beam.numberOfCollisions() mlog.info(" setup for Ncollisions %f deltaBunch %f", jobproperties.Beam.numberOfCollisions(), jobproperties.Beam.bunchSpacing()) else: tool.NMinBias=0 mlog.info(" setup for computing total noise autocorrelation without pileup") tool.NSamples = larRODFlags.nSamples() tool.firstSample = larRODFlags.firstSample() from LArRecUtils.LArADC2MeVSCToolDefault import LArADC2MeVSCToolDefault theADC2MeVTool = LArADC2MeVSCToolDefault() from AthenaCommon.AppMgr import ToolSvc ToolSvc += theADC2MeVTool tool.ADC2MeVTool = theADC2MeVTool if not globalflags.DataSource()=='data': 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/fSampl') ) : conddb.addFolder("LAR_OFL","<tag>LARElecCalibMCSCfSampl-000</tag>/LAR/ElecCalibMCSC/fSampl") 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") if ( conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/AutoCorr') ) : conddb.addFolder("LAR_OFL","<tag>LARElecCalibMCSCAutoCorr-000</tag>/LAR/ElecCalibMCSC/AutoCorr") return tool
def CaloNoiseToolDefault(flag='',name='CaloNoiseToolDefault'): # check if tool already exists from AthenaCommon.AppMgr import ServiceMgr as svcMgr if hasattr(svcMgr.ToolSvc, name): # re-use previously configured (public) tool return getattr(svcMgr.ToolSvc, name) mlog = logging.getLogger( 'CaloNoiseToolDefault' ) if flag=='db' : _useDB = True elif flag=='tool' : _useDB = False else : # will put here logic to select according to global flag from AthenaCommon.GlobalFlags import globalflags from AthenaCommon.BeamFlags import jobproperties if globalflags.DataSource()=='data' and globalflags.DetGeo()!='ctbh6' and globalflags.DetGeo()!='ctbh8': _useDB = True elif globalflags.DataSource()=='geant4' and jobproperties.Beam.zeroLuminosity(): _useDB = True else: # now uses also calonoisetoolDB for MC with pileup.. requires a new global tag for pileup reco to have the noise properly read _useDB = True if _useDB : mlog.info(" Using CaloNoiseToolDB" ) from AthenaCommon.GlobalFlags import globalflags if globalflags.DataSource()=='data': from CaloTools.CaloNoiseToolDBData import CaloNoiseToolDBData theTool = CaloNoiseToolDBData(name) else: from CaloTools.CaloNoiseToolDBMC import CaloNoiseToolDBMC theTool = CaloNoiseToolDBMC(name) return theTool else : mlog.info("Using CaloNoiseTool") from CaloTools.CaloToolsConf import CaloNoiseTool # Tile configuration from AthenaCommon.DetFlags import DetFlags if DetFlags.Tile_on(): from TileConditions.TileInfoConfigurator import TileInfoConfigurator tileInfoConfigurator = TileInfoConfigurator() tileInfoConfigurator.setupCOOL() UseTile = True else: UseTile = False # CaloNoiseTool configuration WorkMode=1 WithOF=True TileInfoName="TileInfo" # get public tool LArADC2MeVTool from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault theADC2MeVTool = LArADC2MeVToolDefault() from AthenaCommon.AppMgr import ToolSvc ToolSvc += theADC2MeVTool # get public tool LArOFCTool from LArRecUtils.LArOFCToolDefault import LArOFCToolDefault theOFCTool = LArOFCToolDefault() from AthenaCommon.AppMgr import ToolSvc ToolSvc += theOFCTool from AthenaCommon.BeamFlags import jobproperties if jobproperties.Beam.zeroLuminosity(): ReturnNoise="electronicNoise" NMinBias=0 deltaBunch=1 else: ReturnNoise="totalNoise" NMinBias=jobproperties.Beam.numberOfCollisions() deltaBunch=int(jobproperties.Beam.bunchSpacing()/( 25.*ns)+0.5) from AthenaCommon.GlobalFlags import globalflags if globalflags.DataSource()=='data': IsMC = False UseSymmetry= False else: IsMC = True UseSymmetry= True from LArROD.LArRODFlags import larRODFlags theTool = CaloNoiseTool(name, WorkMode = WorkMode, WithOF = WithOF, UseTile = UseTile, TileInfoName = TileInfoName, LArADC2MeVTool = theADC2MeVTool, LArOFCTool = theOFCTool, ReturnNoise = ReturnNoise, NMinBias = NMinBias, deltaBunch = deltaBunch, IsMC = IsMC, UseSymmetry = UseSymmetry, firstSample=larRODFlags.firstSample()) return theTool
def getLArPileUpTool(name='LArPileUpTool', **kwargs): ## useLArFloat()=True,isOverlay()=False,outputKey='LArDigitContainer_MC'): from AthenaCommon.Logging import logging mlog = logging.getLogger( 'LArPileUpToolDefault:' ) mlog.info(" ---- in getLArPileUpTool " ) # the LAr and Calo detector description package ## FIXME includes to be replaced by confGetter configuration. if not isOverlay(): from AthenaCommon.Resilience import protectedInclude protectedInclude( "CaloDetMgrDetDescrCnv/CaloDetMgrDetDescrCnv_joboptions.py" ) protectedInclude( "LArDetDescr/LArDetDescr_joboptions.py" ) protectedInclude("LArConditionsCommon/LArConditionsCommon_MC_jobOptions.py") from Digitization.DigitizationFlags import digitizationFlags kwargs.setdefault('NoiseOnOff', digitizationFlags.doCaloNoise.get_Value() ) kwargs.setdefault('RndmSvc', digitizationFlags.rndmSvc.get_Value() ) digitizationFlags.rndmSeedList.addSeed("LArDigitization", 1234, 5678 ) kwargs.setdefault('DoDigiTruthReconstruction',digitizationFlags.doDigiTruth()) if digitizationFlags.doXingByXingPileUp(): kwargs.setdefault('FirstXing', -751 ) kwargs.setdefault('LastXing', 101 ) from LArDigitization.LArDigitizationFlags import jobproperties # check if using high gain for Fcal or not if (not jobproperties.LArDigitizationFlags.useFcalHighGain()) and (not isOverlay()): mlog.info("do not use high gain in Fcal digitization ") kwargs.setdefault('HighGainThreshFCAL', 0 ) else: mlog.info("use high gain in Fcal digitization or overlay job") # check if using high gain for EMEC IW or not if (not jobproperties.LArDigitizationFlags.useEmecIwHighGain()) and (not isOverlay()): mlog.info("do not use high gain in EMEC IW digitization ") kwargs.setdefault('HighGainThreshEMECIW',0) kwargs.setdefault('RndmEvtOverlay', isOverlay() ) kwargs.setdefault('DigitContainer', 'LArDigitContainer_MC' ) ##FIXME - should not be hard-coded # if doing MC+MC overlay from AthenaCommon.GlobalFlags import globalflags if isOverlay() and globalflags.DataSource() == 'geant4': kwargs.setdefault('isMcOverlay',True) from LArROD.LArRODFlags import larRODFlags kwargs.setdefault('Nsamples', larRODFlags.nSamples() ) kwargs.setdefault('firstSample', larRODFlags.firstSample() ) if isOverlay() : kwargs.setdefault('RandomDigitContainer', 'LArDigitContainer_MC' ) # ADC2MeVTool mlog.info(" ---- set LArADC2MeVToolDefault") kwargs.setdefault('ADC2MeVTool', 'LArADC2MeVToolDefault') # Tool for noise autocorrelation generation kwargs.setdefault('AutoCorrNoiseTool', 'LArAutoCorrNoiseToolDefault') # bad channel masking from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool theLArBadChannelTool=LArBadChanTool() from AthenaCommon.AppMgr import ToolSvc ToolSvc+=theLArBadChannelTool from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArRCBMasker=LArBadChannelMasker("LArRCBMasker") theLArRCBMasker.TheLArBadChanTool = theLArBadChannelTool theLArRCBMasker.DoMasking=True theLArRCBMasker.ProblemsToMask=[ "deadReadout","deadPhys"] ToolSvc+=theLArRCBMasker kwargs.setdefault('MaskingTool', theLArRCBMasker ) kwargs.setdefault('BadChannelTool', theLArBadChannelTool ) # CosmicTriggerTimeTool for cosmics digitization from AthenaCommon.BeamFlags import jobproperties if jobproperties.Beam.beamType == "cosmics" : from CommissionUtils.CommissionUtilsConf import CosmicTriggerTimeTool theTriggerTimeTool = CosmicTriggerTimeTool() ToolSvc += theTriggerTimeTool kwargs.setdefault('UseTriggerTime', True ) kwargs.setdefault('TriggerTimeToolName', theTriggerTimeTool ) # pileup configuration "algorithm" way if not digitizationFlags.doXingByXingPileUp(): from AthenaCommon.DetFlags import DetFlags if DetFlags.pileup.LAr_on() or isOverlay(): kwargs.setdefault('PileUp', True ) kwargs.setdefault('useLArFloat', useLArFloat() ) if useLArFloat(): from AthenaCommon.AppMgr import ServiceMgr as svcMgr from SGComps.SGCompsConf import AddressRemappingSvc AddressRemappingSvc = AddressRemappingSvc() svcMgr += AddressRemappingSvc from AthenaCommon.ConfigurableDb import getConfigurable svcMgr += getConfigurable( "ProxyProviderSvc" )() svcMgr.ProxyProviderSvc.ProviderNames += [ "AddressRemappingSvc" ] svcMgr.AddressRemappingSvc.TypeKeyOverwriteMaps = [ "LArHitContainer#LArHitEMB->LArHitFloatContainer#LArHitEMB" , "LArHitContainer#LArHitEMEC->LArHitFloatContainer#LArHitEMEC", "LArHitContainer#LArHitHEC->LArHitFloatContainer#LArHitHEC", "LArHitContainer#LArHitFCAL->LArHitFloatContainer#LArHitFCAL"] svcMgr.AddressRemappingSvc.ProxyDict="ActiveStoreSvc" return CfgMgr.LArPileUpTool(name, **kwargs)
def LArOFCToolDefault(name="LArOFCToolDefault", **kw): # call base class constructor from AthenaCommon import CfgMgr kw['name'] = name tool = CfgMgr.LArOFCTool(**kw) mlog = logging.getLogger('LArOFCToolDefault::__init__ ') mlog.info("entering") mlog.warning("The LArOFCTool is deprecated! Use LArOFCCondAlg!") # do the configuration if globalflags.DataSource() == 'data': tool.MCSym = False tool.IsMC = False tool.FromDatabase = True else: tool.MCSym = True tool.IsMC = True tool.FromDatabase = False from LArROD.LArRODFlags import larRODFlags tool.firstSample = larRODFlags.firstSample() tool.useHighestGainAutoCorr = larRODFlags.useHighestGainAutoCorr() if larRODFlags.doOFCMixedOptimization( ): # kept for backward compatibility tool.UseDelta = 1 # only EMECIW/HEC/FCAL from AthenaCommon.BeamFlags import jobproperties tool.DeltaBunch = int(jobproperties.Beam.bunchSpacing() / (25. * ns) + 0.5) mlog.info(" OFC *MIXED* optimization") else: tool.UseDelta = larRODFlags.UseDelta() if (larRODFlags.UseDelta() == 0): mlog.info(" Standard OFC optimization computation") elif (larRODFlags.UseDelta() == 1): mlog.info( " OFC optimization asking for no average shift as extra constraint only in EMECIW/HEC/FCAL" ) from AthenaCommon.BeamFlags import jobproperties tool.DeltaBunch = int(jobproperties.Beam.bunchSpacing() / (25. * ns) + 0.5) elif (larRODFlags.UseDelta() == 2): mlog.info( " OFC optimization asking for no average shift as extra constraint everywhere" ) from AthenaCommon.BeamFlags import jobproperties tool.DeltaBunch = int(jobproperties.Beam.bunchSpacing() / (25. * ns) + 0.5) elif (larRODFlags.UseDelta() == 3): mlog.info( " OFC optimization asking for no average shift as extra constraint only in EMECIW/HEC/FCAL1+high eta FCAL2-3" ) from AthenaCommon.BeamFlags import jobproperties tool.DeltaBunch = int(jobproperties.Beam.bunchSpacing() / (25. * ns) + 0.5) else: tool.UseDelta = 0 ### avoid unforseed options ### #tool.Dump = True from LArRecUtils.LArAutoCorrTotalToolDefault import LArAutoCorrTotalToolDefault theAutoCorrTool = LArAutoCorrTotalToolDefault() from AthenaCommon.AppMgr import ToolSvc ToolSvc += theAutoCorrTool tool.AutoCorrTool = theAutoCorrTool return tool