Exemplo n.º 1
0
    def __init__(self, name):

        subDetectors = []
        if DetFlags.pixel_on():
            subDetectors += ["Pixel"]
        if DetFlags.SCT_on():
            subDetectors += ["SCT"]
        if DetFlags.TRT_on():
            subDetectors += ["TRT"]
        if DetFlags.Calo_on():
            subDetectors += ["Calo"]

        from ActsGeometry.ActsGeometryConf import ActsTrackingGeometrySvc
        actsTrackingGeometrySvc = ActsTrackingGeometrySvc(
            name="ActsTrackingGeometrySvc", BuildSubDetectors=subDetectors)

        from AthenaCommon.AppMgr import ServiceMgr
        ServiceMgr += actsTrackingGeometrySvc

        from ActsGeometry.ActsGeometryConf import NominalAlignmentCondAlg
        from AthenaCommon.AlgSequence import AthSequencer
        condSeq = AthSequencer("AthCondSeq")
        if not hasattr(condSeq, "NominalAlignmentCondAlg"):
            condSeq += NominalAlignmentCondAlg(name="NominalAlignmentCondAlg")

        ActsTrackingGeometryTool.__init__(
            self, name, ActsTrackingGeometrySvc=actsTrackingGeometrySvc)
Exemplo n.º 2
0
def BunchCrossingCondAlgDefault():
    name = 'BunchCrossingCondAlgDefault'
    condSeq = AthSequencer('AthCondSeq')

    if hasattr(condSeq, name):
        return getattr(condSeq, name)

    from LumiBlockComps.LumiBlockCompsConf import BunchCrossingCondAlg
    from IOVDbSvc.CondDB import conddb

    isMC = conddb.isMC
    run1 = (conddb.dbdata == 'COMP200')

    if (isMC):
        folder = "/Digitization/Parameters"
        conddb.addFolderWithTag('',
                                folder,
                                'HEAD',
                                className='AthenaAttributeList')
    else:
        folder = '/TDAQ/OLC/LHC/FILLPARAMS'
        # Mistakenly created as multi-version folder, must specify HEAD
        conddb.addFolderWithTag('TDAQ',
                                folder,
                                'HEAD',
                                className='AthenaAttributeList')

    alg = BunchCrossingCondAlg(name,
                               isMC=isMC,
                               Run1=run1,
                               FillParamsFolderKey=folder)

    condSeq += alg

    return alg
Exemplo n.º 3
0
def TrigLiveFractionCondAlgDefault(name='TrigLiveFractionCondAlg'):
    condSeq = AthSequencer('AthCondSeq')

    if hasattr(condSeq, name):
        return getattr(condSeq, name)

    from IOVDbSvc.CondDB import conddb

    kwargs = {}
    if conddb.dbdata == "COMP200":
        # Mistakenly created as multi-version folder, must specify HEAD
        conddb.addFolderWithTag('TRIGGER',
                                '/TRIGGER/LUMI/PerBcidDeadtime',
                                'HEAD',
                                className='AthenaAttributeList')
        kwargs['DeadtimeFolderInputKey'] = '/TRIGGER/LUMI/PerBcidDeadtime'
        kwargs['LuminosityInputKey'] = 'LuminosityCondData'

        from LumiBlockComps.LuminosityCondAlgDefault import LuminosityCondAlgDefault
        LuminosityCondAlgDefault()

    else:
        kwargs['DeadtimeFolderInputKey'] = ''
        kwargs['LuminosityInputKey'] = ''

    from LumiBlockComps.LumiBlockCompsConf import TrigLiveFractionCondAlg
    alg = TrigLiveFractionCondAlg(
        name, TrigLiveFractionOutputKey='TrigLiveFractionCondData', **kwargs)
    condSeq += alg

    return alg
