示例#1
0
class GenericMonitoringTool(_GenericMonitoringTool):
    """Configurable of a GenericMonitoringTool"""

    __slots__ = ['_convention', '_defaultDuration']

    def __init__(self, name=None, *args, **kwargs):
        self._convention = ''
        self._defaultDuration = kwargs.pop('defaultDuration', None)
        super(GenericMonitoringTool, self).__init__(name, *args, **kwargs)

    if not isRun3Cfg():

        def __new__(cls, name=None, *args, **kwargs):
            if not Configurable.configurableRun3Behavior:
                if name is None: name = cls.__name__

            # GenericMonitoringTool is always private. To avoid the user having
            # to ensure a unique instance name, always create a new instance.
            b = Configurable.configurableRun3Behavior
            Configurable.configurableRun3Behavior = 1
            try:
                conf = super(GenericMonitoringTool,
                             cls).__new__(cls, name, *args, **kwargs)
            finally:
                Configurable.configurableRun3Behavior = b

            return conf

    @property
    def convention(self):
        return self._convention

    @convention.setter
    def convention(self, value):
        self._convention = value

    @property
    def defaultDuration(self):
        return self._defaultDuration

    @defaultDuration.setter
    def defaultDuration(self, value):
        self._defaultDuration = value

    def _coreDefine(self, deffunc, *args, **kwargs):
        if 'convention' in kwargs:
            # only if someone really knows what they're doing
            pass
        else:
            duration = kwargs.pop('duration', self.defaultDuration)
            if duration is not None:
                kwargs['convention'] = self.convention + ':' + duration
        self.Histograms.append(deffunc(*args, **kwargs))

    def defineHistogram(self, *args, **kwargs):
        self._coreDefine(defineHistogram, *args, **kwargs)

    def defineTree(self, *args, **kwargs):
        self._coreDefine(defineTree, *args, **kwargs)
示例#2
0
def LArFEBMonConfigCore(helper,
                        algoinstance,
                        inputFlags,
                        cellDebug=False,
                        dspDebug=False):

    from LArMonitoring.GlobalVariables import lArDQGlobals

    larFEBMonAlg = helper.addAlgorithm(algoinstance, 'larFEBMonAlg')

    GroupName = "FEBMon"
    nslots = []
    for i in range(0, len(lArDQGlobals.FEB_Slot)):
        nslots.append(lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[i]][1])

    larFEBMonAlg.MonGroup = GroupName
    larFEBMonAlg.PartitionNames = lArDQGlobals.Partitions
    larFEBMonAlg.SubDetNames = lArDQGlobals.SubDet
    larFEBMonAlg.Streams = lArDQGlobals.defaultStreamNames

    isCOMP200 = False
    from AthenaConfiguration.ComponentFactory import isRun3Cfg
    if isRun3Cfg():
        if "COMP200" in inputFlags.IOVDb.DatabaseInstance:
            isCOMP200 = True
    else:
        from IOVDbSvc.CondDB import conddb
        if conddb.GetInstance() == 'COMP200':
            isCOMP200 = True

    if not isCOMP200:
        dbString = "<db>COOLONL_LAR/CONDBR2</db>"
        persClass = "AthenaAttributeList"
        fld = "/LAR/Configuration/DSPThresholdFlat/Thresholds"
        if isRun3Cfg():
            iovDbSvc = helper.resobj.getService("IOVDbSvc")
            condLoader = helper.resobj.getCondAlgo("CondInputLoader")
        else:
            from AthenaCommon import CfgGetter
            iovDbSvc = CfgGetter.getService("IOVDbSvc")
            from AthenaCommon.AlgSequence import AthSequencer
            condSeq = AthSequencer("AthCondSeq")
            condLoader = condSeq.CondInputLoader

        iovDbSvc.Folders.append(fld + dbString)
        condLoader.Load.append((persClass, fld))
        larFEBMonAlg.Run2DSPThresholdsKey = fld
    else:
        fld = '/LAR/Configuration/DSPThreshold/Thresholds'
        db = 'LAR_ONL'
        obj = 'LArDSPThresholdsComplete'
        if isRun3Cfg():
            helper.resobj.addFolderList(inputFlags, [(fld, db, obj)])
        else:
            conddb.addFolder(db, fld, className=obj)
        larFEBMonAlg.Run1DSPThresholdsKey = 'LArDSPThresholds'

    # adding LArFebErrorSummary algo
    if isRun3Cfg():
        from LArROD.LArFebErrorSummaryMakerConfig import LArFebErrorSummaryMakerCfg
        acc = LArFebErrorSummaryMakerCfg(inputFlags)
        helper.resobj.merge(acc)
    else:
        #put here what to do else
        pass
    Group = helper.addGroup(larFEBMonAlg, GroupName,
                            '/LAr/' + GroupName + 'NewAlg/')

    #Summary histos
    summary_hist_path = 'Summary/'

    #-- TTree for corrupted events timestamp
    Group.defineTree(
        'timestamp,time_ns,febHwId,febError;LArCorrupted',
        path=summary_hist_path,
        title='Timestamps of corrupted LAr events',
        treedef=
        'timestamp/i:time_ns/i:febHwId/vector<int>:febErrorType/vector<int>')

    Group.defineHistogram('nbFEB;NbOfReadoutFEBGlobal',
                          title='# of readout FEB/DSP header',
                          type='TH1I',
                          path=summary_hist_path,
                          xbins=lArDQGlobals.N_FEB + 11,
                          xmin=-0.5,
                          xmax=lArDQGlobals.N_FEB + 10 + 0.5)
    Group.defineHistogram(
        'nbFEBpart,part;NbOfEvts2d',
        title='# of readout FEB/DSP header:Num. FEBs:Partition',
        type='TH2I',
        path=summary_hist_path,
        xbins=lArDQGlobals.N_FEB_Parttions_Max,
        xmin=-0.5,
        xmax=lArDQGlobals.N_FEB_Parttions_Max - 0.5,
        ybins=lArDQGlobals.N_Partitions,
        ymin=-0.5,
        ymax=lArDQGlobals.N_Partitions - 0.5,
        ylabels=lArDQGlobals.Partitions)
    Group.defineHistogram('febError,part;NbOfLArFEBMonErrors_dE',
                          title='# of data corruption errors',
                          type='TH2I',
                          path=summary_hist_path,
                          xbins=lArDQGlobals.N_FEBErrors,
                          xmin=0.5,
                          xmax=lArDQGlobals.N_FEBErrors + 0.5,
                          ybins=lArDQGlobals.N_Partitions,
                          ymin=-0.5,
                          ymax=lArDQGlobals.N_Partitions - 0.5,
                          xlabels=lArDQGlobals.FEBErrors,
                          ylabels=lArDQGlobals.Partitions)
    Group.defineHistogram(
        'dspThrADC;dspThresholdsADC',
        title=
        'DSP thresholds to readout samples:Number of cells:Cell threshold in ADC counts',
        type='TH1I',
        path=summary_hist_path,
        xbins=lArDQGlobals.DSPThr_Bins + 1,
        xmin=-0.5,
        xmax=lArDQGlobals.DSPThr_Bins + 0.5)
    Group.defineHistogram(
        'dspThrQT;dspThresholds_qfactortime',
        title=
        'DSP thresholds to readout (qfactor+time):Number of cells:Cell threshold in ADC counts',
        type='TH1I',
        path=summary_hist_path,
        xbins=lArDQGlobals.DSPThr_Bins + 1,
        xmin=-0.5,
        xmax=lArDQGlobals.DSPThr_Bins + 0.5)
    Group.defineHistogram('EvtType;Eventtype',
                          title='Event type (1st readout FEB)',
                          type='TH1I',
                          path=summary_hist_path,
                          xbins=lArDQGlobals.Evt_Bins,
                          xmin=lArDQGlobals.Evt_Min,
                          xmax=lArDQGlobals.Evt_Max,
                          xlabels=lArDQGlobals.Evt_labels)
    Group.defineHistogram(
        'LVL1Trig;TriggerWord',
        title='Number of Events per L1 trigger word (8 bits):L1 trigger word',
        type='TH1I',
        path=summary_hist_path,
        xbins=lArDQGlobals.L1Trig_Bins,
        xmin=lArDQGlobals.L1Trig_Min,
        xmax=lArDQGlobals.L1Trig_Max)
    Group.defineHistogram(
        'LVL1TrigAllDSP;TriggerWordAllDSP',
        title='Number of L1 trigger word per DSP (8 bits):L1 trigger word',
        type='TH1I',
        path=summary_hist_path,
        xbins=lArDQGlobals.L1Trig_Bins,
        xmin=lArDQGlobals.L1Trig_Min,
        xmax=lArDQGlobals.L1Trig_Max)
    Group.defineHistogram('EvtRej;EventsRejected',
                          title='Nb of events rejected (at least one error)',
                          type='TH1I',
                          path=summary_hist_path,
                          xbins=lArDQGlobals.EvtRej_Bins,
                          xmin=lArDQGlobals.EvtRej_Min,
                          xmax=lArDQGlobals.EvtRej_Max,
                          xlabels=lArDQGlobals.EvtRej_labels)
    Group.defineHistogram(
        'EvtRej,EvtRejYield1D;EventsRejectedYield',
        title='Data corruption yield:Corruption type:Yield(%)',
        type='TProfile',
        path=summary_hist_path,
        xbins=lArDQGlobals.EvtRej_Bins - 1,
        xmin=lArDQGlobals.EvtRej_Min,
        xmax=lArDQGlobals.EvtRej_Max - 1,
        xlabels=lArDQGlobals.EvtRejYield_labels)
    Group.defineHistogram(
        'LB0,EvtRejYield;YieldOfRejectedEventsVsLB',
        title=
        'Yield of corrupted events (DATACORRUPTED):Luminosity Block:Yield(%)',
        type='TProfile',
        path=summary_hist_path,
        xbins=lArDQGlobals.LB_Bins,
        xmin=lArDQGlobals.LB_Min,
        xmax=lArDQGlobals.LB_Max)
    Group.defineHistogram(
        'LB0,EvtRejYieldOut;YieldOfRejectedEventsVsLBout',
        title=
        'Yield of corrupted events (DATACORRUPTED) not vetoed by time window:Luminosity Block:Yield(%)',
        type='TProfile',
        path=summary_hist_path,
        xbins=lArDQGlobals.LB_Bins,
        xmin=lArDQGlobals.LB_Min,
        xmax=lArDQGlobals.LB_Max)
    Group.defineHistogram(
        'rejBits;rejectionBits',
        title=
        'Errors at the origin of event rejection:Bits:Number of (rejected) events',
        type='TH1I',
        path=summary_hist_path,
        xbins=lArDQGlobals.rejBits_Bins,
        xmin=-0.5,
        xmax=lArDQGlobals.rejBits_Bins - 0.5)
    Group.defineHistogram('LB0;NbOfEventsVsLB',
                          title='Nb of events per LB:Luminosity Block',
                          type='TH1I',
                          path=summary_hist_path,
                          xbins=lArDQGlobals.LB_Bins,
                          xmin=lArDQGlobals.LB_Min,
                          xmax=lArDQGlobals.LB_Max)
    Group.defineHistogram(
        'NbOfSweet2;NbOfSw2',
        title=
        '# of cells with samples readout:Number of cells:Number of events',
        type='TH1I',
        path=summary_hist_path,
        xbins=int(lArDQGlobals.N_Cells / 10),
        xmin=-1000,
        xmax=lArDQGlobals.N_Cells - 1000)
    Group.defineHistogram(
        'LB0,LArEvSize;eventSizeVsLB',
        title='LAr event size (w/o ROS headers):Luminosity Block:Megabytes',
        type='TProfile',
        path=summary_hist_path,
        xbins=lArDQGlobals.LB_Bins,
        xmin=lArDQGlobals.LB_Min,
        xmax=lArDQGlobals.LB_Max)
    Group.defineHistogram(
        'NbOfSamp;NbOfSamples',
        title='# of samples (1st readout FEB):Samples:Number of events',
        type='TH1I',
        path=summary_hist_path,
        xbins=lArDQGlobals.Samples_Bins,
        xmin=lArDQGlobals.Samples_Min,
        xmax=lArDQGlobals.Samples_Max)

    isOnline = False
    if isRun3Cfg():
        if inputFlags.DQ.Environment == 'online':
            isOnline = True
    else:
        from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
        if athenaCommonFlags.isOnline:
            isOnline = True

    if isOnline:
        Group.defineHistogram(
            'LBf,EvtRejYield;EventsRejectedLB',
            titile='% of events rejected in current LB (online only)',
            type='TProfile',
            path=summary_hist_path,
            xbins=1,
            xmin=0,
            xmax=1,
            xlabels=['% of events'])
        Group.defineHistogram(
            'LB,streamBin,LArEvSizePart;eventSizeStreamVsLB',
            titile='LAr event size per stream per LB (w/o ROS headers)',
            type='TProfile2D',
            path=summary_hist_path,
            xbins=lArDQGlobals.LB_Bins,
            xmin=lArDQGlobals.LB_Min,
            xmax=lArDQGlobals.LB_Max,
            ybins=len(larFEBMonAlg.Streams),
            ymin=-0.5,
            ymax=len(larFEBMonAlg.Streams) - 0.5,
            ylabels=larFEBMonAlg.Streams)

    # Now per partition histograms
    for subdet in range(0, lArDQGlobals.N_SubDet):
        hist_path = '/LAr/' + GroupName + 'NewAlg/' + lArDQGlobals.SubDet[
            subdet] + '/'
        slot_low = lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[subdet *
                                                                 2]][0] - 0.5
        slot_up = lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[subdet *
                                                                2]][1] + 0.5
        slot_n = int(slot_up - slot_low)
        ft_low = lArDQGlobals.FEB_Feedthrough[lArDQGlobals.Partitions[
            subdet * 2]][0] - 0.5
        ft_up = lArDQGlobals.FEB_Feedthrough[lArDQGlobals.Partitions[
            subdet * 2]][1] + 0.5
        ft_n = int(ft_up - ft_low)

        darray = helper.addArray(
            [lArDQGlobals.Partitions[2 * subdet:2 * subdet + 2]], larFEBMonAlg,
            lArDQGlobals.SubDet[subdet])

        darray.defineHistogram('slotPar,FTPar;Parity',
                               title='Parity error:Slot:FT',
                               type='TH2I',
                               path=hist_path,
                               xbins=slot_n,
                               xmin=slot_low,
                               xmax=slot_up,
                               ybins=ft_n,
                               ymin=ft_low,
                               ymax=ft_up)

        darray.defineHistogram(
            'slotBcid,FTBcid;BCID',
            title='BCID mismatch betw. 2 halves of FEB:Slot:FT',
            type='TH2I',
            path=hist_path,
            xbins=slot_n,
            xmin=slot_low,
            xmax=slot_up,
            ybins=ft_n,
            ymin=ft_low,
            ymax=ft_up)

        darray.defineHistogram(
            'slotRadd,FTRadd;RADD',
            title='Sample header mismatch betw. 2 halves of FEB:Slot:FT',
            type='TH2I',
            path=hist_path,
            xbins=slot_n,
            xmin=slot_low,
            xmax=slot_up,
            ybins=ft_n,
            ymin=ft_low,
            ymax=ft_up)

        darray.defineHistogram(
            'slotEvtid,FTEvtid;EVTID',
            title='EVTID mismatch betw. 2 halves of FEB:Slot:FT',
            type='TH2I',
            path=hist_path,
            xbins=slot_n,
            xmin=slot_low,
            xmax=slot_up,
            ybins=ft_n,
            ymin=ft_low,
            ymax=ft_up)

        darray.defineHistogram(
            'slotScac,FTScac;SCACStatus',
            title='Wrong SCAC status in one half of a FEB:Slot:FT',
            type='TH2I',
            path=hist_path,
            xbins=slot_n,
            xmin=slot_low,
            xmax=slot_up,
            ybins=ft_n,
            ymin=ft_low,
            ymax=ft_up)

        darray.defineHistogram('slotscout,FTscout;scaOutOfRange',
                               title='Sca out of range:Slot:FT',
                               type='TH2I',
                               path=hist_path,
                               xbins=slot_n,
                               xmin=slot_low,
                               xmax=slot_up,
                               ybins=ft_n,
                               ymin=ft_low,
                               ymax=ft_up)

        darray.defineHistogram(
            'slotgain,FTgain;gainMismatch',
            title='Gain mismatch within time samples:Slot:FT',
            type='TH2I',
            path=hist_path,
            xbins=slot_n,
            xmin=slot_low,
            xmax=slot_up,
            ybins=ft_n,
            ymin=ft_low,
            ymax=ft_up)

        darray.defineHistogram('slottype,FTtype;typeMismatch',
                               title='Event type mismatch:Slot:FT',
                               type='TH2I',
                               path=hist_path,
                               xbins=slot_n,
                               xmin=slot_low,
                               xmax=slot_up,
                               ybins=ft_n,
                               ymin=ft_low,
                               ymax=ft_up)

        darray.defineHistogram('slotsmp,FTsmp;badNbOfSamp',
                               title='Non uniform number of samples:Slot:FT',
                               type='TH2I',
                               path=hist_path,
                               xbins=slot_n,
                               xmin=slot_low,
                               xmax=slot_up,
                               ybins=ft_n,
                               ymin=ft_low,
                               ymax=ft_up)

        darray.defineHistogram('slotzero,FTzero;zeroSamp',
                               title='Empty FEB data blocks:Slot:FT',
                               type='TH2I',
                               path=hist_path,
                               xbins=slot_n,
                               xmin=slot_low,
                               xmax=slot_up,
                               ybins=ft_n,
                               ymin=ft_low,
                               ymax=ft_up)

        darray.defineHistogram('slotsum,FTsum;checkSum',
                               title='Checksum / DSP block size:Slot:FT',
                               type='TH2I',
                               path=hist_path,
                               xbins=slot_n,
                               xmin=slot_low,
                               xmax=slot_up,
                               ybins=ft_n,
                               ymin=ft_low,
                               ymax=ft_up)

        darray.defineHistogram('slotmis,FTmis;missingHeader',
                               title='Missing header :Slot:FT',
                               type='TH2I',
                               path=hist_path,
                               xbins=slot_n,
                               xmin=slot_low,
                               xmax=slot_up,
                               ybins=ft_n,
                               ymin=ft_low,
                               ymax=ft_up)

        darray.defineHistogram('slotgain,FTgain;badGain',
                               title='Bad gain :Slot:FT',
                               type='TH2I',
                               path=hist_path,
                               xbins=slot_n,
                               xmin=slot_low,
                               xmax=slot_up,
                               ybins=ft_n,
                               ymin=ft_low,
                               ymax=ft_up)

        darray.defineHistogram(
            'slotabs,FTabs;LArFEBMonErrorsAbsolute',
            title='Nb of events with at least one error :Slot:FT',
            type='TH2I',
            path=hist_path,
            xbins=slot_n,
            xmin=slot_low,
            xmax=slot_up,
            ybins=ft_n,
            ymin=ft_low,
            ymax=ft_up)

        darray.defineHistogram(
            'slotmist,FTmist;missingTriggerType',
            title=
            'LVL1 trigger type missing or different from event type :Slot:FT',
            type='TH2I',
            path=hist_path,
            xbins=slot_n,
            xmin=slot_low,
            xmax=slot_up,
            ybins=ft_n,
            ymin=ft_low,
            ymax=ft_up)

        darray.defineHistogram(
            'slotnb,FTnb;nbOfEvts',
            title='Nb of events (DSP header check only) :Slot:FT',
            type='TH2I',
            path=hist_path,
            xbins=slot_n,
            xmin=slot_low,
            xmax=slot_up,
            ybins=ft_n,
            ymin=ft_low,
            ymax=ft_up)

        darray.defineHistogram(
            'slotnb,FTnb,weightsweet1;NbOfSweet1PerFEB',
            title='Average # of cells with (qfactor+time) readout :Slot:FT',
            type='TProfile2D',
            path=hist_path,
            xbins=slot_n,
            xmin=slot_low,
            xmax=slot_up,
            ybins=ft_n,
            ymin=ft_low,
            ymax=ft_up)

        darray.defineHistogram(
            'slotnb,FTnb,weightsweet2;NbOfSweet2PerFEB',
            title='Average # of cells with samples readout :Slot:FT',
            type='TProfile2D',
            path=hist_path,
            xbins=slot_n,
            xmin=slot_low,
            xmax=slot_up,
            ybins=ft_n,
            ymin=ft_low,
            ymax=ft_up)

        darray.defineHistogram(
            'nbFEBpart;nbOfFebBlocks',
            title='# of readout FEBs (DSP header check only) :Slot:FT',
            type='TH1I',
            path=hist_path,
            xbins=lArDQGlobals.N_FEB_Parttions_Max,
            xmin=-0.5,
            xmax=lArDQGlobals.N_FEB_Parttions_Max - 0.5)

        darray.defineHistogram(
            'slotMasked,FTMasked;knownFaultyFEB',
            title='FEB with known errors (1:err. ignored 2:FEB masked):Slot:FT',
            type='TH2I',
            path=hist_path,
            xbins=slot_n,
            xmin=slot_low,
            xmax=slot_up,
            ybins=ft_n,
            ymin=ft_low,
            ymax=ft_up)

        darray.defineHistogram(
            'LB,LArEvSizePart;eventSizeVsLB',
            title='LAr event size per LB (w/o ROS headers):Luminosity Block',
            type='TProfile',
            path=hist_path,
            xbins=lArDQGlobals.LB_Bins,
            xmin=lArDQGlobals.LB_Min,
            xmax=lArDQGlobals.LB_Max)

        if isOnline:
            darray.defineHistogram(
                'LBf,erronl;EventsRejectedLB',
                titile='% of events rejected in current LB (online only)',
                type='TProfile',
                path=hist_path,
                xbins=1,
                xmin=0,
                xmax=1,
                xlabels=['% of events'])
            darray.defineHistogram(
                'LB,streamBin,LArEvSizePart;eventSizeStreamVsLB',
                titile='LAr event size per stream per LB (w/o ROS headers)',
                type='TProfile2D',
                path=hist_path,
                xbins=lArDQGlobals.LB_Bins,
                xmin=lArDQGlobals.LB_Min,
                xmax=lArDQGlobals.LB_Max,
                ybins=len(larFEBMonAlg.Streams),
                ymin=-0.5,
                ymax=len(larFEBMonAlg.Streams) - 0.5,
                ylabels=larFEBMonAlg.Streams)
        pass
