def setupMuonCalibNtuple(): global topSequence, muonRecFlags, beamFlags, ToolSvc, rec, DetFlags if not rec.doMuon() or not DetFlags.Muon_on(): logMuon.warning( "Not setting up requested Muon Calibration Ntuple because Muons are off" ) return logMuon.info("Setting up Muon Calibration Ntuple") try: configs = getCalibConfigs() # MuonSegmentToCalibSegment is only needed if we want segments if muonRecFlags.calibNtupleSegments and muonRecFlags.calibMuonStandalone: MuonSegmentToCalibSegment = getMuonSegmentToCalibSegment() # MuonCalibAlg is always needed eventTag = "UNKNOWN" if (muonRecFlags.calibNtupleSegments or muonRecFlags.calibNtupleTracks ) and muonRecFlags.calibMuonStandalone: if len(configs) >= 1: eventTag = configs[0]["eventTag"] elif muonRecFlags.calibNtupleTrigger: eventTag = "TRIG" else: eventTag = "HITS" MuonCalibAlg = getMuonCalibAlg(eventTag) # configure for writing ntuple from MuonCalibTools.MuonCalibToolsConf import MuonCalib__PatternNtupleMaker MuonCalibTool = MuonCalib__PatternNtupleMaker( "MuonCalibPatternNtupleMaker") MuonCalibTool.FillTruth = rec.doTruth() MuonCalibTool.DoRawTGC = (muonRecFlags.doTGCs() and muonRecFlags.calibNtupleRawTGC()) ToolSvc += MuonCalibTool MuonCalibAlg.MuonCalibTool = MuonCalibTool # MuonCalibExtraTree only if we want to write tracks if muonRecFlags.calibNtupleTracks: MuonCalibTool.DelayFinish = True from MuonCalibExtraTreeAlg.MuonCalibExtraTreeAlgConf import MuonCalib__MuonCalibExtraTreeAlg MuonCalibExtraTreeAlg = MuonCalib__MuonCalibExtraTreeAlg( "MuonCalibExtraTreeAlg", NtupleName="PatternNtupleMaker", ) segmentOnTrackSelector = None if hasattr(topSequence, "MuonSegmentToCalibSegment"): from MuonCalibExtraTreeAlg.MuonCalibExtraTreeAlgConf import MuonCalib__SegmentOnTrackSelector segmentOnTrackSelector = MuonCalib__SegmentOnTrackSelector() segmentOnTrackSelector.PattternLocation = "PatternsForCalibration" ToolSvc += segmentOnTrackSelector MuonCalibExtraTreeAlg.SegmentOnTrackSelector = segmentOnTrackSelector if not rec.doMuonCombined(): tool_nr = 0 from MuonCalibExtraTreeAlg.MuonCalibExtraTreeAlgConf import MuonCalib__ExtraTreeTrackFillerTool resPullCalc = getPublicTool("ResidualPullCalculator") for config in configs: trackDumpTool = MuonCalib__ExtraTreeTrackFillerTool( "ExtraTreeTrackFillerTool" + str(tool_nr)) trackDumpTool.TrackCollectionKey = config['tracksKey'] trackDumpTool.SegmentAuthors = [config['segmentAuthor']] trackDumpTool.TrackAuthor = config['trackAuthor'] trackDumpTool.PullCalculator = resPullCalc ToolSvc += trackDumpTool MuonCalibExtraTreeAlg.TrackFillerTools.append( trackDumpTool) tool_nr += 1 # configure needed tools # add to topSequence topSequence += MuonCalibExtraTreeAlg # MuonCalibExtraTreeTriggerAlg only if trigger is available if muonRecFlags.calibNtupleTrigger: # and DetFlags.detdescr.LVL1_on() and DetFlags.haveRDO.LVL1_on(): # protect against running without AtlasTrigger project doMuCTPI = True if doMuCTPI: try: from TrigT1RPCRecRoiSvc import TrigT1RPCRecRoiConfig from TrigT1TGCRecRoiSvc import TrigT1TGCRecRoiConfig except ImportError: logMuon.warning( "MuonCalibExtraTreeTriggerAlg.doMuCTPI = False because AtlasTrigger is not available" ) doMuCTPI = False # delay writing of MuonCalibAlg MuonCalibTool.DelayFinish = True # also delay MuonCalibExtraTreeAlg if it is running try: topSequence.MuonCalibExtraTreeAlg.DelayFinish = True except AttributeError: pass from MuonCalibExtraTreeAlg.MuonCalibExtraTreeAlgConf import MuonCalib__MuonCalibExtraTreeTriggerAlg topSequence += MuonCalib__MuonCalibExtraTreeTriggerAlg( 'MuonCalibExtraTreeTriggerAlg', doMuCTPI=doMuCTPI, doLVL1Calo=rec.doTile() or rec.doLArg() or DetFlags.haveRDO.Calo_on(), doMBTS=rec.doTile() or DetFlags.haveRDO.Tile_on()) except: from AthenaCommon.Resilience import treatException treatException( "Problem in MuonCalib - Muon Calibration Ntuple configuration probably incomplete" )
from RecExConfig.RecFlags import rec from AthenaCommon.GlobalFlags import globalflags from AthenaCommon.DetFlags import DetFlags from AthenaCommon.Logging import logging if globalflags.DataSource() == 'data': if rec.projectName() == "data09_calophys": # for data09_calophys project, force to use DSP output for the cell energy, perform reco like DSP, no dead cell correction if rec.doLArg(): from LArROD.LArRODFlags import larRODFlags larRODFlags.readDigits = False if rec.doTile(): from TileRecUtils.TileRecFlags import jobproperties jobproperties.TileRecFlags.readDigits = False from CaloRec.CaloCellFlags import jobproperties jobproperties.CaloCellFlags.doDeadCellCorr = False jobproperties.CaloCellFlags.doLArCreateMissingCells = False jobproperties.CaloCellFlags.doLArDeadOTXCorr = False else: if rec.doLArg() and globalflags.InputFormat( ) == 'bytestream' and jobproperties.CaloRecFlags.doLArAutoConfiguration( ): # for bytestream reco of real data, autoconfigure based on the run format information # use digits only when digits available for all cells (transparent or rawdataresult) # use DSP energy + digits when available in case only sparse digits available (results) # (when collisions with timing settled we could use only DSP energy in this case) from LArROD.LArRODFlags import larRODFlags
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