示例#1
0
def LArHVCorrMonConfig(inputFlags):

    from AthenaMonitoring import AthMonitorCfgHelper
    helper = AthMonitorCfgHelper(inputFlags, 'LArHVCorrMonAlgCfg')

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    acc = LArGMCfg(inputFlags)
    from TileGeoModel.TileGMConfig import TileGMCfg
    acc.merge(TileGMCfg(inputFlags))
    from LArCalibUtils.LArHVScaleConfig import LArHVScaleCfg
    acc.merge(LArHVScaleCfg(inputFlags))

    from AthenaConfiguration.ComponentFactory import CompFactory
    LArHVCorrMonConfigCore(helper, CompFactory.LArHVCorrectionMonAlg,
                           inputFlags)

    acc.merge(helper.result())
    return acc
示例#2
0
def LArPileUpToolCfg(flags, name="LArPileUpTool", **kwargs):
    """Return ComponentAccumulator with configured LArPileUpTool"""
    acc = LArGMCfg(flags)

    #The LArPileupTool needs: Noise, fSampl, Pedestal,Shape ADC2MeV
    # AutoCorrNoise, the list of bad FEBs and the cabling
    acc.merge(LArADC2MeVCondAlgCfg(flags))
    acc.merge(LArBadFebCfg(flags))
    if flags.Overlay.DataOverlay:
        kwargs.setdefault("ShapeKey", "LArShape")
    if not flags.Digitization.DoCaloNoise:
        requiredConditons = ["fSampl", "Pedestal", "Shape"]
    else:
        requiredConditons = ["Noise", "fSampl", "Pedestal", "Shape"]
    acc.merge(LArElecCalibDbCfg(flags, requiredConditons))

    if not flags.Detector.OverlayLAr:
        acc.merge(LArAutoCorrNoiseCondAlgCfg(flags))
    if "MaskingTool" not in kwargs:
        maskerTool = acc.popToolsAndMerge(
            LArBadChannelMaskerCfg(flags, ["deadReadout", "deadPhys"],
                                   ToolName="LArRCBMasker"))
        kwargs["MaskingTool"] = maskerTool
    # defaults
    kwargs.setdefault("NoiseOnOff", flags.Digitization.DoCaloNoise)
    kwargs.setdefault("DoDigiTruthReconstruction",
                      flags.Digitization.DoDigiTruth)
    if flags.Digitization.DoXingByXingPileUp:
        kwargs.setdefault("FirstXing", -751)
        kwargs.setdefault("LastXing", 101)
    if (not flags.Digitization.HighGainFCal) and (
            not flags.Detector.OverlayLAr):
        kwargs.setdefault("HighGainThreshFCAL", 0)
    if (not flags.Digitization.HighGainEMECIW) and (
            not flags.Detector.OverlayLAr):
        kwargs.setdefault("HighGainThreshEMECIW", 0)
    kwargs.setdefault("RndmEvtOverlay", flags.Detector.OverlayLAr)
    if flags.Digitization.PileUpPremixing:
        kwargs.setdefault("DigitContainer",
                          flags.Overlay.BkgPrefix + "LArDigitContainer_MC")
    else:
        kwargs.setdefault(
            "DigitContainer",
            "LArDigitContainer_MC")  # FIXME - should not be hard-coded
    # if doing MC+MC overlay
    if flags.Input.isMC and flags.Detector.OverlayLAr:
        kwargs.setdefault("isMcOverlay", True)
    kwargs.setdefault("Nsamples", flags.LAr.ROD.nSamples)
    kwargs.setdefault("firstSample", flags.LAr.ROD.FirstSample)
    # cosmics digitization
    if flags.Beam.Type == "cosmics":
        kwargs.setdefault("UseTriggerTime", True)
        CosmicTriggerTimeTool = CompFactory.CosmicTriggerTimeTool
        kwargs.setdefault("TriggerTimeToolName", CosmicTriggerTimeTool())
    # pileup configuration "algorithm" way
    if not flags.Digitization.DoXingByXingPileUp:
        if flags.Digitization.Pileup or flags.Detector.OverlayLAr:
            kwargs.setdefault("PileUp", True)
    kwargs.setdefault("useLArFloat", useLArFloat(flags))
    if useLArFloat(flags):
        maps = [
            "LArHitContainer#LArHitEMB->LArHitFloatContainer#LArHitEMB",
            "LArHitContainer#LArHitEMEC->LArHitFloatContainer#LArHitEMEC",
            "LArHitContainer#LArHitHEC->LArHitFloatContainer#LArHitHEC",
            "LArHitContainer#LArHitFCAL->LArHitFloatContainer#LArHitFCAL"
        ]
        AddressRemappingSvc, ProxyProviderSvc = CompFactory.getComps(
            "AddressRemappingSvc",
            "ProxyProviderSvc",
        )
        acc.addService(
            AddressRemappingSvc(TypeKeyOverwriteMaps=maps,
                                ProxyDict="ActiveStoreSvc"))
        acc.addService(ProxyProviderSvc(ProviderNames=["AddressRemappingSvc"]))
        kwargs.setdefault("LArHitContainers", [])
    else:
        kwargs.setdefault("LArHitFloatContainers", [])
    if flags.Detector.OverlayLAr:
        kwargs.setdefault("OnlyUseContainerName", False)
        if flags.Overlay.DataOverlay:
            kwargs.setdefault("InputDigitContainer",
                              flags.Overlay.BkgPrefix + "FREE")
        else:
            kwargs.setdefault("InputDigitContainer",
                              flags.Overlay.BkgPrefix + "LArDigitContainer_MC")
    LArPileUpTool = CompFactory.LArPileUpTool
    acc.setPrivateTools(LArPileUpTool(name, **kwargs))
    return acc