示例#3
0
def LArCellMonConfigCore(helper, algclass, inputFlags, isCosmics=False, isMC=False, algname='LArCellMonAlg'):


    LArCellMonAlg = helper.addAlgorithm(algclass, algname)

    if isCosmics:
       badChanMaskProblems=["deadReadout","deadPhys","short","sporadicBurstNoise","highNoiseHG","highNoiseMG","highNoiseLG"]
    else: 
       badChanMaskProblems=["deadReadout","deadPhys","almostDead","short","sporadicBurstNoise","unstableNoiseLG","unstableNoiseMG","unstableNoiseHG","highNoiseHG","highNoiseMG","highNoiseLG"]

    from AthenaConfiguration.ComponentFactory import isRun3Cfg
    if isRun3Cfg():
       from LArBadChannelTool.LArBadChannelConfig import LArBadChannelMaskerCfg

       acc= LArBadChannelMaskerCfg(inputFlags,problemsToMask=badChanMaskProblems,ToolName="BadLArRawChannelMask")
       LArCellMonAlg.LArBadChannelMask=acc.popPrivateTools()
       helper.resobj.merge(acc)
    else:
       from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
       theLArBadChannelsMasker=LArBadChannelMasker("BadLArRawChannelMask")
       theLArBadChannelsMasker.DoMasking=True
       theLArBadChannelsMasker.ProblemsToMask=badChanMaskProblems
       LArCellMonAlg.LArBadChannelMask=theLArBadChannelsMasker

    if not isCosmics and not isMC:
        LArCellMonAlg.useReadyFilterTool=True
    else:
        LArCellMonAlg.useReadyFilterTool=False

    if isMC:
        LArCellMonAlg.useBadLBTool=False
    else:
        LArCellMonAlg.useBadLBTool=True

# FIXME: to be added:    if isCosmics or rec.triggerStream()!='CosmicCalo':
    LArCellMonAlg.useBeamBackgroundRemoval = False
# FIXME: to be added:    else:
# FIXME: to be added:       LArCellMonAlg.useBeamBackgroundRemoval = True

    GroupName="LArCellMon"
    LArCellMonAlg.MonGroupName = GroupName
    LArCellMonAlg.MonGroupName_perJob = GroupName+"PerJob"
    LArCellMonAlg.MonGroupName_OccupancyEtaPhi = GroupName+"_OccupancyEtaPhi"
    LArCellMonAlg.MonGroupName_PercentageOccupancyEtaPhi = GroupName+"_PercentageOccupancyEtaPhi"
    LArCellMonAlg.MonGroupName_OccupancyEta = GroupName+"_OccupancyEta"
    LArCellMonAlg.MonGroupName_OccupancyPhi = GroupName+"_OccupancyPhi"
    LArCellMonAlg.MonGroupName_TotEnergyEtaPhi = GroupName+"_TotEnergyEtaPhi"
    LArCellMonAlg.MonGroupName_AvgQualityEtaPhi = GroupName+"_AvgQualityEtaPhi"
    LArCellMonAlg.MonGroupName_FractionOverQthEtaPhi = GroupName+"_FractionOverQthEtaPhi"
    LArCellMonAlg.MonGroupName_AvgTimeEtaPhi = GroupName+"_AvgTimeEtaPhi"
    LArCellMonAlg.MonGroupName_FractionPastTthEtaPhi = GroupName+"_FractionPastTthEtaPhi"


    LArCellMonAlg.EnableLumi = True
    
    LArCellMonAlg.Sporadic_switch = isCosmics
    

    LArCellMonAlg.Threshold_EM_S0S1=5000.
    LArCellMonAlg.Threshold_HECFCALEMS2S3=15000.

    from CaloMonitoring.LArCellBinning import lArCellBinningScheme

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


    # Global Settings:

    # All 2D plot occupancy are activate only for express and cosmiccalo
#FIXME to be added     if (isCosmics or rec.triggerStream()=='CosmicCalo' or rec.triggerStream()=='express' or rec.triggerStream()=='Main' or rec.triggerStream()<=='ZeroBias') or (inputFlags.Common.isOnline):
#FIXME to be added        do2DOcc = True
#FIXME to be added    else:
#FIXME to be added        do2DOcc = False

    do2DOcc = True #TMP


    thresholdDict = {}
    thresholdDict["ThresholdType"]         = [ "noEth_CSCveto", "noEth_rndm_CSCveto", "medEth_CSCveto", "5Sigma_CSCveto", "hiEth_CSCveto", "hiEth_noVeto", "met_CSCveto"  ]
    thresholdDict["ThresholdDirection"]     = [ "none" , "none"      , "both"  , "both"  , "over" , "over"        , "over" ]
    thresholdDict["TriggersToInclude"]      = [ "all"  , "all"       , "all"   , "all"   , "all"  , "all"         , "met"  ]
    thresholdDict["TriggersToExclude"]      = [ "none" , "none"      , "none"  , "none"  , "none" , "none"        , "none" ]

    thresholdDict["DoPercentageOccupancy"]  = [ True  , False       , True    , False   , False  , False         , False  ]
    thresholdDict["DoEtaPhiOccupancy"]      = [ True  , False       , False   , do2DOcc,do2DOcc, do2DOcc      , False  ]
    thresholdDict["DoEtaOccupancy"]         = [ False  , False       , isCosmics   , False   , False  , False         , False  ]
    thresholdDict["DoPhiOccupancy"]         = [ False  , False       , True    , False   , False  , False         , False  ]

    thresholdDict["DoEtaPhiAverageEnergy"]  = [ False  , do2DOcc    , False   , do2DOcc  , False   , False        , False  ]
    thresholdDict["DoEtaPhiTotalEnergy"]    = [ False  , False       , False   , False   , False   , False        , False  ]
    thresholdDict["DoEtaPhiEnergyRMS"]      = [ False  , False       , False   , False   , False   , False        , False  ]
    thresholdDict["DoEtaPhiRMSvsDBnoise"]   = [ False  , False       , False   , False   , False   , False        , False  ] 

    thresholdDict["DoEtaPhiAverageQuality"] = [ False  , False       , False   , False   , False   , False        , False  ]
    thresholdDict["DoEtaPhiFractionOverQth"]= [ False  , False       , False   , False   , do2DOcc , do2DOcc      , False  ]
    thresholdDict["QualityFactorThreshold"] = [ 4000. ]*7

    thresholdDict["DoEtaPhiAverageTime"]    = [ False  , False       , False   , (not isCosmics)    , False   , False        , False  ]
    thresholdDict["DoEtaPhiFractionPastTth"]= [ False  , False       , False   , (not isCosmics)    , False   , False        , False  ]
    thresholdDict["TimeThreshold"]          = [ 4.      ]*7
    thresholdDict["ThresholdTitleTemplates"]= ["no Threshold",
                                               "no Threshold",
                                               "|E_{cell}| > %0.f#sigma_{noise}^{database}",
                                               "E_{cell} beyond %0.f#sigma_{noise}^{database}",
                                               "E_{cell} > %0.f MeV",
                                               "E_{cell} > %0.f MeV",
                                               "E_{cell} > %0.f MeV, MET trigger"]

    thresholdDict["DefaultThresholds"]     = [-4000000.,-4000000.    , 3.      , 5.      , 500.   , 500.          , 1000.  ]
    thresholdDict["ThresholdinSigNoise"]   = [ False   , False       , True    , True    , False  , False         , False  ]


    #check that thresholds are set properly before passing them to the algorithm
    nthr = len(thresholdDict["ThresholdType"])
    if not all(len(thrProp)==nthr for thrProp in thresholdDict.values()):
        from AthenaCommon.Logging import logging
        mlog = logging.getLogger( 'LArCellMonLog' )
        mlog.error("LArCellMonAlg:: CONFIGURATION ERROR, threshold properties have different lenght. Please check CaloMonitoring/python/LArCellMonAlg.py")
        exit(1)
        pass


    LArCellMonAlg.ThresholdType = thresholdDict["ThresholdType"]

    LArCellMonAlg.ThresholdDirection     = thresholdDict["ThresholdDirection"]
    LArCellMonAlg.TriggersToInclude      = thresholdDict["TriggersToInclude"]
    LArCellMonAlg.TriggersToExclude      = thresholdDict["TriggersToExclude"]

    LArCellMonAlg.QualityFactorThreshold = thresholdDict["QualityFactorThreshold"]
    
    LArCellMonAlg.TimeThreshold          = thresholdDict["TimeThreshold"]

    LArCellMonAlg.DoBeamBackgroundRemoval=[( "CSCveto" in thr ) for thr in thresholdDict["ThresholdType"]]

    # Defaults: (Can be over ridden by layer specific values) ; plots will be made for all layers with DefaultThreshold != -9999999
    LArCellMonAlg.ThresholdTitleTemplates= thresholdDict["ThresholdTitleTemplates"]

    LArCellMonAlg.DefaultThresholds     = thresholdDict["DefaultThresholds"] 
    LArCellMonAlg.ThresholdinSigNoise   = thresholdDict["ThresholdinSigNoise"]

    LArCellMonAlg.ThresholdColumnType   = ["hiEth_CSCveto", "hiEth_noVeto"]
    # EMB
    LArCellMonAlg.EMBP_Thresh           = [ 800.  , 800.          ]
    LArCellMonAlg.EMB1_Thresh           = [ 600.  , 600.          ]
    LArCellMonAlg.EMB2_Thresh           = [ 600.  , 600.          ]
    LArCellMonAlg.EMB3_Thresh           = [ 600.  , 600.          ]
    # EMEC
    LArCellMonAlg.EMECP_Thresh          = [ 1200. , 1200.         ]
    LArCellMonAlg.EMEC1_Thresh          = [ 800.  , 800.          ]
    LArCellMonAlg.EMEC2_Thresh          = [ 800.  , 800.          ]
    LArCellMonAlg.EMEC3_Thresh          = [ 800.  , 800.          ]
    # HEC
    LArCellMonAlg.HEC0_Thresh           = [ 4000. , 4000.         ]
    LArCellMonAlg.HEC1_Thresh           = [ 4000. , 4000.         ]
    LArCellMonAlg.HEC2_Thresh           = [ 4000. , 4000.         ]
    LArCellMonAlg.HEC3_Thresh           = [ 4000. , 4000.         ]
    # FCAL
    LArCellMonAlg.FCAL1_Thresh          = [ 6000. , 6000.         ]
    LArCellMonAlg.FCAL2_Thresh          = [ 6000. , 6000.         ]
    LArCellMonAlg.FCAL3_Thresh          = [ 6000. , 6000.         ]
   
    #set the string arrays for the groups
    LArCellMonAlg.DoEtaPhiTotalOccupancyNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if ( thresholdDict["DoEtaPhiOccupancy"][i_thr] and not thresholdDict["DoPercentageOccupancy"][i_thr] ) 
                            or thresholdDict["DoEtaPhiAverageEnergy"][i_thr] 
                            or thresholdDict["DoEtaPhiAverageQuality"][i_thr] 
                            or thresholdDict["DoEtaPhiAverageTime"][i_thr]]

    LArCellMonAlg.DoEtaPhiPercentageOccupancyNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaPhiOccupancy"][i_thr] and thresholdDict["DoPercentageOccupancy"][i_thr]]

    LArCellMonAlg.DoEtaOccupancyNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaOccupancy"][i_thr]]
    LArCellMonAlg.DoPhiOccupancyNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoPhiOccupancy"][i_thr]]
    LArCellMonAlg.DoEtaPhiTotEnergyNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaPhiTotalEnergy"][i_thr] or thresholdDict["DoEtaPhiAverageEnergy"][i_thr]]
    LArCellMonAlg.DoEtaPhiAvgQualityNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaPhiAverageQuality"][i_thr]]
    LArCellMonAlg.DoEtaPhiFractionOverQthNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaPhiFractionOverQth"][i_thr]]
    LArCellMonAlg.DoEtaPhiAvgTimeNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaPhiAverageTime"][i_thr]]
    LArCellMonAlg.DoEtaPhiFractionPastTthNames=[thr for i_thr,thr in enumerate(thresholdDict["ThresholdType"]) if thresholdDict["DoEtaPhiFractionPastTth"][i_thr]]

   #---Groups and arrays


