예제 #1
0
    def __init__(self, name='TrigCaloDataAccessSvc'):
        super(TrigCaloDataAccessSvc, self).__init__(name)

        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
        from TriggerJobOpts.TriggerFlags import TriggerFlags
        from AthenaCommon.GlobalFlags import globalflags
        from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
        from AthenaCommon.Logging import logging
        log = logging.getLogger(name)


        if ( globalflags.DatabaseInstance == "COMP200" and TriggerFlags.doCaloOffsetCorrection() ) :
            log.warning("Not possible to run BCID offset correction with COMP200")
        else:
            if TriggerFlags.doCaloOffsetCorrection():
                if globalflags.DataSource()=='data' and athenaCommonFlags.isOnline():
                    log.info('Enable HLT calo offset correction for data')
                    from IOVDbSvc.CondDB import conddb
                    conddb.addFolder("LAR_ONL","/LAR/ElecCalibFlat/OFC")
                    from LArRecUtils.LArRecUtilsConf import LArFlatConditionSvc
                    svcMgr += LArFlatConditionSvc()
                    svcMgr.LArFlatConditionSvc.OFCInput="/LAR/ElecCalibFlat/OFC"
                    svcMgr.ProxyProviderSvc.ProviderNames += [ "LArFlatConditionSvc" ]

                    from IOVDbSvc.CondDB import conddb
                    conddb.addFolder("LAR_ONL","/LAR/ElecCalibFlat/OFC",className = 'CondAttrListCollection')

                    from AthenaCommon.AlgSequence import AthSequencer
                    condSequence = AthSequencer("AthCondSeq")
                    from LArRecUtils.LArRecUtilsConf import LArFlatConditionsAlg_LArOFCFlat_ as LArOFCCondAlg
                    condSequence += LArOFCCondAlg (ReadKey="/LAR/ElecCalibFlat/OFC", WriteKey='LArOFC')
                    from LumiBlockComps.LuminosityCondAlgDefault import LuminosityCondAlgOnlineDefault
                    LuminosityCondAlgOnlineDefault()
                    from CaloRec.CaloBCIDAvgAlgDefault import CaloBCIDAvgAlgDefault
                    CaloBCIDAvgAlgDefault()
                else:
                    log.info('Enable HLT calo offset correction for MC')
                    from CaloRec.CaloBCIDAvgAlgDefault import CaloBCIDAvgAlgDefault
                    CaloBCIDAvgAlgDefault()

                from AthenaCommon.AlgSequence import AlgSequence
                topSequence = AlgSequence()
                if not hasattr(topSequence,"CaloBCIDAvgAlg"):
                    log.info('Cannot use timer for CaloBCIDAvgAlg')
                else:
                    from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
                    monTool = GenericMonitoringTool('MonTool')
                    monTool.defineHistogram('TIME_exec', path='EXPERT', type='TH1F', title="CaloBCIDAvgAlg execution time; time [ us ] ; Nruns", xbins=80, xmin=0.0, xmax=4000)
                    topSequence.CaloBCIDAvgAlg.MonTool = monTool
                    log.info('using timer for CaloBCIDAvgAlg')


            else:
                log.info('Disable HLT calo offset correction')

        return
