Esempio n. 1
0
def TriggerOutputItemListAOD():
    from RecExConfig.RecFlags import rec
    from AthenaCommon.Logging import logging
    log = logging.getLogger('TriggerOutputItemListAOD_joboptions')
    log.error(
        "this file is deprecated by the Object Key Store and should no longer be used"
    )
    TriggerAODList = []
    if rec.doWriteAOD():
        print "TriggerAODList: "
        print TriggerAODList
Esempio n. 2
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
Esempio n. 3
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("TrigTier0/TriggerConfigCheckMetadata.py")

        if rec.readRDO() and globalflags.InputFormat(
        ) == 'bytestream' and globalflags.DataSource() == 'data':
            protectedInclude("TrigTier0/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
Esempio n. 4
0
# Particle Property
protectedInclude("PartPropSvc/PartPropSvc.py")
include.block("PartPropSvc/PartPropSvc.py")

# Detector Status
if rec.doDetStatus() and not athenaCommonFlags.isOnline():
    try:
        include("DetectorStatus/DetStatusSvc_CondDB.py")
    except Exception:
        treatException("Could not load DetStatusSvc_CondDb !")
        rec.doFileMetaData = False

    if rec.doFileMetaData():
        #DR FIXME not sure about commissioing exception, filemetadata should be in filteredESD as well
        if rec.doWriteRDO() or rec.doWriteESD() or rec.doWriteAOD(
        ) or rec.doDPD():
            protectedInclude("DetectorStatus/DetStatusSvc_ToFileMetaData.py")

#Output file TagInfo and metadata
if rec.oldFlagCompatibility:
    print "RecExCommon_flags.py flags values:"
    try:
        for o in RecExCommonFlags.keys():
            exec 'print "%s =",%s ' % (o, o)
    except Exception:
        print "WARNING RecExCommonFlags not available, cannot delete"
else:
    print "Old flags have been deleted"

# end flag settings section
##########################################################################
Esempio n. 5
0
    DetFlags.ID_setOff()

##    if rec.doAODall() and oneTrackingAlg :
##       if recAlgs.donewTracking() + recAlgs.doiPatRec() +recAlgs.doxKalman() <= 1 :
##          logRecExCommon_flags.warning('doAODall=True :  more than one tracking alg should be enabled ! So switching doAODall=False')
##          rec.doAODall=False
##       else:
##          InDetFlags.setAODall()

if not rec.doTruth() or (globalflags.DetDescrVersion()[0:3] == "DC1"
                         or globalflags.DetDescrVersion()[0:3] == "DC2"):
    logRecExCommon_flags.info("TrackRecordFilter alg switched off ")
    recAlgs.doTrackRecordFilter = False

# AOD Flags
if rec.doWriteAOD() and not rec.doAOD() and not rec.readAOD():
    logRecExCommon_flags.warning(
        "doAOD False and doWriteAOD True and readAOD False. Most likely meaninglesss !! "
    )

if rec.doWriteTAGCOM() and not rec.Commissioning():
    logRecExCommon_flags.info("Not commissioning, switching of doWriteTAGCOM ")
    rec.doWriteTAGCOM = False

# If no AOD objects made, then do not write out a TAG
if not rec.doAOD() and not rec.readAOD() and rec.doWriteTAG():
    logRecExCommon_flags.warning(
        "no AOD objects available, cannot write out tag, switching rec.doWriteTAG=False"
    )
    rec.doWriteTAG = False
Esempio n. 6
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
Esempio n. 7
0
    FTK_RDO_Reader.GetRefitTrackParticles=True
    if (jobproperties.Beam.beamType() == 'cosmics'):
        FTK_RDO_Reader.GetVertex=False
        FTK_RDO_Reader.GetRefitVertex=False
    else:
        FTK_RDO_Reader.GetVertex=True
        FTK_RDO_Reader.GetRefitVertex=True
    FTK_RDO_Reader.GetTruthVertex=False

    from AthenaCommon.AlgSequence import AlgSequence

    alg = AlgSequence() 
    alg += FTK_RDO_Reader 
    

    if rec.doTruth() and (rec.doWriteAOD() or rec.doWriteESD()):
        include ('FTK_RecExample/ConfiguredFTK_TrackTruth.py')
        FTK_TracksTruth = ConfiguredFTK_TrackTruth(Tracks="FTK_TrackCollection",
                                                TracksTruth = "FTK_Tracks_TruthCollection",
                                                DetailedTruth = "FTK_Tracks_DetailedTruthCollection")
        FTK_RefitTracksTruth = ConfiguredFTK_TrackTruth(Tracks="FTK_TrackCollectionRefit", 
                                                     TracksTruth = "FTK_RefitTracks_TruthCollection",
                                                     DetailedTruth = "FTK_RefitTracks_DetailedTruthCollection")
        from xAODTrackingCnv.xAODTrackingCnvConf import xAODMaker__TrackParticleCnvAlg

        FTKTrackParticleCnvAlg = xAODMaker__TrackParticleCnvAlg("FTKTrackParticleCnvAlg")
        FTKTrackParticleCnvAlg.xAODTrackParticlesFromTracksContainerName = "Converted_FTKTrackParticleContainer"
        FTKTrackParticleCnvAlg.TrackContainerName = "FTK_TrackCollection"
        FTKTrackParticleCnvAlg.ConvertTrackParticles = False
        FTKTrackParticleCnvAlg.ConvertTracks = True
        FTKTrackParticleCnvAlg.AddTruthLink = True
Esempio n. 8
0
    def configure(self):
        log = logging.getLogger("TriggerConfigGetter.py")

        # first check the input
        if "HIT2RDO" in self._environment:
            TriggerFlags.doLVL2 = False
            TriggerFlags.doEF = False
            log.info("For simulation jobs the following flags are set:")
            log.info("globalflags.InputFormat             : %s" %
                     globalflags.InputFormat())
            log.info("globalflags.DataSource              : %s" %
                     globalflags.DataSource())
            log.info("TriggerFlags.configForStartup       : %s" %
                     TriggerFlags.configForStartup())
            log.info("TriggerFlags.dataTakingConditions   : %s" %
                     TriggerFlags.dataTakingConditions())
            log.info("TriggerFlags.doLVL2                 : %s" %
                     TriggerFlags.doLVL2())
            log.info("TriggerFlags.doEF                   : %s" %
                     TriggerFlags.doEF())
        else:
            if not self.checkInput():
                log.error(
                    "Could not determine job input. Can't setup trigger configuration and will return!"
                )
                return

        self.readPool = globalflags.InputFormat() == 'pool'
        self.readRDO = rec.readRDO()
        self.writeESDAOD = rec.doWriteESD() or rec.doWriteAOD(
        ) or rec.doWriteDPD()
        self.ConfigSrcList = TriggerFlags.configurationSourceList()
        self.readMC = globalflags.DataSource(
        ) == 'geant3' or globalflags.DataSource() == 'geant4'
        self.readTriggerDB = TriggerFlags.readMenuFromTriggerDb(
        ) and self.readRDO
        self.isCommisioning = globalflags.DataSource(
        ) == 'data' and globalflags.DetGeo() == 'commis'
        self.l1Folders = TriggerFlags.dataTakingConditions(
        ) == 'FullTrigger' or TriggerFlags.dataTakingConditions() == 'Lvl1Only'
        self.hltFolders = TriggerFlags.dataTakingConditions(
        ) == 'FullTrigger' or TriggerFlags.dataTakingConditions() == 'HltOnly'
        self.isRun1Data = False
        if globalflags.DataSource() == 'data':
            from RecExConfig.AutoConfiguration import GetRunNumber
            runNumber = GetRunNumber()
            if runNumber > 0 and runNumber < 230000:
                self.isRun1Data = True
        self.isTriggerReprocessing = False

        # the TriggerFlags.readMenuFromTriggerDb() tells us that we read the trigger menu from the database
        # the connection itself is defined in TriggerFlags.triggerDbConnection()

        # reading from the TriggerDB can mean different things:

        # a) TriggerFlags doLVL2() and doEF() are both False:
        #    - create a tmp sqlite file with the conditions (menu)
        #    - use DSConfigSvc

        # b) TriggerFlags doLVL2() or doEF() is True:
        #    - use HLTConfigSvc
        if self.readTriggerDB and (TriggerFlags.doLVL2()
                                   or TriggerFlags.doEF()
                                   or TriggerFlags.doHLT()):

            self.ConfigSrcList = [
                'xml'
            ]  # to use L1/HLTConfigSvc and not DSConfigSvc, but only if we are running the HLT

        if self._environment:  # I don't think anyone calls TriggerConfigGetter with an argument
            self.readPool = False
            self.writeESDAOD = False
            self.readHits = False
            if "ReadPoolRDO" in self._environment:
                self.readPool = True
                self.readRDO = True
            elif "ReadPool" in self._environment:
                self.readPool = True
                self.readRDO = False
            if "WritePool" in self._environment:
                self.writeESDAOD = True
            if "HIT2RDO" in self._environment:
                self.readRDO = False
                self.readHits = True

        # define ConfigSvc
        if not self.ConfigSrcList:
            if (self.readPool and not self.readRDO) or (
                    self.readRDO
                    and not self.readPool):  # (ESD, AOD, DPD) or (RDO-BS)
                self.ConfigSrcList = ['ds']
            elif (self.readRDO and self.readPool
                  ) or rec.readTAG() or self.readHits:  # (RDO-MC) or TAG
                self.ConfigSrcList = ['xml']
            else:  # should not get here: should be found by checkInput
                log.fatal('no reading of BS, RDO, AOD, ESD, or TAG specified')

        # we need the temporary COOL database, if we read the configuration from XML and write ESD/AOD (or have 'ds' set for some reason)
        self.makeTempCool   = self.readRDO and \
                              ( self.writeESDAOD or 'ds' in self.ConfigSrcList ) and \
                              ( self.readMC \
                                or (self.isCommisioning and (TriggerFlags.readLVL1configFromXML() and TriggerFlags.readHLTconfigFromXML())) \
                                or TriggerFlags.readMenuFromTriggerDb() )

        log.info("Need to create temporary cool file? : %r" %
                 self.makeTempCool)

        log.info('Creating the Trigger Configuration Services')
        self.svc = SetupTrigConfigSvc()

        #set the merged system
        #self.svc.doMergedHLT = TriggerFlags.doHLT()

        if 'xml' in self.ConfigSrcList or self.makeTempCool:
            # sets them if plain XML reading is to be used
            self.svc.l1topoXmlFile = TriggerFlags.outputL1TopoConfigFile(
            )  # generated in python
            self.svc.l1XmlFile = TriggerFlags.outputLVL1configFile(
            )  # generated in python
            self.svc.hltXmlFile = TriggerFlags.outputHLTconfigFile(
            )  # generated in python
            if TriggerFlags.readL1TopoConfigFromXML():
                self.svc.l1topoXmlFile = TriggerFlags.inputL1TopoConfigFile(
                )  # given XML
            if TriggerFlags.readLVL1configFromXML():
                self.svc.l1XmlFile = TriggerFlags.inputLVL1configFile(
                )  # given XML
            if TriggerFlags.readHLTconfigFromXML():
                self.svc.hltXmlFile = TriggerFlags.inputHLTconfigFile(
                )  # given XML

        ### preparations are done!
        try:
            self.svc.SetStates(self.ConfigSrcList)
        except:
            log.error('Failed to set state of TrigConfigSvc to %r' %
                      self.ConfigSrcList)
        else:
            log.info('The following configuration services will be tried: %r' %
                     self.ConfigSrcList)

        try:
            self.svc.InitialiseSvc()
        except Exception, ex:
            log.error('Failed to activate TrigConfigSvc: %r' % ex)
Esempio n. 9
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
Esempio n. 10
0
    " Retrieve the input metadata information"
    # NOTE: Old way to retrieve configuration:
    #addRingerInputMetaToList( l, outputRingSetConfType() )
    #addRingerInputMetaToList( l, outputRingSetConfAuxType() )
    # NOTE: New way

    from PyUtils.MetaReaderPeeker import convert_metadata_items, metadata
    metaItemDict = convert_metadata_items(layout='dict')

    if any(['RingSetConf' in key for key in metaItemDict]):
        l.append('%s#*' % outputRingSetConfType())
        l.append('%s#*' % outputRingSetConfAuxType())


# Add itens into lists
if (rec.doWriteAOD()
        or rec.doWriteESD()) and caloRingerFlags.doWriteRingsToFile():
    # Get instance to the builder:
    CRBuilder = CaloRingerAlgorithmBuilder()
    # Get instance to the metadata builder:
    CRMetaBuilder = CaloRingerMetaDataBuilder(disable=True)

    if CRBuilder.usable():
        for cType, cKeys in CRBuilder.output().items():
            for cKey in cKeys:
                for dictKey, value in CaloRingerKeysDict.outputs.items():
                    if value[0] == cType:
                        auxOption = CaloRingerKeysDict.outputs[dictKey][2]
                        addOutputToList(caloRingerAODList, cType, cKey,
                                        auxOption)
                        mlog.debug(
Esempio n. 11
0
    pass

def getInputMetaData( l ):
  " Retrieve the input metadata information"
  # NOTE: Old way to retrieve configuration:
  #addRingerInputMetaToList( l, outputRingSetConfType() )
  #addRingerInputMetaToList( l, outputRingSetConfAuxType() )
  # NOTE: New way
  from RecExConfig.InputFilePeeker import inputFileSummary
  metaItemDict = inputFileSummary.get( 'metadata_itemsDic' )
  if any( ['RingSetConf' in key for key in metaItemDict ] ):
    l.append('%s#*' % outputRingSetConfType() )
    l.append('%s#*' % outputRingSetConfAuxType() )

# Add itens into lists
if ( rec.doWriteAOD() or rec.doWriteESD() ) and caloRingerFlags.doWriteRingsToFile():
  # Get instance to the builder:
  CRBuilder = CaloRingerAlgorithmBuilder()
  # Get instance to the metadata builder:
  CRMetaBuilder = CaloRingerMetaDataBuilder()

  if CRBuilder.usable():
    for cType, cKeys in CRBuilder.output().items():
      for cKey in cKeys:
        for dictKey, value in CaloRingerKeysDict.outputs.items():
          if value[0] == cType:
            auxOption = CaloRingerKeysDict.outputs[dictKey][2]
            addOutputToList(caloRingerAODList, cType, cKey, auxOption)
            mlog.debug("Added container with type/key %s/%s to StoreGateSvc", cType, cKey)
            break
  if rec.readESD() or rec.readAOD(): # In this case, we assume that the
Esempio n. 12
0
def addJetRecoToAlgSequence(job=None,
                            useTruth=None,
                            eventShapeTools=None,
                            separateJetAlgs=None,
                            debug=None):

    myname = "JetAlgorithm: "

    # We need this to modify the global variable.
    global jetalg

    # Import message level flags.
    from GaudiKernel.Constants import DEBUG

    # Import the jet reconstruction control flags.
    from JetRec.JetRecFlags import jetFlags

    # Import the standard jet tool manager.
    from JetRec.JetRecStandard import jtm

    # Set sequence and flags as needed.
    if job == None:
        from AthenaCommon.AlgSequence import AlgSequence
        job = AlgSequence()
    if useTruth == None:
        useTruth = jetFlags.useTruth()
    if eventShapeTools == None:
        eventShapeTools = jetFlags.eventShapeTools()
        if eventShapeTools == None:
            eventShapeTools = []
    if separateJetAlgs == None:
        separateJetAlgs = jetFlags.separateJetAlgs()

    # Event shape tools.
    evsDict = {
        "emtopo": ("EMTopoEventShape", jtm.emget),
        "lctopo": ("LCTopoEventShape", jtm.lcget),
        "empflow": ("EMPFlowEventShape", jtm.empflowget),
    }

    if jetFlags.useTracks():
        if jetFlags.useVertices():
            evsDict["emtopo"] = ("EMTopoOriginEventShape", jtm.emoriginget)
            evsDict["lctopo"] = ("LCTopoOriginEventShape", jtm.lcoriginget)
        else:
            evsDict["emtopo"] = ("EMTopoOriginEventShape", jtm.emget)
            evsDict["lctopo"] = ("LCTopoOriginEventShape", jtm.lcget)
    jetlog.info(myname + "Event shape tools: " + str(eventShapeTools))

    from RecExConfig.AutoConfiguration import IsInInputFile
    for evskey in eventShapeTools:
        from EventShapeTools.EventDensityConfig import configEventDensityTool
        if evskey in evsDict:
            (toolname, getter) = evsDict[evskey]
            if toolname in jtm.tools:
                jetlog.info(myname + "Skipping duplicate event shape: " +
                            toolname)
            else:
                jetlog.info(myname + "Adding event shape " + evskey)
                if not IsInInputFile("xAOD::EventShape", toolname):
                    jtm += configEventDensityTool(toolname, getter.Label, 0.4)
                    jtm.allEDTools += [jtm.tools[toolname]]
        else:
            jetlog.info(myname + "Invalid event shape key: " + evskey)
            raise Exception

    # Add the tool runner. It runs the jetrec tools.
    ctools = []
    # Add the truth tools.
    if useTruth:
        from JetRec.JetFlavorAlgs import scheduleCopyTruthParticles
        ctools += scheduleCopyTruthParticles()

        # build truth jet input :
        ctools += [jtm.truthpartcopy, jtm.truthpartcopywz]

    ## if jetFlags.useCells():
    ##   ctools += [jtm.missingcells] commented out : incompatible with trigger : ATR-9696
    if jetFlags.useTracks:
        ctools += [jtm.tracksel, jtm.trackselloose_trackjets]
        if jetFlags.useVertices:
            ctools += [jtm.tvassoc]

    # LCOriginTopoClusters and EMOriginTopoClusters are shallow copies
    # of CaloCalTopoClusters.  This means that if CaloCalTopoClusters gets
    # thinned on output, the the two derived containers need to be thinned
    # in the same way, else they'll be corrupted in the output.
    # FIXME: this should be automatic somehow.
    postalgs = []
    thinneg = False
    from RecExConfig.RecFlags import rec
    if rec.doWriteAOD() and not rec.readAOD():
        from ParticleBuilderOptions.AODFlags import AODFlags
        if AODFlags.ThinNegativeEnergyCaloClusters:
            thinneg = True

    if jetFlags.useTracks and jetFlags.useVertices:
        if not IsInInputFile("xAOD::CaloClusterContainer",
                             "LCOriginTopoClusters"):
            ctools += [jtm.JetConstitSeq_LCOrigin]
            if thinneg:
                from ThinningUtils.ThinningUtilsConf import ThinNegativeEnergyCaloClustersAlg
                postalgs.append(
                    ThinNegativeEnergyCaloClustersAlg(
                        'ThinNegLCOriginTopoClusters',
                        ThinNegativeEnergyCaloClusters=True,
                        CaloClustersKey='LCOriginTopoClusters',
                        StreamName='StreamAOD'))
        if not IsInInputFile("xAOD::CaloClusterContainer",
                             "EMOriginTopoClusters"):
            ctools += [jtm.JetConstitSeq_EMOrigin]
            if thinneg:
                from ThinningUtils.ThinningUtilsConf import ThinNegativeEnergyCaloClustersAlg
                postalgs.append(
                    ThinNegativeEnergyCaloClustersAlg(
                        'ThinNegEMOriginTopoClusters',
                        ThinNegativeEnergyCaloClusters=True,
                        CaloClustersKey='EMOriginTopoClusters',
                        StreamName='StreamAOD'))
        if not IsInInputFile("xAOD::PFOContainer", "CHSParticleFlowObjects"):
            if not hasattr(job, "jetalgCHSPFlow"):
                ctools += [jtm.JetConstitSeq_PFlowCHS]
                if thinneg:
                    from ThinningUtils.ThinningUtilsConf import ThinNegativeEnergyNeutralPFOsAlg
                    CHSnPFOsThinAlg = ThinNegativeEnergyNeutralPFOsAlg(
                        "ThinNegativeEnergyCHSNeutralPFOsAlg",
                        NeutralPFOsKey="CHSNeutralParticleFlowObjects",
                        ThinNegativeEnergyNeutralPFOs=True,
                        StreamName='StreamAOD')
                    postalgs.append(CHSnPFOsThinAlg)

    from JetRec.JetRecConf import JetToolRunner
    from JetRec.JetRecConf import JetAlgorithm
    runners = []
    if len(ctools) > 0:
        jtm += JetToolRunner("jetconstit",
                             EventShapeTools=[],
                             Tools=ctools,
                             Timer=jetFlags.timeJetToolRunner())
        job += JetAlgorithm("jetalgConstituents", Tools=[jtm.jetconstit])

    # Add all the PseudoJetAlgorithms now
    # To avoid massive refactoring and to preserve familiarity,
    # kept calling things "getters", but these are already
    # PseudoJetAlgorithms as we eliminated the wrappers
    for getter in jtm.allGetters:
        job += getter

    # Then, add all event shape tools in separate algs
    for evstool in jtm.allEDTools:
        from EventShapeTools.EventShapeToolsConf import EventDensityAthAlg
        job += EventDensityAthAlg("edalg_" + evstool.OutputContainer,
                                  EventDensityTool=evstool)

    if separateJetAlgs:

        for t in jtm.jetrecs:
            jalg = JetAlgorithm("jetalg" + t.name(), Tools=[t])
            job += jalg

    else:
        from JetRec.JetRecConf import JetToolRunner
        jtm += JetToolRunner("jetrun",
                             EventShapeTools=[],
                             Tools=rtools + jtm.jetrecs,
                             Timer=jetFlags.timeJetToolRunner())
        runners += [jtm.jetrun]

    job += JetAlgorithm("jetalg")
    jetalg = job.jetalg
    jetalg.Tools = runners
    if jetFlags.debug > 0:
        # jtm.setOutputLevel(jtm.jetrun, DEBUG)
        jetalg.OutputLevel = DEBUG
    if jetFlags.debug > 1:
        for tool in jtm.jetrecs:
            jtm.setOutputLevel(tool, DEBUG)
    if jetFlags.debug > 2:
        for tool in jtm.finders:
            jtm.setOutputLevel(tool, DEBUG)
    if jetFlags.debug > 3:
        jtm.setOutputLevel(jtm.jetBuilderWithArea, DEBUG)
        jtm.setOutputLevel(jtm.jetBuilderWithoutArea, DEBUG)

    for postalg in postalgs:
        job += postalg
Esempio n. 13
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():
            bs = ByteStreamUnpackGetter()

        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():
            tdt = TrigDecisionGetter()

        # 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" )
            topSequence += RoiWriter()
            # write out the RoiDescriptorStores
            from TrigEDMConfig.TriggerEDM 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, thinningSvc, edm):
            from AthenaCommon.AlgSequence import AlgSequence 
            topSequence = AlgSequence()
            from TrigNavTools.TrigNavToolsConf import HLT__StreamTrigNavSlimming, HLT__TrigNavigationSlimming
            from TrigNavTools.TrigNavToolsConfig import navigationSlimming

            edmlist = list(y.split('-')[0] for x in edm.values() for y in x) #flatten names
          
            # from HLT result drop unrecorded features
            # slimmerHLT = HLT__StreamTrigNavSlimming('HLTNavSlimmer_%s'%stream)
            slimmerHLT = HLT__TrigNavigationSlimming('TrigNavigationSlimmer_%s'%stream)
            tHLT = navigationSlimming({'name':'HLTNav_%s'%stream, 'mode':'cleanup', 
                                                          'ThinningSvc':thinningSvc, 'result':'HLTResult_HLT',
                                                          'features':edmlist})
            #tHLT.SlimmingTool.OutputLevel=DEBUG
            tHLT.ActInPlace=True
            slimmerHLT.ThinningTool = tHLT
            print slimmerHLT.ThinningTool
            topSequence += slimmerHLT
            log.info("Configured slimming of HLT")
            del edmlist


        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
        from AthenaServices.Configurables import ThinningSvc, createThinningSvc
        
        _doSlimming = True
        if _doSlimming and rec.readRDO() and rec.doWriteAOD():
            if not hasattr(svcMgr, 'ThinningSvc'): # if the default is there it is configured for AODs
                svcMgr += ThinningSvc(name='ThinningSvc', Streams=['StreamAOD'])             
            _addSlimming('StreamAOD', svcMgr.ThinningSvc, _TriggerESDList ) #Use ESD item list also for AOD!
            log.info("configured navigation slimming for AOD output")
            
        if _doSlimming and rec.readRDO() and rec.doWriteESD(): #rec.doWriteESD() and not rec.readESD(): 
            if not  hasattr(svcMgr, 'ESDThinningSvc'):
                svcMgr += ThinningSvc(name='ESDThinningSvc', Streams=['StreamESD']) # the default is configured for AODs
            _addSlimming('StreamESD', svcMgr.ESDThinningSvc, _TriggerESDList )                
            log.info("configured navigation slimming for ESD output")              
            



        objKeyStore.addManyTypesStreamESD( _TriggerESDList )                        
        objKeyStore.addManyTypesStreamAOD( _TriggerAODList )        
            
        return True
Esempio n. 14
0
#FIXME: Subsequent algorithms may alter the event info object (setting Error bits)
if not objKeyStore.isInInput( "xAOD::EventInfo"):
    from xAODEventInfoCnv.xAODEventInfoCreator import xAODMaker__EventInfoCnvAlg
    topSequence+=xAODMaker__EventInfoCnvAlg()
    pass



###################################################################
#
# functionality : monitor memory and cpu time
#

#
#now write out Transient Event Store content in POOL
if rec.doWriteESD() or rec.doWriteAOD() or rec.doWriteRDO() or rec.doWriteTAG():
    import AthenaPoolCnvSvc.WriteAthenaPool


# Must make sure that no OutStream's have been declared
#FIXME
theApp.OutStream = []




MetaDataStore=svcMgr.MetaDataStore


#Lumiblocks and EventBookkeepers
if rec.doFileMetaData():
Esempio n. 15
0
from AthenaCommon.DetFlags import DetFlags
from RecExConfig.RecFlags import rec
from MuonRecExample.MuonRecFlags import muonRecFlags
from AthenaCommon.BeamFlags import jobproperties

from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags

#AOD list, also added to the ESD
MuonAODList = []

if DetFlags.detdescr.Muon_on() and (rec.doWriteAOD() or rec.doWriteESD()):

    # Segments
    MuonAODList += ["xAOD::MuonSegmentContainer#MuonSegments"]
    MuonAODList += ["xAOD::MuonSegmentAuxContainer#MuonSegmentsAux."]

    MuonAODList += ["xAOD::MuonSegmentContainer#NCB_MuonSegments"]
    MuonAODList += ["xAOD::MuonSegmentAuxContainer#NCB_MuonSegmentsAux."]

    # TrackParticles
    MuonAODList += [
        "xAOD::TrackParticleContainer#MuonSpectrometerTrackParticles"
    ]
    MuonAODList += [
        "xAOD::TrackParticleAuxContainer#MuonSpectrometerTrackParticlesAux."
    ]
    MuonAODList += [
        "xAOD::TrackParticleContainer#MuonSpectrometerOnlyTrackParticles"
    ]
    MuonAODList += [
        "xAOD::TrackParticleAuxContainer#MuonSpectrometerOnlyTrackParticlesAux."
Esempio n. 16
0
#
# --- Only do for RAW-ESD stage
#
from RecExConfig.RecFlags import rec
if rec.doWriteESD() or rec.doWriteAOD() or (
        'doWriteESD' in dir() and doWriteESD
) or ('doWriteAOD' in dir()
      and doWriteAOD) or InDetFlags.doTrkNtuple() or InDetFlags.doTrkD3PD():

    # --- fix primary vertex finder bug
    printfunc('===> OVERWRITTEN TOOL SETTINGS ................')
    InDetPriVxFinderTool.maxVertices = 200
    printfunc(InDetPriVxFinderTool)
    printfunc('===> OVERWRITTEN TOOL SETTINGS ................')

    # --- fix vertexing setup for selection
    printfunc('===> OVERWRITTEN TOOL SETTINGS ................')
    from TrkVertexWeightCalculators.TrkVertexWeightCalculatorsConf import Trk__TrueVertexDistanceWeightCalculator
    VertexWeightCalculator = Trk__TrueVertexDistanceWeightCalculator(
        name="InDetTrueVertexDistanceWeightCalculator",
        McTruthCollection=InDetKeys.McEventCollection())
    ToolSvc += VertexWeightCalculator
    printfunc(VertexWeightCalculator)
    printfunc('===> OVERWRITTEN TOOL SETTINGS ................')

    printfunc('===> OVERWRITTEN TOOL SETTINGS ................')
    VertexCollectionSortingTool.VertexWeightCalculator = VertexWeightCalculator
    printfunc(VertexCollectionSortingTool)
    printfunc('===> OVERWRITTEN TOOL SETTINGS ................')

    # --- fix vertexing smoother setup
Esempio n. 17
0
from RecExConfig.RecFlags import rec as recFlags
from RecExConfig.RecAlgsFlags import recAlgs as recAlgsFlags
from RecExConfig.RecConfFlags import recConfFlags
from InDetRecExample.InDetJobProperties import InDetFlags
from MuonCombinedRecExample.MuonCombinedRecFlags import muonCombinedRecFlags

# import standalone to avoid that it overwrites combined later on
import MuonRecExample.MuonRecStandaloneOnlySetup

# Output
recFlags.doWriteESD = False
recFlags.doWriteAOD = False

# reconstruction
recFlags.doESD = True
recFlags.doAOD = recFlags.doWriteAOD()

# enable inner detector
DetFlags.ID_setOn()
recFlags.doInDet = True
InDetFlags.Enabled = True
InDetFlags.disableInDetReco = False

# enable calorimeter
DetFlags.Calo_setOn()
recFlags.doCalo = True
recFlags.doLArg = True
recFlags.doTile = True
# do not run digitization
DetFlags.digitize.all_setOff()
DetFlags.simulate.all_setOff()
Esempio n. 18
0
if not athenaCommonFlags.PoolRDOInput.isDefault():
    athenaCommonFlags.FilesInput = athenaCommonFlags.PoolRDOInput()
elif not athenaCommonFlags.PoolESDInput.isDefault():
    athenaCommonFlags.FilesInput = athenaCommonFlags.PoolESDInput()

from RecExConfig.RecFlags import rec
# --- Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
OutputLevel = INFO
# --- produce an atlantis data file
doJiveXML = False
# --- run the Virtual Point 1 event visualisation
doVP1 = False
# --- controls what is written out. ESD includes AOD, so it's normally enough
doWriteESD = rec.doWriteESD()
doWriteAOD = rec.doWriteAOD()
# --- read BS - please look at the default input file(s) to know the det descr and cond tag
doReadBS = False
# --- do auditors ?
doAuditors = True

if os.environ['CMTCONFIG'].endswith('-dbg'):
    # --- do EDM monitor (debug mode only)
    doEdmMonitor = True
    # --- write out a short message upon entering or leaving each algorithm
    doNameAuditor = True
else:
    doEdmMonitor = False
    doNameAuditor = False

#--------------------------------------------------------------
Esempio n. 19
0
    def configure(self):
        log = logging.getLogger( "TriggerConfigGetter.py" )
        from PyUtils.MetaReaderPeekerFull import metadata

        # first check the input
        if "HIT2RDO" in self._environment:
            TriggerFlags.doLVL2 = False
            TriggerFlags.doEF = False
            log.info("For simulation jobs the following flags are set:")
            log.info("globalflags.InputFormat             : %s", globalflags.InputFormat())
            log.info("globalflags.DataSource              : %s", globalflags.DataSource())
            log.info("TriggerFlags.configForStartup       : %s", TriggerFlags.configForStartup())
            log.info("TriggerFlags.dataTakingConditions   : %s", TriggerFlags.dataTakingConditions())
            log.info("TriggerFlags.doLVL2                 : %s", TriggerFlags.doLVL2())
            log.info("TriggerFlags.doEF                   : %s", TriggerFlags.doEF())
        else:
            if not self.checkInput():
                log.error("Could not determine job input. Can't setup trigger configuration and will return!")
                return
            # self.checkInput() may call TriggerConfigCheckMetadata, this can in turn set "rec.doTrigger.set_Value_and_Lock(False)"
            # but TriggerConfigGetter might have only been called in the first place due to this flag having been true, 
            # so re-check that we're still OK to be executing here
            if not (recAlgs.doTrigger() or rec.doTrigger() or TriggerFlags.doTriggerConfigOnly()):
                log.info("Aborting TriggerConfigGetter as the trigger flags were switched to false in checkInput()")
                return True

        self.readPool       = globalflags.InputFormat() == 'pool'
        self.readRDO        = rec.readRDO()
        self.writeESDAOD    = rec.doWriteESD() or rec.doWriteAOD() or rec.doWriteDPD()
        self.writeAOD       = rec.doWriteAOD() or rec.doWriteDPD()
        self.ConfigSrcList  = TriggerFlags.configurationSourceList()
        self.readMC         = globalflags.DataSource()=='geant3' or globalflags.DataSource()=='geant4'
        self.readTriggerDB  = TriggerFlags.readMenuFromTriggerDb() and self.readRDO
        self.isCommisioning = globalflags.DataSource()=='data' and globalflags.DetGeo()=='commis' 
        self.l1Folders      = TriggerFlags.dataTakingConditions()=='FullTrigger' or TriggerFlags.dataTakingConditions()=='Lvl1Only'
        self.hltFolders     = TriggerFlags.dataTakingConditions()=='FullTrigger' or TriggerFlags.dataTakingConditions()=='HltOnly'
        self.isRun1Data     = False 
        self.hasxAODMeta    = ("metadata_items" in metadata and any(('TriggerMenu' in key) for key in metadata["metadata_items"].keys()))
        if globalflags.DataSource()=='data':
            from RecExConfig.AutoConfiguration  import GetRunNumber
            runNumber = GetRunNumber()
            if runNumber is not None and runNumber > 0 and runNumber < 230000 :
                self.isRun1Data = True
        self.isTriggerReprocessing = False

        # the TriggerFlags.readMenuFromTriggerDb() tells us that we read the trigger menu from the database
        # the connection itself is defined in TriggerFlags.triggerDbConnection()

        # reading from the TriggerDB can mean different things:

        # a) TriggerFlags doLVL2() and doEF() are both False:
        #    - create a tmp sqlite file with the conditions (menu)
        #    - use DSConfigSvc


        # b) TriggerFlags doLVL2() or doEF() is True:
        #    - use HLTConfigSvc
        if self.readTriggerDB and (TriggerFlags.doLVL2() or TriggerFlags.doEF() or TriggerFlags.doHLT()):

            self.ConfigSrcList = ['xml'] # to use L1/HLTConfigSvc and not DSConfigSvc, but only if we are running the HLT


        if self._environment: # I don't think anyone calls TriggerConfigGetter with an argument
            self.readPool  = False
            self.writeESDAOD = False
            self.readHits = False
            if "ReadPoolRDO" in self._environment:
                self.readPool = True
                self.readRDO = True
            elif "ReadPool" in self._environment:
                self.readPool = True
                self.readRDO = False
            if "WritePool" in self._environment:
                self.writeESDAOD = True
            if "HIT2RDO" in self._environment:
                self.readRDO = False
                self.readHits = True


        # define ConfigSvc
        if not self.ConfigSrcList:
            if (self.readPool and not self.readRDO) or (self.readRDO and not self.readPool): # (ESD, AOD, DPD) or (RDO-BS)
                self.ConfigSrcList = ['ds']
            elif (self.readRDO and self.readPool) or rec.readTAG() or self.readHits:           # (RDO-MC) or TAG
                self.ConfigSrcList = ['xml']
            else: # should not get here: should be found by checkInput
                log.fatal('no reading of BS, RDO, AOD, ESD, or TAG specified')

        # we need the temporary COOL database, if we read the configuration from XML and write ESD/AOD (or have 'ds' set for some reason)
        self.makeTempCool   = self.readRDO and \
                              ( self.writeESDAOD or 'ds' in self.ConfigSrcList ) and \
                              ( self.readMC \
                                or (self.isCommisioning and (TriggerFlags.readLVL1configFromXML() and TriggerFlags.readHLTconfigFromXML())) \
                                or TriggerFlags.readMenuFromTriggerDb() )

        log.info("Need to create temporary cool file? : %r", self.makeTempCool)

        log.info('Creating the Trigger Configuration Services')

        from AthenaCommon.AppMgr import ServiceMgr as svcMgr

        ########################################################################
        # START OF TEMPORARY SOLUTION FOR RUN-3 TRIGGER DEVELOPMENT
        ########################################################################
        from TriggerJobOpts.HLTTriggerResultGetter import EDMDecodingVersion
        EDMDecodingVersion()  # In most use cases this needs to be called much earlier than in HLTTriggerResultGetter

        if TriggerFlags.EDMDecodingVersion() >= 3:
            if self.hasxAODMeta:
                if not hasattr(svcMgr, 'xAODConfigSvc'):
                    from TrigConfxAOD.TrigConfxAODConf import TrigConf__xAODConfigSvc
                    svcMgr += TrigConf__xAODConfigSvc('xAODConfigSvc')
            else: # Does not have xAODMeta
                # Run-3 Trigger Configuration Services
                from TrigConfigSvc.TrigConfigSvcCfg import getL1ConfigSvc, getHLTConfigSvc
                from AthenaConfiguration.AllConfigFlags import ConfigFlags
                svcMgr += getL1ConfigSvc(ConfigFlags)
                svcMgr += getHLTConfigSvc(ConfigFlags)

                # Needed for TrigConf::xAODMenuWriterMT
                from TrigConfigSvc.TrigConfigSvcConfig import TrigConfigSvc
                svcMgr += TrigConfigSvc("TrigConfigSvc")
                svcMgr.TrigConfigSvc.PriorityList = ["none", "ds", "xml"]

        else:
            # non-MT (Run-2) Trigger Configuration
            self.svc = SetupTrigConfigSvc()

            if 'xml' in self.ConfigSrcList or self.makeTempCool:
                # sets them if plain XML reading is to be used
                self.svc.l1topoXmlFile = TriggerFlags.outputL1TopoConfigFile()  # generated in python
                self.svc.l1XmlFile     = TriggerFlags.outputLVL1configFile()    # generated in python
                self.svc.hltXmlFile    = TriggerFlags.outputHLTconfigFile()     # generated in python
                if TriggerFlags.readL1TopoConfigFromXML():
                    self.svc.l1topoXmlFile  = TriggerFlags.inputL1TopoConfigFile() # given XML
                if TriggerFlags.readLVL1configFromXML():
                    self.svc.l1XmlFile  = TriggerFlags.inputLVL1configFile() # given XML
                if TriggerFlags.readHLTconfigFromXML():
                    self.svc.hltXmlFile  = TriggerFlags.inputHLTconfigFile()   # given XML

            try:
                self.svc.SetStates( self.ConfigSrcList )
            except Exception:
                log.error( 'Failed to set state of TrigConfigSvc to %r', self.ConfigSrcList )
            else:
                log.info('The following configuration services will be tried: %r', self.ConfigSrcList )

            try:
                self.svc.InitialiseSvc()
            except Exception as ex:
                log.error( 'Failed to activate TrigConfigSvc: %r', ex )
        ########################################################################
        # END OF TEMPORARY SOLUTION FOR RUN-3 TRIGGER DEVELOPMENT
        ########################################################################

        if self.readTriggerDB:
            log.info( "Using TriggerDB connection '%s'", TriggerFlags.triggerDbConnection() )
            self.trigDbConnectionParameters = interpretConnection(TriggerFlags.triggerDbConnection(), resolveAlias=False)
            self.setConfigSvcConnParams(self.trigDbConnectionParameters)

        log.info("TriggerFlags.triggerCoolDbConnection is '%s' [default: '']", TriggerFlags.triggerCoolDbConnection())
        TrigCoolDbConnection = TriggerFlags.triggerCoolDbConnection()

        if self.makeTempCool:
            TrigCoolDbConnection = self.setupTempCOOLWriting(TrigCoolDbConnection)

        if ('ds' in self.ConfigSrcList) and not self.hasxAODMeta:
            self.setupCOOLReading(TrigCoolDbConnection)

        if hasattr(svcMgr, 'DSConfigSvc'):
            db = 'TRIGGERDB'
            if self.isRun1Data:
                db = 'TRIGGERDB_RUN1'
            elif self.readMC:
                db = 'TRIGGERDBMC'
            elif self.isTriggerReprocessing:
                db = 'TRIGGERDBREPR'
            svcMgr.DSConfigSvc.ConfigSource = 'dblookup'
            svcMgr.DSConfigSvc.DBServer = db
            log.info("DSConfigSvc trigger database is '%s'", db)
        
        if not self.hasxAODMeta:
            self.setupxAODWriting()


        # all went fine we are configured
        return True