#FIXME: need option to switch between weightedEfficiency and weightedAverage (depends on when the average  is computed: if post-processing is done after merging, I don't want 'weightedMerge' options, otherwise I do. Not implemented for now)

   #---single Group for non threshold histograms
    cellMonGroup = helper.addGroup(
        LArCellMonAlg,
        GroupName,
        '/CaloMonitoring/LArCellMon_NoTrigSelNewAlg/'

    )


    #--define histograms
    # Summary
    summ_hist_path='Summary/'

    from CaloMonitoring.CaloMonAlgBase import CaloBaseHistConfig
    CaloBaseHistConfig(cellMonGroup,summ_hist_path,binlabels)  

    cellMonGroup.defineHistogram('trigType;nEvtsByTrigger',
                                 title='Total Events: bin 0, RNDM Trigger: 1, Calo Trigger: 2, MinBias Trigger: 3, MET Trigger: 4, Misc Trigger: 5, Events Selected for Noise Plots: 6 ',
                                 type='TH1I', path=summ_hist_path,
                                 xbins=lArCellBinningScheme.larCellSummary["xbins"][0], xmin=lArCellBinningScheme.larCellSummary["xbins"][1], xmax=lArCellBinningScheme.larCellSummary["xbins"][2],
                                 xlabels=lArCellBinningScheme.larCellSummary["xlabels"])

    #total events, saved if percentage occupancy is required
    cellMonGroup.defineHistogram('eventCounter;nEvtsPerThreshold',
                                 title='Events events passed Trigger and Background removal for each threshold (for normalisation)',
                                 type='TH1I', path=summ_hist_path,
                                 xbins=len(thresholdDict["ThresholdType"]),xmin=-0.5, xmax=(len(thresholdDict["ThresholdType"])-0.5),
                                 xlabels=thresholdDict["ThresholdType"])

    # En.
    LArCellMonAlg.doUnnormalized1DEnergy=True
    energy_hist_path='Energy/'
    if not isCosmics:
        for part in LArCellMonAlg.LayerNames:
            cellMonGroup.defineHistogram('cellEnergy_'+part+';CellEnergy_'+part,
                                         title='Cell Energy in ' +part+' with CSC veto;Cell Energy [MeV];Cell Events',
                                         type='TH1F', path=energy_hist_path,
                                         xbins=lArCellBinningScheme.logEnergyBins)
            pass
    elif isCosmics:   
        for part in LArCellMonAlg.LayerNames:
            cellMonGroup.defineHistogram('cellEnergy_'+part+';CellEnergy_'+part,
                                         title='Cell Energy in ' +part+' with CSC veto;Cell Energy [MeV];Cell Events',
                                         type='TH1F', path=energy_hist_path,
                                         xbins=lArCellBinningScheme.cosmicEneBinning[part][0], xmin=lArCellBinningScheme.cosmicEneBinning[part][1], xmax=lArCellBinningScheme.cosmicEneBinning[part][2])
            pass     
    else:   
        for part in LArCellMonAlg.LayerNames:
            cellMonGroup.defineHistogram('cellEnergy_'+part+';CellEnergy_'+part,
                                         title='Cell Energy in ' +part+' with CSC veto;Cell Energy [MeV];Cell Events',
                                         type='TH1F', path=energy_hist_path,
                                         xbins=lArCellBinningScheme.defaultEnergyBins[0],xmin=lArCellBinningScheme.defaultEnergyBins[1],xmax=lArCellBinningScheme.defaultEnergyBins[2])
            pass

    #En vs. Time
    energyvstime_hist_path='EnergyVsTime/'

#    eCutForTiming = [1000., 1000., 3000., 1500., 3500., 3500., 3500., 3500., 1500., 3000., 3000., 2000., 10000., 10000., 10000.]
    eCutForTiming = LArCellMonAlg.EcutForTiming #taken from the values hardcoded in the .h, only way to prevent mixing everything up with the enum in the code
    idx=0
    for part in LArCellMonAlg.LayerNames:
         cellMonGroup.defineHistogram('cellTime_'+part+',cellEnergy_'+part+';CellEnergyVsTime_'+part,
                           title='Cell Energy vs Cell Time in '+part+' with CSC veto;Cell Time [ns];Cell Energy [MeV]',
                           type='TH2F', path=energyvstime_hist_path,
                           xbins=lArCellBinningScheme.timescale, ybins=lArCellBinningScheme.energyscale)

         cellMonGroup.defineHistogram('cellTime_'+part+'_cut;CellEnergyVsTime_'+part+'_'+str(eCutForTiming[idx//2]),
                           title='Cell Energy vs Cell Time in '+part+' with CSC veto - Cell Time (E>'+str(eCutForTiming[idx//2])+' [MeV]);Cell Time [ns];Cell Energy [MeV]',
                           weight='cellEnergy_'+part+'_cut',
                           cutmask='enGreaterThanCut_'+part,
                           type='TH1F', path=energyvstime_hist_path,
                           xbins=lArCellBinningScheme.timescale)
         idx=idx+1
         pass


    cellMonGroupPerJob = helper.addGroup(
        LArCellMonAlg,
        LArCellMonAlg.MonGroupName_perJob,
        '/CaloMonitoring/LArCellMon_NoTrigSelNewAlg/'
    )

    LArCellMonAlg.doKnownBadChannelsVsEtaPhi = True
    LArCellMonAlg.doDatabaseNoiseVsEtaPhi = True

    for part in LArCellMonAlg.LayerNames:
        cellMonGroupPerJob.defineHistogram('celleta_'+part+',cellphi_'+part+';KnownBadChannelsVsEtaPhi_'+part,
                                           title="Map of known bad channels in (#eta,#phi) for "+part+";cell #eta;cell #phi",
                                           weight='badCellWord_'+part,
                                           cutmask='fillBadChannelPlot',
                                           type='TH2F', path="KnownBadChannels/", 
                                           xbins = lArCellBinningScheme.etaRange[part],
                                           ybins = lArCellBinningScheme.phiRange[part],
                                           merge='weightedAverage'
)
        
        cellMonGroupPerJob.defineHistogram('celleta_'+part+',cellphi_'+part+';DatabaseNoiseVsEtaPhi_'+part,
                                           title="Map of Noise Values from the Database vs (#eta,#phi) for "+part+";cell #eta;cell #phi",
                                           weight='cellnoisedb_'+part,
                                           cutmask='doDatabaseNoisePlot',
                                           type='TH2F', path="DatabaseNoise/", 
                                           xbins = lArCellBinningScheme.etaRange[part],
                                           ybins = lArCellBinningScheme.phiRange[part],
                                           merge='weightedAverage')
        
        cellMonGroupPerJob.defineHistogram('celleta_'+part+';NCellsActiveVsEta_'+part,
                                           title="No. of Active Cells in #eta for "+part+";cell #eta",
                                           cutmask='doCellsActiveEtaPlot',
                                           type='TH1F', path="ActiveCells/", 
                                           xbins = lArCellBinningScheme.etaRange[part],
                                           merge='weightedAverage')
        
        cellMonGroupPerJob.defineHistogram('cellphi_'+part+';NCellsActiveVsPhi_'+part,
                                           title="No. of Active Cells in #phi for "+part+";cell #phi",
                                           cutmask='doCellsActivePhiPlot',
                                           type='TH1F', path="ActiveCells/", 
                                           xbins = lArCellBinningScheme.phiRange[part],
                                           merge='weightedAverage')
        

        pass #part loop

    #--- group array for threshold dependent histograms
    allMonArray = helper.addArray([LArCellMonAlg.LayerNames, LArCellMonAlg.ThresholdType], LArCellMonAlg, "allMon", 
                                    "/CaloMonitoring/LArCellMon_NoTrigSelNewAlg/")


    #now histograms
    for part in LArCellMonAlg.LayerNames:
        allMonArray.defineHistogram('dummy', type='TH1F', xbins=1, xmin=0, xmax=1) # dummy to have at least 1 plot defined

        allMonArray.defineHistogram('celleta,cellphi;CellOccupancyVsEtaPhi',
                                                title='No. of events in (#eta,#phi) for '+part+';cell #eta;cell #phi',
                                                type='TH2F', path="2d_Occupancy/",
                                                cutmask='passThrCut',
                                                xbins = lArCellBinningScheme.etaRange[part],
                                                ybins = lArCellBinningScheme.phiRange[part],
                                                pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiTotalOccupancyNames])

        allMonArray.defineHistogram('passThrCut,celleta,cellphi;CellOccupancyFractionVsEtaPhi',
                                                          title='Fraction of events in (#eta,#phi) for '+part+';cell #eta;cell #phi',
                                                          type='TEfficiency', path="2d_Occupancy/",
                                                          xbins = lArCellBinningScheme.etaRange[part],
                                                          ybins = lArCellBinningScheme.phiRange[part],
                                                          pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiPercentageOccupancyNames])

        allMonArray.defineHistogram('celleta;CellOccupancyVsEta', #needs weightedAverage/weightedEff
                                                 title='No. of events in (#eta) for '+part+';cell #eta;',
                                                 type='TH1F', path="1d_Occupancy/",
                                                 cutmask='passThrCut',
                                                 xbins = lArCellBinningScheme.etaRange[part],
                                                 pattern=[(part, _) for _ in LArCellMonAlg.DoEtaOccupancyNames])

        allMonArray.defineHistogram('cellphi;CellOccupancyVsPhi',
                                             title='No. of events in (#phi) for '+part+';cell #phi;',
                                             type='TH1F', path="1d_Occupancy/",
                                             cutmask='passThrCut',
                                             xbins = lArCellBinningScheme.phiRange[part],
                                             pattern=[(part, _) for _ in LArCellMonAlg.DoPhiOccupancyNames])

        allMonArray.defineHistogram('celleta,cellphi;TotalEnergyVsEtaPhi',
                                                title="Total Cell Energy vs (#eta,#phi) in "+part+";cell #eta;cell #phi",
                                                weight='cellEnergy',
                                                type='TH2F', path="2d_TotalEnergy/", 
                                                cutmask='passThrCut',
                                                xbins = lArCellBinningScheme.etaRange[part],
                                                ybins = lArCellBinningScheme.phiRange[part],
                                                pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiTotEnergyNames])

        allMonArray.defineHistogram('celleta,cellphi;TotalQualityVsEtaPhi',
                                                title="Cell Quality vs (#eta,#phi) in "+part+";cell #eta;cell #phi",
                                                weight='cellQuality',
                                                type='TH2F', path="2d_AvgQuality/", #needs to be divided by '2D_occupancy' at post processing stage
                                                cutmask='passThrCut',
                                                xbins = lArCellBinningScheme.etaRange[part],
                                                ybins = lArCellBinningScheme.phiRange[part],
                                                pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiAvgQualityNames])

        allMonArray.defineHistogram('celleta,cellphi;TotalTimeVsEtaPhi',
                                              title="Cell Time vs (#eta,#phi) in "+part+";cell #eta;cell #phi",
                                              weight='cellTime',
                                              type='TH2F', path="2d_AvgTime/", #needs to be divided by '2D_occupancy' at post processing stage
                                                cutmask='passThrCut',
                                              xbins = lArCellBinningScheme.etaRange[part],
                                              ybins = lArCellBinningScheme.phiRange[part],
                                              pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiAvgTimeNames])

        allMonArray.defineHistogram('celleta,cellphi;fractionOverQthVsEtaPhi',
                                                      title="Fraction of Events in "+part+" for which the Quality Factor exceeds Threshold;cell #eta;cell #phi",
                                                      weight='isPoorQuality',
                                                      type='TH2F', path="2d_PoorQualityFraction/", # needs postprocessing 
                                                cutmask='passThrCut',
                                                      xbins = lArCellBinningScheme.etaRange[part],
                                                      ybins = lArCellBinningScheme.phiRange[part],
                                                      pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiFractionOverQthNames])

        allMonArray.defineHistogram('celleta,cellphi;fractionPastTthVsEtaPhi',
                                                      title="Fraction of Events in "+part+" for which the Time is further than Threshold;cell #eta;cell #phi",
                                                      weight='isLateTime',
                                                      type='TH2F', path="2d_FractionOutOfTime/", # needs postprocessing 
                                                cutmask='passThrCut',
                                                      xbins = lArCellBinningScheme.etaRange[part],
                                                      ybins = lArCellBinningScheme.phiRange[part],
                                                      pattern=[(part, _) for _ in LArCellMonAlg.DoEtaPhiFractionPastTthNames])

        pass #part loop for occupancy



    #-- TTree for sporadic
    if LArCellMonAlg.Sporadic_switch:
        sporadic_hist_path='/Sporadic_'+str(LArCellMonAlg.Threshold_EM_S0S1)+'*1e-3_'+str(LArCellMonAlg.Threshold_HECFCALEMS2S3)+'*1e-3GeV/'
        cellMonGroup.defineTree('sporadicCellE,sporadicCellTime,sporadicCellQuality,sporadicCellID,lumiBlock,adoptedEThreshold;SporadicNoisyCellsTree', path=sporadic_hist_path,
                                treedef='sporadicCellE/F:sporadicCellTime/F:sporadicCellQuality/s:sporadicCellID/l:lumiBlock/i')
