ATLAS Offline Software
Loading...
Searching...
No Matches
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
6import sys
7import os
8sys.path.append(os.path.abspath("../python"))
9import MuonsCPContent as mcc
10
11print (mcc.MuonsCPContent)
12
14 ct = 'MuonsCPContent = [\n'
15 for i in l:
16 ct += '"'+i+'",\n'
17 ct += ']'
18 return ct
19
20def 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
41ifile=sys.argv[1]
42list1 = []
43with open(ifile) as if1:
44 for line in if1.readlines():
45 list1.append(line.rstrip())
46print (makeContent(list1))
47print (makeContent(mcc.MuonsCPContent))
48
49kk = mergeList(list1, mcc.MuonsCPContent, ['EventInfo', 'EventInfoAux'])
51with open('new_MuonsCPContent.py','w') as fout1:
52 fout1.write(nc)
mergeList(l1, l2, excludeList=[])