示例#1
0
def LArPileUpToolDefault(useLArFloat=True,
                         isOverlay=False,
                         outputKey='LArDigitContainer_MC',
                         outputKey_DigiHSTruth='LArDigitContainer_DigiHSTruth',
                         name='LArPileUpToolDefault'):

    if isOverlay:
        #For all other cases, this is already done by LArConditionsCommon_MC_jobOptions.py
        from LArRecUtils.LArRecUtilsConf import LArSymConditionsAlg_LArfSamplMC_LArfSamplSym_ as LArfSamplSymAlg
        condSeq = AthSequencer("AthCondSeq")
        condSeq += LArfSamplSymAlg(ReadKey="LArfSampl",
                                   WriteKey="LArfSamplSym")

    try:
        from AthenaCommon import CfgGetter
        theTool = CfgGetter.getPublicTool("LArPileUpTool")
        theTool.DigitContainer = outputKey
        theTool.DigitContainer_DigiHSTruth = outputKey_DigiHSTruth
        from Digitization.DigitizationFlags import digitizationFlags
        theTool.DoDigiTruthReconstruction = digitizationFlags.doDigiTruth()

    except Exception as configException:
        import traceback
        traceback.print_exc()

    return theTool
示例#2
0
def TileHitVecToCntTool(name="TileHitVecToCntTool", **kwargs):
    ## FIXME includes to be replaced by confGetter configuration.
    from AthenaCommon.Resilience import protectedInclude
    protectedInclude(
        "CaloDetMgrDetDescrCnv/CaloDetMgrDetDescrCnv_joboptions.py")
    protectedInclude("TileConditions/TileConditions_jobOptions.py")
    kwargs.setdefault("TileHitVectors", ["TileHitVec", "MBTSHits"])
    kwargs.setdefault("TileInfoName", "TileInfo")
    kwargs.setdefault("TileHitContainer", "TileHitCnt")
    kwargs.setdefault("TileHitContainer_DigiHSTruth", "TileHitCnt_DigiHSTruth")
    kwargs.setdefault("DoHSTruthReconstruction",
                      digitizationFlags.doDigiTruth())
    from AthenaCommon.DetFlags import DetFlags
    kwargs.setdefault("PileUp", DetFlags.pileup.Tile_on())

    from AthenaCommon.BeamFlags import jobproperties
    if jobproperties.Beam.beamType == 'cosmics':
        kwargs.setdefault("TriggerTimeTool", "CosmicTriggerTimeTool")
        kwargs.setdefault("HitTimeFlag", 2)
        kwargs.setdefault("UseTriggerTime", True)

    if digitizationFlags.doXingByXingPileUp():  # PileUpTool approach
        kwargs.setdefault("FirstXing", Tile_FirstXing())
        kwargs.setdefault("LastXing", Tile_LastXing())

    return CfgMgr.TileHitVecToCntTool(name, **kwargs)
示例#3
0
def LArPileUpToolDefault(useLArFloat=True,isOverlay=False,outputKey='LArDigitContainer_MC',outputKey_DigiHSTruth='LArDigitContainer_DigiHSTruth',name='LArPileUpToolDefault'):

    try:
        from AthenaCommon import CfgGetter
        theTool = CfgGetter.getPublicTool("LArPileUpTool")
        theTool.DigitContainer = outputKey
        theTool.DigitContainer_DigiHSTruth = outputKey_DigiHSTruth
        from Digitization.DigitizationFlags import digitizationFlags
        theTool.DoDigiTruthReconstruction = digitizationFlags.doDigiTruth()
    except Exception as configException:
        print configException
        print "ERROR Problem with configuration"

    return theTool
示例#4
0
    def configure(self):
        mlog = logging.getLogger( 'LArDigitGetter.py::configure :' )
        mlog.info ('entering')

        from AthenaCommon.AlgSequence import AlgSequence
        job = AlgSequence()

        try:
            from AthenaCommon import CfgGetter
            # if using new scheme for pileup
            from Digitization.DigitizationFlags import digitizationFlags
            if digitizationFlags.doXingByXingPileUp():
                # Defined in LArDigitizationConfig.py
                job.PileUpToolsAlg.PileUpTools += [ CfgGetter.getPrivateTool("LArPileUpTool", checkType=True) ]
                job.PileUpToolsAlg.PileUpTools["LArPileUpTool"].DigitContainer = self.outputKey()
                job.PileUpToolsAlg.PileUpTools["LArPileUpTool"].DigitContainer_DigiHSTruth = self.outputKey_DigiHSTruth()
                job.PileUpToolsAlg.PileUpTools["LArPileUpTool"].DoDigiTruthReconstruction = digitizationFlags.doDigiTruth()
            else:
                # Defined in LArDigitizationConfig.py
                print "call CfgGetter for digitmaker1 "
                job += CfgGetter.getAlgorithm("digitmaker1", tryDefaultConfigurable=True)
                job.digitmaker1.LArPileUpTool.DigitContainer = self.outputKey()
                job.digitmaker1.LArPileUpTool.DigitContainer_DigiHSTruth = self.outputKey_DigiHSTruth()
                #job.digitmaker1.LArPileUpTool.DigitContainer_DigiHSTruth = "LArDigitContainer_DigiHSTruth"
                job.digitmaker1.LArPileUpTool.DoDigiTruthReconstruction = digitizationFlags.doDigiTruth()
                # if pileup or overlay
                from AthenaCommon.DetFlags import DetFlags
                from LArDigitization.LArDigitizationConfig import isOverlay
                if DetFlags.pileup.LAr_on() or isOverlay():
                    from AthenaCommon.AppMgr import ServiceMgr
                    # Defined in LArDigitizationConfig.py
                    ServiceMgr.PileUpMergeSvc.Intervals += [ CfgGetter.getPrivateTool("LArRangeEM", checkType=True) ]
                    ServiceMgr.PileUpMergeSvc.Intervals += [ CfgGetter.getPrivateTool("LArRangeHEC", checkType=True) ]
                    ServiceMgr.PileUpMergeSvc.Intervals += [ CfgGetter.getPrivateTool("LArRangeFCAL", checkType=True) ]
        except Exception as configException:
            print configException
            print "ERROR Problem with configuration"
        
        return True
