def makeCaloCellFilterAlg( CellsName = "AllCalo", OutputCellsName="SelectedCells", MaxNCells=200000, CellSigmaCut=4, CaloNums=[SUBCALO.LAREM, SUBCALO.LARHEC, SUBCALO.LARFCAL, SUBCALO.TILE], CaloSamplings=[], CellEnergyThreshold=0.) : from CaloD3PDMaker.CaloD3PDMakerConf import CaloCellFilterAlg caloCellFilter = CaloCellFilterAlg(OutputCellsName) caloCellFilter.CaloNums=CaloNums caloCellFilter.CaloSamplings=CaloSamplings from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() svcMgr.ToolSvc+=theCaloNoiseTool caloCellFilter.NoiseTool = theCaloNoiseTool caloCellFilter.CellsName = CellsName caloCellFilter.OutputCellsName = OutputCellsName caloCellFilter.MaxNCells = MaxNCells caloCellFilter.CellSigmaCut = CellSigmaCut caloCellFilter.CellEnergyThreshold = CellEnergyThreshold return caloCellFilter
def makeCaloCellSlimmedD3PDObject(maker, prefix, object_name): cellD3PDObject = D3PDObject(makeCellD3PDObject, prefix, object_name) if prefix in prefix_to_det.keys(): #print " in makeCaloCellD3PDMaker, prefix =" , prefix cellD3PDObject.defineHook(hookForCaloCellFilterAlg) cellD3PDObject.defineBlock(0, 'Kinematics', EventCommonD3PDMaker.FourMomFillerTool, WriteE=True, WriteM=False, WritePt=False) from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() svcMgr.ToolSvc += theCaloNoiseTool cellD3PDObject.defineBlock(1, 'Detail1', CaloD3PDMaker.CaloCellDetailsFillerTool, SaveCellQuality=True, SaveBadCellStatus=True, SaveSigma=True, SaveId=True, SaveDetInfo=True, NoiseTool=theCaloNoiseTool) return cellD3PDObject
def configure(self): from AthenaCommon.Logging import logging mlog = logging.getLogger('LArNoisyROSummaryGetter::configure:') mlog.info('entering') import traceback try: from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault from AthenaCommon.AppMgr import ToolSvc theCaloNoiseTool = CaloNoiseToolDefault() ToolSvc += theCaloNoiseTool from LArCellRec.LArCellRecConf import LArCollisionTimeAlg from AthenaCommon.GlobalFlags import globalflags self._handle = \ LArCollisionTimeAlg("LArCollisionTimeAlg", NoiseTool = theCaloNoiseTool, isMC = globalflags.DataSource != 'data', cutIteration=False) # register output in objKeyStore from RecExConfig.ObjKeyStore import objKeyStore objKeyStore.addTransient(self.outputType(), self.outputKey()) self.seq += self._handle except: mlog.error("Error configuring LArCollisionTimeAlg.") traceback.print_exc() return True
def ApplySubtractionToClusters(**kwargs): if 'event_shape_key' in kwargs.keys(): event_shape_key = kwargs['event_shape_key'] else: from HIGlobal.HIGlobalFlags import jobproperties event_shape_key = jobproperties.HIGlobalFlags.EventShapeKey() if 'cluster_key' in kwargs.keys(): cluster_key = kwargs['cluster_key'] else: cluster_key = HIJetFlags.HIClusterKey() if 'modulator' in kwargs.keys(): mod_tool = kwargs['modulator'] else: mod_tool = GetNullModulator() from HIJetRec.HIJetRecConf import HIClusterSubtraction toolName = 'HIClusterSubtraction' if 'name' in kwargs.keys(): toolName = kwargs['name'] theAlg = HIClusterSubtraction(toolName) theAlg.ClusterKey = cluster_key theAlg.EventShapeKey = event_shape_key theAlg.Subtractor = GetSubtractorTool(**kwargs) theAlg.Modulator = mod_tool do_cluster_moments = False if 'CalculateMoments' in kwargs.keys(): do_cluster_moments = kwargs['CalculateMoments'] if do_cluster_moments: from CaloRec.CaloRecConf import CaloClusterMomentsMaker from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() from AthenaCommon.AppMgr import ToolSvc ToolSvc += theCaloNoiseTool HIClusterMoments = CaloClusterMomentsMaker("HIClusterMoments") #HIClusterMoments.MaxAxisAngle = 20*deg HIClusterMoments.CaloNoiseTool = theCaloNoiseTool HIClusterMoments.UsePileUpNoise = False HIClusterMoments.MinBadLArQuality = 4000 HIClusterMoments.MomentsNames = [ "CENTER_MAG", "LONGITUDINAL", "FIRST_ENG_DENS", "SECOND_ENG_DENS", "ENG_FRAC_EM", "ENG_FRAC_MAX", "ENG_FRAC_CORE", "ENG_BAD_CELLS", "N_BAD_CELLS", "N_BAD_CELLS_CORR", "BAD_CELLS_CORR_E", "BADLARQ_FRAC", "ENG_POS", "SIGNIFICANCE", "CELL_SIGNIFICANCE", "CELL_SIG_SAMPLING", "AVG_LAR_Q", "AVG_TILE_Q" ] from IOVDbSvc.CondDB import conddb if not conddb.isOnline: from LArRecUtils.LArHVScaleRetrieverDefault import LArHVScaleRetrieverDefault HIClusterMoments.LArHVScaleRetriever = LArHVScaleRetrieverDefault() HIClusterMoments.MomentsNames += [ "ENG_BAD_HV_CELLS", "N_BAD_HV_CELLS" ] theAlg.ClusterCorrectionTools = [HIClusterMoments] jtm.add(theAlg) jtm.jetrecs += [theAlg] jtm.HIJetRecs += [theAlg]
def __init__(self, name="LArRawDataContByteStreamTool", **kwargs): super(LArRawDataContByteStreamToolConfig, self).__init__(name) from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() from AthenaCommon.AppMgr import ToolSvc ToolSvc += theCaloNoiseTool self.NoiseTool = theCaloNoiseTool for n, v in kwargs.items(): setattr(self, n, v)
def __init__(self, name="eflowMomentCalculatorToolDefault"): eflowMomentCalculatorTool.__init__(self, name) mlog = logging.getLogger('eflowMomentCalculatorToolDefault::__init__ ') mlog.info("entering") try: from CaloRec.CaloRecConf import CaloClusterMomentsMaker ClusterMomentsMaker = CaloClusterMomentsMaker() except: mlog.error("could not import CaloRec.CaloClusterMomentsMaker") print traceback.format_exc() return False from CaloRec.CaloTopoClusterFlags import jobproperties from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() from AthenaCommon.AppMgr import ToolSvc ToolSvc += theCaloNoiseTool ClusterMomentsMaker.MaxAxisAngle = 20 * deg ClusterMomentsMaker.WeightingOfNegClusters = jobproperties.CaloTopoClusterFlags.doTreatEnergyCutAsAbsolute( ) ClusterMomentsMaker.MinBadLArQuality = 4000 ClusterMomentsMaker.CaloNoiseTool = theCaloNoiseTool ClusterMomentsMaker.UsePileUpNoise = True ClusterMomentsMaker.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise( ) ClusterMomentsMaker.OutputLevel = INFO ClusterMomentsMaker.MomentsNames = [ "FIRST_PHI", "FIRST_ETA", "SECOND_R", "SECOND_LAMBDA", "DELTA_PHI", "DELTA_THETA", "DELTA_ALPHA", "CENTER_X", "CENTER_Y", "CENTER_Z", "CENTER_MAG", "CENTER_LAMBDA", "LATERAL", "LONGITUDINAL", "FIRST_ENG_DENS", "ENG_FRAC_EM", "ENG_FRAC_MAX", "ENG_FRAC_CORE", "FIRST_ENG_DENS", "SECOND_ENG_DENS", "ISOLATION", "EM_PROBABILITY", "ENG_POS", "ENG_BAD_CELLS", "N_BAD_CELLS", "BADLARQ_FRAC", "AVG_LAR_Q", "AVG_TILE_Q", "SIGNIFICANCE" ] self.CaloClusterMomentsMaker = ClusterMomentsMaker from eflowRec.eflowMomentCalculatorSetup import setup_eflowMomentCalculatorTool return setup_eflowMomentCalculatorTool(self, "LC", mlog)
def getLCWeightTool(self, name): mlog = logging.getLogger('eflowLocalHadCal::getLCWeightTool') try: from CaloUtils.CaloUtilsConf import CaloLCWeightTool LCWeight = CaloLCWeightTool(name + "_CaloLCWeightTool") except: mlog.error("could not import CaloUtils.CaloLCWeightTool") print traceback.format_exc() return False try: from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() except: mlog.error("could not import CaloTools.CaloNoiseToolDefault") print traceback.format_exc() return False try: from AthenaCommon.AppMgr import ServiceMgr as svcMgr except: mlog.error("coud not import svcMgr") print traceback.format_ec() return False if (False == hasattr(svcMgr.ToolSvc, "CaloNoiseToolDefault")): try: from AthenaCommon.AppMgr import ToolSvc except: mlog.error("could not import ToolSvc") print traceback.format_ec() return False ToolSvc += theCaloNoiseTool LCWeight.CorrectionKey = "H1ClusterCellWeights" LCWeight.SignalOverNoiseCut = 2.0 LCWeight.CaloNoiseTool = theCaloNoiseTool LCWeight.UseHadProbability = True return LCWeight
jobproperties.Global.DetDescrVersion = Geometry from AtlasGeoModel import SetGeometryVersion from AtlasGeoModel import GeoModelInit include("CaloDetMgrDetDescrCnv/CaloDetMgrDetDescrCnv_joboptions.py") include("CaloIdCnv/CaloIdCnv_joboptions.py") include("TileIdCnv/TileIdCnv_jobOptions.py") include("LArDetDescr/LArDetDescr_joboptions.py") include("TileConditions/TileConditions_jobOptions.py") include("LArConditionsCommon/LArConditionsCommon_comm_jobOptions.py") svcMgr.IOVDbSvc.GlobalTag = GlobalTag from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() theCaloNoiseTool.RescaleForHV = False #Turn automatic rescaling off ToolSvc += theCaloNoiseTool from LArConditionsCommon import LArHVDB #-------------------------------------------------------------- # Private Application Configuration options #-------------------------------------------------------------- from CaloCondPhysAlgs.CaloCondPhysAlgsConf import CaloRescaleNoise theCaloRescaleNoise = CaloRescaleNoise("CaloRescaleNoise") theCaloRescaleNoise.noiseTool = theCaloNoiseTool topSequence += theCaloRescaleNoise #--------------------------------------------------------------
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
TBBeamQuality.CheckTrackReco = True #topSequence += TBBeamQuality from AthenaCommon.AppMgr import athMasterSeq athMasterSeq += TBBeamQuality # ----------------------------- # LAr detectors # ----------------------------- if doLAr: # Default CaloNoiseTool, to be used by all: from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault from CaloTools.CaloNoiseFlags import jobproperties jobproperties.CaloNoiseFlags.UseCaloLuminosity.set_Value_and_Lock(False) theCaloNoiseTool = CaloNoiseToolDefault() theCaloNoiseTool.NMinBias = 0 theCaloNoiseTool.WithOF = True theCaloNoiseTool.UseTile = False theCaloNoiseTool.IsMC = False theCaloNoiseTool.UseSymmetry = False theCaloNoiseTool.WorkMode = 1 if doOFC: theCaloNoiseTool.WithOF = True if doSim: theCaloNoiseTool.IsMC = True ToolSvc += theCaloNoiseTool # get public tool LArADC2MeVTool from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault
def HLTCaloMonitoringTool(): if not 'DQMonFlags' in dir(): from AthenaMonitoring.DQMonFlags import DQMonFlags if DQMonFlags.monManEnvironment == 'tier0Raw': from TrigCaloRec.TrigCaloRecConf import RoILArEMCellContMaker, RoILArHadCellContMaker, RoITileCellContMaker, RoIFCalEmCellContMaker, RoIFCalHadCellContMaker, FullCaloCellContMaker from TrigCaloMonitoring.TrigCaloMonitoringConf import HLTCaloTool, HLTCaloFEBTool from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() from AthenaCommon.AppMgr import ToolSvc if not hasattr(ToolSvc, "CaloNoiseToolDefault"): ToolSvc += theCaloNoiseTool from TrigT2CaloCommon.TrigT2CaloCommonConfig import TrigDataAccess ToolSvc += TrigDataAccess() ToolSvc.TrigDataAccess.loadAllSamplings = True roilaremcellcontmaker = RoILArEMCellContMaker() roilaremcellcontmaker.CaloNoiseTool = theCaloNoiseTool roilarhadcellcontmaker = RoILArHadCellContMaker() roilarhadcellcontmaker.CaloNoiseTool = theCaloNoiseTool roilaremcellcontmaker.DoLArCellsNoiseSuppression = 0 roilarhadcellcontmaker.DoLArCellsNoiseSuppression = 0 roifcalemcellcontmaker = RoIFCalEmCellContMaker() roifcalemcellcontmaker.CaloNoiseTool = theCaloNoiseTool roifcalemcellcontmaker.DoLArCellsNoiseSuppression = 0 roifcalhadcellcontmaker = RoIFCalHadCellContMaker() roifcalhadcellcontmaker.CaloNoiseTool = theCaloNoiseTool roifcalhadcellcontmaker.DoLArCellsNoiseSuppression = 0 #fullcalocellcontmaker = FullCaloCellContMaker() #fullcalocellcontmaker.CaloNoiseTool = theCaloNoiseTool #fullcalocellcontmaker.DoLArCellsNoiseSuppression = 0 HLTCalo = HLTCaloTool(name='HLTCalo', histoPathBase="/Trigger/HLT") HLTCalo.TCRTools = [ roilaremcellcontmaker, roilarhadcellcontmaker, roifcalemcellcontmaker, roifcalhadcellcontmaker, RoITileCellContMaker() ] # From Ignacio HLTCaloFEB = HLTCaloFEBTool(name='HLTCaloFEB', histoPathBase="/Trigger/HLT") HLTCaloFEB.TCRTools = [ roilaremcellcontmaker, roilarhadcellcontmaker, roifcalemcellcontmaker, roifcalhadcellcontmaker, RoITileCellContMaker() ] HLTCaloFEB.sigma = 3 # # Add Region Selector if there is none from AthenaCommon.AppMgr import ServiceMgr if not hasattr(ServiceMgr, "RegSelSvcDefault"): from RegionSelector.RegSelSvcDefault import RegSelSvcDefault ServiceMgr += RegSelSvcDefault() #HLTFullCalo = HLTCaloTool(name = 'HLTFullCalo', # histoPathBase = "/Trigger/HLT") #HLTFullCalo.TCRTools = [fullcalocellcontmaker] ToolSvc += HLTCalo list = ["HLTCaloTool/HLTCalo"] ToolSvc += HLTCaloFEB list += ["HLTCaloFEBTool/HLTCaloFEB"] #ToolSvc += HLTFullCalo; #list += [ "HLTCaloTool/HLTFullCalo" ]; return list #elif DQMonFlags.monManEnvironment == 'tier0ESD': elif ((DQMonFlags.monManEnvironment == 'tier0ESD') or (DQMonFlags.monManEnvironment == 'tier0')): from TrigCaloMonitoring.TrigCaloMonitoringConf import HLTCaloToolL2 from TrigCaloMonitoring.TrigCaloMonitoringConf import HLTCaloClusterTool from TrigCaloMonitoring.TrigCaloMonitoringConf import HLTCaloESD_xAODTrigEMClusters from TrigCaloMonitoring.TrigCaloMonitoringConf import HLTCaloESD_xAODCaloClusters from TrigCaloMonitoring.TrigCaloMonitoringConf import HLTCaloESD_CaloCells xAODTrigEMClusters = HLTCaloESD_xAODTrigEMClusters( "xAODTrigEMClusters") xAODCaloClusters = HLTCaloESD_xAODCaloClusters("xAODCaloClusters") CaloCells = HLTCaloESD_CaloCells("CaloCells") HLTCaloL2 = HLTCaloToolL2( name='HLTCaloL2', histoPathBase="/Trigger/HLT", ListOfCellsKeys=[ 'HLT_CaloCellContainer_TrigT2CaloTauCells', 'HLT_CaloCellContainer_TrigT2CaloEgammaCells' ]) HLTCaloCluster = HLTCaloClusterTool(name='HLTCaloCluster', histoPathBase="/Trigger/HLT") from AthenaCommon.AppMgr import ToolSvc #ToolSvc += HLTCaloL2; ToolSvc += xAODTrigEMClusters #list = [ "HLTCaloToolL2/HLTCaloL2" ]; list = ["HLTCaloESD_xAODTrigEMClusters/xAODTrigEMClusters"] #ToolSvc += HLTCaloCluster; ToolSvc += xAODCaloClusters #list += [ "HLTCaloClusterTool/HLTCaloCluster" ]; list += ["HLTCaloESD_xAODCaloClusters/xAODCaloClusters"] ToolSvc += CaloCells list += ["HLTCaloESD_CaloCells/CaloCells"] return list else: list = [] return list
else: if dt == 25: #conddb.addOverride("/LAR/NoiseOfl/CellNoise","LARNoiseOflCellNoisenoise_2015_ofc25mu20_25ns") # for the 2017 running: conddb.addOverride( "/LAR/NoiseOfl/CellNoise", "LARNoiseOflCellNoisenoise-mc16-ofc25mc15mu20-25ns-A3MinBias_1phi_v2" ) else: #conddb.addOverride("/LAR/NoiseOfl/CellNoise","LARNoiseOflCellNoisenoise_2015_ofc25mu20_50ns") # not possible for 2017: printfunc("Could not handle 50ns in 2017") sys.exit(-1) from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() theCaloNoiseTool.RescaleForHV = False ToolSvc += theCaloNoiseTool from LArConditionsCommon import LArHVDB #-------------------------------------------------------------- # Private Application Configuration options #-------------------------------------------------------------- from CaloCondPhysAlgs.CaloCondPhysAlgsConf import CaloRescaleNoise theCaloRescaleNoise = CaloRescaleNoise("CaloRescaleNoise") theCaloRescaleNoise.noiseTool = theCaloNoiseTool theCaloRescaleNoise.absScaling = True topSequence += theCaloRescaleNoise
def MakeClustersFromTowers(clusterMakerName='CaloClusterMaker',clusterContainerKey='TowerTopoCluster',configDict=ClustersFromTowersDict(),applyEnergyThreshold=False,debugOn=False): ''' This function generates an instance of a cluster algorithm producting clusters trom towers with or without moments ''' # collect inputs mlog = logging.getLogger('MakeClustersFromTowers.py:: ') mlog.info('ClusterMakerName = "'+clusterMakerName+'"') mlog.info('ClusterContainerKey = <'+clusterContainerKey+'>') mlog.info('Converter parameters: ',configDict) # configure cluster builder cnvname = configDict['ClusterBuilderName'] twralgo = configDict['CaloTowerBuilder'] towerkey = twralgo.CaloTowerContainer mlog.info('(input) CaloTowerContainer <'+towerkey+'>') cellkey = 'AllCalo' ### twralgo.InputCellContainer --> this does not work, why? mlog.info('(input) CaloCellContainer <'+cellkey+'>') ptorder = configDict['OrderClusterByPt'] tcluskey = configDict['CaloTopoClusterContainerKey'] tcwgtkey = configDict['CellClusterWeightKey'] #### buildtt = ( tcluskey != 'NONE' and tcwgtkey != 'NONE' ) buildtt = configDict['ApplyLCW'] ''' Configuration module for the tower converter ''' towerConverter = CaloTopoClusterFromTowerMaker(cnvname,CaloTowerContainerKey=towerkey,CaloCellContainerKey=cellkey,OrderClusterByPt=ptorder) ''' Refinement of converter configuration ''' mlog.info(' ') if buildtt: mlog.info('################################################') mlog.info('## Produce LCW calibrated topo-tower clusters ##') mlog.info('################################################') mlog.info('CaloTopoClusterContainerKey .. {0}'.format(tcluskey)) mlog.info('CellClusterWeightKey ......... {0}'.format(tcwgtkey)) towerConverter.CaloTopoClusterContainerKey = tcluskey towerConverter.CellClusterWeightKey = tcwgtkey towerConverter.ApplyLCW = True else: mlog.info('####################################################') mlog.info('## Produce EM calibrated inclusive tower clusters ##') mlog.info('####################################################') mlog.info(' ') if applyEnergyThreshold: towerConverter.CellEnergyThreshold = twralgo.CellEnergyThreshold if debugOn: towerConverter.OutputLevel = Lvl.DEBUG # setting up the moments: external tools from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault caloNoiseTool = CaloNoiseToolDefault() from AthenaCommon.AppMgr import ToolSvc ToolSvc += caloNoiseTool # moment maker from CaloRec.CaloTopoClusterFlags import jobproperties from AthenaCommon.SystemOfUnits import deg, GeV, MeV from CaloRec.CaloRecConf import CaloClusterMomentsMaker clusterMoments = CaloClusterMomentsMaker (clusterMakerName+'MomentMaker') clusterMoments.MaxAxisAngle = 20*deg clusterMoments.CaloNoiseTool = caloNoiseTool clusterMoments.UsePileUpNoise = True clusterMoments.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise() clusterMoments.MinBadLArQuality = 4000 clusterMoments.MomentsNames = ["FIRST_PHI" ,"FIRST_ETA" ,"SECOND_R" ,"SECOND_LAMBDA" ,"DELTA_PHI" ,"DELTA_THETA" ,"DELTA_ALPHA" ,"CENTER_X" ,"CENTER_Y" ,"CENTER_Z" ,"CENTER_MAG" ,"CENTER_LAMBDA" ,"LATERAL" ,"LONGITUDINAL" ,"FIRST_ENG_DENS" ,"ENG_FRAC_EM" ,"ENG_FRAC_MAX" ,"ENG_FRAC_CORE" ,"SECOND_ENG_DENS" ,"ISOLATION" ,"ENG_BAD_CELLS" ,"N_BAD_CELLS" ,"N_BAD_CELLS_CORR" ,"BAD_CELLS_CORR_E" ,"BADLARQ_FRAC" ,"ENG_POS" ,"SIGNIFICANCE" ,"CELL_SIGNIFICANCE" ,"CELL_SIG_SAMPLING" ,"AVG_LAR_Q" ,"AVG_TILE_Q" ,"PTD" ,"MASS" ] # only add HV related moments if it is offline. from IOVDbSvc.CondDB import conddb if not conddb.isOnline: from LArRecUtils.LArHVScaleRetrieverDefault import LArHVScaleRetrieverDefault clusterMoments.LArHVScaleRetriever=LArHVScaleRetrieverDefault() clusterMoments.MomentsNames += ["ENG_BAD_HV_CELLS" ,"N_BAD_HV_CELLS" ] # cluster maker from CaloRec.CaloRecConf import CaloClusterMaker clusterMaker = CaloClusterMaker(clusterMakerName) clusterMaker.ClustersOutputName = clusterContainerKey clusterMaker.ClusterMakerTools = [ towerConverter ] mlog.info('instantiated CaloClusterMaker "{0}"'.format(clusterMaker.name())) # bad cell corrections ## from CaloClusterCorrection.CaloClusterBadChannelListCorr import CaloClusterBadChannelListCorr ## badChannelCorr = CaloClusterBadChannelListCorr() # Correction tools ## clusterMaker.ClusterCorrectionTools += [ badChannelCorr ] clusterMaker.ClusterCorrectionTools += [ clusterMoments ] # configuring the algorithm clusterMaker += towerConverter ## clusterMaker += badChannelCorr clusterMaker += clusterMoments if buildtt: from CaloRec.CaloRecConf import CaloTopoClusterFromTowerCalibrator calgname = clusterMakerName+'Calibrator' mlog.info('TopoTowers: add LCW calibration tool <'+calgname+'>') clusterCalibrator = CaloTopoClusterFromTowerCalibrator(calgname) mlog.info('TopoTowers: '+calgname+'.CellClusterWeightKey = "'+tcwgtkey+'"') clusterCalibrator.CellClusterWeightKey = tcwgtkey clusterCalibrator.OrderClusterByPt = ptorder clusterMaker.ClusterCorrectionTools += [ clusterCalibrator ] clusterMaker += clusterCalibrator # done return clusterMaker
# --- for athena online running --- # For Atlas Ready Filter. Not needed. #include ("AthenaMonitoring/AtlasReadyFilterTool_jobOptions.py") # --- CaloNoiseTool configuration --- from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault lar_raw_channel_noise_tool = CaloNoiseToolDefault() ToolSvc += lar_raw_channel_noise_tool # ---- Local Variables ---- # ---specify trigger tool and trigger chain here LArRawChannelMonTool_TrigToolName = "Trig::TrigDecisionTool/TrigDecisionTool" LArRawChannelMonTool_TriggerChain = "L1_RD0_EMPTY" #"L1_RD0_FILLED" # --- LArRawChannelMon configuration --- from LArMonTools.LArMonToolsConf import LArRawChannelMonTool LArRawChannelMon = LArRawChannelMonTool( # --- set up mon tool --- name="LArRawChannelMon", LArRawChannelContainerKey="LArRawChannels", histoPathBase="LAr/RawChannel", OutputLevel=3, # ATLAS Ready Filter Tool ATLASReadyFilterTool=[monAtlasReadyFilterTool], # --- specify trigger options --- # These will be specified for different streams below TrigDecisionTool="", TriggerChain="", #Added by Louis Stream Aware, add the stream this tool should monitor: noise_streams=[], #["RNDM"]
#tag="LARConfigurationDSPThresholdTemplates-Qt5sigma-samp5sigma" #ModeType="noise" # fixed, group, noise #fileName=ModeType+"tQThr5sigmasampleThr5sigma" fileName=ModeType+tag setName="-".join(tag.split("-")[1:]) from CaloTools.CaloNoiseFlags import jobproperties #jobproperties.CaloNoiseFlags.FixedLuminosity.set_Value_and_Lock(1.45*30/8) jobproperties.CaloNoiseFlags.FixedLuminosity.set_Value_and_Lock(-1.) from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() theCaloNoiseTool.OutputLevel=INFO theCaloNoiseTool.RescaleForHV=False ToolSvc+=theCaloNoiseTool from CaloRec.CaloCellFlags import jobproperties jobproperties.CaloCellFlags.doLArHVCorr = False conddb.addOverride("/CALO/Ofl/Noise/PileUpNoiseLumi","CALOOflNoisePileUpNoiseLumi-RUN2-UPD1-00") if 'pileupsqlite' in dir(): conddb.addMarkup("/CALO/Ofl/Noise/PileUpNoiseLumi","<db>sqlite://;schema="+pileupsqlite+";dbname=CONDBR2</db>") if 'noisesqlite' in dir(): if 'noisetag' in dir(): conddb.addMarkup("/LAR/NoiseOfl/CellNoise","<db>sqlite://;schema="+noisesqlite+";dbname=CONDBR2</db><tag>"+noisetag+"</tag>") else: conddb.addMarkup("/LAR/NoiseOfl/CellNoise","<db>sqlite://;schema="+noisesqlite+";dbname=CONDBR2</db>")
def makeCaloCellD3PDObject(maker, prefix, object_name): cellD3PDObject = D3PDObject(makeCellD3PDObject, prefix, object_name) if prefix in prefix_to_det.keys(): #print " in makeCaloCellD3PDMaker, prefix =" , prefix cellD3PDObject.defineHook(hookForCaloCellFilterAlg) cellD3PDObject.defineBlock(0, 'Kinematics', EventCommonD3PDMaker.FourMomFillerTool, WriteE=True, WriteM=False) cellD3PDObject.defineBlock( 1, 'Detail1', CaloD3PDMaker.CaloCellDetailsFillerTool, SaveCellQuality=True, SaveTimeInfo=True, SaveDetInfo=True, SaveCellGain=True, SaveBadCellStatus=False, SaveId=False, SavePositionInfo=False, ) cellD3PDObject.defineBlock( 2, 'Detail2', CaloD3PDMaker.CaloCellDetailsFillerTool, SaveCellQuality=False, SaveTimeInfo=False, SaveDetInfo=False, SaveCellGain=False, SaveBadCellStatus=True, SaveId=True, SavePositionInfo=True, ) from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() svcMgr.ToolSvc += theCaloNoiseTool cellD3PDObject.defineBlock(3, 'Detail3', CaloD3PDMaker.CaloCellDetailsFillerTool, SaveCellQuality=False, SaveTimeInfo=False, SaveDetInfo=False, SaveCellGain=False, SaveBadCellStatus=False, SaveId=False, SavePositionInfo=False, SaveSigma=True, NoiseTool=theCaloNoiseTool) # Raw eta/phi --- off by default. cellD3PDObject.defineBlock(99, 'RawPosition', CaloD3PDMaker.CaloCellRawFillerTool) return cellD3PDObject
###### LAr Coverage Tool Configuration ############### from LArMonTools.LArMonToolsConf import LArCoverage theLArCoverage = LArCoverage(name="LArCoverage", ProcessNEvents=EventBlockSize, LArDigitContainerKey=LArMonFlags.LArDigitKey(), LArBadChannelMask=theLArBadChannelsMasker, Nevents=40) ToolSvc += theLArCoverage LArMon.AthenaMonTools += [theLArCoverage] # BadChannelTool configuration from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool theLArBadChannelTool = LArBadChanTool() theLArBadChannelTool.ReadFromASCII = False ToolSvc += theLArBadChannelTool ToolSvc.LArCoverage.LArBadChannelTool = theLArBadChannelTool # KnownMNBFEBsTool configuration if 'COMP200' not in conddb.GetInstance(): theMNBFebTool = LArBadChanTool("KnownMNBFEBsTool") theMNBFebTool.CoolMissingFEBsFolder = "/LAR/BadChannels/KnownMNBFEBs" ToolSvc += theMNBFebTool ToolSvc.LArCoverage.LArKnownMNBFEBsTool = theMNBFebTool # CaloNoiseTool configuration from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theLArCoverageCaloNoiseTool = CaloNoiseToolDefault() ToolSvc += theLArCoverageCaloNoiseTool ToolSvc.LArCoverage.LArCaloNoiseTool = theLArCoverageCaloNoiseTool
def getCaloNoiseTool(name="ISF_FCS_CaloNoiseTool", **kwargs): from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault return CaloNoiseToolDefault(name, **kwargs)
# particles info from RecExCommon_topOptions.py include( "PartPropSvc/PartPropSvc.py" ) # calorimetry from RecExConfig.ObjKeyStore import objKeyStore # 14.2.20 #objKeyStore.readInputFile('RecExCond/OKS_streamRDO.py') # 14.2.21 objKeyStore.readInputFile('RecExPers/OKS_streamRDO.py') include( "TileConditions/TileConditions_jobOptions.py" ) include( "CaloIdCnv/CaloIdCnv_joboptions.py" ) include( "TileIdCnv/TileIdCnv_jobOptions.py" ) include( "LArDetDescr/LArDetDescr_joboptions.py" ) from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault ToolSvc += CaloNoiseToolDefault() # data from pool include( "EventAthenaPool/EventAthenaPool_joboptions.py" ) include( "GeneratorObjectsAthenaPool/GeneratorObjectsAthenaPool_joboptions.py" ) include( "LArAthenaPool/LArAthenaPool_joboptions.py" ) include( "TileEventAthenaPool/TileEventAthenaPool_joboptions.py" ) # extra dictionary for calibration hits include( "CaloSimEvent/CaloSimEventDict_joboptions.py" ) ################################################################################ ## CALORIMETER RECONSTRUCTION from include ("CaloRec/CaloRec_jobOptions.py") ################################################################################ include( "CaloRec/CaloCellMaker_config.py" )
#cfg = TriggerConfigGetter("ReadPool") #from TriggerJobOpts.Lvl1ResultBuilderGetter import Lvl1ResultBuilderGetter #lvl1 = Lvl1ResultBuilderGetter() # TDT #from AthenaCommon.AppMgr import ToolSvc #from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool #tdt = Trig__TrigDecisionTool("TrigDecisionTool") #ToolSvc += tdt #from TrigDecisionMaker.TrigDecisionMakerConfig import WriteTrigDecision #trigDecWriter = WriteTrigDecision() from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() ToolSvc += theCaloNoiseTool # --- BunchCrossing Tool configuration --- from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool theBCTool = BunchCrossingTool() ToolSvc += theBCTool svcMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() include("LArCellRec//LArCollisionTime_jobOptions.py") from LArCafJobs.LArCafJobsConf import LArNoiseBursts topSequence += LArNoiseBursts("LArNoiseBursts") topSequence.LArNoiseBursts.ICaloNoiseTool = theCaloNoiseTool topSequence.LArNoiseBursts.BCTool = theBCTool
# for LArBadChannelTool, instead of conddb.AddFolder below #include("LArConditionsCommon/LArConditionsCommon_comm_jobOptions.py") theApp.EvtMax = 1 #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"