示例#4
0
def LArNoisyROMonConfigCore(helper,algoinstance,inputFlags, 
                              inKey="", 
                              NoisyFEBDefStr="(>30 chan with Q>4000)", 
                              MNBTightFEBDefStr="",
                              MNBTight_PsVetoFEBDefStr="",
                              MNBLooseFEBDefStr=""):

    # first configure known bad FEBs
    from AthenaConfiguration.ComponentFactory import isRun3Cfg
    if isRun3Cfg():
       from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
       cfg=ComponentAccumulator()
       from LArBadChannelTool.LArBadFebsConfig import LArKnownBadFebCfg, LArKnownMNBFebCfg
       cfg.merge(LArKnownBadFebCfg(inputFlags))
       cfg.merge(LArKnownMNBFebCfg(inputFlags))

    larNoisyROMonAlg = helper.addAlgorithm(algoinstance,'larNoisyROMonAlg')

    NoisyROMonGroupName="LArNoisyROMonGroup"

    from LArMonitoring.GlobalVariables import lArDQGlobals

    larNoisyROMonAlg.NoisyROGroupName=NoisyROMonGroupName
    larNoisyROMonAlg.SubDetNames=lArDQGlobals.SubDet[0:2]
    larNoisyROMonAlg.PartitionNames=lArDQGlobals.Partitions[0:4]

    #FIXME: True only for testing
    larNoisyROMonAlg.storeLooseMNBFEBs=False
    if inKey != "":
       larNoisyROMonAlg.inputKey=inKey 

    # variable for testing on ESD
    try:
      LArNoisyROMonForceTrigger
    except NameError:
      LArNoisyROMonForceTrigger = False

    EFNoiseBurstTriggersList=[
         "EF_j165_u0uchad_LArNoiseBurst",
         "EF_j30_u0uchad_empty_LArNoiseBurst",
         "EF_j55_u0uchad_firstempty_LArNoiseBurst",
         "EF_j55_u0uchad_empty_LArNoiseBurst",
         "EF_xe45_LArNoiseBurst",
         "EF_xe55_LArNoiseBurst",
         "EF_xe60_LArNoiseBurst",
         "EF_j55_u0uchad_firstempty_LArNoiseBurstT",
         "EF_j100_u0uchad_LArNoiseBurstT",
         "EF_j165_u0uchad_LArNoiseBurstT",
         "EF_j130_u0uchad_LArNoiseBurstT",
         "EF_j35_u0uchad_empty_LArNoiseBurst",
         "EF_j35_u0uchad_firstempty_LArNoiseBurst",
         "EF_j80_u0uchad_LArNoiseBurstT"
    ]
    L1NoiseBurstTriggersList = [
         "L1_J75",
         "L1_J10_EMPTY",
         "L1_J30_FIRSTEMPTY",
         "L1_J30_EMPTY",
         "L1_XE40",
         "L1_XE50",
         "L1_XE50_BGRP7",
         "L1_XE70"
    ]
    doTrigger=False
    if isRun3Cfg():
      if inputFlags.Trigger.doHLT or LArNoisyROMonForceTrigger:
        doTrigger=True
    else:    
      if inputFlags.doHLTMon or LArNoisyROMonForceTrigger:
        doTrigger=True

    if doTrigger:
       larNoisyROMonAlg.doTrigger = True  
       larNoisyROMonAlg.EFNoiseBurstTriggers = EFNoiseBurstTriggersList
       larNoisyROMonAlg.L1NoiseBurstTriggers = L1NoiseBurstTriggersList
    else:   
       larNoisyROMonAlg.doTrigger = False  
       larNoisyROMonAlg.EFNoiseBurstTriggers = []
       larNoisyROMonAlg.L1NoiseBurstTriggers = []

    noisyROGroup = helper.addGroup(
        larNoisyROMonAlg,
        NoisyROMonGroupName,
        '/LAr/NoisyRONewAlg/'
    )


    larNoisyRO_hist_path='Summary/'

    # first trees
    noisyROGroup.defineTree('time,time_ns,algo;LArNoise',path=larNoisyRO_hist_path,
                            treedef='time/i:time_ns/i:algo/b')

    noisyROGroup.defineTree('candidate_MNB_time,candidate_MNB_time_ns,n_candidate_MNBTight_FEB,n_candidate_MNBTight_PsVeto_FEB,n_candidate_MNBLoose_FEB,v_candidate_MNBTightFEB,v_candidate_MNBTight_PsVetoFEB,v_candidate_MNBLooseFEB;CandidateMNBFebs',path=larNoisyRO_hist_path,
                            treedef='candidate_MNB_time/i:candidate_MNB_time_ns/i:n_candidate_MNBTight_FEB/i:n_candidate_MNBTight_PsVeto_FEB/i:n_candidate_MNBLoose_FEB/i:v_candidate_MNBTightFEB/vector<int>:v_candidate_MNBTight_PsVetoFEB/vector<int>:v_candidate_MNBLooseFEB/vector<int>')

    #then global histo
    noisyROGroup.defineHistogram('n_noisyFEBs;NoisyFEB',
                                  title='Number of noisy FEB '+ NoisyFEBDefStr + '  per event;# of noisy FEB',
                                  type='TH1I',
                                  path=larNoisyRO_hist_path,
                                  xbins=lArDQGlobals.noisyFEB_Bins,xmin=lArDQGlobals.noisyFEB_Min,xmax=lArDQGlobals.noisyFEB_Max)
    noisyROGroup.defineHistogram('LBN;LBN',type='TH1I',
                                 title='Event counter per LB', path=larNoisyRO_hist_path,
                                 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max)

    for subdet in range(0,2): 
       hist_path='/LAr/NoisyRONewAlg/'+lArDQGlobals.SubDet[subdet]+'/'
       slot_low = lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[subdet*2]][0] - 0.5
       slot_up  = lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[subdet*2]][1] + 0.5
       slot_n = int(slot_up - slot_low)
       ft_low = lArDQGlobals.FEB_Feedthrough[lArDQGlobals.Partitions[subdet*2]][0] - 0.5
       ft_up  = lArDQGlobals.FEB_Feedthrough[lArDQGlobals.Partitions[subdet*2]][1] + 0.5
       ft_n = int(ft_up - ft_low)

       darray = helper.addArray([lArDQGlobals.Partitions[2*subdet:2*subdet+2]],larNoisyROMonAlg,lArDQGlobals.SubDet[subdet],topPath=hist_path)
       # Known bad FEBS
       darray.defineHistogram('slotBad,FTBad;KnownBadFEB', title='Known Bad FEBs {0} ; Slot ; FT', 
                              type='TH2I', 
                              xbins=slot_n,xmin=slot_low,xmax=slot_up,
                              ybins=ft_n, ymin=ft_low, ymax=ft_up)

       darray.defineHistogram('slotMNB,FTMNB;MNBKnownFEB', title='Known MNB FEBs {0} ; Slot ; FT', 
                              type='TH2I', 
                              xbins=slot_n,xmin=slot_low,xmax=slot_up,
                              ybins=ft_n, ymin=ft_low, ymax=ft_up)

       # 2D plots of noisy FEBs with various cuts
       darray.defineHistogram('slotNoisy,FTNoisy;NoisyFEBPerEvt', title='Yield of events with {0} FEB noisy -'+NoisyFEBDefStr+' (only vetoed events) ; Slot ; FT', 
                              type='TH2I', 
                              xbins=slot_n,xmin=slot_low,xmax=slot_up,
                              ybins=ft_n, ymin=ft_low, ymax=ft_up)

       darray.defineHistogram('slotTight,FTTight;MNBTightFEBPerEvt', title='Yield of events with {0} FEB noisy -'+MNBTightFEBDefStr+' (only vetoed events) ; Slot ; FT', 
                              type='TH2I', 
                              xbins=slot_n,xmin=slot_low,xmax=slot_up,
                              ybins=ft_n, ymin=ft_low, ymax=ft_up)

       darray.defineHistogram('slotTightCan,FTTightCan;CandidateMNBTightFEBPerEvt', title='Yield of events with {0} FEB noisy -'+MNBTightFEBDefStr+' (only vetoed events) ; Slot ; FT', 
                              type='TH2I', 
                              xbins=slot_n,xmin=slot_low,xmax=slot_up,
                              ybins=ft_n, ymin=ft_low, ymax=ft_up)

       darray.defineHistogram('slot_PsVetoTight,FT_PsVetoTight;MNBTight_PsVetoFEBPerEvt', title='Yield of events with {0} FEB noisy -'+MNBTight_PsVetoFEBDefStr+' (only vetoed events) ; Slot ; FT', 
                              type='TH2I', 
                              xbins=slot_n,xmin=slot_low,xmax=slot_up,
                              ybins=ft_n, ymin=ft_low, ymax=ft_up)

       darray.defineHistogram('slot_PsVetoTightCan,FT_PsVetoTightCan;CandidateMNBTight_PsVetoFEBPerEvt', title='Yield of events with {0} FEB noisy -'+MNBTight_PsVetoFEBDefStr+' (only vetoed events) ; Slot ; FT', 
                              type='TH2I', 
                              xbins=slot_n,xmin=slot_low,xmax=slot_up,
                              ybins=ft_n, ymin=ft_low, ymax=ft_up)

       darray.defineHistogram('slotLoose,FTLoose;MNBLooseFEBPerEvt', title='Yield of events with {0} FEB noisy -'+MNBLooseFEBDefStr+' (only vetoed events) ; Slot ; FT', 
                              type='TH2I', 
                              xbins=slot_n,xmin=slot_low,xmax=slot_up,
                              ybins=ft_n, ymin=ft_low, ymax=ft_up)

       darray.defineHistogram('slotLooseCan,FTLooseCan;CandidateMNBLooseFEBPerEvt', title='Yield of events with {0} FEB noisy -'+MNBLooseFEBDefStr+' (only vetoed events) ; Slot ; FT', 
                              type='TH2I', 
                              xbins=slot_n,xmin=slot_low,xmax=slot_up,
                              ybins=ft_n, ymin=ft_low, ymax=ft_up)

       # 1D plots of noisy events of various type
       darray.defineHistogram('LBStd;NoisyEvent',type='TH1I',
                                 title='Yield of events flagged as RNB-Standard - {0} ; Luminosity Block', 
                                 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max)

       darray.defineHistogram('LBSat;SaturatedNoisyEvent',type='TH1I',
                                 title='Yield of events flagged as RNB-Saturated - {0} ; Luminosity Block', 
                                 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max)

       darray.defineHistogram('LBMNBTight;MNBTightEvent',type='TH1I',
                                 title='Yield of events flagged as MNB-Tight - {0} ; Luminosity Block', 
                                 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max)

       darray.defineHistogram('LBMNBTight_PsVet;MNBTight_PsVetoEvent',type='TH1I',
                                 title='Yield of events flagged as MNB-Tight_PsVeto - {0} ; Luminosity Block', 
                                 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max)

       darray.defineHistogram('LBMNBLoose;MNBLooseEvent',type='TH1I',
                                 title='Yield of events flagged as MNB-Loose - {0} ; Luminosity Block', 
                                 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max)

       # 1D plots of events still noisy after EventVeto
       darray.defineHistogram('LBStd_Veto;NoisyEvent_TimeVeto',type='TH1I',
                                 title='Yield of events flagged as RNB-Standard not vetoed by time window - {0} ; Luminosity Block', 
                                 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max)

       darray.defineHistogram('LBSat_Veto;SaturatedNoisyEvent_TimeVeto',type='TH1I',
                                 title='Yield of events flagged as RNB-Saturated not vetoed by time window - {0} ; Luminosity Block', 
                                 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max)

       darray.defineHistogram('LBMNBTight_Veto;MNBTightEvent_TimeVeto',type='TH1I',
                                 title='Yield of events flagged as MNB-Tight not vetoed by time window - {0} ; Luminosity Block', 
                                 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max)

       darray.defineHistogram('LBMNBTight_PsVeto_Veto;MNBTight_PsVetoEvent_TimeVeto',type='TH1I',
                                 title='Yield of events flagged as MNB-Tight_PsVeto not vetoed by time window - {0} ; Luminosity Block', 
                                 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max)

       darray.defineHistogram('LBMNBLoose_Veto;MNBLooseEvent_TimeVeto',type='TH1I',
                                 title='Yield of events flagged as MNB-Loose not vetoed by time window - {0} ; Luminosity Block', 
                                 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max)

       # Trigger histos
       if larNoisyROMonAlg.doTrigger:
          siz=len(larNoisyROMonAlg.EFNoiseBurstTriggers)
          darray.defineHistogram('Triggers;NoisyEventTrigger',type='TH1I',
                                 title='Trigger fired for RNB flagged events - {0} ; Special trigger fired', 
                                 xbins=siz+1,xmin=0.5,xmax=siz+1.5,
                                 xlabels=larNoisyROMonAlg.EFNoiseBurstTriggers.append("NONE"))

          l1siz=len(larNoisyROMonAlg.L1NoiseBurstTriggers)
          darray.defineHistogram('L1Triggers;NoisyEventL1Term',type='TH1I',
                                 title='L1 term fired for RNB flagged events - {0} ; Special trigger fired', 
                                 xbins=l1siz+1,xmin=0.5,xmax=l1siz+1.5,
                                 xlabels=larNoisyROMonAlg.L1NoiseBurstTriggers.append("NONE"))

    pass

    if isRun3Cfg():
       cfg.merge(helper.result())
       return cfg
示例#5
0
#
#  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#

from AthenaCommon.Logging import logging
from AthenaCommon.Configurable import Configurable
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags

import json
import six

from AthenaConfiguration.ComponentFactory import isRun3Cfg

if isRun3Cfg():
    from GaudiConfig2.Configurables import GenericMonitoringTool as _GenericMonitoringTool
else:
    from AthenaMonitoringKernel.AthenaMonitoringKernelConf import GenericMonitoringTool as _GenericMonitoringTool

log = logging.getLogger(__name__)


class GenericMonitoringTool(_GenericMonitoringTool):
    """Configurable of a GenericMonitoringTool"""

    __slots__ = ['_convention', '_defaultDuration']

    def __init__(self, name=None, *args, **kwargs):
        self._convention = ''
        self._defaultDuration = kwargs.pop('defaultDuration', None)
        super(GenericMonitoringTool, self).__init__(name, *args, **kwargs)