示例#3
0
def TileCalCellMonAlgConfig(inputFlags, **kwargs):
    ''' Function to configure TileCalCellMonAlg algorithm in the monitoring system.'''

    kwargs.setdefault('MonGroupName', 'TileEventFiter')
    kwargs.setdefault('useBeamBackgroundRemoval', False)
    kwargs.setdefault('useLArNoisyAlg', False)
    kwargs.setdefault('useLArCollisionFilterTool', False)

    if not (inputFlags.Common.isOnline == 'online' or inputFlags.Input.isMC):
        kwargs.setdefault('useReadyFilterTool', True)
        kwargs.setdefault(
            'useBadLBTool',
            False)  # FIXME: when new LArBadLBFilterTool config is ready
    else:
        kwargs.setdefault('useReadyFilterTool', False)
        kwargs.setdefault('useBadLBTool', False)

    from AthenaCommon.SystemOfUnits import MeV
    kwargs.setdefault('EnergyThreshold', 300.0 * MeV)

    from AthenaMonitoring import AthMonitorCfgHelper
    helper = AthMonitorCfgHelper(inputFlags, 'TileCalMonCfg')

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    cfg = LArGMCfg(inputFlags)

    from TileGeoModel.TileGMConfig import TileGMCfg
    cfg.merge(TileGMCfg(inputFlags))

    from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
    cfg.merge(CaloNoiseCondAlgCfg(inputFlags))

    if kwargs['useLArCollisionFilterTool']:
        from LArCellRec.LArCollisionTimeConfig import LArCollisionTimeCfg
        cfg.merge(LArCollisionTimeCfg(inputFlags))

    if kwargs['useReadyFilterTool'] and 'ReadyFilterTool' not in kwargs:
        from AthenaMonitoring.AtlasReadyFilterConfig import AtlasReadyFilterCfg
        readyFilterTool = cfg.popToolsAndMerge(AtlasReadyFilterCfg(inputFlags))
        kwargs['ReadyFilterTool'] = readyFilterTool

    from AthenaConfiguration.ComponentFactory import CompFactory
    tileCalCellMonAlg = helper.addAlgorithm(CompFactory.TileCalCellMonAlg,
                                            'TileCalCellMonAlg')

    for k, v in kwargs.items():
        setattr(tileCalCellMonAlg, k, v)

    binLabels = [
        "TotalEvents", "ATLAS Ready", "with Good LAr LB",
        "with No LAr Collision", "with No Beam Background",
        "with No Trigger Filter", "with No LArError"
    ]

    if not tileCalCellMonAlg.useReadyFilterTool:
        binLabels[1] = "ATLAS Ready-OFF"
    if not tileCalCellMonAlg.useBadLBTool:
        binLabels[2] = "Good LAr LB-OFF"
    if not tileCalCellMonAlg.useLArCollisionFilterTool:
        binLabels[3] = "LAr collision-OFF"
    if not tileCalCellMonAlg.useBeamBackgroundRemoval:
        binLabels[4] = "Beam backgr.-OFF"
    if not tileCalCellMonAlg.useLArNoisyAlg:
        binLabels[5] = "LAr Error Veto-OFF"

    topPath = '/CaloMonitoring/TileCellMon_NoTrigSel/General/'
    tileFilterGroup = helper.addGroup(tileCalCellMonAlg,
                                      tileCalCellMonAlg.MonGroupName, topPath)

    from CaloMonitoring.CaloMonAlgBase import CaloBaseHistConfig
    CaloBaseHistConfig(tileFilterGroup, 'Summary/', binLabels)

    # 1) Configure histogram with TileCalCellMonAlg algorithm execution time
    executeTimeGroup = helper.addGroup(tileCalCellMonAlg,
                                       'TileCalCellMonExecuteTime', topPath)
    executeTimeGroup.defineHistogram(
        'TIME_execute',
        path='Summary',
        type='TH1F',
        title='Time for execute TileCalCellMonAlg algorithm;time [#mus]',
        xbins=100,
        xmin=0,
        xmax=100000)

    # 2) Configure histograms with occupancy maps over threshold (4 noise sigma) per Tile sample
    samplesWithoutE = ['A', 'BC', 'D', '']
    noiseEtaPhiArray = helper.addArray([len(samplesWithoutE)],
                                       tileCalCellMonAlg,
                                       'CellsNoiseXEtaVSPhi',
                                       topPath=topPath)
    for postfix, tool in noiseEtaPhiArray.Tools.items():
        sample = samplesWithoutE[int(postfix.split('_')[1])]
        title = ('Number of Tile Cells %s' %
                 sample) + ' with E > 4 sigma (DB);#eta;#phi'
        name = 'eta,phi;CellsNoiseXEtaVSPhi' + (sample +
                                                'cells' if sample else '')
        tool.defineHistogram(name,
                             title=title,
                             type='TH2F',
                             xbins=17,
                             xmin=-1.7,
                             xmax=1.7,
                             ybins=64,
                             ymin=-3.14,
                             ymax=3.14)

    # 3) Configure histogram with number of 4 sigma seeds per Tile hash ID
    noiseHashGroup = helper.addGroup(tileCalCellMonAlg, 'CellsXNoiseXHash',
                                     topPath)
    noiseHashGroup.defineHistogram(
        'hash;CellsXNoiseXHash',
        path='',
        type='TH1F',
        title='Number of 4 sigma seeds per hash;Tile Cell Hash ID;Events',
        xbins=5184,
        xmin=-0.5,
        xmax=5183.5)

    # 4) Configure histogram with Tile cell energy/noise (DB) ratio
    noiseHashGroup = helper.addGroup(tileCalCellMonAlg, 'CellsNoiseTile',
                                     topPath)
    noiseHashGroup.defineHistogram(
        'noise;CellsNoiseTile',
        path='',
        type='TH1F',
        title='Energy/Noise (DB) of TileCal;Cell Energy / sigma (DB);Events',
        xbins=200,
        xmin=-10.0,
        xmax=10.0)

    # 5) Configure histogram with mean Tile cell noise (DB) vs eta
    noiseEtaGroup = helper.addGroup(tileCalCellMonAlg, 'CellsNoiseXEta',
                                    topPath)
    noiseEtaGroup.defineHistogram(
        'eta,noise;CellsNoiseXEta',
        path='',
        type='TProfile',
        title=
        'Tile Cell noise #sigma (DB) vs #eta;#eta;Mean Cell noise (DB) [MeV]',
        xbins=17,
        xmin=-1.7,
        xmax=1.7)

    # 6) Configure histogram with mean Tile cell noise (DB) vs phi
    noisePhiGroup = helper.addGroup(tileCalCellMonAlg, 'CellsNoiseXPhi',
                                    topPath)
    noisePhiGroup.defineHistogram(
        'phi,noise;CellsNoiseXPhi',
        path='',
        type='TProfile',
        title=
        'Tile Cell noise #sigma (DB) vs #phi;#phi;Mean Cell noise (DB) [MeV]',
        xbins=64,
        xmin=-3.14,
        xmax=3.14)

    # 7) Configure histogram with number of Tile cell over threshold
    nCellsGroup = helper.addGroup(tileCalCellMonAlg, 'CellsXN', topPath)
    nCellsGroup.defineHistogram(
        'nCells;CellsXN',
        path='',
        type='TH1F',
        title=
        'Number of Tile Cells over threshold;Number of Tile Cells; Events',
        xbins=250,
        xmin=0,
        xmax=500)

    # 8) Configure histogram with Tile cell energy in GeV
    energyGroup = helper.addGroup(tileCalCellMonAlg, 'CellsXE', topPath)
    energyGroup.defineHistogram(
        'energy;CellsXE',
        path='',
        type='TH1F',
        title='Energy of Tile Cells;Tile Cell Energy [GeV]; Events',
        xbins=50,
        xmin=0,
        xmax=20)

    # 9) Configure histogram with mean Tile cell energy in GeV vs eta
    energyEtaGroup = helper.addGroup(tileCalCellMonAlg, 'CellsXEta', topPath)
    energyEtaGroup.defineHistogram(
        'eta,energy;CellsXEta',
        path='',
        type='TProfile',
        title='Tile Cell Energy vs #eta;#eta;Mean Cell Energy [GeV]',
        xbins=17,
        xmin=-1.7,
        xmax=1.7)

    # 10) Configure histogram with mean Tile cell energy in GeV vs phi
    energyPhiGroup = helper.addGroup(tileCalCellMonAlg, 'CellsXPhi', topPath)
    energyPhiGroup.defineHistogram(
        'phi,energy;CellsXPhi',
        path='',
        type='TProfile',
        title='Tile Cell Energy vs #phi;#phi;Mean Cell Energy [GeV]',
        xbins=64,
        xmin=-3.14,
        xmax=3.14)

    # 11) Configure histogram with mean Tile cell energy in GeV vs tower
    energyTowerGroup = helper.addGroup(tileCalCellMonAlg, 'CellsXTower',
                                       topPath)
    energyTowerGroup.defineHistogram(
        'tower,energy;CellsXTower',
        path='',
        type='TProfile',
        title='Tile Cell Energy vs tower;Tower;Mean Cell Energy [GeV]',
        xbins=18,
        xmin=0,
        xmax=18)

    # 12) Configure histogram with occupancy map over threshold vs eta and phi
    occupEtaPhiGroup = helper.addGroup(tileCalCellMonAlg, 'CellsXEtaVSPhi',
                                       topPath)
    occupEtaPhiTitle = (
        'Number of Tile Cell above threshold %s MeV;#eta;#phi' %
        kwargs['EnergyThreshold'])
    occupEtaPhiGroup.defineHistogram('eta,phi;CellsXEtaVSPhi',
                                     path='',
                                     type='TH2F',
                                     title=occupEtaPhiTitle,
                                     xbins=17,
                                     xmin=-1.7,
                                     xmax=1.7,
                                     ybins=64,
                                     ymin=-3.14,
                                     ymax=3.14)

    # 13) Configure histograms with mean Tile cell energy vs module per sample
    samples = ['A', 'BC', 'D', 'E']
    energyModuleArray = helper.addArray([len(samples)],
                                        tileCalCellMonAlg,
                                        'CellsXModule',
                                        topPath=topPath)
    for postfix, tool in energyModuleArray.Tools.items():
        sampleIdx = int(postfix.split('_')[1])
        sample = samples[sampleIdx]
        title = ('Tile Sampling %s' %
                 sample) + ';Module;Mean Cell Energy [GeV]'
        name = 'module,energy;CellsXModuleS' + str(sampleIdx + 1)
        tool.defineHistogram(name,
                             title=title,
                             type='TProfile',
                             xbins=64,
                             xmin=1,
                             xmax=65)

    accumalator = helper.result()
    cfg.merge(accumalator)
    return cfg