ATLAS Offline Software
update_CPContent.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4 
5 
6 import sys
7 import os
8 sys.path.append(os.path.abspath("../python"))
9 import MuonsCPContent as mcc
10 
11 print (mcc.MuonsCPContent)
12 
13 def makeContent(l):
14  ct = 'MuonsCPContent = [\n'
15  for i in l:
16  ct += '"'+i+'",\n'
17  ct += ']'
18  return ct
19 
20 def mergeList(l1, l2, excludeList=[]):
21  l1a = []
22  for i in l1:
23  x = i.split('.')
24  tag=x[0]
25  found = False
26  for ji in range(len(l2)):
27  j = l2[ji]
28 # for j in l2:
29  y = j.split('.')
30  if tag!=y[0]: continue
31  found = True
32  for m in x[1:]:
33  if m in y[1:]: continue
34  print (m, 'is not found for', tag)
35  l2[ji] += '.'+m
36  if (not found) and (not (tag in excludeList)):
37  print (tag, 'is not found')
38  l1a.append(i)
39  return l2+l1a
40 
41 ifile=sys.argv[1]
42 list1 = []
43 with open(ifile) as if1:
44  for line in if1.readlines():
45  list1.append(line.rstrip())
46 print (makeContent(list1))
47 print (makeContent(mcc.MuonsCPContent))
48 
49 kk = mergeList(list1, mcc.MuonsCPContent, ['EventInfo', 'EventInfoAux'])
50 nc = makeContent(kk)
51 with open('new_MuonsCPContent.py','w') as fout1:
52  fout1.write(nc)
update_CPContent.makeContent
def makeContent(l)
Definition: update_CPContent.py:13
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:194
update_CPContent.mergeList
def mergeList(l1, l2, excludeList=[])
Definition: update_CPContent.py:20
Trk::open
@ open
Definition: BinningType.h:40