def init_mask(tool_name): from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArBadChannelsMasker = LArBadChannelMasker(tool_name) #,this) theLArBadChannelsMasker.DoMasking = True theLArBadChannelsMasker.ProblemsToMask = [ "deadReadout", "deadPhys", "short", "almostDead", "highNoiseHG", "highNoiseMG", "highNoiseLG", "sporadicBurstNoise" ] return theLArBadChannelsMasker
def configure(self): from AthenaCommon.Logging import logging mlog = logging.getLogger('CaloCellGetter::configure:') mlog.info('entering') doStandardCellReconstruction = True from CaloRec.CaloCellFlags import jobproperties if not jobproperties.CaloCellFlags.doFastCaloSim.statusOn: doFastCaloSim = False mlog.info("doFastCaloSim not set, so not using it") else: doFastCaloSim = jobproperties.CaloCellFlags.doFastCaloSim() if doFastCaloSim: mlog.info("doFastCaloSim requested") doStandardCellReconstruction = False if jobproperties.CaloCellFlags.doFastCaloSimAddCells(): doStandardCellReconstruction = True mlog.info( "doFastCaloSimAddCells requested: FastCaloSim is added to fullsim calorimeter" ) else: mlog.info( "doFastCaloSimAddCells not requested: Stand alone FastCaloSim is running" ) else: mlog.info("doFastCaloSim explicitly not requested") # get handle to upstream object # handle tile if doStandardCellReconstruction: # handle LAr import traceback try: from LArROD.LArRODFlags import larRODFlags from AthenaCommon.GlobalFlags import globalflags if larRODFlags.readDigits() and globalflags.DataSource( ) == 'data': from AthenaCommon.KeyStore import CfgItemList CfgItemList("KeyStore_inputFile").removeItem( "LArRawChannelContainer#LArRawChannels") if (not larRODFlags.readDigits() ) and globalflags.InputFormat() == 'bytestream': from AthenaCommon.AppMgr import ServiceMgr as svcMgr try: if not "LArRawChannelContainer/LArRawChannels" in svcMgr.ByteStreamAddressProviderSvc.TypeNames: svcMgr.ByteStreamAddressProviderSvc.TypeNames += [ "LArRawChannelContainer/LArRawChannels" ] except: mlog.warning( "Cannot remove LArRawChannelContainer/LArRawChannels from bytestream list" ) from LArROD.LArRawChannelGetter import LArRawChannelGetter theLArRawChannelGetter = LArRawChannelGetter() except: mlog.error("could not get handle to LArRawChannel Quit") print traceback.format_exc() return False if not theLArRawChannelGetter.usable(): if not self.ignoreConfigError(): mlog.error("LArRawChannelGetter unusable. Quit.") return False else: mlog.error( "LArRawChannelGetter unusable. Continue nevertheless") # writing of thinned digits if jobproperties.CaloCellFlags.doLArThinnedDigits.statusOn and jobproperties.CaloCellFlags.doLArThinnedDigits( ): from AthenaCommon.GlobalFlags import globalflags if globalflags.DataSource() == 'data': try: from LArROD.LArDigits import DefaultLArDigitThinner LArDigitThinner = DefaultLArDigitThinner( 'LArDigitThinner' ) # automatically added to topSequence LArDigitThinner.InputContainerName = "FREE" LArDigitThinner.OutputContainerName = "LArDigitContainer_Thinned" except Exception: treatException("Problem with LArDigitThinner ") # now configure the algorithm, part of this could be done in a separate class # cannot have same name try: from CaloRec.CaloRecConf import CaloCellMaker except: mlog.error("could not import CaloRec.CaloCellMaker") print traceback.format_exc() return False theCaloCellMaker = CaloCellMaker() self._CaloCellMakerHandle = theCaloCellMaker from AthenaCommon.AppMgr import ToolSvc if doStandardCellReconstruction: # configure CaloCellMaker here # check LArCellMakerTool_jobOptions.py for full configurability # FIXME from RecExConfig.RecFlags import rec if rec.doLArg(): try: from LArCellRec.LArCellRecConf import LArCellBuilderFromLArRawChannelTool theLArCellBuilder = LArCellBuilderFromLArRawChannelTool() except: mlog.error( "could not get handle to LArCellBuilderFromLArRawChannel Quit" ) print traceback.format_exc() return False if jobproperties.CaloCellFlags.doLArCreateMissingCells(): # bad channel tools try: from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool theLArBadChannelTool = LArBadChanTool() except: mlog.error("could not access bad channel tool Quit") print traceback.format_exc() return False ToolSvc += theLArBadChannelTool theLArCellBuilder.addDeadOTX = True theLArCellBuilder.badChannelTool = theLArBadChannelTool # add the tool to list of tool ( should use ToolHandle eventually) ToolSvc += theLArCellBuilder theCaloCellMaker.CaloCellMakerToolNames += [theLArCellBuilder] if rec.doTile(): from AthenaCommon.GlobalFlags import globalflags if globalflags.DataSource( ) == 'data' and globalflags.InputFormat() == 'bytestream': from AthenaCommon.AppMgr import ServiceMgr as svcMgr try: svcMgr.ByteStreamCnvSvc.ROD2ROBmap = ["-1"] if not "TileDigitsContainer/TileDigitsCnt" in svcMgr.ByteStreamAddressProviderSvc.TypeNames: svcMgr.ByteStreamAddressProviderSvc.TypeNames += [ "TileBeamElemContainer/TileBeamElemCnt", "TileDigitsContainer/TileDigitsCnt", "TileL2Container/TileL2Cnt", "TileLaserObject/TileLaserObj", "TileMuonReceiverContainer/TileMuRcvCnt" ] except: mlog.warning( "Cannot add TileDigitsContainer/TileDigitsCnt et al. to bytestream list" ) # set options for TileRawChannelMaker from TileRecUtils.TileRecFlags import jobproperties jobproperties.TileRecFlags.TileRunType = 1 # physics run type # reading of digits can be disabled before calling CaloCellGetter # if this is not done, but digits are not available in BS file # reading of digits is automatically disabled at start of run if jobproperties.TileRecFlags.readDigits() \ and not (jobproperties.TileRecFlags.doTileFlat \ or jobproperties.TileRecFlags.doTileFit \ or jobproperties.TileRecFlags.doTileFitCool \ or jobproperties.TileRecFlags.doTileOpt \ or jobproperties.TileRecFlags.doTileOF1 \ or jobproperties.TileRecFlags.doTileOpt2 \ or jobproperties.TileRecFlags.doTileOptATLAS \ or jobproperties.TileRecFlags.doTileMF): from AthenaCommon.BeamFlags import jobproperties # run Opt filter with iterations by default, both for cosmics and collisions before 2011 # run Opt filter without iterations for collisions in 2011 and later if not 'doTileOpt2' in dir(): from RecExConfig.AutoConfiguration import GetRunNumber rn = GetRunNumber() if rn > 0 and rn < 171194: doTileOpt2 = True elif jobproperties.Beam.beamType() == 'collisions': doTileOpt2 = False # use OF without iterations for collisions else: doTileOpt2 = True # always run OF with iterations for cosmics # jobproperties.TileRecFlags.calibrateEnergy=True; # use pCb for RawChannels # please, note that time correction and best phase are used only for collisions if doTileOpt2: jobproperties.TileRecFlags.doTileOpt2 = True # run optimal filter with iterations jobproperties.TileRecFlags.doTileOptATLAS = False # disable optimal filter without iterations jobproperties.TileRecFlags.correctAmplitude = False # don't do parabolic correction if jobproperties.Beam.beamType() == 'collisions': jobproperties.TileRecFlags.correctTime = True # apply time correction in physics runs jobproperties.TileRecFlags.BestPhaseFromCOOL = False # best phase is not needed for iterations else: jobproperties.TileRecFlags.doTileOpt2 = False # disable optimal filter with iterations jobproperties.TileRecFlags.doTileOptATLAS = True # run optimal filter without iterations jobproperties.TileRecFlags.correctAmplitude = True # apply parabolic correction if jobproperties.Beam.beamType() == 'collisions': jobproperties.TileRecFlags.correctTime = False # don't need time correction if best phase is used jobproperties.TileRecFlags.BestPhaseFromCOOL = True # use best phase stored in DB try: from TileRecUtils.TileRawChannelGetter import TileRawChannelGetter theTileRawChannelGetter = TileRawChannelGetter() except: mlog.error("could not load TileRawChannelGetter Quit") print traceback.format_exc() return False try: from TileRecAlgs.TileRecAlgsConf import TileDigitsFilter from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() topSequence += TileDigitsFilter() except: mlog.error("Could not configure TileDigitsFilter") try: from TileRecUtils.TileRecUtilsConf import TileCellBuilder theTileCellBuilder = TileCellBuilder() from TileRecUtils.TileRecFlags import jobproperties theTileCellBuilder.TileRawChannelContainer = jobproperties.TileRecFlags.TileRawChannelContainer( ) if not hasattr(ToolSvc, "TileBeamInfoProvider"): from TileRecUtils.TileRecUtilsConf import TileBeamInfoProvider ToolSvc += TileBeamInfoProvider() if globalflags.DataSource( ) == 'data' and globalflags.InputFormat() == 'bytestream': if jobproperties.TileRecFlags.readDigits(): # everything is already corrected at RawChannel level theTileCellBuilder.correctTime = False theTileCellBuilder.correctAmplitude = False else: ToolSvc.TileBeamInfoProvider.TileRawChannelContainer = "TileRawChannelCnt" # by default parameters are tuned for opt.filter without iterations theTileCellBuilder.correctTime = jobproperties.TileRecFlags.correctTime( ) theTileCellBuilder.correctAmplitude = jobproperties.TileRecFlags.correctAmplitude( ) theTileCellBuilder.AmpMinForAmpCorrection = jobproperties.TileRecFlags.AmpMinForAmpCorrection( ) if jobproperties.TileRecFlags.TimeMaxForAmpCorrection( ) <= jobproperties.TileRecFlags.TimeMinForAmpCorrection( ): from AthenaCommon.BeamFlags import jobproperties mlog.info( "adjusting min/max time of parabolic correction for %s" % jobproperties.Beam.bunchSpacing) halfBS = jobproperties.Beam.bunchSpacing.get_Value( ) / 2. jobproperties.TileRecFlags.TimeMinForAmpCorrection = -halfBS jobproperties.TileRecFlags.TimeMaxForAmpCorrection = halfBS if jobproperties.TileRecFlags.TimeMaxForAmpCorrection( ) > jobproperties.TileRecFlags.TimeMinForAmpCorrection( ): theTileCellBuilder.TimeMinForAmpCorrection = jobproperties.TileRecFlags.TimeMinForAmpCorrection( ) theTileCellBuilder.TimeMaxForAmpCorrection = jobproperties.TileRecFlags.TimeMaxForAmpCorrection( ) ToolSvc += theTileCellBuilder theCaloCellMaker.CaloCellMakerToolNames += [ theTileCellBuilder ] except: mlog.error("could not get handle to TileCellBuilder Quit") print traceback.format_exc() return False if doFastCaloSim: mlog.info('configuring FastCaloSim here') try: from FastCaloSim.FastCaloSimConf import EmptyCellBuilderTool theEmptyCellBuilderTool = EmptyCellBuilderTool() ToolSvc += theEmptyCellBuilderTool theCaloCellMaker.CaloCellMakerToolNames += [ theEmptyCellBuilderTool ] print theEmptyCellBuilderTool mlog.info("configure EmptyCellBuilderTool worked") except: mlog.error("could not get handle to EmptyCellBuilderTool Quit") print traceback.format_exc() return False try: from FastCaloSim.FastCaloSimFactory import FastCaloSimFactory theFastShowerCellBuilderTool = FastCaloSimFactory() ToolSvc += theFastShowerCellBuilderTool theCaloCellMaker.CaloCellMakerToolNames += [ theFastShowerCellBuilderTool ] mlog.info("configure FastShowerCellBuilderTool worked") except: mlog.error( "could not get handle to FastShowerCellBuilderTool Quit") print traceback.format_exc() return False doFastCaloSimNoise = jobproperties.CaloCellFlags.doFastCaloSimNoise( ) if doFastCaloSimNoise: try: from FastCaloSim.FastCaloSimConf import AddNoiseCellBuilderTool theAddNoiseCellBuilderTool = AddNoiseCellBuilderTool() from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() from AthenaCommon.AppMgr import ToolSvc ToolSvc += theCaloNoiseTool theAddNoiseCellBuilderTool.CaloNoiseTool = theCaloNoiseTool.getFullName( ) print theAddNoiseCellBuilderTool ToolSvc += theAddNoiseCellBuilderTool theCaloCellMaker.CaloCellMakerToolNames += [ theAddNoiseCellBuilderTool ] mlog.info("configure AddNoiseCellBuilderTool worked") except: mlog.error( "could not get handle to AddNoiseCellBuilderTool Quit") print traceback.format_exc() return False # # CaloCellContainerFinalizerTool : closing container and setting up iterators # from CaloRec.CaloRecConf import CaloCellContainerFinalizerTool theCaloCellContainerFinalizerTool = CaloCellContainerFinalizerTool() ToolSvc += theCaloCellContainerFinalizerTool theCaloCellMaker.CaloCellMakerToolNames += [ theCaloCellContainerFinalizerTool ] # # Mergeing of calo cellcontainer with sparse raw channel container with improved energies # doLArMerge = False if globalflags.DataSource( ) == 'data' and jobproperties.CaloCellFlags.doLArRawChannelMerge.statusOn and jobproperties.CaloCellFlags.doLArRawChannelMerge( ): from LArROD.LArRODFlags import larRODFlags if larRODFlags.readDigits() and larRODFlags.keepDSPRaw(): doLArMerge = True if doLArMerge: try: from LArCellRec.LArCellRecConf import LArCellMerger theLArCellMerger = LArCellMerger() except: mlog.error("could not get handle to LArCellMerge Quit") print traceback.format_exc() return False theLArCellMerger.RawChannelsName = larRODFlags.RawChannelFromDigitsContainerName( ) ToolSvc += theLArCellMerger theCaloCellMaker.CaloCellMakerToolNames += [theLArCellMerger] # # masking of noisy and sporadic noisy cells in LAr # doNoiseMask = False if jobproperties.CaloCellFlags.doLArNoiseMasking.statusOn and jobproperties.CaloCellFlags.doLArNoiseMasking( ): doNoiseMask = True doSporadicMask = False if jobproperties.CaloCellFlags.doLArSporadicMasking.statusOn and jobproperties.CaloCellFlags.doLArSporadicMasking( ): doSporadicMask = True if doNoiseMask or doSporadicMask: try: from LArCellRec.LArCellRecConf import LArCellNoiseMaskingTool theLArCellNoiseMaskingTool = LArCellNoiseMaskingTool() except: mlog.error( "could not get handle to LArCellNoiseMaskingTool Quit") print traceback.format_exc() return False # bad channel tools try: from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool theLArBadChannelTool = LArBadChanTool() except: mlog.error("could not access bad channel tool Quit") print traceback.format_exc() return False ToolSvc += theLArBadChannelTool if doSporadicMask: try: from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArSporadicNoiseMasker = LArBadChannelMasker( "LArSporadicNoiseMasker") except: mlog.error("could not access bad channel tool Quit") print traceback.format_exc() return False theLArSporadicNoiseMasker.TheLArBadChanTool = theLArBadChannelTool theLArSporadicNoiseMasker.DoMasking = True theLArSporadicNoiseMasker.ProblemsToMask = [ "sporadicBurstNoise" ] ToolSvc += theLArSporadicNoiseMasker theLArCellNoiseMaskingTool.MaskingSporadicTool = theLArSporadicNoiseMasker if doNoiseMask: try: from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArNoiseMasker = LArBadChannelMasker("LArNoiseMasker") except: mlog.error("could not access bad channel tool Quit") print traceback.format_exc() return False theLArNoiseMasker.TheLArBadChanTool = theLArBadChannelTool theLArNoiseMasker.DoMasking = True theLArNoiseMasker.ProblemsToMask = [ "highNoiseHG", "highNoiseMG", "highNoiseLG", "deadReadout", "deadPhys" ] ToolSvc += theLArNoiseMasker theLArCellNoiseMaskingTool.MaskingTool = theLArNoiseMasker theLArCellNoiseMaskingTool.maskNoise = doNoiseMask theLArCellNoiseMaskingTool.maskSporadic = doSporadicMask # quality cut for sporadic noise masking theLArCellNoiseMaskingTool.qualityCut = 4000 ToolSvc += theLArCellNoiseMaskingTool theCaloCellMaker.CaloCellMakerToolNames += [ theLArCellNoiseMaskingTool ] # # masking of Feb problems # doBadFebMasking = False if jobproperties.CaloCellFlags.doLArBadFebMasking.statusOn and jobproperties.CaloCellFlags.doLArBadFebMasking( ): from AthenaCommon.GlobalFlags import globalflags if globalflags.DataSource() == 'data': doBadFebMasking = True if doBadFebMasking: try: from LArCellRec.LArCellRecConf import LArBadFebMaskingTool theLArBadFebMaskingTool = LArBadFebMaskingTool() if ( rec.doExpressProcessing() or athenaCommonFlags.isOnline() ): # In online or express processing, EventInfo::LArError is triggered if >=4 FEB with data corrupted theLArBadFebMaskingTool.minFebInError = 4 except: mlog.error("could not get handle to LArBadFebMaskingTool Quit") print traceback.format_exc() return False ToolSvc += theLArBadFebMaskingTool # bad channel tools try: from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool theLArBadChannelTool = LArBadChanTool() except: mlog.error("could not access bad channel tool Quit") print traceback.format_exc() return False ToolSvc += theLArBadChannelTool theLArBadFebMaskingTool.badChannelTool = theLArBadChannelTool theCaloCellMaker.CaloCellMakerToolNames += [ theLArBadFebMaskingTool ] # # emulate gain pathologies on MC # doGainPathology = False if jobproperties.CaloCellFlags.doLArCellGainPathology.statusOn and jobproperties.CaloCellFlags.doLArCellGainPathology( ): from AthenaCommon.GlobalFlags import globalflags if globalflags.DataSource() == 'geant4': doGainPathology = True if doGainPathology: try: from LArCellRec.LArCellRecConf import LArCellGainPathology theLArCellGainPathology = LArCellGainPathology() except: mlog.error("could not get handle to LArCellGainPatholog< Quit") print traceback.format_exc() return False ToolSvc += theLArCellGainPathology theCaloCellMaker.CaloCellMakerToolNames += [ theLArCellGainPathology ] # lar miscalibration if MC only (should be done after finalisation) if not jobproperties.CaloCellFlags.doLArCellEmMisCalib.statusOn: # the flag has not been set, so decide a reasonable default # this is the old global flags should use the new one as # soon as monitoring does from AthenaCommon.GlobalFlags import globalflags if globalflags.DataSource() == 'data': doLArCellEmMisCalib = False mlog.info( "jobproperties.CaloCellFlags.doLArMisCalib not set and real data: do not apply LArCellEmMisCalibTool" ) else: doLArCellEmMisCalib = True mlog.info( "jobproperties.CaloCellFlags.doLArMisCalib not set and Monte Carlo: apply LArCellEmMisCalibTool" ) else: doLArCellEmMisCalib = jobproperties.CaloCellFlags.doLArCellEmMisCalib( ) if doLArCellEmMisCalib: mlog.info("LArCellEmMisCalibTool requested") else: mlog.info("LArCellEmMisCalibTool explicitly not requested") if doLArCellEmMisCalib: try: from LArCellRec.LArCellRecConf import LArCellEmMiscalib theLArCellEmMiscalib = LArCellEmMiscalib("LArCellEmMiscalib") except: mlog.error("could not get handle to LArCellEmMisCalib Quit") print traceback.format_exc() return False # examples on how to change miscalibration. Default values are 0.005 and 0.007 # theLArCellEmMiscalib.SigmaPerRegion = 0.005; # theLArCellEmMiscalib.SigmaPerCell = 0.005; ToolSvc += theLArCellEmMiscalib try: from CaloRec.CaloRecConf import CaloCellContainerCorrectorTool from CaloIdentifier import SUBCALO theMisCalibTool = CaloCellContainerCorrectorTool( "MisCalibTool", CaloNums=[SUBCALO.LAREM], CellCorrectionToolNames=[theLArCellEmMiscalib]) except: mlog.error("could not get handle to MisCalibTool Quit") print traceback.format_exc() return False ToolSvc += theMisCalibTool theCaloCellMaker.CaloCellMakerToolNames += [theMisCalibTool] # # Pedestal shift correction # doPedestalCorr = False if jobproperties.CaloCellFlags.doPedestalCorr.statusOn: from AthenaCommon.GlobalFlags import globalflags if jobproperties.CaloCellFlags.doPedestalCorr() and ( globalflags.DataSource() == 'data' or jobproperties.CaloCellFlags.doPileupOffsetBCIDCorr): doPedestalCorr = True mlog.info("Apply cell level pedestal shift correction") import os if doPedestalCorr: try: from CaloCellCorrection.CaloCellPedestalCorrDefault import CaloCellPedestalCorrDefault theCaloCellPedestalCorr = CaloCellPedestalCorrDefault() ToolSvc += theCaloCellPedestalCorr theCaloCellMaker.CaloCellMakerToolNames += [ theCaloCellPedestalCorr ] except: mlog.error("could not get handle to CaloCellPedestalCorr") print traceback.format_exc() # # HV correction for offline reprocessing, reading HV from Cool-DCS database # doHVCorr = False from AthenaCommon.DetFlags import DetFlags if DetFlags.dcs.LAr_on(): if jobproperties.CaloCellFlags.doLArHVCorr.statusOn: from AthenaCommon.GlobalFlags import globalflags if jobproperties.CaloCellFlags.doLArHVCorr( ) and globalflags.DataSource() == 'data': doHVCorr = True mlog.info( "Redoing HV correction at cell level from COOL/DCS database" ) if doHVCorr: from LArCellRec.LArCellHVCorrDefault import LArCellHVCorrDefault theLArCellHVCorr = LArCellHVCorrDefault() try: from CaloRec.CaloRecConf import CaloCellContainerCorrectorTool from CaloIdentifier import SUBCALO theHVCorrTool = CaloCellContainerCorrectorTool( "HVCorrTool", CaloNums=[SUBCALO.LAREM, SUBCALO.LARHEC, SUBCALO.LARFCAL], CellCorrectionToolNames=[theLArCellHVCorr]) except: mlog.error("could not get handle to HVCorrTool Quit") print traceback.format_exc() return False ToolSvc += theHVCorrTool theCaloCellMaker.CaloCellMakerToolNames += [theHVCorrTool] # # correction to undo online calibration and apply new LAr electronics calibration for ADC->MeV conversion # doLArRecalibration = False if jobproperties.CaloCellFlags.doLArRecalibration.statusOn: from AthenaCommon.GlobalFlags import globalflags from LArConditionsCommon.LArCondFlags import larCondFlags if jobproperties.CaloCellFlags.doLArRecalibration( ) and globalflags.DataSource() == 'data' and ( not larCondFlags.SingleVersion()): doLArRecalibration = True mlog.info("Redoing LAr electronics calibration for ADC->MeV") if doLArRecalibration: # get tool for cell recalibration try: from LArCellRec.LArCellRecConf import LArCellRecalibration theLArCellRecalibration = LArCellRecalibration( "LArCellRecalibration") except: mlog.error("could not get handle to LArCellRecalibration Quit") print traceback.format_exc() return False ToolSvc += theLArCellRecalibration # get new ADC2MeVTool try: from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault theLArADC2MeVToolDefault = LArADC2MeVToolDefault() except: mlog.error( "Could not get handle to LArADC2MeVToolDefault Quit") print traceback.format_exc() return False ToolSvc += theLArADC2MeVToolDefault # get old ADC2MeVTool try: from LArRecUtils.LArADC2MeVToolOnline import LArADC2MeVToolOnline theLArADC2MeVToolOnline = LArADC2MeVToolOnline() except: mlog.error("Could not get handle to LArADC2MeVToolOnline Quit") print traceback.format_exc() return False ToolSvc += theLArADC2MeVToolOnline theLArCellRecalibration.adc2MeVTool = theLArADC2MeVToolDefault theLArCellRecalibration.adc2MeVToolOnline = theLArADC2MeVToolOnline try: from CaloRec.CaloRecConf import CaloCellContainerCorrectorTool from CaloIdentifier import SUBCALO theLArRecalibrationTool = CaloCellContainerCorrectorTool( "LArRecalibrationTool", CaloNums=[SUBCALO.LAREM, SUBCALO.LARHEC, SUBCALO.LARFCAL], CellCorrectionToolNames=[theLArCellRecalibration]) except: mlog.error("could not get handle to HVCorrTool Quit") print traceback.format_exc() return False ToolSvc += theLArRecalibrationTool theCaloCellMaker.CaloCellMakerToolNames += [ theLArRecalibrationTool ] # # Correction for MinBias energy shift for MC pileup reco # doMinBiasAverage = False if jobproperties.CaloCellFlags.doMinBiasAverage.statusOn: from AthenaCommon.GlobalFlags import globalflags from AthenaCommon.BeamFlags import jobproperties if jobproperties.CaloCellFlags.doMinBiasAverage( ) and globalflags.DataSource() == 'geant4' and ( not jobproperties.Beam.zeroLuminosity()): doMinBiasAverage = True if doMinBiasAverage: try: from CaloTools.CaloMBAverageToolDefault import CaloMBAverageToolDefault theCaloMBAverageTool = CaloMBAverageToolDefault() except: mlog.error("could not get handle to CaloMBAverageTool Quit") print traceback.format_exc() return False ToolSvc += theCaloMBAverageTool try: from CaloCellCorrection.CaloCellCorrectionConf import CaloCellMBAverageCorr theCaloCellMBAverageCorr = CaloCellMBAverageCorr( "CaloCellMBAverageCorr") theCaloCellMBAverageCorr.CaloMBAverageTool = theCaloMBAverageTool except: mlog.error( "could not get handle to CaloCellMBAverageCorr Quit") print traceback.format_exc() return False ToolSvc += theCaloCellMBAverageCorr try: from CaloRec.CaloRecConf import CaloCellContainerCorrectorTool from CaloIdentifier import SUBCALO theMBAverageTool = CaloCellContainerCorrectorTool( "MBAverageTool", CaloNums=[SUBCALO.NSUBCALO], CellCorrectionToolNames=[theCaloCellMBAverageCorr]) except: mlog.error( "could not get handle to CaloCellContainerCorrectorTool/MBAverageTool Quit" ) print traceback.format_exc() return False ToolSvc += theMBAverageTool theCaloCellMaker.CaloCellMakerToolNames += [theMBAverageTool] # # Correction for dead cells, where we average the energy density of neighbor cells # doNeighborsAverage = False if jobproperties.CaloCellFlags.doDeadCellCorr.statusOn: if jobproperties.CaloCellFlags.doDeadCellCorr(): doNeighborsAverage = True if doNeighborsAverage: try: from CaloCellCorrection.CaloCellCorrectionConf import CaloCellNeighborsAverageCorr theCaloCellNeighborsAverageCorr = CaloCellNeighborsAverageCorr( "CaloCellNeighborsAverageCorr") theCaloCellNeighborsAverageCorr.testMode = False except: mlog.error( "could not get handle to CaloCellNeighborsAverageCorr Quit" ) print traceback.format_exc() return False ToolSvc += theCaloCellNeighborsAverageCorr theCaloCellMaker.CaloCellMakerToolNames += [ theCaloCellNeighborsAverageCorr ] # # correction for missing Febs based on L1 readout doLArDeadOTXCorr = False if jobproperties.CaloCellFlags.doLArDeadOTXCorr.statusOn and jobproperties.CaloCellFlags.doLArCreateMissingCells.statusOn: if jobproperties.CaloCellFlags.doLArDeadOTXCorr( ) and jobproperties.CaloCellFlags.doLArCreateMissingCells( ) and doStandardCellReconstruction: if rec.doTrigger(): doLArDeadOTXCorr = True else: mlog.warning( "Trigger is switched off. Can't run deadOTX correction." ) if doLArDeadOTXCorr: try: from LArCellRec.LArCellDeadOTXCorrToolDefault import LArCellDeadOTXCorrToolDefault theLArCellDeadOTXCorr = LArCellDeadOTXCorrToolDefault() except: mlog.error("could not get handle to LArCellDeadOTXCorr Quit") print traceback.format_exc() ToolSvc += theLArCellDeadOTXCorr theCaloCellMaker.CaloCellMakerToolNames += [theLArCellDeadOTXCorr] doCaloEnergyRescaler = False if jobproperties.CaloCellFlags.doCaloCellEnergyCorr( ) and globalflags.DataSource( ) == 'data' and not athenaCommonFlags.isOnline(): try: from CaloCellCorrection.CaloCellCorrectionConf import CaloCellEnergyRescaler theCCERescalerTool = CaloCellEnergyRescaler() theCCERescalerTool.Folder = "/LAR/CellCorrOfl/EnergyCorr" ToolSvc += theCCERescalerTool from IOVDbSvc.CondDB import conddb # conddb.addFolder("","/LAR/CellCorrOfl/EnergyCorr<tag>EnergyScale-00</tag><db>sqlite://;schema=escale.db;dbname=COMP200</db>") conddb.addFolder("LAR_OFL", "/LAR/CellCorrOfl/EnergyCorr") ToolSvc += theCCERescalerTool theCaloCellMaker.CaloCellMakerToolNames += [theCCERescalerTool] except: mlog.error( "could not get handle to CaloCellEnergyRescaler Quit") print traceback.format_exc() return False pass if jobproperties.CaloCellFlags.doCaloCellTimeCorr( ) and globalflags.DataSource( ) == 'data' and not athenaCommonFlags.isOnline(): try: from CaloRec.CaloRecConf import CaloCellContainerCorrectorTool from CaloCellCorrection.CaloCellCorrectionConf import CaloCellTimeCorrTool theLArTimeCorr = CaloCellTimeCorrTool() theLArTimeCorr.Folder = "/LAR/TimeCorrectionOfl/CellTimeOffset" ToolSvc += theLArTimeCorr from IOVDbSvc.CondDB import conddb # conddb.addFolder("","/LAR/TimeCorrectionOfl/CellTimeOffset<tag>LARTimeCorrectionOflCellTimeOffset-empty</tag><db>sqlite://;schema=timecorr.db;dbname=COMP200</db>") conddb.addFolder("LAR_OFL", "/LAR/TimeCorrectionOfl/CellTimeOffset") theCaloTimeCorrTool = CaloCellContainerCorrectorTool( "LArTimeCorrTool", CellCorrectionToolNames=[theLArTimeCorr]) ToolSvc += theCaloTimeCorrTool theCaloCellMaker.CaloCellMakerToolNames += [ theCaloTimeCorrTool ] except: mlog.error("could not get handle to CaloCellTimeCorrTool Quit") print traceback.format_exc() return False pass # make lots of checks (should not be necessary eventually) # to print the check add: from CaloRec.CaloRecConf import CaloCellContainerCheckerTool theCaloCellContainerCheckerTool = CaloCellContainerCheckerTool() # FIXME # theCaloCellContainerCheckerTool.OutputLevel=DEBUG ToolSvc += theCaloCellContainerCheckerTool theCaloCellMaker.CaloCellMakerToolNames += [ theCaloCellContainerCheckerTool ] # # sets output key theCaloCellMaker.CaloCellsOutputName = self.outputKey() # register output in objKeyStore from RecExConfig.ObjKeyStore import objKeyStore objKeyStore.addStreamESD(self.outputType(), self.outputKey()) # now add algorithm to topSequence # this should always come at the end mlog.info(" now adding CaloCellMaker to topSequence") from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() topSequence += theCaloCellMaker return True
def configure(self): from AthenaCommon.Logging import logging mlog = logging.getLogger('CaloCellGetter_DigiHSTruth::configure:') mlog.info('entering') doStandardCellReconstruction = True from CaloRec.CaloCellFlags import jobproperties # get handle to upstream object # handle tile if doStandardCellReconstruction: from LArROD.LArRODFlags import larRODFlags # now configure the algorithm, part of this could be done in a separate class # cannot have same name try: from CaloRec.CaloRecConf import CaloCellMaker except Exception: mlog.error("could not import CaloRec.CaloCellMaker") print(traceback.format_exc()) return False theCaloCellMaker = CaloCellMaker("CaloCellMaker_DigiHSTruth") self._CaloCellMakerHandle = theCaloCellMaker from AthenaCommon.AppMgr import ToolSvc if doStandardCellReconstruction: # configure CaloCellMaker here # check LArCellMakerTool_jobOptions.py for full configurability # FIXME if rec.doLArg(): from LArCabling.LArCablingAccess import LArOnOffIdMapping LArOnOffIdMapping() try: from LArCellRec.LArCellRecConf import LArCellBuilderFromLArRawChannelTool theLArCellBuilder = LArCellBuilderFromLArRawChannelTool( "LArCellBuilder_DigiHSTruth") theLArCellBuilder.RawChannelsName = "LArRawChannels_DigiHSTruth" except Exception: mlog.error( "could not get handle to LArCellBuilderFromLArRawChannel Quit" ) print(traceback.format_exc()) return False if jobproperties.CaloCellFlags.doLArCreateMissingCells(): theLArCellBuilder.addDeadOTX = True # add the tool to list of tool ( should use ToolHandle eventually) theCaloCellMaker += theLArCellBuilder theCaloCellMaker.CaloCellMakerToolNames += [theLArCellBuilder] if rec.doTile(): try: from TileRecUtils.TileRecUtilsConf import TileCellBuilder theTileCellBuilder = TileCellBuilder( "TileCellBuilder_DigiHSTruth") theTileCellBuilder.TileRawChannelContainer = "TileRawChannelCnt_DigiHSTruth" theTileCellBuilder.E4prContainer = "E4prContainer2_DigiHSTruth" theTileCellBuilder.MBTSContainer = "MBTSContainer2_DigiHSTruth" theTileCellBuilder.TileDSPRawChannelContainer = "TileRawChannelCnt_DigiHSTruth" theCaloCellMaker += theTileCellBuilder theCaloCellMaker.CaloCellMakerToolNames += [ theTileCellBuilder ] except Exception: mlog.error("could not get handle to TileCellBuilder Quit") print(traceback.format_exc()) return False # # CaloCellContainerFinalizerTool : closing container and setting up iterators # from CaloRec.CaloRecConf import CaloCellContainerFinalizerTool theCaloCellContainerFinalizerTool = CaloCellContainerFinalizerTool( "CaloCellContainerFinalizerTool_DigiHSTruth") theCaloCellMaker += theCaloCellContainerFinalizerTool theCaloCellMaker.CaloCellMakerToolNames += [ theCaloCellContainerFinalizerTool ] # # Mergeing of calo cellcontainer with sparse raw channel container with improved energies # doLArMerge = False if doLArMerge: try: from LArCellRec.LArCellRecConf import LArCellMerger theLArCellMerger = LArCellMerger() except Exception: mlog.error("could not get handle to LArCellMerge Quit") print(traceback.format_exc()) return False theLArCellMerger.RawChannelsName = larRODFlags.RawChannelFromDigitsContainerName( ) theCaloCellMaker += theLArCellMerger theCaloCellMaker.CaloCellMakerToolNames += [theLArCellMerger] # # masking of noisy and sporadic noisy cells in LAr # doNoiseMask = False if jobproperties.CaloCellFlags.doLArNoiseMasking.statusOn and jobproperties.CaloCellFlags.doLArNoiseMasking( ): doNoiseMask = True doSporadicMask = False if jobproperties.CaloCellFlags.doLArSporadicMasking.statusOn and jobproperties.CaloCellFlags.doLArSporadicMasking( ): doSporadicMask = True if doNoiseMask or doSporadicMask: try: from LArCellRec.LArCellRecConf import LArCellNoiseMaskingTool theLArCellNoiseMaskingTool = LArCellNoiseMaskingTool() except Exception: mlog.error( "could not get handle to LArCellNoiseMaskingTool Quit") print(traceback.format_exc()) return False if doSporadicMask: try: from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArSporadicNoiseMasker = LArBadChannelMasker( "LArSporadicNoiseMasker") except Exception: mlog.error("could not access bad channel tool Quit") print(traceback.format_exc()) return False theLArSporadicNoiseMasker.DoMasking = True theLArSporadicNoiseMasker.ProblemsToMask = [ "sporadicBurstNoise" ] ToolSvc += theLArSporadicNoiseMasker theLArCellNoiseMaskingTool.MaskingSporadicTool = theLArSporadicNoiseMasker if doNoiseMask: try: from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArNoiseMasker = LArBadChannelMasker("LArNoiseMasker") except Exception: mlog.error("could not access bad channel tool Quit") print(traceback.format_exc()) return False theLArNoiseMasker.DoMasking = True theLArNoiseMasker.ProblemsToMask = [ "highNoiseHG", "highNoiseMG", "highNoiseLG", "deadReadout", "deadPhys" ] ToolSvc += theLArNoiseMasker theLArCellNoiseMaskingTool.MaskingTool = theLArNoiseMasker theLArCellNoiseMaskingTool.maskNoise = doNoiseMask theLArCellNoiseMaskingTool.maskSporadic = doSporadicMask # quality cut for sporadic noise masking theLArCellNoiseMaskingTool.qualityCut = 4000 theCaloCellMaker += theLArCellNoiseMaskingTool theCaloCellMaker.CaloCellMakerToolNames += [ theLArCellNoiseMaskingTool ] # # masking of Feb problems # doBadFebMasking = False if doBadFebMasking: try: from LArCellRec.LArCellRecConf import LArBadFebMaskingTool theLArBadFebMaskingTool = LArBadFebMaskingTool() if ( rec.doExpressProcessing() or athenaCommonFlags.isOnline() ): # In online or express processing, EventInfo::LArError is triggered if >=4 FEB with data corrupted theLArBadFebMaskingTool.minFebInError = 4 except Exception: mlog.error("could not get handle to LArBadFebMaskingTool Quit") print(traceback.format_exc()) return False theCaloCellMaker += theLArBadFebMaskingTool theCaloCellMaker.CaloCellMakerToolNames += [ theLArBadFebMaskingTool ] # # emulate gain pathologies on MC # doGainPathology = False if jobproperties.CaloCellFlags.doLArCellGainPathology.statusOn and jobproperties.CaloCellFlags.doLArCellGainPathology( ): if globalflags.DataSource() == 'geant4': doGainPathology = True if doGainPathology: try: from LArCellRec.LArCellRecConf import LArCellGainPathology theLArCellGainPathology = LArCellGainPathology() except Exception: mlog.error("could not get handle to LArCellGainPatholog< Quit") print(traceback.format_exc()) return False theCaloCellMaker += theLArCellGainPathology theCaloCellMaker.CaloCellMakerToolNames += [ theLArCellGainPathology ] # lar miscalibration if MC only (should be done after finalisation) if not jobproperties.CaloCellFlags.doLArCellEmMisCalib.statusOn: # the flag has not been set, so decide a reasonable default # this is the old global flags should use the new one as # soon as monitoring does doLArCellEmMisCalib = True mlog.info( "jobproperties.CaloCellFlags.doLArMisCalib not set and Monte Carlo: apply LArCellEmMisCalibTool" ) else: doLArCellEmMisCalib = jobproperties.CaloCellFlags.doLArCellEmMisCalib( ) if doLArCellEmMisCalib: mlog.info("LArCellEmMisCalibTool requested") else: mlog.info("LArCellEmMisCalibTool explicitly not requested") if doLArCellEmMisCalib: try: from LArCellRec.LArCellRecConf import LArCellEmMiscalib theLArCellEmMiscalib = LArCellEmMiscalib("LArCellEmMiscalib") except Exception: mlog.error("could not get handle to LArCellEmMisCalib Quit") print(traceback.format_exc()) return False # examples on how to change miscalibration. Default values are 0.005 and 0.007 # theLArCellEmMiscalib.SigmaPerRegion = 0.005 # theLArCellEmMiscalib.SigmaPerCell = 0.005 ToolSvc += theLArCellEmMiscalib try: from CaloRec.CaloRecConf import CaloCellContainerCorrectorTool from CaloIdentifier import SUBCALO theMisCalibTool = CaloCellContainerCorrectorTool( "MisCalibTool", CaloNums=[SUBCALO.LAREM], CellCorrectionToolNames=[theLArCellEmMiscalib]) except Exception: mlog.error("could not get handle to MisCalibTool Quit") print(traceback.format_exc()) return False theCaloCellMaker += theMisCalibTool theCaloCellMaker.CaloCellMakerToolNames += [theMisCalibTool] # # Pedestal shift correction # doPedestalCorr = False if jobproperties.CaloCellFlags.doPedestalCorr.statusOn: if jobproperties.CaloCellFlags.doPedestalCorr() and ( jobproperties.CaloCellFlags.doPileupOffsetBCIDCorr): doPedestalCorr = True mlog.info("Apply cell level pedestal shift correction") if doPedestalCorr: try: from CaloCellCorrection.CaloCellPedestalCorrDefault import CaloCellPedestalCorrDefault theCaloCellPedestalCorr = CaloCellPedestalCorrDefault() theCaloCellMaker += theCaloCellPedestalCorr theCaloCellMaker.CaloCellMakerToolNames += [ theCaloCellPedestalCorr ] except Exception: mlog.error("could not get handle to CaloCellPedestalCorr") print(traceback.format_exc()) # # Correction for MinBias energy shift for MC pileup reco # doMinBiasAverage = False if jobproperties.CaloCellFlags.doMinBiasAverage.statusOn: from AthenaCommon.BeamFlags import jobproperties if jobproperties.CaloCellFlags.doMinBiasAverage( ) and globalflags.DataSource() == 'geant4' and ( not jobproperties.Beam.zeroLuminosity()): doMinBiasAverage = True if doMinBiasAverage: try: from CaloTools.CaloMBAverageToolDefault import CaloMBAverageToolDefault theCaloMBAverageTool = CaloMBAverageToolDefault() except Exception: mlog.error("could not get handle to CaloMBAverageTool Quit") print(traceback.format_exc()) return False ToolSvc += theCaloMBAverageTool try: from CaloCellCorrection.CaloCellCorrectionConf import CaloCellMBAverageCorr theCaloCellMBAverageCorr = CaloCellMBAverageCorr( "CaloCellMBAverageCorr") theCaloCellMBAverageCorr.CaloMBAverageTool = theCaloMBAverageTool except Exception: mlog.error( "could not get handle to CaloCellMBAverageCorr Quit") print(traceback.format_exc()) return False ToolSvc += theCaloCellMBAverageCorr try: from CaloRec.CaloRecConf import CaloCellContainerCorrectorTool from CaloIdentifier import SUBCALO theMBAverageTool = CaloCellContainerCorrectorTool( "MBAverageTool", CaloNums=[SUBCALO.NSUBCALO], CellCorrectionToolNames=[theCaloCellMBAverageCorr]) except Exception: mlog.error( "could not get handle to CaloCellContainerCorrectorTool/MBAverageTool Quit" ) print(traceback.format_exc()) return False theCaloCellMaker += theMBAverageTool theCaloCellMaker.CaloCellMakerToolNames += [theMBAverageTool] # # Correction for dead cells, where we average the energy density of neighbor cells # doNeighborsAverage = False if jobproperties.CaloCellFlags.doDeadCellCorr.statusOn: if jobproperties.CaloCellFlags.doDeadCellCorr(): doNeighborsAverage = True if doNeighborsAverage: try: from CaloCellCorrection.CaloCellCorrectionConf import CaloCellNeighborsAverageCorr theCaloCellNeighborsAverageCorr = CaloCellNeighborsAverageCorr( "CaloCellNeighborsAverageCorr") theCaloCellNeighborsAverageCorr.testMode = False except Exception: mlog.error( "could not get handle to CaloCellNeighborsAverageCorr Quit" ) print(traceback.format_exc()) return False theCaloCellMaker += theCaloCellNeighborsAverageCorr theCaloCellMaker.CaloCellMakerToolNames += [ theCaloCellNeighborsAverageCorr ] # # correction for missing Febs based on L1 readout doLArDeadOTXCorr = False if jobproperties.CaloCellFlags.doLArDeadOTXCorr.statusOn and jobproperties.CaloCellFlags.doLArCreateMissingCells.statusOn: if jobproperties.CaloCellFlags.doLArDeadOTXCorr( ) and jobproperties.CaloCellFlags.doLArCreateMissingCells( ) and doStandardCellReconstruction: if rec.doTrigger(): doLArDeadOTXCorr = True else: mlog.warning( "Trigger is switched off. Can't run deadOTX correction." ) if doLArDeadOTXCorr: try: from LArCellRec.LArCellDeadOTXCorrToolDefault import LArCellDeadOTXCorrToolDefault theLArCellDeadOTXCorr = LArCellDeadOTXCorrToolDefault() except Exception: mlog.error("could not get handle to LArCellDeadOTXCorr Quit") print(traceback.format_exc()) theCaloCellMaker += theLArCellDeadOTXCorr theCaloCellMaker.CaloCellMakerToolNames += [theLArCellDeadOTXCorr] # make lots of checks (should not be necessary eventually) # to print the check add: from CaloRec.CaloRecConf import CaloCellContainerCheckerTool theCaloCellContainerCheckerTool = CaloCellContainerCheckerTool() # FIXME # theCaloCellContainerCheckerTool.OutputLevel=DEBUG theCaloCellMaker += theCaloCellContainerCheckerTool theCaloCellMaker.CaloCellMakerToolNames += [ theCaloCellContainerCheckerTool ] # sets output key theCaloCellMaker.CaloCellsOutputName = self.outputKey() # register output in objKeyStore from RecExConfig.ObjKeyStore import objKeyStore objKeyStore.addStreamESD(self.outputType(), self.outputKey()) # Also note that we produce it as a transient output. objKeyStore.addTransient(self.outputType(), self.outputKey()) from TileRecUtils.TileDQstatusAlgDefault import TileDQstatusAlgDefault TileDQstatusAlgDefault() # now add algorithm to topSequence # this should always come at the end mlog.info(" now adding CaloCellMaker to topSequence") from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() topSequence += theCaloCellMaker return True
def LArDigitMonConfigCore(helper, algoinstance, inputFlags): from LArMonitoring.GlobalVariables import lArDQGlobals larDigitMonAlg = helper.addAlgorithm(algoinstance, 'larDigitMonAlg') summaryGroupName = "Summary" nslots = [] for i in range(0, len(lArDQGlobals.FEB_Slot)): nslots.append(lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[i]][1]) larDigitMonAlg.SummaryMonGroup = summaryGroupName larDigitMonAlg.LArDigitsSubDetNames = lArDQGlobals.SubDet larDigitMonAlg.LArDigitsPartitionNames = lArDQGlobals.Partitions larDigitMonAlg.LArDigitsNslots = nslots # adding BadChan masker private tool from AthenaConfiguration.ComponentFactory import isRun3Cfg if isRun3Cfg(): from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator cfg = ComponentAccumulator() from LArBadChannelTool.LArBadChannelConfig import LArBadChannelMaskerCfg acc = LArBadChannelMaskerCfg(inputFlags, problemsToMask=[ "highNoiseHG", "highNoiseMG", "highNoiseLG", "deadReadout", "deadPhys" ], ToolName="BadLArRawChannelMask") larDigitMonAlg.LArBadChannelMask = acc.popPrivateTools() cfg.merge(acc) else: from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArBadChannelsMasker = LArBadChannelMasker("BadLArRawChannelMask") theLArBadChannelsMasker.DoMasking = True theLArBadChannelsMasker.ProblemsToMask = [ "deadReadout", "deadPhys", "short", "almostDead", "highNoiseHG", "highNoiseMG", "highNoiseLG", "sporadicBurstNoise" ] larDigitMonAlg.LArBadChannelMask = theLArBadChannelsMasker summaryGroup = helper.addGroup(larDigitMonAlg, summaryGroupName, '/LAr/DigitsNewAlg') summary_hist_path = summaryGroupName + '/' summaryGroup.defineHistogram('sumbin,partition;Summary', title='Gain', type='TH2F', path=summary_hist_path, weight='weight', xbins=lArDQGlobals.N_DigitsSummary, xmin=-0.5, xmax=lArDQGlobals.N_DigitsSummary - 0.5, ybins=lArDQGlobals.N_Partitions, ymin=-0.5, ymax=lArDQGlobals.N_Partitions - 0.5, xlabels=lArDQGlobals.DigitsSummary, ylabels=lArDQGlobals.Partitions) summaryGroup.defineHistogram('gain,partition;summaryGain', title='Gain', type='TH2F', path=summary_hist_path, weight='weight', xbins=lArDQGlobals.N_Gains, xmin=-0.5, xmax=lArDQGlobals.N_Gains - 0.5, ybins=lArDQGlobals.N_Partitions, ymin=-0.5, ymax=lArDQGlobals.N_Partitions - 0.5, xlabels=lArDQGlobals.Gains, ylabels=lArDQGlobals.Partitions) # now individual partitions, because we need a different directories, will have only 2dim arrays (side) for subdet in range(0, lArDQGlobals.N_SubDet): array = helper.addArray( [lArDQGlobals.Partitions[2 * subdet:2 * subdet + 2]], larDigitMonAlg, lArDQGlobals.SubDet[subdet]) hist_path = '/LAr/DigitsNewAlg/' + lArDQGlobals.SubDet[subdet] + '/' slot_low = lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[subdet * 2]][0] - 0.5 slot_up = lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[subdet * 2]][1] + 0.5 slot_n = int(slot_up - slot_low) ft_low = lArDQGlobals.FEB_Feedthrough[lArDQGlobals.Partitions[ subdet * 2]][0] - 0.5 ft_up = lArDQGlobals.FEB_Feedthrough[lArDQGlobals.Partitions[ subdet * 2]][1] + 0.5 ft_n = int(ft_up - ft_low) chan_n = lArDQGlobals.FEB_N_channels chan_low = lArDQGlobals.FEB_channels_Min chan_up = lArDQGlobals.FEB_channels_Max crates_n = lArDQGlobals.FEB_Crates[lArDQGlobals.Partitions[subdet * 2]][1] crates_low = 0.5 crates_up = lArDQGlobals.FEB_Crates[lArDQGlobals.Partitions[ subdet * 2]][1] + 0.5 array.defineHistogram('Outslot,OutFT;tOutOfRange', title='% chan/FEB/events with max out of ', type='TH2I', path=hist_path, weight='weight', xbins=int(slot_n), xmin=slot_low, xmax=slot_up, ybins=int(ft_n), ymin=ft_low, ymax=ft_up) array.defineHistogram('Outslot,OutFT,Outweight;OutOfRange', title='% chan/FEB/events with max out of ', type='TProfile2D', path=hist_path, xbins=int(slot_n), xmin=slot_low, xmax=slot_up, ybins=int(ft_n), ymin=ft_low, ymax=ft_up) array.defineHistogram('Outcrate,Outchan;OutOfRangeChan', title='% chan/FEB/events with max out of ', type='TH2I', path=hist_path, weight='weight', xbins=crates_n, xmin=crates_low, xmax=crates_up, ybins=chan_n, ymin=chan_low, ymax=chan_up) array.defineHistogram('Saturslot,SaturFT;tSaturation', title='% chan/FEB/events with max=4095 ADC ', type='TH2I', path=hist_path, weight='weight', xbins=int(slot_n), xmin=slot_low, xmax=slot_up, ybins=int(ft_n), ymin=ft_low, ymax=ft_up) array.defineHistogram('Saturslot,SaturFT,Saturweight;Saturation', title='% chan/FEB/events with max=4095 ADC ', type='TProfile2D', path=hist_path, xbins=int(slot_n), xmin=slot_low, xmax=slot_up, ybins=int(ft_n), ymin=ft_low, ymax=ft_up) array.defineHistogram( 'Saturcrate,Saturchan;SaturationChan', title= '% chan/FEB/events with max=4095 ADC - Med/High Gain - All Stream', type='TH2I', path=hist_path, weight='Saturweight', xbins=crates_n, xmin=crates_low, xmax=crates_up, ybins=chan_n, ymin=chan_low, ymax=chan_up) array.defineHistogram('SaturLowslot,SaturLowFT;tSaturationLow', title='% chan/FEB/events with max=4095 ADC ', type='TH2I', path=hist_path, xbins=int(slot_n), xmin=slot_low, xmax=slot_up, ybins=int(ft_n), ymin=ft_low, ymax=ft_up) array.defineHistogram( 'SaturLowslot,SaturLowFT,SaturLowweight;SaturationLow', title='% chan/FEB/events with max=4095 ADC ', type='TProfile2D', path=hist_path, xbins=int(slot_n), xmin=slot_low, xmax=slot_up, ybins=int(ft_n), ymin=ft_low, ymax=ft_up) array.defineHistogram( 'SaturLowcrate,SaturLowchan;SaturationChanLow', title='% chan/FEB/events with max=4095 ADC - Low Gain - All Stream', type='TH2I', path=hist_path, weight='SaturLowweight', xbins=crates_n, xmin=crates_low, xmax=crates_up, ybins=chan_n, ymin=chan_low, ymax=chan_up) array.defineHistogram('Nullslot,NullFT;tNullDigit', title='% chan/FEB/events with min=0 ADC ', type='TH2I', path=hist_path, weight='weight', xbins=int(slot_n), xmin=slot_low, xmax=slot_up, ybins=int(ft_n), ymin=ft_low, ymax=ft_up) array.defineHistogram('Nullslot,NullFT,Nullweight;NullDigit', title='% chan/FEB/events with min=0 ADC ', type='TProfile2D', path=hist_path, xbins=int(slot_n), xmin=slot_low, xmax=slot_up, ybins=int(ft_n), ymin=ft_low, ymax=ft_up) array.defineHistogram( 'Nullcrate,Nullchan;NullDigitChan', title='% chan/FEB/events with min=0 ADC - All Gain - All Stream', type='TH2I', path=hist_path, xbins=crates_n, xmin=crates_low, xmax=crates_up, ybins=chan_n, ymin=chan_low, ymax=chan_up) array.defineHistogram('slot,FT,MaxPos;AvePosMaxDig', title='Average position of Max Digit ', type='TProfile2D', path=hist_path, xbins=int(slot_n), xmin=slot_low, xmax=slot_up, ybins=int(ft_n), ymin=ft_low, ymax=ft_up) array.defineHistogram('LBN,MaxPos;MaxVsTime', title='Average Max Sample vs LumiBlock ', type='TProfile', path=hist_path, xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max) array.defineHistogram('MaxPos,Energy;EnVsTime', title='Energy vs max sample ', type='TH2F', path=hist_path, xbins=lArDQGlobals.Samples_Bins, xmin=lArDQGlobals.Samples_Min, xmax=lArDQGlobals.Samples_Max, ybins=lArDQGlobals.Energy_Bins, ymin=lArDQGlobals.Energy_Min, ymax=lArDQGlobals.Energy_Max) array.defineHistogram( 'l1trig,MaxPos;TriggerWord', title='Position of max sample per L1 trigger word (8 bits) ', type='TProfile', path=hist_path, xbins=lArDQGlobals.L1Trig_Bins, xmin=lArDQGlobals.L1Trig_Min, xmax=lArDQGlobals.L1Trig_Max) array.defineHistogram('Sample,SignalNorm;SignShape', title='Normalized Signal Shape ', type='TProfile', weight='weight', path=hist_path, xbins=lArDQGlobals.Samples_Bins, xmin=lArDQGlobals.Samples_Min, xmax=lArDQGlobals.Samples_Max) if isRun3Cfg(): cfg.merge(helper.result()) return cfg else: return helper.result()
NoiseCorr.NoiseE = NoiseE ToolSvc += NoiseCorr from AthenaServices.AthenaServicesConf import AtRanluxGenSvc ServiceMgr += AtRanluxGenSvc() ServiceMgr.AtRanluxGenSvc.Seeds = ["TB_NOISE " + NoiseSeed] theNoiseCorrTool = CaloCellContainerCorrectorTool("CellNoise") theNoiseCorrTool.CellCorrectionToolNames = [NoiseCorr] ToolSvc += theNoiseCorrTool CaloCellMaker.CaloCellMakerToolNames += [theNoiseCorrTool] if doMask: from LArCellRec.LArCellRecConf import LArCellNoiseMaskingTool theLArCellMaskingTool = LArCellNoiseMaskingTool() from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArMasker = LArBadChannelMasker("LArMasker") theLArMasker.DoMasking = True theLArMasker.ProblemsToMask = [ "highNoiseHG", "highNoiseMG", "highNoiseLG", "deadReadout", "deadPhys" ] ToolSvc += theLArMasker theLArCellMaskingTool.MaskingTool = theLArMasker theLArCellMaskingTool.maskNoise = doMask theLArCellMaskingTool.maskSporadic = False ToolSvc += theLArCellMaskingTool CaloCellMaker.CaloCellMakerToolNames += [theLArCellMaskingTool] topSequence += CaloCellMaker if not doUseRampBuilder:
svcMgr.ProxyProviderSvc.ProviderNames += ["CondProxyProvider"] svcMgr += getConfigurable("CondProxyProvider")() svcMgr.CondProxyProvider.InputCollections += PoolFileList ########################################################################### # # Predict physics waveforms from Cali/Master waveforms # ########################################################################### from LArCalibUtils.LArCalibUtilsConf import LArPhysWavePredictor from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theMask = LArBadChannelMasker("BadChannelMask", DoMasking=True, ProblemsToMask=[ "deadCalib", "deadReadout", "deadPhys", "almostDead", "short" ]) ToolSvc += theMask LArPhysWavePredictor = LArPhysWavePredictor("LArPhysWavePredictor") LArPhysWavePredictor.MaskingTool = theMask LArPhysWavePredictor.TestMode = doTest LArPhysWavePredictor.isSC = SuperCells LArPhysWavePredictor.KeyCaliList = KeyCaliList LArPhysWavePredictor.UseCaliPulseParamsFromJO = UseCaliPulseParamsFromJO LArPhysWavePredictor.UseDetCellParamsFromJO = UseDetCellParamsFromJO LArPhysWavePredictor.UseTdriftFromJO = UseTdriftFromJO LArPhysWavePredictor.Tdrift = TdriftVector LArPhysWavePredictor.UseDoubleTriangle = UseDoubleTriangle LArPhysWavePredictor.Tdrift2 = TdriftVector2
from AthenaCommon.ConfigurableDb import getConfigurable svcMgr += getConfigurable("ProxyProviderSvc")() svcMgr.ProxyProviderSvc.ProviderNames += ["CondProxyProvider"] svcMgr += getConfigurable("CondProxyProvider")() svcMgr.CondProxyProvider.InputCollections += PoolFileList if (StripsXtalkCorr): from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker from LArCalibUtils.LArCalibUtilsConf import LArStripsCrossTalkCorrector theLArStripsCrossTalkCorrector = LArStripsCrossTalkCorrector() theLArStripsCrossTalkCorrector.KeyList = GainList theLArStripsCrossTalkCorrector.ADCsaturation = ADCsaturation theLArStripsCrossTalkCorrector.NoXtalkCorr = LArBadChannelMasker( "NoXtalkCorr", DoMasking=True, ProblemsToMask=["deadReadout", "deadPhys", "deadCalib", "almostDead"]) theLArStripsCrossTalkCorrector.DontUseForXtalkCorr = LArBadChannelMasker( "DontUseForXtalkCorr", DoMasking=True, ProblemsToMask=["short", "peculiarCalibrationLine", "deadReadout"]) theLArStripsCrossTalkCorrector.AcceptableDifference = 25.0 #in per-cent topSequence += theLArStripsCrossTalkCorrector #Bad-channel mask used by the LArRampBuilder and the Ramp-patcher from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArRCBMasker = LArBadChannelMasker("LArRCBMasker") theLArRCBMasker.DoMasking = True theLArRCBMasker.ProblemsToMask = [ "deadCalib", "deadReadout", "deadPhys", "almostDead", "short" ]
#conddb.setGlobalTag("COMCOND-006-01") #For id mapping folder="/LAR/Configuration/DSPGeoWeightsFlat" fileName="DSPGeoWeigths" from CaloTools.CaloNoiseFlags import jobproperties jobproperties.CaloNoiseFlags.FixedLuminosity.set_Value_and_Lock(1.45*30/8) from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() theCaloNoiseTool.OutputLevel=INFO ToolSvc+=theCaloNoiseTool from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArBadChannelMasker=LArBadChannelMasker("LArBadChannelMasker") theLArBadChannelMasker.DoMasking=True theLArBadChannelMasker.ProblemsToMask=[ "highNoiseHG","highNoiseMG","highNoiseLG" ] ## "deadReadout","deadPhys","deadCalib","short","almostDead", ToolSvc+=theLArBadChannelMasker from LArOnlDbPrep.LArOnlDbPrepConf import LArGeoWeightsFill theLArGeoWeightsFill=LArGeoWeightsFill() theLArGeoWeightsFill.OutFile="dumpFile.txt" theLArGeoWeightsFill.Key=folder theLArGeoWeightsFill.Fill=True theLArGeoWeightsFill.Dump=True
PoolSvc.ReadCatalog += ["prfile:poolcond/PoolCat_comcond_castor.xml"] theApp.EvtMax = 1 svcMgr.EventSelector.RunNumber = RunNumber from LArCalibUtils.LArCalibUtilsConf import LArCalibPatchingAlg_LArCaliWaveContainer_ theLArCaliWavePatcher = LArCalibPatchingAlg_LArCaliWaveContainer_( "LArCaliWavePatcher") theLArCaliWavePatcher.ContainerKey = "LArCaliWave" theLArCaliWavePatcher.NewContainerKey = "LArCaliWaveOut" theLArCaliWavePatcher.PatchMethod = "PhiNeighbor" theLArCaliWavePatcher.OutputLevel = DEBUG topSequence += theLArCaliWavePatcher from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArRCBMasker = LArBadChannelMasker("LArRCBMasker") theLArRCBMasker.DoMasking = True theLArRCBMasker.ProblemsToMask = [ "deadCalib", "deadReadout", "deadPhys", "almostDead", "short", ] ToolSvc += theLArRCBMasker theLArCaliWavePatcher.MaskingTool = theLArRCBMasker OutputObjectSpecCaliWave = "LArCaliWaveContainere#LArCaliWaveOut#" + Folder from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg theOutputConditionsAlg = OutputConditionsAlg(
def LArRODMonConfigCore(helper, algoinstance, inputFlags, cellDebug=False, dspDebug=False): larRODMonAlg = helper.addAlgorithm(algoinstance, 'larRODMonAlg') from LArMonitoring.GlobalVariables import lArDQGlobals GroupName = "RODMon" nslots = [] for i in range(0, len(lArDQGlobals.FEB_Slot)): nslots.append(lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[i]][1]) larRODMonAlg.MonGroup = GroupName larRODMonAlg.LArRODSubDetNames = lArDQGlobals.SubDet larRODMonAlg.LArRODPartitionNames = lArDQGlobals.Partitions larRODMonAlg.LArRODNslots = nslots #Adding 1MeV on request of Alexis (truncating difference) (May 2016): larRODMonAlg.PrecisionERange0 = 2 # MeV (Precision on E is on Eoff - Eonl) larRODMonAlg.PrecisionERange1 = 9 larRODMonAlg.PrecisionERange2 = 65 larRODMonAlg.PrecisionERange3 = 513 larRODMonAlg.PrecisionERangeMax = 8192 larRODMonAlg.ADCthreshold = 0 larRODMonAlg.peakTimeCut = 5. larRODMonAlg.SkipNullQT = True # for detailed debugging if cellDebug: larRODMonAlg.DoCellsDump = True if dspDebug: larRODMonAlg.DoDspTestDump = True #from AthenaCommon.Constants import VERBOSE #larRODMonAlg.OutputLevel=VERBOSE from AthenaConfiguration.ComponentFactory import isRun3Cfg if isRun3Cfg(): # adding BadChan masker private tool from LArBadChannelTool.LArBadChannelConfig import LArBadChannelMaskerCfg acc = LArBadChannelMaskerCfg(inputFlags, problemsToMask=[ "highNoiseHG", "highNoiseMG", "highNoiseLG", "deadReadout", "deadPhys", "almostDead", "short", "sporadicBurstNoise" ], ToolName="BadLArChannelMask") larRODMonAlg.LArBadChannelMask = acc.popPrivateTools() helper.resobj.merge(acc) else: from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArBadChannelsMasker = LArBadChannelMasker("BadLArRawChannelMask") theLArBadChannelsMasker.DoMasking = True theLArBadChannelsMasker.ProblemsToMask = [ "deadReadout", "deadPhys", "short", "almostDead", "highNoiseHG", "highNoiseMG", "highNoiseLG", "sporadicBurstNoise" ] larRODMonAlg.LArBadChannelMask = theLArBadChannelsMasker Group = helper.addGroup(larRODMonAlg, GroupName, '/LAr/DSPMonitoringNewAlg') #Summary histos summary_hist_path = 'Summary/' Group.defineHistogram( 'partition,gain;Summary_E', title='Summary of errors on Energy per partition and per gain', type='TH2F', path=summary_hist_path, weight='weight_e', xbins=lArDQGlobals.N_Partitions, xmin=-0.5, xmax=lArDQGlobals.N_Partitions - 0.5, ybins=lArDQGlobals.N_Gains, ymin=-0.5, ymax=lArDQGlobals.N_Gains - 0.5, xlabels=lArDQGlobals.Partitions, ylabels=lArDQGlobals.Gains) Group.defineHistogram( 'partition,gain;Summary_Q', title='Summary of errors on Quality per partition and per gain', type='TH2F', path=summary_hist_path, weight='weight_q', xbins=lArDQGlobals.N_Partitions, xmin=-0.5, xmax=lArDQGlobals.N_Partitions - 0.5, ybins=lArDQGlobals.N_Gains, ymin=-0.5, ymax=lArDQGlobals.N_Gains - 0.5, xlabels=lArDQGlobals.Partitions, ylabels=lArDQGlobals.Gains) Group.defineHistogram( 'partition,gain;Summary_T', title='Summary of errors on Time per partition and per gain', type='TH2F', path=summary_hist_path, weight='weight_t', xbins=lArDQGlobals.N_Partitions, xmin=-0.5, xmax=lArDQGlobals.N_Partitions - 0.5, ybins=lArDQGlobals.N_Gains, ymin=-0.5, ymax=lArDQGlobals.N_Gains - 0.5, xlabels=lArDQGlobals.Partitions, ylabels=lArDQGlobals.Gains) Group.defineHistogram( 'Ediff;E_all', title= 'E_offline - E_online for all partitions;E_offline - E_online (MeV)', type='TH1F', path=summary_hist_path, xbins=lArDQGlobals.DSPEnergy_Bins, xmin=lArDQGlobals.DSPEnergy_Min, xmax=lArDQGlobals.DSPEnergy_Max) Group.defineHistogram( 'Tdiff;T_all', title= 'T_offline - T_online for all partitions;T_offline - T_online (ps)', type='TH1F', path=summary_hist_path, xbins=lArDQGlobals.DSPTime_Bins, xmin=lArDQGlobals.DSPTime_Min, xmax=lArDQGlobals.DSPTime_Max) Group.defineHistogram( 'Qdiff;Q_all', title= 'Q_offline - Q_online / #sqrt{Q_offline} for all partitions;Q_offline - Q_online / sqrt{Q_offline} (ps)', type='TH1F', path=summary_hist_path, xbins=lArDQGlobals.DSPQuality_Bins, xmin=lArDQGlobals.DSPQuality_Min, xmax=lArDQGlobals.DSPQuality_Max) #Infos histos (vs. LB) info_hist_path = 'Infos/' cut = "#delta ADC>" + str( larRODMonAlg.ADCthreshold) + " and |t_offline| < " + str( larRODMonAlg.peakTimeCut) + " ns" Group.defineHistogram('LBN,partitionI;EErrorsPerLB', title='Nb of errors in E per LB - ' + cut + ':Luminosity Block:Partition', type='TH2I', weight='numE', path=info_hist_path, xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max, ybins=lArDQGlobals.N_Partitions, ymin=-0.5, ymax=lArDQGlobals.N_Partitions - 0.5, ylabels=lArDQGlobals.Partitions) Group.defineHistogram('LBN,partitionI;TErrorsPerLB', title='Nb of errors in T per LB - ' + cut + ':Luminosity Block:Partition', type='TH2I', weight='numT', path=info_hist_path, xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max, ybins=lArDQGlobals.N_Partitions, ymin=-0.5, ymax=lArDQGlobals.N_Partitions - 0.5, ylabels=lArDQGlobals.Partitions) Group.defineHistogram('LBN,partitionI;QErrorsPerLB', title='Nb of errors in Q per LB - ' + cut + ':Luminosity Block:Partition', type='TH2I', weight='numQ', path=info_hist_path, xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max, ybins=lArDQGlobals.N_Partitions, ymin=-0.5, ymax=lArDQGlobals.N_Partitions - 0.5, ylabels=lArDQGlobals.Partitions) #DQMD histos dqmd_hist_path = '/LAr/DSPMonitoringNewAlg/DQMD/' darray = helper.addArray([lArDQGlobals.Partitions], larRODMonAlg, "RODMon") darray.defineHistogram( 'Ediff,Erange;DE_ranges', title= 'EOnline - E_offline for all ranges : E_offline - E_online (MeV) : Energy range', #'E_online - E_offline for all ranges : E_offline - E_online (MeV) : Energy range', type='TH2F', path=dqmd_hist_path, xbins=lArDQGlobals.DSP1Energy_Bins, xmin=lArDQGlobals.DSP1Energy_Min, xmax=lArDQGlobals.DSP1Energy_Max, ybins=lArDQGlobals.DSPRanges_Bins, ymin=lArDQGlobals.DSPRanges_Min, ymax=lArDQGlobals.DSPRanges_Max, ylabels=lArDQGlobals.DSPRanges) Group.defineHistogram( 'Ediff,Erange;E_ranges_all', title= 'E_online - E_offline for all ranges : E_offline - E_online (MeV) : Energy range', type='TH2F', path=dqmd_hist_path, xbins=lArDQGlobals.DSP1Energy_Bins, xmin=lArDQGlobals.DSP1Energy_Min, xmax=lArDQGlobals.DSP1Energy_Max, ybins=lArDQGlobals.DSPRanges_Bins, ymin=lArDQGlobals.DSPRanges_Min, ymax=lArDQGlobals.DSPRanges_Max, ylabels=lArDQGlobals.DSPRanges) #per partition, currently in one dir only part_hist_path = '/LAr/DSPMonitoringNewAlg/perPartition/' darray.defineHistogram('Ediff;DE', title='E_offline - E_online:E_offline - E_online', type='TH1F', path=part_hist_path, xbins=lArDQGlobals.DSPEnergy_Bins, xmin=lArDQGlobals.DSPEnergy_Min, xmax=lArDQGlobals.DSPEnergy_Max) darray.defineHistogram('Tdiff;DT', title='T_offline - T_online:T_offline - T_online', type='TH1F', path=part_hist_path, xbins=lArDQGlobals.DSPTime_Bins, xmin=lArDQGlobals.DSPTime_Min, xmax=lArDQGlobals.DSPTime_Max) darray.defineHistogram( 'Qdiff;DG', title='Q_offline - Q_online:Q_offline - Q_online / #sqrtQ_offline', type='TH1F', path=part_hist_path, xbins=lArDQGlobals.DSPTime_Bins, xmin=lArDQGlobals.DSPTime_Min, xmax=lArDQGlobals.DSPTime_Max) darray.defineHistogram( 'slot,FT;Out_E_FT_vs_SLOT', title= '# of cells with E_offline - E_online > numerical precision : Slot : Feedthrough', type='TH2I', path=part_hist_path, weight='weight_e', xbins=lArDQGlobals.FEB_Slot["EMECA"][1], xmin=lArDQGlobals.FEB_Slot["EMECA"][0] - 0.5, xmax=lArDQGlobals.FEB_Slot["EMECA"][1] + 0.5, ybins=lArDQGlobals.FEB_Feedthrough["EMBA"][1] + 1, ymin=lArDQGlobals.FEB_Feedthrough["EMBA"][0] - 0.5, ymax=lArDQGlobals.FEB_Feedthrough["EMBA"][1] + 0.5) darray.defineHistogram( 'slot,FT;Out_T_FT_vs_SLOT', title= '# of cells with E_offline - E_online > numerical precision : Slot : Feedthrough', type='TH2I', path=part_hist_path, weight='weight_t', xbins=lArDQGlobals.FEB_Slot["EMECA"][1], xmin=lArDQGlobals.FEB_Slot["EMECA"][0] - 0.5, xmax=lArDQGlobals.FEB_Slot["EMECA"][1] + 0.5, ybins=lArDQGlobals.FEB_Feedthrough["EMBA"][1] + 1, ymin=lArDQGlobals.FEB_Feedthrough["EMBA"][0] - 0.5, ymax=lArDQGlobals.FEB_Feedthrough["EMBA"][1] + 0.5) darray.defineHistogram( 'slot,FT;Out_Q_FT_vs_SLOT', title= '# of cells with E_offline - E_online > numerical precision : Slot : Feedthrough', type='TH2I', path=part_hist_path, weight='weight_q', xbins=lArDQGlobals.FEB_Slot["EMECA"][1], xmin=lArDQGlobals.FEB_Slot["EMECA"][0] - 0.5, xmax=lArDQGlobals.FEB_Slot["EMECA"][1] + 0.5, ybins=lArDQGlobals.FEB_Feedthrough["EMBA"][1] + 1, ymin=lArDQGlobals.FEB_Feedthrough["EMBA"][0] - 0.5, ymax=lArDQGlobals.FEB_Feedthrough["EMBA"][1] + 0.5) darray.defineHistogram( 'Eoff,Eon;Eon_VS_Eoff', title='E_online VS E_offline:E_offline (MeV):E_online (MeV)', type='TH2F', path=part_hist_path, xbins=lArDQGlobals.DSPEonEoff_Bins, xmin=-lArDQGlobals.DSPEonEoff_Max, xmax=lArDQGlobals.DSPEonEoff_Max, ybins=lArDQGlobals.DSPEonEoff_Bins, ymin=-lArDQGlobals.DSPEonEoff_Max, ymax=lArDQGlobals.DSPEonEoff_Max) darray.defineHistogram( 'Toff,Ton;Ton_VS_Toff', title='T_online VS T_offline:T_offline (ps):T_online (ps)', type='TH2F', path=part_hist_path, xbins=lArDQGlobals.DSPTonToff_Bins, xmin=-lArDQGlobals.DSPTonToff_Max, xmax=lArDQGlobals.DSPTonToff_Max, ybins=lArDQGlobals.DSPTonToff_Bins, ymin=-lArDQGlobals.DSPTonToff_Max, ymax=lArDQGlobals.DSPTonToff_Max) darray.defineHistogram('Qoff,Qon;Qon_VS_Qoff', title='Q_online VS Q_offline:Q_offline :Q_online ', type='TH2F', path=part_hist_path, xbins=lArDQGlobals.DSPQonQoff_Bins, xmin=-lArDQGlobals.DSPQonQoff_Max, xmax=lArDQGlobals.DSPQonQoff_Max, ybins=lArDQGlobals.DSPQonQoff_Bins, ymin=-lArDQGlobals.DSPQonQoff_Max, ymax=lArDQGlobals.DSPQonQoff_Max) darray.defineHistogram( 'Sweetc;Sweet_cells', title='Number of sweet Cells in LAr:Sweet cells per feb', type='TH1F', path=part_hist_path, xbins=lArDQGlobals.FEB_N_channels, xmin=lArDQGlobals.FEB_channels_Min, xmax=lArDQGlobals.FEB_channels_Max)
topSequence += LArPedACBuilder ###################################################################### # # # Output # # # ###################################################################### from xAODEventInfoCnv.xAODEventInfoCreator import xAODMaker__EventInfoCnvAlg topSequence += xAODMaker__EventInfoCnvAlg() if (doLArCalibDataQuality): from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArPedValBCMask = LArBadChannelMasker("PedValBCMask", DoMasking=True, ProblemsToMask=[]) svcMgr.ToolSvc += theLArPedValBCMask theLArACValBCMask = LArBadChannelMasker("ACValBCMask", DoMasking=True, ProblemsToMask=[]) svcMgr.ToolSvc += theLArACValBCMask if Pedestal: from LArCalibDataQuality.Thresholds import pedThr, rmsThr, pedThrFEB, rmsThrFEB from LArCalibDataQuality.LArCalibDataQualityConf import LArPedestalValidationAlg thePedestalValidationAlg = LArPedestalValidationAlg("PedestalVal") thePedestalValidationAlg.BadChannelMaskingTool = theLArPedValBCMask thePedestalValidationAlg.ValidationKey = "Pedestal" thePedestalValidationAlg.ReferenceKey = "PedestalRef" thePedestalValidationAlg.PedestalTolerance = pedThr
def LArCosmicsMonConfigCore(helper, algoinstance,inputFlags): from LArMonitoring.GlobalVariables import lArDQGlobals larCosmicsMonAlg = helper.addAlgorithm(algoinstance,'larCosmicsMonAlg') larCosmicsMonAlg.CosmicsMonGroupName = 'LarCosmicsMonGroup' larCosmicsMonAlg.MuonADCthreshold_EM_barrel = 30 larCosmicsMonAlg.MuonADCthreshold_EM_endcap = 40 larCosmicsMonAlg.MuonADCthreshold_HEC = 40 larCosmicsMonAlg.MuonADCthreshold_FCAL = 40 # adding BadChan masker private tool from AthenaCommon.Configurable import Configurable if Configurable.configurableRun3Behavior : from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator cfg=ComponentAccumulator() from LArBadChannelTool.LArBadChannelConfig import LArBadChannelMaskerCfg acc= LArBadChannelMaskerCfg(inputFlags,problemsToMask=["highNoiseHG","highNoiseMG","highNoiseLG","deadReadout","deadPhys"],ToolName="BadLArRawChannelMask") larCosmicsMonAlg.LArBadChannelMask=acc.popPrivateTools() cfg.merge(acc) else : from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArBadChannelsMasker=LArBadChannelMasker("BadLArRawChannelMask") theLArBadChannelsMasker.DoMasking=True theLArBadChannelsMasker.ProblemsToMask=["deadReadout","deadPhys","short","almostDead","highNoiseHG","highNoiseMG","highNoiseLG","sporadicBurstNoise"] larCosmicsMonAlg.LArBadChannelMask=theLArBadChannelsMasker pass #mon group cosmicMonGroup = helper.addGroup( larCosmicsMonAlg, larCosmicsMonAlg.CosmicsMonGroupName, '/LAr/', 'run' ) cosmic_path="CosmicsNewAlg/" EM_bins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["2"]+lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["C"]["2"]+lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["A"]["2"]+lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["2"] cosmicMonGroup.defineHistogram('mon_eta_EM,mon_phi;Muon2DHitsECAL', type='TH2F', path=cosmic_path, title='Cosmics Seeds - Digit Max > '+str(int(larCosmicsMonAlg.MuonADCthreshold_EM_barrel))+'/'+str(int(larCosmicsMonAlg.MuonADCthreshold_EM_endcap))+' [ADC] in S2 Barrel/Endcap - EM;#eta cell;#phi cell;Number of Hits', xbins=EM_bins, ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["A"]["2"]) HEC_bins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["C"]["1"]+lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["A"]["1"] cosmicMonGroup.defineHistogram('mon_eta_HEC,mon_phi;Muon2DHitsHCAL', type='TH2F', path=cosmic_path, title='Cosmics Seeds - Digit Max > '+str(int(larCosmicsMonAlg.MuonADCthreshold_HEC))+' [ADC] in S1 HEC;#eta cell;#phi cell;Number of Hits', xbins=HEC_bins, ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["A"]["1"]) FCal_bins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["C"]["2"]+lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["A"]["2"] cosmicMonGroup.defineHistogram('mon_eta_FCal,mon_phi;Muon2DHitsFCAL', type='TH2F', path=cosmic_path, title='Cosmics Seeds - Digit Max > '+str(int(larCosmicsMonAlg.MuonADCthreshold_FCAL))+' [ADC] in S2 FCal;#eta cell;#phi cell;Number of Hits', xbins=FCal_bins, ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["A"]["2"])
def LArCoverageConfigCore(helper, algoinstance, inputFlags): larCoverageAlg = helper.addAlgorithm(algoinstance, 'LArCoverageAlg') # adding BadChan masker private tool from AthenaConfiguration.ComponentFactory import isRun3Cfg if isRun3Cfg(): from LArBadChannelTool.LArBadChannelConfig import LArBadChannelMaskerCfg #,LArBadChannelCfg acc = LArBadChannelMaskerCfg(inputFlags, problemsToMask=[ "highNoiseHG", "highNoiseMG", "highNoiseLG", "deadReadout", "deadPhys" ], ToolName="BadLArRawChannelMask") larCoverageAlg.LArBadChannelMask = acc.popPrivateTools() helper.resobj.merge(acc) else: from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArRCBMasker = LArBadChannelMasker("BadLArRawChannelMask") theLArRCBMasker.DoMasking = True theLArRCBMasker.ProblemsToMask = [ "deadReadout", "deadPhys", "highNoiseHG", "highNoiseMG", "highNoiseLG" ] larCoverageAlg.LArBadChannelMask = theLArRCBMasker from LArMonitoring.GlobalVariables import lArDQGlobals #define the group names here, as you'll use them multiple times caloNoiseToolGroupName = "CaloNoise" nLayers = 4 badChannelsGroupName = "BadChannels" coverageHWGroupName = "Coverage" partitionsBarrel = [ lArDQGlobals.SubDet[0] + side for side in lArDQGlobals.Sides ] partitionsEndcap = [ lArDQGlobals.SubDet[ip] + side for side in lArDQGlobals.Sides for ip in range(1, len(lArDQGlobals.SubDet)) ] # Edit properties of a algorithm larCoverageAlg.CaloNoiseToolGroupName = caloNoiseToolGroupName larCoverageAlg.Nsample = nLayers larCoverageAlg.BadChannelsGroupName = badChannelsGroupName larCoverageAlg.Sides = lArDQGlobals.Sides larCoverageAlg.CoverageHWGroupName = coverageHWGroupName larCoverageAlg.CoverageBarrelPartitions = partitionsBarrel larCoverageAlg.CoverageEndcapPartitions = partitionsEndcap larCoverageAlg.NphiBinsEMB1 = lArDQGlobals.Cell_Variables["phiNbin"][ "EMB"]["A"]["1"] larCoverageAlg.NphiBinsEMEC2 = lArDQGlobals.Cell_Variables["phiNbin"][ "EMEC"]["A"]["2"] larCoverageAlg.NphiBinsHEC = [ lArDQGlobals.Cell_Variables["phiNbin"]["HEC"]["A"]["0"], lArDQGlobals.Cell_Variables["phiNbin"]["HEC"]["A"]["1"], lArDQGlobals.Cell_Variables["phiNbin"]["HEC"]["A"]["2"], lArDQGlobals.Cell_Variables["phiNbin"]["HEC"]["A"]["3"] ] #Configure the CaloNoise from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg CaloNoiseCondAlg(noisetype="electronicNoise") #-- caloNoise groups -- caloNoiseToolArrayEM = helper.addArray([nLayers], larCoverageAlg, caloNoiseToolGroupName + "EM") caloNoiseToolArrayHEC = helper.addArray([nLayers], larCoverageAlg, caloNoiseToolGroupName + "HEC") caloNoiseToolArrayFCAL = helper.addArray([nLayers], larCoverageAlg, caloNoiseToolGroupName + "FCAL") caloNoiseToolGroup = helper.addGroup( #for the LB histogram larCoverageAlg, caloNoiseToolGroupName, '/LAr/', 'run') #-- badChannels groups -- badChannelToolArrayBarrel = helper.addArray( [lArDQGlobals.Sides], larCoverageAlg, badChannelsGroupName + "Barrel", '/LAr/', 'run') badChannelToolArrayEndcap = helper.addArray( [lArDQGlobals.Sides], larCoverageAlg, badChannelsGroupName + "EndCap", '/LAr/', 'run') #-- CoverageHW groups -- availErrCode = larCoverageAlg.AvailableErrorCodes #-- Coverage groups (eta-phi plots) -- coverageToolArrayEMBA = helper.addArray([availErrCode], larCoverageAlg, coverageHWGroupName + "EMBA", '/LAr/', 'run') coverageToolArrayEMECA = helper.addArray([availErrCode], larCoverageAlg, coverageHWGroupName + "EMECA", '/LAr/', 'run') coverageToolArrayHECA = helper.addArray([availErrCode], larCoverageAlg, coverageHWGroupName + "HECA", '/LAr/', 'run') coverageToolArrayFCalA = helper.addArray([availErrCode], larCoverageAlg, coverageHWGroupName + "FCalA", '/LAr/', 'run') coverageToolArrayEMBC = helper.addArray([availErrCode], larCoverageAlg, coverageHWGroupName + "EMBC", '/LAr/', 'run') coverageToolArrayEMECC = helper.addArray([availErrCode], larCoverageAlg, coverageHWGroupName + "EMECC", '/LAr/', 'run') coverageToolArrayHECC = helper.addArray([availErrCode], larCoverageAlg, coverageHWGroupName + "HECC", '/LAr/', 'run') coverageToolArrayFCalC = helper.addArray([availErrCode], larCoverageAlg, coverageHWGroupName + "FCalC", '/LAr/', 'run') ### Configure histograms coveragePath = 'CoverageNewAlg/' # -- caloNoiseTool histograms -- caloNoiseTool_path = coveragePath + 'CaloNoiseTool/' #LB histogram: need to know which LB the CaloNoiseTool histogram is about. Only add to caloNoiseToolGroup to avoid duplicates caloNoiseToolGroup.defineHistogram( 'lb1_x;FirstLBnumber', type='TH1D', path=caloNoiseTool_path, title='CaloNoiseTool histogram are filled from this LB;;LB number', weight='lb1', xbins=1, xmin=-1, xmax=1) caloNoiseToolArrayEM.defineHistogram('etaChan,noise;CaloNoiseEM_Sampling', type='TProfile', path='LAr/' + caloNoiseTool_path, title='DBNoise in EM', xbins=lArDQGlobals.etaCaloNoise_Bins, xmax=lArDQGlobals.etaCaloNoise_Max, xmin=lArDQGlobals.etaCaloNoise_Min) caloNoiseToolArrayHEC.defineHistogram( 'etaChan,noise;CaloNoiseHEC_Sampling', type='TProfile', path='LAr/' + caloNoiseTool_path, title='DBNoise in HEC', xbins=lArDQGlobals.etaCaloNoise_Bins, xmax=lArDQGlobals.etaCaloNoise_Max, xmin=lArDQGlobals.etaCaloNoise_Min) caloNoiseToolArrayFCAL.defineHistogram( 'etaChan,noise;CaloNoiseFCAL_Sampling', type='TProfile', path='LAr/' + caloNoiseTool_path, title='DBNoise in FCAL', xbins=lArDQGlobals.etaCaloNoise_FcalBins, xmax=lArDQGlobals.etaCaloNoise_FcalMax, xmin=lArDQGlobals.etaCaloNoise_FcalMin) # -- badChannels histograms -- badChannels_path = coveragePath + 'BadChannels/' badChannelToolArrayBarrel.defineHistogram( 'mon_FtSlot,single_channel;DBBadChannelsBarrel', type='TH2I', path=badChannels_path, title= 'Known Bad Channels - Barrel {0};Feedthrough(+Slot increasing);Channel', weight='flag', xbins=lArDQGlobals.Feedthrough_Slot_Nbins[ "EMBA"], #bins from A side also used for C, they're the same xmin=lArDQGlobals.Feedthrough_Slot_range["EMBA"][0], xmax=lArDQGlobals.Feedthrough_Slot_range["EMBA"][1], ybins=lArDQGlobals.FEB_N_channels, ymin=-0.5, ymax=lArDQGlobals.FEB_N_channels - 0.5, xlabels=lArDQGlobals.Feedthrough_Slot_labels_Barrel, merge='weightedAverage') badChannelToolArrayEndcap.defineHistogram( 'mon_FtSlot,single_channel;DBBadChannelsEndcap', type='TH2I', path=badChannels_path, title= 'Known Bad Channels - Endcap {0};Feedthrough(+Slot increasing);Channel', weight='flag', xbins=lArDQGlobals.Feedthrough_Slot_Nbins[ "EMECA"], #bins from A side also used for C, they're the same xmin=lArDQGlobals.Feedthrough_Slot_range["EMECA"][0], xmax=lArDQGlobals.Feedthrough_Slot_range["EMECA"][1], ybins=lArDQGlobals.FEB_N_channels, ymin=-0.5, ymax=lArDQGlobals.FEB_N_channels - 0.5, xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap, merge='weightedAverage') #--coverageHW histograms coverage_path = coveragePath + 'perPartition/' coverageToolArrayEMBA.defineHistogram( 'mon_ChanFtSlot,mon_Channels;CoverageHW_EMBA_statusCode', type='TH2I', path=coverage_path, title= 'Coverage - EMBA - statusCode={0};Feedthrough(+Slot increasing);Channel', xbins=lArDQGlobals.Feedthrough_Slot_Nbins["EMBA"], xmin=lArDQGlobals.Feedthrough_Slot_range["EMBA"][0], xmax=lArDQGlobals.Feedthrough_Slot_range["EMBA"][1], ybins=lArDQGlobals.FEB_N_channels, ymin=-0.5, ymax=lArDQGlobals.FEB_N_channels - 0.5, xlabels=lArDQGlobals.Feedthrough_Slot_labels_Barrel) coverageToolArrayEMBC.defineHistogram( 'mon_ChanFtSlot,mon_Channels;CoverageHW_EMBC_statusCode', type='TH2I', path=coverage_path, title= 'Coverage - EMBC - statusCode={0};Feedthrough(+Slot increasing);Channel', xbins=lArDQGlobals.Feedthrough_Slot_Nbins["EMBC"], xmin=lArDQGlobals.Feedthrough_Slot_range["EMBC"][0], xmax=lArDQGlobals.Feedthrough_Slot_range["EMBC"][1], ybins=lArDQGlobals.FEB_N_channels, ymin=-0.5, ymax=lArDQGlobals.FEB_N_channels - 0.5, xlabels=lArDQGlobals.Feedthrough_Slot_labels_Barrel) coverageToolArrayEMECA.defineHistogram( 'mon_ChanFtSlot,mon_Channels;CoverageHW_EMECA_statusCode', type='TH2I', path=coverage_path, title= 'Coverage - EMECA - statusCode={0};Feedthrough(+Slot increasing);Channel', xbins=lArDQGlobals.Feedthrough_Slot_Nbins["EMECA"], xmin=lArDQGlobals.Feedthrough_Slot_range["EMECA"][0], xmax=lArDQGlobals.Feedthrough_Slot_range["EMECA"][1], ybins=lArDQGlobals.FEB_N_channels, ymin=-0.5, ymax=lArDQGlobals.FEB_N_channels - 0.5, xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap) coverageToolArrayEMECC.defineHistogram( 'mon_ChanFtSlot,mon_Channels;CoverageHW_EMECA_statusCode', type='TH2I', path=coverage_path, title= 'Coverage - EMECC - statusCode={0};Feedthrough(+Slot increasing);Channel', xbins=lArDQGlobals.Feedthrough_Slot_Nbins["EMECC"], xmin=lArDQGlobals.Feedthrough_Slot_range["EMECC"][0], xmax=lArDQGlobals.Feedthrough_Slot_range["EMECC"][1], ybins=lArDQGlobals.FEB_N_channels, ymin=-0.5, ymax=lArDQGlobals.FEB_N_channels - 0.5, xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap) coverageToolArrayHECA.defineHistogram( 'mon_ChanFtSlot,mon_Channels;CoverageHW_HECA_statusCode', type='TH2I', path=coverage_path, title= 'Coverage - HECA - statusCode={0};Feedthrough(+Slot increasing);Channel', xbins=lArDQGlobals.Feedthrough_Slot_Nbins["HECA"], xmin=lArDQGlobals.Feedthrough_Slot_range["HECA"][0], xmax=lArDQGlobals.Feedthrough_Slot_range["HECA"][1], ybins=lArDQGlobals.FEB_N_channels, ymin=-0.5, ymax=lArDQGlobals.FEB_N_channels - 0.5, xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap) coverageToolArrayHECC.defineHistogram( 'mon_ChanFtSlot,mon_Channels;CoverageHW_HECA_statusCode', type='TH2I', path=coverage_path, title= 'Coverage - HECC - statusCode={0};Feedthrough(+Slot increasing);Channel', xbins=lArDQGlobals.Feedthrough_Slot_Nbins["HECC"], xmin=lArDQGlobals.Feedthrough_Slot_range["HECC"][0], xmax=lArDQGlobals.Feedthrough_Slot_range["HECC"][1], ybins=lArDQGlobals.FEB_N_channels, ymin=-0.5, ymax=lArDQGlobals.FEB_N_channels - 0.5, xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap) coverageToolArrayFCalA.defineHistogram( 'mon_ChanFtSlot,mon_Channels;CoverageHW_FCalA_statusCode', type='TH2I', path=coverage_path, title= 'Coverage - FCalA - statusCode={0};Feedthrough(+Slot increasing);Channel', xbins=lArDQGlobals.Feedthrough_Slot_Nbins["FCalA"], xmin=lArDQGlobals.Feedthrough_Slot_range["FCalA"][0], xmax=lArDQGlobals.Feedthrough_Slot_range["FCalA"][1], ybins=lArDQGlobals.FEB_N_channels, ymin=-0.5, ymax=lArDQGlobals.FEB_N_channels - 0.5, xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap) coverageToolArrayFCalC.defineHistogram( 'mon_ChanFtSlot,mon_Channels;CoverageHW_FCalC_statusCode', type='TH2I', path=coverage_path, title= 'Coverage - FCalC - statusCode={0};Feedthrough(+Slot increasing);Channel', xbins=lArDQGlobals.Feedthrough_Slot_Nbins["FCalC"], xmin=lArDQGlobals.Feedthrough_Slot_range["FCalC"][0], xmax=lArDQGlobals.Feedthrough_Slot_range["FCalC"][1], ybins=lArDQGlobals.FEB_N_channels, ymin=-0.5, ymax=lArDQGlobals.FEB_N_channels - 0.5, xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap) coverageToolArrayEMBA.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling0EMBA_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 0 - EMBA;#eta;#phi', cutmask='isSampl0', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["A"]["0"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["A"]["0"]) coverageToolArrayEMBA.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling1EMBA_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 1 - EMBA;#eta;#phi', cutmask='isSampl1', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["A"]["1"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["A"]["1"]) coverageToolArrayEMBA.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling2EMBA_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 2 - EMBA;#eta;#phi', cutmask='isSampl2', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["A"]["2"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["A"]["2"]) coverageToolArrayEMBA.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling3EMBA_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 3 - EMBA;#eta;#phi', cutmask='isSampl3', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["A"]["3"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["A"]["3"]) coverageToolArrayEMBC.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling0EMBC_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 0 - EMBC;#eta;#phi', cutmask='isSampl0', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["C"]["0"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["C"]["0"]) coverageToolArrayEMBC.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling1EMBC_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 1 - EMBC;#eta;#phi', cutmask='isSampl1', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["C"]["1"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["C"]["1"]) coverageToolArrayEMBC.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling2EMBC_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 2 - EMBC;#eta;#phi', cutmask='isSampl2', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["C"]["2"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["C"]["2"]) coverageToolArrayEMBC.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling3EMBC_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 3 - EMBC;#eta;#phi', cutmask='isSampl3', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["C"]["3"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["C"]["3"]) coverageToolArrayEMECA.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling0EMECA_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 0 - EMECA;#eta;#phi', cutmask='isSampl0', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["0"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["0"]) coverageToolArrayEMECA.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling1EMECA_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 1 - EMECA;#eta;#phi', cutmask='isSampl1', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["1"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["1"]) coverageToolArrayEMECA.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling2EMECA_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 2 - EMECA;#eta;#phi', cutmask='isSampl2', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["2"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["2"]) coverageToolArrayEMECA.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling3EMECA_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 3 - EMECA;#eta;#phi', cutmask='isSampl3', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["3"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["3"]) coverageToolArrayEMECC.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling0EMECC_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 0 - EMECC;#eta;#phi', cutmask='isSampl0', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["0"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["0"]) coverageToolArrayEMECC.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling1EMECC_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 1 - EMECC;#eta;#phi', cutmask='isSampl1', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["1"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["1"]) coverageToolArrayEMECC.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling2EMECC_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 2 - EMECC;#eta;#phi', cutmask='isSampl2', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["2"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["2"]) coverageToolArrayEMECC.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling3EMECC_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 3 - EMECC;#eta;#phi', cutmask='isSampl3', xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["3"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["3"]) coverageToolArrayHECA.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling0HECA_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 0 - HECA;#eta;#phi', cutmask='isSampl0', xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["A"]["0"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["A"]["0"]) coverageToolArrayHECA.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling1HECA_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 1 - HECA;#eta;#phi', cutmask='isSampl1', xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["A"]["1"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["A"]["1"]) coverageToolArrayHECA.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling2HECA_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 2 - HECA;#eta;#phi', cutmask='isSampl2', xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["A"]["2"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["A"]["2"]) coverageToolArrayHECA.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling3HECA_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 3 - HECA;#eta;#phi', cutmask='isSampl3', xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["A"]["3"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["A"]["3"]) coverageToolArrayHECC.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling0HECC_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 0 - HECC;#eta;#phi', cutmask='isSampl0', xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["C"]["0"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["C"]["0"]) coverageToolArrayHECC.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling1HECC_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 1 - HECC;#eta;#phi', cutmask='isSampl1', xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["C"]["1"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["C"]["1"]) coverageToolArrayHECC.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling2HECC_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 2 - HECC;#eta;#phi', cutmask='isSampl2', xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["C"]["2"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["C"]["2"]) coverageToolArrayHECC.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling3HECC_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 3 - HECC;#eta;#phi', cutmask='isSampl3', xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["C"]["3"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["C"]["3"]) coverageToolArrayFCalA.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling1FCalA_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 1 - FCalA;#eta;#phi', cutmask='isSampl1', xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["A"]["1"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["A"]["1"]) coverageToolArrayFCalA.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling2FCalA_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 2 - FCalA;#eta;#phi', cutmask='isSampl2', xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["A"]["2"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["A"]["2"]) coverageToolArrayFCalA.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling3FCalA_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 3 - FCalA;#eta;#phi', cutmask='isSampl3', xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["A"]["3"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["A"]["3"]) coverageToolArrayFCalC.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling1FCalC_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 1 - FCalC;#eta;#phi', cutmask='isSampl1', xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["C"]["1"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["C"]["1"]) coverageToolArrayFCalC.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling2FCalC_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 2 - FCalC;#eta;#phi', cutmask='isSampl2', xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["C"]["2"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["C"]["2"]) coverageToolArrayFCalC.defineHistogram( 'mon_Eta,mon_Phi;CoverSampling3FCalC_StatusCode', type='TH2I', path=coverage_path, title='Coverage status code={0} - Sampling 3 - FCalC;#eta;#phi', cutmask='isSampl3', xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["C"]["3"], ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["C"]["3"])
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)
# LArCellVecMon_jobOpt.py R. Kehoe 07/03/06 from CaloMonitoring.CaloMonitoringConf import LArCellMonTool from RecExConfig.RecFlags import rec from AthenaMonitoring.DQMonFlags import DQMonFlags from AthenaCommon.GlobalFlags import globalflags from AthenaMonitoring.BadLBFilterTool import GetLArBadLBFilterTool from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArChanMasker = LArBadChannelMasker("LArChanMasker") theLArChanMasker.DoMasking = True theLArChanMasker.ProblemsToMask = [ "deadReadout", "deadPhys", "short", "sporadicBurstNoise", "highNoiseHG", "highNoiseMG", "highNoiseLG" ] ToolSvc += theLArChanMasker from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool theLArBadChannelTool = LArBadChanTool() ToolSvc += theLArBadChannelTool LArCellMon = LArCellMonTool( name="LArCellMonCosmics", CaloCellContainer="AllCalo",
def LArCellMonConfigCore(helper, algclass, inputFlags, isCosmics=False, isMC=False, algname='LArCellMonAlg'): LArCellMonAlg = helper.addAlgorithm(algclass, algname) if isCosmics: badChanMaskProblems=["deadReadout","deadPhys","short","sporadicBurstNoise","highNoiseHG","highNoiseMG","highNoiseLG"] else: badChanMaskProblems=["deadReadout","deadPhys","almostDead","short","sporadicBurstNoise","unstableNoiseLG","unstableNoiseMG","unstableNoiseHG","highNoiseHG","highNoiseMG","highNoiseLG"] from AthenaConfiguration.ComponentFactory import isRun3Cfg if isRun3Cfg(): from LArBadChannelTool.LArBadChannelConfig import LArBadChannelMaskerCfg acc= LArBadChannelMaskerCfg(inputFlags,problemsToMask=badChanMaskProblems,ToolName="BadLArRawChannelMask") LArCellMonAlg.LArBadChannelMask=acc.popPrivateTools() helper.resobj.merge(acc) else: from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArBadChannelsMasker=LArBadChannelMasker("BadLArRawChannelMask") theLArBadChannelsMasker.DoMasking=True theLArBadChannelsMasker.ProblemsToMask=badChanMaskProblems LArCellMonAlg.LArBadChannelMask=theLArBadChannelsMasker if not isCosmics and not isMC: LArCellMonAlg.useReadyFilterTool=True else: LArCellMonAlg.useReadyFilterTool=False if isMC: LArCellMonAlg.useBadLBTool=False else: LArCellMonAlg.useBadLBTool=True # FIXME: to be added: if isCosmics or rec.triggerStream()!='CosmicCalo': LArCellMonAlg.useBeamBackgroundRemoval = False # FIXME: to be added: else: # FIXME: to be added: LArCellMonAlg.useBeamBackgroundRemoval = True GroupName="LArCellMon" LArCellMonAlg.MonGroupName = GroupName LArCellMonAlg.MonGroupName_perJob = GroupName+"PerJob" LArCellMonAlg.MonGroupName_OccupancyEtaPhi = GroupName+"_OccupancyEtaPhi" LArCellMonAlg.MonGroupName_PercentageOccupancyEtaPhi = GroupName+"_PercentageOccupancyEtaPhi" LArCellMonAlg.MonGroupName_OccupancyEta = GroupName+"_OccupancyEta" LArCellMonAlg.MonGroupName_OccupancyPhi = GroupName+"_OccupancyPhi" LArCellMonAlg.MonGroupName_TotEnergyEtaPhi = GroupName+"_TotEnergyEtaPhi" LArCellMonAlg.MonGroupName_AvgQualityEtaPhi = GroupName+"_AvgQualityEtaPhi" LArCellMonAlg.MonGroupName_FractionOverQthEtaPhi = GroupName+"_FractionOverQthEtaPhi" LArCellMonAlg.MonGroupName_AvgTimeEtaPhi = GroupName+"_AvgTimeEtaPhi" LArCellMonAlg.MonGroupName_FractionPastTthEtaPhi = GroupName+"_FractionPastTthEtaPhi" LArCellMonAlg.EnableLumi = True LArCellMonAlg.Sporadic_switch = isCosmics LArCellMonAlg.Threshold_EM_S0S1=5000. LArCellMonAlg.Threshold_HECFCALEMS2S3=15000. from CaloMonitoring.LArCellBinning import lArCellBinningScheme binlabels=["TotalEvents","ATLAS Ready","with Good LAr LB","with No LAr Collision","with No Beam Background", "with No Trigger Filter","with No LArError"] # Global Settings: # All 2D plot occupancy are activate only for express and cosmiccalo #FIXME to be added if (isCosmics or rec.triggerStream()=='CosmicCalo' or rec.triggerStream()=='express' or rec.triggerStream()=='Main' or rec.triggerStream()<=='ZeroBias') or (inputFlags.Common.isOnline): #FIXME to be added do2DOcc = True #FIXME to be added else: #FIXME to be added do2DOcc = False do2DOcc = True #TMP thresholdDict = {} thresholdDict["ThresholdType"] = [ "noEth_CSCveto", "noEth_rndm_CSCveto", "medEth_CSCveto", "5Sigma_CSCveto", "hiEth_CSCveto", "hiEth_noVeto", "met_CSCveto" ] thresholdDict["ThresholdDirection"] = [ "none" , "none" , "both" , "both" , "over" , "over" , "over" ] thresholdDict["TriggersToInclude"] = [ "all" , "all" , "all" , "all" , "all" , "all" , "met" ] thresholdDict["TriggersToExclude"] = [ "none" , "none" , "none" , "none" , "none" , "none" , "none" ] thresholdDict["DoPercentageOccupancy"] = [ True , False , True , False , False , False , False ] thresholdDict["DoEtaPhiOccupancy"] = [ True , False , False , do2DOcc,do2DOcc, do2DOcc , False ] thresholdDict["DoEtaOccupancy"] = [ False , False , isCosmics , False , False , False , False ] thresholdDict["DoPhiOccupancy"] = [ False , False , True , False , False , False , False ] thresholdDict["DoEtaPhiAverageEnergy"] = [ False , do2DOcc , False , do2DOcc , False , False , False ] thresholdDict["DoEtaPhiTotalEnergy"] = [ False , False , False , False , False , False , False ] thresholdDict["DoEtaPhiEnergyRMS"] = [ False , False , False , False , False , False , False ] thresholdDict["DoEtaPhiRMSvsDBnoise"] = [ False , False , False , False , False , False , False ] thresholdDict["DoEtaPhiAverageQuality"] = [ False , False , False , False , False , False , False ] thresholdDict["DoEtaPhiFractionOverQth"]= [ False , False , False , False , do2DOcc , do2DOcc , False ] thresholdDict["QualityFactorThreshold"] = [ 4000. ]*7 thresholdDict["DoEtaPhiAverageTime"] = [ False , False , False , (not isCosmics) , False , False , False ] thresholdDict["DoEtaPhiFractionPastTth"]= [ False , False , False , (not isCosmics) , False , False , False ] thresholdDict["TimeThreshold"] = [ 4. ]*7 thresholdDict["ThresholdTitleTemplates"]= ["no Threshold", "no Threshold", "|E_{cell}| > %0.f#sigma_{noise}^{database}", "E_{cell} beyond %0.f#sigma_{noise}^{database}", "E_{cell} > %0.f MeV", "E_{cell} > %0.f MeV", "E_{cell} > %0.f MeV, MET trigger"] thresholdDict["DefaultThresholds"] = [-4000000.,-4000000. , 3. , 5. , 500. , 500. , 1000. ] thresholdDict["ThresholdinSigNoise"] = [ False , False , True , True , False , False , False ] #check that thresholds are set properly before passing them to the algorithm nthr = len(thresholdDict["ThresholdType"]) if not all(len(thrProp)==nthr for thrProp in thresholdDict.values()): from AthenaCommon.Logging import logging mlog = logging.getLogger( 'LArCellMonLog' ) mlog.error("LArCellMonAlg:: CONFIGURATION ERROR, threshold properties have different lenght. Please check CaloMonitoring/python/LArCellMonAlg.py") exit(1) pass LArCellMonAlg.ThresholdType = thresholdDict["ThresholdType"] LArCellMonAlg.ThresholdDirection = thresholdDict["ThresholdDirection"] LArCellMonAlg.TriggersToInclude = thresholdDict["TriggersToInclude"] LArCellMonAlg.TriggersToExclude = thresholdDict["TriggersToExclude"] LArCellMonAlg.QualityFactorThreshold = thresholdDict["QualityFactorThreshold"] LArCellMonAlg.TimeThreshold = thresholdDict["TimeThreshold"] LArCellMonAlg.DoBeamBackgroundRemoval=[( "CSCveto" in thr ) for thr in thresholdDict["ThresholdType"]] # Defaults: (Can be over ridden by layer specific values) ; plots will be made for all layers with DefaultThreshold != -9999999 LArCellMonAlg.ThresholdTitleTemplates= thresholdDict["ThresholdTitleTemplates"] LArCellMonAlg.DefaultThresholds = thresholdDict["DefaultThresholds"] LArCellMonAlg.ThresholdinSigNoise = thresholdDict["ThresholdinSigNoise"] LArCellMonAlg.ThresholdColumnType = ["hiEth_CSCveto", "hiEth_noVeto"] # EMB LArCellMonAlg.EMBP_Thresh = [ 800. , 800. ] LArCellMonAlg.EMB1_Thresh = [ 600. , 600. ] LArCellMonAlg.EMB2_Thresh = [ 600. , 600. ] LArCellMonAlg.EMB3_Thresh = [ 600. , 600. ] # EMEC LArCellMonAlg.EMECP_Thresh = [ 1200. , 1200. ] LArCellMonAlg.EMEC1_Thresh = [ 800. , 800. ] LArCellMonAlg.EMEC2_Thresh = [ 800. , 800. ] LArCellMonAlg.EMEC3_Thresh = [ 800. , 800. ] # HEC LArCellMonAlg.HEC0_Thresh = [ 4000. , 4000. ] LArCellMonAlg.HEC1_Thresh = [ 4000. , 4000. ] LArCellMonAlg.HEC2_Thresh = [ 4000. , 4000. ] LArCellMonAlg.HEC3_Thresh = [ 4000. , 4000. ] # FCAL LArCellMonAlg.FCAL1_Thresh = [ 6000. , 6000. ] LArCellMonAlg.FCAL2_Thresh = [ 6000. , 6000. ] LArCellMonAlg.FCAL3_Thresh = [ 6000. , 6000. ] #set the string arrays for the groups LArCellMonAlg.DoEtaPhiTotalOccupancyNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if ( thresholdDict["DoEtaPhiOccupancy"][i_thr] and not thresholdDict["DoPercentageOccupancy"][i_thr] ) or thresholdDict["DoEtaPhiAverageEnergy"][i_thr] or thresholdDict["DoEtaPhiAverageQuality"][i_thr] or thresholdDict["DoEtaPhiAverageTime"][i_thr]] LArCellMonAlg.DoEtaPhiPercentageOccupancyNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaPhiOccupancy"][i_thr] and thresholdDict["DoPercentageOccupancy"][i_thr]] LArCellMonAlg.DoEtaOccupancyNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaOccupancy"][i_thr]] LArCellMonAlg.DoPhiOccupancyNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoPhiOccupancy"][i_thr]] LArCellMonAlg.DoEtaPhiTotEnergyNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaPhiTotalEnergy"][i_thr] or thresholdDict["DoEtaPhiAverageEnergy"][i_thr]] LArCellMonAlg.DoEtaPhiAvgQualityNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaPhiAverageQuality"][i_thr]] LArCellMonAlg.DoEtaPhiFractionOverQthNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaPhiFractionOverQth"][i_thr]] LArCellMonAlg.DoEtaPhiAvgTimeNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaPhiAverageTime"][i_thr]] LArCellMonAlg.DoEtaPhiFractionPastTthNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaPhiFractionPastTth"][i_thr]] #---Groups and arrays #FIXME: need option to switch between weightedEfficiency and weightedAverage (depends on when the average is computed: if post-processing is done after merging, I don't want 'weightedMerge' options, otherwise I do. Not implemented for now) #---single Group for non threshold histograms cellMonGroup = helper.addGroup( LArCellMonAlg, GroupName, '/CaloMonitoring/LArCellMon_NoTrigSelNewAlg/' ) #--define histograms # Summary summ_hist_path='Summary/' from CaloMonitoring.CaloMonAlgBase import CaloBaseHistConfig CaloBaseHistConfig(cellMonGroup,summ_hist_path,binlabels) cellMonGroup.defineHistogram('trigType;nEvtsByTrigger', title='Total Events: bin 0, RNDM Trigger: 1, Calo Trigger: 2, MinBias Trigger: 3, MET Trigger: 4, Misc Trigger: 5, Events Selected for Noise Plots: 6 ', type='TH1I', path=summ_hist_path, xbins=lArCellBinningScheme.larCellSummary["xbins"][0], xmin=lArCellBinningScheme.larCellSummary["xbins"][1], xmax=lArCellBinningScheme.larCellSummary["xbins"][2], xlabels=lArCellBinningScheme.larCellSummary["xlabels"]) #total events, saved if percentage occupancy is required cellMonGroup.defineHistogram('eventCounter;nEvtsPerThreshold', title='Events events passed Trigger and Background removal for each threshold (for normalisation)', type='TH1I', path=summ_hist_path, xbins=len(thresholdDict["ThresholdType"]),xmin=-0.5, xmax=(len(thresholdDict["ThresholdType"])-0.5), xlabels=thresholdDict["ThresholdType"]) # En. LArCellMonAlg.doUnnormalized1DEnergy=True energy_hist_path='Energy/' if not isCosmics: for part in LArCellMonAlg.LayerNames: cellMonGroup.defineHistogram('cellEnergy_'+part+';CellEnergy_'+part, title='Cell Energy in ' +part+' with CSC veto;Cell Energy [MeV];Cell Events', type='TH1F', path=energy_hist_path, xbins=lArCellBinningScheme.logEnergyBins) pass elif isCosmics: for part in LArCellMonAlg.LayerNames: cellMonGroup.defineHistogram('cellEnergy_'+part+';CellEnergy_'+part, title='Cell Energy in ' +part+' with CSC veto;Cell Energy [MeV];Cell Events', type='TH1F', path=energy_hist_path, xbins=lArCellBinningScheme.cosmicEneBinning[part][0], xmin=lArCellBinningScheme.cosmicEneBinning[part][1], xmax=lArCellBinningScheme.cosmicEneBinning[part][2]) pass else: for part in LArCellMonAlg.LayerNames: cellMonGroup.defineHistogram('cellEnergy_'+part+';CellEnergy_'+part, title='Cell Energy in ' +part+' with CSC veto;Cell Energy [MeV];Cell Events', type='TH1F', path=energy_hist_path, xbins=lArCellBinningScheme.defaultEnergyBins[0],xmin=lArCellBinningScheme.defaultEnergyBins[1],xmax=lArCellBinningScheme.defaultEnergyBins[2]) pass #En vs. Time energyvstime_hist_path='EnergyVsTime/' # eCutForTiming = [1000., 1000., 3000., 1500., 3500., 3500., 3500., 3500., 1500., 3000., 3000., 2000., 10000., 10000., 10000.] eCutForTiming = LArCellMonAlg.EcutForTiming #taken from the values hardcoded in the .h, only way to prevent mixing everything up with the enum in the code idx=0 for part in LArCellMonAlg.LayerNames: cellMonGroup.defineHistogram('cellTime_'+part+',cellEnergy_'+part+';CellEnergyVsTime_'+part, title='Cell Energy vs Cell Time in '+part+' with CSC veto;Cell Time [ns];Cell Energy [MeV]', type='TH2F', path=energyvstime_hist_path, xbins=lArCellBinningScheme.timescale, ybins=lArCellBinningScheme.energyscale) cellMonGroup.defineHistogram('cellTime_'+part+'_cut;CellEnergyVsTime_'+part+'_'+str(eCutForTiming[idx//2]), title='Cell Energy vs Cell Time in '+part+' with CSC veto - Cell Time (E>'+str(eCutForTiming[idx//2])+' [MeV]);Cell Time [ns];Cell Energy [MeV]', weight='cellEnergy_'+part+'_cut', cutmask='enGreaterThanCut_'+part, type='TH1F', path=energyvstime_hist_path, xbins=lArCellBinningScheme.timescale) idx=idx+1 pass cellMonGroupPerJob = helper.addGroup( LArCellMonAlg, LArCellMonAlg.MonGroupName_perJob, '/CaloMonitoring/LArCellMon_NoTrigSelNewAlg/' ) LArCellMonAlg.doKnownBadChannelsVsEtaPhi = True LArCellMonAlg.doDatabaseNoiseVsEtaPhi = True for part in LArCellMonAlg.LayerNames: cellMonGroupPerJob.defineHistogram('celleta_'+part+',cellphi_'+part+';KnownBadChannelsVsEtaPhi_'+part, title="Map of known bad channels in (#eta,#phi) for "+part+";cell #eta;cell #phi", weight='badCellWord_'+part, cutmask='fillBadChannelPlot', type='TH2F', path="KnownBadChannels/", xbins = lArCellBinningScheme.etaRange[part], ybins = lArCellBinningScheme.phiRange[part], merge='weightedAverage' ) cellMonGroupPerJob.defineHistogram('celleta_'+part+',cellphi_'+part+';DatabaseNoiseVsEtaPhi_'+part, title="Map of Noise Values from the Database vs (#eta,#phi) for "+part+";cell #eta;cell #phi", weight='cellnoisedb_'+part, cutmask='doDatabaseNoisePlot', type='TH2F', path="DatabaseNoise/", xbins = lArCellBinningScheme.etaRange[part], ybins = lArCellBinningScheme.phiRange[part], merge='weightedAverage') cellMonGroupPerJob.defineHistogram('celleta_'+part+';NCellsActiveVsEta_'+part, title="No. of Active Cells in #eta for "+part+";cell #eta", cutmask='doCellsActiveEtaPlot', type='TH1F', path="ActiveCells/", xbins = lArCellBinningScheme.etaRange[part], merge='weightedAverage') cellMonGroupPerJob.defineHistogram('cellphi_'+part+';NCellsActiveVsPhi_'+part, title="No. of Active Cells in #phi for "+part+";cell #phi", cutmask='doCellsActivePhiPlot', type='TH1F', path="ActiveCells/", xbins = lArCellBinningScheme.phiRange[part], merge='weightedAverage') pass #part loop #--- group array for threshold dependent histograms allMonArray = helper.addArray([LArCellMonAlg.LayerNames, LArCellMonAlg.ThresholdType], LArCellMonAlg, "allMon", "/CaloMonitoring/LArCellMon_NoTrigSelNewAlg/") #now histograms for part in LArCellMonAlg.LayerNames: allMonArray.defineHistogram('dummy', type='TH1F', xbins=1, xmin=0, xmax=1) # dummy to have at least 1 plot defined allMonArray.defineHistogram('celleta,cellphi;CellOccupancyVsEtaPhi', title='No. of events in (#eta,#phi) for '+part+';cell #eta;cell #phi', type='TH2F', path="2d_Occupancy/", cutmask='passThrCut', xbins = lArCellBinningScheme.etaRange[part], ybins = lArCellBinningScheme.phiRange[part], pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiTotalOccupancyNames]) allMonArray.defineHistogram('passThrCut,celleta,cellphi;CellOccupancyFractionVsEtaPhi', title='Fraction of events in (#eta,#phi) for '+part+';cell #eta;cell #phi', type='TEfficiency', path="2d_Occupancy/", xbins = lArCellBinningScheme.etaRange[part], ybins = lArCellBinningScheme.phiRange[part], pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiPercentageOccupancyNames]) allMonArray.defineHistogram('celleta;CellOccupancyVsEta', #needs weightedAverage/weightedEff title='No. of events in (#eta) for '+part+';cell #eta;', type='TH1F', path="1d_Occupancy/", cutmask='passThrCut', xbins = lArCellBinningScheme.etaRange[part], pattern=[(part, _) for _ in LArCellMonAlg.DoEtaOccupancyNames]) allMonArray.defineHistogram('cellphi;CellOccupancyVsPhi', title='No. of events in (#phi) for '+part+';cell #phi;', type='TH1F', path="1d_Occupancy/", cutmask='passThrCut', xbins = lArCellBinningScheme.phiRange[part], pattern=[(part, _) for _ in LArCellMonAlg.DoPhiOccupancyNames]) allMonArray.defineHistogram('celleta,cellphi;TotalEnergyVsEtaPhi', title="Total Cell Energy vs (#eta,#phi) in "+part+";cell #eta;cell #phi", weight='cellEnergy', type='TH2F', path="2d_TotalEnergy/", cutmask='passThrCut', xbins = lArCellBinningScheme.etaRange[part], ybins = lArCellBinningScheme.phiRange[part], pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiTotEnergyNames]) allMonArray.defineHistogram('celleta,cellphi;TotalQualityVsEtaPhi', title="Cell Quality vs (#eta,#phi) in "+part+";cell #eta;cell #phi", weight='cellQuality', type='TH2F', path="2d_AvgQuality/", #needs to be divided by '2D_occupancy' at post processing stage cutmask='passThrCut', xbins = lArCellBinningScheme.etaRange[part], ybins = lArCellBinningScheme.phiRange[part], pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiAvgQualityNames]) allMonArray.defineHistogram('celleta,cellphi;TotalTimeVsEtaPhi', title="Cell Time vs (#eta,#phi) in "+part+";cell #eta;cell #phi", weight='cellTime', type='TH2F', path="2d_AvgTime/", #needs to be divided by '2D_occupancy' at post processing stage cutmask='passThrCut', xbins = lArCellBinningScheme.etaRange[part], ybins = lArCellBinningScheme.phiRange[part], pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiAvgTimeNames]) allMonArray.defineHistogram('celleta,cellphi;fractionOverQthVsEtaPhi', title="Fraction of Events in "+part+" for which the Quality Factor exceeds Threshold;cell #eta;cell #phi", weight='isPoorQuality', type='TH2F', path="2d_PoorQualityFraction/", # needs postprocessing cutmask='passThrCut', xbins = lArCellBinningScheme.etaRange[part], ybins = lArCellBinningScheme.phiRange[part], pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiFractionOverQthNames]) allMonArray.defineHistogram('celleta,cellphi;fractionPastTthVsEtaPhi', title="Fraction of Events in "+part+" for which the Time is further than Threshold;cell #eta;cell #phi", weight='isLateTime', type='TH2F', path="2d_FractionOutOfTime/", # needs postprocessing cutmask='passThrCut', xbins = lArCellBinningScheme.etaRange[part], ybins = lArCellBinningScheme.phiRange[part], pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiFractionPastTthNames]) pass #part loop for occupancy #-- TTree for sporadic if LArCellMonAlg.Sporadic_switch: sporadic_hist_path='/Sporadic_'+str(LArCellMonAlg.Threshold_EM_S0S1)+'*1e-3_'+str(LArCellMonAlg.Threshold_HECFCALEMS2S3)+'*1e-3GeV/' cellMonGroup.defineTree('sporadicCellE,sporadicCellTime,sporadicCellQuality,sporadicCellID,lumiBlock,adoptedEThreshold;SporadicNoisyCellsTree', path=sporadic_hist_path, treedef='sporadicCellE/F:sporadicCellTime/F:sporadicCellQuality/s:sporadicCellID/l:lumiBlock/i')
svcMgr.IOVDbSvc.GlobalTag = "COMCOND-ES1C-001-00" #Specify the input file(s) svcMgr.EventSelector.InputCollections = CafJobInputs[0] from LArROD.LArRODConf import LArRawChannelBuilderDriver theLArRawChannelBuilder = LArRawChannelBuilderDriver("LArRawChannelBuilder") theLArRawChannelBuilder.DataLocation = "LArDigitContainer_Thinned" topSequence += theLArRawChannelBuilder # The first tool filters out bad channels from LArROD.LArRODConf import LArRawChannelBuilderToolBadChannelTool theLArRawChannelBuilderToolBadChannel = LArRawChannelBuilderToolBadChannelTool( ) from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArRCBMasker = LArBadChannelMasker("LArRCBMasker") theLArRCBMasker.DoMasking = True theLArRCBMasker.ProblemsToMask = [ "deadReadout", "deadPhys", "almostDead", "short", "lowNoiseHG", "highNoiseHG", "unstableNoiseHG", "lowNoiseMG", "highNoiseMG", "unstableNoiseMG", "lowNoiseLG", "highNoiseLG", "unstableNoiseLG" ] ToolSvc += theLArRCBMasker from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool ToolSvc += LArBadChanTool() theLArRawChannelBuilderToolBadChannel.BadChannelMask = theLArRCBMasker theLArRawChannelBuilder.BuilderTools += [ theLArRawChannelBuilderToolBadChannel.getFullName() ] ToolSvc += theLArRawChannelBuilderToolBadChannel
def __init__(self, name='LArShapeDumper', digitsKey='FREE', noiseSignifCut=3, doStream=False, doShape=True, doTrigger=True, doOFCIter=True, prescale=1, triggerNames=triggersToCheck, caloType='EMHECFCAL', dumpChannelInfos=False, addToAlgSeq=True): super(LArShapeDumper, self).__init__(name) theDumperTool = DefaultShapeDumperTool(doShape=doShape) self.LArShapeDumperTool = theDumperTool if doStream: from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream StreamLArSamples = AthenaPoolOutputStream('StreamLArSamples', 'LArSamples.root', True) topSequence.StreamLArSamples.ItemList += [ 'LArSamplesContainer#Samples' ] topSequence.StreamLArSamples_FH.ItemList += [ 'LArSamplesContainer#Samples' ] StreamLArSamples.WriteOnExecute = False StreamLArSamples.WriteOnFinalize = True else: from AthenaCommon.AppMgr import ServiceMgr as svcMgr svcMgr.AthenaSealSvc.DictNames += ["LArCafJobsDict"] self.CaloType = caloType self.Prescale = prescale self.NoiseSignifCut = noiseSignifCut self.DoTrigger = doTrigger self.DoStream = doStream self.DoOFCIter = doOFCIter self.DumpChannelInfos = dumpChannelInfos self.DumpDisconnected = dumpChannelInfos #self.ChannelsKey = 'LArRawChannels_FromDigits' self.ChannelsKey = 'LArRawChannels' self.TriggerNames = triggerNames from AthenaCommon.AppMgr import ToolSvc from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault theADC2MeVTool = LArADC2MeVToolDefault() ToolSvc += theADC2MeVTool self.ADC2MeVTool = theADC2MeVTool if doShape: from IOVDbSvc.CondDB import conddb conddb.addFolder( 'LAR_OFL', '/LAR/ElecCalibOfl/AutoCorrs/AutoCorr<tag>LARElecCalibOflAutoCorrsAutoCorr-RUN2-UPD3-00</tag>' ) # use the shapes without residual corrections by default (makes it easier to compute new residuals) conddb.addOverride( '/LAR/ElecCalibOfl/Shape/RTM/5samples1phase', 'LARElecCalibOflShapeRTM5samples1phase-RUN2-UPD1-04') masker = LArBadChannelMasker('LArBadChannelMasker') masker.DoMasking = True masker.ProblemsToMask = [ 'deadReadout', 'deadPhys', 'almostDead', 'short', 'highNoiseHG', 'highNoiseMG', 'highNoiseLG' ] self.BadChannelMasker = masker self.DigitsKey = digitsKey if doOFCIter: from AthenaCommon.AppMgr import ToolSvc if hasattr(ToolSvc, 'LArRawChannelBuilderToolOFCIter'): ToolSvc.LArRawChannelBuilderToolOFCIter.StoreTiming = True if addToAlgSeq: from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() topSequence += self print self
theLArBadChanTool.OutputLevel=DEBUG #can put in bad channels by hand in text files by setting this true and specifying names of text files, see LArBadChanTool documentation theLArBadChanTool.ReadFromASCII=False #have to specify the these names iff ReadFromASCII=True #theLArBadChanTool.EMBAfile = 'EMBA.txt' #theLArBadChanTool.EMBCfile = 'EMBC.txt' #theLArBadChanTool.EMECAfile = 'EMECA.txt' #theLArBadChanTool.EMECCfile = 'EMECC.txt' #theLArBadChanTool.HECAfile = 'HECA.txt' #theLArBadChanTool.HECCfile = 'HECC.txt' #theLArBadChanTool.FCALAfile = 'FCALA.txt' #theLArBadChanTool.FCALCfile = 'FCALC.txt' #theLArBadChanTool.FEBfile = 'FEB.txt' ToolSvc+=theLArBadChanTool MissingETData.BadChannelTool = theLArBadChanTool if MissingETData.UseBadChannelMasker == True: from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArMasker=LArBadChannelMasker("myLArMasker") theLArMasker.DoMasking=True #set problems to be masked here, badchannelmasker and badchantool are independently applied theLArMasker.ProblemsToMask=["deadReadout","deadPhys","almostDead","short", "lowNoiseHG","highNoiseHG","unstableNoiseHG","lowNoiseMG","highNoiseMG","unstableNoiseMG", "lowNoiseLG","highNoiseLG","unstableNoiseLG","deadCalib","distorted","peculiarCalibrationLine", "unstable","sporadicBurstNoise","problematicForUnknownReason","shortProblem","missingFEB" ] ToolSvc+=theLArMasker MissingETData.BadChannelMasker = theLArMasker ToolSvc += MissingETData print MissingETData
include.block("TrigT2CaloCommon/CaloCellMasking.py") from AthenaCommon.AppMgr import ToolSvc #if not already imported from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool, LArBadChannelMasker ToolSvc += LArBadChanTool("MyBadChanTool") ToolSvc.MyBadChanTool.ReadFromASCII = False #Not necessary if you have already produced a database file ToolSvc.MyBadChanTool.ComplementaryCoolFolder = "/LAR/BadChannels/BadChannelsOnl" #ToolSvc.MyBadChanTool.OutputLevel=VERBOSE #ToolSvc.MyBadChanTool.OutputLevel=DEBUG #The masker tool name must be "LArBadChannelMasker", the same as retrieved in LArCellCont.cxx ToolSvc += LArBadChannelMasker("LArBadChannelMasker") ToolSvc.LArBadChannelMasker.ProblemsToMask = [ "unstable", "short", "highNoiseHG", "highNoiseMG", "highNoiseLG", "problematicForUnknownReason" ] #See LArBadChanBitPacking.cxx for the list of strings that can be used. ToolSvc.LArBadChannelMasker.DoMasking = True #Masking can easily be turned on and off here. #ToolSvc.LArBadChannelMasker.OutputLevel=DEBUG ToolSvc.LArBadChannelMasker.TheLArBadChanTool = ToolSvc.MyBadChanTool #Tell the Masker to use the LArBadChanTool that was just configured. #IOVDbSvc=theApp.service('IOVDbSvc') #if ( svcMgr.IOVDbSvc.GlobalTag!="COMCOND-002-00" and svcMgr.IOVDbSvc.GlobalTag!="COMCOND-003-00" and svcMgr.IOVDbSvc.GlobalTag!="COMCOND-004-00" and svcMgr.IOVDbSvc.GlobalTag!="COMCOND-005-00" ): #else: if not conddb.folderRequested('/LAR/BadChannels/BadChannels'): conddb.addFolder(LArDB, "/LAR/BadChannels/BadChannels") conddb.addFolder(LArDB, "/LAR/BadChannels/BadChannelsOnl") from TileConditions.TileInfoConfigurator import TileInfoConfigurator tIC = TileInfoConfigurator() tIC.setupCOOL()
def configure(self): mlog = logging.getLogger( 'Py:LArRawChannelGetter::configure %s:' % self.__class__ ) from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() from AthenaCommon.AppMgr import ToolSvc # get LArDigitGetter in MC case from AthenaCommon.DetFlags import DetFlags if DetFlags.digitize.LAr_on() : try: from LArDigitization.LArDigitGetter import LArDigitGetter theLArDigitGetter = LArDigitGetter() except Exception as configException: mlog.error("could not get handle to LArDigitGetter Quit") import traceback mlog.error(traceback.format_exc()) return False if not theLArDigitGetter.usable(): mlog.error("LArDigitGetter unusable. Quite") return False from LArROD.LArRODFlags import larRODFlags from AthenaCommon.GlobalFlags import globalflags if globalflags.DataSource()=='data' or larRODFlags.forceIter() : # ADC2MeV tool from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault theADC2MeVTool = LArADC2MeVToolDefault() ToolSvc += theADC2MeVTool from AthenaCommon.AppMgr import ServiceMgr as svcMgr # Data case if larRODFlags.readDigits(): from AthenaCommon.GlobalFlags import globalflags if globalflags.InputFormat() == 'bytestream': if not larRODFlags.keepDSPRaw(): topSequence.LArRawDataReaderAlg.LArRawChannelKey="" if globalflags.DetGeo() == 'ctbh6' or globalflags.DetGeo() == 'ctbh8': from LArROD.LArRODConf import LArRawChannelBuilder theLArRawChannelBuilder=LArRawChannelBuilder() topSequence += theLArRawChannelBuilder return True from LArROD.LArRODConf import LArRawChannelBuilderDriver theLArRawChannelBuilder=LArRawChannelBuilderDriver("LArRawChannelBuilder") topSequence += theLArRawChannelBuilder if larRODFlags.keepDSPRaw(): theLArRawChannelBuilder.LArRawChannelContainerName=larRODFlags.RawChannelFromDigitsContainerName() # bad channel masking if required if not larRODFlags.doBuildBadChannel(): # The first tool filters out bad channels from LArROD.LArRODConf import LArRawChannelBuilderToolBadChannelTool theLArRawChannelBuilderToolBadChannel=LArRawChannelBuilderToolBadChannelTool() from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArRCBMasker=LArBadChannelMasker("LArRCBMasker") theLArRCBMasker.DoMasking=True theLArRCBMasker.ProblemsToMask=[ "deadReadout","deadPhys","almostDead","short", "lowNoiseHG","highNoiseHG","unstableNoiseHG", "lowNoiseMG","highNoiseMG","unstableNoiseMG", "lowNoiseLG","highNoiseLG","unstableNoiseLG" ] theLArRawChannelBuilderToolBadChannel.BadChannelMask=theLArRCBMasker theLArRawChannelBuilder.BuilderTools += [theLArRawChannelBuilderToolBadChannel] ToolSvc+=theLArRawChannelBuilderToolBadChannel # Pulse reconstruction # main method: OFC iteration from LArROD.LArRODConf import LArRawChannelBuilderToolOFCIter theLArRawChannelBuilderToolOFCIter=LArRawChannelBuilderToolOFCIter() theLArRawChannelBuilderToolOFCIter.minSample = 2 theLArRawChannelBuilderToolOFCIter.maxSample = 12 theLArRawChannelBuilderToolOFCIter.minADCforIterInSigma=4 # ADCmax at least 4 sigma above noise for iteration theLArRawChannelBuilderToolOFCIter.minADCforIter=15 # min adc for iteration (only if no pedestalRMS found) theLArRawChannelBuilderToolOFCIter.defaultPhase=0 # starting delay, also the fixed delay for ADC below min. theLArRawChannelBuilderToolOFCIter.ECut=250. # Energy to save quality theLArRawChannelBuilder.BuilderTools += [theLArRawChannelBuilderToolOFCIter] theLArRawChannelBuilder+=theLArRawChannelBuilderToolOFCIter # no fallback when emulating exactly DSP computation if not larRODFlags.doDSP(): # fallback(1): cubic method from LArROD.LArRODConf import LArRawChannelBuilderToolCubic theLArRawChannelBuilderToolCubic=LArRawChannelBuilderToolCubic() theLArRawChannelBuilderToolCubic.minADCforCubic=30 theLArRawChannelBuilder.BuilderTools += [theLArRawChannelBuilderToolCubic] theLArRawChannelBuilder += theLArRawChannelBuilderToolCubic # fallback(2) averageing from LArROD.LArRODConf import LArRawChannelBuilderToolAverage theLArRawChannelBuilderToolAverage=LArRawChannelBuilderToolAverage() theLArRawChannelBuilderToolAverage.NScan=0 theLArRawChannelBuilder.BuilderTools += [theLArRawChannelBuilderToolAverage] theLArRawChannelBuilder += theLArRawChannelBuilderToolAverage # Pedestal # main method from database from LArROD.LArRODConf import LArRawChannelBuilderPedestalDataBase theLArRawChannelBuilderPedestalDataBase=LArRawChannelBuilderPedestalDataBase() theLArRawChannelBuilderPedestalDataBase.LArPedestalKey = "LArPedestal" theLArRawChannelBuilder.PedestalTools = [theLArRawChannelBuilderPedestalDataBase] theLArRawChannelBuilder += theLArRawChannelBuilderPedestalDataBase # no fallback when emulating exactly DSP computation if not larRODFlags.doDSP(): # fallback. sample 0 from LArROD.LArRODConf import LArRawChannelBuilderPedestalSampleZero theLArRawChannelBuilderPedestalSampleZero=LArRawChannelBuilderPedestalSampleZero() theLArRawChannelBuilder.PedestalTools += [theLArRawChannelBuilderPedestalSampleZero] theLArRawChannelBuilder += theLArRawChannelBuilderPedestalSampleZero # ADC to energy # main method from database from LArROD.LArRODConf import LArRawChannelBuilderADC2EDataBase theLArRawChannelBuilderADC2EDataBase=LArRawChannelBuilderADC2EDataBase() theLArRawChannelBuilder.ADCtoEnergyTools = [theLArRawChannelBuilderADC2EDataBase] theLArRawChannelBuilderADC2EDataBase.ADC2MeVTool = theADC2MeVTool theLArRawChannelBuilder += theLArRawChannelBuilderADC2EDataBase # no fallback when emulating exactly DSP computation if not larRODFlags.doDSP(): # fallback, constant conversion factors from LArROD.LArRODConf import LArRawChannelBuilderADC2EConstants theLArRawChannelBuilderADC2EConstants=LArRawChannelBuilderADC2EConstants() theLArRawChannelBuilder.ADCtoEnergyTools += [theLArRawChannelBuilderADC2EConstants] theLArRawChannelBuilder += theLArRawChannelBuilderADC2EConstants #more tools to be configured from LArRecUtils.LArRecUtilsConf import LArOFPeakRecoTool theLArOFPeakRecoTool=LArOFPeakRecoTool() from LArConditionsCommon.LArCondFlags import larCondFlags theLArOFPeakRecoTool.UseShape=larCondFlags.useShape() if larCondFlags.LArCoolChannelSelection.statusOn: if len(larCondFlags.LArCoolChannelSelection())>0: theLArOFPeakRecoTool.forceHighGain=larCondFlags.useOFCOnlyCoolChannelSelection() ToolSvc += theLArOFPeakRecoTool # # adjust default timing to match first sample information written in cool from Lar online configuration # nominalPeakSample=2 if globalflags.DataSource()=='data': from LArConditionsCommon.LArCool import larcool if (larcool is not None): nominalPeakSample = larcool.firstSample() # don't use ramp intercept in calibration if gain type is not auto if larcool.gainType() > 0 : mlog.info(" Gain Type: %d don't use intercept in ADC to Energy ramp calibration",larcool.gainType()) theLArRawChannelBuilderADC2EDataBase.UseHighGainRampIntercept = False theLArRawChannelBuilderADC2EDataBase.UseMedGainRampIntercept = False theLArRawChannelBuilderADC2EDataBase.UseLowGainRampIntercept = False else : mlog.info(" Gain Type: %d use intercept in ADC to energy ramp calibraion ",larcool.gainType()) if (nominalPeakSample > 1) : theLArRawChannelBuilder.DefaultShiftTimeSample=nominalPeakSample-2 else : theLArRawChannelBuilder.DefaultShiftTimeSample=0 theLArRawChannelBuilder.DataLocation = "FREE" else: from AthenaCommon.GlobalFlags import globalflags if globalflags.InputFormat() == 'bytestream': if not "LArRawChannelContainer/LArRawChannels" in svcMgr.ByteStreamAddressProviderSvc.TypeNames: svcMgr.ByteStreamAddressProviderSvc.TypeNames+=["LArRawChannelContainer/LArRawChannels"] # In the case of DSP monitoring and reading rawchannels, need to give a different name to the LArRawChannels container # read from the bytestream ... # This name has to be coherent with the name in LArMonTools/LArRODMonTool_jobOptions.py if larRODFlags.doDSP() and larRODFlags.readRawChannels(): #Reading LArRawChannel print ("Reading RawChannels in DSP physics mode") # !!! The name of the LArRawChannels container read from the Bytestream is LArRawChannels_fB !!! if not "LArRawChannelContainer/LArRawChannels_fB" in svcMgr.ByteStreamAddressProviderSvc.TypeNames: svcMgr.ByteStreamAddressProviderSvc.TypeNames+=["LArRawChannelContainer/LArRawChannels_fB"] print (svcMgr.ByteStreamAddressProviderSvc.TypeNames) else: # MC Case try: from AthenaCommon import CfgGetter topSequence += CfgGetter.getAlgorithm("LArRawChannelBuilder", tryDefaultConfigurable=True) except Exception as cfgException: mlog.error("Failed to retrieve LArRawChannelBuilder. Quit") import traceback mlog.error(traceback.format_exc()) return False return True
## ) ## ToolSvc+=theLArPedACValBCMask ## theLArRampValBCMask=LArBadChannelMasker("RampValBCMask", ## DoMasking=True, ## ProblemsToMask=[ ## "deadReadout","deadCalib","deadPhys","almostDeadBit", ## "highNoiseHG","highNoiseMG","highNoiseLG" ## ] ## ) ## ToolSvc+=theLArRampValBCMask from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker theLArBCMask = LArBadChannelMasker("BadChannelMask", DoMasking=True, ProblemsToMask=[ "deadReadout", "deadCalib", "deadPhys", "almostDead", "highNoiseHG", "highNoiseMG", "highNoiseLG" ]) ToolSvc += theLArBCMask if upper(Object) == "PEDESTAL": from LArCalibDataQuality.Thresholds import pedThr, rmsThr, pedThrFEB, rmsThrFEB addFolderAndTag("/LAR/ElecCalibOfl/Pedestals/Pedestal", "Pedestal") from LArCalibDataQuality.LArCalibDataQualityConf import LArPedestalValidationAlg thePedestalValidationAlg = LArPedestalValidationAlg() thePedestalValidationAlg.PedestalTolerance = pedThr thePedestalValidationAlg.PedestalRMSTolerance = rmsThr thePedestalValidationAlg.PedestalToleranceFEB = pedThrFEB thePedestalValidationAlg.PedestalRMSToleranceFEB = rmsThrFEB