示例#6
0
def LArRODMonConfigCore(helper,
                        algoinstance,
                        inputFlags,
                        cellDebug=False,
                        dspDebug=False):

    larRODMonAlg = helper.addAlgorithm(algoinstance, 'larRODMonAlg')

    from LArMonitoring.GlobalVariables import lArDQGlobals

    GroupName = "RODMon"
    nslots = []
    for i in range(0, len(lArDQGlobals.FEB_Slot)):
        nslots.append(lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[i]][1])

    larRODMonAlg.MonGroup = GroupName
    larRODMonAlg.LArRODSubDetNames = lArDQGlobals.SubDet
    larRODMonAlg.LArRODPartitionNames = lArDQGlobals.Partitions
    larRODMonAlg.LArRODNslots = nslots

    #Adding 1MeV on request of Alexis (truncating difference) (May 2016):

    larRODMonAlg.PrecisionERange0 = 2  # MeV (Precision on E is on Eoff - Eonl)
    larRODMonAlg.PrecisionERange1 = 9
    larRODMonAlg.PrecisionERange2 = 65
    larRODMonAlg.PrecisionERange3 = 513
    larRODMonAlg.PrecisionERangeMax = 8192

    larRODMonAlg.ADCthreshold = 0
    larRODMonAlg.peakTimeCut = 5.
    larRODMonAlg.SkipNullQT = True

    # for detailed debugging
    if cellDebug:
        larRODMonAlg.DoCellsDump = True

    if dspDebug:
        larRODMonAlg.DoDspTestDump = True

    #from AthenaCommon.Constants import VERBOSE
    #larRODMonAlg.OutputLevel=VERBOSE
    from AthenaConfiguration.ComponentFactory import isRun3Cfg
    if isRun3Cfg():
        # adding BadChan masker private tool
        from LArBadChannelTool.LArBadChannelConfig import LArBadChannelMaskerCfg
        acc = LArBadChannelMaskerCfg(inputFlags,
                                     problemsToMask=[
                                         "highNoiseHG", "highNoiseMG",
                                         "highNoiseLG", "deadReadout",
                                         "deadPhys", "almostDead", "short",
                                         "sporadicBurstNoise"
                                     ],
                                     ToolName="BadLArChannelMask")
        larRODMonAlg.LArBadChannelMask = acc.popPrivateTools()
        helper.resobj.merge(acc)
    else:
        from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
        theLArBadChannelsMasker = LArBadChannelMasker("BadLArRawChannelMask")
        theLArBadChannelsMasker.DoMasking = True
        theLArBadChannelsMasker.ProblemsToMask = [
            "deadReadout", "deadPhys", "short", "almostDead", "highNoiseHG",
            "highNoiseMG", "highNoiseLG", "sporadicBurstNoise"
        ]
        larRODMonAlg.LArBadChannelMask = theLArBadChannelsMasker

    Group = helper.addGroup(larRODMonAlg, GroupName,
                            '/LAr/DSPMonitoringNewAlg')

    #Summary histos
    summary_hist_path = 'Summary/'

    Group.defineHistogram(
        'partition,gain;Summary_E',
        title='Summary of errors on Energy per partition and per gain',
        type='TH2F',
        path=summary_hist_path,
        weight='weight_e',
        xbins=lArDQGlobals.N_Partitions,
        xmin=-0.5,
        xmax=lArDQGlobals.N_Partitions - 0.5,
        ybins=lArDQGlobals.N_Gains,
        ymin=-0.5,
        ymax=lArDQGlobals.N_Gains - 0.5,
        xlabels=lArDQGlobals.Partitions,
        ylabels=lArDQGlobals.Gains)

    Group.defineHistogram(
        'partition,gain;Summary_Q',
        title='Summary of errors on Quality per partition and per gain',
        type='TH2F',
        path=summary_hist_path,
        weight='weight_q',
        xbins=lArDQGlobals.N_Partitions,
        xmin=-0.5,
        xmax=lArDQGlobals.N_Partitions - 0.5,
        ybins=lArDQGlobals.N_Gains,
        ymin=-0.5,
        ymax=lArDQGlobals.N_Gains - 0.5,
        xlabels=lArDQGlobals.Partitions,
        ylabels=lArDQGlobals.Gains)

    Group.defineHistogram(
        'partition,gain;Summary_T',
        title='Summary of errors on Time per partition and per gain',
        type='TH2F',
        path=summary_hist_path,
        weight='weight_t',
        xbins=lArDQGlobals.N_Partitions,
        xmin=-0.5,
        xmax=lArDQGlobals.N_Partitions - 0.5,
        ybins=lArDQGlobals.N_Gains,
        ymin=-0.5,
        ymax=lArDQGlobals.N_Gains - 0.5,
        xlabels=lArDQGlobals.Partitions,
        ylabels=lArDQGlobals.Gains)

    Group.defineHistogram(
        'Ediff;E_all',
        title=
        'E_offline - E_online for all partitions;E_offline - E_online (MeV)',
        type='TH1F',
        path=summary_hist_path,
        xbins=lArDQGlobals.DSPEnergy_Bins,
        xmin=lArDQGlobals.DSPEnergy_Min,
        xmax=lArDQGlobals.DSPEnergy_Max)
    Group.defineHistogram(
        'Tdiff;T_all',
        title=
        'T_offline - T_online for all partitions;T_offline - T_online (ps)',
        type='TH1F',
        path=summary_hist_path,
        xbins=lArDQGlobals.DSPTime_Bins,
        xmin=lArDQGlobals.DSPTime_Min,
        xmax=lArDQGlobals.DSPTime_Max)
    Group.defineHistogram(
        'Qdiff;Q_all',
        title=
        'Q_offline - Q_online / #sqrt{Q_offline} for all partitions;Q_offline - Q_online  / sqrt{Q_offline} (ps)',
        type='TH1F',
        path=summary_hist_path,
        xbins=lArDQGlobals.DSPQuality_Bins,
        xmin=lArDQGlobals.DSPQuality_Min,
        xmax=lArDQGlobals.DSPQuality_Max)

    #Infos histos (vs. LB)
    info_hist_path = 'Infos/'
    cut = "#delta ADC>" + str(
        larRODMonAlg.ADCthreshold) + " and |t_offline| < " + str(
            larRODMonAlg.peakTimeCut) + " ns"
    Group.defineHistogram('LBN,partitionI;EErrorsPerLB',
                          title='Nb of errors in E per LB - ' + cut +
                          ':Luminosity Block:Partition',
                          type='TH2I',
                          weight='numE',
                          path=info_hist_path,
                          xbins=lArDQGlobals.LB_Bins,
                          xmin=lArDQGlobals.LB_Min,
                          xmax=lArDQGlobals.LB_Max,
                          ybins=lArDQGlobals.N_Partitions,
                          ymin=-0.5,
                          ymax=lArDQGlobals.N_Partitions - 0.5,
                          ylabels=lArDQGlobals.Partitions)
    Group.defineHistogram('LBN,partitionI;TErrorsPerLB',
                          title='Nb of errors in T per LB - ' + cut +
                          ':Luminosity Block:Partition',
                          type='TH2I',
                          weight='numT',
                          path=info_hist_path,
                          xbins=lArDQGlobals.LB_Bins,
                          xmin=lArDQGlobals.LB_Min,
                          xmax=lArDQGlobals.LB_Max,
                          ybins=lArDQGlobals.N_Partitions,
                          ymin=-0.5,
                          ymax=lArDQGlobals.N_Partitions - 0.5,
                          ylabels=lArDQGlobals.Partitions)
    Group.defineHistogram('LBN,partitionI;QErrorsPerLB',
                          title='Nb of errors in Q per LB - ' + cut +
                          ':Luminosity Block:Partition',
                          type='TH2I',
                          weight='numQ',
                          path=info_hist_path,
                          xbins=lArDQGlobals.LB_Bins,
                          xmin=lArDQGlobals.LB_Min,
                          xmax=lArDQGlobals.LB_Max,
                          ybins=lArDQGlobals.N_Partitions,
                          ymin=-0.5,
                          ymax=lArDQGlobals.N_Partitions - 0.5,
                          ylabels=lArDQGlobals.Partitions)

    #DQMD histos
    dqmd_hist_path = '/LAr/DSPMonitoringNewAlg/DQMD/'
    darray = helper.addArray([lArDQGlobals.Partitions], larRODMonAlg, "RODMon")
    darray.defineHistogram(
        'Ediff,Erange;DE_ranges',
        title=
        'EOnline - E_offline for all ranges : E_offline - E_online (MeV) : Energy range',  #'E_online - E_offline for all ranges : E_offline - E_online (MeV) : Energy range',
        type='TH2F',
        path=dqmd_hist_path,
        xbins=lArDQGlobals.DSP1Energy_Bins,
        xmin=lArDQGlobals.DSP1Energy_Min,
        xmax=lArDQGlobals.DSP1Energy_Max,
        ybins=lArDQGlobals.DSPRanges_Bins,
        ymin=lArDQGlobals.DSPRanges_Min,
        ymax=lArDQGlobals.DSPRanges_Max,
        ylabels=lArDQGlobals.DSPRanges)
    Group.defineHistogram(
        'Ediff,Erange;E_ranges_all',
        title=
        'E_online - E_offline for all ranges : E_offline - E_online (MeV) : Energy range',
        type='TH2F',
        path=dqmd_hist_path,
        xbins=lArDQGlobals.DSP1Energy_Bins,
        xmin=lArDQGlobals.DSP1Energy_Min,
        xmax=lArDQGlobals.DSP1Energy_Max,
        ybins=lArDQGlobals.DSPRanges_Bins,
        ymin=lArDQGlobals.DSPRanges_Min,
        ymax=lArDQGlobals.DSPRanges_Max,
        ylabels=lArDQGlobals.DSPRanges)

    #per partition, currently in one dir only
    part_hist_path = '/LAr/DSPMonitoringNewAlg/perPartition/'
    darray.defineHistogram('Ediff;DE',
                           title='E_offline - E_online:E_offline - E_online',
                           type='TH1F',
                           path=part_hist_path,
                           xbins=lArDQGlobals.DSPEnergy_Bins,
                           xmin=lArDQGlobals.DSPEnergy_Min,
                           xmax=lArDQGlobals.DSPEnergy_Max)
    darray.defineHistogram('Tdiff;DT',
                           title='T_offline - T_online:T_offline - T_online',
                           type='TH1F',
                           path=part_hist_path,
                           xbins=lArDQGlobals.DSPTime_Bins,
                           xmin=lArDQGlobals.DSPTime_Min,
                           xmax=lArDQGlobals.DSPTime_Max)
    darray.defineHistogram(
        'Qdiff;DG',
        title='Q_offline - Q_online:Q_offline - Q_online / #sqrtQ_offline',
        type='TH1F',
        path=part_hist_path,
        xbins=lArDQGlobals.DSPTime_Bins,
        xmin=lArDQGlobals.DSPTime_Min,
        xmax=lArDQGlobals.DSPTime_Max)

    darray.defineHistogram(
        'slot,FT;Out_E_FT_vs_SLOT',
        title=
        '# of cells with E_offline - E_online > numerical precision : Slot : Feedthrough',
        type='TH2I',
        path=part_hist_path,
        weight='weight_e',
        xbins=lArDQGlobals.FEB_Slot["EMECA"][1],
        xmin=lArDQGlobals.FEB_Slot["EMECA"][0] - 0.5,
        xmax=lArDQGlobals.FEB_Slot["EMECA"][1] + 0.5,
        ybins=lArDQGlobals.FEB_Feedthrough["EMBA"][1] + 1,
        ymin=lArDQGlobals.FEB_Feedthrough["EMBA"][0] - 0.5,
        ymax=lArDQGlobals.FEB_Feedthrough["EMBA"][1] + 0.5)

    darray.defineHistogram(
        'slot,FT;Out_T_FT_vs_SLOT',
        title=
        '# of cells with E_offline - E_online > numerical precision : Slot : Feedthrough',
        type='TH2I',
        path=part_hist_path,
        weight='weight_t',
        xbins=lArDQGlobals.FEB_Slot["EMECA"][1],
        xmin=lArDQGlobals.FEB_Slot["EMECA"][0] - 0.5,
        xmax=lArDQGlobals.FEB_Slot["EMECA"][1] + 0.5,
        ybins=lArDQGlobals.FEB_Feedthrough["EMBA"][1] + 1,
        ymin=lArDQGlobals.FEB_Feedthrough["EMBA"][0] - 0.5,
        ymax=lArDQGlobals.FEB_Feedthrough["EMBA"][1] + 0.5)

    darray.defineHistogram(
        'slot,FT;Out_Q_FT_vs_SLOT',
        title=
        '# of cells with E_offline - E_online > numerical precision : Slot : Feedthrough',
        type='TH2I',
        path=part_hist_path,
        weight='weight_q',
        xbins=lArDQGlobals.FEB_Slot["EMECA"][1],
        xmin=lArDQGlobals.FEB_Slot["EMECA"][0] - 0.5,
        xmax=lArDQGlobals.FEB_Slot["EMECA"][1] + 0.5,
        ybins=lArDQGlobals.FEB_Feedthrough["EMBA"][1] + 1,
        ymin=lArDQGlobals.FEB_Feedthrough["EMBA"][0] - 0.5,
        ymax=lArDQGlobals.FEB_Feedthrough["EMBA"][1] + 0.5)

    darray.defineHistogram(
        'Eoff,Eon;Eon_VS_Eoff',
        title='E_online VS E_offline:E_offline (MeV):E_online (MeV)',
        type='TH2F',
        path=part_hist_path,
        xbins=lArDQGlobals.DSPEonEoff_Bins,
        xmin=-lArDQGlobals.DSPEonEoff_Max,
        xmax=lArDQGlobals.DSPEonEoff_Max,
        ybins=lArDQGlobals.DSPEonEoff_Bins,
        ymin=-lArDQGlobals.DSPEonEoff_Max,
        ymax=lArDQGlobals.DSPEonEoff_Max)

    darray.defineHistogram(
        'Toff,Ton;Ton_VS_Toff',
        title='T_online VS T_offline:T_offline (ps):T_online (ps)',
        type='TH2F',
        path=part_hist_path,
        xbins=lArDQGlobals.DSPTonToff_Bins,
        xmin=-lArDQGlobals.DSPTonToff_Max,
        xmax=lArDQGlobals.DSPTonToff_Max,
        ybins=lArDQGlobals.DSPTonToff_Bins,
        ymin=-lArDQGlobals.DSPTonToff_Max,
        ymax=lArDQGlobals.DSPTonToff_Max)

    darray.defineHistogram('Qoff,Qon;Qon_VS_Qoff',
                           title='Q_online VS Q_offline:Q_offline :Q_online ',
                           type='TH2F',
                           path=part_hist_path,
                           xbins=lArDQGlobals.DSPQonQoff_Bins,
                           xmin=-lArDQGlobals.DSPQonQoff_Max,
                           xmax=lArDQGlobals.DSPQonQoff_Max,
                           ybins=lArDQGlobals.DSPQonQoff_Bins,
                           ymin=-lArDQGlobals.DSPQonQoff_Max,
                           ymax=lArDQGlobals.DSPQonQoff_Max)

    darray.defineHistogram(
        'Sweetc;Sweet_cells',
        title='Number of sweet Cells in LAr:Sweet cells per feb',
        type='TH1F',
        path=part_hist_path,
        xbins=lArDQGlobals.FEB_N_channels,
        xmin=lArDQGlobals.FEB_channels_Min,
        xmax=lArDQGlobals.FEB_channels_Max)
