Beispiel #1
0
##Implementing x277 requirements  PF 26/10/2014
#rec.doJetMissingETTag=False  -> Not needed for this Jo since it properly set the Calo off
rec.doTau = False
from TrigHLTMonitoring.HLTMonFlags import HLTMonFlags
HLTMonFlags.doBphys = False
from AthenaMonitoring import DQMonFlags
DQMonFlags.doJetMon = False
DQMonFlags.doMissingEtMon = False
DQMonFlags.enableLumiAccess = False
DQMonFlags.doStreamAwareMon = False
from JetRec.JetRecFlags import jetFlags
jetFlags.useTracks = False

from InDetRecExample.InDetJobProperties import InDetFlags
InDetFlags.doTruth = (globalflags.DataSource == 'geant4'
                      and globalflags.InputFormat() == 'pool')
#InDetFlags.doTruth = False
if globalflags.InputFormat(
) == 'pool' and not globalflags.DataSource == 'geant4':
    # ---- run over ESD files
    #  InDetFlags.preProcessing=True
    #This is not originally defined in the Cosmics jobOption, but i add it here
    InDetFlags.doPRDFormation = False
else:
    InDetFlags.doPRDFormation = True

# --- uncomment to change the default of one of the following options:
#InDetFlags.doNewTracking          = False
#InDetFlags.doLowPt                = True
#InDetFlags.doBeamGas              = True
#InDetFlags.doBeamHalo             = True
Beispiel #2
0
if tileRawMon:

    if 'doTileMonOld' in dir() and doTileMonOld:
        TileMBTSMon = CfgMgr.TileMBTSMonTool(
            name='TileMBTSMon',
            OutputLevel=INFO,
            histoPathBase="/Tile/MBTS_OLD",
            LVL1ConfigSvc="TrigConf::TrigConfigSvc/TrigConfigSvc",
            doOnline=athenaCommonFlags.isOnline(),
            readTrigger=False,
            UseTrigger=False,
            FillHistogramsPerMBTS=False)
        #                                         , readTrigger     = DQMonFlags.useTrigger());

        from AthenaCommon.GlobalFlags import globalflags
        if globalflags.InputFormat() == 'pool':
            TileMBTSMon.TileDigitsContainerName = 'TileDigitsFlt'

        ManagedAthenaTileMon.AthenaMonTools += [TileMBTSMon]

    from TileMonitoring.TileMBTSMonitorAlgorithm import TileMBTSMonitoringConfigOld
    topSequence += TileMBTSMonitoringConfigOld(DQMonFlags)

    from TileRecUtils.TileRecFlags import jobproperties
    if jobproperties.TileRecFlags.readDigits():
        if 'doTileRODMon' in dir() and doTileRODMon:
            TileRODMon = CfgMgr.TileRODMonTool(
                name='TileRODMon',
                OutputLevel=INFO,
                histoPathBase="/Tile/ROD",
                FillHistogramsForL1Triggers=[],
Beispiel #3
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
Beispiel #4
0
        try:
            from CaloRec.CaloClusterSWCmbGetter import CaloClusterSWCmbGetter
            CaloClusterSWCmbGetter()
        except Exception:
            treatException("Problem with CaloSWCmbCluster. Switched off.")
            jobproperties.CaloRecFlags.doCaloCluster = False
    #EM clusters
    if jobproperties.CaloRecFlags.doEmCluster():
        try:
            include("LArClusterRec/LArCluster_jobOptions.py")
        except Exception:
            treatException("Problem with LArCluster. Switched off.")
            jobproperties.CaloRecFlags.doEmCluster = False
        # write digits of EM clusters
        if jobproperties.CaloRecFlags.doEMDigits() and globalflags.DataSource(
        ) == 'data' and globalflags.InputFormat() == 'bytestream':
            try:
                include("LArClusterRec/LArDigits_fromEMCluster_jobptions.py")
            except Exception:
                treatException(
                    "Problem with LArDigitsFromEMClust. Switched off.")
                jobproperties.CaloRecFlags.doEMDigits = False

    #Topoclusters
    if jobproperties.CaloRecFlags.doCaloTopoCluster():
        try:
            include("CaloRec/CaloTopoCluster_jobOptions.py")
        except Exception:
            treatException("Problem with CaloTopoCluster. Switched off.")
            jobproperties.CaloRecFlags.doCaloTopoCluster = False
    TrackD3PDSCTFlags.inputFiles = runArgs.inputBSFile
    globalflags.InputFormat='bytestream'
    athenaCommonFlags.BSRDOInput=TrackD3PDSCTFlags.inputFiles()

if hasattr(runArgs,"inputRDOFile"):
    TrackD3PDSCTFlags.inputFiles = runArgs.inputRDOFile
    globalflags.InputFormat='pool'
    athenaCommonFlags.PoolRDOInput=TrackD3PDSCTFlags.inputFiles()
    athenaCommonFlags.FilesInput=athenaCommonFlags.PoolRDOInput()


# run the reconstruction
include('TrackD3PDMaker/RecoSetupForSctNtuple.py')

#Condition tag 04.03
if globalflags.InputFormat() == 'bytestream':   
   if len(globalflags.ConditionsTag())!=0:
      from IOVDbSvc.CondDB import conddb
      conddb.setGlobalTag(globalflags.ConditionsTag())
   

# compose the tree
from TrackD3PDMaker.TrackD3PDMakerSCTFlags    import TrackD3PDSCTFlags

# uncomment the necessary one
TrackD3PDSCTFlags.doSCTNtuple = True # default
#TrackD3PDSCTFlags.doSCTNtupleLight = True
#TrackD3PDSCTFlags.doSCTNtupleExtended = True

#if not hasattr(runArgs,"inputRDOFile") and not hasattr(runArgs,"inputBSFile"):
#    include('TrackD3PDMaker/SCTNtuple.py')
Beispiel #6
0
DetFlags.ID_setOn()
# --- and switch off all the rest
DetFlags.Calo_setOff()
DetFlags.Muon_setOff()
# --- printout
DetFlags.Print()

#DetFlags.writeRDOPool.pixel_setOn()

#--------------------------------------------------------------
# Load InDet configuration
#--------------------------------------------------------------

# --- setup InDetJobProperties
from InDetRecExample.InDetJobProperties import InDetFlags
InDetFlags.doTruth = (globalflags.InputFormat() == 'pool')

InDetFlags.doLowBetaFinder = False

# --- uncomment to change the default of one of the following options:
#OutputLevel          = DEBUG

# --- possibility to change the trackfitter
#InDetFlags.trackFitterType = 'KalmanFitter'
#if (hasattr(InDetFlags,"doPixelClusterSplitting")) :
#  InDetFlags.doPixelClusterSplitting=False
#---slhc
#InDetFlags.doTrackSegmentsPixel = False
#InDetFlags.doTrackSegmentsSCT   = False
#InDetFlags.doTrackSegmentsTRT   = False
Beispiel #7
0
#DetFlags.pixel_setOff()
#DetFlags.detdescr.pixel_setOn()
#DetFlags.SCT_setOff()
#DetFlags.detdescr.SCT_setOn()
DetFlags.TRT_setOff()
DetFlags.detdescr.TRT_setOn()
# --- printout
DetFlags.Print()

#--------------------------------------------------------------
# Load InDet configuration
#--------------------------------------------------------------

# --- setup InDetJobProperties
from InDetRecExample.InDetJobProperties import InDetFlags
InDetFlags.doTruth       = (globalflags.DataSource == 'geant4' and globalflags.InputFormat() == 'pool')

# --- uncomment to change the default of one of the following options:
#InDetFlags.doHeavyIon = True
#InDetFlags.doNewTracking  = False#####################################
#InDetFlags.doLowPt        = True
#InDetFlags.doBeamGas      = True
#InDetFlags.doBeamHalo     = True
#InDetFlags.doxKalman      = True
#InDetFlags.doiPatRec      = False
#InDetFlags.doBackTracking = False
#InDetFlags.doTRTStandalone = False
#InDetFlags.doSingleSpBackTracking = True
#InDetFlags.doV0Finder         = False
#InDetFlags.doConversions      = False
#InDetFlags.doStatistics       = False
Beispiel #8
0
print "globalflags configuration:"
print globalflags

print "detflags configuration:"
DetFlags.Print()

print "rec configuration:"
print rec

#--------------------------------------------------------------
# Load InDet configuration
#--------------------------------------------------------------

# --- setup InDetJobProperties (default)
from InDetRecExample.InDetJobProperties import InDetFlags
InDetFlags.doTruth.set_Value_and_Lock (globalflags.DataSource == 'geant4' and globalflags.InputFormat() == 'pool')

# --- enable brem recovery
InDetFlags.doBremRecovery.set_Value_and_Lock                       (doBremRecovery)
# --- calo seeding does not work standalone 
InDetFlags.doCaloSeededBrem.set_Value_and_Lock                     (doCaloSeededBrem)

# --- cut level
#InDetFlags.cutLevel.set_Value_and_Lock                             (8)
#InDetFlags.priVtxCutLevel.set_Value_and_Lock                       (2)

# --- enable forward tracks
InDetFlags.doForwardTracks.set_Value_and_Lock                      (False)

# --- activate monitorings
InDetFlags.doMonitoringGlobal.set_Value_and_Lock                   (False)
    def configure(self):
        mlog = logging.getLogger('Py:LArRawChannelGetter::configure %s:' %
                                 self.__class__)

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

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

        from LArROD.LArRODFlags import larRODFlags

        from AthenaCommon.GlobalFlags import globalflags
        if globalflags.DataSource() == 'data' or larRODFlags.forceIter():

            # ADC2MeV tool
            from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault
            theADC2MeVTool = LArADC2MeVToolDefault()
            ToolSvc += theADC2MeVTool

            from AthenaCommon.AppMgr import ServiceMgr as svcMgr

            # Data case

            if larRODFlags.readDigits():

                from AthenaCommon.GlobalFlags import globalflags
                if globalflags.InputFormat() == 'bytestream':
                    if not "LArDigitContainer/FREE" in svcMgr.ByteStreamAddressProviderSvc.TypeNames:
                        svcMgr.ByteStreamAddressProviderSvc.TypeNames += [
                            "LArDigitContainer/FREE"
                        ]
                    if not larRODFlags.keepDSPRaw():
                        if "LArRawChannelContainer/LArRawChannels" in svcMgr.ByteStreamAddressProviderSvc.TypeNames:
                            svcMgr.ByteStreamAddressProviderSvc.TypeNames.remove(
                                "LArRawChannelContainer/LArRawChannels")
                    else:
                        if not "LArRawChannelContainer/LArRawChannels" in svcMgr.ByteStreamAddressProviderSvc.TypeNames:
                            svcMgr.ByteStreamAddressProviderSvc.TypeNames += [
                                "LArRawChannelContainer/LArRawChannels"
                            ]

                if globalflags.DetGeo() == 'ctbh6' or globalflags.DetGeo(
                ) == 'ctbh8':
                    from LArROD.LArRODConf import LArRawChannelBuilder
                    theLArRawChannelBuilder = LArRawChannelBuilder()
                    topSequence += theLArRawChannelBuilder
                    return True

                from LArROD.LArRODConf import LArRawChannelBuilderDriver

                theLArRawChannelBuilder = LArRawChannelBuilderDriver(
                    "LArRawChannelBuilder")
                topSequence += theLArRawChannelBuilder

                if larRODFlags.keepDSPRaw():
                    theLArRawChannelBuilder.LArRawChannelContainerName = larRODFlags.RawChannelFromDigitsContainerName(
                    )

                # bad channel masking if required
                if not larRODFlags.doBuildBadChannel():
                    # The first tool filters out bad channels
                    from LArROD.LArRODConf import LArRawChannelBuilderToolBadChannelTool
                    theLArRawChannelBuilderToolBadChannel = LArRawChannelBuilderToolBadChannelTool(
                    )
                    from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
                    theLArRCBMasker = LArBadChannelMasker("LArRCBMasker")
                    theLArRCBMasker.DoMasking = True
                    theLArRCBMasker.ProblemsToMask = [
                        "deadReadout", "deadPhys", "almostDead", "short",
                        "lowNoiseHG", "highNoiseHG", "unstableNoiseHG",
                        "lowNoiseMG", "highNoiseMG", "unstableNoiseMG",
                        "lowNoiseLG", "highNoiseLG", "unstableNoiseLG"
                    ]
                    #ToolSvc+=theLArRCBMasker
                    from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool
                    ToolSvc += LArBadChanTool()
                    theLArRawChannelBuilderToolBadChannel.BadChannelMask = theLArRCBMasker
                    theLArRawChannelBuilder.BuilderTools += [
                        theLArRawChannelBuilderToolBadChannel
                    ]
                    ToolSvc += theLArRawChannelBuilderToolBadChannel

                # Pulse reconstruction
                # main method: OFC iteration
                from LArROD.LArRODConf import LArRawChannelBuilderToolOFCIter
                theLArRawChannelBuilderToolOFCIter = LArRawChannelBuilderToolOFCIter(
                )
                theLArRawChannelBuilderToolOFCIter.minSample = 2
                theLArRawChannelBuilderToolOFCIter.maxSample = 12
                theLArRawChannelBuilderToolOFCIter.minADCforIterInSigma = 4  # ADCmax at least 4 sigma above noise for iteration
                theLArRawChannelBuilderToolOFCIter.minADCforIter = 15  # min adc for iteration (only if no pedestalRMS found)
                theLArRawChannelBuilderToolOFCIter.defaultPhase = 0  # starting delay, also the fixed delay for ADC below min.
                theLArRawChannelBuilderToolOFCIter.ECut = 250.  # Energy to save quality
                theLArRawChannelBuilder.BuilderTools += [
                    theLArRawChannelBuilderToolOFCIter
                ]
                theLArRawChannelBuilder += theLArRawChannelBuilderToolOFCIter

                # no fallback when emulating exactly DSP computation
                if not larRODFlags.doDSP():
                    # fallback(1): cubic method
                    from LArROD.LArRODConf import LArRawChannelBuilderToolCubic
                    theLArRawChannelBuilderToolCubic = LArRawChannelBuilderToolCubic(
                    )
                    theLArRawChannelBuilderToolCubic.minADCforCubic = 30
                    theLArRawChannelBuilder.BuilderTools += [
                        theLArRawChannelBuilderToolCubic
                    ]
                    theLArRawChannelBuilder += theLArRawChannelBuilderToolCubic

                    # fallback(2) averageing
                    from LArROD.LArRODConf import LArRawChannelBuilderToolAverage
                    theLArRawChannelBuilderToolAverage = LArRawChannelBuilderToolAverage(
                    )
                    theLArRawChannelBuilderToolAverage.NScan = 0
                    theLArRawChannelBuilder.BuilderTools += [
                        theLArRawChannelBuilderToolAverage
                    ]
                    theLArRawChannelBuilder += theLArRawChannelBuilderToolAverage

                # Pedestal
                # main method from database
                from LArROD.LArRODConf import LArRawChannelBuilderPedestalDataBase
                theLArRawChannelBuilderPedestalDataBase = LArRawChannelBuilderPedestalDataBase(
                )
                theLArRawChannelBuilderPedestalDataBase.LArPedestalKey = "Pedestal"
                theLArRawChannelBuilder.PedestalTools = [
                    theLArRawChannelBuilderPedestalDataBase
                ]
                theLArRawChannelBuilder += theLArRawChannelBuilderPedestalDataBase

                # no fallback when emulating exactly DSP computation
                if not larRODFlags.doDSP():
                    # fallback. sample 0
                    from LArROD.LArRODConf import LArRawChannelBuilderPedestalSampleZero
                    theLArRawChannelBuilderPedestalSampleZero = LArRawChannelBuilderPedestalSampleZero(
                    )
                    theLArRawChannelBuilder.PedestalTools += [
                        theLArRawChannelBuilderPedestalSampleZero
                    ]
                    theLArRawChannelBuilder += theLArRawChannelBuilderPedestalSampleZero

                # ADC to energy
                # main method from database
                from LArROD.LArRODConf import LArRawChannelBuilderADC2EDataBase
                theLArRawChannelBuilderADC2EDataBase = LArRawChannelBuilderADC2EDataBase(
                )
                theLArRawChannelBuilder.ADCtoEnergyTools = [
                    theLArRawChannelBuilderADC2EDataBase
                ]
                theLArRawChannelBuilderADC2EDataBase.ADC2MeVTool = theADC2MeVTool
                theLArRawChannelBuilder += theLArRawChannelBuilderADC2EDataBase

                # no fallback when emulating exactly DSP computation
                if not larRODFlags.doDSP():
                    # fallback, constant conversion factors
                    from LArROD.LArRODConf import LArRawChannelBuilderADC2EConstants
                    theLArRawChannelBuilderADC2EConstants = LArRawChannelBuilderADC2EConstants(
                    )
                    theLArRawChannelBuilder.ADCtoEnergyTools += [
                        theLArRawChannelBuilderADC2EConstants
                    ]
                    theLArRawChannelBuilder += theLArRawChannelBuilderADC2EConstants

                #more tools to be configured
                from LArRecUtils.LArRecUtilsConf import LArOFPeakRecoTool
                theLArOFPeakRecoTool = LArOFPeakRecoTool()
                from LArConditionsCommon.LArCondFlags import larCondFlags
                theLArOFPeakRecoTool.UseShape = larCondFlags.useShape()
                if larCondFlags.LArCoolChannelSelection.statusOn:
                    if len(larCondFlags.LArCoolChannelSelection()) > 0:
                        theLArOFPeakRecoTool.forceHighGain = larCondFlags.useOFCOnlyCoolChannelSelection(
                        )
                ToolSvc += theLArOFPeakRecoTool

                #
                # adjust default timing to match first sample information written in cool from Lar online configuration
                #
                nominalPeakSample = 2
                if globalflags.DataSource() == 'data':
                    from LArConditionsCommon.LArCool import larcool
                    if (larcool is not None):
                        nominalPeakSample = larcool.firstSample()
                        # don't use ramp intercept in calibration if gain type is not auto
                        if larcool.gainType() > 0:
                            mlog.info(
                                " Gain Type: %d  don't use intercept in ADC to Energy ramp calibration",
                                larcool.gainType())
                            theLArRawChannelBuilderADC2EDataBase.UseHighGainRampIntercept = False
                            theLArRawChannelBuilderADC2EDataBase.UseMedGainRampIntercept = False
                            theLArRawChannelBuilderADC2EDataBase.UseLowGainRampIntercept = False
                        else:
                            mlog.info(
                                " Gain Type: %d   use intercept in ADC to energy ramp calibraion ",
                                larcool.gainType())
                if (nominalPeakSample > 1):
                    theLArRawChannelBuilder.DefaultShiftTimeSample = nominalPeakSample - 2
                else:
                    theLArRawChannelBuilder.DefaultShiftTimeSample = 0
                theLArRawChannelBuilder.DataLocation = "FREE"

            else:

                from AthenaCommon.GlobalFlags import globalflags
                if globalflags.InputFormat() == 'bytestream':
                    if not "LArRawChannelContainer/LArRawChannels" in svcMgr.ByteStreamAddressProviderSvc.TypeNames:
                        svcMgr.ByteStreamAddressProviderSvc.TypeNames += [
                            "LArRawChannelContainer/LArRawChannels"
                        ]

            # In the case of DSP monitoring and reading rawchannels, need to give a different name to the LArRawChannels container
            # read from the bytestream ...
            # This name has to be coherent with the name in LArMonTools/LArRODMonTool_jobOptions.py
            if larRODFlags.doDSP() and larRODFlags.readRawChannels(
            ):  #Reading LArRawChannel
                print "Reading RawChannels in DSP physics mode"
                # !!! The name of the LArRawChannels container read from the Bytestream is LArRawChannels_fB !!!
                if not "LArRawChannelContainer/LArRawChannels_fB" in svcMgr.ByteStreamAddressProviderSvc.TypeNames:
                    svcMgr.ByteStreamAddressProviderSvc.TypeNames += [
                        "LArRawChannelContainer/LArRawChannels_fB"
                    ]
                print svcMgr.ByteStreamAddressProviderSvc.TypeNames

        else:

            # MC Case
            try:
                from AthenaCommon import CfgGetter
                topSequence += CfgGetter.getAlgorithm(
                    "LArRawChannelBuilder", tryDefaultConfigurable=True)
            except Exception as cfgException:
                print cfgException
                mlog.error("Failed to retrieve LArRawChannelBuilder. Quit")
                return False

        return True
Beispiel #10
0
if globalflags.DataSource() == 'data':
    if rec.projectName() == "data09_calophys":
        # for data09_calophys project, force to use DSP output for the cell energy, perform reco like DSP, no dead cell correction
        if rec.doLArg():
            from LArROD.LArRODFlags import larRODFlags
            larRODFlags.readDigits = False
        if rec.doTile():
            from TileRecUtils.TileRecFlags import jobproperties
            jobproperties.TileRecFlags.readDigits = False
        from CaloRec.CaloCellFlags import jobproperties
        jobproperties.CaloCellFlags.doDeadCellCorr = False
        jobproperties.CaloCellFlags.doLArCreateMissingCells = False
        jobproperties.CaloCellFlags.doLArDeadOTXCorr = False
    else:
        if rec.doLArg() and globalflags.InputFormat(
        ) == 'bytestream' and jobproperties.CaloRecFlags.doLArAutoConfiguration(
        ):
            # for bytestream reco of real data, autoconfigure based on the run format information
            # use digits only when digits available for all cells (transparent or rawdataresult)
            # use DSP energy + digits when available in case only sparse digits available (results)
            #   (when collisions with timing settled we could use only DSP energy in this case)
            from LArROD.LArRODFlags import larRODFlags
            larRODFlags.readDigits = True
            from LArConditionsCommon.LArCool import larcool
            if (larcool is not None):
                # check format1 & results mode
                if (larcool.format() == 1 and larcool.runType() == 2):
                    larRODFlags.keepDSPRaw = True
                if (larcool.format() == 0):
                    larRODFlags.keepDSPRaw = False  # raw data transparent mode, no DSP energy
Beispiel #11
0
CaloCellMakerFlags.doCompactCellInstead = doCompactCellInstead
CaloCellMakerFlags.doCompactCellInAddition = doCompactCellInAddition

# set sensible defaults according to global tags

CaloCellMakerFlags.makeCellFromRawChannel = False
CaloCellMakerFlags.makeCellFromDigit = False
CaloCellMakerFlags.doLArHitToCellDirect = False
CaloCellMakerFlags.doTileHitToRawChannelDirect = False

from AthenaCommon.GlobalFlags import globalflags

if globalflags.DataSource() == 'data':
    if globalflags.DetGeo() == 'ctb':
        CaloCellMakerFlags.makeCellFromDigit = True
if globalflags.DataSource() == 'geant3' and globalflags.InputFormat(
) == 'zebra':
    # for geant3 digitisation of all calo is needed
    DetFlags.digitize.Calo_setOn()
    # usually use fast digitisation for lar
    CaloCellMakerFlags.doLArHitToCellDirect = True
    # usually use slow digitisation for tile
    CaloCellMakerFlags.doTileHitToRawChannelDirect = False
    CaloCellMakerFlags.makeCellFromDigit = True
elif globalflags.DataSource() == 'geant3' or globalflags.DataSource(
) == 'geant4':
    # on geant4 usually run on raw channel file
    CaloCellMakerFlags.makeCellFromRawChannel = True

if not DetFlags.digitize.LAr_on():
    CaloCellMakerFlags.doLArHitToCellDirect = False
if not DetFlags.digitize.Tile_on():
Beispiel #12
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)
Beispiel #13
0
import pickle

