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