示例#7
0
def LArAffectedRegionsConfigCore(helper, algoinstance, inputFlags):

    larAffectedRegAlg = helper.addAlgorithm(algoinstance, 'larAffectedRegAlg')

    #define the group names here, as you'll use them multiple times
    affectedRegGroupName = "LArAffectedRegionsMonGroup"

    # Edit properties of a algorithm
    larAffectedRegAlg.AffectedRegionsGroupName = affectedRegGroupName
    isOnline = False
    from AthenaConfiguration.ComponentFactory import isRun3Cfg
    if isRun3Cfg():
        if inputFlags.DQ.Environment == 'online':
            isOnline = True
    else:
        from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
        if athenaCommonFlags.isOnline:
            isOnline = True

    larAffectedRegAlg.IsOnline = isOnline

    from LArMonitoring.GlobalVariables import lArDQGlobals  #to define the ranges
    larAffReg_hist_path = 'AffectedRegionsNewAlg/'  #histogram path

    #EMBPS
    group_name_ending = "EMBPS"
    larAffectedRegAlg.EMBPSname = group_name_ending
    affectedRegGroupEMBPS = helper.addGroup(
        larAffectedRegAlg, affectedRegGroupName + group_name_ending, '/LAr/',
        'run')

    affectedRegGroupEMBPS.defineHistogram(
        'etaPOS,phi;LArAffectedRegionsEMBAPS',
        title='HV Affected Regions - EMBA - Presampler;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_EMB["EMBAPS"][0],
        xmin=lArDQGlobals.HVeta_EMB["EMBAPS"][1],
        xmax=lArDQGlobals.HVeta_EMB["EMBAPS"][2],
        ybins=lArDQGlobals.HVphi_EMB["EMBAPS"][0],
        ymin=lArDQGlobals.HVphi_EMB["EMBAPS"][1],
        ymax=lArDQGlobals.HVphi_EMB["EMBAPS"][2],
        merge='weightedAverage')
    affectedRegGroupEMBPS.defineHistogram(
        'etaNEG,phi;LArAffectedRegionsEMBCPS',
        title='HV Affected Regions - EMBC - Presampler;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_EMB["EMBCPS"][0],
        xmin=lArDQGlobals.HVeta_EMB["EMBCPS"][1],
        xmax=lArDQGlobals.HVeta_EMB["EMBCPS"][2],
        ybins=lArDQGlobals.HVphi_EMB["EMBCPS"][0],
        ymin=lArDQGlobals.HVphi_EMB["EMBCPS"][1],
        ymax=lArDQGlobals.HVphi_EMB["EMBCPS"][2],
        merge='weightedAverage')

    #EMB
    group_name_ending = "EMB"
    larAffectedRegAlg.EMBname = group_name_ending
    affectedRegGroupEMB = helper.addGroup(
        larAffectedRegAlg, affectedRegGroupName + group_name_ending, '/LAr/',
        'run')

    affectedRegGroupEMB.defineHistogram(
        'etaPOS,phi;LArAffectedRegionsEMBA',
        title='HV Affected Regions - EMBA - Samplings 1-3;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_EMB["EMBA"][0],
        xmin=lArDQGlobals.HVeta_EMB["EMBA"][1],
        xmax=lArDQGlobals.HVeta_EMB["EMBA"][2],
        ybins=lArDQGlobals.HVphi_EMB["EMBA"][0],
        ymin=lArDQGlobals.HVphi_EMB["EMBA"][1],
        ymax=lArDQGlobals.HVphi_EMB["EMBA"][2],
        merge='weightedAverage')
    affectedRegGroupEMB.defineHistogram(
        'etaNEG,phi;LArAffectedRegionsEMBC',
        title='HV Affected Regions - EMBC - Samplings 1-3;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_EMB["EMBC"][0],
        xmin=lArDQGlobals.HVeta_EMB["EMBC"][1],
        xmax=lArDQGlobals.HVeta_EMB["EMBC"][2],
        ybins=lArDQGlobals.HVphi_EMB["EMBC"][0],
        ymin=lArDQGlobals.HVphi_EMB["EMBC"][1],
        ymax=lArDQGlobals.HVphi_EMB["EMBC"][2],
        merge='weightedAverage')

    #EMECPS
    group_name_ending = "EMECPS"
    larAffectedRegAlg.EMECPSname = group_name_ending
    affectedRegGroupEMECPS = helper.addGroup(
        larAffectedRegAlg, affectedRegGroupName + group_name_ending, '/LAr/',
        'run')

    affectedRegGroupEMECPS.defineHistogram(
        'etaPOS,phi;LArAffectedRegionsEMECAPS',
        title='HV Affected Regions - EMECA - Presampler;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_EMEC["EMECAPS"],
        ybins=lArDQGlobals.HVphi_EMEC["EMECAPS"],
        merge='weightedAverage')
    affectedRegGroupEMECPS.defineHistogram(
        'etaNEG,phi;LArAffectedRegionsEMECCPS',
        title='HV Affected Regions - EMECC - Presampler;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_EMEC["EMECCPS"],
        ybins=lArDQGlobals.HVphi_EMEC["EMECCPS"],
        merge='weightedAverage')

    #EMEC
    group_name_ending = "EMEC"
    larAffectedRegAlg.EMECname = group_name_ending
    affectedRegGroupEMEC = helper.addGroup(
        larAffectedRegAlg, affectedRegGroupName + group_name_ending, '/LAr/',
        'run')

    affectedRegGroupEMEC.defineHistogram(
        'etaPOS,phi;LArAffectedRegionsEMECA',
        title='HV Affected Regions - EMECA - Samplings 1-3;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_EMEC["EMECA"],
        ybins=lArDQGlobals.HVphi_EMEC["EMECA"],
        merge='weightedAverage')
    affectedRegGroupEMEC.defineHistogram(
        'etaNEG,phi;LArAffectedRegionsEMECC',
        title='HV Affected Regions - EMECC - Samplings 1-3;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_EMEC["EMECC"],
        ybins=lArDQGlobals.HVphi_EMEC["EMECC"],
        merge='weightedAverage')

    #HEC0
    group_name_ending = "HEC0"
    larAffectedRegAlg.HEC0name = group_name_ending
    affectedRegGroupHEC0 = helper.addGroup(
        larAffectedRegAlg, affectedRegGroupName + group_name_ending, '/LAr/',
        'run')

    affectedRegGroupHEC0.defineHistogram(
        'etaPOS,phi;LArAffectedRegionsHECA0',
        title='HV Affected Regions - HECA - Layer 1;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_HECFcal["HECA"][0],
        xmin=lArDQGlobals.HVeta_HECFcal["HECA"][1],
        xmax=lArDQGlobals.HVeta_HECFcal["HECA"][2],
        ybins=lArDQGlobals.HVphi_HECFcal["HECA"][0],
        ymin=lArDQGlobals.HVphi_HECFcal["HECA"][1],
        ymax=lArDQGlobals.HVphi_HECFcal["HECA"][2],
        merge='weightedAverage')
    affectedRegGroupHEC0.defineHistogram(
        'etaNEG,phi;LArAffectedRegionsHECC0',
        title='HV Affected Regions - HECC - Layer 1;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_HECFcal["HECC"][0],
        xmin=lArDQGlobals.HVeta_HECFcal["HECC"][1],
        xmax=lArDQGlobals.HVeta_HECFcal["HECC"][2],
        ybins=lArDQGlobals.HVphi_HECFcal["HECC"][0],
        ymin=lArDQGlobals.HVphi_HECFcal["HECC"][1],
        ymax=lArDQGlobals.HVphi_HECFcal["HECC"][2],
        merge='weightedAverage')

    #HEC1
    group_name_ending = "HEC1"
    larAffectedRegAlg.HEC1name = group_name_ending
    affectedRegGroupHEC1 = helper.addGroup(
        larAffectedRegAlg, affectedRegGroupName + group_name_ending, '/LAr/',
        'run')

    affectedRegGroupHEC1.defineHistogram(
        'etaPOS,phi;LArAffectedRegionsHECA1',
        title='HV Affected Regions - HECA - Layer 2;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_HECFcal["HECA"][0],
        xmin=lArDQGlobals.HVeta_HECFcal["HECA"][1],
        xmax=lArDQGlobals.HVeta_HECFcal["HECA"][2],
        ybins=lArDQGlobals.HVphi_HECFcal["HECA"][0],
        ymin=lArDQGlobals.HVphi_HECFcal["HECA"][1],
        ymax=lArDQGlobals.HVphi_HECFcal["HECA"][2],
        merge='weightedAverage')
    affectedRegGroupHEC1.defineHistogram(
        'etaNEG,phi;LArAffectedRegionsHECC1',
        title='HV Affected Regions - HECC - Layer 2;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_HECFcal["HECC"][0],
        xmin=lArDQGlobals.HVeta_HECFcal["HECC"][1],
        xmax=lArDQGlobals.HVeta_HECFcal["HECC"][2],
        ybins=lArDQGlobals.HVphi_HECFcal["HECC"][0],
        ymin=lArDQGlobals.HVphi_HECFcal["HECC"][1],
        ymax=lArDQGlobals.HVphi_HECFcal["HECC"][2],
        merge='weightedAverage')

    #HEC2
    group_name_ending = "HEC2"
    larAffectedRegAlg.HEC2name = group_name_ending
    affectedRegGroupHEC2 = helper.addGroup(
        larAffectedRegAlg, affectedRegGroupName + group_name_ending, '/LAr/',
        'run')

    affectedRegGroupHEC2.defineHistogram(
        'etaPOS,phi;LArAffectedRegionsHECA2',
        title='HV Affected Regions - HECA - Layer 3;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_HECFcal["HECA"][0],
        xmin=lArDQGlobals.HVeta_HECFcal["HECA"][1],
        xmax=lArDQGlobals.HVeta_HECFcal["HECA"][2],
        ybins=lArDQGlobals.HVphi_HECFcal["HECA"][0],
        ymin=lArDQGlobals.HVphi_HECFcal["HECA"][1],
        ymax=lArDQGlobals.HVphi_HECFcal["HECA"][2],
        merge='weightedAverage')
    affectedRegGroupHEC2.defineHistogram(
        'etaNEG,phi;LArAffectedRegionsHECC2',
        title='HV Affected Regions - HECC - Layer 3;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_HECFcal["HECC"][0],
        xmin=lArDQGlobals.HVeta_HECFcal["HECC"][1],
        xmax=lArDQGlobals.HVeta_HECFcal["HECC"][2],
        ybins=lArDQGlobals.HVphi_HECFcal["HECC"][0],
        ymin=lArDQGlobals.HVphi_HECFcal["HECC"][1],
        ymax=lArDQGlobals.HVphi_HECFcal["HECC"][2],
        merge='weightedAverage')

    #HEC3
    group_name_ending = "HEC3"
    larAffectedRegAlg.HEC3name = group_name_ending
    affectedRegGroupHEC3 = helper.addGroup(
        larAffectedRegAlg, affectedRegGroupName + group_name_ending, '/LAr/',
        'run')

    affectedRegGroupHEC3.defineHistogram(
        'etaPOS,phi;LArAffectedRegionsHECA3',
        title='HV Affected Regions - HECA - Layer 4;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_HECFcal["HECA"][0],
        xmin=lArDQGlobals.HVeta_HECFcal["HECA"][1],
        xmax=lArDQGlobals.HVeta_HECFcal["HECA"][2],
        ybins=lArDQGlobals.HVphi_HECFcal["HECA"][0],
        ymin=lArDQGlobals.HVphi_HECFcal["HECA"][1],
        ymax=lArDQGlobals.HVphi_HECFcal["HECA"][2],
        merge='weightedAverage')
    affectedRegGroupHEC3.defineHistogram(
        'etaNEG,phi;LArAffectedRegionsHECC3',
        title='HV Affected Regions - HECC - Layer 4;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_HECFcal["HECC"][0],
        xmin=lArDQGlobals.HVeta_HECFcal["HECC"][1],
        xmax=lArDQGlobals.HVeta_HECFcal["HECC"][2],
        ybins=lArDQGlobals.HVphi_HECFcal["HECC"][0],
        ymin=lArDQGlobals.HVphi_HECFcal["HECC"][1],
        ymax=lArDQGlobals.HVphi_HECFcal["HECC"][2],
        merge='weightedAverage')

    #FCAL0
    group_name_ending = "FCAL0"
    larAffectedRegAlg.FCAL0name = group_name_ending
    affectedRegGroupFCAL0 = helper.addGroup(
        larAffectedRegAlg, affectedRegGroupName + group_name_ending, '/LAr/',
        'run')

    affectedRegGroupFCAL0.defineHistogram(
        'etaPOS,phi;LArAffectedRegionsFCALA0',
        title='HV Affected Regions - FCALA - Layer 1;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_HECFcal["FCalA"][0],
        xmin=lArDQGlobals.HVeta_HECFcal["FCalA"][1],
        xmax=lArDQGlobals.HVeta_HECFcal["FCalA"][2],
        ybins=lArDQGlobals.HVphi_HECFcal["FCalA"][0],
        ymin=lArDQGlobals.HVphi_HECFcal["FCalA"][1],
        ymax=lArDQGlobals.HVphi_HECFcal["FCalA"][2],
        merge='weightedAverage')
    affectedRegGroupFCAL0.defineHistogram(
        'etaNEG,phi;LArAffectedRegionsFCALC0',
        title='HV Affected Regions - FCALC - Layer 1;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_HECFcal["FCalC"][0],
        xmin=lArDQGlobals.HVeta_HECFcal["FCalC"][1],
        xmax=lArDQGlobals.HVeta_HECFcal["FCalC"][2],
        ybins=lArDQGlobals.HVphi_HECFcal["FCalC"][0],
        ymin=lArDQGlobals.HVphi_HECFcal["FCalC"][1],
        ymax=lArDQGlobals.HVphi_HECFcal["FCalC"][2],
        merge='weightedAverage')

    #FCAL1
    group_name_ending = "FCAL1"
    larAffectedRegAlg.FCAL1name = group_name_ending
    affectedRegGroupFCAL1 = helper.addGroup(
        larAffectedRegAlg, affectedRegGroupName + group_name_ending, '/LAr/',
        'run')

    affectedRegGroupFCAL1.defineHistogram(
        'etaPOS,phi;LArAffectedRegionsFCALA1',
        title='HV Affected Regions - FCALA - Layer 2;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_HECFcal["FCalA"][0],
        xmin=lArDQGlobals.HVeta_HECFcal["FCalA"][1],
        xmax=lArDQGlobals.HVeta_HECFcal["FCalA"][2],
        ybins=lArDQGlobals.HVphi_HECFcal["FCalA"][0],
        ymin=lArDQGlobals.HVphi_HECFcal["FCalA"][1],
        ymax=lArDQGlobals.HVphi_HECFcal["FCalA"][2],
        merge='weightedAverage')
    affectedRegGroupFCAL1.defineHistogram(
        'etaNEG,phi;LArAffectedRegionsFCALC1',
        title='HV Affected Regions - FCALC - Layer 2;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_HECFcal["FCalC"][0],
        xmin=lArDQGlobals.HVeta_HECFcal["FCalC"][1],
        xmax=lArDQGlobals.HVeta_HECFcal["FCalC"][2],
        ybins=lArDQGlobals.HVphi_HECFcal["FCalC"][0],
        ymin=lArDQGlobals.HVphi_HECFcal["FCalC"][1],
        ymax=lArDQGlobals.HVphi_HECFcal["FCalC"][2],
        merge='weightedAverage')

    #FCAL2
    group_name_ending = "FCAL2"
    larAffectedRegAlg.FCAL2name = group_name_ending
    affectedRegGroupFCAL2 = helper.addGroup(
        larAffectedRegAlg, affectedRegGroupName + group_name_ending, '/LAr/',
        'run')

    affectedRegGroupFCAL2.defineHistogram(
        'etaPOS,phi;LArAffectedRegionsFCALA2',
        title='HV Affected Regions - FCALA - Layer 3;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_HECFcal["FCalA"][0],
        xmin=lArDQGlobals.HVeta_HECFcal["FCalA"][1],
        xmax=lArDQGlobals.HVeta_HECFcal["FCalA"][2],
        ybins=lArDQGlobals.HVphi_HECFcal["FCalA"][0],
        ymin=lArDQGlobals.HVphi_HECFcal["FCalA"][1],
        ymax=lArDQGlobals.HVphi_HECFcal["FCalA"][2],
        merge='weightedAverage')
    affectedRegGroupFCAL2.defineHistogram(
        'etaNEG,phi;LArAffectedRegionsFCALC2',
        title='HV Affected Regions - FCALC - Layer 3;#eta;#phi',
        type='TH2F',
        path=larAffReg_hist_path,
        weight='problem',
        xbins=lArDQGlobals.HVeta_HECFcal["FCalC"][0],
        xmin=lArDQGlobals.HVeta_HECFcal["FCalC"][1],
        xmax=lArDQGlobals.HVeta_HECFcal["FCalC"][2],
        ybins=lArDQGlobals.HVphi_HECFcal["FCalC"][0],
        ymin=lArDQGlobals.HVphi_HECFcal["FCalC"][1],
        ymax=lArDQGlobals.HVphi_HECFcal["FCalC"][2],
        merge='weightedAverage')