from AthenaCommon.GlobalFlags import globalflags
from AthenaCommon.AthenaCommonFlags import jobproperties,athenaCommonFlags

onlinegoodies = {}

onlinegoodies['DataSource'] = globalflags.DataSource()
onlinegoodies['InputFormat'] = globalflags.InputFormat()
onlinegoodies['ConditionsTag'] = globalflags.ConditionsTag()
onlinegoodies['beamType'] = jobproperties.Beam.beamType()
onlinegoodies['DetDescrVersion'] = globalflags.DetDescrVersion()

file = open("globalflags.pickle",'wb')
pickle.dump(onlinegoodies,file)
file.close()

Beispiel #14
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
Beispiel #15
0
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
##########################################################################
# set up job


if globalflags.InputFormat()=='pool':
    # to read Pool data
    import AthenaPoolCnvSvc.ReadAthenaPool

    # if file not in catalog put it there
    svcMgr.PoolSvc.AttemptCatalogPatch=True 

    svcMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput()

    # backward compatibility (needed for RTT overwriting InputCollections)
    EventSelector=ServiceMgr.EventSelector


########################################################################

# Number of events to be processed 
    def createSvc(self):

        #
        # Load necessary conditions folders
        #

        # Calibration constants
        from IOVDbSvc.CondDB import conddb

        if not self._isMC:
            #only needed for data
            if not (conddb.folderRequested('/TRT/Onl/ROD/Compress')):
                conddb.addFolder("TRT_ONL", "/TRT/Onl/ROD/Compress")

        if not (conddb.folderRequested('/TRT/Calib/RT')
                or conddb.folderRequested('/TRT/Onl/Calib/RT')):
            conddb.addFolderSplitOnline('TRT', '/TRT/Onl/Calib/RT',
                                        '/TRT/Calib/RT')
        if not (conddb.folderRequested('/TRT/Calib/T0')
                or conddb.folderRequested('/TRT/Onl/Calib/T0')):
            conddb.addFolderSplitOnline('TRT', '/TRT/Onl/Calib/T0',
                                        '/TRT/Calib/T0')

        if not (conddb.folderRequested('/TRT/Calib/errors')
                or conddb.folderRequested('/TRT/Onl/Calib/errors')):
            conddb.addFolderSplitOnline("TRT", "/TRT/Onl/Calib/errors",
                                        "/TRT/Calib/errors")
            # not needed anymore conddb.addOverride('/TRT/Onl/Calib/errors','TrtCalibErrorsOnl-ErrorVal-00-00')

        if not (conddb.folderRequested('/TRT/Calib/ToTCalib')
                or conddb.folderRequested('/TRT/Onl/Calib/ToTCalib')):
            conddb.addFolderSplitOnline("TRT", "/TRT/Onl/Calib/ToTCalib",
                                        "/TRT/Calib/ToTCalib")

        if not (conddb.folderRequested('/TRT/Calib/HTCalib')
                or conddb.folderRequested('/TRT/Onl/Calib/HTCalib')):
            conddb.addFolderSplitOnline("TRT", "/TRT/Onl/Calib/HTCalib",
                                        "/TRT/Calib/HTCalib")

        # Calibration DB Service
        from AthenaCommon.AppMgr import ServiceMgr
        from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_CalDbSvc
        #InDetTRTCalDbSvc = TRT_CalDbSvc(self.instanceName('TRT_CalDbSvc'))    #
        InDetTRTCalDbSvc = TRT_CalDbSvc('TRT_CalDbSvc')
        ServiceMgr += InDetTRTCalDbSvc
        if self._print:
            print InDetTRTCalDbSvc

        # Dead/Noisy Straw Lists
        if not (conddb.folderRequested('/TRT/Cond/Status')
                or conddb.folderRequested('/TRT/Onl/Cond/Status')):
            conddb.addFolderSplitOnline("TRT", "/TRT/Onl/Cond/Status",
                                        "/TRT/Cond/Status")
        #there used to be an additional tag here!
        #conddb.addFolder("TRT","/TRT/Cond/StatusPermanent<tag>TrtStrawStatusPermanent-01</tag>")
        if not (conddb.folderRequested('/TRT/Cond/StatusPermanent')
                or conddb.folderRequested('/TRT/Onl/Cond/StatusPermanent')):
            conddb.addFolderSplitOnline("TRT", "/TRT/Onl/Cond/StatusPermanent",
                                        "/TRT/Cond/StatusPermanent")

        #high threshold capabilities
        if not (conddb.folderRequested('/TRT/Cond/StatusHT')
                or conddb.folderRequested('/TRT/Onl/Cond/StatusHT')):
            conddb.addFolderSplitOnline("TRT", "/TRT/Onl/Cond/StatusHT",
                                        "/TRT/Cond/StatusHT")

        # DCS Data Folders
        from AthenaCommon.GlobalFlags import globalflags
        if (globalflags.InputFormat() == 'bytestream'
                and globalflags.DataSource() == 'data'):
            if self.useDCS and not self.onlineMode:
                if not conddb.folderRequested(
                        '/TRT/DCS/HV/BARREL <cache>600</cache>'):
                    conddb.addFolder('DCS_OFL',
                                     "/TRT/DCS/HV/BARREL <cache>600</cache>")
                if not conddb.folderRequested(
                        '/TRT/DCS/HV/ENDCAPA <cache>600</cache>'):
                    conddb.addFolder('DCS_OFL',
                                     "/TRT/DCS/HV/ENDCAPA <cache>600</cache>")
                if not conddb.folderRequested(
                        '/TRT/DCS/HV/ENDCAPC <cache>600</cache>'):
                    conddb.addFolder('DCS_OFL',
                                     "/TRT/DCS/HV/ENDCAPC <cache>600</cache>")

        # TRT PID tools
        if not (conddb.folderRequested('/TRT/Calib/PID')
                or conddb.folderRequested('/TRT/Onl/Calib/PID')):
            conddb.addFolderSplitOnline("TRT", "/TRT/Onl/Calib/PID",
                                        "/TRT/Calib/PID")
        if not (conddb.folderRequested('/TRT/Calib/PIDver_New')
                or conddb.folderRequested('/TRT/Onl/Calib/PIDver_New')):
            conddb.addFolderSplitOnline("TRT", "/TRT/Onl/Calib/PIDver_New",
                                        "/TRT/Calib/PIDver_New")
        if not (conddb.folderRequested('/TRT/Calib/PID_RToTver_New')
                or conddb.folderRequested('/TRT/Onl/Calib/PID_RToTver_New')):
            conddb.addFolderSplitOnline("TRT",
                                        "/TRT/Onl/Calib/PID_RToTver_New",
                                        "/TRT/Calib/PID_RToTver_New")

        #
        # Load and Configure TRT Conditions Services
        #
        InDetTRTConditionsServices = []

        # Dead/Noisy Straw Service
        from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_StrawStatusSummarySvc
        InDetTRTStrawStatusSummarySvc = \
            TRT_StrawStatusSummarySvc(name=self.instanceName("InDetTRTStrawStatusSummarySvc"))
        ServiceMgr += InDetTRTStrawStatusSummarySvc
        InDetTRTConditionsServices.append(InDetTRTStrawStatusSummarySvc)

        if self._print:
            print InDetTRTStrawStatusSummarySvc

        # Services which only run on raw data
        if (globalflags.InputFormat() == 'bytestream'
                and globalflags.DataSource() == 'data'):

            # Hardware Mapping Service
            from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_HWMappingSvc
            InDetTRT_HWMappingSvc = TRT_HWMappingSvc(
                name=self.instanceName("InDetTRT_HWMappingSvc"))
            ServiceMgr += InDetTRT_HWMappingSvc
            if self._print:
                print InDetTRT_HWMappingSvc

            # DCS Conditions Service
            if self.useDCS and not self.onlineMode:
                from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_DCS_ConditionsSvc
                InDetTRT_DCS_ConditionsSvc = TRT_DCS_ConditionsSvc(
                    name=self.instanceName("InDetTRT_DCS_ConditionsSvc"),
                    HWMapSvc=InDetTRT_HWMappingSvc,
                    #OutputLevel = VERBOSE,
                    EventInfoKey="ByteStreamEventInfo",
                    DoIOVChecking=True,
                    IOVmaxLength=7 * 24 * 60 * 60,
                    #FallBackOnCOOLChanName = False,
                )
                ServiceMgr += InDetTRT_DCS_ConditionsSvc
                if self._print:
                    print InDetTRT_DCS_ConditionsSvc
                InDetTRTConditionsServices.append(InDetTRT_DCS_ConditionsSvc)

        # TRT Conditions Summary Service
        from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_ConditionsSummarySvc
        InDetTRTConditionsSummaryService = TRT_ConditionsSummarySvc(
            name=self.instanceName("InDetTRTConditionsSummaryService"),
            ServiceList=InDetTRTConditionsServices,
        )
        ServiceMgr += InDetTRTConditionsSummaryService
        if self._print:
            print InDetTRTConditionsSummaryService

        from TRT_RecoConditionsServices.TRT_RecoConditionsServicesConf import TRT_ActiveFractionSvc
        InDetTRT_ActiveFractionSvc = TRT_ActiveFractionSvc(
            name=self.instanceName("InDetTRTActiveFractionSvc"),
            #missing link to TRTSummarySvc
        )
        ServiceMgr += InDetTRT_ActiveFractionSvc