Exemplo n.º 4
0
def LArADC2MeVCondAlgDefault():

    LArOnOffIdMapping()
    condSeq = AthSequencer("AthCondSeq")
    if hasattr(condSeq, "LArADC2MeVCondAlg"):
        return getattr(condSeq, "LArADC2MeVCondAlg")

    theADC2MeVCondAlg = LArADC2MeVCondAlg(LArADC2MeVKey='LArADC2MeV')

    if conddb.isMC:
        from LArConditionsCommon.LArCondFlags import larCondFlags
        if not larCondFlags.hasMphys():
            theADC2MeVCondAlg.LArMphysOverMcalKey = ""  #No MphysOVerMcal
        else:
            theADC2MeVCondAlg.LArMphysOverMcalKey = "LArMphysOverMcalSym"

        if not larCondFlags.hasHVCorr():
            theADC2MeVCondAlg.LArHVScaleCorrKey = ""

        theADC2MeVCondAlg.LAruA2MeVKey = "LAruA2MeVSym"
        theADC2MeVCondAlg.LArDAC2uAKey = "LArDAC2uASym"
        theADC2MeVCondAlg.LArRampKey = "LArRampSym"

        theADC2MeVCondAlg.UseFEBGainTresholds = False
    else:  # not MC:
        from LArRecUtils.LArFebConfigCondAlgDefault import LArFebConfigCondAlgDefault
        LArFebConfigCondAlgDefault()
        if 'COMP200' in conddb.GetInstance():  # Run1 case
            theADC2MeVCondAlg.LAruA2MeVKey = "LAruA2MeVSym"
            theADC2MeVCondAlg.LArDAC2uAKey = "LArDAC2uASym"

    condSeq += theADC2MeVCondAlg
    return theADC2MeVCondAlg
Exemplo n.º 5
0
    def initLorentzAngleTool(self, instanceName):
        # Set up Silicon Conditions Tool
        from SCT_ConditionsTools.SCT_SiliconConditionsToolSetup import SCT_SiliconConditionsToolSetup
        sct_SiliconConditionsToolSetup = SCT_SiliconConditionsToolSetup()
        sct_SiliconConditionsToolSetup.setDcsTool(self.dcsTool)
        sct_SiliconConditionsToolSetup.setToolName(
            "InDetSCT_SiliconConditionsTool")
        sct_SiliconConditionsToolSetup.setup()
        sctSiliconConditionsTool = sct_SiliconConditionsToolSetup.getTool()
        sctSiliconConditionsTool.CheckGeoModel = False
        sctSiliconConditionsTool.ForceUseGeoModel = False
        if self._print: print(sctSiliconConditionsTool)

        # Set up SCTSiLorentzAngleCondAlg
        from AthenaCommon.AlgSequence import AthSequencer
        condSeq = AthSequencer("AthCondSeq")
        if not hasattr(condSeq, "SCTSiLorentzAngleCondAlg"):
            from SiLorentzAngleTool.SiLorentzAngleToolConf import SCTSiLorentzAngleCondAlg
            from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
            condSeq += SCTSiLorentzAngleCondAlg(
                name="SCTSiLorentzAngleCondAlg",
                SiConditionsTool=sctSiliconConditionsTool,
                UseMagFieldCache=True,
                UseMagFieldDcs=(not athenaCommonFlags.isOnline()))
            sctSiLorentzAngleCondAlg = condSeq.SCTSiLorentzAngleCondAlg

        "Inititalize Lorentz angle Tool"
        from SiLorentzAngleTool.SiLorentzAngleToolConf import SiLorentzAngleTool
        SCTLorentzAngleTool = SiLorentzAngleTool(
            name=instanceName,
            DetectorName="SCT",
            SiLorentzAngleCondData="SCTSiLorentzAngleCondData")
        SCTLorentzAngleTool.UseMagFieldCache = True
Exemplo n.º 6
0
def _setupAtlasUnixGeneratorJob():
    from AthenaCommon import AtlasUnixStandardJob  # noqa: F401
    from AthenaCommon.AppMgr import theApp
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
    from AthenaCommon.Logging import logging
    log = logging.getLogger('AtlasUnixGeneratorJob')

    # General Application Configuration options
    from McEventSelector.McEventSelectorConf import McCnvSvc
    svcMgr += McCnvSvc()
    if hasattr(svcMgr, 'EventSelector'):
        log.warning(
            'EventSelector of type %s already exists. Will not add McEventSelector.',
            svcMgr.EventSelector.getType())
    else:
        from McEventSelector.McEventSelectorConf import McEventSelector
        svcMgr += McEventSelector("EventSelector")
        theApp.EvtSel = svcMgr.EventSelector.getFullName()

    # Persistency services
    svcMgr.EventPersistencySvc.CnvServices += ["McCnvSvc"]

    # Temporarily inject the xAOD::EventInfo converter here to allow for adiabatic migration of the clients
    from AthenaCommon.AlgSequence import AthSequencer
    topSequence = AthSequencer("AthAlgSeq")
    from xAODEventInfoCnv.xAODEventInfoCnvConf import xAODMaker__EventInfoCnvAlg
    topSequence += xAODMaker__EventInfoCnvAlg(AODKey='McEventInfo')

    return
