Пример #1
0
    def checkInput(self):
        self.checkFileMetaData()

        log = logging.getLogger( "TriggerConfigGetter.py" )
        if "ReadPool" in self._environment or "WritePool" in self._environment:
            log.info("Flags are ignored, since 'ReadPool' or  'WritePool' is specified")
            return True

        if rec.readESD() or rec.readAOD(): # and globalflags.DataSource()=='data':  # need this for MC as well
            protectedInclude("TriggerJobOpts/TriggerConfigCheckMetadata.py")

        if rec.readRDO() and globalflags.InputFormat()=='bytestream' and globalflags.DataSource()=='data' and TriggerFlags.configForStartup()!='HLToffline':
            protectedInclude("TriggerJobOpts/TriggerConfigCheckHLTpsk.py")

        log.info("The following flags are set:")
        log.info("globalflags.InputFormat             : %s", globalflags.InputFormat())
        log.info("rec.read.*                          : RDO: %s, ESD: %s, AOD: %s, TAG: %s", rec.readRDO(), rec.readESD(), rec.readAOD(), rec.readTAG())
        log.info("rec.doWrite.*                       : ESD: %s, AOD: %s, TAG: %s", rec.doWriteESD(), rec.doWriteAOD(), rec.doWriteTAG())
        log.info("globalflags.DataSource              : %s", globalflags.DataSource())
        log.info("TriggerFlags.configForStartup       : %s", TriggerFlags.configForStartup())
        log.info("TriggerFlags.dataTakingConditions   : %s", TriggerFlags.dataTakingConditions())
        log.info("TriggerFlags.configurationSourceList: %s", TriggerFlags.configurationSourceList())

        count = len([1 for x in [rec.readRDO(),rec.readESD(),rec.readAOD()] if x ]) #readTAG is only set with another input
        if count == 0:
            log.warning("Don't know what the input format is.")
            return False
        if count >= 2:
            log.warning("More than one input format specified, please set only the appropriate one.")
            return False
        return True
Пример #2
0
    def addMetaData(self):
        '''standard function to apply metadata, can overload if necessary for complicated scenarios.'''
        if self.doAODFix:
            logAODFix.debug("in addMetaData")

            from RecExConfig.RecFlags import rec

            suffix="_RAW"
            if rec.readESD():
                suffix="_ESD"
            elif rec.readAOD():
                suffix="_AOD"

            # remove any metadata we don't want to write out (in order to rerun again)
            metadataList = self.newAODFix.split("-")
            excludeFromMetadata = self.excludeFromMetadata()

            for excl in excludeFromMetadata:
                if excl in metadataList:
                    metadataList.remove(excl)

            metastr = "AODFix_" + "-".join(metadataList) + suffix

            logAODFix.info("executing addMetaData, will add as AODFixVersion %s" % metastr)
            from AthenaCommon.AppMgr import ServiceMgr as svcMgr
            svcMgr.TagInfoMgr.ExtraTagValuePairs["AODFixVersion"]=metastr
Пример #3
0
def inputFileNames():
    from AthenaCommon.AthenaCommonFlags import athenaCommonFlags

    if athenaCommonFlags.FilesInput() != []:
        return athenaCommonFlags.FilesInput()
    from RecExConfig.RecFlags import rec
    inFiles = None

    # highest flag have precedence
    if rec.readTAG():
        inFiles = athenaCommonFlags.PoolTAGInput()
    elif rec.readAOD():
        inFiles = athenaCommonFlags.PoolAODInput()
    elif rec.readESD():
        inFiles = athenaCommonFlags.PoolESDInput()
    elif rec.readRDO():
        from AthenaCommon.GlobalFlags import globalflags
        if globalflags.InputFormat == 'bytestream':
            inFiles = athenaCommonFlags.BSRDOInput()
        else:
            inFiles = athenaCommonFlags.PoolRDOInput()
    else:
        raise RutimeError("Unable to determine input file")

    return inFiles
Пример #4
0
def addCalorimeter(streamName=""):
    if not streamName=="" :
        stream = MSMgr.GetStream(streamName)
        #-----------------------------------------------------------------------------
        # Write Calorimeter information
        #   for more info on the calorimeter collections, see:
        #   https://twiki.cern.ch/twiki/bin/view/Atlas/CaloEvolution1200Persist 
        #-----------------------------------------------------------------------------
        stream.AddItem( ["CaloClusterContainer#egClusterCollection"] )
        stream.AddItem( ["CaloCellLinkContainer#egClusterCollection*"] )
        stream.AddItem( ["CaloShowerContainer#egClusterCollection*"] )
        stream.AddItem( ["CaloClusterContainer#EMTopoCluster*"] )
        stream.AddItem( ["CaloCellLinkContainer#EMTopoCluster*"] )
        stream.AddItem( ["CaloShowerContainer#EMTopoCluster*"] )
        if rec.readESD() :
            stream.AddItem( ["CaloClusterContainer#LArClusterEM*"] )
            stream.AddItem( ["CaloShowerContainer#LArClusterEM*"] )
            stream.AddItem( ["CaloCellLinkContainer#LArClusterEM*"] )
            stream.AddItem( ["CaloShowerContainer#egClusterCollection*"] )
            pass
        pass
    else :
        primaryDPD_BasicOutput_msg.warning( 'Can not add the basic output collections to the stream %s', streamName )
        pass

    return
def _fixJetTiming(c, **kw):
    # Check version number of the input data.
    # If no version is found, assume old.
    rlist = release_version()
    if rlist:
        if rlist[0] >= 16: return
        if rlist[0] == 15 and rlist[1] >= 7: return
        if rlist[0] == 15 and rlist[1] == 6 and rlist[2] >= 8: return

    sgkey_in = c.Getter.SGKey
    sgkey_in = resolveSGKey('JetCollection', sgkey_in)
    sgkey_out = sgkey_in + '_timing'

    seq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName())
    if not hasattr(seq, sgkey_out):
        tools = []
        caloqual_kw = {
            'doCellBasedVariables': True,
            'doConstituentBasedVariables': True,
            'doSamplingBasedVariables': True,
            'cutOnTile': 254,
            'cutOnLAr': 4000,
            'doTileQuality': True,
            'doLArQuality': True
        }

        if hasattr(JetRecToolsConf, 'JetTimeQualityTool'):
            # rel 15 setup
            tool1 = JetRecToolsConf.JetTimeQualityTool(sgkey_out + 'TimeTool',
                                                       DoTime=False,
                                                       DoQuality=False,
                                                       UseCells=False)
            if rec.readESD() or rec.readRDO():
                tool1.DoTime = True
                tool1.DoQuality = True
                tool1.UseCells = True
            if rec.readAOD() and (sgkey_in.find('H1Topo') >= 0
                                  or sgkey_in.find('LCTopo') >= 0):
                tool1.DoTime = True
            tools.append(tool1)
        else:
            # rel 16
            caloqual_kw['doTiming'] = True

        tool2 = JetCaloQualityTool(sgkey_out + 'QualTool', **caloqual_kw)
        tools.append(tool2)

        alg = JetD3PDMaker.JetFixupAlg(sgkey_out,
                                       InputKey=sgkey_in,
                                       OutputKey=sgkey_out,
                                       Tools=tools)
        for t in tools:
            alg += t

        seq += alg

    c.Getter.SGKey = sgkey_out
    return
