File indexing completed on 2024-11-25 02:29:11
0001
0002
0003 """ This macro can be used to merge the information from the accurate HV
0004 map derived from pedestal runs studies with the old db map into a new
0005 accurate map.
0006 """
0007
0008 import sys
0009
0010 print("Reading psu-detId map from map.txt")
0011
0012 inputMap = open("map.txt", "r")
0013
0014 outputFile = open("newMap.txt", "w")
0015
0016 for line in inputMap:
0017
0018
0019 splittedLine = line.rsplit("/", 1)
0020
0021 detId = splittedLine[0].split()[0]
0022
0023 channel = ""
0024
0025 HVmap = open("HVmap.txt", "r")
0026 for HVline in HVmap:
0027 if detId in HVline:
0028 channel = HVline.split()[1].strip()
0029
0030 if channel == "" or "undefined" in channel:
0031 if channel == "":
0032 print("channel not found for detId = ", detId)
0033 else:
0034 print("channel is undefined in HV map ", end=' ')
0035 print("leaving channel 0")
0036 outputFile.write(line)
0037
0038 else:
0039
0040 outputFile.write(splittedLine[0]+"/"+channel+"\n")
0041
0042