Exemplo n.º 7
0
    def setAlgs(self):
        from AthenaCommon.AlgSequence import AthSequencer
        condSeq = AthSequencer("AthCondSeq")

        if not hasattr(condSeq, self.hvAlgName):
            from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConf import SCT_SiliconHVCondAlg
            if self.dcsTool is None:
                condSeq += SCT_SiliconHVCondAlg(name=self.hvAlgName)
            else:
                condSeq += SCT_SiliconHVCondAlg(
                    name=self.hvAlgName,
                    UseState=self.dcsTool.ReadAllDBFolders,
                    DCSConditionsTool=self.dcsTool)
        self.hvAlg = getattr(condSeq, self.hvAlgName)

        if not hasattr(condSeq, self.tempAlgName):
            from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConf import SCT_SiliconTempCondAlg
            if self.dcsTool is None:
                condSeq += SCT_SiliconTempCondAlg(name=self.tempAlgName)
            else:
                condSeq += SCT_SiliconTempCondAlg(
                    name=self.tempAlgName,
                    UseState=self.dcsTool.ReadAllDBFolders,
                    DCSConditionsTool=self.dcsTool)
        self.tempAlg = getattr(condSeq, self.tempAlgName)
Exemplo n.º 8
0
def JetGroomCfg(groomdef, configFlags, jetnameprefix="",jetnamesuffix=""):
    jetsfullname = jetnameprefix+groomdef.basename+jetnamesuffix+"Jets"
    jetlog.info("Setting up to find {0}".format(jetsfullname))

    sequencename = jetsfullname

    components = ComponentAccumulator()
    from AthenaCommon.AlgSequence import AthSequencer
    components.addSequence( AthSequencer(sequencename) )

    # Check if the ungroomed jets exist in the input file.
    # If not, we need to configure their reconstruction.
    filecontents = configFlags.Input.Collections
    if groomdef.ungroomedname not in filecontents:
        from . import JetRecCfg
        components.merge(JetRecCfg(groomdef.ungroomeddef, configFlags,
                                   jetnameoverride=groomdef.ungroomedname))
    else:
        # FIXME: Need to schedule rebuilding of pseudojets
        pass

    # FIXME: Add calls to JetModConfig.getFinalModifierListAndPrereqs
    components.addEventAlgo(getJetGroomAlg(jetsfullname,groomdef,groomdef.modifiers))

    return components
Exemplo n.º 9
0
def LArBadChannelAccess(algname="LArBadChannelCondAlg", dbString=None):
    from AthenaCommon.AlgSequence import AthSequencer
    condSeq = AthSequencer("AthCondSeq")

    if hasattr(condSeq, algname):
        print("Access to bad Feb info already set up")
        return

    from LArCabling.LArCablingAccess import LArOnOffIdMapping
    LArOnOffIdMapping()

    from IOVDbSvc.CondDB import conddb

    if dbString is not None:
        foldername = conddb.extractFolder(dbString)
        conddb.addFolder("", dbString, className="CondAttrListCollection")
    else:
        if conddb.isOnline:
            foldername = "/LAR/BadChannels/BadChannels"
            conddb.addFolder("LAR",
                             foldername,
                             className="CondAttrListCollection")
        else:
            foldername = "/LAR/BadChannelsOfl/BadChannels"
            conddb.addFolder("LAR_OFL",
                             foldername,
                             className="CondAttrListCollection")
            pass
        pass

    from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelCondAlg
    theLArBadChannelCondAlg = LArBadChannelCondAlg(algname)
    theLArBadChannelCondAlg.ReadKey = foldername
    condSeq += theLArBadChannelCondAlg
    return
