Ejemplo n.º 1
0
    def configure(self):

        log = logging.getLogger("TrigDecisionGetterRun2")

        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        #if hasOnlyLVL1:
        #from RecExConfig.ObjKeyStore import objKeyStore
        #objKeyStore.addStreamESD('TrigDec::TrigDecision','TrigDecision')
        #objKeyStore.addStreamAOD('TrigDec::TrigDecision','TrigDecision')

        from RecExConfig.RecFlags import rec
        if ( rec.doWriteESD() or rec.doWriteAOD() or rec.doESD() or rec.doAOD() ) and \
               ( not ( rec.readAOD() or rec.readESD() or rec.doWriteBS()) ):
            log.info("Will write TrigDecision object to storegate")

            from TrigDecisionMaker.TrigDecisionMakerConfig import WriteTrigDecision
            trigDecWriter = WriteTrigDecision()  # noqa: F841

            #           WritexAODTrigDecision() is called within WriteTrigDecision()

            # inform TD maker that some parts may be missing
            if TriggerFlags.dataTakingConditions() == 'Lvl1Only':
                topSequence.TrigDecMaker.doL2 = False
                topSequence.TrigDecMaker.doEF = False
                topSequence.TrigDecMaker.doHLT = False
                topSequence.TrigNavigationCnvAlg.doL2 = False
                topSequence.TrigNavigationCnvAlg.doEF = False
                topSequence.TrigNavigationCnvAlg.doHLT = False
            elif TriggerFlags.dataTakingConditions() == 'HltOnly':
                from AthenaCommon.AlgSequence import AlgSequence
                topSequence.TrigDecMaker.doL1 = False
            # Decide based on the doMergedHLTResult to assume a merged, or a
            # split HLT:
            if not TriggerFlags.doMergedHLTResult():
                topSequence.TrigDecMaker.doHLT = False
                topSequence.TrigNavigationCnvAlg.doL2 = False
                topSequence.TrigNavigationCnvAlg.doHLT = False
            else:
                topSequence.TrigDecMaker.doL2 = False
                topSequence.TrigDecMaker.doEF = False
                topSequence.TrigNavigationCnvAlg.doL2 = False
                topSequence.TrigNavigationCnvAlg.doEF = False
                pass

        else:
            log.info("Will not write TrigDecision object to storegate")

        return True
Ejemplo n.º 2
0
def sync_Trigger2Reco():
    from AthenaCommon.Include import include
    from RecExConfig.RecAlgsFlags import recAlgs
    from AthenaCommon.GlobalFlags import globalflags
    from RecExConfig.RecFlags import rec

    if recAlgs.doTrigger() and rec.readRDO(
    ) and not globalflags.InputFormat() == 'bytestream':
        include("TriggerJobOpts/TransientBS_DetFlags.py")

    if globalflags.InputFormat() == 'bytestream':
        TriggerFlags.readBS = True
        TriggerFlags.doLVL1 = False
        TriggerFlags.doLVL2 = False
        TriggerFlags.doEF = False

    if rec.doWriteBS():
        TriggerFlags.writeBS = True
Ejemplo n.º 3
0
def OutputFileName(suffix=""):
    from RecExConfig.RecFlags import rec
    OutFileName = ""
    if rec.OutputFileNameForRecoStep() == "":
        if rec.readRDO():
            if globalflags.InputFormat() == "bytestream":
                OutFileName = "bs"
            else:
                OutFileName = "rdo"
        elif rec.readESD():
            OutFileName = "esd"
        elif rec.readAOD():
            OutFileName = "aod"
        else:
            OutFileName = "in"

        OutFileName = OutFileName + "to"
        if rec.doWriteBS():
            OutFileName = OutFileName + "bs"
        elif rec.doWriteRDO():
            OutFileName = OutFileName + "rdo"

        if rec.doESD():
            OutFileName = OutFileName + "esd"
        if rec.doAOD():
            OutFileName = OutFileName + "aod"
        if rec.doDPD():
            OutFileName = OutFileName + "dpd"
        if rec.doWriteTAG():
            OutFileName = OutFileName + "tag"

        if suffix != "":
            OutFileName = OutFileName + "_" + suffix
        print("Generated OutFileName", OutFileName)
    else:
        OutFileName = rec.OutputFileNameForRecoStep()
        print("User defined OutFileName", OutFileName)
    return OutFileName
Ejemplo n.º 4
0
if rec.doLArg() and globalflags.DataSource(
) == 'data' and globalflags.InputFormat() == 'bytestream':
    from LArROD.LArRODFlags import larRODFlags
    if larRODFlags.doLArFebErrorSummary():
        try:
            include("LArROD/LArFebErrorSummaryMaker_jobOptions.py")
        except Exception:
            treatException(
                "Problem with LArFebErrorSummaryMaker_jobOptions.py switch larRODFlags.doLArFebErrorSummary "
            )
            larRODFlags.doLArFebErrorSummary = False

#
# functionality: Calorimeter cells
#
if DetFlags.makeRIO.Calo_on() and not rec.doWriteBS():
    from AthenaCommon.Include import excludeTracePattern
    excludeTracePattern.append("*/CaloClusterCorrection/common.py")

    try:
        include("TileRec/TileDefaults_jobOptions.py")
    except Exception:
        treatException("Could not set up Tile default options.")

# CaloCellGetter
#
    try:
        from CaloRec.CaloCellGetter import CaloCellGetter
        CaloCellGetter()

        # for data09_calophys project, force to use the same quality cut as in BS converter
Ejemplo n.º 5
0
    def sync_DetFlags(self,technologies="MDT,RPC,CSC,TGC,sTGC,Micromegas"):
        self.setDefaults()
        global rec
        from AthenaCommon.DetFlags import DetFlags
        # if Muons off, then do nothing
        if not DetFlags.Muon_on() or not rec.doMuon(): return

        flagsOn = []
        flagsOff = [ 'readRIOBS' ] # we don't store RIO (=PRD) on bytestream ???
        # Reading RDO
        if rec.readRDO():
            if muonRecFlags.makePRDs():
                flagsOn.append( 'makeRIO' )
            else:
                flagsOff.append( 'makeRIO' )
            if globalflags.InputFormat == 'pool'      :
                flagsOn.append( 'readRDOPool' )
                flagsOff.append( 'readRDOBS' )
            elif globalflags.InputFormat == 'bytestream':
                flagsOn.append( 'readRDOBS'   )
                flagsOff.append( 'readRDOPool' )
        else: # not reading RDO

            flagsOff.append( 'makeRIO' )

        # Reading ESD
        if rec.readESD():
            flagsOn.append( 'readRIOPool' )
        else:
            flagsOff.append( 'readRIOPool' )

        # Writing RDO Pool
        if rec.doWriteRDO():
            flagsOn.append( 'writeRDOPool' )
        else:
            flagsOff.append( 'writeRDOPool' )

        # Writing RDO bystream
        if rec.doWriteBS() :
            flagsOn.append( 'writeBS' )
        else:
            flagsOff.append( 'writeBS' )

        # Writing ESD
        if rec.doWriteESD():
            flagsOn.append( 'writeRIOPool' )
        else:
            flagsOff.append( 'writeRIOPool' )

        # Digitization on-the-fly
        if self.doDigitization():
            flagsOn.append( 'digitize' )
            try:
                flagsOn.remove( 'readRDOPool' )
            except ValueError: # not in list
                pass
            try:
                flagsOn.remove( 'readRDOBS' )
            except ValueError: # not in list
                pass
            flagsOff.append( 'readRDOPool' )
            flagsOff.append( 'readRDOBS'   )
            # very special case for normal Rome production (inspired by RecExCommon_DetFlags.py)
            if 'readRIOPool' not in flagsOn:
                flagsOn.append( 'readRIOPool' )
                try:
                    flagsOff.remove( 'readRIOPool' )
                except ValueError: # not in list
                    pass
            if not rec.doWriteRDO() and 'makeRIO' not in flagsOn:
                flagsOn.append( 'makeRIO' )
                try:
                    flagsOff.remove( 'makeRIO' )
                except ValueError: #not in list
                    pass
                    
        else:
            flagsOff.append( 'digitize')


        # do sync per technology for selected flags
        MDT_on = self.doMDTs()
        RPC_on = self.doRPCs()
        CSC_on = self.doCSCs()
        TGC_on = self.doTGCs()
        sTGC_on = self.dosTGCs()
        Micromegas_on = self.doMicromegas()
        techList = technologies.split(',')
        for f in flagsOn:
            for tech in techList:
                setOn = eval(tech+'_on')
                isOn = eval("DetFlags.%s.%s_on()" % (f,tech))
                if setOn:
                    if not isOn:
                        cmd = "DetFlags.%s.%s_setOn()" % (f,tech)
                        logMuon.info(cmd)
                        exec(cmd)
                else: # set off
                    if isOn:
                        cmd = "DetFlags.%s.%s_setOff()" % (f,tech)
                        logMuon.info(cmd)
                        exec(cmd)

        # Turn off Muon flags (row in DetFlags printout)
        for f in flagsOff:
            isOn = eval("DetFlags.%s.Muon_on()" % f)
            if isOn:
                cmd = "DetFlags.%s.Muon_setOff()" % f
                logMuon.info(cmd)
                exec(cmd)
Ejemplo n.º 6
0
    def setDefaults(self):
        global globalflags

        from MuonRecExample.MuonRecUtils import setJobPropertyDefault as setDefault

        # as long as rec.Commissioning is alive, sync the default to it
        # in case of BS->RDO, RDO->RDO, RDO->BS, BS->BS: don't run RIO (i.e RDO->PRD)
        setDefault(self.makePRDs, rec.readRDO() and not rec.doWriteRDO() and not rec.doWriteBS())
        setDefault(self.doStandalone,True)
        setDefault(self.doDigitization,False)
        setDefault(self.doCalib,False)
        setDefault(self.applyResilience,athenaCommonFlags.AllowIgnoreConfigError())
        setDefault(self.doSegmentsOnly,False)
        setDefault(self.doMDTs,True)
        setDefault(self.doRPCs,True)
        setDefault(self.doTGCs,True)
        setDefault(self.doCSCs,True)
        setDefault(self.dosTGCs,True)
        setDefault(self.doMicromegas,True)
        setDefault(self.doMSVertex,True)
        setDefault(self.useWireSagCorrections,False)
        setDefault(self.enableErrorTuning,True)
        setDefault(self.useLooseErrorTuning,False)
        setDefault(self.useAlignmentCorrections,DetFlags.detdescr.Muon_on() and rec.doMuon())
        setDefault(self.writeSDOs, rec.doWriteESD() and globalflags.DataSource != 'data')
        setDefault(self.useTGCPriorNextBC,True)
        setDefault(self.doMuonIso,True)

        if beamFlags.beamType == 'cosmics' or beamFlags.beamType == 'singlebeam':
            setDefault(self.doSegmentT0Fit,True)
        else:
            setDefault(self.doSegmentT0Fit,False)
            
        setDefault(self.doPrdSelect,False)

        # Default for MuonCalibration ntuple
        setDefault(self.calibMuonStandalone, muonRecFlags.doStandalone() or rec.readESD() )
        try:
            from MuonCnvExample.MuonCalibFlags import muonCalibFlags
        except ImportError:
            from AthenaCommon.Resilience import treatException
            treatException("Could not load MuonCalibFlags. Switching off calibration ntuple")
            self.doCalib = False
            self.doCalibNtuple = False
        else:
               
            doTracks = self.calibMuonStandalone()
            # chose a default
            if not muonCalibFlags.Mode.statusOn:
                if doTracks:
                    muonCalibFlags.Mode = 'trackNtuple'
                else:
                    muonCalibFlags.Mode = 'ntuple'

            if muonCalibFlags.Mode == 'trackNtuple' and doTracks:
                setDefault(self.doCalibNtuple,self.doCalib())
                setDefault(self.calibNtupleSegments,True)
                setDefault(self.calibNtupleTracks,True)
                if rec.doTrigger: setDefault(self.calibNtupleTrigger,True)
                else: setDefault(self.calibNtupleTrigger,False)
            elif muonCalibFlags.Mode == 'ntuple' or (muonCalibFlags.Mode == 'trackNtuple' and not doTracks):
                setDefault(self.doCalibNtuple,self.doCalib())
                setDefault(self.calibNtupleSegments,True)
                setDefault(self.calibNtupleTracks,False)
                if rec.doTrigger: setDefault(self.calibNtupleTrigger,True)
                else: setDefault(self.calibNtupleTrigger,False)
            else:
                setDefault(self.doCalibNtuple,False)
                setDefault(self.calibNtupleSegments,False)
                setDefault(self.calibNtupleTracks,False)
                setDefault(self.calibNtupleTrigger,False)
Ejemplo n.º 7
0
            from TrigT1CaloTools.TrigT1CaloToolsConf import LVL1__L1JEPHitsTools
            ToolSvc += LVL1__L1JEPHitsTools("L1JEPHitsTools")
        ToolSvc.L1JEPHitsTools.LVL1ConfigSvc = "TrigConf::TrigConfigSvc/TrigConfigSvc"

        import TrigT1CaloTools.TrigT1CaloToolsConf as calotools  # noqa: F401

        for toolName in [
                'L1JetCMXTools', 'L1EnergyCMXTools', 'L1TriggerTowerTool',
                'L1CPMTools', 'L1CPCMXTools', 'L1EmTauTools', 'L1JEMJetTools',
                'L1JetEtTools', 'L1JetTools'
        ]:
            if not hasattr(ToolSvc, toolName):
                ToolSvc += eval('calotools.LVL1__%s( toolName )' % toolName)
            getattr(ToolSvc, toolName
                    ).LVL1ConfigSvc = "TrigConf::TrigConfigSvc/TrigConfigSvc"

    #---------------------------------------------------------------------------
    if recAlgs.doTrigger():
        try:
            from TriggerJobOpts.T0TriggerGetter import T0TriggerGetter
            triggerGetter = T0TriggerGetter()
        except Exception:
            from AthenaCommon.Resilience import treatException
            treatException(
                "Could not import TriggerJobOpts.TriggerGetter . Switched off !"
            )
            recAlgs.doTrigger = False
    elif rec.doWriteBS():
        include("ByteStreamCnvSvc/RDP_ByteStream_jobOptions.py")
## end of configure the HLT config
Ejemplo n.º 8
0
include.block('ForwardRec/ForwardRec_jobOptions.py')

from AthenaCommon.Resilience import treatException
from AthenaCommon.GlobalFlags import globalflags
from AthenaCommon.DetFlags import DetFlags
from RecExConfig.RecFlags import rec

if (rec.doLucid):
    include("ForwardRec/LUCID_Rec_jobOptions.py")

#if (rec.doForwardDet and rec.doZdc):
#  include ( "ZdcRec/ZdcRec_jobOptions.py" )

if DetFlags.makeRIO.ZDC_on() and not rec.doWriteBS():
    try:
        #from ZdcRec.ZdcRawChannelGetter import ZdcRawChannelGetter
        #ZdcRawChannelGetter()
        from ZdcRec.ZdcModuleGetter import ZdcModuleGetter
        ZdcModuleGetter()
    except Exception:
        treatException("Problem with ZdcModuleGetter. Switched off.")
        DetFlags.makeRIO.ZDC_setOff()

if rec.doAlfa() and rec.doESD():
    if DetFlags.readRDOBS.ALFA_on():
        #Needed for real-data reconstruction:
        from ALFA_RawDataByteStreamCnv.ALFA_RawDataByteStreamCnvConf import ALFA_RawDataProvider
        topSequence += ALFA_RawDataProvider()

        from ALFA_Raw2Digit.ALFA_Raw2DigitConf import ALFA_Raw2Digit