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 from __future__ import print_function
6 
7 import sys
8 import os
9 sys.path.append(os.path.abspath("../python"))
10 import MuonsCPContent as mcc
11 
12 print (mcc.MuonsCPContent)
13 
14 def makeContent(l):
15  ct = 'MuonsCPContent = [\n'
16  for i in l:
17  ct += '"'+i+'",\n'
18  ct += ']'
19  return ct
20 
21 def mergeList(l1, l2, excludeList=[]):
22  l1a = []
23  for i in l1:
24  x = i.split('.')
25  tag=x[0]
26  found = False
27  for ji in range(len(l2)):
28  j = l2[ji]
29 # for j in l2:
30  y = j.split('.')
31  if tag!=y[0]: continue
32  found = True
33  for m in x[1:]:
34  if m in y[1:]: continue
35  print (m, 'is not found for', tag)
36  l2[ji] += '.'+m
37  if (not found) and (not (tag in excludeList)):
38  print (tag, 'is not found')
39  l1a.append(i)
40  return l2+l1a
41 
42 ifile=sys.argv[1]
43 list1 = []
44 with open(ifile) as if1:
45  for line in if1.readlines():
46  list1.append(line.rstrip())
47 print (makeContent(list1))
48 print (makeContent(mcc.MuonsCPContent))
49 
50 kk = mergeList(list1, mcc.MuonsCPContent, ['EventInfo', 'EventInfoAux'])
51 nc = makeContent(kk)
52 with open('new_MuonsCPContent.py','w') as fout1:
53  fout1.write(nc)
update_CPContent.makeContent
def makeContent(l)
Definition: update_CPContent.py:14
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
update_CPContent.mergeList
def mergeList(l1, l2, excludeList=[])
Definition: update_CPContent.py:21
Trk::open
@ open
Definition: BinningType.h:40