Exemplo n.º 10
0
def LArAutoCorrTotalCondAlgDefault():

    mlog = logging.getLogger( 'LArAutoCorrTotalCondAlg::__init__ ' )
    mlog.info("entering LArAutoCorrTotalCondAlgDefault")

    LArOnOffIdMapping()
    condSeq = AthSequencer("AthCondSeq")
    if hasattr (condSeq,"LArAutoCorrTotalCondAlg"):
        return getattr(condSeq,"LArAutoCorrTotalCondAlg")

    theAutoCorrTotalCondAlg=LArAutoCorrTotalCondAlg()


    from AthenaCommon.BeamFlags import jobproperties
    from LArROD.LArRODFlags import larRODFlags

    from AthenaCommon.SystemOfUnits import ns
    theAutoCorrTotalCondAlg.Nsamples = larRODFlags.nSamples()
    theAutoCorrTotalCondAlg.firstSample = larRODFlags.firstSample()
    theAutoCorrTotalCondAlg.deltaBunch = int(jobproperties.Beam.bunchSpacing()/( 25.*ns)+0.5)   

    if larRODFlags.doOFCPileupOptimization():
        if larRODFlags.NumberOfCollisions():
            theAutoCorrTotalCondAlg.Nminbias=larRODFlags.NumberOfCollisions()
            mlog.info("  setup for  Ncollisions %f   deltaBunch %f", larRODFlags.NumberOfCollisions(), jobproperties.Beam.bunchSpacing())
        else:
            theAutoCorrTotalCondAlg.Nminbias=jobproperties.Beam.numberOfCollisions()
            mlog.info("  setup for  Ncollisions %f   deltaBunch %f", jobproperties.Beam.numberOfCollisions(), jobproperties.Beam.bunchSpacing())
    else:
        theAutoCorrTotalCondAlg.Nminbias=0
        mlog.info("  setup for computing total noise autocorrelation without pileup")
    
 
    condSeq+=theAutoCorrTotalCondAlg
    return theAutoCorrTotalCondAlg
Exemplo n.º 11
0
def LArBadFebAccess(algname="LArBadFebCondAlg", dbString=None):
    from AthenaCommon.AlgSequence import AthSequencer
    condSeq = AthSequencer("AthCondSeq")

    if hasattr(condSeq, algname):
        print("Access to bad Feb info already set up")
        return

    from IOVDbSvc.CondDB import conddb

    if dbString is not None:
        #foldername=conddb.extractFolder(dbString)
        conddb.addFolder("", dbString, className='AthenaAttributeList')
    #else:
    #    if conddb.isOnline or conddb.isMC:
    #        foldername="/LAR/BadChannels/MissingFEBs"
    #        conddb.addFolder("LAR",foldername,className='AthenaAttributeList')
    #    else:
    #        foldername="/LAR/BadChannelsOfl/MissingFEBs"
    #        conddb.addFolder("LAR_OFL",foldername,className='AthenaAttributeList')
    #        pass
    #    pass

    from LArBadChannelTool.LArBadChannelToolConf import LArBadFebCondAlg
    theLArBadFebCondAlg = LArBadFebCondAlg(algname)
    theLArBadFebCondAlg.ReadKey = "/LAR/BadChannels/MissingFEBs"
    condSeq += theLArBadFebCondAlg
    return
Exemplo n.º 12
0
    def setAlgs(self):
        from AthenaCommon.AlgSequence import AthSequencer
        condSeq = AthSequencer("AthCondSeq")

        if ((self.readAllDBFolders and self.returnHVTemp)
                or (not self.readAllDBFolders and not self.returnHVTemp)):
            if not hasattr(condSeq, self.stateAlgName):
                from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConf import SCT_DCSConditionsStatCondAlg
                condSeq += SCT_DCSConditionsStatCondAlg(
                    name=self.stateAlgName,
                    ReturnHVTemp=self.returnHVTemp,
                    ReadKeyHV=self.hvFolder,
                    ReadKeyState=self.stateFolder)
            self.stateAlg = getattr(condSeq, self.stateAlgName)

        if ((self.readAllDBFolders and self.returnHVTemp)
                or self.returnHVTemp):
            if not hasattr(condSeq, self.hvAlgName):
                from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConf import SCT_DCSConditionsHVCondAlg
                condSeq += SCT_DCSConditionsHVCondAlg(name=self.hvAlgName,
                                                      ReadKey=self.hvFolder)
            self.hvAlg = getattr(condSeq, self.hvAlgName)

            if not hasattr(condSeq, self.tempAlgName):
                from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConf import SCT_DCSConditionsTempCondAlg
                condSeq += SCT_DCSConditionsTempCondAlg(
                    name=self.tempAlgName, ReadKey=self.tempFolder)
            self.tempAlg = getattr(condSeq, self.tempAlgName)