Beispiel #17
0
def createOutputStream(streamName,
                       fileName="",
                       asAlg=False,
                       noTag=False,
                       eventInfoKey="EventInfo",
                       decisionFilter="",
                       trigNavThinningSvc=None):
    if trigNavThinningSvc is None:
        trigNavThinningSvc = _trigNavThinningSvcs.get(streamName, None)

    # define athena output stream
    writingTool = AthenaOutputStreamTool(streamName + "Tool")
    outputStream = AthenaOutputStream(streamName,
                                      WritingTool=writingTool,
                                      ItemList=["EventInfo#*"])
    #outputStream.ItemList += [ "xAOD::EventInfo#*" ]
    outputStream.MetadataStore = svcMgr.MetaDataStore
    outputStream.MetadataItemList = [
        "EventStreamInfo#" + streamName, "IOVMetaDataContainer#*"
    ]

    ## get a handle on the default top-level algorithm sequence
    from AthenaCommon.AlgSequence import AlgSequence
    topSequence = AlgSequence()
    from AthenaCommon.AlgSequence import AthSequencer
    outSequence = AthSequencer("AthOutSeq")

    doTag = not noTag
    if doTag:
        if ('EventInfoTagBuilder/EventInfoTagBuilder'
                not in topSequence.getProperties()['Members']):
            key = "SimpleTag"
            # Tell tool to pick it up
            outputStream.WritingTool.AttributeListKey = key
            # build eventinfo attribute list
            from .OutputStreamAthenaPoolConf import EventInfoAttListTool, EventInfoTagBuilder
            EventInfoTagBuilder = EventInfoTagBuilder(
                AttributeList=key,
                EventInfoKey=eventInfoKey,
                FilterString=decisionFilter)
            from AthenaCommon.GlobalFlags import globalflags
            if globalflags.InputFormat() == 'bytestream':
                #No event-tag input in bytestream
                EventInfoTagBuilder.PropagateInput = False
            topSequence += EventInfoTagBuilder

    # decide where to put outputstream in sequencing
    if asAlg:
        outSequence += outputStream
    else:
        outSequence += outputStream

    if fileName != "":
        outputStream.OutputFile = fileName
        from .OutputStreamAthenaPoolConf import MakeEventStreamInfo
        streamInfoTool = MakeEventStreamInfo(streamName +
                                             "_MakeEventStreamInfo")
        streamInfoTool.Key = streamName
        streamInfoTool.EventInfoKey = eventInfoKey
        outputStream.HelperTools = [streamInfoTool]

    # Support for MT thinning.
    from AthenaServices.AthenaServicesConf import Athena__ThinningCacheTool
    tct = Athena__ThinningCacheTool('ThinningCacheTool_' + streamName,
                                    StreamName=streamName)
    if trigNavThinningSvc is not None:
        tct.TrigNavigationThinningSvc = trigNavThinningSvc
    outputStream.HelperTools += [tct]

    # Set the list of transient items based on what we know is in the transient
    # store.  The output algorithm will then declare input dependencies
    # for objects which are both listed here and in the ItemList.
    # (We do it like this because ItemList is typically configured to include
    # everything which might possibly be output.  If this gets cleaned up,
    # then we can remove this.)
    # Some builds don't include RecExConfig, so don't crash in that case.
    # FIXME: Rather than using ObjKeyStore, we could scan all algorithms
    # and look for write handles.
    try:
        tlist = []
        from RecExConfig.ObjKeyStore import objKeyStore
        for typ, klist in objKeyStore['transient'].getProperties().items():
            for k in klist:
                tlist.append(typ + '#' + k)
        outputStream.TransientItems += tlist
    except ImportError:
        pass

    return outputStream
    globalflags.DataSource = 'data'