예제 #2
0
    def __init__(self, name='TrigDataAccess'):
        super(TrigDataAccess, self).__init__(name)

        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
        from TriggerJobOpts.TriggerFlags import TriggerFlags
        from AthenaCommon.GlobalFlags import globalflags
        from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
        from AthenaCommon.Logging import logging
        log = logging.getLogger(name)

        self.loadFullCollections = (TriggerFlags.doEF()
                                    or TriggerFlags.doHLT())
        self.loadAllSamplings = (TriggerFlags.doLVL2() or TriggerFlags.doHLT())

        if (globalflags.DatabaseInstance == "COMP200"
                and TriggerFlags.doCaloOffsetCorrection()):
            self.ApplyOffsetCorrection = False
            log.warning(
                "Not possible to run BCID offset correction with COMP200")
        else:
            if TriggerFlags.doCaloOffsetCorrection():
                log.info('Enable HLT calo offset correction')
                if globalflags.DataSource(
                ) == 'data' and athenaCommonFlags.isOnline():
                    from IOVDbSvc.CondDB import conddb
                    conddb.addFolder("LAR_ONL", "/LAR/ElecCalibFlat/OFC")
                    from LArRecUtils.LArRecUtilsConf import LArFlatConditionSvc
                    svcMgr += LArFlatConditionSvc()
                    svcMgr.LArFlatConditionSvc.OFCInput = "/LAR/ElecCalibFlat/OFC"
                    svcMgr.ProxyProviderSvc.ProviderNames += [
                        "LArFlatConditionSvc"
                    ]

                from CaloTools.CaloLumiBCIDToolDefault import CaloLumiBCIDToolDefault
                theCaloLumiBCIDTool = CaloLumiBCIDToolDefault()
                svcMgr.ToolSvc += theCaloLumiBCIDTool
                self.CaloLumiBCIDTool = theCaloLumiBCIDTool
                self.ApplyOffsetCorrection = True
            else:
                log.info('Disable HLT calo offset correction')
                self.ApplyOffsetCorrection = False

        from RecExConfig.RecFlags import rec
        transientBS = (rec.readRDO()
                       and not globalflags.InputFormat() == 'bytestream')
        if (transientBS or TriggerFlags.writeBS()):
            if (not hasattr(svcMgr.ToolSvc, 'LArRawDataContByteStreamTool')):
                from LArByteStream.LArByteStreamConfig import LArRawDataContByteStreamToolConfig
                svcMgr.ToolSvc += LArRawDataContByteStreamToolConfig()
            svcMgr.ToolSvc.LArRawDataContByteStreamTool.DSPRunMode = 4
            svcMgr.ToolSvc.LArRawDataContByteStreamTool.RodBlockVersion = 10

        return