示例#8
0
def LArCoverageConfigCore(helper, algoinstance, inputFlags):

    larCoverageAlg = helper.addAlgorithm(algoinstance, 'LArCoverageAlg')

    # adding BadChan masker private tool
    from AthenaConfiguration.ComponentFactory import isRun3Cfg
    if isRun3Cfg():
        from LArBadChannelTool.LArBadChannelConfig import LArBadChannelMaskerCfg  #,LArBadChannelCfg
        acc = LArBadChannelMaskerCfg(inputFlags,
                                     problemsToMask=[
                                         "highNoiseHG", "highNoiseMG",
                                         "highNoiseLG", "deadReadout",
                                         "deadPhys"
                                     ],
                                     ToolName="BadLArRawChannelMask")
        larCoverageAlg.LArBadChannelMask = acc.popPrivateTools()
        helper.resobj.merge(acc)
    else:
        from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
        theLArRCBMasker = LArBadChannelMasker("BadLArRawChannelMask")
        theLArRCBMasker.DoMasking = True
        theLArRCBMasker.ProblemsToMask = [
            "deadReadout", "deadPhys", "highNoiseHG", "highNoiseMG",
            "highNoiseLG"
        ]
        larCoverageAlg.LArBadChannelMask = theLArRCBMasker

    from LArMonitoring.GlobalVariables import lArDQGlobals

    #define the group names here, as you'll use them multiple times
    caloNoiseToolGroupName = "CaloNoise"
    nLayers = 4
    badChannelsGroupName = "BadChannels"
    coverageHWGroupName = "Coverage"
    partitionsBarrel = [
        lArDQGlobals.SubDet[0] + side for side in lArDQGlobals.Sides
    ]
    partitionsEndcap = [
        lArDQGlobals.SubDet[ip] + side for side in lArDQGlobals.Sides
        for ip in range(1, len(lArDQGlobals.SubDet))
    ]

    # Edit properties of a algorithm
    larCoverageAlg.CaloNoiseToolGroupName = caloNoiseToolGroupName
    larCoverageAlg.Nsample = nLayers
    larCoverageAlg.BadChannelsGroupName = badChannelsGroupName
    larCoverageAlg.Sides = lArDQGlobals.Sides
    larCoverageAlg.CoverageHWGroupName = coverageHWGroupName
    larCoverageAlg.CoverageBarrelPartitions = partitionsBarrel
    larCoverageAlg.CoverageEndcapPartitions = partitionsEndcap
    larCoverageAlg.NphiBinsEMB1 = lArDQGlobals.Cell_Variables["phiNbin"][
        "EMB"]["A"]["1"]
    larCoverageAlg.NphiBinsEMEC2 = lArDQGlobals.Cell_Variables["phiNbin"][
        "EMEC"]["A"]["2"]
    larCoverageAlg.NphiBinsHEC = [
        lArDQGlobals.Cell_Variables["phiNbin"]["HEC"]["A"]["0"],
        lArDQGlobals.Cell_Variables["phiNbin"]["HEC"]["A"]["1"],
        lArDQGlobals.Cell_Variables["phiNbin"]["HEC"]["A"]["2"],
        lArDQGlobals.Cell_Variables["phiNbin"]["HEC"]["A"]["3"]
    ]

    #Configure the CaloNoise
    from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg
    CaloNoiseCondAlg(noisetype="electronicNoise")

    #-- caloNoise groups --
    caloNoiseToolArrayEM = helper.addArray([nLayers], larCoverageAlg,
                                           caloNoiseToolGroupName + "EM")
    caloNoiseToolArrayHEC = helper.addArray([nLayers], larCoverageAlg,
                                            caloNoiseToolGroupName + "HEC")
    caloNoiseToolArrayFCAL = helper.addArray([nLayers], larCoverageAlg,
                                             caloNoiseToolGroupName + "FCAL")
    caloNoiseToolGroup = helper.addGroup(  #for the LB histogram
        larCoverageAlg, caloNoiseToolGroupName, '/LAr/', 'run')

    #-- badChannels groups --

    badChannelToolArrayBarrel = helper.addArray(
        [lArDQGlobals.Sides], larCoverageAlg, badChannelsGroupName + "Barrel",
        '/LAr/', 'run')
    badChannelToolArrayEndcap = helper.addArray(
        [lArDQGlobals.Sides], larCoverageAlg, badChannelsGroupName + "EndCap",
        '/LAr/', 'run')

    #-- CoverageHW groups --
    availErrCode = larCoverageAlg.AvailableErrorCodes

    #-- Coverage groups (eta-phi plots) --
    coverageToolArrayEMBA = helper.addArray([availErrCode], larCoverageAlg,
                                            coverageHWGroupName + "EMBA",
                                            '/LAr/', 'run')
    coverageToolArrayEMECA = helper.addArray([availErrCode], larCoverageAlg,
                                             coverageHWGroupName + "EMECA",
                                             '/LAr/', 'run')
    coverageToolArrayHECA = helper.addArray([availErrCode], larCoverageAlg,
                                            coverageHWGroupName + "HECA",
                                            '/LAr/', 'run')
    coverageToolArrayFCalA = helper.addArray([availErrCode], larCoverageAlg,
                                             coverageHWGroupName + "FCalA",
                                             '/LAr/', 'run')
    coverageToolArrayEMBC = helper.addArray([availErrCode], larCoverageAlg,
                                            coverageHWGroupName + "EMBC",
                                            '/LAr/', 'run')
    coverageToolArrayEMECC = helper.addArray([availErrCode], larCoverageAlg,
                                             coverageHWGroupName + "EMECC",
                                             '/LAr/', 'run')
    coverageToolArrayHECC = helper.addArray([availErrCode], larCoverageAlg,
                                            coverageHWGroupName + "HECC",
                                            '/LAr/', 'run')
    coverageToolArrayFCalC = helper.addArray([availErrCode], larCoverageAlg,
                                             coverageHWGroupName + "FCalC",
                                             '/LAr/', 'run')

    ### Configure histograms

    coveragePath = 'CoverageNewAlg/'

    # -- caloNoiseTool histograms --

    caloNoiseTool_path = coveragePath + 'CaloNoiseTool/'
    #LB histogram: need to know which LB the CaloNoiseTool histogram is about. Only add to caloNoiseToolGroup to avoid duplicates
    caloNoiseToolGroup.defineHistogram(
        'lb1_x;FirstLBnumber',
        type='TH1D',
        path=caloNoiseTool_path,
        title='CaloNoiseTool histogram are filled from this LB;;LB number',
        weight='lb1',
        xbins=1,
        xmin=-1,
        xmax=1)

    caloNoiseToolArrayEM.defineHistogram('etaChan,noise;CaloNoiseEM_Sampling',
                                         type='TProfile',
                                         path='LAr/' + caloNoiseTool_path,
                                         title='DBNoise in EM',
                                         xbins=lArDQGlobals.etaCaloNoise_Bins,
                                         xmax=lArDQGlobals.etaCaloNoise_Max,
                                         xmin=lArDQGlobals.etaCaloNoise_Min)

    caloNoiseToolArrayHEC.defineHistogram(
        'etaChan,noise;CaloNoiseHEC_Sampling',
        type='TProfile',
        path='LAr/' + caloNoiseTool_path,
        title='DBNoise in HEC',
        xbins=lArDQGlobals.etaCaloNoise_Bins,
        xmax=lArDQGlobals.etaCaloNoise_Max,
        xmin=lArDQGlobals.etaCaloNoise_Min)
    caloNoiseToolArrayFCAL.defineHistogram(
        'etaChan,noise;CaloNoiseFCAL_Sampling',
        type='TProfile',
        path='LAr/' + caloNoiseTool_path,
        title='DBNoise in FCAL',
        xbins=lArDQGlobals.etaCaloNoise_FcalBins,
        xmax=lArDQGlobals.etaCaloNoise_FcalMax,
        xmin=lArDQGlobals.etaCaloNoise_FcalMin)

    # -- badChannels histograms --
    badChannels_path = coveragePath + 'BadChannels/'
    badChannelToolArrayBarrel.defineHistogram(
        'mon_FtSlot,single_channel;DBBadChannelsBarrel',
        type='TH2I',
        path=badChannels_path,
        title=
        'Known Bad Channels - Barrel {0};Feedthrough(+Slot increasing);Channel',
        weight='flag',
        xbins=lArDQGlobals.Feedthrough_Slot_Nbins[
            "EMBA"],  #bins from A side also used for C, they're the same
        xmin=lArDQGlobals.Feedthrough_Slot_range["EMBA"][0],
        xmax=lArDQGlobals.Feedthrough_Slot_range["EMBA"][1],
        ybins=lArDQGlobals.FEB_N_channels,
        ymin=-0.5,
        ymax=lArDQGlobals.FEB_N_channels - 0.5,
        xlabels=lArDQGlobals.Feedthrough_Slot_labels_Barrel,
        merge='weightedAverage')
    badChannelToolArrayEndcap.defineHistogram(
        'mon_FtSlot,single_channel;DBBadChannelsEndcap',
        type='TH2I',
        path=badChannels_path,
        title=
        'Known Bad Channels - Endcap {0};Feedthrough(+Slot increasing);Channel',
        weight='flag',
        xbins=lArDQGlobals.Feedthrough_Slot_Nbins[
            "EMECA"],  #bins from A side also used for C, they're the same
        xmin=lArDQGlobals.Feedthrough_Slot_range["EMECA"][0],
        xmax=lArDQGlobals.Feedthrough_Slot_range["EMECA"][1],
        ybins=lArDQGlobals.FEB_N_channels,
        ymin=-0.5,
        ymax=lArDQGlobals.FEB_N_channels - 0.5,
        xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap,
        merge='weightedAverage')

    #--coverageHW histograms
    coverage_path = coveragePath + 'perPartition/'
    coverageToolArrayEMBA.defineHistogram(
        'mon_ChanFtSlot,mon_Channels;CoverageHW_EMBA_statusCode',
        type='TH2I',
        path=coverage_path,
        title=
        'Coverage - EMBA - statusCode={0};Feedthrough(+Slot increasing);Channel',
        xbins=lArDQGlobals.Feedthrough_Slot_Nbins["EMBA"],
        xmin=lArDQGlobals.Feedthrough_Slot_range["EMBA"][0],
        xmax=lArDQGlobals.Feedthrough_Slot_range["EMBA"][1],
        ybins=lArDQGlobals.FEB_N_channels,
        ymin=-0.5,
        ymax=lArDQGlobals.FEB_N_channels - 0.5,
        xlabels=lArDQGlobals.Feedthrough_Slot_labels_Barrel)

    coverageToolArrayEMBC.defineHistogram(
        'mon_ChanFtSlot,mon_Channels;CoverageHW_EMBC_statusCode',
        type='TH2I',
        path=coverage_path,
        title=
        'Coverage - EMBC - statusCode={0};Feedthrough(+Slot increasing);Channel',
        xbins=lArDQGlobals.Feedthrough_Slot_Nbins["EMBC"],
        xmin=lArDQGlobals.Feedthrough_Slot_range["EMBC"][0],
        xmax=lArDQGlobals.Feedthrough_Slot_range["EMBC"][1],
        ybins=lArDQGlobals.FEB_N_channels,
        ymin=-0.5,
        ymax=lArDQGlobals.FEB_N_channels - 0.5,
        xlabels=lArDQGlobals.Feedthrough_Slot_labels_Barrel)

    coverageToolArrayEMECA.defineHistogram(
        'mon_ChanFtSlot,mon_Channels;CoverageHW_EMECA_statusCode',
        type='TH2I',
        path=coverage_path,
        title=
        'Coverage - EMECA - statusCode={0};Feedthrough(+Slot increasing);Channel',
        xbins=lArDQGlobals.Feedthrough_Slot_Nbins["EMECA"],
        xmin=lArDQGlobals.Feedthrough_Slot_range["EMECA"][0],
        xmax=lArDQGlobals.Feedthrough_Slot_range["EMECA"][1],
        ybins=lArDQGlobals.FEB_N_channels,
        ymin=-0.5,
        ymax=lArDQGlobals.FEB_N_channels - 0.5,
        xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap)

    coverageToolArrayEMECC.defineHistogram(
        'mon_ChanFtSlot,mon_Channels;CoverageHW_EMECA_statusCode',
        type='TH2I',
        path=coverage_path,
        title=
        'Coverage - EMECC - statusCode={0};Feedthrough(+Slot increasing);Channel',
        xbins=lArDQGlobals.Feedthrough_Slot_Nbins["EMECC"],
        xmin=lArDQGlobals.Feedthrough_Slot_range["EMECC"][0],
        xmax=lArDQGlobals.Feedthrough_Slot_range["EMECC"][1],
        ybins=lArDQGlobals.FEB_N_channels,
        ymin=-0.5,
        ymax=lArDQGlobals.FEB_N_channels - 0.5,
        xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap)

    coverageToolArrayHECA.defineHistogram(
        'mon_ChanFtSlot,mon_Channels;CoverageHW_HECA_statusCode',
        type='TH2I',
        path=coverage_path,
        title=
        'Coverage - HECA - statusCode={0};Feedthrough(+Slot increasing);Channel',
        xbins=lArDQGlobals.Feedthrough_Slot_Nbins["HECA"],
        xmin=lArDQGlobals.Feedthrough_Slot_range["HECA"][0],
        xmax=lArDQGlobals.Feedthrough_Slot_range["HECA"][1],
        ybins=lArDQGlobals.FEB_N_channels,
        ymin=-0.5,
        ymax=lArDQGlobals.FEB_N_channels - 0.5,
        xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap)

    coverageToolArrayHECC.defineHistogram(
        'mon_ChanFtSlot,mon_Channels;CoverageHW_HECA_statusCode',
        type='TH2I',
        path=coverage_path,
        title=
        'Coverage - HECC - statusCode={0};Feedthrough(+Slot increasing);Channel',
        xbins=lArDQGlobals.Feedthrough_Slot_Nbins["HECC"],
        xmin=lArDQGlobals.Feedthrough_Slot_range["HECC"][0],
        xmax=lArDQGlobals.Feedthrough_Slot_range["HECC"][1],
        ybins=lArDQGlobals.FEB_N_channels,
        ymin=-0.5,
        ymax=lArDQGlobals.FEB_N_channels - 0.5,
        xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap)

    coverageToolArrayFCalA.defineHistogram(
        'mon_ChanFtSlot,mon_Channels;CoverageHW_FCalA_statusCode',
        type='TH2I',
        path=coverage_path,
        title=
        'Coverage - FCalA - statusCode={0};Feedthrough(+Slot increasing);Channel',
        xbins=lArDQGlobals.Feedthrough_Slot_Nbins["FCalA"],
        xmin=lArDQGlobals.Feedthrough_Slot_range["FCalA"][0],
        xmax=lArDQGlobals.Feedthrough_Slot_range["FCalA"][1],
        ybins=lArDQGlobals.FEB_N_channels,
        ymin=-0.5,
        ymax=lArDQGlobals.FEB_N_channels - 0.5,
        xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap)

    coverageToolArrayFCalC.defineHistogram(
        'mon_ChanFtSlot,mon_Channels;CoverageHW_FCalC_statusCode',
        type='TH2I',
        path=coverage_path,
        title=
        'Coverage - FCalC - statusCode={0};Feedthrough(+Slot increasing);Channel',
        xbins=lArDQGlobals.Feedthrough_Slot_Nbins["FCalC"],
        xmin=lArDQGlobals.Feedthrough_Slot_range["FCalC"][0],
        xmax=lArDQGlobals.Feedthrough_Slot_range["FCalC"][1],
        ybins=lArDQGlobals.FEB_N_channels,
        ymin=-0.5,
        ymax=lArDQGlobals.FEB_N_channels - 0.5,
        xlabels=lArDQGlobals.Feedthrough_Slot_labels_Endcap)

    coverageToolArrayEMBA.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling0EMBA_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 0 - EMBA;#eta;#phi',
        cutmask='isSampl0',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["A"]["0"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["A"]["0"])

    coverageToolArrayEMBA.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling1EMBA_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 1 - EMBA;#eta;#phi',
        cutmask='isSampl1',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["A"]["1"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["A"]["1"])

    coverageToolArrayEMBA.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling2EMBA_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 2 - EMBA;#eta;#phi',
        cutmask='isSampl2',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["A"]["2"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["A"]["2"])

    coverageToolArrayEMBA.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling3EMBA_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 3 - EMBA;#eta;#phi',
        cutmask='isSampl3',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["A"]["3"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["A"]["3"])

    coverageToolArrayEMBC.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling0EMBC_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 0 - EMBC;#eta;#phi',
        cutmask='isSampl0',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["C"]["0"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["C"]["0"])

    coverageToolArrayEMBC.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling1EMBC_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 1 - EMBC;#eta;#phi',
        cutmask='isSampl1',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["C"]["1"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["C"]["1"])

    coverageToolArrayEMBC.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling2EMBC_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 2 - EMBC;#eta;#phi',
        cutmask='isSampl2',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["C"]["2"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["C"]["2"])

    coverageToolArrayEMBC.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling3EMBC_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 3 - EMBC;#eta;#phi',
        cutmask='isSampl3',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMB"]["C"]["3"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMB"]["C"]["3"])

    coverageToolArrayEMECA.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling0EMECA_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 0 - EMECA;#eta;#phi',
        cutmask='isSampl0',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["0"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["0"])

    coverageToolArrayEMECA.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling1EMECA_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 1 - EMECA;#eta;#phi',
        cutmask='isSampl1',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["1"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["1"])

    coverageToolArrayEMECA.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling2EMECA_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 2 - EMECA;#eta;#phi',
        cutmask='isSampl2',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["2"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["2"])

    coverageToolArrayEMECA.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling3EMECA_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 3 - EMECA;#eta;#phi',
        cutmask='isSampl3',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["A"]["3"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["A"]["3"])

    coverageToolArrayEMECC.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling0EMECC_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 0 - EMECC;#eta;#phi',
        cutmask='isSampl0',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["0"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["0"])

    coverageToolArrayEMECC.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling1EMECC_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 1 - EMECC;#eta;#phi',
        cutmask='isSampl1',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["1"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["1"])

    coverageToolArrayEMECC.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling2EMECC_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 2 - EMECC;#eta;#phi',
        cutmask='isSampl2',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["2"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["2"])

    coverageToolArrayEMECC.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling3EMECC_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 3 - EMECC;#eta;#phi',
        cutmask='isSampl3',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["EMEC"]["C"]["3"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["EMEC"]["C"]["3"])

    coverageToolArrayHECA.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling0HECA_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 0 - HECA;#eta;#phi',
        cutmask='isSampl0',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["A"]["0"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["A"]["0"])

    coverageToolArrayHECA.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling1HECA_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 1 - HECA;#eta;#phi',
        cutmask='isSampl1',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["A"]["1"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["A"]["1"])

    coverageToolArrayHECA.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling2HECA_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 2 - HECA;#eta;#phi',
        cutmask='isSampl2',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["A"]["2"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["A"]["2"])

    coverageToolArrayHECA.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling3HECA_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 3 - HECA;#eta;#phi',
        cutmask='isSampl3',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["A"]["3"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["A"]["3"])

    coverageToolArrayHECC.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling0HECC_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 0 - HECC;#eta;#phi',
        cutmask='isSampl0',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["C"]["0"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["C"]["0"])

    coverageToolArrayHECC.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling1HECC_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 1 - HECC;#eta;#phi',
        cutmask='isSampl1',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["C"]["1"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["C"]["1"])

    coverageToolArrayHECC.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling2HECC_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 2 - HECC;#eta;#phi',
        cutmask='isSampl2',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["C"]["2"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["C"]["2"])

    coverageToolArrayHECC.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling3HECC_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 3 - HECC;#eta;#phi',
        cutmask='isSampl3',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["HEC"]["C"]["3"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["HEC"]["C"]["3"])

    coverageToolArrayFCalA.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling1FCalA_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 1 - FCalA;#eta;#phi',
        cutmask='isSampl1',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["A"]["1"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["A"]["1"])

    coverageToolArrayFCalA.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling2FCalA_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 2 - FCalA;#eta;#phi',
        cutmask='isSampl2',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["A"]["2"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["A"]["2"])

    coverageToolArrayFCalA.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling3FCalA_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 3 - FCalA;#eta;#phi',
        cutmask='isSampl3',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["A"]["3"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["A"]["3"])

    coverageToolArrayFCalC.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling1FCalC_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 1 - FCalC;#eta;#phi',
        cutmask='isSampl1',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["C"]["1"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["C"]["1"])

    coverageToolArrayFCalC.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling2FCalC_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 2 - FCalC;#eta;#phi',
        cutmask='isSampl2',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["C"]["2"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["C"]["2"])

    coverageToolArrayFCalC.defineHistogram(
        'mon_Eta,mon_Phi;CoverSampling3FCalC_StatusCode',
        type='TH2I',
        path=coverage_path,
        title='Coverage status code={0} - Sampling 3 - FCalC;#eta;#phi',
        cutmask='isSampl3',
        xbins=lArDQGlobals.Cell_Variables["etaRange"]["FCal"]["C"]["3"],
        ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["C"]["3"])