#--------------------------------------------------------------
# Detector Set Up
#-------------------------------------------------------------

from RecExConfig.RecFlags import rec
rec.Commissioning = False
rec.doESD.set_Value_and_Lock(True)
rec.doInDet.set_Value_and_Lock(True)
rec.doEgamma.set_Value_and_Lock(False)
rec.doWriteESD.set_Value_and_Lock(False)  ## write out ESDs
rec.doJiveXML.set_Value_and_Lock(False)  ## for ATLANTIS
readESD = True
readRDO = False
if globalflags.InputFormat() == 'bytestream':
    readESD = False
elif globalflags.InputFormat() == 'pool' and globalflags.DataSource(
) == 'geant4':
    redESD = False
    redRDO = True

rec.readESD = readESD
rec.readRDO = readRDO

from AthenaCommon.DetFlags import DetFlags
# --- switch on Detector bits
DetFlags.ID_setOn()
#DetFlags.makeRIO.pixel_setOff()
#DetFlags.makeRIO.SCT_setOff()
#DetFlags.makeRIO.TRT_setOff()
Beispiel #19
0
    def configure(self):
        from AthenaCommon.Logging import logging
        mlog = logging.getLogger('CaloCellGetter::configure:')
        mlog.info('entering')

        doStandardCellReconstruction = True
        from CaloRec.CaloCellFlags import jobproperties
        from AthenaCommon.AppMgr import ToolSvc

        if not jobproperties.CaloCellFlags.doFastCaloSim.statusOn:
            doFastCaloSim = False
            mlog.info("doFastCaloSim not set, so not using it")
        else:
            doFastCaloSim = jobproperties.CaloCellFlags.doFastCaloSim()
            if doFastCaloSim:
                mlog.info("doFastCaloSim requested")
                doStandardCellReconstruction = False
                if jobproperties.CaloCellFlags.doFastCaloSimAddCells():
                    doStandardCellReconstruction = True
                    mlog.info(
                        "doFastCaloSimAddCells requested: FastCaloSim is added to fullsim calorimeter"
                    )
                else:
                    mlog.info(
                        "doFastCaloSimAddCells not requested: Stand alone FastCaloSim is running"
                    )
            else:
                mlog.info("doFastCaloSim explicitly not requested")

        # get handle to upstream object
        # handle tile

        if doStandardCellReconstruction:
            from LArROD.LArRODFlags import larRODFlags
            from AthenaCommon.GlobalFlags import globalflags
            if larRODFlags.readDigits() and globalflags.DataSource() == 'data':
                from LArROD.LArRawChannelBuilderDefault import LArRawChannelBuilderDefault
                LArRawChannelBuilderDefault()

        # writing of thinned digits
        if jobproperties.CaloCellFlags.doLArThinnedDigits.statusOn and jobproperties.CaloCellFlags.doLArThinnedDigits(
        ):
            from AthenaCommon.GlobalFlags import globalflags
            if globalflags.DataSource() == 'data':
                try:
                    from LArROD.LArDigits import DefaultLArDigitThinner
                    LArDigitThinner = DefaultLArDigitThinner(
                        'LArDigitThinner'
                    )  # automatically added to topSequence
                    LArDigitThinner.InputContainerName = "FREE"
                    LArDigitThinner.OutputContainerName = "LArDigitContainer_Thinned"
                except Exception:
                    treatException("Problem with LArDigitThinner ")

        # now configure the algorithm, part of this could be done in a separate class
        # cannot have same name
        try:
            from CaloRec.CaloRecConf import CaloCellMaker
        except Exception:
            mlog.error("could not import CaloRec.CaloCellMaker")
            print(traceback.format_exc())
            return False

        theCaloCellMaker = CaloCellMaker()
        self._CaloCellMakerHandle = theCaloCellMaker

        if doStandardCellReconstruction:
            # configure CaloCellMaker here
            # check LArCellMakerTool_jobOptions.py for full configurability
            # FIXME

            if rec.doLArg():
                from LArCabling.LArCablingAccess import LArOnOffIdMapping
                LArOnOffIdMapping()

                try:
                    from LArCellRec.LArCellRecConf import LArCellBuilderFromLArRawChannelTool
                    theLArCellBuilder = LArCellBuilderFromLArRawChannelTool()
                except Exception:
                    mlog.error(
                        "could not get handle to LArCellBuilderFromLArRawChannel Quit"
                    )
                    print(traceback.format_exc())
                    return False

                if jobproperties.CaloCellFlags.doLArCreateMissingCells():
                    theLArCellBuilder.addDeadOTX = True

                # add the tool to list of tool ( should use ToolHandle eventually)
                theCaloCellMaker += theLArCellBuilder
                theCaloCellMaker.CaloCellMakerToolNames += [theLArCellBuilder]

            if rec.doTile():

                from AthenaCommon.GlobalFlags import globalflags
                if globalflags.DataSource(
                ) == 'data' and globalflags.InputFormat() == 'bytestream':
                    try:
                        svcMgr.ByteStreamCnvSvc.ROD2ROBmap = ["-1"]
                        if "TileDigitsContainer/TileDigitsCnt" not in svcMgr.ByteStreamAddressProviderSvc.TypeNames:
                            svcMgr.ByteStreamAddressProviderSvc.TypeNames += [
                                "TileBeamElemContainer/TileBeamElemCnt",
                                "TileDigitsContainer/TileDigitsCnt",
                                "TileL2Container/TileL2Cnt",
                                "TileLaserObject/TileLaserObj",
                                "TileMuonReceiverContainer/TileMuRcvCnt"
                            ]
                    except Exception:
                        mlog.warning(
                            "Cannot add TileDigitsContainer/TileDigitsCnt et al. to bytestream list"
                        )

                    # set options for TileRawChannelMaker
                    from TileRecUtils.TileRecFlags import jobproperties
                    jobproperties.TileRecFlags.TileRunType = 1  # physics run type

                    # reading of digits can be disabled before calling CaloCellGetter
                    # if this is not done, but digits are not available in BS file
                    # reading of digits is automatically disabled at start of run
                    if jobproperties.TileRecFlags.readDigits()                \
                        and not (jobproperties.TileRecFlags.doTileFlat        \
                                 or jobproperties.TileRecFlags.doTileFit      \
                                 or jobproperties.TileRecFlags.doTileFitCool  \
                                 or jobproperties.TileRecFlags.doTileOF1      \
                                 or jobproperties.TileRecFlags.doTileOpt2     \
                                 or jobproperties.TileRecFlags.doTileOptATLAS \
                                 or jobproperties.TileRecFlags.doTileMF):

                        from AthenaCommon.BeamFlags import jobproperties
                        # run Opt filter with iterations by default, both for cosmics and collisions before 2011
                        # run Opt filter without iterations for collisions in 2011 and later
                        if 'doTileOpt2' not in dir():
                            from RecExConfig.AutoConfiguration import GetRunNumber
                            rn = GetRunNumber()
                            if not athenaCommonFlags.isOnline(
                            ) and rn > 0 and rn < 171194:
                                doTileOpt2 = True
                            elif jobproperties.Beam.beamType() == 'collisions':
                                doTileOpt2 = False  # use OF without iterations for collisions
                            else:
                                doTileOpt2 = True  # always run OF with iterations for cosmics

                        # jobproperties.TileRecFlags.calibrateEnergy=True # use pCb for RawChannels
                        # please, note that time correction and best phase are used only for collisions
                        if doTileOpt2:
                            jobproperties.TileRecFlags.doTileOpt2 = True  # run optimal filter with iterations
                            jobproperties.TileRecFlags.doTileOptATLAS = False  # disable optimal filter without iterations
                            jobproperties.TileRecFlags.correctAmplitude = False  # don't do parabolic correction
                            if jobproperties.Beam.beamType() == 'collisions':
                                jobproperties.TileRecFlags.correctTime = True  # apply time correction in physics runs
                                jobproperties.TileRecFlags.BestPhaseFromCOOL = False  # best phase is not needed for iterations
                        else:
                            jobproperties.TileRecFlags.doTileOpt2 = False  # disable optimal filter with iterations
                            jobproperties.TileRecFlags.doTileOptATLAS = True  # run optimal filter without iterations
                            jobproperties.TileRecFlags.correctAmplitude = True  # apply parabolic correction
                            if jobproperties.Beam.beamType() == 'collisions':
                                jobproperties.TileRecFlags.correctTime = False  # don't need time correction if best phase is used
                                jobproperties.TileRecFlags.BestPhaseFromCOOL = True  # use best phase stored in DB

                    try:
                        from TileRecUtils.TileRawChannelGetter import TileRawChannelGetter
                        theTileRawChannelGetter = TileRawChannelGetter(
                        )  # noqa: F841
                    except Exception:
                        mlog.error("could not load TileRawChannelGetter Quit")
                        print(traceback.format_exc())
                        return False

                    try:
                        from TileRecAlgs.TileRecAlgsConf import TileDigitsFilter
                        from AthenaCommon.AlgSequence import AlgSequence
                        topSequence = AlgSequence()
                        topSequence += TileDigitsFilter()
                    except Exception:
                        mlog.error("Could not configure TileDigitsFilter")

                from AthenaCommon.AlgSequence import AthSequencer
                condSequence = AthSequencer("AthCondSeq")
                checkDCS = hasattr(condSequence, 'TileDCSCondAlg')
                try:
                    from TileRecUtils.TileRecUtilsConf import TileCellBuilder
                    theTileCellBuilder = TileCellBuilder(CheckDCS=checkDCS)
                    from TileRecUtils.TileRecFlags import jobproperties
                    theTileCellBuilder.TileRawChannelContainer = jobproperties.TileRecFlags.TileRawChannelContainer(
                    )

                    if (jobproperties.TileRecFlags.noiseFilter() == 1
                            and jobproperties.TileRecFlags.readDigits()
                            and globalflags.DataSource() == 'data'
                            and not globalflags.isOverlay()):
                        theTileCellBuilder.TileDSPRawChannelContainer = 'TileRawChannelCntCorrected'

                    rawChannelContainer = ''
                    if globalflags.DataSource(
                    ) == 'data' and globalflags.InputFormat() == 'bytestream':
                        if jobproperties.TileRecFlags.readDigits():
                            # everything is already corrected at RawChannel level
                            theTileCellBuilder.correctTime = False
                            theTileCellBuilder.correctAmplitude = False
                        else:
                            rawChannelContainer = 'TileRawChannelCnt'
                            # by default parameters are tuned for opt.filter without iterations
                            theTileCellBuilder.correctTime = jobproperties.TileRecFlags.correctTime(
                            )
                            theTileCellBuilder.correctAmplitude = jobproperties.TileRecFlags.correctAmplitude(
                            )
                            theTileCellBuilder.AmpMinForAmpCorrection = jobproperties.TileRecFlags.AmpMinForAmpCorrection(
                            )
                            if jobproperties.TileRecFlags.TimeMaxForAmpCorrection(
                            ) <= jobproperties.TileRecFlags.TimeMinForAmpCorrection(
                            ):
                                from AthenaCommon.BeamFlags import jobproperties
                                mlog.info(
                                    "adjusting min/max time of parabolic correction for %s",
                                    jobproperties.Beam.bunchSpacing)
                                halfBS = jobproperties.Beam.bunchSpacing.get_Value(
                                ) / 2.
                                jobproperties.TileRecFlags.TimeMinForAmpCorrection = -halfBS
                                jobproperties.TileRecFlags.TimeMaxForAmpCorrection = halfBS
                            if jobproperties.TileRecFlags.TimeMaxForAmpCorrection(
                            ) > jobproperties.TileRecFlags.TimeMinForAmpCorrection(
                            ):
                                theTileCellBuilder.TimeMinForAmpCorrection = jobproperties.TileRecFlags.TimeMinForAmpCorrection(
                                )
                                theTileCellBuilder.TimeMaxForAmpCorrection = jobproperties.TileRecFlags.TimeMaxForAmpCorrection(
                                )

                    theCaloCellMaker += theTileCellBuilder
                    theCaloCellMaker.CaloCellMakerToolNames += [
                        theTileCellBuilder
                    ]
                except Exception:
                    mlog.error("could not get handle to TileCellBuilder Quit")
                    print(traceback.format_exc())
                    return False

        if doFastCaloSim:
            mlog.info('configuring FastCaloSim here')

            try:
                from FastCaloSim.FastCaloSimConf import EmptyCellBuilderTool
                theEmptyCellBuilderTool = EmptyCellBuilderTool()
                theCaloCellMaker += theEmptyCellBuilderTool
                theCaloCellMaker.CaloCellMakerToolNames += [
                    theEmptyCellBuilderTool
                ]

                print(theEmptyCellBuilderTool)
                mlog.info("configure EmptyCellBuilderTool worked")
            except Exception:
                mlog.error("could not get handle to EmptyCellBuilderTool Quit")
                print(traceback.format_exc())
                return False

            try:
                from FastCaloSim.FastCaloSimFactory import FastCaloSimFactory
                theFastShowerCellBuilderTool = FastCaloSimFactory()

                theCaloCellMaker += theFastShowerCellBuilderTool
                theCaloCellMaker.CaloCellMakerToolNames += [
                    theFastShowerCellBuilderTool
                ]
                mlog.info("configure FastShowerCellBuilderTool worked")
            except Exception:
                mlog.error(
                    "could not get handle to FastShowerCellBuilderTool Quit")
                print(traceback.format_exc())
                return False

            doFastCaloSimNoise = jobproperties.CaloCellFlags.doFastCaloSimNoise(
            )
            if doFastCaloSimNoise:
                try:
                    from FastCaloSim.AddNoiseCellBuilderToolDefault import AddNoiseCellBuilderToolDefault
                    theAddNoiseCellBuilderTool = AddNoiseCellBuilderToolDefault(
                    )

                    print(theAddNoiseCellBuilderTool)

                    theCaloCellMaker += theAddNoiseCellBuilderTool
                    theCaloCellMaker.CaloCellMakerToolNames += [
                        theAddNoiseCellBuilderTool
                    ]
                    mlog.info("configure AddNoiseCellBuilderTool worked")
                except Exception:
                    mlog.error(
                        "could not get handle to AddNoiseCellBuilderTool Quit")
                    print(traceback.format_exc())
                    return False

        #
        # CaloCellContainerFinalizerTool : closing container and setting up iterators
        #

        from CaloRec.CaloRecConf import CaloCellContainerFinalizerTool
        theCaloCellContainerFinalizerTool = CaloCellContainerFinalizerTool()
        theCaloCellMaker += theCaloCellContainerFinalizerTool
        theCaloCellMaker.CaloCellMakerToolNames += [
            theCaloCellContainerFinalizerTool
        ]

        #
        # Mergeing of calo cellcontainer with sparse raw channel container with improved energies
        #

        doLArMerge = False
        if globalflags.DataSource(
        ) == 'data' and jobproperties.CaloCellFlags.doLArRawChannelMerge.statusOn and jobproperties.CaloCellFlags.doLArRawChannelMerge(
        ):
            from LArROD.LArRODFlags import larRODFlags
            if larRODFlags.readDigits() and larRODFlags.keepDSPRaw():
                doLArMerge = True
        if doLArMerge:
            try:
                from LArCellRec.LArCellRecConf import LArCellMerger
                theLArCellMerger = LArCellMerger()
            except Exception:
                mlog.error("could not get handle to LArCellMerge Quit")
                print(traceback.format_exc())
                return False
            theLArCellMerger.RawChannelsName = larRODFlags.RawChannelFromDigitsContainerName(
            )
            theCaloCellMaker += theLArCellMerger
            theCaloCellMaker.CaloCellMakerToolNames += [theLArCellMerger]

        #
        # masking of noisy and sporadic noisy cells in LAr
        #

        doNoiseMask = False
        if jobproperties.CaloCellFlags.doLArNoiseMasking.statusOn and jobproperties.CaloCellFlags.doLArNoiseMasking(
        ):
            doNoiseMask = True
        doSporadicMask = False
        if jobproperties.CaloCellFlags.doLArSporadicMasking.statusOn and jobproperties.CaloCellFlags.doLArSporadicMasking(
        ):
            doSporadicMask = True

        if doNoiseMask or doSporadicMask:
            try:
                from LArCellRec.LArCellRecConf import LArCellNoiseMaskingTool
                theLArCellNoiseMaskingTool = LArCellNoiseMaskingTool()
            except Exception:
                mlog.error(
                    "could not get handle to LArCellNoiseMaskingTool Quit")
                print(traceback.format_exc())
                return False

            if doSporadicMask:
                try:
                    from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
                    theLArSporadicNoiseMasker = LArBadChannelMasker(
                        "LArSporadicNoiseMasker")
                except Exception:
                    mlog.error("could not access bad channel tool Quit")
                    print(traceback.format_exc())
                    return False
                theLArSporadicNoiseMasker.DoMasking = True
                theLArSporadicNoiseMasker.ProblemsToMask = [
                    "sporadicBurstNoise"
                ]
                #ToolSvc += theLArSporadicNoiseMasker
                theLArCellNoiseMaskingTool.MaskingSporadicTool = theLArSporadicNoiseMasker

            if doNoiseMask:
                try:
                    from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
                    theLArNoiseMasker = LArBadChannelMasker("LArNoiseMasker")
                except Exception:
                    mlog.error("could not access bad channel tool Quit")
                    print(traceback.format_exc())
                    return False
                theLArNoiseMasker.DoMasking = True
                theLArNoiseMasker.ProblemsToMask = [
                    "highNoiseHG", "highNoiseMG", "highNoiseLG", "deadReadout",
                    "deadPhys"
                ]
                #ToolSvc+=theLArNoiseMasker
                theLArCellNoiseMaskingTool.MaskingTool = theLArNoiseMasker

            theLArCellNoiseMaskingTool.maskNoise = doNoiseMask
            theLArCellNoiseMaskingTool.maskSporadic = doSporadicMask
            # quality cut for sporadic noise masking
            theLArCellNoiseMaskingTool.qualityCut = 4000
            theCaloCellMaker += theLArCellNoiseMaskingTool
            theCaloCellMaker.CaloCellMakerToolNames += [
                theLArCellNoiseMaskingTool
            ]

        #
        #  masking of Feb problems
        #
        doBadFebMasking = False
        if jobproperties.CaloCellFlags.doLArBadFebMasking.statusOn and jobproperties.CaloCellFlags.doLArBadFebMasking(
        ):
            from AthenaCommon.GlobalFlags import globalflags
            if globalflags.DataSource() == 'data':
                doBadFebMasking = True

        if doBadFebMasking:
            try:
                from LArCellRec.LArCellRecConf import LArBadFebMaskingTool
                theLArBadFebMaskingTool = LArBadFebMaskingTool()
                if (
                        rec.doExpressProcessing()
                        or athenaCommonFlags.isOnline()
                ):  # In online or express processing, EventInfo::LArError is triggered if >=4 FEB with data corrupted
                    theLArBadFebMaskingTool.minFebInError = 4
            except Exception:
                mlog.error("could not get handle to LArBadFebMaskingTool Quit")
                print(traceback.format_exc())
                return False
            theCaloCellMaker += theLArBadFebMaskingTool

            theCaloCellMaker.CaloCellMakerToolNames += [
                theLArBadFebMaskingTool
            ]

        #
        #  emulate gain pathologies on MC
        #
        doGainPathology = False
        if jobproperties.CaloCellFlags.doLArCellGainPathology.statusOn and jobproperties.CaloCellFlags.doLArCellGainPathology(
        ):
            from AthenaCommon.GlobalFlags import globalflags
            if globalflags.DataSource() == 'geant4':
                doGainPathology = True

        if doGainPathology:
            try:
                from LArCellRec.LArCellRecConf import LArCellGainPathology
                theLArCellGainPathology = LArCellGainPathology()
            except Exception:
                mlog.error("could not get handle to LArCellGainPatholog< Quit")
                print(traceback.format_exc())
                return False
            theCaloCellMaker += theLArCellGainPathology

            theCaloCellMaker.CaloCellMakerToolNames += [
                theLArCellGainPathology
            ]

        # lar miscalibration if MC only  (should be done after finalisation)

        if not jobproperties.CaloCellFlags.doLArCellEmMisCalib.statusOn:
            # the flag has not been set, so decide a reasonable default
            # this is the old global flags should use the new one as
            # soon as monitoring does
            from AthenaCommon.GlobalFlags import globalflags
            if globalflags.DataSource() == 'data':
                doLArCellEmMisCalib = False
                mlog.info(
                    "jobproperties.CaloCellFlags.doLArMisCalib not set and real data: do not apply LArCellEmMisCalibTool"
                )
            else:
                doLArCellEmMisCalib = True
                mlog.info(
                    "jobproperties.CaloCellFlags.doLArMisCalib not set and Monte Carlo: apply LArCellEmMisCalibTool"
                )
        else:
            doLArCellEmMisCalib = jobproperties.CaloCellFlags.doLArCellEmMisCalib(
            )
            if doLArCellEmMisCalib:
                mlog.info("LArCellEmMisCalibTool requested")
            else:
                mlog.info("LArCellEmMisCalibTool explicitly not requested")

        if doLArCellEmMisCalib:
            try:
                from LArCellRec.LArCellRecConf import LArCellEmMiscalib
                theLArCellEmMiscalib = LArCellEmMiscalib("LArCellEmMiscalib")
            except Exception:
                mlog.error("could not get handle to LArCellEmMisCalib Quit")
                print(traceback.format_exc())
                return False

            # examples on how to change miscalibration. Default values are 0.005 and 0.007
            #        theLArCellEmMiscalib.SigmaPerRegion = 0.005
            #        theLArCellEmMiscalib.SigmaPerCell = 0.005

            try:
                from CaloRec.CaloRecConf import CaloCellContainerCorrectorTool
                from CaloIdentifier import SUBCALO
                theMisCalibTool = CaloCellContainerCorrectorTool(
                    "MisCalibTool",
                    CaloNums=[SUBCALO.LAREM],
                    CellCorrectionToolNames=[theLArCellEmMiscalib])
            except Exception:
                mlog.error("could not get handle to MisCalibTool Quit")
                print(traceback.format_exc())
                return False

            theCaloCellMaker += theMisCalibTool
            theCaloCellMaker.CaloCellMakerToolNames += [theMisCalibTool]

        #
        # Pedestal shift correction
        #
        doPedestalCorr = False
        if jobproperties.CaloCellFlags.doPedestalCorr.statusOn:
            from AthenaCommon.GlobalFlags import globalflags
            if jobproperties.CaloCellFlags.doPedestalCorr() and (
                    globalflags.DataSource() == 'data'
                    or jobproperties.CaloCellFlags.doPileupOffsetBCIDCorr):
                doPedestalCorr = True
                mlog.info("Apply cell level pedestal shift correction")

        if doPedestalCorr:
            try:
                from CaloCellCorrection.CaloCellPedestalCorrDefault import CaloCellPedestalCorrDefault
                theCaloCellPedestalCorr = CaloCellPedestalCorrDefault()
                theCaloCellMaker += theCaloCellPedestalCorr
                theCaloCellMaker.CaloCellMakerToolNames += [
                    theCaloCellPedestalCorr
                ]
            except Exception:
                mlog.error("could not get handle to CaloCellPedestalCorr")
                print(traceback.format_exc())

        #
        # HV correction for offline reprocessing, reading HV from Cool-DCS database
        #
        doHVCorr = False
        from AthenaCommon.DetFlags import DetFlags
        if DetFlags.dcs.LAr_on():
            if jobproperties.CaloCellFlags.doLArHVCorr.statusOn:
                from AthenaCommon.GlobalFlags import globalflags
                if jobproperties.CaloCellFlags.doLArHVCorr(
                ) and globalflags.DataSource() == 'data':
                    doHVCorr = True
                    mlog.info(
                        "Redoing HV correction at cell level from COOL/DCS database"
                    )

        if doHVCorr:
            from LArCellRec.LArCellRecConf import LArCellContHVCorrTool
            theLArCellHVCorrTool = LArCellContHVCorrTool()

            #theCaloCellMaker += theHVCorrTool
            theCaloCellMaker.CaloCellMakerToolNames += [theLArCellHVCorrTool]

        #
        # correction to undo online calibration and apply new LAr electronics calibration for ADC->MeV conversion
        #
        doLArRecalibration = False
        if jobproperties.CaloCellFlags.doLArRecalibration.statusOn:
            from AthenaCommon.GlobalFlags import globalflags
            from LArConditionsCommon.LArCondFlags import larCondFlags
            if jobproperties.CaloCellFlags.doLArRecalibration(
            ) and globalflags.DataSource() == 'data' and (
                    not larCondFlags.SingleVersion()):
                doLArRecalibration = True
                mlog.info("Redoing LAr electronics calibration for ADC->MeV")

        if doLArRecalibration:

            # get tool for cell recalibration
            try:
                from LArCellRec.LArCellRecConf import LArCellRecalibration
                theLArCellRecalibration = LArCellRecalibration(
                    "LArCellRecalibration")
            except Exception:
                mlog.error("could not get handle to LArCellRecalibration Quit")
                print(traceback.format_exc())
                return False

            # get new ADC2MeVTool
            try:
                from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault
                theLArADC2MeVToolDefault = LArADC2MeVToolDefault()
            except Exception:
                mlog.error(
                    "Could not get handle to LArADC2MeVToolDefault Quit")
                print(traceback.format_exc())
                return False
            ToolSvc += theLArADC2MeVToolDefault

            # get old  ADC2MeVTool
            try:
                from LArRecUtils.LArADC2MeVToolOnline import LArADC2MeVToolOnline
                theLArADC2MeVToolOnline = LArADC2MeVToolOnline()
            except Exception:
                mlog.error("Could not get handle to LArADC2MeVToolOnline Quit")
                print(traceback.format_exc())
                return False
            ToolSvc += theLArADC2MeVToolOnline

            theLArCellRecalibration.adc2MeVTool = theLArADC2MeVToolDefault
            theLArCellRecalibration.adc2MeVToolOnline = theLArADC2MeVToolOnline

            try:
                from CaloRec.CaloRecConf import CaloCellContainerCorrectorTool
                from CaloIdentifier import SUBCALO
                theLArRecalibrationTool = CaloCellContainerCorrectorTool(
                    "LArRecalibrationTool",
                    CaloNums=[SUBCALO.LAREM, SUBCALO.LARHEC, SUBCALO.LARFCAL],
                    CellCorrectionToolNames=[theLArCellRecalibration])
            except Exception:
                mlog.error("could not get handle to HVCorrTool Quit")
                print(traceback.format_exc())
                return False
            theCaloCellMaker += theLArRecalibrationTool
            theCaloCellMaker.CaloCellMakerToolNames += [
                theLArRecalibrationTool
            ]

        #
        # Correction for MinBias energy shift for MC pileup reco
        #
        doMinBiasAverage = False
        if jobproperties.CaloCellFlags.doMinBiasAverage.statusOn:
            from AthenaCommon.GlobalFlags import globalflags
            from AthenaCommon.BeamFlags import jobproperties
            if jobproperties.CaloCellFlags.doMinBiasAverage(
            ) and globalflags.DataSource() == 'geant4' and (
                    not jobproperties.Beam.zeroLuminosity()):
                doMinBiasAverage = True

        if doMinBiasAverage:

            try:
                from CaloTools.CaloMBAverageToolDefault import CaloMBAverageToolDefault
                theCaloMBAverageTool = CaloMBAverageToolDefault()
            except Exception:
                mlog.error("could not get handle to CaloMBAverageTool  Quit")
                print(traceback.format_exc())
                return False
            ToolSvc += theCaloMBAverageTool

            try:
                from CaloCellCorrection.CaloCellCorrectionConf import CaloCellMBAverageCorr
                theCaloCellMBAverageCorr = CaloCellMBAverageCorr(
                    "CaloCellMBAverageCorr")
                theCaloCellMBAverageCorr.CaloMBAverageTool = theCaloMBAverageTool
            except Exception:
                mlog.error(
                    "could not get handle to  CaloCellMBAverageCorr  Quit")
                print(traceback.format_exc())
                return False

            try:
                from CaloRec.CaloRecConf import CaloCellContainerCorrectorTool
                from CaloIdentifier import SUBCALO
                theMBAverageTool = CaloCellContainerCorrectorTool(
                    "MBAverageTool",
                    CaloNums=[SUBCALO.NSUBCALO],
                    CellCorrectionToolNames=[theCaloCellMBAverageCorr])
            except Exception:
                mlog.error(
                    "could not get handle to CaloCellContainerCorrectorTool/MBAverageTool Quit"
                )
                print(traceback.format_exc())
                return False

            theCaloCellMaker += theMBAverageTool
            theCaloCellMaker.CaloCellMakerToolNames += [theMBAverageTool]

        #
        # Correction for dead cells, where we average the energy density of neighbor cells
        #
        doNeighborsAverage = False
        if jobproperties.CaloCellFlags.doDeadCellCorr.statusOn:
            if jobproperties.CaloCellFlags.doDeadCellCorr():
                doNeighborsAverage = True

        if doNeighborsAverage:
            try:
                from CaloCellCorrection.CaloCellCorrectionConf import CaloCellNeighborsAverageCorr
                theCaloCellNeighborsAverageCorr = CaloCellNeighborsAverageCorr(
                    "CaloCellNeighborsAverageCorr")
                theCaloCellNeighborsAverageCorr.testMode = False
            except Exception:
                mlog.error(
                    "could not get handle to  CaloCellNeighborsAverageCorr  Quit"
                )
                print(traceback.format_exc())
                return False
            theCaloCellMaker += theCaloCellNeighborsAverageCorr
            theCaloCellMaker.CaloCellMakerToolNames += [
                theCaloCellNeighborsAverageCorr
            ]

        #
        # correction for missing Febs based on L1 readout
        doLArDeadOTXCorr = False
        if jobproperties.CaloCellFlags.doLArDeadOTXCorr.statusOn and jobproperties.CaloCellFlags.doLArCreateMissingCells.statusOn:
            if jobproperties.CaloCellFlags.doLArDeadOTXCorr(
            ) and jobproperties.CaloCellFlags.doLArCreateMissingCells(
            ) and doStandardCellReconstruction:
                if rec.doTrigger():
                    doLArDeadOTXCorr = True
                else:
                    if globalflags.DataSource.get_Value(
                    ) != 'geant4':  #warning only if not MC
                        mlog.warning(
                            "Trigger is switched off. Can't run deadOTX correction."
                        )

        if doLArDeadOTXCorr:

            try:
                from LArCellRec.LArCellDeadOTXCorrToolDefault import LArCellDeadOTXCorrToolDefault
                theLArCellDeadOTXCorr = LArCellDeadOTXCorrToolDefault()
            except Exception:
                mlog.error("could not get handle to LArCellDeadOTXCorr Quit")
                print(traceback.format_exc())

            theCaloCellMaker += theLArCellDeadOTXCorr
            theCaloCellMaker.CaloCellMakerToolNames += [theLArCellDeadOTXCorr]

        if jobproperties.CaloCellFlags.doCaloCellEnergyCorr(
        ) and globalflags.DataSource(
        ) == 'data' and not athenaCommonFlags.isOnline():

            try:
                from CaloCellCorrection.CaloCellCorrectionConf import CaloCellEnergyRescaler
                theCCERescalerTool = CaloCellEnergyRescaler()
                theCCERescalerTool.Folder = "/LAR/CellCorrOfl/EnergyCorr"
                from IOVDbSvc.CondDB import conddb
                # conddb.addFolder("","/LAR/CellCorrOfl/EnergyCorr<tag>EnergyScale-00</tag><db>sqlite://;schema=escale.db;dbname=COMP200</db>")
                conddb.addFolder("LAR_OFL",
                                 "/LAR/CellCorrOfl/EnergyCorr",
                                 className="AthenaAttributeList")
                theCaloCellMaker += theCCERescalerTool
                theCaloCellMaker.CaloCellMakerToolNames += [theCCERescalerTool]
            except Exception:
                mlog.error(
                    "could not get handle to CaloCellEnergyRescaler Quit")
                print(traceback.format_exc())
                return False
            pass

        if jobproperties.CaloCellFlags.doCaloCellTimeCorr(
        ) and globalflags.DataSource(
        ) == 'data' and not athenaCommonFlags.isOnline():
            try:
                from CaloCellCorrection.CaloCellCorrectionConf import CaloCellTimeCorrTool
                theLArTimeCorr = CaloCellTimeCorrTool()
                theLArTimeCorr.Folder = "/LAR/TimeCorrectionOfl/CellTimeOffset"
                from IOVDbSvc.CondDB import conddb
                # conddb.addFolder("","/LAR/TimeCorrectionOfl/CellTimeOffset<tag>LARTimeCorrectionOflCellTimeOffset-empty</tag><db>sqlite://;schema=timecorr.db;dbname=COMP200</db>")
                conddb.addFolder("LAR_OFL",
                                 "/LAR/TimeCorrectionOfl/CellTimeOffset",
                                 className="AthenaAttributeList")
                theCaloCellMaker.CaloCellMakerToolNames += [theLArTimeCorr]

            except Exception:
                mlog.error("could not get handle to CaloCellTimeCorrTool Quit")
                print(traceback.format_exc())
                return False

            pass

        # make lots of checks (should not be necessary eventually)
        # to print the check add:

        from CaloRec.CaloRecConf import CaloCellContainerCheckerTool
        theCaloCellContainerCheckerTool = CaloCellContainerCheckerTool()
        # FIXME
        # theCaloCellContainerCheckerTool.OutputLevel=DEBUG

        theCaloCellMaker += theCaloCellContainerCheckerTool
        theCaloCellMaker.CaloCellMakerToolNames += [
            theCaloCellContainerCheckerTool
        ]

        #

        # sets output key
        theCaloCellMaker.CaloCellsOutputName = self.outputKey()

        # register output in objKeyStore
        from RecExConfig.ObjKeyStore import objKeyStore
        objKeyStore.addStreamESD(self.outputType(), self.outputKey())

        # Also note that we produce it as a transient output.
        objKeyStore.addTransient(self.outputType(), self.outputKey())

        from TileRecUtils.TileDQstatusAlgDefault import TileDQstatusAlgDefault
        TileDQstatusAlgDefault(TileRawChannelContainer=rawChannelContainer)

        # now add algorithm to topSequence
        # this should always come at the end

        mlog.info(" now adding CaloCellMaker to topSequence")

        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        topSequence += theCaloCellMaker

        return True