예제 #3
0
    def configure(self):
        mlog = logging.getLogger( 'LArSCL1Getter::configure:' )
        mlog.info ('entering')        

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

        if not theLArSCL1Getter.usable():
            if not self.ignoreConfigError():
                mlog.error("LArSCL1Getter unusable. Quit.")
                return False
            else:
                mlog.error("LArSCL1Getter unusable. Continue nevertheless")
                
        # Instantiation of the C++ algorithm
        try:        
            from LArL1Sim.LArL1SimConf import LArSCL1Maker                
        except:
            mlog.error("could not import LArL1Sim.LArSCL1Maker")
            print traceback.format_exc()
            return False

        theLArSCL1Maker=LArSCL1Maker()
        from AthenaCommon.AppMgr import ToolSvc
        from LArRecUtils.LArAutoCorrNoiseSCToolDefault import LArAutoCorrNoiseSCToolDefault
        theLArAutoCorrNoiseSCTool = LArAutoCorrNoiseSCToolDefault()
        ToolSvc+=theLArAutoCorrNoiseSCTool
        theLArSCL1Maker.AutoCorrNoiseTool = theLArAutoCorrNoiseSCTool

        from LArRecUtils.LArADC2MeVSCToolDefault import LArADC2MeVSCToolDefault
        theLArADC2MeVSCTool = LArADC2MeVSCToolDefault()
        ToolSvc+=theLArADC2MeVSCTool
        theLArSCL1Maker.ADC2MeVTool = theLArADC2MeVSCTool

        theLArSCL1Maker.SCL1ContainerName = "LArDigitSCL1"

        self._LArSCL1Maker = theLArSCL1Maker ;

        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        # check if LArdigitization is run before. If yes, uses hit map from detector store produces from lardigitization
        from Digitization.DigitizationFlags import jobproperties
        from AthenaCommon.DetFlags import DetFlags
        if DetFlags.digitize.LAr_on():
            mlog.info("Using hit map from LArDigitMaker algoritm")
        else:
            mlog.info("digitmaker1 not found in topSequence, using own map in LArSCL1Maker")
            return False
        
        # now add algorithm to topSequence
        # this should always come at the end
        from IOVDbSvc.CondDB import conddb
        if ( conddb.isMC and not conddb.folderRequested('/LAR/IdentifierOfl/OnOffIdMap_SC') ) :
            conddb.addFolder("LAR_OFL","<tag>LARIdentifierOflOnOffIdMap_SC-000</tag>/LAR/IdentifierOfl/OnOffIdMap_SC")
        if ( conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/fSampl') ) :
            conddb.addFolder("LAR_OFL","<tag>LARElecCalibMCSCfSampl-000</tag>/LAR/ElecCalibMCSC/fSampl")
        if ( conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/Pedestal') ) :
            conddb.addFolder("LAR_OFL","<tag>LARElecCalibMCSCPedestal-000</tag>/LAR/ElecCalibMCSC/Pedestal")
        if ( conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/Noise') ) :
            conddb.addFolder("LAR_OFL","<tag>LARElecCalibMCSCNoise-000</tag>/LAR/ElecCalibMCSC/Noise")
        if ( conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/Shape') ) :
            conddb.addFolder("LAR_OFL","<tag>LARElecCalibMCSCShape-000</tag>/LAR/ElecCalibMCSC/Shape")

        from LArRecUtils.LArRecUtilsConf import LArFlatConditionSvc
        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
        if not hasattr(svcMgr,"LArFlatConditionSvc"):
           svcMgr+=LArFlatConditionSvc()
           svcMgr.ProxyProviderSvc.ProviderNames += [ "LArFlatConditionSvc" ]
        svcMgr.LArFlatConditionSvc.DoSuperCells=True

        mlog.info(" now adding to topSequence")        
        topSequence += theLArSCL1Maker

        
        return True
if ( doLArCalibDataQuality  ) :
   ## The reference is the Oracle DB
   if StripsXtalkCorr:
      conddb.addFolder("",LArCalib_Flags.LArCaliWaveFolderXtlk+"<key>LArCaliWaveRef</key><dbConnection>"+DBConnectionCOOL+"</dbConnection>"+ChannelSelection)
   else:
      conddb.addFolder("",LArCalib_Flags.LArCaliWaveFolder+"<key>LArCaliWaveRef</key><dbConnection>"+DBConnectionCOOL+"</dbConnection>"+ChannelSelection)

if (SubtractPed):
   if ( ReadPedFromCOOL ):
      if not 'InputPedSQLiteFile' in dir():
         DelayOFCLog.info( "Read Pedestal from Oracle DB")
         PedestalFolder = "/LAR/ElecCalibFlat/Pedestal"
         PedestalTagSpec = ""
         from LArRecUtils.LArRecUtilsConf import LArFlatConditionSvc
         theLArCondSvc=LArFlatConditionSvc(DoSuperCells=False,DoRegularCells=True)
         svcMgr+=theLArCondSvc
         svcMgr.ProxyProviderSvc.ProviderNames += [ "LArFlatConditionSvc" ]
         svcMgr.LArFlatConditionSvc.PedestalInput=PedestalFolder
         PedChannelSelection=""
      else :   
         DelayOFCLog.info( "Read Pedestal from SQLite file")
         PedestalFolder = LArCalib_Flags.LArPedestalFolder
         PedestalTagSpec = LArCalibFolderTag (PedestalFolder,PedLArCalibFolderTag)
         PedChannelSelection=ChannelSelection
         
      conddb.addFolder("",PedestalFolder+"<tag>"+PedestalTagSpec+"</tag>"+"<dbConnection>"+InputDBConnectionPed+"</dbConnection>"+PedChannelSelection)
   else:
      if 'InputPedPoolFileName' in dir():
         DelayOFCLog.info( "Read Pedestal from POOL file") 
         PoolFileList += [ InputPedPoolFileDir+"/"+InputPedPoolFileName ]
예제 #5
0
    def configure(self):
        mlog = logging.getLogger('Py:LArSCellGetter::configure %s:' %
                                 self.__class__)

        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        from AthenaCommon.AppMgr import ToolSvc

        # get LArDigitGetter in MC case
        from AthenaCommon.DetFlags import DetFlags
        if DetFlags.digitize.LAr_on():
            try:
                from LArL1Sim.LArSCL1Getter import LArSCL1Getter
                theLArSCL1Getter = LArSCL1Getter()
            except Exception as configException:
                import traceback
                mlog.error(traceback.format_exc())
                mlog.error("could not get handle to LArDigitGetter Quit")
                return False
            if not theLArSCL1Getter.usable():
                mlog.error("LArSCL1Getter unusable. Quite")
                return False

        from LArROD.LArRODFlags import larRODFlags

        from AthenaCommon.GlobalFlags import globalflags

        # ADC2MeV tool
        from LArRecUtils.LArADC2MeVSCToolDefault import LArADC2MeVSCToolDefault
        theADC2MeVSCTool = LArADC2MeVSCToolDefault('LArADC2MeVSCTool')
        ToolSvc += theADC2MeVSCTool

        from AthenaCommon.AppMgr import ServiceMgr as svcMgr

        # Only MC case

        if True:
            from LArROD.LArRODConf import LArSuperCellBuilderDriver
            theLArSCellBuilder = LArSuperCellBuilderDriver(
                "LArSuperCellBuilder")

            theLArSCellBuilder.LArRawChannelContainerName = "LArSuperCells"
            theLArSCellBuilder.DataLocation = "LArDigitSCL1"
            self_LArSCellBuilder = theLArSCellBuilder
            topSequence += theLArSCellBuilder
            from LArRecUtils.LArRecUtilsConf import LArFlatConditionSvc
            if not hasattr(svcMgr, "LArFlatConditionSvc"):
                svcMgr += LArFlatConditionSvc()
                svcMgr.ProxyProviderSvc.ProviderNames += [
                    "LArFlatConditionSvc"
                ]
            svcMgr.LArFlatConditionSvc.DoSuperCells = True

            # Pulse reconstruction
            # main method: OFC iteration
            from LArRecUtils.LArOFCSCToolDefault import LArOFCSCToolDefault
            theLArOFCSCTool = LArOFCSCToolDefault('LArOFCSCToolDefault')
            ToolSvc += theLArOFCSCTool
            from LArROD.LArRODConf import LArRawChannelBuilderToolOFC
            theLArRawChannelBuilderToolOFC = LArRawChannelBuilderToolOFC(
                'LArRawChannelBuilderSCToolOFC')
            theLArRawChannelBuilderToolOFC.OFCTool = theLArOFCSCTool
            theLArRawChannelBuilderToolOFC.ECut = -99999.0
            theLArRawChannelBuilderToolOFC.KeyShape = "LArShapeSC"
            ToolSvc += theLArRawChannelBuilderToolOFC
            theLArSCellBuilder.BuilderTools += [theLArRawChannelBuilderToolOFC]
            theLArSCellBuilder += theLArRawChannelBuilderToolOFC

            # no fallback when emulating exactly DSP computation
            # fallback(1): cubic method
            from LArROD.LArRODConf import LArRawChannelBuilderToolCubic
            theLArRawChannelBuilderToolCubic = LArRawChannelBuilderToolCubic(
                'LArRawChannelBuilderSCToolCubic')
            theLArRawChannelBuilderToolCubic.minADCforCubic = 2
            ToolSvc += theLArRawChannelBuilderToolCubic
            theLArSCellBuilder.BuilderTools += [
                theLArRawChannelBuilderToolCubic
            ]
            theLArSCellBuilder += theLArRawChannelBuilderToolCubic

            # Pedestal
            # main method from database
            from LArROD.LArRODConf import LArRawChannelBuilderPedestalDataBase
            theLArRawChannelBuilderPedestalDataBase = LArRawChannelBuilderPedestalDataBase(
                'LArRawChannelBuilderPedestalSCDataBase')
            theLArRawChannelBuilderPedestalDataBase.LArPedestalKey = "LArPedestalSC"
            ToolSvc += theLArRawChannelBuilderPedestalDataBase
            theLArSCellBuilder.PedestalTools = [
                theLArRawChannelBuilderPedestalDataBase
            ]
            theLArSCellBuilder += theLArRawChannelBuilderPedestalDataBase

            # no fallback when emulating exactly DSP computation
            # fallback. sample 0
            from LArROD.LArRODConf import LArRawChannelBuilderPedestalSampleZero
            theLArRawChannelBuilderPedestalSampleZero = LArRawChannelBuilderPedestalSampleZero(
            )
            ToolSvc += theLArRawChannelBuilderPedestalSampleZero
            theLArSCellBuilder.PedestalTools += [
                theLArRawChannelBuilderPedestalSampleZero
            ]
            theLArSCellBuilder += theLArRawChannelBuilderPedestalSampleZero

            # ADC to energy
            # main method from database
            from LArROD.LArRODConf import LArRawChannelBuilderADC2EDataBase
            theLArRawChannelBuilderADC2EDataBase = LArRawChannelBuilderADC2EDataBase(
                name='LArRawChannelBuilderADC2ESCDataBase', IsSuperCell=True)
            theLArRawChannelBuilderADC2EDataBase.RampMaxHighGain = 6000
            theLArRawChannelBuilderADC2EDataBase.RampMaxMediumGain = 49000
            ToolSvc += theLArRawChannelBuilderADC2EDataBase
            theLArSCellBuilder.ADCtoEnergyTools = [
                theLArRawChannelBuilderADC2EDataBase
            ]
            theLArRawChannelBuilderADC2EDataBase.ADC2MeVTool = theADC2MeVSCTool
            theLArSCellBuilder += theLArRawChannelBuilderADC2EDataBase

            # no fallback when emulating exactly DSP computation
            # fallback, constant conversion factors
            from LArROD.LArRODConf import LArRawChannelBuilderADC2EConstants
            theLArRawChannelBuilderADC2EConstants = LArRawChannelBuilderADC2EConstants(
            )
            ToolSvc += theLArRawChannelBuilderADC2EConstants
            theLArSCellBuilder.ADCtoEnergyTools += [
                theLArRawChannelBuilderADC2EConstants
            ]
            theLArSCellBuilder += theLArRawChannelBuilderADC2EConstants

        return True
        "LAR", "/LAR/BadChannels/KnownMNBFEBs",
        "/LAR/BadChannelsOfl/KnownMNBFEBs" + forceRN + rekeyMNBF)

if not larCondFlags.LoadElecCalib.is_locked():
    larCondFlags.LoadElecCalib.set_Value(rec.readRDO())

#For run 2 we use cool-inline storage in online database COOLONL_LAR/CONDBR2:
haveElecCalibInline = (conddb.dbdata == "CONDBR2")

if (haveElecCalibInline):
    # Run 2 case:
    #This service creates a objects in the DetectorStore that wrap the AttributeListCollections
    #with the inline representation of the electronic calibration and makes them accessible through the
    #ILArRamp, ILArOFC, etc. abstract interfaces
    from LArRecUtils.LArRecUtilsConf import LArFlatConditionSvc
    theLArCondSvc = LArFlatConditionSvc()
    svcMgr += theLArCondSvc
    svcMgr.ProxyProviderSvc.ProviderNames += ["LArFlatConditionSvc"]

#Load HVScaleCorr. For run 2,these constants are also used by the CaloNoiseToolDB
if (haveElecCalibInline):
    conddb.addFolder(ONLDB, "/LAR/ElecCalibFlat/HVScaleCorr" + forceRN + sqlDB)
    theLArCondSvc.HVScaleCorrInput = "/LAR/ElecCalibFlat/HVScaleCorr"

#Load Electronic Calibration folders:
if larCondFlags.LoadElecCalib():

    #Some examples based on ExtendedFTGrouping, not duely tested.
    #Always use correction channels
    #LArCoolChannelSelection="0,1,3:473"                           #Ignore low gain
    #LArCoolChannelSelection="0:3,3:66,117:180,238:304,355:418"    #Barrel High, Med gain
예제 #7
0
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration

#JobO fragment to set up LArFlatConditionsSvc

if 'LARFLATCONDITIONSVC_HAS_BEEN_INCLUDED' not in dir():
    from LArRecUtils.LArRecUtilsConf import LArFlatConditionSvc
    theLArCondSvc=LArFlatConditionSvc(OutputLevel=DEBUG,DoSuperCells=False)
    svcMgr+=theLArCondSvc
    svcMgr.ProxyProviderSvc.ProviderNames += [ "LArFlatConditionSvc" ]
    pass

    include("LArConditionsCommon/LArIdMap_comm_jobOptions.py")
    conddb.addFolder(
        "LAR_OFL",
        "/LAR/BadChannelsOfl/BadChannels<key>/LAR/BadChannels/BadChannels</key>"
    )
    conddb.addFolder(
        "LAR_OFL",
        "/LAR/BadChannelsOfl/MissingFEBs<key>/LAR/BadChannels/MissingFEBs</key>"
    )

theApp.EvtMax = 1
svcMgr.EventSelector.RunNumber = RunNumber

if SuperCells or IsFlat:
    from LArRecUtils.LArRecUtilsConf import LArFlatConditionSvc
    theLArCondSvc = LArFlatConditionSvc(DoSuperCells=SuperCells,
                                        DoRegularCells=IsFlat)
    svcMgr += theLArCondSvc
    svcMgr.ProxyProviderSvc.ProviderNames += ["LArFlatConditionSvc"]
    #svcMgr.LArFlatConditionSvc.OutputLevel=DEBUG

if SuperCells:
    conddb.addFolder(
        "LAR_OFL",
        "/LAR/IdentifierOfl/OnOffIdMap_SC<tag>LARIdentifierOflOnOffIdMap_SC-000</tag>"
    )

if 'PoolFiles' in dir():
    from AthenaCommon.ConfigurableDb import getConfigurable
    from AthenaCommon.AppMgr import ServiceMgr
    ServiceMgr.ProxyProviderSvc.ProviderNames += ["CondProxyProvider"]
    ServiceMgr += getConfigurable("CondProxyProvider")()