示例#5
0
    from TileSimAlgs.TileRawChannelFromHitsGetter import *
    theTileRawChannelFromHitsGetter=TileRawChannelFromHitsGetter()


if doTileHitToDigit:
    
    from TileSimAlgs.TileDigitsGetter import *
    theTileDigitsGetter=TileDigitsGetter()
    
    from TileSimAlgs.TileSimAlgsConf import *
    theTileDigitsMaker=TileDigitsMaker()
    theTileDigitsMaker.UseCoolPulseShapes=True
    theTileDigitsMaker.MaskBadChannels=False
    theTileDigitsMaker.RndmEvtOverlay=False
    from Digitization.DigitizationFlags import digitizationFlags
    theTileDigitsMaker.DoHSTruthReconstruction = digitizationFlags.doDigiTruth()
    
if doTileDigitsFromPulse:
    
    import traceback

    try:        
        from TileSimAlgs.TileSimAlgsConf import TileDigitsFromPulse
        theTileDigitsFromPulse=TileDigitsFromPulse()
        mlog.info("Adding TileDigitsFromPulse to topSequence")
        ## get a handle on the top sequence of algorithms
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += theTileDigitsFromPulse;

    except:
示例#6
0
    def configure(self):
        mlog = logging.getLogger( 'TileDigitsGetter::configure:' )
        mlog.info ('entering')        


        # get handle to upstream object
        try:
            from TileSimAlgs.TileDigitsGetter import TileDigitsGetter
            theTileDigitsGetter=TileDigitsGetter()
        except:
            mlog.error("could not get handle to TileDigitsGetter Quit")
            print traceback.format_exc()
            return False

        if not theTileDigitsGetter.usable():
            if not self.ignoreConfigError():
                mlog.error("TileDigitsGetter unusable. Quit.")
                return False
            else:
                mlog.error("TileDigitsGetter unusable. Continue nevertheless")
                
        from TileConditions.TileInfoConfigurator import TileInfoConfigurator
        tileInfoConfigurator = TileInfoConfigurator()
        tileInfoConfigurator.setupCOOLPHYPULSE()

        # Instantiation of the C++ algorithm
        try:        
            from TileSimAlgs.TileSimAlgsConf import TileDigitsMaker                
        except:
            mlog.error("could not import TileSimAlgs.TileDigitsMaker")
            print traceback.format_exc()
            return False

        theTileDigitsMaker=TileDigitsMaker()
        self._TileDigitsMakerHandle = theTileDigitsMaker ;

        theTileDigitsMaker.TileHitContainer_DigiHSTruth="TileHitCnt_DigiHSTruth"
        from Digitization.DigitizationFlags import digitizationFlags
        theTileDigitsMaker.DoHSTruthReconstruction = digitizationFlags.doDigiTruth()
        # Configure TileDigitsMaker here
        # Check TileDigitization_jobOptions.py for full configurability
        theTileDigitsMaker.TileHitContainer="TileHitCnt"
        theTileDigitsMaker.TileInfoName="TileInfo"

        theTileDigitsMaker.CalibrationRun=False

        # Random number engine
        theTileDigitsMaker.RndmSvc=digitizationFlags.rndmSvc()
        digitizationFlags.rndmSeedList.addSeed("Tile_DigitsMaker", 4789899, 989240512)

        # Save integer numbers in digits vector if not pile-up premixing
        theTileDigitsMaker.IntegerDigits = not digitizationFlags.PileUpPremixing() 

        # sets output key  
        theTileDigitsMaker.TileDigitsContainer=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 to topSequence")        
        # get a handle on topalg
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += theTileDigitsMaker;
        
        return True
示例#7
0
        # for data09_calophys project, force to use the same quality cut as in BS converter
        if globalflags.DataSource() == 'data':
            if rec.projectName() == "data09_calophys":
                if rec.doTile():
                    from AthenaCommon.AppMgr import ToolSvc
                    ToolSvc.TileCellBuilder.QualityCut = 15
    except Exception:
        treatException("Problem with CaloCellGetter. Switched off.")
        DetFlags.makeRIO.Calo_setOff()

# CaloCellGetter_DigiHSTruth
    doDigiTruthFlag = False
    try:
        from Digitization.DigitizationFlags import digitizationFlags
        doDigiTruthFlag = digitizationFlags.doDigiTruth()
    except:
        log = logging.getLogger('CaloRec')
        log.info(
            'Unable to import DigitizationFlags in CaloRec_jobOptions. Expected in AthenaP1'
        )

    if doDigiTruthFlag:
        try:
            from CaloRec.CaloCellGetter_DigiHSTruth import CaloCellGetter_DigiHSTruth
            CaloCellGetter_DigiHSTruth()

        except Exception:
            treatException(
                "Problem with CaloCellGetter_DigiHSTruth. Switched off.")
示例#8
0
    ,
    "ENG_POS"
    #,"SIGNIFICANCE"
    #,"CELL_SIGNIFICANCE"
    #,"CELL_SIG_SAMPLING"
    ,
    "AVG_LAR_Q",
    "AVG_TILE_Q",
    "EM_PROBABILITY"
    #,"PTD"
    ,
    "BadChannelList",  #"LATERAL"
]
try:
    from Digitization.DigitizationFlags import digitizationFlags
    if digitizationFlags.doDigiTruth():

        AODMoments += [
            "SECOND_R_DigiHSTruth",
            "SECOND_LAMBDA_DigiHSTruth",
            "CENTER_MAG_DigiHSTruth",
            "CENTER_LAMBDA_DigiHSTruth",
            "FIRST_ENG_DENS_DigiHSTruth",
            "ENG_FRAC_MAX_DigiHSTruth",
            "ISOLATION_DigiHSTruth",
            "ENG_BAD_CELLS_DigiHSTruth",
            "N_BAD_CELLS_DigiHSTruth",
            "BADLARQ_FRAC_DigiHSTruth"
            #,"ENG_BAD_HV_CELLS_Truth"
            #,"N_BAD_HV_CELLS_Truth"
            ,
示例#9
0
    def configure(self):
        mlog = logging.getLogger('TileDigitsGetter::configure:')
        mlog.info('entering')

        # get handle to upstream object
        try:
            from TileSimAlgs.TileDigitsGetter import TileDigitsGetter
            theTileDigitsGetter = TileDigitsGetter()
        except Exception:
            mlog.error("could not get handle to TileDigitsGetter Quit")
            traceback.print_exc()
            return False

        if not theTileDigitsGetter.usable():
            if not self.ignoreConfigError():
                mlog.error("TileDigitsGetter unusable. Quit.")
                return False
            else:
                mlog.error("TileDigitsGetter unusable. Continue nevertheless")

        from TileConditions.TileInfoConfigurator import TileInfoConfigurator
        tileInfoConfigurator = TileInfoConfigurator()
        tileInfoConfigurator.setupCOOLPHYPULSE()

        # Instantiation of the C++ algorithm
        try:
            from TileSimAlgs.TileSimAlgsConf import TileDigitsMaker
        except Exception:
            mlog.error("could not import TileSimAlgs.TileDigitsMaker")
            traceback.print_exc()
            return False

        theTileDigitsMaker = TileDigitsMaker()
        self._TileDigitsMakerHandle = theTileDigitsMaker

        from Digitization.DigitizationFlags import digitizationFlags
        theTileDigitsMaker.DoHSTruthReconstruction = digitizationFlags.doDigiTruth(
        )
        # Configure TileDigitsMaker here
        # Check TileDigitization_jobOptions.py for full configurability
        theTileDigitsMaker.TileHitContainer = "TileHitCnt"
        theTileDigitsMaker.TileHitContainer_DigiHSTruth = "TileHitCnt_DigiHSTruth"
        theTileDigitsMaker.TileInfoName = "TileInfo"

        theTileDigitsMaker.CalibrationRun = False

        # Save integer numbers in digits vector if not pile-up premixing
        theTileDigitsMaker.IntegerDigits = not digitizationFlags.PileUpPremixing(
        )

        from TileConditions.TileConditionsConf import TileCondToolNoiseSample
        theTileDigitsMaker.TileCondToolNoiseSample = TileCondToolNoiseSample(
            TileOnlineSampleNoise='')

        # sets output key
        if digitizationFlags.PileUpPremixing and 'OverlayMT' in digitizationFlags.experimentalDigi(
        ):
            from OverlayCommonAlgs.OverlayFlags import overlayFlags
            theTileDigitsMaker.TileDigitsContainer = overlayFlags.bkgPrefix(
            ) + self.outputKey()
        else:
            theTileDigitsMaker.TileDigitsContainer = 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 to topSequence")
        # get a handle on topalg
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += theTileDigitsMaker

        return True
示例#10
0
    def configure(self):
        mlog = logging.getLogger('CaloClusterTopoGetter::configure :')
        mlog.info('scheduled to output %s', self.output())

        # get handle to upstream object
        theCaloCellGetter = self.getInputGetter\
                            (jp.CaloRecFlags.clusterCellGetterName())

        # configure cell weight calibration
        if jobproperties.CaloTopoClusterFlags.doCellWeightCalib():
            from CaloClusterCorrection.CaloClusterCorrectionConf import H1WeightToolCSC12Generic
            from CaloClusterCorrection.StandardCellWeightCalib import H1Calibration, getCellWeightTool
            CellWeights = CaloClusterCellWeightCalib("CellWeights")
            # -- configure weight tool
            finder = jobproperties.CaloTopoClusterFlags.cellWeightRefFinder.get_Value(
            )
            size = jobproperties.CaloTopoClusterFlags.cellWeightRefSize.get_Value(
            )
            signal = jobproperties.CaloTopoClusterFlags.cellWeightRefSignal.get_Value(
            )
            WeightTool = getCellWeightTool(finder, size, signal)
            # -- connect weight tool
            CellWeights.CellSignalWeightTool = WeightTool
            CellWeights += WeightTool
            #-- default properties
            CellWeights.Direction = "AbsSignal"  #-- use absolute cell energies for eta/phi calculation
            CellWeights.BelowThresholdLikeAll = True  #-- treat clusters below thresholds the same as all others
            CellWeights.BelowThresholdDirection = "AbsSignal"  #-- alternative direction calculation for below threshold clusters,
            #   ignored if BelowThresholdLikeAll = True
            CellWeights.EnergyThreshold = 0.0 * MeV  #-- threshold for possible change of direction calculation
            CellWeights.IgnoreGeoWeights = False  #-- ignore geometrical cell signal weights if True

        # now configure local hadronic calibration
        if jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib():
            # tools used by tools
            # EMFrac   = EMFracClusterClassificationTool("EMFrac")
            # EMFrac.ClassificationKey   = "EMFracClassify"
            # EMFrac.UseEMFractionSpread = False
            # EMFrac.MaxEMFraction       = 0.5
            #
            # H1Weight = H1ClusterCellWeightTool("H1Weight")
            # H1Weight.CorrectionKey       = "H1ClusterCellWeights"
            # H1Weight.SignalOverNoiseCut  = 2.0
            # H1Weight.CaloNoiseTool       = theCaloNoiseTool
            #
            # OOCC     = OutOfClusterCorrectionTool("OOCC")
            # OOCC.CorrectionKey       = "OOCCorrection"
            #
            # OOCCPi0  = OutOfClusterCorrectionTool("OOCCPi0")
            # OOCCPi0.CorrectionKey    = "OOCPi0Correction"

            # tools used by tools
            LCClassify = CaloLCClassificationTool("LCClassify")
            LCClassify.ClassificationKey = "EMFracClassify"
            LCClassify.UseSpread = False
            LCClassify.MaxProbability = 0.5
            # add the moments EM_PROBABILITY, HAD_WEIGHT, OOC_WEIGHT, DM_WEIGHT to the AOD:
            LCClassify.StoreClassificationProbabilityInAOD = True
            LCClassify.WeightingOfNegClusters = jobproperties.CaloTopoClusterFlags.doTreatEnergyCutAsAbsolute(
            )

            LCWeight = CaloLCWeightTool("LCWeight")
            LCWeight.CorrectionKey = "H1ClusterCellWeights"
            LCWeight.SignalOverNoiseCut = 2.0
            LCWeight.CaloNoiseTool = theCaloNoiseTool
            LCWeight.UseHadProbability = True

            LCOut = CaloLCOutOfClusterTool("LCOut")
            LCOut.CorrectionKey = "OOCCorrection"
            LCOut.UseEmProbability = False
            LCOut.UseHadProbability = True

            LCOutPi0 = CaloLCOutOfClusterTool("LCOutPi0")
            LCOutPi0.CorrectionKey = "OOCPi0Correction"
            LCOutPi0.UseEmProbability = True
            LCOutPi0.UseHadProbability = False

            #DMTool   = DeadMaterialCorrectionTool2("DMTool")
            #DMTool.HadDMCoeffKey       = "HadDMCoeff2"
            #DMTool.SignalOverNoiseCut  = 1.0
            #DMTool.ClusterRecoStatus   = 0
            #DMTool.WeightModeDM        = 2
            #DMTool.CaloNoiseTool       = theCaloNoiseTool

            LCDeadMaterial = CaloLCDeadMaterialTool("LCDeadMaterial")
            LCDeadMaterial.HadDMCoeffKey = "HadDMCoeff2"
            LCDeadMaterial.ClusterRecoStatus = 0
            LCDeadMaterial.WeightModeDM = 2
            LCDeadMaterial.UseHadProbability = True
            LCDeadMaterial.WeightingOfNegClusters = jobproperties.CaloTopoClusterFlags.doTreatEnergyCutAsAbsolute(
            )
            # correction tools using tools
            LocalCalib = CaloClusterLocalCalib("LocalCalib")
            LocalCalib.ClusterClassificationTool = [LCClassify]
            #LocalCalib.ClusterRecoStatus             = [2]
            LocalCalib.ClusterRecoStatus = [1, 2]
            LocalCalib.LocalCalibTools = [LCWeight]
            LocalCalib.WeightingOfNegClusters = jobproperties.CaloTopoClusterFlags.doTreatEnergyCutAsAbsolute(
            )

            LocalCalib += LCClassify
            LocalCalib += LCWeight

            OOCCalib = CaloClusterLocalCalib("OOCCalib")
            #OOCCalib.ClusterRecoStatus   = [2]
            OOCCalib.ClusterRecoStatus = [1, 2]
            OOCCalib.LocalCalibTools = [LCOut]
            OOCCalib.WeightingOfNegClusters = jobproperties.CaloTopoClusterFlags.doTreatEnergyCutAsAbsolute(
            )

            OOCCalib += LCOut

            OOCPi0Calib = CaloClusterLocalCalib("OOCPi0Calib")
            #OOCPi0Calib.ClusterRecoStatus   = [1]
            OOCPi0Calib.ClusterRecoStatus = [1, 2]
            OOCPi0Calib.LocalCalibTools = [LCOutPi0]

            OOCPi0Calib.WeightingOfNegClusters = jobproperties.CaloTopoClusterFlags.doTreatEnergyCutAsAbsolute(
            )

            OOCPi0Calib += LCOutPi0

            DMCalib = CaloClusterLocalCalib("DMCalib")
            DMCalib.ClusterRecoStatus = [1, 2]
            #DMCalib.LocalCalibToolNames = [DMTool.getFullName()]
            #DMCalib += DMTool
            DMCalib.LocalCalibTools = [LCDeadMaterial]

            DMCalib.WeightingOfNegClusters = jobproperties.CaloTopoClusterFlags.doTreatEnergyCutAsAbsolute(
            )

            DMCalib += LCDeadMaterial

        # correction tools not using tools
        TopoMoments = CaloClusterMomentsMaker("TopoMoments")
        TopoMoments.WeightingOfNegClusters = jobproperties.CaloTopoClusterFlags.doTreatEnergyCutAsAbsolute(
        )
        TopoMoments.MaxAxisAngle = 20 * deg
        TopoMoments.CaloNoiseTool = theCaloNoiseTool
        TopoMoments.UsePileUpNoise = True
        TopoMoments.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise(
        )
        TopoMoments.MinBadLArQuality = 4000
        TopoMoments.MomentsNames = [
            "AVG_LAR_Q", "AVG_TILE_Q", "BAD_CELLS_CORR_E", "BADLARQ_FRAC",
            "CELL_SIGNIFICANCE", "CELL_SIG_SAMPLING", "CENTER_LAMBDA",
            "CENTER_MAG", "CENTER_X", "CENTER_Y", "CENTER_Z", "DELTA_ALPHA",
            "DELTA_PHI", "DELTA_THETA", "ENG_BAD_CELLS", "ENG_FRAC_CORE",
            "ENG_FRAC_EM", "ENG_FRAC_MAX", "ENG_POS", "FIRST_ENG_DENS",
            "FIRST_ETA", "FIRST_PHI", "ISOLATION", "LATERAL", "LONGITUDINAL",
            "MASS", "N_BAD_CELLS", "N_BAD_CELLS_CORR", "PTD",
            "SECOND_ENG_DENS", "SECOND_LAMBDA", "SECOND_R", "SIGNIFICANCE"
        ]

        doDigiTruthFlag = False
        try:
            from Digitization.DigitizationFlags import digitizationFlags
            doDigiTruthFlag = digitizationFlags.doDigiTruth()
        except:
            log = logging.getLogger('CaloClusterTopoGetter')
            log.info(
                'Unable to import DigitizationFlags in CaloClusterTopoGetter. Expected in AthenaP1'
            )

        if doDigiTruthFlag:
            TopoMoments_Truth = CaloClusterMomentsMaker_DigiHSTruth(
                "TopoMoments_Truth")
            TopoMoments_Truth.WeightingOfNegClusters = jobproperties.CaloTopoClusterFlags.doTreatEnergyCutAsAbsolute(
            )
            TopoMoments_Truth.MaxAxisAngle = 20 * deg
            TopoMoments_Truth.CaloNoiseTool = theCaloNoiseTool
            TopoMoments_Truth.UsePileUpNoise = True
            TopoMoments_Truth.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise(
            )
            TopoMoments_Truth.MinBadLArQuality = 4000
            TopoMoments_Truth.MomentsNames = [
                "FIRST_PHI_DigiHSTruth", "FIRST_ETA_DigiHSTruth",
                "SECOND_R_DigiHSTruth", "SECOND_LAMBDA_DigiHSTruth",
                "DELTA_PHI_DigiHSTruth", "DELTA_THETA_DigiHSTruth",
                "DELTA_ALPHA_DigiHSTruth", "CENTER_X_DigiHSTruth",
                "CENTER_Y_DigiHSTruth", "CENTER_Z_DigiHSTruth",
                "CENTER_MAG_DigiHSTruth", "CENTER_LAMBDA_DigiHSTruth",
                "LATERAL_DigiHSTruth", "LONGITUDINAL_DigiHSTruth",
                "ENG_FRAC_CORE_DigiHSTruth", "FIRST_ENG_DENS_DigiHSTruth",
                "SECOND_ENG_DENS_DigiHSTruth", "ISOLATION_DigiHSTruth",
                "BAD_CELLS_CORR_E_DigiHSTruth", "ENG_POS_DigiHSTruth",
                "SIGNIFICANCE_DigiHSTruth", "CELL_SIGNIFICANCE_DigiHSTruth",
                "CELL_SIG_SAMPLING_DigiHSTruth", "AVG_LAR_Q_DigiHSTruth",
                "AVG_TILE_Q_DigiHSTruth", "ENERGY_DigiHSTruth",
                "PHI_DigiHSTruth", "ETA_DigiHSTruth"
            ]

        # only add HV related moments if it is offline.
        from IOVDbSvc.CondDB import conddb
        if not conddb.isOnline:
            from LArRecUtils.LArHVScaleRetrieverDefault import LArHVScaleRetrieverDefault
            TopoMoments.LArHVScaleRetriever = LArHVScaleRetrieverDefault()
            TopoMoments.MomentsNames += ["ENG_BAD_HV_CELLS", "N_BAD_HV_CELLS"]

#        TopoMoments.AODMomentsNames = ["LATERAL"
#                                       ,"LONGITUDINAL"
#                                       ,"SECOND_R"
#                                       ,"SECOND_LAMBDA"
#                                       ,"CENTER_MAG"
#                                       ,"CENTER_LAMBDA"
#                                       ,"FIRST_ENG_DENS"
#                                       ,"ENG_FRAC_MAX"
#                                       ,"ISOLATION"
#                                       ,"ENG_BAD_CELLS"
#                                       ,"N_BAD_CELLS"
#                                       ,"BADLARQ_FRAC"
#                                       ,"ENG_POS"
#                                       ,"SIGNIFICANCE"
#                                       ,"CELL_SIGNIFICANCE"
#                                       ,"CELL_SIG_SAMPLING"
#                                       ,"AVG_LAR_Q"
#                                       ,"AVG_TILE_Q"
#                                       ]

#if jobproperties.CaloTopoClusterFlags.lockTopoClusterSamplingEnergies() or jobproperties.CaloTopoClusterFlags.lockTopoClusterSamplingVariables():
#    LockVariables = CaloClusterLockVars("LockVariables")
#    LockVariables.FixBasicEnergy = True
#    LockVariables.LockedSamplingVariables = []
#    if jobproperties.CaloTopoClusterFlags.lockTopoClusterSamplingEnergies():
#        LockVariables.LockedSamplingVariables += [
#            "Energy", "Max_Energy"]
#    if jobproperties.CaloTopoClusterFlags.lockTopoClusterSamplingVariables():
#        LockVariables.LockedSamplingVariables += [
#            "Eta", "Phi", "Delta_Eta",
#            "Delta_Phi", "Max_Eta", "Max_Phi"
#            ]

#if jobproperties.CaloTopoClusterFlags.printTopoClusters():
#    PrintCaloCluster = CaloClusterPrinter("PrintCaloCluster")
#    PrintCaloCluster.PrintFirstOnly = True
#    PrintCaloCluster.PrintFrequency = 1
#    PrintCaloCluster.EnergyUnit     = 1.0*GeV

        theCaloClusterSnapshot = CaloClusterSnapshot(
            OutputName="CaloTopoCluster", SetCrossLinks=True)

        # maker tools
        TopoMaker = CaloTopoClusterMaker("TopoMaker")

        TopoMaker.CellsName = theCaloCellGetter.outputKey()
        TopoMaker.CalorimeterNames = ["LAREM", "LARHEC", "LARFCAL", "TILE"]
        # cells from the following samplings will be able to form
        # seeds. By default no sampling is excluded
        TopoMaker.SeedSamplingNames = [
            "PreSamplerB", "EMB1", "EMB2", "EMB3", "PreSamplerE", "EME1",
            "EME2", "EME3", "HEC0", "HEC1", "HEC2", "HEC3", "TileBar0",
            "TileBar1", "TileBar2", "TileExt0", "TileExt1", "TileExt2",
            "TileGap1", "TileGap2", "TileGap3", "FCAL0", "FCAL1", "FCAL2"
        ]
        TopoMaker.CaloNoiseTool = theCaloNoiseTool
        TopoMaker.UseCaloNoiseTool = True
        TopoMaker.UsePileUpNoise = True
        TopoMaker.NeighborOption = "super3D"
        TopoMaker.RestrictHECIWandFCalNeighbors = False
        TopoMaker.RestrictPSNeighbors = True
        TopoMaker.CellThresholdOnEorAbsEinSigma = 0.0
        TopoMaker.NeighborThresholdOnEorAbsEinSigma = 2.0
        TopoMaker.SeedThresholdOnEorAbsEinSigma = 4.0
        #timing
        TopoMaker.SeedCutsInT = jobproperties.CaloTopoClusterFlags.doTimeCut()

        # note E or AbsE
        #
        # the following property must be set to TRUE in order to make double
        # sided cuts on the seed and the cluster level
        #
        TopoMaker.SeedCutsInAbsE = True
        TopoMaker.ClusterEtorAbsEtCut = 0.0 * MeV
        #
        # note E or AbsE
        #
        # by default neighbor and cell thresholds are on AbsE. Set the following
        # properties to FALSE in order to switch to cuts on E
        #
        #TopoMaker.NeighborCutsInAbsE              = False
        #TopoMaker.CellCutsInAbsE                 = False
        # the following Et thresholds are ignored in case UsePileUpNoise
        # is TRUE
        #
        #
        # CellThresholdOnAbsEt = 0.0*MeV
        # NeighborThresholdOnAbsEt = 100.0*MeV
        # SeedThresholdOnEtorAbsEt = 200.0*MeV
        # note Et or AbsEt

        # use 2-gaussian or single gaussian noise for TileCal
        TopoMaker.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise(
        )

        TopoSplitter = CaloTopoClusterSplitter("TopoSplitter")
        # cells from the following samplings will be able to form local
        # maxima. The excluded samplings are PreSamplerB, EMB1,
        # PreSamplerE, EME1, all Tile samplings, all HEC samplings and the
        # two rear FCal samplings.
        #
        TopoSplitter.SamplingNames = ["EMB2", "EMB3", "EME2", "EME3", "FCAL0"]
        # cells from the following samplings will also be able to form
        # local maxima but only if they are not overlapping in eta and phi
        # with local maxima in previous samplings from the primary list.
        #
        TopoSplitter.SecondarySamplingNames = [
            "EMB1", "EME1", "TileBar0", "TileBar1", "TileBar2", "TileExt0",
            "TileExt1", "TileExt2", "HEC0", "HEC1", "HEC2", "HEC3", "FCAL1",
            "FCAL2"
        ]
        TopoSplitter.ShareBorderCells = True
        TopoSplitter.RestrictHECIWandFCalNeighbors = False
        TopoSplitter.WeightingOfNegClusters = jobproperties.CaloTopoClusterFlags.doTreatEnergyCutAsAbsolute(
        )
        #
        # the following options are not set, since these are the default
        # values
        #
        # NeighborOption                = "super3D",
        # NumberOfCellsCut              = 4,
        # EnergyCut                     = 500*MeV,

        # cluster maker
        CaloTopoCluster = CaloClusterMaker("CaloTopoCluster")
        if jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib():
            CaloTopoCluster.ClustersOutputName = "CaloCalTopoClusters"
        else:
            CaloTopoCluster.ClustersOutputName = "CaloTopoCluster"
        CaloTopoCluster.ClusterMakerTools = [TopoMaker, TopoSplitter]

        from CaloClusterCorrection.CaloClusterBadChannelListCorr import CaloClusterBadChannelListCorr
        BadChannelListCorr = CaloClusterBadChannelListCorr()
        CaloTopoCluster.ClusterCorrectionTools += [BadChannelListCorr]

        CaloTopoCluster.ClusterCorrectionTools += [TopoMoments]

        if doDigiTruthFlag:
            CaloTopoCluster.ClusterCorrectionTools += [TopoMoments_Truth]

        CaloTopoCluster += TopoMaker
        CaloTopoCluster += TopoSplitter
        CaloTopoCluster += BadChannelListCorr
        CaloTopoCluster += TopoMoments
        if doDigiTruthFlag:
            CaloTopoCluster += TopoMoments_Truth

        if jobproperties.CaloTopoClusterFlags.doClusterVertexFraction():
            from CaloTrackUtils.CaloTrackUtilsConf import CaloClusterVertexFractionMaker
            MyCaloClusterVertexFractionMaker = CaloClusterVertexFractionMaker(
                name="CaloClusterVertexFractionMaker",
                VxContainerName="VxPrimaryCandidate",
                dRMatchMax=0.17)
            CaloTopoCluster.ClusterCorrectionTools += [
                MyCaloClusterVertexFractionMaker
            ]
            CaloTopoCluster += MyCaloClusterVertexFractionMaker

        if jobproperties.CaloTopoClusterFlags.doCalibHitMoments(
        ) and rec.doTruth():
            from CaloCalibHitRec.CaloCalibHitRecConf import CaloCalibClusterMomentsMaker2
            TopoCalibMoments = CaloCalibClusterMomentsMaker2(
                "TopoCalibMoments")
            TopoCalibMoments.MomentsNames = [
                "ENG_CALIB_TOT",
                "ENG_CALIB_OUT_L"
                #,"ENG_CALIB_OUT_M"
                # ,"ENG_CALIB_OUT_T"
                # ,"ENG_CALIB_DEAD_L"
                # ,"ENG_CALIB_DEAD_M"
                # ,"ENG_CALIB_DEAD_T"
                ,
                "ENG_CALIB_EMB0",
                "ENG_CALIB_EME0",
                "ENG_CALIB_TILEG3",
                "ENG_CALIB_DEAD_TOT",
                "ENG_CALIB_DEAD_EMB0",
                "ENG_CALIB_DEAD_TILE0",
                "ENG_CALIB_DEAD_TILEG3",
                "ENG_CALIB_DEAD_EME0",
                "ENG_CALIB_DEAD_HEC0",
                "ENG_CALIB_DEAD_FCAL",
                "ENG_CALIB_DEAD_LEAKAGE",
                "ENG_CALIB_DEAD_UNCLASS",
                "ENG_CALIB_FRAC_EM",
                "ENG_CALIB_FRAC_HAD",
                "ENG_CALIB_FRAC_REST"
            ]

            #            TopoCalibMoments.AODMomentsNames = ["ENG_CALIB_TOT"
            #                                                 ,"ENG_CALIB_OUT_L"
            #                                                #,"ENG_CALIB_OUT_M"
            #                                                # ,"ENG_CALIB_OUT_T"
            #                                                # ,"ENG_CALIB_DEAD_L"
            #                                                # ,"ENG_CALIB_DEAD_M"
            #                                                # ,"ENG_CALIB_DEAD_T"
            #                                                ,"ENG_CALIB_EMB0"
            #                                                ,"ENG_CALIB_EME0"
            #                                                ,"ENG_CALIB_TILEG3"
            #                                                ,"ENG_CALIB_DEAD_TOT"
            #                                                ,"ENG_CALIB_DEAD_EMB0"
            #                                                ,"ENG_CALIB_DEAD_TILE0"
            #                                                ,"ENG_CALIB_DEAD_TILEG3"
            #                                                ,"ENG_CALIB_DEAD_EME0"
            #                                                ,"ENG_CALIB_DEAD_HEC0"
            #                                                ,"ENG_CALIB_DEAD_FCAL"
            #                                                ,"ENG_CALIB_DEAD_LEAKAGE"
            #                                                ,"ENG_CALIB_DEAD_UNCLASS"
            #                                                ,"ENG_CALIB_FRAC_EM"
            #                                                ,"ENG_CALIB_FRAC_HAD"
            #                                                ,"ENG_CALIB_FRAC_REST"]
            TopoCalibMoments.CalibrationHitContainerNames = [
                "LArCalibrationHitInactive", "LArCalibrationHitActive",
                "TileCalibHitActiveCell", "TileCalibHitInactiveCell"
            ]
            TopoCalibMoments.DMCalibrationHitContainerNames = [
                "LArCalibrationHitDeadMaterial", "TileCalibHitDeadMaterial"
            ]
            CaloTopoCluster.ClusterCorrectionTools += [TopoCalibMoments]
            CaloTopoCluster += TopoCalibMoments

        #if jobproperties.CaloTopoClusterFlags.lockTopoClusterSamplingEnergies() or jobproperties.CaloTopoClusterFlags.lockTopoClusterSamplingVariables():
        #    CaloTopoCluster.ClusterCorrectionTools += [
        #        LockVariables.getFullName()]
        #    CaloTopoCluster += LockVariables

        CaloTopoCluster.ClusterCorrectionTools += [theCaloClusterSnapshot]
        CaloTopoCluster += theCaloClusterSnapshot

        if jobproperties.CaloTopoClusterFlags.doCellWeightCalib():
            CaloTopoCluster.ClusterCorrectionTools += [
                CellWeights.getFullName()
            ]
            CaloTopoCluster += CellWeights

        if jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib():
            CaloTopoCluster.ClusterCorrectionTools += [
                LocalCalib, OOCCalib, OOCPi0Calib, DMCalib
            ]

            CaloTopoCluster += LocalCalib
            CaloTopoCluster += OOCCalib
            CaloTopoCluster += OOCPi0Calib
            CaloTopoCluster += DMCalib

        #
        # pool/cool part
        #
        if jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib():
            from CaloRec import CaloClusterTopoCoolFolder
            if globalflags.DetDescrVersion().startswith("Rome"):
                CaloTopoCluster.LocalCalib.LCClassify.MaxProbability = 0.85
                CaloTopoCluster.LocalCalib.LCClassify.UseNormalizedEnergyDensity = False
            else:
                CaloTopoCluster.LocalCalib.LCClassify.MaxProbability = 0.50
                CaloTopoCluster.LocalCalib.LCClassify.UseNormalizedEnergyDensity = True

        self._handle = CaloTopoCluster

        objKeyStore.addManyTypesTransient(self.output())
        # only write main object in AOD
        # 2014-01-15 W.L. Remove objs from output streams  b/c of xAOD migration
        #objKeyStore.addStreamESD(self.outputType(),self.outputKey())
        #objKeyStore.addStreamESD("CaloShowerContainer",self.outputKey()+"_Data")
        #objKeyStore.addStreamESD("CaloCellLinkContainer",self.outputKey()+"_Link")
        #objKeyStore.addStreamAOD(self.outputType(),self.outputKey())

        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += CaloTopoCluster

        return True
示例#11
0
def getLArPileUpTool(name='LArPileUpTool', **kwargs): ## useLArFloat()=True,isOverlay()=False,outputKey='LArDigitContainer_MC'):
    from AthenaCommon.Logging import logging
    mlog = logging.getLogger( 'LArPileUpToolDefault:' )
    mlog.info(" ---- in getLArPileUpTool " )
    # the LAr and Calo detector description package
    ## FIXME includes to be replaced by confGetter configuration.
    if not isOverlay():
        from AthenaCommon.Resilience import protectedInclude
        protectedInclude( "CaloDetMgrDetDescrCnv/CaloDetMgrDetDescrCnv_joboptions.py" )
        protectedInclude( "LArDetDescr/LArDetDescr_joboptions.py" )
        protectedInclude("LArConditionsCommon/LArConditionsCommon_MC_jobOptions.py")
    from Digitization.DigitizationFlags import digitizationFlags
    kwargs.setdefault('NoiseOnOff', digitizationFlags.doCaloNoise.get_Value() )
    kwargs.setdefault('RndmSvc', digitizationFlags.rndmSvc.get_Value() )
    digitizationFlags.rndmSeedList.addSeed("LArDigitization", 1234, 5678 )
    kwargs.setdefault('DoDigiTruthReconstruction',digitizationFlags.doDigiTruth())

    if digitizationFlags.doXingByXingPileUp():
        kwargs.setdefault('FirstXing', -751 )
        kwargs.setdefault('LastXing', 101 )

    from LArDigitization.LArDigitizationFlags import jobproperties
    # check if using high gain for Fcal or not
    if  (not jobproperties.LArDigitizationFlags.useFcalHighGain()) and (not isOverlay()):
        mlog.info("do not use high gain in Fcal digitization ")
        kwargs.setdefault('HighGainThreshFCAL', 0 )
    else:
        mlog.info("use high gain in Fcal digitization or overlay job")

    # check if using high gain for EMEC IW or not
    if (not jobproperties.LArDigitizationFlags.useEmecIwHighGain()) and (not isOverlay()):
       mlog.info("do not use high gain in EMEC IW digitization ")
       kwargs.setdefault('HighGainThreshEMECIW',0)

    kwargs.setdefault('RndmEvtOverlay', isOverlay() )
    kwargs.setdefault('DigitContainer', 'LArDigitContainer_MC' ) ##FIXME - should not be hard-coded

    # if doing MC+MC overlay
    from AthenaCommon.GlobalFlags import globalflags
    if isOverlay() and globalflags.DataSource() == 'geant4':
        kwargs.setdefault('isMcOverlay',True)

    from LArROD.LArRODFlags import larRODFlags
    kwargs.setdefault('Nsamples', larRODFlags.nSamples() )
    kwargs.setdefault('firstSample', larRODFlags.firstSample() )

    if  isOverlay() :
         kwargs.setdefault('RandomDigitContainer', 'LArDigitContainer_MC' )

    # ADC2MeVTool
    mlog.info(" ----  set LArADC2MeVToolDefault")
    kwargs.setdefault('ADC2MeVTool', 'LArADC2MeVToolDefault')

    # Tool for noise autocorrelation generation
    kwargs.setdefault('AutoCorrNoiseTool', 'LArAutoCorrNoiseToolDefault')

    # bad channel masking
    from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool
    theLArBadChannelTool=LArBadChanTool()
    from AthenaCommon.AppMgr import ToolSvc
    ToolSvc+=theLArBadChannelTool
    from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
    theLArRCBMasker=LArBadChannelMasker("LArRCBMasker")
    theLArRCBMasker.TheLArBadChanTool = theLArBadChannelTool
    theLArRCBMasker.DoMasking=True
    theLArRCBMasker.ProblemsToMask=[
         "deadReadout","deadPhys"]
    ToolSvc+=theLArRCBMasker
    kwargs.setdefault('MaskingTool', theLArRCBMasker )
    kwargs.setdefault('BadChannelTool', theLArBadChannelTool )

    # CosmicTriggerTimeTool for cosmics digitization
    from AthenaCommon.BeamFlags import jobproperties
    if jobproperties.Beam.beamType == "cosmics" :
        from CommissionUtils.CommissionUtilsConf import CosmicTriggerTimeTool
        theTriggerTimeTool = CosmicTriggerTimeTool()
        ToolSvc += theTriggerTimeTool
        kwargs.setdefault('UseTriggerTime', True )
        kwargs.setdefault('TriggerTimeToolName', theTriggerTimeTool )


    # pileup configuration "algorithm" way
    if not digitizationFlags.doXingByXingPileUp():
        from AthenaCommon.DetFlags import DetFlags
        if DetFlags.pileup.LAr_on() or isOverlay():
            kwargs.setdefault('PileUp', True )

    kwargs.setdefault('useLArFloat', useLArFloat() )
    if useLArFloat():
        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
        from SGComps.SGCompsConf import AddressRemappingSvc
        AddressRemappingSvc = AddressRemappingSvc()
        svcMgr += AddressRemappingSvc
        from AthenaCommon.ConfigurableDb import getConfigurable
        svcMgr += getConfigurable( "ProxyProviderSvc" )()
        svcMgr.ProxyProviderSvc.ProviderNames += [ "AddressRemappingSvc" ]
        svcMgr.AddressRemappingSvc.TypeKeyOverwriteMaps = [ "LArHitContainer#LArHitEMB->LArHitFloatContainer#LArHitEMB" ,
                                                            "LArHitContainer#LArHitEMEC->LArHitFloatContainer#LArHitEMEC",
                                                            "LArHitContainer#LArHitHEC->LArHitFloatContainer#LArHitHEC",
                                                            "LArHitContainer#LArHitFCAL->LArHitFloatContainer#LArHitFCAL"]
        svcMgr.AddressRemappingSvc.ProxyDict="ActiveStoreSvc"


    return CfgMgr.LArPileUpTool(name, **kwargs)