Beispiel #20
0
# --- printout
DetFlags.Print()

# --- output level
OutputLevel = DEBUG

#--------------------------------------------------------------
# Load InDet configuration
#--------------------------------------------------------------

# --- setup InDetJobProperties
from AthenaCommon.GlobalFlags import globalflags
from InDetRecExample.InDetJobProperties import InDetFlags
InDetFlags.doTruth = (globalflags.DataSource == 'geant4'
                      and globalflags.InputFormat() == 'pool')
#InDetFlags.doTruth = False
#if globalflags.InputFormat() == 'pool' and not globalflags.DataSource == 'geant4':
# ---- run over ESD files
InDetFlags.preProcessing = True
InDetFlags.doPRDFormation = True
#else:
#  InDetFlags.doPRDFormation = True

# --- uncomment to change the default of one of the following options:
InDetFlags.doNewTracking = True
#InDetFlags.doLowPt                = True
#InDetFlags.doBeamGas              = True
#InDetFlags.doBeamHalo             = True
#if not Cosmics:
InDetFlags.doxKalman = False
Beispiel #21
0
    topSequence = AlgSequence()
    topSequence += AthenaMonManager("L1MonManager0A")
    L1Man0A = topSequence.L1MonManager0A
    topSequence += AthenaMonManager("L1MonManager0B")
    L1Man0B = topSequence.L1MonManager0B
    topSequence += AthenaMonManager("L1MonManager0C")
    L1Man0C = topSequence.L1MonManager0C
    topSequence += AthenaMonManager("L1MonManager1")
    L1Man1 = topSequence.L1MonManager1
    topSequence += AthenaMonManager("L1MonManager2")
    L1Man2 = topSequence.L1MonManager2

    ## get a handle on the ToolSvc
    #from AthenaCommon.AppMgr import ToolSvc

    if globalflags.InputFormat() == "bytestream":
        include("TrigT1CaloByteStream/ReadLVL1CaloBS_jobOptions.py")
        if not hasattr(svcMgr, "ByteStreamAddressProviderSvc"):
            from ByteStreamCnvSvcBase.ByteStreamCnvSvcBaseConf import ByteStreamAddressProviderSvc
            svcMgr += ByteStreamAddressProviderSvc()
        svcMgr.ByteStreamAddressProviderSvc.TypeNames += ["CTP_RDO/CTP_RDO"]

    if isData and isCalo and (Online or rec.triggerStream() == "express"
                              or rec.triggerStream() == "JetTauEtmiss"):

        ####################### Calorimeter -> L1Calo ################################
        include("CaloConditions/CaloConditions_jobOptions.py")
        include("LArDetDescr/LArDetDescr_joboptions.py")
        # CaloCells
        from TrigT1Monitoring.TrigT1MonitoringConf import LVL1__CalorimeterL1CaloMon
        CalorimeterL1CaloMonTool = LVL1__CalorimeterL1CaloMon(
Beispiel #22
0
    def createSvc(self):

        #
        # Load necessary conditions folders
        #

        # Calibration constants
        from IOVDbSvc.CondDB import conddb

        if not self._isMC:
            #only needed for data
            if not (conddb.folderRequested('/TRT/Onl/ROD/Compress')):
                conddb.addFolder("TRT_ONL",
                                 "/TRT/Onl/ROD/Compress",
                                 className='CondAttrListCollection')

        if not (conddb.folderRequested('/TRT/Calib/RT')
                or conddb.folderRequested('/TRT/Onl/Calib/RT')):
            conddb.addFolderSplitOnline(
                'TRT',
                '/TRT/Onl/Calib/RT',
                '/TRT/Calib/RT',
                className='TRTCond::RtRelationMultChanContainer')
        if not (conddb.folderRequested('/TRT/Calib/T0')
                or conddb.folderRequested('/TRT/Onl/Calib/T0')):
            conddb.addFolderSplitOnline(
                'TRT',
                '/TRT/Onl/Calib/T0',
                '/TRT/Calib/T0',
                className='TRTCond::StrawT0MultChanContainer')

        if not (conddb.folderRequested('/TRT/Calib/errors')
                or conddb.folderRequested('/TRT/Onl/Calib/errors')):
            conddb.addFolderSplitOnline(
                "TRT",
                "/TRT/Onl/Calib/errors",
                "/TRT/Calib/errors",
                className='TRTCond::RtRelationMultChanContainer')

        if not (conddb.folderRequested('/TRT/Calib/errors2d')
                or conddb.folderRequested('/TRT/Onl/Calib/errors2d')):
            conddb.addFolderSplitOnline(
                "TRT",
                "/TRT/Onl/Calib/errors2d",
                "/TRT/Calib/errors2d",
                className='TRTCond::RtRelationMultChanContainer')

        if not (conddb.folderRequested('/TRT/Calib/slopes')
                or conddb.folderRequested('/TRT/Onl/Calib/slopes')):
            conddb.addFolderSplitOnline(
                "TRT",
                "/TRT/Onl/Calib/slopes",
                "/TRT/Calib/slopes",
                className='TRTCond::RtRelationMultChanContainer')

        # Calibration DB Service
        from AthenaCommon.AppMgr import ServiceMgr

        # Dead/Noisy Straw Lists
        if not conddb.folderRequested('/TRT/Cond/Status'):
            conddb.addFolderSplitOnline(
                "TRT",
                "/TRT/Onl/Cond/Status",
                "/TRT/Cond/Status",
                className='TRTCond::StrawStatusMultChanContainer')
        if not conddb.folderRequested('/TRT/Cond/StatusPermanent'):
            conddb.addFolderSplitOnline(
                "TRT",
                "/TRT/Onl/Cond/StatusPermanent",
                "/TRT/Cond/StatusPermanent",
                className='TRTCond::StrawStatusMultChanContainer')

        # Argon straw list
        if not conddb.folderRequested('/TRT/Cond/StatusHT'):
            conddb.addFolderSplitOnline(
                "TRT",
                "/TRT/Onl/Cond/StatusHT",
                "/TRT/Cond/StatusHT",
                className='TRTCond::StrawStatusMultChanContainer')

        #these conditions were instantiated together with specific tools using them in InDetTrigRecLoadTools
        #now required for the condAlg
        if not (conddb.folderRequested("/TRT/Calib/PID_vector") or \
                conddb.folderRequested("/TRT/Onl/Calib/PID_vector")):
            conddb.addFolderSplitOnline("TRT",
                                        "/TRT/Onl/Calib/PID_vector",
                                        "/TRT/Calib/PID_vector",
                                        className='CondAttrListVec')
        if not (conddb.folderRequested("/TRT/Calib/ToT/ToTVectors") or \
                conddb.folderRequested("/TRT/Onl/Calib/ToT/ToTVectors")):
            conddb.addFolderSplitOnline("TRT",
                                        "/TRT/Onl/Calib/ToT/ToTVectors",
                                        "/TRT/Calib/ToT/ToTVectors",
                                        className='CondAttrListVec')
        if not (conddb.folderRequested("/TRT/Calib/ToT/ToTValue") or \
                conddb.folderRequested("/TRT/Onl/Calib/ToT/ToTValue")):
            conddb.addFolderSplitOnline("TRT",
                                        "/TRT/Onl/Calib/ToT/ToTValue",
                                        "/TRT/Calib/ToT/ToTValue",
                                        className='CondAttrListCollection')

        # Straw status tool (now private, cannot be passed by name)
        from InDetTrigRecExample.InDetTrigCommonTools import InDetTrigTRTStrawStatusSummaryTool

        # Alive straws algorithm
        from TRT_ConditionsAlgs.TRT_ConditionsAlgsConf import TRTStrawCondAlg
        TRTStrawCondAlg = TRTStrawCondAlg(
            name="TRTStrawCondAlg",
            TRTStrawStatusSummaryTool=InDetTrigTRTStrawStatusSummaryTool,
            isGEANT4=self._isMC)
        # Active Fraction algorithm
        from TRT_ConditionsAlgs.TRT_ConditionsAlgsConf import TRTActiveCondAlg
        TRTActiveCondAlg = TRTActiveCondAlg(
            name="TRTActiveCondAlg",
            TRTStrawStatusSummaryTool=InDetTrigTRTStrawStatusSummaryTool)

        # HT probability algorithm
        from TRT_ConditionsAlgs.TRT_ConditionsAlgsConf import TRTHTCondAlg
        TRTHTCondAlg = TRTHTCondAlg(name="TRTHTCondAlg")

        from TRT_ConditionsAlgs.TRT_ConditionsAlgsConf import TRTToTCondAlg
        TRTToTCondAlg = TRTToTCondAlg(name="TRTToTCondAlg")

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

        # Condition algorithms for straw conditions
        if not hasattr(condSeq, "TRTStrawCondAlg"):
            condSeq += TRTStrawCondAlg
        if not hasattr(condSeq, "TRTActiveCondAlg"):
            condSeq += TRTActiveCondAlg
        # Condition algorithms for Pid
        if not hasattr(condSeq, "TRTHTCondAlg"):
            condSeq += TRTHTCondAlg

        if not hasattr(condSeq, "TRTToTCondAlg"):
            condSeq += TRTToTCondAlg

        from AthenaCommon.GlobalFlags import globalflags

        #
        # Load and Configure TRT Conditions Services
        #
        InDetTRTConditionsServices = []

        # Services which only run on raw data
        if (globalflags.InputFormat() == 'bytestream'
                and globalflags.DataSource() == 'data'):

            # Hardware Mapping Service
            from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_HWMappingSvc
            InDetTRT_HWMappingSvc = TRT_HWMappingSvc(
                name=self.instanceName("InDetTRT_HWMappingSvc"))
            ServiceMgr += InDetTRT_HWMappingSvc
            if self._print:
                print(InDetTRT_HWMappingSvc)

            # DCS Conditions Service
            if self.useDCS and not self.onlineMode:
                from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_DCS_ConditionsSvc
                InDetTRT_DCS_ConditionsSvc = TRT_DCS_ConditionsSvc(
                    name=self.instanceName("InDetTRT_DCS_ConditionsSvc"),
                    HWMapSvc=InDetTRT_HWMappingSvc,
                    #OutputLevel = VERBOSE,
                    EventInfoKey="ByteStreamEventInfo",
                    DoIOVChecking=True,
                    IOVmaxLength=7 * 24 * 60 * 60,
                    #FallBackOnCOOLChanName = False,
                )
                ServiceMgr += InDetTRT_DCS_ConditionsSvc
                if self._print:
                    print(InDetTRT_DCS_ConditionsSvc)
                InDetTRTConditionsServices.append(InDetTRT_DCS_ConditionsSvc)

        # TRT Conditions Summary Service
        from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_ConditionsSummarySvc
        InDetTRTConditionsSummaryService = TRT_ConditionsSummarySvc(
            name=self.instanceName("InDetTRTConditionsSummaryService"),
            ServiceList=InDetTRTConditionsServices,
        )
        ServiceMgr += InDetTRTConditionsSummaryService
        if self._print:
            print(InDetTRTConditionsSummaryService)
Beispiel #23
0
#-- set that if using some ModuleOverlay maks
#
#conddb.iovdbsvc.Folders += [ "<dbConnection>impl=cool;techno=sqlite;schema=module_overlay.db;X:CONDBR2</dbConnection> /PIXEL/PixMapOverlay <tag>PixMapOverlay-Test-00</tag>" ]
#ServiceMgr.SpecialPixelMapSvc.ModuleOverlayFolder = "/PIXEL/PixMapOverlay"
#ServiceMgr.SpecialPixelMapSvc.ModuleOverlayKey = "PixMapOverlay"

from PixelConditionsServices.PixelConditionsServicesConf import PixelConditionsSummarySvc

ServiceMgr += PixelConditionsSummarySvc()
ServiceMgr.PixelConditionsSummarySvc.UseSpecialPixelMap = False
ServiceMgr.PixelConditionsSummarySvc.UseDCS = False
ServiceMgr.PixelConditionsSummarySvc.UseByteStream = True

## Input files

if globalflags.InputFormat() == 'pool':
    import AthenaPoolCnvSvc.ReadAthenaPool
    ServiceMgr.EventSelector.InputCollections = collection
    include("PixelByteStreamErrorsSvc_jobOptions.py")
elif globalflags.InputFormat() == 'bytestream':
    include("ByteStreamCnvSvc/BSEventStorageEventSelector_jobOptions.py")
    include("InDetRecExample/InDetReadBS_jobOptions.py")
    ServiceMgr.EventSelector.Input = collection

topSequence += NoiseMapBuilder

#
# include clusterization
#

if doClusterization: