def test2SetToolProperties(self): """Test setting of tool properties""" from AthExHelloWorld.AthExHelloWorldConf import HelloAlg from AthExHelloWorld.AthExHelloWorldConf import HelloTool HelloWorld = HelloAlg('HelloWorld') msg1 = "A Private Message!" HelloWorld.MyPrivateHelloTool = HelloTool("HelloTool") HelloWorld.MyPrivateHelloTool.MyMessage = msg1 HelloWorld.setup() global ToolSvc msg2 = "A Public Message!" ToolSvc += HelloTool("PublicHello") ToolSvc.PublicHello.MyMessage = msg2 ToolSvc.setup() self.assertEqual(HelloWorld.MyPrivateHelloTool.MyMessage, msg1) client = HelloWorld.getName( ) + '.' + HelloWorld.MyPrivateHelloTool.getName() self.assert_(JobOptionsSvc.verify(client, 'MyMessage', msg1)) self.assertEqual(ToolSvc.PublicHello.MyMessage, msg2) self.assert_( JobOptionsSvc.verify('ToolSvc.PublicHello', 'MyMessage', msg2))
# Set a matrix (a vector of vectors) ... HelloWorld.MyMatrix = [[1, 2, 3], [4, 5, 6]] # ... and some more: HelloWorld.MyMatrix += [[7, 8, 9]] #-------------------------------------------------------------- # Algorithms Tool Usage Private Options (advanced and optional) #-------------------------------------------------------------- # Import configurable for using our HelloTool from AthExHelloWorld.AthExHelloWorldConf import HelloTool # Setup a public tool so that it can be used (again, note name) ToolSvc += HelloTool("PublicHello") ToolSvc.PublicHello.MyMessage = "A Public Message!" # Tell "HelloWorld" to use this tool ("MyPublicHelloTool" is a # ToolHandle property of HelloAlg) HelloWorld.MyPublicHelloTool = ToolSvc.PublicHello # Hand "HelloWorld" a private HelloTool ("MyPrivateHelloTool" is # a ToolHandler property of HelloAlg) HelloWorld.MyPrivateHelloTool = HelloTool("HelloTool") HelloWorld.MyPrivateHelloTool.MyMessage = "A Private Message!" #============================================================== # # End of job options file #