ATLAS Offline Software
EventInfoMgtInit.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2 
3 
13 
14 from __future__ import print_function
15 
17  """Loads the basic services for EventInfoMgt"""
18 
19  import os
20  import string
21  class EventInfoMgtInit:
22 
23  def __init__(self):
24  self.release = self.getRelease()
25 
26  #----------------------------------------------------
27  #
28  # Executing a shell command
29  #
30  def execute (self, cmd):
31  #print ('> ' + cmd)
32  r = os.popen(cmd)
33  lines = []
34  for line in r.readlines():
35  #print (line)
36  line = string.rstrip (line)
37  lines.append (line)
38  r.close()
39  return lines
40 
41  # Get the project name and it version version, the top level
42  # project, AtlasOffline, has the release number
43  def getRelease (self):
44  try:
45  #print ("EventInfoMgtInit.getRelease: get project, version")
46  project = os.environ ['AtlasProject']
47  version = os.environ ['AtlasVersion']
48  #print ("EventInfoMgtInit.getRelease: project, version",project, version)
49  return project + '-' + version
50  except Exception:
51  # These variables can be missing during CI builds,
52  # so don't complain if they're not there.
53  #print ("EventInfoMgtInit getRelease: except caught")
54  #print (sys.exc_info()[0])
55  #print (sys.exc_info()[1])
56  pass
57  return "Unknown-Unknown"
58 
59 
60 
61  import AthenaCommon.AtlasUnixStandardJob # noqa: F401
62 
63  from AthenaCommon.Logging import logging
64  from AthenaCommon.AppMgr import ServiceMgr as svcMgr
65 
66  msg = logging.getLogger( 'loadBasicEventInfoMgt' )
67  msg.debug( "Loading basic services for EventInfoMgt..." )
68 
69  #from EventInfoMgt.EventInfoMgtConf import TagInfoMgr
70  from EventInfoMgt.EventInfoMgtConf import TagInfoMgr
71  tagInfoMgr = TagInfoMgr()
72  svcMgr += tagInfoMgr
73 
74  # Add in extra tag for the release number:
75  evtMgt = EventInfoMgtInit()
76  release = evtMgt.release
77  print ("EventInfoMgtInit: Got release version ",release)
78  svcMgr.TagInfoMgr.ExtraTagValuePairs = {"AtlasRelease" : release }
79 
80  # Add TagInfoMgr to services activated by the framework
81  from AthenaCommon.AppMgr import theApp
82  theApp.CreateSvc += [ tagInfoMgr.name() ]
83 
84  # include basic IOVDbSvc functionality for /TagInfo
85  from IOVDbSvc import IOVDb # noqa: F401
86 
87  msg.debug( "Loading basic services for EventInfoMgt... [DONE]" )
88  return
89 
90 
92 
93 
94 del _loadBasicEventInfoMgt
95 
96 
LArG4FSStartPointFilterLegacy.execute
execute
Definition: LArG4FSStartPointFilterLegacy.py:20
python.EventInfoMgtInit._loadBasicEventInfoMgt
def _loadBasicEventInfoMgt()
Definition: EventInfoMgtInit.py:16
TagInfoMgr
This is a Athena service which manages detector description tag information. It maintains a TagInfo o...
Definition: TagInfoMgr.h:70
python.Utilities.__init__
__init__
Definition: Utilities.py:103