Example #1
0
    def setUp(self):

        # trivial case without any nested sequences

        log.setLevel(DEBUG)

        dummyCfgFlags = AthConfigFlags()
        dummyCfgFlags.lock()

        def AlgsConf1(flags):
            acc = ComponentAccumulator()
            a1 = TestAlgo("Algo1")
            a2 = TestAlgo("Algo2")
            return acc, [a1, a2]

        def AlgsConf2(flags):
            acc = ComponentAccumulator()
            result, algs = AlgsConf1(flags)
            acc.merge(result)
            a = TestAlgo("Algo3")
            print("algo3 when created %s" % id(a))
            algs.append(a)
            return acc, algs

        acc = ComponentAccumulator()

        # top level algs
        acc1, algs = AlgsConf2(dummyCfgFlags)
        acc.merge(acc1)
        acc.addEventAlgo(algs)

        def AlgsConf3(flags):
            acc = ComponentAccumulator()
            na1 = TestAlgo("NestedAlgo1")
            return acc, na1

        def AlgsConf4(flags):
            acc, na1 = AlgsConf3(flags)
            NestedAlgo2 = TestAlgo("NestedAlgo2")
            NestedAlgo2.OutputLevel = 7
            return acc, na1, NestedAlgo2

        acc.addSequence(seqAND("Nest"))
        acc.addSequence(seqAND("subSequence1"), parentName="Nest")
        acc.addSequence(parOR("subSequence2"), parentName="Nest")

        acc.addSequence(seqAND("sub2Sequence1"), parentName="subSequence1")
        acc.addSequence(seqAND("sub3Sequence1"), parentName="subSequence1")
        acc.addSequence(seqAND("sub4Sequence1"), parentName="subSequence1")

        accNA1 = AlgsConf4(dummyCfgFlags)
        acc.merge(accNA1[0])
        acc.addEventAlgo(accNA1[1:], "sub2Sequence1")
        outf = open("testFile.pkl", "wb")
        acc.store(outf)
        outf.close()
        self.acc = acc
Example #2
0
"""

if __name__ == "__main__":

    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    from AthenaCommon.Configurable import Configurable
    Configurable.configurableRun3Behavior = 1
    from AthenaConfiguration.AllConfigFlags import ConfigFlags
    from AthenaConfiguration.TestDefaults import defaultTestFiles
    from AthenaCommon.Logging import log
    from AthenaCommon.Constants import DEBUG

    # test setup
    log.setLevel(DEBUG)

    ConfigFlags.Input.Files = defaultTestFiles.RDO
    ConfigFlags.Tile.RunType = 'PHY'
    ConfigFlags.lock()

    acc = ComponentAccumulator()

    from TileConditions.TileCondToolsTestConfig import TileCondToolsTestCfg
    acc.merge(TileCondToolsTestCfg(ConfigFlags))

    acc.printConfig(withDetails=True, summariseProps=True)

    print(acc.getService('IOVDbSvc'))
    acc.store(open('TileCondToolsOfflineMC.pkl', 'wb'))

    print('All OK')
Example #3
0
    acc.setPrivateTools( TileBadChanTool(name, TileBadChannels = badChannels) )

    return acc


if __name__ == "__main__":

    from AthenaCommon.Configurable import Configurable
    Configurable.configurableRun3Behavior = 1
    from AthenaConfiguration.AllConfigFlags import ConfigFlags
    from AthenaConfiguration.TestDefaults import defaultTestFiles
    from AthenaCommon.Logging import log
    from AthenaCommon.Constants import DEBUG
    
    # Test setup
    log.setLevel(DEBUG)

    ConfigFlags.Input.Files = defaultTestFiles.RAW
    ConfigFlags.lock()

    acc = ComponentAccumulator()

    badChanTool =  acc.popToolsAndMerge( TileBadChanToolCfg(ConfigFlags) )
    print(badChanTool)

    acc.printConfig(withDetails = True, summariseProps = True)
    print(acc.getService('IOVDbSvc'))
    acc.store( open('TileBadChannels.pkl','wb') )

    print('All OK')
Example #4
0
def MainServicesMiniCfg(loopMgr='AthenaEventLoopMgr',
                        masterSequence='AthAlgSeq'):
    #Mininmal basic config, just good enough for HelloWorld and alike
    cfg = ComponentAccumulator(masterSequence)
    cfg.setAsTopLevel()
    cfg.setAppProperty('TopAlg', ['AthSequencer/' + masterSequence])
    cfg.setAppProperty('MessageSvcType', 'MessageSvc')
    cfg.setAppProperty('EventLoop', loopMgr)
    cfg.setAppProperty('ExtSvcCreates', 'False')
    cfg.setAppProperty('JobOptionsSvcType', 'JobOptionsSvc')
    cfg.setAppProperty('JobOptionsType', 'NONE')
    cfg.setAppProperty('JobOptionsPostAction', '')
    cfg.setAppProperty('JobOptionsPreAction', '')
    cfg.setAppProperty('PrintAlgsSequence', True)
    return cfg
Example #5
0
    from AthenaConfiguration.AllConfigFlags import ConfigFlags
    from AthenaConfiguration.TestDefaults import defaultTestFiles
    from AthenaCommon.Logging import log
    from AthenaCommon.Constants import DEBUG

    # Test setup
    log.setLevel(DEBUG)

    ConfigFlags.Input.Files = defaultTestFiles.RAW
    ConfigFlags.Tile.RunType = 'PHY'
    ConfigFlags.Tile.NoiseFilter = 1
    ConfigFlags.lock()

    ConfigFlags.dump()

    acc = ComponentAccumulator()

    TileRawChannelBuilderFitFilter = CompFactory.TileRawChannelBuilderFitFilter
    rchBuilderFitAcc = TileRawChannelBuilderCfg(
        ConfigFlags,
        name='TileRawChannelBuilderFit',
        TileRawChannelBuilder=TileRawChannelBuilderFitFilter)
    print(acc.popToolsAndMerge(rchBuilderFitAcc))

    TileRawChannelBuilderOpt2Filter = CompFactory.TileRawChannelBuilderOpt2Filter
    rchBuilderOpt2Acc = TileRawChannelBuilderCfg(
        ConfigFlags,
        name='TileRawChannelBuilderOpt2',
        TileRawChannelBuilder=TileRawChannelBuilderOpt2Filter)
    print(acc.popToolsAndMerge(rchBuilderOpt2Acc))
Example #6
0
def MagneticFieldSvcCfg(flags, **kwargs):
    result = ComponentAccumulator()

    # initialise required conditions DB folders
    from IOVDbSvc.IOVDbSvcConfig import addFolders

    if flags.Input.isMC:
        db = 'GLOBAL_OFL'
    else:
        db = 'GLOBAL'

    result.merge(
        addFolders(flags, ['/GLOBAL/BField/Maps <noover/>'],
                   detDb=db,
                   className="CondAttrListCollection"))

    if not flags.Common.isOnline:
        result.merge(
            addFolders(flags, ['/EXT/DCS/MAGNETS/SENSORDATA'],
                       detDb='DCS_OFL',
                       className="CondAttrListCollection"))

    # AtlasFieldSvc - old one
    afsArgs = {
        "name": "AtlasFieldSvc",
    }
    if flags.Common.isOnline:
        afsArgs.update(UseDCS=False)
        afsArgs.update(UseSoleCurrent=7730)
        afsArgs.update(UseToroCurrent=20400)
    else:
        afsArgs.update(UseDCS=True)
    if 'UseDCS' in kwargs:
        afsArgs['UseDCS'] = kwargs['UseDCS']
    mag_field_svc = CompFactory.MagField.AtlasFieldSvc(**afsArgs)
    result.addService(mag_field_svc, primary=True)

    # AtlasFieldMapCondAlg - for reading in map
    afmArgs = {
        "name": "AtlasFieldMapCondAlg",
    }
    if flags.Common.isOnline:
        # online has the map loaded at start
        afmArgs.update(LoadMapOnStart=True)

    # UseMapsFromCOOL is default for standard running
    afmArgs.update(UseMapsFromCOOL=True)
    # However, for tests, this must be turned off. It is detected
    # when UseDCS is set to False - UseDCS is directly an option for the field cache alg
    if 'UseDCS' in kwargs and not kwargs['UseDCS']:
        afmArgs['UseMapsFromCOOL'] = False
    mag_field_map_cond_alg = CompFactory.MagField.AtlasFieldMapCondAlg(
        **afmArgs)
    result.addCondAlgo(mag_field_map_cond_alg)

    # AtlasFieldCacheCondAlg - for reading in current
    afcArgs = {
        "name": "AtlasFieldCacheCondAlg",
    }
    if flags.Common.isOnline:
        afcArgs.update(UseDCS=False)
        afcArgs.update(UseSoleCurrent=7730)
        afcArgs.update(UseToroCurrent=20400)
        afcArgs.update(LockMapCurrents=True)
    else:
        afcArgs.update(UseDCS=True)
    # For test, UseDCS is set to False
    if 'UseDCS' in kwargs:
        afcArgs['UseDCS'] = kwargs['UseDCS']
    mag_field_cache_cond_alg = CompFactory.MagField.AtlasFieldCacheCondAlg(
        **afcArgs)
    result.addCondAlgo(mag_field_cache_cond_alg)

    return result
Example #7
0
    Configurable.configurableRun3Behavior = 1

    #import config flags
    from AthenaConfiguration.AllConfigFlags import ConfigFlags
    ConfigFlags.Sim.ISFRun = True

    #Provide input
    from AthenaConfiguration.TestDefaults import defaultTestFiles
    inputDir = defaultTestFiles.d
    ConfigFlags.Input.Files = defaultTestFiles.EVNT

    # Finalize
    ConfigFlags.lock()

    ## Initialize a new component accumulator
    cfg = ComponentAccumulator()

    from BCM_G4_SD.BCM_G4_SDToolConfig import BCMSensorSDCfg

    acc, tool = BCMSensorSDCfg(ConfigFlags)
    acc.addPublicTool(tool)
    cfg.merge(acc)

    cfg.printConfig(withDetails=True, summariseProps=True)
    ConfigFlags.dump()

    f = open("test.pkl", "wb")
    cfg.store(f)
    f.close()

    print(cfg._publicTools)
Example #8
0
    def runTest(self):
        ca = ComponentAccumulator()
        ca.addEventAlgo(TestAlgo("alg1"))

        self.assertEqual(len(ca.getEventAlgos()), 1, "Found single alg")
        # no idea why this assersts do not recognise exceptions
        #        self.assertRaises(ConfigurationError, ca.getEventAlgo("alg2"))

        ca.addEventAlgo(TestAlgo("alg2"))

        self.assertIsNotNone(ca.getEventAlgo("alg2"), "Found single alg")
        self.assertEqual(len(ca.getEventAlgos()), 2, "Found single alg")
        #       self.assertRaises(ConfigurationError, ca.getEventAlgo(), "Single Alg API ambiguity")

        ca.addPublicTool(dummyTool(name="tool1"))
        self.assertIsNotNone(ca.getPublicTool(), "Found single tool")
        ca.addPublicTool(dummyTool(name="tool2"))
Example #9
0
    def runTest(self):
        IOVDbSvc = CompFactory.IOVDbSvc  #Test de-duplicating folder-list
        result1 = ComponentAccumulator()
        result1.addService(IOVDbSvc(Folders=["/foo"]))
        result1.wasMerged()

        result2 = ComponentAccumulator()
        result2.addService(IOVDbSvc(Folders=["/bar"]))
        result2.merge(result1)

        self.assertIn("/bar", result2.getService("IOVDbSvc").Folders)
        self.assertIn("/foo", result2.getService("IOVDbSvc").Folders)

        #The merge should be also updated the result1
        self.assertIn("/bar", result1.getService("IOVDbSvc").Folders)
        self.assertIn("/foo", result1.getService("IOVDbSvc").Folders)

        svc3 = IOVDbSvc(Folders=["/barrr"])
        result2.addService(svc3)
        self.assertIn("/foo", svc3.Folders)
        self.assertIn("/barrr", result2.getService("IOVDbSvc").Folders)

        #The IOVDbSvc in the componentAccumulator is the same instance than the one we have here
        #Modifying svc3 touches also the ComponentAccumulator
        svc3.Folders += ["/fooo"]
        self.assertIn("/fooo", result2.getService("IOVDbSvc").Folders)

        result2.wasMerged()

        #Trickier case: Recursive de-duplication of properties of tools in a Tool-handle array
        result3 = ComponentAccumulator()
        result3.addService(
            dummyService(
                "dummyService",
                AString="bla",
                AList=["l1", "l2"],
                SomeTools=[
                    dummyTool("tool1", BList=["lt1", "lt2"]),
                ],
            ))

        #Exactly the same again:
        result3.addService(
            dummyService(
                "dummyService",
                AString="bla",
                AList=["l1", "l2"],
                SomeTools=[
                    dummyTool("tool1", BList=["lt1", "lt2"]),
                ],
            ))

        self.assertEqual(len(result3._services),
                         1)  #Verify that we have only one service

        #Add a service with a different name
        result3.addService(
            dummyService(
                "NewService",
                AString="blabla",
                AList=["new1", "new2"],
                OneTool=dummyTool("tool2"),
                SomeTools=[
                    dummyTool("tool1"),
                ],
            ))

        self.assertEqual(len(result3._services), 2)

        #Add the same service again, with a sightly differently configured private tool:
        result3.addService(
            dummyService(
                AString="bla",
                AList=["l1", "l3"],
                SomeTools=[
                    dummyTool("tool1", BList=["lt3", "lt4"]),
                ],
            ))
        # TODO revistit how this can be tested in "python" service implementations
        self.assertEqual(len(result3.getService("dummyService").SomeTools), 1)
        #self.assertEqual(set(result3.getService("dummyService").SomeTools[0].BList),set(["lt1","lt2","lt3","lt4"]))
        #self.assertEqual(set(result3.getService("dummyService").AList),set(["l1","l2","l3"]))

        #with  self.assertRaises(DeduplicationFailed):
        #    result3.addService(dummyService("dummyService", AString="blaOther"))

        [ca.wasMerged() for ca in [result1, result2, result3]]
Example #10
0
 def badMerge():
     someCA = ComponentAccumulator()
     topCA.merge((someCA, 1, "hello"))
Example #11
0
    def runTest(self):
        destinationCA = ComponentAccumulator()
        destinationCA.addSequence(seqAND("dest"))

        sourceCA = ComponentAccumulator()
        sourceCA.addEventAlgo(TestAlgo("alg1"))
        sourceCA.addEventAlgo(TestAlgo("alg2"))
        sourceCA.addSequence(seqAND("innerSeq"))
        sourceCA.addEventAlgo(TestAlgo("alg3"), sequenceName="innerSeq")

        destinationCA.merge(sourceCA, sequenceName="dest")

        #destinationCA.merge( sourceCA )
        self.assertIsNotNone(
            findAlgorithm(destinationCA.getSequence("dest"), "alg1"),
            "Algorithm not placed in sub-sequence")
        self.assertIsNotNone(
            findSubSequence(destinationCA.getSequence(), "innerSeq"),
            "The sequence is not added")
        self.assertIsNotNone(
            findAlgorithm(destinationCA.getSequence("dest"), "alg3"),
            "Algorithm deep in thesource CA not placed in sub-sequence of destiantion CA"
        )
        destinationCA.wasMerged()
        sourceCA.wasMerged()
Example #12
0
 def AlgsConf1(flags):
     acc = ComponentAccumulator()
     a1 = TestAlgo("Algo1")
     a2 = TestAlgo("Algo2")
     return acc, [a1, a2]
Example #13
0
        def selfMergedGrandParentSequence():
            from AthenaCommon.CFElements import seqAND
            acc1 = ComponentAccumulator()
            acc1.wasMerged()
            acc1.addSequence(seqAND("seq1"))

            acc2 = ComponentAccumulator()
            acc2.wasMerged()
            acc2.addSequence(seqAND("seq2"))
            acc2.addSequence(seqAND("seq1"), parentName="seq2")
            acc1.merge(acc2, sequenceName="seq1")
Example #14
0
 def selfTwinSequence():
     from AthenaCommon.CFElements import seqAND
     accTop = ComponentAccumulator()
     accTop.wasMerged()
     seq1 = seqAND("seq1")
     seq2 = seqAND("seq2")
     seq2_again = seqAND("seq1")
     accTop.addSequence(seq1)
     accTop.addSequence(seq2, parentName="seq1")
     accTop.addSequence(seq2_again, parentName="seq1")
     accTop.wasMerged()
Example #15
0
def IP3DTagCfg(flags,
               name='IP3DTag',
               PrimaryVertexCollectionName="",
               scheme='',
               useBTagFlagsDefaults=True,
               **options):
    """Sets up a IP3DTag tool and returns it.

    The following options have BTaggingFlags defaults:

    Runmodus                            default: BTagging.RunModus
    referenceType                       default: BTagging.ReferenceType
    impactParameterView                 default: "3D"
    trackGradePartitions                default: [ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ]
    RejectBadTracks                     default: False
    jetCollectionList                   default: BTaggingFlags.Jets
    unbiasIPEstimation                  default: False (switch to true (better!) when creating new PDFs)
    SecVxFinderName                     default: "SV1"
    UseCHypo                            default: True

    input:             name: The name of the tool (should be unique).
          useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified.
                  **options: Python dictionary with options for the tool.
    output: The actual tool."""
    acc = ComponentAccumulator()
    options['name'] = name
    options['xAODBaseName'] = 'IP3D'
    options['trackAssociationName'] = 'BTagTrackToJetAssociator'

    if useBTagFlagsDefaults:
        trackToVertexIPEstimator = acc.popToolsAndMerge(
            BTagTrackToVertexIPEstimatorCfg(flags, 'TrkToVxIPEstimator'))
        svForIPTool = acc.popToolsAndMerge(SVForIPToolCfg('SVForIPTool'))
        trackGradeFactory = acc.popToolsAndMerge(
            IPDetailedTrackGradeFactoryCfg('IP3DDetailedTrackGradeFactory'))
        trackSelectorTool = acc.popToolsAndMerge(
            IPTrackSelectorCfg(flags, 'IP3DTrackSelector'))
        likelihood = acc.popToolsAndMerge(
            NewLikelihoodToolCfg(flags, 'IP3DNewLikelihoodTool', 'IP3D',
                                 scheme))
        inDetTrackSelectionTool = acc.popToolsAndMerge(
            InDetTrackSelectorCfg('InDetTrackSelector'))
        trackVertexAssociationTool = acc.popToolsAndMerge(
            SpecialTrackAssociatorCfg('SpecialTrackAssociator',
                                      PrimaryVertexCollectionName))

        defaults = {
            'Runmodus': flags.BTagging.RunModus,
            'referenceType': flags.BTagging.ReferenceType,
            'jetPtMinRef': flags.BTagging.JetPtMinRef,
            'impactParameterView': '3D',
            'trackGradePartitions': flags.BTagging.Grades,
            'RejectBadTracks': True,
            'jetCollectionList': [],  #used only in reference mode
            'unbiasIPEstimation': False,
            'UseCHypo': True,
            'SecVxFinderName': 'SV1',
            'storeTrackParticles': True,
            'storeTrackParameters': True,
            'storeIpValues': True,
            'LikelihoodTool': likelihood,
            'trackSelectorTool': trackSelectorTool,
            'SVForIPTool': svForIPTool,
            'trackGradeFactory': trackGradeFactory,
            'TrackToVertexIPEstimator': trackToVertexIPEstimator,
            'InDetTrackSelectionTool': inDetTrackSelectionTool,
            'TrackVertexAssociationTool': trackVertexAssociationTool,
        }
        for option in defaults:
            options.setdefault(option, defaults[option])
    acc.setPrivateTools(Analysis__IPTag(**options))

    return acc
Example #16
0
    def skip_test_algorithms_merging(self):
        class MergeableAlgorithm(TestAlgo):
            def __init__(self, name, **kwargs):
                super(TestAlgo, self).__init__(name)
                #self._jobOptName = name
                for n, v in kwargs.items():
                    setattr(self, n, v)

                self._set_attributes = kwargs.keys()

            def getValuedProperties(self):
                d = {}
                for attrib in self._set_attributes:
                    d[attrib] = getattr(self, attrib)
                return d

            def __eq__(self, rhs):
                if self is rhs:
                    return True
                if not rhs or not isinstance(
                        rhs, Configurable
                ) or self.getFullName() != rhs.getFullName():
                    return False
                for attr, value in self.getValuedProperties().items():
                    if getattr(rhs, attr) != value:
                        return False
                return True

            def __ne__(self, rhs):
                return not self.__eq__(rhs)

        ca = ComponentAccumulator()

        seq1 = seqAND("seq1")
        innerSeq1 = seqAND("innerSeq1")
        level2Seq1 = seqAND("level2Seq1")

        seq2 = seqAND("seq2")
        innerSeq2 = seqAND("innerSeq2")

        firstAlg = MergeableAlgorithm("alg1",
                                      InputMakerInputDecisions=["input1"])

        ca.addSequence(seq1)
        ca.addSequence(innerSeq1, parentName=seq1.name())
        ca.addSequence(level2Seq1, parentName=innerSeq1.name())
        ca.addEventAlgo(firstAlg, sequenceName=level2Seq1.name())

        ca.addSequence(seq2)
        ca.addSequence(innerSeq2, parentName=seq2.name())

        innerSeqCopy = seqAND("innerSeq2")
        level2SeqCopy = seqAND("level2Seq2")

        secondAlg = MergeableAlgorithm("alg1",
                                       InputMakerInputDecisions=["input2"])

        secondCa = ComponentAccumulator()
        secondCa.addSequence(innerSeqCopy)
        secondCa.addSequence(level2SeqCopy, parentName=innerSeqCopy.name())
        secondCa.addEventAlgo(secondAlg, sequenceName=level2SeqCopy.name())

        ca.merge(secondCa)

        foundAlgs = findAllAlgorithms(ca.getSequence(), 'alg1')

        self.assertEqual(len(foundAlgs), 2)

        self.assertEqual(set(foundAlgs[0].InputMakerInputDecisions),
                         {"input1", "input2"})
        self.assertEqual(set(foundAlgs[1].InputMakerInputDecisions),
                         {"input1", "input2"})

        ca.printConfig()
        ca.wasMerged()
Example #17
0
    return result


if __name__ == "__main__":
    # To run this, do e.g.
    # python ../athena/MagneticField/MagFieldServices/python/MagFieldServicesConfig.py
    from AthenaCommon.Configurable import Configurable
    Configurable.configurableRun3Behavior = 1

    from AthenaCommon.Logging import log
    from AthenaCommon.Constants import VERBOSE
    from AthenaConfiguration.AllConfigFlags import ConfigFlags

    log.setLevel(VERBOSE)
    from AthenaConfiguration.TestDefaults import defaultTestFiles

    ConfigFlags.Input.Files = defaultTestFiles.RAW
    ConfigFlags.Input.isMC = False
    ConfigFlags.lock()

    cfg = ComponentAccumulator()

    acc = MagneticFieldSvcCfg(ConfigFlags)
    log.verbose(acc.getPrimary())
    cfg.merge(acc)

    f = open("MagneticFieldSvc.pkl", "wb")
    cfg.store(f)
    f.close()
Example #18
0
 def AlgsConf3(flags):
     acc = ComponentAccumulator()
     na1 = TestAlgo("NestedAlgo1")
     return acc, na1
Example #19
0
def MuonReconstructionCfg(flags):
    # https://gitlab.cern.ch/atlas/athena/blob/master/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonStandalone.py
    result = ComponentAccumulator()
    result.merge(MuonSegmentFindingCfg(flags))
    result.merge(MuonTrackBuildingCfg(flags))
    return result
Example #20
0
    def skip_test_sequences_merging(self):
        from AthenaConfiguration.AllConfigFlags import ConfigFlags
        ConfigFlags.lock()
        from AthenaCommon.Logging import logging
        logging.getLogger('ComponentAccumulator').setLevel(DEBUG)

        print("ca1")
        ca1 = ComponentAccumulator()
        ca1.addEventAlgo(TestAlgo("alg1"))
        ca1.printConfig()
        ca1.addSequence(seqAND("someSequence"))

        print("ca2")
        from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
        ca2 = OutputStreamCfg(ConfigFlags,
                              "RDO",
                              ItemList=[
                                  "SCT_RDO_Container#SCT_RDOs",
                                  "InDetSimDataCollection#SCT_SDO_Map"
                              ])
        ca2.printConfig()

        print("after merge")
        ca1.merge(ca2)
        ca1.printConfig()

        self.assertEqual(len(ca1._allSequences), 2,
                         "Dangling sequences not maintained")

        print("Instantiating top CA")
        from AthenaConfiguration.MainServicesConfig import MainServicesCfg
        topca = MainServicesCfg(ConfigFlags)
        topca.printConfig()

        print("Merging to the top level CA")
        topca.merge(ca1)
        topca.printConfig()
        topca.wasMerged()
Example #21
0
    acc.setPrivateTools( TileCondToolIntegrator(name, TileIntegrator = integrator) )

    return acc


if __name__ == "__main__":

    from AthenaCommon.Configurable import Configurable
    Configurable.configurableRun3Behavior = 1
    from AthenaConfiguration.AllConfigFlags import ConfigFlags
    from AthenaConfiguration.TestDefaults import defaultTestFiles
    from AthenaCommon.Logging import log
    from AthenaCommon.Constants import DEBUG
    
    # Test setup
    log.setLevel(DEBUG)

    ConfigFlags.Input.Files = defaultTestFiles.RAW
    ConfigFlags.lock()

    acc = ComponentAccumulator()

    integratorTool = acc.popToolsAndMerge( TileCondToolIntegratorCfg(ConfigFlags) )
    print(integratorTool)

    acc.printConfig(withDetails = True, summariseProps = True)
    print(acc.getService('IOVDbSvc'))
    acc.store( open('TileIntegrator.pkl','wb') )

    print('All OK')
Example #22
0
def TileMuonFitMonitoringConfig(flags, **kwargs):
    ''' Function to configure TileMuonFitMonitorAlgorithm algorithm in the monitoring system.'''

    # Define one top-level monitoring algorithm. The new configuration
    # framework uses a component accumulator.

    result = ComponentAccumulator()

    # The following class will make a sequence, configure algorithms, and link
    # them to GenericMonitoringTools
    from AthenaMonitoring import AthMonitorCfgHelper
    helper = AthMonitorCfgHelper(flags, 'TileMuonFitMonitoring')

    # Adding an TileMuonFitMonitorAlgorithm algorithm to the helper
    TileMuonFitMonitorAlgorithm = CompFactory.TileMuonFitMonitorAlgorithm
    tileMuonFitMonAlg = helper.addAlgorithm(TileMuonFitMonitorAlgorithm,
                                            'TileMuonFitMonAlg')

    tileMuonFitMonAlg.TriggerChain = ''

    # L1Trigger Type Bits:
    #     bit0_RNDM, bit1_ZeroBias, bit2_L1Cal, bit3_Muon,
    #     bit4_RPC, bit5_FTK, bit6_CTP, bit7_Calib, AnyPhysTrig
    kwargs.setdefault('fillHistogramsForL1Triggers',
                      ['AnyPhysTrig', 'bit7_Calib'])
    l1Triggers = kwargs['fillHistogramsForL1Triggers']

    for k, v in kwargs.items():
        setattr(tileMuonFitMonAlg, k, v)

    run = str(flags.Input.RunNumber[0])

    # 1) Configure histogram with TileMuonFitMonAlg algorithm execution time
    executeTimeGroup = helper.addGroup(tileMuonFitMonAlg,
                                       'TileMuonFitMonExecuteTime', 'Tile/')
    executeTimeGroup.defineHistogram(
        'TIME_execute',
        path='MuonFit',
        type='TH1F',
        title='Time for execute TileMuonFitMonAlg algorithm;time [#mus]',
        xbins=100,
        xmin=0,
        xmax=10000)

    from TileCalibBlobObjs.Classes import TileCalibUtils as Tile
    from TileMonitoring.TileMonitoringCfgHelper import addTile2DHistogramsArray

    # 2) Configure histograms with Tile MuonFit position at y=0
    addTile2DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitPosition',
        xvalue='zPosition',
        yvalue='xPosition',
        title='Tile MuonFit position at y=0;z [mm];x [mm]',
        path='Tile/MuonFit',
        xbins=69,
        xmin=-6900,
        xmax=6900.,
        ybins=44,
        ymin=-4400.,
        ymax=4400.,
        type='TH2D',
        run=run,
        triggers=l1Triggers)

    # 3) Configure histograms with Tile MuonFit sinus of the angle in the y-z plane vs position
    addTile2DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitPosDirectionTheta',
        xvalue='zPosition',
        yvalue='theta',
        path='Tile/MuonFit',
        title='Tile MuonFit vertical axis component;z [mm];sin(#theta)',
        xbins=49,
        xmin=-4900,
        xmax=4900.,
        ybins=50,
        ymin=-0.,
        ymax=1.,
        type='TH2D',
        run=run,
        triggers=l1Triggers)

    from TileMonitoring.TileMonitoringCfgHelper import addTile1DHistogramsArray

    # 4) Configure histograms with number of Tile MuonFits reconstructed
    addTile1DHistogramsArray(helper,
                             tileMuonFitMonAlg,
                             name='TileMuonFitNum',
                             xvalue='nMuons',
                             title='Number of Tile MuonFit reconstructed',
                             path='Tile/MuonFit',
                             xbins=10,
                             xmin=-0.5,
                             xmax=9.5,
                             type='TH1F',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False)

    # 5) Configure histograms with number of Tile cells per MuonFit track
    addTile1DHistogramsArray(helper,
                             tileMuonFitMonAlg,
                             name='TileMuonFitNCells',
                             xvalue='nCells',
                             title='Number of Tile cells per MuonFit track',
                             path='Tile/MuonFit',
                             xbins=10,
                             xmin=-0.5,
                             xmax=9.5,
                             type='TH1F',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False)

    # 6) Configure histograms with Tile MuonFit total energy
    addTile1DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitEnergy',
        xvalue='energy',
        title='Tile MuonFit total energy;Muon energy [MeV]',
        path='Tile/MuonFit',
        xbins=50,
        xmin=0.,
        xmax=10000.,
        type='TH1F',
        run=run,
        triggers=l1Triggers,
        perPartition=False)

    # 7) Configure histograms with Tile MuonFit time at y=0 plane
    addTile1DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitTime',
        xvalue='time',
        title='Tile MuonFit time at y=0 plane;Muon time [ns]',
        path='Tile/MuonFit',
        xbins=49,
        xmin=-73.5,
        xmax=73.5,
        type='TH1F',
        run=run,
        triggers=l1Triggers,
        perPartition=False)

    # 8) Configure histograms with Tile MuonFit path
    addTile1DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitPath',
        xvalue='path',
        title='Tile MuonFit total path length;Muon path length [mm]',
        path='Tile/MuonFit',
        xbins=50,
        xmin=0.,
        xmax=10000.,
        type='TH1F',
        run=run,
        triggers=l1Triggers,
        perPartition=False)

    # 9) Configure histograms with Tile MuonFit energy density
    addTile1DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitEneDensity',
        xvalue='eneDensity',
        title='Tile MuonFit energy density;Muon energy loss [MeV/mm]',
        path='Tile/MuonFit',
        xbins=50,
        xmin=0.,
        xmax=10.,
        type='TH1F',
        run=run,
        triggers=l1Triggers,
        perPartition=False)

    # 10) Configure histograms with Tile MuonFit sinus of the angle in the x-y plane
    addTile1DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitDirectionPhi',
        xvalue='phi',
        title='Tile MuonFit sinus of the angle in the x-y plane;sin(#phi)',
        path='Tile/MuonFit',
        xbins=100,
        xmin=-1.,
        xmax=1.,
        type='TH1F',
        run=run,
        triggers=l1Triggers,
        perPartition=False)

    # 11) Configure histograms with Tile MuonFit sinus of the angle in the y-z plane
    addTile1DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitDirectionTheta',
        xvalue='theta',
        title='Tile MuonFit sinus of the angle in the y-z plane;sin(#theta)',
        path='Tile/MuonFit',
        xbins=50,
        xmin=0.,
        xmax=1.,
        type='TH1F',
        run=run,
        triggers=l1Triggers,
        perPartition=False)

    # 12) Configure histograms with Tile MuonFit sinus of the angle in the y-z plane
    addTile1DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitPositionTime',
        xvalue='zPosition',
        value='time',
        title=
        'Tile MuonFit average time vs z position at y=0 plane;z [mm]; t [ns]',
        path='Tile/MuonFit',
        xbins=79,
        xmin=-7900.,
        xmax=7900.,
        type='TProfile',
        run=run,
        triggers=l1Triggers,
        perPartition=False)

    from TileMonitoring.TileMonitoringCfgHelper import getPartitionName

    # 13) Configure histograms with Tile MuonFit partition time
    partitionLabels = [getPartitionName(ros) for ros in range(1, Tile.MAX_ROS)]
    addTile1DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitPartitionTime',
        xvalue='partition',
        value='time',
        title='Tile MuonFit average time vs partition at y=0 plane;; t [ns]',
        path='Tile/MuonFit',
        xbins=Tile.MAX_ROS - 1,
        xmin=-0.5,
        xmax=Tile.MAX_ROS - 1.5,
        xlabels=partitionLabels,
        type='TProfile',
        run=run,
        triggers=l1Triggers,
        perPartition=False)

    accumalator = helper.result()
    result.merge(accumalator)
    return result
Example #23
0
def generateChains(flags, chainDict):

    firstStepName = getChainStepName('Photon', 1)
    stepReco, stepView = createStepView(firstStepName)

    accCalo = ComponentAccumulator()
    accCalo.addSequence(stepView)

    l2CaloReco = l2CaloRecoCfg(flags)
    accCalo.merge(l2CaloReco, sequenceName=stepReco.getName())

    # this alg needs EventInfo decorated with the  pileup info
    from LumiBlockComps.LumiBlockMuWriterConfig import LumiBlockMuWriterCfg
    accCalo.merge(LumiBlockMuWriterCfg(flags))

    l2CaloHypo = l2CaloHypoCfg(
        flags,
        name='L2PhotonCaloHypo',
        CaloClusters=recordable('HLT_FastCaloEMClusters'))

    accCalo.addEventAlgo(l2CaloHypo, sequenceName=stepView.getName())

    fastCaloSequence = CAMenuSequence(
        Sequence=l2CaloReco.sequence(),
        Maker=l2CaloReco.inputMaker(),
        Hypo=l2CaloHypo,
        HypoToolGen=TrigEgammaFastCaloHypoToolFromDict,
        CA=accCalo)

    fastCaloStep = ChainStep(firstStepName, [fastCaloSequence])

    secondStepName = getChainStepName('Photon', 2)
    stepReco, stepView = createStepView(secondStepName)

    accPhoton = ComponentAccumulator()
    accPhoton.addSequence(stepView)

    l2PhotonReco = l2PhotonRecoCfg(flags)
    accPhoton.merge(l2PhotonReco, sequenceName=stepReco.getName())

    l2PhotonHypo = l2PhotonHypoCfg(flags,
                                   Photons='HLT_FastPhotons',
                                   RunInView=True)

    accPhoton.addEventAlgo(l2PhotonHypo, sequenceName=stepView.getName())

    l2PhotonSequence = CAMenuSequence(
        Sequence=l2PhotonReco.sequence(),
        Maker=l2PhotonReco.inputMaker(),
        Hypo=l2PhotonHypo,
        HypoToolGen=TrigEgammaFastPhotonHypoToolFromDict,
        CA=accPhoton)

    l2PhotonStep = ChainStep(secondStepName, [l2PhotonSequence])

    l1Thresholds = []
    for part in chainDict['chainParts']:
        l1Thresholds.append(part['L1threshold'])

    log.debug('dictionary is: %s\n', pprint.pformat(chainDict))

    chain = Chain(chainDict['chainName'],
                  L1Thresholds=l1Thresholds,
                  ChainSteps=[fastCaloStep, l2PhotonStep])
    return chain
Example #24
0
def AtlasExtrapolatorCfg(flags, name='AtlasExtrapolator'):
    result = ComponentAccumulator()

    acc = MagneticFieldSvcCfg(flags)
    result.merge(acc)

    # get the correct TrackingGeometry setup
    from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg
    acc = TrackingGeometrySvcCfg(flags)
    geom_svc = acc.getPrimary()
    result.merge(acc)

    # PROPAGATOR DEFAULTS --------------------------------------------------------------------------------------

    AtlasPropagators = []

    RkPropagator = CompFactory.Trk.RungeKuttaPropagator
    AtlasRungeKuttaPropagator = RkPropagator(name='AtlasRungeKuttaPropagator')
    result.addPublicTool(AtlasRungeKuttaPropagator)  #TODO remove one day

    AtlasPropagators += [AtlasRungeKuttaPropagator]

    STEP_Propagator = CompFactory.Trk.STEP_Propagator
    AtlasSTEP_Propagator = STEP_Propagator(name='AtlasSTEP_Propagator')
    result.addPublicTool(AtlasSTEP_Propagator)  #TODO remove one day

    AtlasPropagators += [AtlasSTEP_Propagator]

    # UPDATOR DEFAULTS -----------------------------------------------------------------------------------------

    AtlasUpdators = []

    MaterialEffectsUpdator = CompFactory.Trk.MaterialEffectsUpdator
    AtlasMaterialEffectsUpdator = MaterialEffectsUpdator(
        name='AtlasMaterialEffectsUpdator')
    result.addPublicTool(AtlasMaterialEffectsUpdator)  #TODO remove one day

    AtlasUpdators += [AtlasMaterialEffectsUpdator]

    AtlasMaterialEffectsUpdatorLandau = MaterialEffectsUpdator(
        name='AtlasMaterialEffectsUpdatorLandau')
    AtlasMaterialEffectsUpdatorLandau.LandauMode = True
    result.addPublicTool(
        AtlasMaterialEffectsUpdatorLandau)  #TODO remove one day

    AtlasUpdators += [AtlasMaterialEffectsUpdatorLandau]

    # the UNIQUE NAVIGATOR ( === UNIQUE GEOMETRY) --------------------------------------------------------------
    Trk__Navigator = CompFactory.Trk.Navigator
    AtlasNavigator = Trk__Navigator(name='AtlasNavigator')
    AtlasNavigator.TrackingGeometrySvc = geom_svc
    result.addPublicTool(AtlasNavigator)  #TODO remove one day

    # CONFIGURE PROPAGATORS/UPDATORS ACCORDING TO GEOMETRY SIGNATURE

    AtlasSubPropagators = []
    AtlasSubUpdators = []

    # -------------------- set it depending on the geometry ----------------------------------------------------
    # default for Global is (Rk,Mat)
    AtlasSubPropagators += [AtlasRungeKuttaPropagator.name]
    AtlasSubUpdators += [AtlasMaterialEffectsUpdator.name]

    # default for ID is (Rk,Mat)
    AtlasSubPropagators += [AtlasRungeKuttaPropagator.name]
    AtlasSubUpdators += [AtlasMaterialEffectsUpdator.name]

    # default for BeamPipe is (STEP,Mat)
    AtlasSubPropagators += [AtlasSTEP_Propagator.name]
    AtlasSubUpdators += [AtlasMaterialEffectsUpdator.name]

    # default for Calo is (STEP,Mat)
    AtlasSubPropagators += [AtlasSTEP_Propagator.name]
    AtlasSubUpdators += [AtlasMaterialEffectsUpdator.name]

    # default for MS is (STEP,Mat)
    AtlasSubPropagators += [AtlasSTEP_Propagator.name]
    AtlasSubUpdators += [AtlasMaterialEffectsUpdator.name]

    # default for Cavern is (Rk,Mat)
    AtlasSubPropagators += [AtlasRungeKuttaPropagator.name]
    AtlasSubUpdators += [AtlasMaterialEffectsUpdator.name]

    # ----------------------------------------------------------------------------------------------------------

    # call the base class constructor
    Extrapolator = Trk__Extrapolator(name,\
                               Navigator = AtlasNavigator,\
                               MaterialEffectsUpdators = AtlasUpdators,\
                               Propagators = AtlasPropagators,\
                               SubPropagators = AtlasSubPropagators,\
                               SubMEUpdators = AtlasSubUpdators
                               )

    result.setPrivateTools(Extrapolator)

    return result
Example #25
0
def TileRawChannelBuilderCfg(flags, name, TileRawChannelBuilder, **kwargs):
    """Return component accumulator with configured private base Tile raw channel builder tool

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
        name -- name of Tile raw channel builder
        TileRawChannelbuilder -- concrete Tile raw channel builder tool.
    """

    acc = ComponentAccumulator()

    runType = flags.Tile.RunType
    runType = runType.upper()

    if runType not in _runTypes.keys():
        raise (Exception("Invalid Tile run type: %s" % runType))

    createContainer = (kwargs.get('TileRawChannelContainer', "") != "")

    if createContainer:
        from TileRecUtils.TileDQstatusConfig import TileDQstatusAlgCfg
        acc.merge(TileDQstatusAlgCfg(flags))
    else:
        kwargs['TileDQstatus'] = ""

    from TileConditions.TileInfoLoaderConfig import TileInfoLoaderCfg
    acc.merge(TileInfoLoaderCfg(flags))

    from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
    acc.merge(TileCablingSvcCfg(flags))

    kwargs['RunType'] = _runTypes[runType]
    kwargs['calibrateEnergy'] = False

    kwargs.setdefault('AmpMinForAmpCorrection',
                      flags.Tile.AmpMinForAmpCorrection)
    kwargs.setdefault('TimeMinForAmpCorrection',
                      flags.Tile.TimeMinForAmpCorrection)
    kwargs.setdefault('TimeMaxForAmpCorrection',
                      flags.Tile.TimeMaxForAmpCorrection)

    tileRawChannelContainerDSP = ""
    if flags.Tile.NoiseFilter == 1 and createContainer and 'NoiseFilterTools' not in kwargs:
        from TileRecUtils.TileRawChannelCorrectionConfig import TileRawChannelCorrectionToolsCfg
        correctionTools = acc.popToolsAndMerge(
            TileRawChannelCorrectionToolsCfg(flags))
        kwargs['NoiseFilterTools'] = correctionTools

        if not (flags.Input.isMC or flags.Overlay.DataOverlay):
            tileRawChannelContainerDSP = 'TileRawChannelCntCorrected'
            from TileRecUtils.TileRawChannelCorrectionConfig import TileRawChannelCorrectionAlgCfg
            acc.merge(TileRawChannelCorrectionAlgCfg(flags))

    kwargs.setdefault('DSPContainer', tileRawChannelContainerDSP)

    acc.setPrivateTools(TileRawChannelBuilder(name, **kwargs))

    return acc
Example #26
0
def TileMuIdMonitoringConfig(flags, **kwargs):
    ''' Function to configure TileMuIdMonitorAlgorithm algorithm in the monitoring system.'''

    # Define one top-level monitoring algorithm. The new configuration
    # framework uses a component accumulator.
    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    result = ComponentAccumulator()

    # The following class will make a sequence, configure algorithms, and link
    # them to GenericMonitoringTools
    from AthenaMonitoring import AthMonitorCfgHelper
    helper = AthMonitorCfgHelper(flags, 'TileMuIdMonitoring')

    # Adding an TileCellMonitorAlgorithm algorithm to the helper
    from AthenaConfiguration.ComponentFactory import CompFactory
    tileMuIdMonAlg = helper.addAlgorithm(CompFactory.TileMuIdMonitorAlgorithm,
                                         'TileMuIdMonAlg')

    tileMuIdMonAlg.TriggerChain = ''

    # L1Trigger Type Bits:
    #     bit0_RNDM, bit1_ZeroBias, bit2_L1Cal, bit3_Muon,
    #     bit4_RPC, bit5_FTK, bit6_CTP, bit7_Calib, AnyPhysTrig
    kwargs.setdefault('fillHistogramsForL1Triggers',
                      ['AnyPhysTrig', 'bit7_Calib'])
    l1Triggers = kwargs['fillHistogramsForL1Triggers']

    for k, v in kwargs.items():
        setattr(tileMuIdMonAlg, k, v)

    run = str(flags.Input.RunNumber[0])

    # 1) Configure histogram with TileMuIdMonAlg algorithm execution time
    executeTimeGroup = helper.addGroup(tileMuIdMonAlg,
                                       'TileMuIdMonExecuteTime', 'Tile/')
    executeTimeGroup.defineHistogram(
        'TIME_execute',
        path='MuId',
        type='TH1F',
        title='Time for execute TileMuIdMonAlg algorithm;time [#mus]',
        xbins=100,
        xmin=0,
        xmax=1000)

    from TileCalibBlobObjs.Classes import TileCalibUtils as Tile

    from TileMonitoring.TileMonitoringCfgHelper import addTileEtaPhiMapsArray

    # 2) Configure histograms with most energetic Tile MuId muon position
    addTileEtaPhiMapsArray(helper,
                           tileMuIdMonAlg,
                           name='TileMuIdEtaPhi',
                           type='TH2D',
                           title='Tile MuId muon position',
                           path='Tile/MuId',
                           run=run,
                           triggers=l1Triggers,
                           perSample=False)

    # 3) Configure histograms with most energetic Tile MuId muon position when Tags=1
    addTileEtaPhiMapsArray(helper,
                           tileMuIdMonAlg,
                           name='TileMuId1TagEtaPhi',
                           type='TH2D',
                           title='Tile MuId Tags=1 muon position',
                           path='Tile/MuId',
                           run=run,
                           triggers=l1Triggers,
                           perSample=False)

    # 4) Configure histograms with most energetic Tile MuId muon position when Tags=2
    addTileEtaPhiMapsArray(helper,
                           tileMuIdMonAlg,
                           name='TileMuId2TagEtaPhi',
                           type='TH2D',
                           title='Tile MuId Tags=2 muon position',
                           path='Tile/MuId',
                           run=run,
                           triggers=l1Triggers,
                           perSample=False)

    from TileMonitoring.TileMonitoringCfgHelper import addTile2DHistogramsArray

    # 5) Configure histograms with Tile MuId muon quality vs energy
    addTile2DHistogramsArray(
        helper,
        tileMuIdMonAlg,
        name='TileMuIdEneQuality',
        xvalue='energy',
        yvalue='quality',
        type='TH2D',
        title='Tile MuId muon quality vs energy [MeV];Energy [MeV];Quality',
        path='Tile/MuId',
        xbins=50,
        xmin=0.,
        xmax=10000.,
        ybins=4,
        ymin=-0.5,
        ymax=1.5,
        run=run,
        triggers=l1Triggers)

    # 6) Configure histograms with Tile  MuId muon quality vs energy when Tags=1
    addTile2DHistogramsArray(
        helper,
        tileMuIdMonAlg,
        name='TileMuId1TagEneQuality',
        xvalue='energy',
        yvalue='quality',
        type='TH2D',
        title=
        'Tile MuId Tags=1 muon quality vs energy [MeV];Energy [MeV];Quality',
        path='Tile/MuId',
        xbins=50,
        xmin=0.,
        xmax=10000.,
        ybins=4,
        ymin=-0.5,
        ymax=1.5,
        run=run,
        triggers=l1Triggers)

    # 7) Configure histograms with Tile  MuId muon quality vs energy when Tags=2
    addTile2DHistogramsArray(
        helper,
        tileMuIdMonAlg,
        name='TileMuId2TagEneQuality',
        xvalue='energy',
        yvalue='quality',
        type='TH2D',
        title=
        'Tile MuId Tags=2 muon quality vs energy [MeV];Energy [MeV];Quality',
        path='Tile/MuId',
        xbins=50,
        xmin=0.,
        xmax=10000.,
        ybins=4,
        ymin=-0.5,
        ymax=1.5,
        run=run,
        triggers=l1Triggers)

    from TileMonitoring.TileMonitoringCfgHelper import addTile1DHistogramsArray

    # 8) Configure histograms with Tile MuId number of tags
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuIdTags',
                             xvalue='nTags',
                             title='Tile MuId number of tags',
                             path='Tile/MuId',
                             xbins=5,
                             xmin=-0.5,
                             xmax=4.5,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 9) Configure histograms with all Tile MuId energy
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuIdEnergy',
                             xvalue='energy',
                             title='Tile MuId Energy [MeV]',
                             path='Tile/MuId',
                             xbins=100,
                             xmin=0.,
                             xmax=10000.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 10) Configure histograms with all Tile MuId muon quality
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuIdQuality',
                             xvalue='quality',
                             title='Tile MuId muon quality',
                             path='Tile/MuId',
                             xbins=4,
                             xmin=-0.5,
                             xmax=1.5,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 11) Configure histograms with all Tile MuId muon eta position
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuIdEta',
                             xvalue='eta',
                             title='Tile MuId muon #eta position;#eta',
                             path='Tile/MuId',
                             xbins=40,
                             xmin=-2.,
                             xmax=2.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 12) Configure histograms with all Tile MuId muon phi position
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuIdPhi',
                             xvalue='phi',
                             title='Tile MuId muon #phi position;#phi',
                             path='Tile/MuId',
                             xbins=Tile.MAX_DRAWER,
                             xmin=-3.15,
                             xmax=3.15,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 13) Configure histograms with all Tile MuId muon average energy vs eta
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuIdEneEta',
                             xvalue='eta',
                             value='energy',
                             title='Tile MuId muon average energy;#eta',
                             path='Tile/MuId',
                             xbins=40,
                             xmin=-2.,
                             xmax=2.,
                             type='TProfile',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 14) Configure histograms with all Tile MuId muon average energy vs phi
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuIdEnePhi',
                             xvalue='phi',
                             value='energy',
                             title='Tile MuId muon everage energy;#phi',
                             path='Tile/MuId',
                             xbins=Tile.MAX_DRAWER,
                             xmin=-3.15,
                             xmax=3.15,
                             type='TProfile',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 15) Configure histograms with all Tile MuId energy when Tags=1
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuId1TagEnergy',
                             xvalue='energy',
                             title='Tile MuId Tags=1 Energy [MeV]',
                             path='Tile/MuId',
                             xbins=100,
                             xmin=0.,
                             xmax=10000.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 16) Configure histograms with all Tile MuId muon quality when Tags=1
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuId1TagQuality',
                             xvalue='quality',
                             title='Tile MuId Tags=1 muon quality',
                             path='Tile/MuId',
                             xbins=4,
                             xmin=-0.5,
                             xmax=1.5,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 17) Configure histograms with all Tile MuId muon average energy vs eta when Tags=1
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuId1TagEneEta',
                             xvalue='eta',
                             value='energy',
                             title='Tile MuId Tags=1 muon average energy;#eta',
                             path='Tile/MuId',
                             xbins=40,
                             xmin=-2.,
                             xmax=2.,
                             type='TProfile',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 18) Configure histograms with all Tile MuId muon average energy vs phi when Tags=1
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuId1TagEnePhi',
                             xvalue='phi',
                             value='energy',
                             title='Tile MuId Tags=1 muon everage energy;#phi',
                             path='Tile/MuId',
                             xbins=Tile.MAX_DRAWER,
                             xmin=-3.15,
                             xmax=3.15,
                             type='TProfile',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 19) Configure histograms with all Tile MuId energy when Tags=2
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuId2TagEnergy',
                             xvalue='energy',
                             title='Tile MuId Tags=2 Energy [MeV]',
                             path='Tile/MuId',
                             xbins=100,
                             xmin=0.,
                             xmax=10000.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 20) Configure histograms with all Tile MuId muon quality when Tags=2
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuId2TagQuality',
                             xvalue='quality',
                             title='Tile MuId Tags=2 muon quality',
                             path='Tile/MuId',
                             xbins=4,
                             xmin=-0.5,
                             xmax=1.5,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 21) Configure histograms with all Tile MuId muon average energy vs eta when Tags=2
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuId2TagEneEta',
                             xvalue='eta',
                             value='energy',
                             title='Tile MuId Tags=2 muon average energy;#eta',
                             path='Tile/MuId',
                             xbins=40,
                             xmin=-2.,
                             xmax=2.,
                             type='TProfile',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 22) Configure histograms with all Tile MuId muon average energy vs phi when Tags=2
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuId2TagEnePhi',
                             xvalue='phi',
                             value='energy',
                             title='Tile MuId Tags=2 muon everage energy;#phi',
                             path='Tile/MuId',
                             xbins=Tile.MAX_DRAWER,
                             xmin=-3.15,
                             xmax=3.15,
                             type='TProfile',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    accumalator = helper.result()
    result.merge(accumalator)
    return result
Example #27
0
def testCfg(configFlags):
    result = ComponentAccumulator()

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    from TileGeoModel.TileGMConfig import TileGMCfg
    result.merge(LArGMCfg(configFlags))
    result.merge(TileGMCfg(configFlags))

    from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg
    result.merge(LArOnOffIdMappingCfg(configFlags))

    result.addEventAlgo(CreateDataAlg('CreateDataAlg'))

    CaloCellContainerAliasAlg = CompFactory.CaloCellContainerAliasAlg
    result.addEventAlgo(
        CaloCellContainerAliasAlg('aliasAlg',
                                  Cells='AllCalo',
                                  Alias='CellAlias'))

    result.addEventAlgo(CheckAliasAlg('CheckAliasAlg'))
    return result
Example #28
0
def LArMonitoringConfig(inputFlags):

    from LArMonitoring.LArCollisionTimeMonAlg import LArCollisionTimeMonConfig
    from LArMonitoring.LArAffectedRegionsAlg import LArAffectedRegionsConfig
    from LArMonitoring.LArDigitMonAlg import LArDigitMonConfig
    from LArMonitoring.LArRODMonAlg import LArRODMonConfig
    from LArMonitoring.LArNoisyROMonAlg import LArNoisyROMonConfig
    from LArMonitoring.LArFEBMonAlg import LArFEBMonConfig
    from LArMonitoring.LArHVCorrMonAlg import LArHVCorrMonConfig

    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    acc = ComponentAccumulator()

    if not inputFlags.Input.isMC:
        acc.merge(LArAffectedRegionsConfig(inputFlags))
        acc.merge(LArNoisyROMonConfig(inputFlags))
        if 'online' not in inputFlags.DQ.Environment:
            acc.merge(LArHVCorrMonConfig(inputFlags))

    # algos which can run in ESD but not AOD:
    if inputFlags.DQ.Environment != 'AOD':
        if inputFlags.DQ.DataType != 'cosmics':
            from LumiBlockComps.BunchCrossingCondAlgConfig import BunchCrossingCondAlgCfg
            acc.merge(BunchCrossingCondAlgCfg(inputFlags))
            acc.merge(LArCollisionTimeMonConfig(inputFlags))

    # and others on RAW data only
    if inputFlags.DQ.Environment in ('online', 'tier0', 'tier0Raw'):
        if not inputFlags.Input.isMC:
            acc.merge(LArFEBMonConfig(inputFlags))
            acc.merge(LArDigitMonConfig(inputFlags))
            acc.merge(LArRODMonConfig(inputFlags))

    return acc
Example #29
0
def TileBadChannelsCondAlgCfg(flags, **kwargs):
    """Return component accumulator with configured Tile bad channels conditions algorithm

    Arguments:
        flags:  -- Athena configuration flags (ConfigFlags)
    Keyword arguments:
        Source: -- source of Tile bad channels (COOL, FILE). Defaults to COOL.
        TileBadChannels -- name of Tile bad channels object. Defaults to TileBadChannels.
    """

    acc = ComponentAccumulator()

    source = kwargs.get('Source', 'COOL')
    badChannels = kwargs.get('TileBadChannels', 'TileBadChannels')

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

    name = badChannels + 'CondAlg'

    if source == 'COOL':
        # Connect COOL Tile conditions proxies to the algorithm (default)

        from TileConditions.TileFolders import TileFolders
        folders = TileFolders(isMC = flags.Input.isMC, isOnline = flags.Common.isOnline)

        TileCondProxyCoolBch=CompFactory.getComp("TileCondProxyCool<TileCalibDrawerBch>")
        onlineFolder = folders.addSplitMC('/TILE/ONL01/STATUS/ADC', '/TILE/ONL01/STATUS/ADC')
        onlineBadChannelsProxy = TileCondProxyCoolBch('TileCondProxyCool_OnlBch', Source = onlineFolder)

        if flags.IOVDb.DatabaseInstance  == 'CONDBR2':
            if not flags.Common.isOnline:
                oflineFolder = folders.add('/TILE/OFL02/STATUS/ADC', 'TILE_OFL')
                offlineBadChannelsProxy = TileCondProxyCoolBch('TileCondProxyCool_OflBch', Source = oflineFolder)
            else:
                offlineBadChannelsProxy = None
        else:
            oflineFolder = folders.addSplitOnline('/TILE/OFL01/STATUS/ADC', '/TILE/OFL02/STATUS/ADC')
            offlineBadChannelsProxy = TileCondProxyCoolBch('TileCondProxyCool_OflBch', Source = oflineFolder)
        
        from IOVDbSvc.IOVDbSvcConfig import addFolderList
        acc.merge( addFolderList(flags, folders.get()) )

    else:
        # Connect FILE Tile conditions proxies to the algorithm
        TileCondProxyFileBch=CompFactory.getComp("TileCondProxyFile<TileCalibDrawerBch>")
        onlineBadChannelsProxy = TileCondProxyFileBch('TileCondProxyFile_OnlBch', Source = 'TileDefault.onlBch')
        offlineBadChannelsProxy = TileCondProxyFileBch('TileCondProxyFile_OflBch', Source = 'TileDefault.oflBch')
        

    TileCondIdTransforms=CompFactory.TileCondIdTransforms
    TileBadChannelsCondAlg=CompFactory.TileBadChannelsCondAlg
    badChannelsCondAlg = TileBadChannelsCondAlg( name = name,
                                                 OnlBchProxy = onlineBadChannelsProxy,
                                                 OflBchProxy = offlineBadChannelsProxy,
                                                 TileCondIdTransforms = TileCondIdTransforms(),
                                                 TileBadChannels = badChannels)

    acc.addCondAlgo(badChannelsCondAlg)

    from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
    acc.merge( TileCablingSvcCfg(flags) )
    
    return acc
Example #30
0
    def runTest(self):
        # test if an algorithm (or sequence) can be controlled by more than one sequence

        accTop = ComponentAccumulator()

        recoSeq = seqAND("seqReco")
        recoAlg = TestAlgo("recoAlg")
        recoSeq.Members.append(recoAlg)

        acc1 = ComponentAccumulator()
        acc1.addSequence(seqAND("seq1"))
        acc1.addSequence(recoSeq, parentName="seq1")

        acc2 = ComponentAccumulator()
        acc2.addSequence(seqAND("seq2"))
        acc2.addSequence(recoSeq, parentName="seq2")

        accTop.merge(acc1)
        accTop.merge(acc2)

        accTop.printConfig()

        self.assertIsNotNone(
            findAlgorithm(accTop.getSequence("seq1"), "recoAlg"),
            "Algorithm missing in the first sequence")
        self.assertIsNotNone(
            findAlgorithm(accTop.getSequence("seq2"), "recoAlg"),
            "Algorithm missing in the second sequence")
        s = accTop.getSequence("seqReco")
        self.assertEqual(
            len(s.Members), 1,
            "Wrong number of algorithms in reco seq: %d " % len(s.Members))
        self.assertIs(findAlgorithm(accTop.getSequence("seq1"), "recoAlg"),
                      findAlgorithm(accTop.getSequence("seq2"), "recoAlg"),
                      "Algorithms are cloned")
        self.assertIs(findAlgorithm(accTop.getSequence("seq1"), "recoAlg"),
                      recoAlg, "Clone of the original inserted in sequence")

        fout = open("dummy.pkl", "wb")
        accTop.store(fout)
        fout.close()