Пример #6
0
def egammaBuilderAvailable():
    " Return true if egammaBuilder is available."
    flag = False
    if rec.readRDO() or rec.readESD() and not rec.readAOD():
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        if hasattr(topSequence, 'egamma'):
            flag = True
    return flag
Пример #7
0
def MuonsMuonCollectionAvailable():
    if rec.readESD() and checkContainerInInputFile("Analysis::MuonContainer",
                                                   "Muons"):
        return True
    if muonCombinedRecFlags.doxAOD() and muonCombinedRecFlags.doCombinedFit():
        return True
    if hasattr(topSequence, 'BuildMuonCollection'):
        return True
    return False
Пример #8
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
Пример #9
0
def addMuons(streamName=""):
    if not streamName == "":
        stream = MSMgr.GetStream(streamName)
        ##-----------------------------------------------------------------------------
        ## Write Muon related containers
        ##-----------------------------------------------------------------------------
        stream.AddItem(["Analysis::MuonContainer#*"])
        stream.AddItem(["TrackRecordCollection#MuonEntryRecordFilter"])
        stream.AddItem(["Rec::TrackParticleContainer#MuidCombTrackParticles"])
        stream.AddItem(
            ["Rec::TrackParticleContainer#MuidCombTrackParticlesLowPt"])
        stream.AddItem(["Rec::TrackParticleContainer#MuidExtrTrackParticles"])
        stream.AddItem(["Rec::TrackParticleContainer#MuTagTrackParticles"])
        stream.AddItem([
            "Rec::TrackParticleContainer#MuonboyMuonSpectroOnlyTrackParticles"
        ])
        stream.AddItem(["Rec::TrackParticleContainer#MuonboyTrackParticles"])
        stream.AddItem(["Rec::TrackParticleContainer#StacoTrackParticles"])
        stream.AddItem(["Rec::TrackParticleContainer#MooreTrackParticles"])
        stream.AddItem(["Rec::MuonSpShowerContainer#MuonSpShowers"])

        stream.AddItem(["CaloCompactCellContainer#AODCellContainer"
                        ])  ## Requires detector description
        stream.AddItem(["CaloCellContainer#AODCellContainer"
                        ])  ## Requires detector description
        stream.AddItem(["CaloClusterContainer#CaloCalTopoCluster"])

        if rec.readESD():
            stream.AddItem(["TileMuContainer#TileMuObj"])
            stream.AddItem(["Trk::SegmentCollection#*"])
            stream.AddItem(["Muon::CscPrepDataContainer#CSC_Clusters"])
            stream.AddItem(["Muon::MdtPrepDataContainer#MDT_DriftCircles"])
            stream.AddItem(["Muon::RpcPrepDataContainer#RPC_Measurements"])
            stream.AddItem(["Muon::TgcPrepDataContainer#TGC_Measurements"])
            stream.AddItem(
                ["MuonCaloEnergyContainer#MuonCaloEnergyCollection"])
            if primDPD.UseMCTruth():
                stream.AddItem(["PRD_MultiTruthCollection#*"])

        pass
    else:
        primaryDPD_BasicOutput_msg.warning(
            'Can not add the basic output collections to the stream %s',
            streamName)
        pass

    return
Пример #10
0
def GetDefaultTagRefStream(streams):
    # spot the most downstream target : this will be the default
    # except if one readXYZ is locked
    from RecExConfig.RecFlags import rec

    if rec.readRDO.is_locked() and rec.readRDO():
        if 'Stream1_ref' in streams:
            return 'Stream1_ref'
        if 'StreamRDO_ref' in streams:
            return 'StreamRDO_ref'
        elif 'StreamRAW_ref' in streams:
            return 'StreamRAW_ref'
        else:
            raise RuntimeError(
                " readRDO locked True and no Stream1 nor StreamRDO nor StreamRAW !"
            )
    if rec.readESD.is_locked() and rec.readESD():
        if 'StreamESD_ref' in streams:
            return 'StreamESD_ref'
        else:
            raise RuntimeError(" readESD locked True and no StreamESD !")

    if rec.readAOD.is_locked() and rec.readAOD():
        if 'StreamAOD_ref' in streams:
            return 'StreamAOD_ref'
        else:
            raise RuntimeError(" readAOD locked True and no StreamAOD !")

    # now deal with default case
    if 'StreamAOD_ref' in streams:
        return 'StreamAOD_ref'
    elif 'StreamESD_ref' in streams:
        return 'StreamESD_ref'
    elif 'Stream1_ref' in streams:
        return 'Stream1_ref'
    elif 'StreamRDO_ref' in streams:
        return 'StreamRDO_ref'
    elif 'StreamRAW_ref' in streams:
        return 'StreamRAW_ref'
    else:
        raise RuntimeError(" no known streams !")

    return None
Пример #11
0
    def configure(self):
        #         from AthenaServices.AthenaServicesConf import AthenaOutputStream
        #         from AthenaCommon.AppMgr import ServiceMgr
        #         from AthenaCommon.AlgSequence import AlgSequence
        #         topSequence = AlgSequence()

        #         ### the following was gotten from the LVL1TriggerGetter not sure if needed when not simulation
        #         if not (TriggerFlags.fakeLVL1() or TriggerFlags.doLVL1()):
        #            DetFlags.readRIOPool.LVL1_setOn()

        #         # ***Temp : needed to enable required combination of thresholds
        #         #           mu4,mu6,mu10,mu11,mu20,mu40
        #         # Will be replaced by config. from Lvl1ConfigSvc
        #         if hasattr(ServiceMgr,'RPCcablingSimSvc'):
        #             ServiceMgr.RPCcablingSimSvc.HackFor1031 = True
        if jobproperties.Global.InputFormat() == 'bytestream':
            theApp.Dlls += ["TrigT1Calo"]
            include("TrigT1CaloByteStream/ReadLVL1CaloBS_jobOptions.py")
        #         ###

        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        if recAlgs.doTrigger():
            if (rec.doESD() or rec.doAOD()) and (not(rec.readAOD() or \
                                                         rec.readESD())):
                if jobproperties.Global.InputFormat() == 'bytestream':
                    # Decode ROIB::RoIBResult from ByteStream
                    from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig import L1ByteStreamDecodersRecExSetup
                    L1ByteStreamDecodersRecExSetup()
                from AnalysisTriggerAlgs.AnalysisTriggerAlgsConfig import \
                    RoIBResultToAOD
                topSequence += RoIBResultToAOD("RoIBResultToxAOD")
                pass
            pass

        from TrigEDMConfig.TriggerEDM import getLvl1ESDList
        objKeyStore.addManyTypesStreamESD(getLvl1ESDList())
        from TrigEDMConfig.TriggerEDM import getLvl1AODList
        objKeyStore.addManyTypesStreamAOD(getLvl1AODList())

        return True
Пример #12
0
def setMetaData():
    '''
   Write the input source on which the InDet decoration algorithm was running to the meta data
   '''

    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
    if metaDataKey() in svcMgr.TagInfoMgr.ExtraTagValuePairs:
        return

    from RecExConfig.RecFlags import rec
    str = ''
    if rec.readRDO():
        str = 'fromRDO'
    elif rec.readESD():
        str = 'fromESD'
    elif rec.readAOD():
        str = 'fromAOD'

    if metaDataKey() not in svcMgr.TagInfoMgr.ExtraTagValuePairs:
        svcMgr.TagInfoMgr.ExtraTagValuePairs[metaDataKey()] = str
Пример #13
0
def addEGamma(streamName=""):
    if not streamName=="" :
        stream = MSMgr.GetStream(streamName)
        ##-----------------------------------------------------------------------------
        ## Write EGamma related containers
        ##-----------------------------------------------------------------------------
        stream.AddItem( ["egDetailContainer#egDetailAOD"] )
        stream.AddItem( ["egDetailContainer#egDetailContainer"] )
        stream.AddItem( ["egDetailContainer#SofteDetailContainer"] )

        if rec.readESD() :
            stream.AddItem( ["ElectronContainer#softeCollection"] )
            stream.AddItem( ["ElectronContainer#ElectronCollection"] )
            stream.AddItem( ["PhotonContainer#PhotonCollection"] )
        pass
    else :
        primaryDPD_BasicOutput_msg.warning( 'Can not add the basic output collections to the stream %s', streamName )
        pass

    return
Пример #14
0
 def checkFileMetaData(self):
     log = logging.getLogger("TriggerConfigGetter.py")
     from RecExConfig.InputFilePeeker import inputFileSummary
     self.hasLBwiseHLTPrescalesAndL1ItemDef = True
     if rec.readESD() or rec.readAOD() or "ReadPool" in self._environment:
         self.hasLBwiseHLTPrescalesAndL1ItemDef = inputFileSummary[
             'metadata'].has_key(
                 '/TRIGGER/HLT/Prescales'
             )  # they were all added at the same time (Repro with 15.6.3.2 Prod)
     # protection against early runs
     if inputFileSummary.has_key(
             'run_number'
     ) and self._environment == "" and globalflags.DataSource(
     ) == 'data' and rec.readRDO() and any(
         [run < 134230 for run in inputFileSummary['run_number']]):
         self.hasLBwiseHLTPrescalesAndL1ItemDef = False
     if self.hasLBwiseHLTPrescalesAndL1ItemDef:
         log.info("Using LB-wise HLT prescales")
     else:
         log.info("Using run-wise HLT prescales")
Пример #15
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
Пример #16
0
def InputFileNames():
    from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
    if athenaCommonFlags.FilesInput() != []:
        return athenaCommonFlags.FilesInput()
    from RecExConfig.RecFlags import rec
    inFiles = None

    ## FIXME
    ##     if (not athenaCommonFlags.PoolTAGInput.isDefault() or rec.readTAG() ):
    ##         inFiles=athenaCommonFlags.PoolTAGInput()
    ##     elif (not athenaCommonFlags.PoolAODInput.isDefault() or rec.readAOD() ):
    ##         inFiles=athenaCommonFlags.PoolAODInput()
    ##     elif (not athenaCommonFlags.PoolESDInput.isDefault() or rec.readESD() ):
    ##         inFiles=athenaCommonFlags.PoolESDInput()
    ##     elif not athenaCommonFlags.BSRDOInput.isDefault():
    ##         inFiles=athenaCommonFlags.BSRDOInput()
    ##     elif not athenaCommonFlags.PoolRDOInput.isDefault():
    ##         inFiles=athenaCommonFlags.PoolRDOInput()

    if rec.readTAG():
        inFiles = athenaCommonFlags.PoolTAGInput()
    elif rec.readAOD():
        inFiles = athenaCommonFlags.PoolAODInput()
    elif rec.readESD():
        inFiles = athenaCommonFlags.PoolESDInput()

    elif rec.readRDO():
        from AthenaCommon.GlobalFlags import globalflags
        if globalflags.InputFormat == 'bytestream':
            inFiles = athenaCommonFlags.BSRDOInput()
        else:
            inFiles = athenaCommonFlags.PoolRDOInput()
    else:
        raise RuntimeError("Unable to determine input file")

    return inFiles
Пример #17
0
from AthenaCommon.GlobalFlags import globalflags

from RecExConfig.RecFlags import rec

if globalflags.InputFormat=='bytestream' or (not  TriggerFlags.doLVL1()):
    CBNT_AthenaAware.Members += ["LVL1::CBNTAA_LVL1CaloESD/CBNT_LVL1calo"]
elif (rec.readESD() or rec.readAOD()):
    CBNT_AthenaAware.Members += ["LVL1::CBNTAA_LVL1CaloESD/CBNT_LVL1calo"]
elif (rec.readRDO() and TriggerFlags.doLVL1()):
    CBNT_AthenaAware.Members += [ "LVL1::CBNTAA_LVL1calo/CBNT_LVL1calo" ]
elif ( jobproperties.CaloCellFlags.doFastCaloSim() and TriggerFlags.doLVL1()):
    CBNT_AthenaAware.Members += [ "LVL1::CBNTAA_LVL1calo/CBNT_LVL1calo" ]
       
CBNT_AthenaAware.Members += [ "CBNTAA_ReadRoIBResult/CBNT_ReadRoIBResult" ]

#CBNTAthenaAware=True
include( "CBNT_Athena/CBNT_AthenaAware_jobOptions.py" )
include( "CBNT_Athena/CBNT_EventInfo_jobOptions.py" )
if rec.Commissioning:
    from AthenaMonitoring.DQMonFlags import DQMonFlags
    if DQMonFlags.doCTPMon():
        include ("TrigT1CTMonitoring/NtupleFragment.py")
    if DQMonFlags.doLVL1CaloMon(): 
        include( "TrigT1CaloCalibTools/CBNT_L1Calo_jobOptions.py" ) 
else:
    doL1CaloCBNT_JEM = False
    doL1CaloCBNT_CPM = False
    doL1CaloCBNT_RODHeader = False
    include( "TrigT1CaloCalibTools/CBNT_L1Calo_jobOptions.py" ) 

    include("TrigNtInDet/jobOfragment_TrigNtInDet.py")
tdt_local_logger = logging.getLogger('TrigDecTool_jobOptions')

# Set up the trigger decision tool (for trigger-aware monitoring)
if not 'DQMonFlags' in dir():
   tdt_local_logger.debug("DQMonFlags not yet imported - I import them now")
   from AthenaMonitoring.DQMonFlags import DQMonFlags

if DQMonFlags.useTrigger():
   if not 'rec' in dir():
      from RecExConfig.RecFlags import rec

   if rec.readESD() and (DQMonFlags.monManEnvironment=='tier0ESD'):
      # for ESD->AOD use trigger config stored as in-file meta-data,
      if not 'TriggerFlags' in dir():
         from TriggerJobOpts.TriggerFlags import TriggerFlags
      TriggerFlags.configurationSourceList = ['ds']

      # set up trigger config service
      if not 'TriggerConfigGetter' in dir():
         from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter
         cfg = TriggerConfigGetter()

   if not hasattr(ToolSvc, DQMonFlags.nameTrigDecTool()):
      from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
      monTrigDecTool = Trig__TrigDecisionTool(name=DQMonFlags.nameTrigDecTool(),
                                              OutputLevel=ERROR,
                                              PublicChainGroups = {"EFTau": "EF_[0-9]?tau.*",
                                                                   "EFPhoton": "EF_[0-9]?g*",
                                                                   "EFJets":"EF_J.*",
                                                                  }
                                             )
Пример #19
0
from AthenaCommon.GlobalFlags import globalflags
from RecExConfig.RecFlags import rec
from RecExConfig.RecAlgsFlags import recAlgs

if rec.Commissioning:
    CBNTAthenaAware = True

if rec.doTruth():
    protectedInclude("RecExCommon/CBNT_Truth_jobOptions.py")

    if not (globalflags.DetDescrVersion()[0:3] == "DC1"
            or globalflags.DetDescrVersion()[0:3] == "DC2"):
        protectedInclude("MCTruthAlgs/CBNT_TrackRecord.py")

if (DetFlags.haveRIO.ID_on() or rec.readESD() or rec.readAOD()):
    # no CBNT for ID anymore (use track validation ntuple)
    if jobproperties.Beam.beamType() == "collisions":

        #
        # functionality : put tracks from any tracking algorithm in combined ntuple
        #

        protectedInclude("InDetPriVxCBNT/InDetPriVxCBNT_jobOptions.py")

        if rec.readAOD():
            try:
                CBNTAA_VxPrimary.useTrkTrack = False
                CBNTAA_VxPrimary.McEventCollectionName = "GEN_AOD"
            except Exception:
                logCBNT_config.warning("CBNTAA_VxPrimary undefined")
Пример #20
0
def ConfigureInputType():
    from PyUtils.MetaReaderPeeker import metadata

    from AthenaCommon.GlobalFlags import globalflags
    streamsName = []

    if metadata['file_type'] == 'BS':
        #byte stream
        logAutoConfiguration.info("Input BS detected")
        globalflags.InputFormat = 'bytestream'
        rec.readRDO = True
        rec.readESD = False
        rec.readAOD = False
        rec.doAOD = False
        rec.doESD = True
        rec.doWriteAOD = False
        logAutoConfiguration.info(
            "BS format: setting globalflags.InputFormat=%s " %
            globalflags.InputFormat())
        logAutoConfiguration.info("BS format: setting rec.readRDO=%s " %
                                  rec.readRDO())
        logAutoConfiguration.info("BS format: setting rec.doAOD=%s " %
                                  rec.doAOD())
        logAutoConfiguration.info("BS format: setting rec.doESD=%s " %
                                  rec.doESD())
        logAutoConfiguration.info("BS format: setting rec.doWriteAOD=%s " %
                                  rec.doWriteAOD())
    else:
        globalflags.InputFormat = 'pool'
        #Get streamsName
        streamsName = []
        if 'processingTags' in metadata:
            streamsName = metadata['processingTags']
        if streamsName == None:
            streamsName = []
        logAutoConfiguration.info("Extracted streams %s from input file " %
                                  streamsName)

        if len(streamsName) == 0:
            logAutoConfiguration.warning(
                "ConfigureInputType: no stream in input file.")
        elif len(streamsName) > 1:
            logAutoConfiguration.warning(
                "ConfigureInputType: more than one stream: %s in input file. Default action. Consider the highest one."
            )
        else:
            rec.mergingStreamName = streamsName[0]

    from RecExConfig.RecoFunctions import OverlapLists
    try:
        from PrimaryDPDMaker.PrimaryDPDFlags import listRAWtoDPD, listESDtoDPD, listAODtoDPD
    except:
        logAutoConfiguration.warning(
            "Unable to import PrimaryDPDFlags. OK for ATN tests below AtlasAnalysis, otherwise suspicious."
        )
        listRAWtoDPD = []
        listESDtoDPD = []
        listAODtoDPD = []

    ## these lines have been added to guarantee the backward compatibility for the old DPD naming convention cosmics
    try:
        from PrimaryDPDMaker.PrimaryDPDFlags import listBackwardCompatibleAODtoDPD, listBackwardCompatibleESDtoDPD
        listESDtoDPD.extend(listBackwardCompatibleESDtoDPD)
        listAODtoDPD.extend(listBackwardCompatibleAODtoDPD)
    except:
        logAutoConfiguration.warning(
            "Primary DPDMake does not support the old naming convention!!")

    if 'TagStreamsRef' in metadata and metadata['TagStreamsRef'] != None:
        logAutoConfiguration.info("Input TAG detected")
        rec.readTAG = True
        logAutoConfiguration.info("Auto configured rec.readTAG=%s " %
                                  rec.readTAG())

    from RecExConfig.RecoFunctions import ItemInListStartsWith
    if ItemInListStartsWith("StreamAOD", streamsName) or ItemInListStartsWith(
            'StreamDAOD', streamsName) or ItemInListStartsWith(
                'StreamD2AOD', streamsName) or OverlapLists(
                    streamsName, listAODtoDPD) or ItemInListStartsWith(
                        'DAOD', streamsName) or ItemInListStartsWith(
                            'D2AOD', streamsName):
        logAutoConfiguration.info("Input AOD detected")
        rec.readRDO = False
        rec.readESD = False
        rec.readAOD = True
        rec.doAOD = False
        rec.doESD = False
        logAutoConfiguration.info("setting rec.readAOD=%s " % rec.readAOD())
    elif ItemInListStartsWith(
            "StreamESD", streamsName) or ItemInListStartsWith(
                'StreamDESD', streamsName) or ItemInListStartsWith(
                    'StreamD2ESD', streamsName) or OverlapLists(
                        streamsName, listESDtoDPD) or ItemInListStartsWith(
                            'DESD', streamsName) or ItemInListStartsWith(
                                'D2ESD', streamsName):
        logAutoConfiguration.info("Input ESD detected")
        rec.readRDO = False
        rec.readESD = True
        rec.readAOD = False
        rec.doAOD = True
        rec.doESD = False
        logAutoConfiguration.info("setting rec.readESD=%s " % rec.readESD())
        logAutoConfiguration.info("setting rec.doAOD=%s " % rec.doAOD())
    elif ItemInListStartsWith("Stream1", streamsName) or ItemInListStartsWith(
            "StreamRDO", streamsName) or ItemInListStartsWith(
                "OutputStreamRDO", streamsName) or OverlapLists(
                    streamsName, listRAWtoDPD):
        logAutoConfiguration.info("Input RDO detected")
        rec.readRDO = True
        rec.readESD = False
        rec.readAOD = False
        rec.doAOD = False
        rec.doESD = True
        logAutoConfiguration.info("setting rec.readRDO=%s " % rec.readRDO())
        logAutoConfiguration.info("setting rec.doESD=%s " % rec.doESD())
    elif ItemInListStartsWith("StreamEVGEN", streamsName):
        logAutoConfiguration.info("Input EVGEN detected")
        rec.readRDO = False
        rec.readESD = False
        rec.readAOD = False
        rec.doAOD = False
        rec.doESD = False
        logAutoConfiguration.info(
            "setting all unlocked rec.readXXX and rec.doXXX to False")
    elif ItemInListStartsWith("StreamHITS", streamsName):
        logAutoConfiguration.info("Input StreamEVGEN detected")

    elif metadata['file_type'] != 'BS':
        raise RuntimeError("ConfigureInputType cannot handle streamsName==%s" %
                           streamsName)
    return
elif jobproperties.Beam.beamType() == 'singlebeam':
   ## There is no singlebeam in AthenaMonitoring
   DQMonFlags.monManDataType = 'collisions'
else:
   local_logger.warning("invalid jobproperties.Beam.beamType(): %s, using default (%s)", 
                        jobproperties.Beam.beamType(), DQMonFlags.monManDataType)


# First, test to see if this is being run online
if athenaCommonFlags.isOnline:
   DQMonFlags.monManEnvironment='online'

# Running offline; set the monMan environment based on monType
elif DQMonFlags.monType=='BSonly':
   DQMonFlags.monManEnvironment='tier0Raw'
   if rec.readESD(): 
      DQMonFlags.doMonitoring=False

elif DQMonFlags.monType=='ESDonly':  
   DQMonFlags.monManEnvironment='tier0ESD' 
   if rec.readRDO(): 
      DQMonFlags.doMonitoring=False

elif (DQMonFlags.monType=='BS_ESD'):
   if rec.readRDO():
      DQMonFlags.monManEnvironment='tier0Raw'
   if rec.readESD(): 
      DQMonFlags.monManEnvironment='tier0ESD'
   if rec.readAOD():
      DQMonFlags.monManEnvironment='AOD'
Пример #22
0
def AODFix_Init():
    ''' This function is called to correctly setup AODFix.'''

    global _aodFixInstance

    from RecExConfig.RecFlags import rec

    ##################
    # exit if locked to false
    ##################
    if rec.doApplyAODFix.is_locked() and rec.doApplyAODFix.get_Value(
    ) == False:
        logAODFix.info(
            "doApplyAODFix is locked to False; not applying anything")
        return

    ##################
    # deterimine in what release we are running (and fill some rec variables
    ##################

    import os
    curRelease = os.getenv("AtlasVersion") or ''

    logAODFix.debug("curRelease set to " + curRelease)

    ##################
    # determine athena with which input file was created and previous AODFix
    ##################

    # RDO doesn't have MetaData
    prevAODFix = ''
    prevRelease = ''
    isMC = False
    isHI = rec.doHeavyIon()
    isHIP = rec.doHIP()

    # is it better to do this or to look at GlobalFlags?
    from RecExConfig.InputFilePeeker import inputFileSummary
    try:
        isMC = (inputFileSummary['evt_type'][0] == "IS_SIMULATION")
    except Exception:
        logAODFix.warning(
            "Could not tell if the input file is data or MC; setting to data")
        isMC = False

    if not rec.readRDO():

        try:
            AtlasReleaseVersionString = inputFileSummary['metadata'][
                '/TagInfo']['AtlasRelease']
            rv = AtlasReleaseVersionString.split('-')
            if len(rv) > 1:
                prevRelease = rv[1]
        except Exception:
            logAODFix.warning(
                "no AthenRelease found in input file, setting to <none> !!")
            prevRelease = ''

        ##################
        # determine which is the previous verion of the AODFix
        ##################
        try:
            prevAODFix = inputFileSummary['tag_info']['AODFixVersion']
            if prevAODFix.startswith("AODFix_"):
                prevAODFix = prevAODFix[7:]
                prevAODFix = prevAODFix.split("_")[0]
        except Exception:
            logAODFix.debug(
                "no AODFixVersion found in input file, setting to <none>.")
            prevAODFix = ''

    logAODFix.info("Summary of MetaData for AODFix:")
    if isMC:
        logAODFix.info(" Input file is MC")
    else:
        logAODFix.info(" Input file is DATA")
    logAODFix.info(" Input file produced with Athena version <%s>." %
                   prevRelease)
    logAODFix.info(" AODFix version <%s> was previously applied." % prevAODFix)
    if rec.doApplyAODFix.is_locked():
        logAODFix.info(" AODFix is forced to run!")

    ##################
    # determine which AODFix to run (if actually running--to be determined later)
    ##################

    doAODFix = False
    if rec.readAOD():  # change in policy: no AODFix if reading ESD.
        doAODFix = True
        # check to see if it's a DAOD; do not run by default in DAODs
        from RecExConfig.InputFilePeeker import inputFileSummary
        try:
            streamNames = inputFileSummary['stream_names']
            if any(map(lambda x: "StreamDAOD" in x,
                       streamNames)) and not rec.doApplyAODFix.is_locked():
                logAODFix.info("Running on a DAOD, so not scheduling AODFix")
                doAODFix = False
        except Exception:
            logAODFix.warning("Could not determine the stream name")

    elif rec.readESD() and rec.doApplyAODFix.is_locked():
        # only run on ESDs if forcing
        doAODFix = True

    #exit if not doing AODFix
    if not doAODFix:
        return

    curReleaseSplit = curRelease.split('.')
    prevReleaseSplit = prevRelease.split('.')
    if len(curReleaseSplit) >= 2 and (rec.doApplyAODFix.is_locked()
                                      or len(prevReleaseSplit) >= 2):
        ### If adding an AODFix for a release family that does not have it,
        ### please add it to the if-elif... statement below
        # if (curReleaseSplit[0] == '21' and (curReleaseSplit[1] == '0' or curReleaseSplit[1] == '2') and
        #       (rec.doApplyAODFix.is_locked() or
        #        (prevReleaseSplit[0] == '21' and (prevReleaseSplit[1] == '0' or prevReleaseSplit[1] == '2')))):
        #     _aodFixInstance = AODFix_r210(prevAODFix, isMC, rec.doApplyAODFix.is_locked(), isHI, isHIP)
        # else:
        #     logAODFix.info("No AODFix scheduled for this release.")
        logAODFix.info("AODFix disabled.")

    else:
        logAODFix.info("Current release is of strange form: %s" % curRelease)
Пример #23
0
from InDetVertexMonitoring.InDetVertexMonitoringConf import InDetVertexMonitoring
myVx = InDetVertexMonitoring()
myVx.DoControlPlots = False
myVx.OutputLevel = WARNING

if not 'DQMonFlags' in dir():
    print "DQMonFlags not yet imported - I import them now"
    from AthenaMonitoring.DQMonFlags import DQMonFlags

#DQMonFlags.useTrigger = False 

if DQMonFlags.useTrigger():
   if not 'rec' in dir():
      from RecExConfig.RecFlags import rec

   if rec.readESD() and (DQMonFlags.monManEnvironment=='tier0ESD'):
      # for ESD->AOD use trigger config stored as in-file meta-data,
      if not 'TriggerFlags' in dir():
         from TriggerJobOpts.TriggerFlags import TriggerFlags
      TriggerFlags.configurationSourceList = ['ds']

      # set up trigger config service
      if not 'TriggerConfigGetter' in dir():
         from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter
         cfg = TriggerConfigGetter()

   if not hasattr(ToolSvc, DQMonFlags.nameTrigDecTool()):
      from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
      monTrigDecTool = Trig__TrigDecisionTool(name=DQMonFlags.nameTrigDecTool(),
        				      OutputLevel=ERROR,
        				      PublicChainGroups = {"EF": "EF_rd0*",}
Пример #24
0
    from TrkExTools.AtlasExtrapolator import AtlasExtrapolator
    from TrackToCalo.TrackToCaloConf import Trk__ParticleCaloExtensionTool, Rec__ParticleCaloCellAssociationTool
    pcExtensionTool = Trk__ParticleCaloExtensionTool(
        Extrapolator=AtlasExtrapolator())
    caloCellAssociationTool = Rec__ParticleCaloCellAssociationTool(
        ParticleCaloExtensionTool=pcExtensionTool)

    topSequence += CfgMgr.TrackParticleCellAssociationAlg(
        "TrackParticleCellAssociationAlg",
        ParticleCaloCellAssociationTool=caloCellAssociationTool)

#
# functionality : energy flow
#
pdr.flag_domain('eflow')
if recAlgs.doEFlow() and (rec.readESD() or (DetFlags.haveRIO.ID_on()
                                            and DetFlags.haveRIO.Calo_allOn()
                                            and rec.doMuonCombined())):
    try:
        include("eflowRec/eflowRec_jobOptions.py")
    except Exception:
        treatException("Could not set up EFlow. Switched off !")
        recAlgs.doEFlow = False
else:
    recAlgs.doEFlow = False

#AODFix_postMuonCombinedRec()
#
# functionality : CaloTower protojets + preclustering + KT algorithm + CombinedJetAlg
#
pdr.flag_domain('jet')
Пример #25
0
from RecExConfig.RecAlgsFlags  import recAlgs
from AthenaCommon.Resilience import treatException
from AthenaCommon.DetFlags import DetFlags
from egammaRec import egammaKeys
from egammaRec.egammaKeys import egammaKeysDict


from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
###############Print Egamma JobProperties#############
jobproperties.egammaRecFlags.print_JobProperties("full")
#####################################################################
# Run calo-based (egamma) algorithm, includes topo-seeded
# It requires either to read ESD
# either that Emcluster have been build
if jobproperties.egammaRecFlags.doEgammaCaloSeeded()  and ( rec.readESD() or jobproperties.CaloRecFlags.doEmCluster()) :
    # 
    try:
        if jobproperties.egammaRecFlags.doEgammaCaloSeeded:
            from egammaRec.egammaGetter import egammaGetter
            egammaGetter(ignoreExistingDataObject=True)
    except Exception:
        treatException("Could not set up egammaGetter. Switch it off !")
        jobproperties.egammaRecFlags.doEgammaCaloSeeded=False    
        egammaGetter(disable=True)
else:
    jobproperties.egammaRecFlags.doEgammaCaloSeeded=False
    try:
        from egammaRec.egammaGetter import egammaGetter
        egammaGetter(disable=True)
    except Exception:
Пример #26
0
    # include DetFlags
    # by default everything is off
    from AthenaCommon.DetFlags import DetFlags
    # switch on tasks for all detectors
    DetFlags.detdescr.all_setOn()
    # switch on dcs for all detectors
    try:
        # need AthenaCommon
        DetFlags.dcs.all_setOn()
    except Exception:
        logRecExCommon_DetFlags.warning("could not set DetFlags.dcs")
        pass

    from RecExConfig.RecFlags import rec
    if not rec.readESD() and not rec.readAOD() and not rec.doWriteRDO():
        DetFlags.makeRIO.all_setOn()
    else:
        DetFlags.makeRIO.all_setOff()
        #calo cells are there on ESD
        if rec.readESD():
            DetFlags.readRIOPool.Calo_setOn()
            # savannah 73686
            from RecExConfig.AutoConfiguration import IsInInputFile
            from InDetRecExample.InDetKeys import InDetKeys
            if IsInInputFile('InDet::PixelClusterContainer',
                             InDetKeys.PixelClusters()):
                DetFlags.readRIOPool.pixel_setOn()
            if IsInInputFile('InDet::SCT_ClusterContainer',
                             InDetKeys.SCT_Clusters()):
                DetFlags.readRIOPool.SCT_setOn()
Пример #27
0
if globalflags.InputFormat.is_pool():
    logAnaCommon_topOptions.info("Pool file : storing in objKeyStore the list of input object directly from file")
    try:
        from PyUtils.MetaReaderPeeker import convert_itemList
        objKeyStore.addManyTypesInputFile(convert_itemList(layout = '#join'))

        pass
    except:
        logAnaCommon_topOptions.error("no input file defined in flags. If using RTT please use tag <athenaCommonFlags/>. Now continuing at own riske")
        pass
    pass
# for BS file this cannot be done already, see later



if not rec.readESD() and not rec.readAOD():
    ##objKeyStore.readInputFile('RecExPers/OKS_streamRDO.py')
    pass
elif rec.readESD():
    ##objKeyStore.readInputFile('RecExPers/OKS_streamESD.py')
    ##objKeyStore.readInputBackNav('RecExPers/OKS_streamRDO.py')
    # still need to read in AOD content built at ESD stage
    objKeyStore.readStreamAOD('RecExPers/OKS_streamAOD_fromESD.py')
    # at this point all streamAOD there should already be in ESD
    for k in objKeyStore['streamAOD'].list():
        if not objKeyStore['inputFile'].has_item (k):
            logAnaCommon_topOptions.info("Warning item %s scheduled co be copied from ESD to  AOD, but missing in ESD! Dropped. " % k )
            objKeyStore['streamAOD'].removeItem (k)
            pass
        pass
    pass
Пример #28
0
    def configure(self):

        log = logging.getLogger("HLTTriggerResultGetter.py")
        from RecExConfig.ObjKeyStore import objKeyStore

        # set EDMDecodingVersion
        EDMDecodingVersion()

        # Set AODFULL for data unless it was set explicitly already
        if TriggerFlags.AODEDMSet.isDefault() and globalflags.DataSource(
        ) == 'data':
            TriggerFlags.AODEDMSet = 'AODFULL'

        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        log.info("BS unpacking (TF.readBS): %d", TriggerFlags.readBS())
        if TriggerFlags.readBS():
            if TriggerFlags.EDMDecodingVersion() <= 2:
                bs = ByteStreamUnpackGetterRun2()  # noqa: F841
            else:
                bs = ByteStreamUnpackGetter()  # noqa: F841

        xAODContainers = {}
        #        if not recAlgs.doTrigger():      #only convert when running on old data
        if TriggerFlags.EDMDecodingVersion() == 1:
            xaodcnvrt = xAODConversionGetter()
            xAODContainers = xaodcnvrt.xaodlist

        if recAlgs.doTrigger() or TriggerFlags.doTriggerConfigOnly():
            if TriggerFlags.EDMDecodingVersion() <= 2:
                tdt = TrigDecisionGetterRun2()  # noqa: F841
            else:
                tdt = TrigDecisionGetter()  # noqa: F841

        # Temporary hack to add Run-3 navigation to ESD and AOD
        if (rec.doESD()
                or rec.doAOD()) and TriggerFlags.EDMDecodingVersion() == 3:
            # The hack with wildcards is needed for BS->ESD because we don't know the exact keys
            # of HLT navigation containers before unpacking them from the BS event.
            objKeyStore._store['streamESD'].allowWildCard(True)
            objKeyStore._store['streamAOD'].allowWildCard(True)
            objKeyStore.addManyTypesStreamESD([
                'xAOD::TrigCompositeContainer#HLTNav*',
                'xAOD::TrigCompositeAuxContainer#HLTNav*'
            ])
            objKeyStore.addManyTypesStreamAOD([
                'xAOD::TrigCompositeContainer#HLTNav*',
                'xAOD::TrigCompositeAuxContainer#HLTNav*'
            ])

        # TrigJetRec additions
        if rec.doWriteESD():
            objKeyStore.addStreamESD("JetKeyDescriptor", "JetKeyMap")
            objKeyStore.addStreamESD("JetMomentMap", "TrigJetRecMomentMap")

        if rec.doWriteAOD():
            objKeyStore.addStreamAOD("JetKeyDescriptor", "JetKeyMap")
            objKeyStore.addStreamAOD("JetMomentMap", "TrigJetRecMomentMap")

        # ID truth
        if not rec.readESD() and (not rec.readAOD()) and TriggerFlags.doID() \
                and rec.doTruth():
            try:
                from TrigInDetTruthAlgs.TrigInDetTruthAlgsConfig import \
                    TrigIDTruthMaker
                topSequence += TrigIDTruthMaker()
            except Exception:
                log.warning("Couldn't set up the trigger ID truth maker")
                pass

        if rec.doESD() or rec.doAOD():
            from TrigEDMConfig.TriggerEDM import getTrigIDTruthList
            objKeyStore.addManyTypesStreamESD(
                getTrigIDTruthList(TriggerFlags.ESDEDMSet()))
            objKeyStore.addManyTypesStreamAOD(
                getTrigIDTruthList(TriggerFlags.AODEDMSet()))

        if (rec.doESD() or rec.doAOD()) and TriggerFlags.writeL1TopoValData():
            objKeyStore.addManyTypesStreamESD([
                'xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData',
                'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.'
            ])
            objKeyStore.addManyTypesStreamAOD([
                'xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData',
                'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.'
            ])
            log.debug(
                "HLT_xAOD__TrigCompositeContainer_L1TopoValData(Aux.) for L1Topo validation added to the data."
            )

        if rec.doAOD() or rec.doWriteAOD():
            # schedule the RoiDescriptorStore conversion
            # log.warning( "HLTTriggerResultGetter - setting up RoiWriter" )
            roiWriter = RoiWriter()
            # Add fictional input to ensure data dependency in AthenaMT
            roiWriter.ExtraInputs += [("TrigBSExtractionOutput",
                                       "StoreGateSvc+TrigBSExtractionOutput")]
            topSequence += roiWriter
            # write out the RoiDescriptorStores
            from TrigEDMConfig.TriggerEDMRun2 import TriggerRoiList
            objKeyStore.addManyTypesStreamAOD(TriggerRoiList)

        #Are we adding operational info objects in ESD?
        added = self._AddOPIToESD()
        if added:
            log.debug(
                "Operational Info object HLT_EXPRESS_OPI_HLT with extra information about express stream prescaling added to the data."
            )

        # ESD objects definitions
        _TriggerESDList = {}

        from TrigEDMConfig.TriggerEDM import getTriggerEDMList
        # we have to store xAOD containers in the root file, NOT AOD,
        # if the xAOD container list is not empty
        if (xAODContainers):
            _TriggerESDList.update(xAODContainers)
        else:
            _TriggerESDList.update(
                getTriggerEDMList(TriggerFlags.ESDEDMSet(),
                                  TriggerFlags.EDMDecodingVersion()))

        log.info(
            "ESD content set according to the ESDEDMSet flag: %s and EDM version %d",
            TriggerFlags.ESDEDMSet(), TriggerFlags.EDMDecodingVersion())

        # AOD objects choice
        _TriggerAODList = {}

        #from TrigEDMConfig.TriggerEDM import getAODList
        _TriggerAODList.update(
            getTriggerEDMList(TriggerFlags.AODEDMSet(),
                              TriggerFlags.EDMDecodingVersion()))

        log.info(
            "AOD content set according to the AODEDMSet flag: %s and EDM version %d",
            TriggerFlags.AODEDMSet(), TriggerFlags.EDMDecodingVersion())

        log.debug("ESD EDM list: %s", _TriggerESDList)
        log.debug("AOD EDM list: %s", _TriggerAODList)

        # Highlight what is in AOD list but not in ESD list, as this can cause
        # the "different number of entries in branch" problem, when it is in the
        # AOD list but the empty container per event is not created
        # Just compares keys of dicts, which are the class names, not their string keys in StoreGate
        not_in = [
            element for element in _TriggerAODList
            if element not in _TriggerESDList
        ]
        if (len(not_in) > 0):
            log.warning("In AOD list but not in ESD list: ")
            log.warning(not_in)
        else:
            log.info("AOD list is subset of ESD list - good.")

        def _addSlimming(stream, edm):
            from TrigNavTools.TrigNavToolsConfig import navigationThinningSvc

            edmlist = list(y.split('-')[0] for x in edm.values()
                           for y in x)  #flatten names

            svc = navigationThinningSvc({
                'name': 'HLTNav_%s' % stream,
                'mode': 'cleanup',
                'result': 'HLTResult_HLT',
                'features': edmlist
            })

            from OutputStreamAthenaPool.CreateOutputStreams import registerTrigNavThinningSvc
            registerTrigNavThinningSvc(stream, svc)

            log.info("Configured slimming of HLT for %s", stream)
            print(svc)  # noqa: ATL901
            del edmlist

        if TriggerFlags.doNavigationSlimming() and rec.readRDO(
        ) and rec.doWriteAOD():
            _addSlimming('StreamAOD',
                         _TriggerESDList)  #Use ESD item list also for AOD!
            log.info("configured navigation slimming for AOD output")

        if TriggerFlags.doNavigationSlimming() and rec.readRDO(
        ) and rec.doWriteESD():
            _addSlimming('StreamESD', _TriggerESDList)
            log.info("configured navigation slimming for ESD output")

        objKeyStore.addManyTypesStreamESD(_TriggerESDList)
        objKeyStore.addManyTypesStreamAOD(_TriggerAODList)

        return True
Пример #29
0
from RecExConfig.RecAlgsFlags import recAlgs
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
athenaCommonFlags.FilesInput = [ '/tmp/jdevivi/ESD.186186._001566.pool.root.1' ]
athenaCommonFlags.EvtMax.set_Value_and_Lock(5)
athenaCommonFlags.SkipEvents.set_Value_and_Lock(0)

from AthenaCommon.GlobalFlags import globalflags
if OverrideConditionsTag != "":
  print '#BTAG# Overriding conditions tag with ', OverrideConditionsTag
  globalflags.ConditionsTag.set_Value_and_Lock(OverrideConditionsTag)

# --- Re-reconstruction steering flags: do not change if not an expert !
#rec.readAOD.set_Value_and_Lock(True)
rec.doTrigger.set_Value_and_Lock(False)
rec.readESD.set_Value_and_Lock(True)
rec.doESD.set_Value_and_Lock(ReDoTrkEgComMuon and rec.readESD())
rec.doAOD.set_Value_and_Lock(False)
rec.doWriteAOD.set_Value_and_Lock(False)
rec.doWriteTAG.set_Value_and_Lock(False)
rec.doCBNT.set_Value_and_Lock(False)
rec.doHist.set_Value_and_Lock(False)
rec.doDumpTES.set_Value_and_Lock(False)
rec.doPerfMon.set_Value_and_Lock(False)
rec.doDetailedPerfMon.set_Value_and_Lock(False)

if rec.doESD():
  rec.Commissioning=True
  rec.doMonitoring=False
  # Since I put doESD at True to allow for ID reco, I have to swich off many things
  # High level objects
  recAlgs.doMuonIDStandAlone.set_Value_and_Lock(False)
Пример #30
0
            from AthenaCommon.BFieldFlags import jobproperties
            jobproperties.BField.solenoidOn.set_Value_and_Lock(False)
            jobproperties.BField.barrelToroidOn.set_Value_and_Lock(True)
            jobproperties.BField.endcapToroidOn.set_Value_and_Lock(True)

        globalflags.InputFormat.set_Value_and_Lock('bytestream')

    if rec.readAOD():
        if rec.readTAG():
            raise "Cannot have both readAOD and readTAG true"
        athenaCommonFlags.PoolAODInput.set_Value_and_Lock(
            ["../cosm/myAOD.pool.root"])
        rec.doWriteAOD = False
        rec.doWriteESD = False

    if rec.readESD():  #lxplus225
        ####L1CaloEM
        # this is ignored if tags are read
        athenaCommonFlags.PoolESDInput.set_Value_and_Lock(
            ["../cosm/myESD.pool.root"])
        rec.doWriteESD = False

    if rec.readESD() or rec.readAOD():
        globalflags.InputFormat.set_Value_and_Lock('pool')
        globalflags.DetDescrVersion.set_Value_and_Lock('ATLAS-GEO-03-00-00')
        globalflags.ConditionsTag.set_Value_and_Lock('COMCOND-REPC-001-00')
        from AthenaCommon.BFieldFlags import jobproperties
        jobproperties.BField.solenoidOn.set_Value_and_Lock(True)
        jobproperties.BField.barrelToroidOn.set_Value_and_Lock(True)
        jobproperties.BField.endcapToroidOn.set_Value_and_Lock(True)
Пример #31
0
topSequence.VrtSecInclusive.TrkA0ErrCut = 200000
topSequence.VrtSecInclusive.TrkZErrCut = 200000
topSequence.VrtSecInclusive.a0TrkPVDstMinCut = 5.0
topSequence.VrtSecInclusive.TrkPtCut = 300
topSequence.VrtSecInclusive.SelVrtChi2Cut=4.5
topSequence.VrtSecInclusive.CutSharedHits=5
topSequence.VrtSecInclusive.TrkChi2Cut=5.0
topSequence.VrtSecInclusive.TruthTrkLen=1
topSequence.VrtSecInclusive.DoSAloneTRT=False
topSequence.VrtSecInclusive.DoTruth = False
# following is when there is no GEN_AOD in input file,
# e.g., when I run on output of InDetRecExample or on a ESD file
# when running on AOD output of InDetRecEx, explicitly uncomment the next line and comment out rec.readESD
#     topSequence.VrtSecInclusive.MCEventContainer = "TruthEvent"

if rec.readESD():
    topSequence.VrtSecInclusive.MCEventContainer = "TruthEvent"

if 'IS_SIMULATION' in metadata['eventTypes']:
    topSequence.VrtSecInclusive.DoTruth=True

from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter
InclusiveVxFitterTool = Trk__TrkVKalVrtFitter(name                = "InclusiveVxFitter",
	                                      Extrapolator        = ToolSvc.AtlasExtrapolator,
	                                      IterationNumber     = 30
					     )
ToolSvc +=  InclusiveVxFitterTool;
InclusiveVxFitterTool.OutputLevel = INFO
topSequence.VrtSecInclusive.VertexFitterTool=InclusiveVxFitterTool
topSequence.VrtSecInclusive.Extrapolator = ToolSvc.AtlasExtrapolator
Пример #32
0
        # this is a RDO to RDO copy, do not put detector status
        rec.doDetStatus = False

# in case several read specified, favour the highest one
if rec.readAOD():
    logRecExCommon_flags.info("read AOD : all algs switched off ")

    # switch off all algorithms
    rec.doESD = False
    rec.doAOD = False
    rec.doWriteESD = False
    rec.doWriteAOD = False
    if rec.readRDO:
        logRecExCommon_flags.info("readAOD : switch readRDO off ")
        rec.readRDO = False
    if rec.readESD():
        logRecExCommon_flags.info("readESD : switch readRDO off ")
        rec.readRDO = False

if rec.readESD():
    logRecExCommon_flags.info("read ESD : all algs switched off ")
    # switch off all algorithms
    rec.doESD = False
    rec.doWriteESD = False

    if rec.readRDO():
        logRecExCommon_flags.info("readESD : switch readRDO off ")
        rec.readRDO = False

# consistency check in case of lock
_allRead = rec.readRDO() + rec.readESD() + rec.readAOD()
topSequence = AlgSequence()

if muonRecFlags.doDigitization():
    include("MuonRecExample/MuonDigitization_jobOptions.py")

if rec.readRDO():
    if globalflags.InputFormat == 'bytestream':
        include("MuonCnvExample/MuonReadBS_jobOptions.py")
    else:
        include("MuonCnvExample/MuonReadRDO_jobOptions.py")
    if DetFlags.makeRIO.Muon_on():
        include("MuonRecExample/MuonRDO_to_PRD_jobOptions.py")

### add PRD -> xAOD
if (rec.readRDO() or rec.readESD()) and muonRecFlags.prdToxAOD():
    from AthenaCommon import CfgMgr
    topSequence += CfgMgr.MDT_PrepDataToxAOD()
    topSequence += CfgMgr.RPC_PrepDataToxAOD()
    topSequence += CfgMgr.TGC_PrepDataToxAOD()
    topSequence += CfgMgr.CSC_PrepDataToxAOD()

    if muonRecFlags.doCreateClusters():
        topSequence += CfgMgr.RPC_PrepDataToxAOD(
            "RPC_ClusterToxAOD", InputContainerName="RPC_Clusters")
        topSequence += CfgMgr.TGC_PrepDataToxAOD(
            "TGC_ClusterToxAOD", InputContainerName="TGC_Clusters")

### add RPC RDO -> xAOD
if (rec.readRDO() or rec.readESD()) and muonRecFlags.rpcRawToxAOD():
    from AthenaCommon import CfgMgr
Пример #34
0
        treatException("Could not set up combined muon reconstruction. Switched off !")
        rec.doMuonCombined = False

#
#  functionality : add cells crossed by high pt ID tracks 
#
if rec.doESD() and recAlgs.doTrackParticleCellAssociation():
    from AthenaCommon.CfgGetter import getPublicTool
    getPublicTool("MuonCombinedInDetDetailedTrackSelectorTool")
    topSequence += CfgMgr.TrackParticleCellAssociationAlg("TrackParticleCellAssociationAlg")

#
# functionality : energy flow
#                                                                                                 
pdr.flag_domain('eflow')
if recAlgs.doEFlow() and ( rec.readESD() or ( DetFlags.haveRIO.ID_on() and DetFlags.haveRIO.Calo_allOn() ) )  :
    try:
        include( "eflowRec/eflowRec_jobOptions.py" )
    except Exception:
        treatException("Could not set up EFlow. Switched off !")
        recAlgs.doEFlow=False
else:
    recAlgs.doEFlow=False

# Calo extrapolation
try:
    from eflowRec.eflowRecConf import eflowTrackCaloExtensionTool
    TrackCaloExtensionTool=eflowTrackCaloExtensionTool()
except:
    mlog.error("could not import eflowRec.eflowTrackCaloExtensionTool")
    print traceback.format_exc()