Exemplo n.º 13
0
def ToolConstantsCondAlgDefault(key, DetStoreKey='', COOLFolder=''):
    """Configure a conditions algorithm to convert inline COOL data or detector store data to ToolConstants.
    KEY is also the key of the output conditions object.
    For reading from COOL inline data, COOLFOLDER gives the name
    of the COOL folder; the dta are given by KEY within the folder.
    The caller should register the folder with IOVDbSvc.
    For copying a ToolConstants object from the detector store,
    set DETSTOREKEY to the key of the object to copy."""

    if ((DetStoreKey == '' and COOLFolder == '')
            or (DetStoreKey != '' and COOLFolder != '')):
        raise RuntimeError(
            "ToolConstantsCondAlgCfg: For key " + key +
            ", exactly one of DetStoreKey or COOLFolder must be specified")

    name = 'ToolConstantsCondAlg_' + key
    condSeq = AthSequencer('AthCondSeq')

    if hasattr(condSeq, name):
        return getattr(condSeq, name)

    ToolConstantsCondAlg = CompFactory.ToolConstantsCondAlg  # CaloRec
    alg = ToolConstantsCondAlg(name,
                               COOLFolderKey=COOLFolder,
                               ToolConstantsKey=key,
                               DetStoreKey=DetStoreKey)

    condSeq += alg
    return alg
Exemplo n.º 14
0
def BunchGroupCondAlgDefault():
    name = 'BunchGroupCondAlg'
    condSeq = AthSequencer('AthCondSeq')

    if hasattr(condSeq, name):
        return getattr(condSeq, name)

    folder = ''

    from IOVDbSvc.CondDB import conddb
    if conddb.dbdata == 'COMP200':
        folder = '/TRIGGER/LVL1/BunchGroupContent'

        # Mistakenly created as multi-version folder, must specify HEAD
        from IOVDbSvc.CondDB import conddb
        conddb.addFolderWithTag('TRIGGER',
                                folder,
                                'HEAD',
                                className='AthenaAttributeList')

    from CoolLumiUtilities.CoolLumiUtilitiesConf import \
         BunchGroupCondAlg

    alg = BunchGroupCondAlg(name,
                            BunchGroupFolderInputKey=folder,
                            BunchGroupOutputKey='BunchGroupCondData')
    condSeq += alg

    return alg
Exemplo n.º 15
0
    def __init__(self,
                 name="EFCaloHypoNoiseConfig",
                 ef_thr=20 * GeV,
                 etaMin=0,
                 etaMax=10):
        super(EFCaloHypoNoiseConfig, self).__init__(name)

        self.Etcut = ef_thr
        self.BadFEBCut = 3
        from LArBadChannelTool.LArBadChannelToolConf import LArBadFebCondAlg
        conddb.addFolder('LAR_ONL',
                         "/LAR/BadChannels/KnownBADFEBs",
                         className="AthenaAttributeList")
        conddb.addFolder('LAR_ONL',
                         "/LAR/BadChannels/KnownMNBFEBs",
                         className="AthenaAttributeList")
        from AthenaCommon.AlgSequence import AthSequencer
        condSeq = AthSequencer("AthCondSeq")
        condSeq += LArBadFebCondAlg("LArKnownBadFebAlg",
                                    ReadKey="/LAR/BadChannels/KnownBADFEBs",
                                    WriteKey="LArKnownBadFEBs")
        condSeq += LArBadFebCondAlg("LArKnownMNBFebAlg",
                                    ReadKey="/LAR/BadChannels/KnownMNBFEBs",
                                    WriteKey="LArKnownMNBFEBs")
        theLArNoisyROTool = LArNoisyROTool(SaturatedCellTightCut=20,
                                           MNBLooseCut=5,
                                           MNBTightCut=17)
        self.NoiseTool = theLArNoisyROTool
Exemplo n.º 16
0
def CaloBCIDLumiCondAlgDefault():
    from AthenaCommon.GlobalFlags import globalflags

    name = 'CaloBCIDLumiCondAlg'
    condSeq = AthSequencer('AthCondSeq')

    if hasattr(condSeq, name):
        return getattr(condSeq, name)

    from CaloRec.CaloBCIDCoeffsCondAlgDefault import CaloBCIDCoeffsCondAlgDefault
    CaloBCIDCoeffsCondAlgDefault()

    if globalflags.DataSource() == 'data':
        from LumiBlockComps.LuminosityCondAlgDefault import LuminosityCondAlgDefault
        LuminosityCondAlgDefault()
    else:  #MC case
        from LumiBlockComps.BunchCrossingCondAlgDefault import BunchCrossingCondAlgDefault
        BunchCrossingCondAlgDefault()

    CaloBCIDLumiCondAlg = CompFactory.CaloBCIDLumiCondAlg  # CaloRec
    alg = CaloBCIDLumiCondAlg(name,
                              CoeffsKey='CaloBCIDCoeffs',
                              BunchCrossingCondDataKey='BunchCrossingData',
                              LuminosityCondDataKey='LuminosityCondData',
                              isMC=globalflags.DataSource() != 'data',
                              OutputLumiKey='CaloBCIDLumi')
    condSeq += alg
    return alg
Exemplo n.º 17
0
def LArOFCCondAlgDefault():

    mlog = logging.getLogger('LArOFCCondAlg')
    mlog.info("entering LArOFCCondAlgDefault")

    LArOnOffIdMapping()
    condSeq = AthSequencer("AthCondSeq")
    if hasattr (condSeq,"LArOFCCondAlg"):
        return getattr(condSeq,"LArOFCCondAlg")

    theOFCCondAlg=LArOFCCondAlg()
    #theOFCCondAlg.MCSym = True
    theOFCCondAlg.isMC  = True
    from LArROD.LArRODFlags import larRODFlags
    from AthenaCommon.BeamFlags import jobproperties

    theOFCCondAlg.firstSample = larRODFlags.firstSample()
    theOFCCondAlg.useHighestGainAutoCorr = larRODFlags.useHighestGainAutoCorr()

    if larRODFlags.doOFCPileupOptimization():
        if larRODFlags.NumberOfCollisions():
            theOFCCondAlg.Nminbias=larRODFlags.NumberOfCollisions()
            mlog.info("  setup for  Ncollisions %f   ", larRODFlags.NumberOfCollisions())
        else:
            theOFCCondAlg.Nminbias=jobproperties.Beam.numberOfCollisions()
            mlog.info("  setup for  Ncollisions %f   ", jobproperties.Beam.numberOfCollisions())
    else:
        theOFCCondAlg.Nminbias=0
        mlog.info("  setup for no pileup optimization")
      
    pass
    
    condSeq+=theOFCCondAlg
    return theOFCCondAlg
Exemplo n.º 18
0
def FillParamsCondAlgDefault():
    log = logging.getLogger('FillParamsCondAlgDefault')
    name = 'FillParamsCondAlg'
    condSeq = AthSequencer('AthCondSeq')

    if hasattr(condSeq, name):
        return getattr(condSeq, name)

    # Should only be used for Run 1.
    from IOVDbSvc.CondDB import conddb
    if conddb.dbdata != 'COMP200':
        return None

    folder = '/TDAQ/OLC/LHC/FILLPARAMS'

    # Mistakenly created as multi-version folder, must specify HEAD
    conddb.addFolderWithTag('TDAQ',
                            folder,
                            'HEAD',
                            className='AthenaAttributeList')
    log.info("FillParamsToolDefault requested %s", folder)

    from CoolLumiUtilities.CoolLumiUtilitiesConf import \
         FillParamsCondAlg

    alg = FillParamsCondAlg(name,
                            FillParamsFolderInputKey=folder,
                            FillParamsOutputKey='FillParamsCondData')
    condSeq += alg

    return alg
Exemplo n.º 19
0
def OnlineLumiCalibrationCondAlgDefault():
    name = 'OnlineLumiCalibrationCondAlg'
    condSeq = AthSequencer('AthCondSeq')

    from IOVDbSvc.CondDB import conddb
    if conddb.isMC:
        return None

    if hasattr(condSeq, name):
        return getattr(condSeq, name)

    from CoolLumiUtilities.CoolLumiUtilitiesConf import OnlineLumiCalibrationCondAlg

    # For both runs 1 and 2
    folder = '/TDAQ/OLC/CALIBRATIONS'

    alg = OnlineLumiCalibrationCondAlg(
        name,
        CalibrationFolderInputKey=folder,
        LumiCalibOutputKey='OnlineLumiCalibrationCondData')
    condSeq += alg

    conddb.addFolder('TDAQ', folder, className='CondAttrListCollection')

    return alg