示例#9
0
def LArDigitMonConfigCore(helper, algoinstance, inputFlags):

    from LArMonitoring.GlobalVariables import lArDQGlobals

    larDigitMonAlg = helper.addAlgorithm(algoinstance, 'larDigitMonAlg')

    summaryGroupName = "Summary"
    nslots = []
    for i in range(0, len(lArDQGlobals.FEB_Slot)):
        nslots.append(lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[i]][1])

    larDigitMonAlg.SummaryMonGroup = summaryGroupName
    larDigitMonAlg.LArDigitsSubDetNames = lArDQGlobals.SubDet
    larDigitMonAlg.LArDigitsPartitionNames = lArDQGlobals.Partitions
    larDigitMonAlg.LArDigitsNslots = nslots

    # adding BadChan masker private tool
    from AthenaConfiguration.ComponentFactory import isRun3Cfg
    if isRun3Cfg():
        from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
        cfg = ComponentAccumulator()

        from LArBadChannelTool.LArBadChannelConfig import LArBadChannelMaskerCfg
        acc = LArBadChannelMaskerCfg(inputFlags,
                                     problemsToMask=[
                                         "highNoiseHG", "highNoiseMG",
                                         "highNoiseLG", "deadReadout",
                                         "deadPhys"
                                     ],
                                     ToolName="BadLArRawChannelMask")
        larDigitMonAlg.LArBadChannelMask = acc.popPrivateTools()
        cfg.merge(acc)
    else:

        from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
        theLArBadChannelsMasker = LArBadChannelMasker("BadLArRawChannelMask")
        theLArBadChannelsMasker.DoMasking = True
        theLArBadChannelsMasker.ProblemsToMask = [
            "deadReadout", "deadPhys", "short", "almostDead", "highNoiseHG",
            "highNoiseMG", "highNoiseLG", "sporadicBurstNoise"
        ]
        larDigitMonAlg.LArBadChannelMask = theLArBadChannelsMasker

    summaryGroup = helper.addGroup(larDigitMonAlg, summaryGroupName,
                                   '/LAr/DigitsNewAlg')

    summary_hist_path = summaryGroupName + '/'

    summaryGroup.defineHistogram('sumbin,partition;Summary',
                                 title='Gain',
                                 type='TH2F',
                                 path=summary_hist_path,
                                 weight='weight',
                                 xbins=lArDQGlobals.N_DigitsSummary,
                                 xmin=-0.5,
                                 xmax=lArDQGlobals.N_DigitsSummary - 0.5,
                                 ybins=lArDQGlobals.N_Partitions,
                                 ymin=-0.5,
                                 ymax=lArDQGlobals.N_Partitions - 0.5,
                                 xlabels=lArDQGlobals.DigitsSummary,
                                 ylabels=lArDQGlobals.Partitions)
    summaryGroup.defineHistogram('gain,partition;summaryGain',
                                 title='Gain',
                                 type='TH2F',
                                 path=summary_hist_path,
                                 weight='weight',
                                 xbins=lArDQGlobals.N_Gains,
                                 xmin=-0.5,
                                 xmax=lArDQGlobals.N_Gains - 0.5,
                                 ybins=lArDQGlobals.N_Partitions,
                                 ymin=-0.5,
                                 ymax=lArDQGlobals.N_Partitions - 0.5,
                                 xlabels=lArDQGlobals.Gains,
                                 ylabels=lArDQGlobals.Partitions)

    # now individual partitions, because we need a different directories, will have only 2dim arrays (side)
    for subdet in range(0, lArDQGlobals.N_SubDet):
        array = helper.addArray(
            [lArDQGlobals.Partitions[2 * subdet:2 * subdet + 2]],
            larDigitMonAlg, lArDQGlobals.SubDet[subdet])
        hist_path = '/LAr/DigitsNewAlg/' + lArDQGlobals.SubDet[subdet] + '/'
        slot_low = lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[subdet *
                                                                 2]][0] - 0.5
        slot_up = lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[subdet *
                                                                2]][1] + 0.5
        slot_n = int(slot_up - slot_low)
        ft_low = lArDQGlobals.FEB_Feedthrough[lArDQGlobals.Partitions[
            subdet * 2]][0] - 0.5
        ft_up = lArDQGlobals.FEB_Feedthrough[lArDQGlobals.Partitions[
            subdet * 2]][1] + 0.5
        ft_n = int(ft_up - ft_low)
        chan_n = lArDQGlobals.FEB_N_channels
        chan_low = lArDQGlobals.FEB_channels_Min
        chan_up = lArDQGlobals.FEB_channels_Max
        crates_n = lArDQGlobals.FEB_Crates[lArDQGlobals.Partitions[subdet *
                                                                   2]][1]
        crates_low = 0.5
        crates_up = lArDQGlobals.FEB_Crates[lArDQGlobals.Partitions[
            subdet * 2]][1] + 0.5
        array.defineHistogram('Outslot,OutFT;tOutOfRange',
                              title='% chan/FEB/events with max out of ',
                              type='TH2I',
                              path=hist_path,
                              weight='weight',
                              xbins=int(slot_n),
                              xmin=slot_low,
                              xmax=slot_up,
                              ybins=int(ft_n),
                              ymin=ft_low,
                              ymax=ft_up)
        array.defineHistogram('Outslot,OutFT,Outweight;OutOfRange',
                              title='% chan/FEB/events with max out of ',
                              type='TProfile2D',
                              path=hist_path,
                              xbins=int(slot_n),
                              xmin=slot_low,
                              xmax=slot_up,
                              ybins=int(ft_n),
                              ymin=ft_low,
                              ymax=ft_up)
        array.defineHistogram('Outcrate,Outchan;OutOfRangeChan',
                              title='% chan/FEB/events with max out of  ',
                              type='TH2I',
                              path=hist_path,
                              weight='weight',
                              xbins=crates_n,
                              xmin=crates_low,
                              xmax=crates_up,
                              ybins=chan_n,
                              ymin=chan_low,
                              ymax=chan_up)

        array.defineHistogram('Saturslot,SaturFT;tSaturation',
                              title='% chan/FEB/events with max=4095 ADC ',
                              type='TH2I',
                              path=hist_path,
                              weight='weight',
                              xbins=int(slot_n),
                              xmin=slot_low,
                              xmax=slot_up,
                              ybins=int(ft_n),
                              ymin=ft_low,
                              ymax=ft_up)
        array.defineHistogram('Saturslot,SaturFT,Saturweight;Saturation',
                              title='% chan/FEB/events with max=4095 ADC ',
                              type='TProfile2D',
                              path=hist_path,
                              xbins=int(slot_n),
                              xmin=slot_low,
                              xmax=slot_up,
                              ybins=int(ft_n),
                              ymin=ft_low,
                              ymax=ft_up)
        array.defineHistogram(
            'Saturcrate,Saturchan;SaturationChan',
            title=
            '% chan/FEB/events with max=4095 ADC - Med/High Gain - All Stream',
            type='TH2I',
            path=hist_path,
            weight='Saturweight',
            xbins=crates_n,
            xmin=crates_low,
            xmax=crates_up,
            ybins=chan_n,
            ymin=chan_low,
            ymax=chan_up)

        array.defineHistogram('SaturLowslot,SaturLowFT;tSaturationLow',
                              title='% chan/FEB/events with max=4095 ADC ',
                              type='TH2I',
                              path=hist_path,
                              xbins=int(slot_n),
                              xmin=slot_low,
                              xmax=slot_up,
                              ybins=int(ft_n),
                              ymin=ft_low,
                              ymax=ft_up)
        array.defineHistogram(
            'SaturLowslot,SaturLowFT,SaturLowweight;SaturationLow',
            title='% chan/FEB/events with max=4095 ADC ',
            type='TProfile2D',
            path=hist_path,
            xbins=int(slot_n),
            xmin=slot_low,
            xmax=slot_up,
            ybins=int(ft_n),
            ymin=ft_low,
            ymax=ft_up)
        array.defineHistogram(
            'SaturLowcrate,SaturLowchan;SaturationChanLow',
            title='% chan/FEB/events with max=4095 ADC - Low Gain - All Stream',
            type='TH2I',
            path=hist_path,
            weight='SaturLowweight',
            xbins=crates_n,
            xmin=crates_low,
            xmax=crates_up,
            ybins=chan_n,
            ymin=chan_low,
            ymax=chan_up)

        array.defineHistogram('Nullslot,NullFT;tNullDigit',
                              title='% chan/FEB/events with min=0 ADC ',
                              type='TH2I',
                              path=hist_path,
                              weight='weight',
                              xbins=int(slot_n),
                              xmin=slot_low,
                              xmax=slot_up,
                              ybins=int(ft_n),
                              ymin=ft_low,
                              ymax=ft_up)
        array.defineHistogram('Nullslot,NullFT,Nullweight;NullDigit',
                              title='% chan/FEB/events with min=0 ADC ',
                              type='TProfile2D',
                              path=hist_path,
                              xbins=int(slot_n),
                              xmin=slot_low,
                              xmax=slot_up,
                              ybins=int(ft_n),
                              ymin=ft_low,
                              ymax=ft_up)
        array.defineHistogram(
            'Nullcrate,Nullchan;NullDigitChan',
            title='% chan/FEB/events with min=0 ADC - All Gain - All Stream',
            type='TH2I',
            path=hist_path,
            xbins=crates_n,
            xmin=crates_low,
            xmax=crates_up,
            ybins=chan_n,
            ymin=chan_low,
            ymax=chan_up)

        array.defineHistogram('slot,FT,MaxPos;AvePosMaxDig',
                              title='Average position of Max Digit ',
                              type='TProfile2D',
                              path=hist_path,
                              xbins=int(slot_n),
                              xmin=slot_low,
                              xmax=slot_up,
                              ybins=int(ft_n),
                              ymin=ft_low,
                              ymax=ft_up)

        array.defineHistogram('LBN,MaxPos;MaxVsTime',
                              title='Average Max Sample vs LumiBlock ',
                              type='TProfile',
                              path=hist_path,
                              xbins=lArDQGlobals.LB_Bins,
                              xmin=lArDQGlobals.LB_Min,
                              xmax=lArDQGlobals.LB_Max)
        array.defineHistogram('MaxPos,Energy;EnVsTime',
                              title='Energy vs max sample ',
                              type='TH2F',
                              path=hist_path,
                              xbins=lArDQGlobals.Samples_Bins,
                              xmin=lArDQGlobals.Samples_Min,
                              xmax=lArDQGlobals.Samples_Max,
                              ybins=lArDQGlobals.Energy_Bins,
                              ymin=lArDQGlobals.Energy_Min,
                              ymax=lArDQGlobals.Energy_Max)

        array.defineHistogram(
            'l1trig,MaxPos;TriggerWord',
            title='Position of max sample per L1 trigger word (8 bits) ',
            type='TProfile',
            path=hist_path,
            xbins=lArDQGlobals.L1Trig_Bins,
            xmin=lArDQGlobals.L1Trig_Min,
            xmax=lArDQGlobals.L1Trig_Max)

        array.defineHistogram('Sample,SignalNorm;SignShape',
                              title='Normalized Signal Shape ',
                              type='TProfile',
                              weight='weight',
                              path=hist_path,
                              xbins=lArDQGlobals.Samples_Bins,
                              xmin=lArDQGlobals.Samples_Min,
                              xmax=lArDQGlobals.Samples_Max)

    if isRun3Cfg():
        cfg.merge(helper.result())
        return cfg
    else:
        return helper.result()