Exemplo n.º 20
0
 def set(self, numThreads):
     if numThreads >= 2:
         from AthenaCommon.AlgSequence import AthSequencer
         condSeq = AthSequencer("AthCondSeq")
         for condAlgName in self.clonableCondAlgNames:
             if hasattr(condSeq, condAlgName):
                 condAlg = getattr(condSeq, condAlgName)
                 condAlg.Cardinality = numThreads
Exemplo n.º 21
0
 def setAlgs(self):
     from AthenaCommon.AlgSequence import AthSequencer
     condSeq = AthSequencer("AthCondSeq")
     if not hasattr(condSeq, self.algName):
         from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConf import SCT_ModuleVetoCondAlg
         condSeq += SCT_ModuleVetoCondAlg(name=self.algName,
                                          ReadKey=self.folder)
     self.alg = getattr(condSeq, self.algName)
Exemplo n.º 22
0
def getTileCondToolOfcCool(source='FILE',
                           runType='PHY',
                           ofcType='OF2',
                           name='TileCondToolOfcCool',
                           **kwargs):

    if source not in validSources:
        raise (Exception("Invalid source: %s" % source))

    if runType not in validRunTypes:
        raise (Exception("Invalid run type %s" % runType))

    from TileConditions.TileConditionsConf import TileCondToolOfcCool

    from AthenaCommon.AlgSequence import AthSequencer
    condSequence = AthSequencer("AthCondSeq")

    #do some check for global flag here: if source='' and flag set, adopt flag
    from AthenaCommon.GlobalFlags import globalflags
    isMC = (globalflags.DataSource() != 'data')

    tool = None

    if source == 'COOL':
        # There are OFC for OF1 only in DB used in Run2
        if ofcType == 'OF1' and not (isUsedDataBaseRun2 or isMC):
            return None

        from TileConditions.TileCoolMgr import GetTileOfcCoolSource, AddTileOfcCoolSource, tileCoolMgr

        ofc = 'TileOfc' + ofcType.capitalize()
        ofcCondAlg = ofc + 'CondAlg'

        if not hasattr(condSequence, ofcCondAlg):
            proxySource = GetTileOfcCoolSource(ofcType, runType)
            if not tileCoolMgr.isSourceAvailable(proxySource):
                splitOnline = isUsedDataBaseRun2 and (runType == 'PHY')
                AddTileOfcCoolSource(ofcType, runType, splitOnline)

            proxyName = 'TileCondProxyCool_' + proxySource
            ofcCoolProxy = getTileCondProxy('COOL', 'Ofc', proxySource,
                                            proxyName)

            from TileConditions.TileConditionsConf import TileCalibCondAlg_TileCalibDrawerOfc_ as TileCalibOfcCondAlg
            condSequence += TileCalibOfcCondAlg(name=ofcCondAlg,
                                                ConditionsProxy=ofcCoolProxy,
                                                TileCalibData=ofc)

        tool = TileCondToolOfcCool(name, TileOfc=ofc)

    else:
        raise (Exception("Invalid source %s" % source))

    #=== set the arguments passed and return tool
    for n, v in kwargs.items():
        setattr(tool, n, v)
    return tool
Exemplo n.º 23
0
def _makeRegSelTool(detector, enable, CondAlgConstructor):

    from AthenaCommon.AlgSequence import AthSequencer
    condseq = AthSequencer('AthCondSeq')

    if enable and not hasattr(condseq, _condAlgName(detector)):
        condseq += _createRegSelCondAlg(detector, CondAlgConstructor)

    return _createRegSelTool(detector, enable)
Exemplo n.º 24
0
 def setAlgs(self):
     from AthenaCommon.AlgSequence import AthSequencer
     condSeq = AthSequencer("AthCondSeq")
     if not hasattr(condSeq, self.algName):
         from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConf import SCT_ReadCalibDataCondAlg
         condSeq += SCT_ReadCalibDataCondAlg(name=self.algName,
                                             ReadKeyGain=self.gainFolder,
                                             ReadKeyNoise=self.noiseFolder)
     self.alg = getattr(condSeq, self.algName)
Exemplo n.º 25
0
 def setAlg(self):
     # In this case, conditions algorithm is scheduled in NOT AthCondSeq but AthAlgSeq
     # because conditions data are written in event store.
     from AthenaCommon.AlgSequence import AthSequencer
     job = AthSequencer("AthAlgSeq")
     if not hasattr(job, self.algName):
         from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConf import SCT_RODVetoCondAlg
         job += SCT_RODVetoCondAlg(name=self.algName)
     self.alg = getattr(job, self.algName)
Exemplo n.º 26
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
Exemplo n.º 27
0
def bookTileCalibCondAlg(calibData, proxy):

    from AthenaCommon.AlgSequence import AthSequencer
    condSequence = AthSequencer("AthCondSeq")

    calibCondAlg = calibData + 'CondAlg'
    if not hasattr(condSequence, calibCondAlg):
        condSequence += TileCalibFltCondAlg(name=calibCondAlg,
                                            ConditionsProxy=proxy,
                                            TileCalibData=calibData)
Exemplo n.º 28
0
def addLArFlatFolder(db, obj, calg, qual=''):
    from AthenaCommon.AlgSequence import AthSequencer
    condSequence = AthSequencer("AthCondSeq")

    folder = '/LAR/ElecCalibFlat/' + obj
    conddb.addFolder(db,
                     folder + forceRN + qual,
                     className='CondAttrListCollection')
    condSequence += calg(ReadKey=folder, WriteKey='LAr' + obj)
    return
Exemplo n.º 29
0
    def __init__(self, name='TrigOpMonitor', **kwargs):
        super(TrigOpMonitor, self).__init__(name, **kwargs)

        # Only monitor lumi if available
        self.LuminosityCondDataKey = ''
        condSeq = AthSequencer('AthCondSeq')
        for a in condSeq:
            if a.getType() == 'LuminosityCondAlg':
                self.LuminosityCondDataKey = a.LuminosityOutputKey
                break
Exemplo n.º 30
0
def getTileBadChanTool(source='FILE', name='TileBadChanTool', **kwargs):

    if source not in validSources:
        raise (Exception("Invalid source: %s" % source))

    from TileConditions.TileConditionsConf import TileBadChanTool

    from AthenaCommon.AlgSequence import AthSequencer
    condSequence = AthSequencer("AthCondSeq")

    #do some check for global flag here: if source='' and flag set, adopt flag

    tool = None

    badChannels = 'TileBadChannels'
    badChannelsCondAlg = badChannels + 'CondAlg'

    if not hasattr(condSequence, badChannelsCondAlg):

        if source == 'COOL':
            #====================================================
            #=== Connect COOL TileCondProxies to the tool
            #====================================================
            if isOnline and isUsedDataBaseRun2:
                offlineBadChannelsProxy = None
            else:
                offlineBadChannelsProxy = getTileCondProxy(
                    'COOL', 'Bch', 'oflStatAdc', 'TileCondProxyCool_OflBch')

            onlineBadChannelsProxy = getTileCondProxy(
                'COOL', 'Bch', 'onlStatAdc', 'TileCondProxyCool_OnlBch')
        else:
            #========================================================
            #=== Connect FILE TileCondProxies to the tool (default)
            #========================================================
            onlineBadChannelsProxy = getTileCondProxy(
                'FILE', 'Bch', 'TileDefault.onlBch',
                'TileCondProxyFile_OnlBch')
            offlineBadChannelsProxy = getTileCondProxy(
                'FILE', 'Bch', 'TileDefault.oflBch',
                'TileCondProxyFile_OflBch')

        from TileConditions.TileConditionsConf import TileBadChannelsCondAlg
        condSequence += TileBadChannelsCondAlg(
            name=badChannelsCondAlg,
            OnlBchProxy=onlineBadChannelsProxy,
            OflBchProxy=offlineBadChannelsProxy,
            TileBadChannels=badChannels)

    tool = TileBadChanTool(name, TileBadChannels=badChannels)

    #=== set the arguments passed and return tool
    for n, v in kwargs.items():
        setattr(tool, n, v)
    return tool