ATLAS Offline Software
prepareForcedList.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2 
3 from optparse import OptionParser
4 
5 from PlotCalibrationGains import L1CaloGeometryConvertor
6 
7 
8 print ("Starting prepareForcedList")
9 
10 parser = OptionParser()
11 
12 parser.add_option("-f","--InputFile",action="store",type="string",dest="input_file_name",help="Name of input file")
13 parser.add_option("-o","--OutputFile",action="store",type="string",dest="output_file_name",help="Name of input file")
14 parser.add_option("-s","--StrategyString",action="store",type="string",dest="strategy",default=None,help="Strategy string")
15 
16 (options, args) = parser.parse_args()
17 
18 file_input = open(options.input_file_name)
19 file_output = open(options.output_file_name,'w')
20 
21 geometry_convertor = L1CaloGeometryConvertor()
22 geometry_convertor.LoadReceiverPPMMap()
23 
24 if options.strategy is None:
25  print ("taking default strategy string")
26  strategy ="GainOneOvEmecFcalLowEta"
27 # strategy ="GainOneOvEmbFcalHighEta"
28 else:
29  strategy=options.strategy
30 
31 print ("Using strategy string %s, check it makes sense!!!" % strategy)
32 
33 for line in file_input.readlines():
34  line2=line.rstrip()
35  parts = line2.split(' ')
36  parts_stripped = [iii for iii in parts if not iii=='']
37  # print (parts_stripped)
38  file_output.write("%s %.3f # %s %s %s %s \n" % (geometry_convertor.getReceiverfromPPM(parts_stripped[2],strategy),
39  float(parts_stripped[3]),
40  parts_stripped[0],parts_stripped[1],parts_stripped[2],parts_stripped[3]))
41 # print (geometry_convertor.getReceiverfromPPM(parts_stripped[2]), " ", parts_stripped[3], " # ", parts_stripped)
42 
43 
44 file_input.close()
45 file_output.close()
46 
47 print ("Done!")
PlotCalibrationGains.L1CaloGeometryConvertor
Definition: PlotCalibrationGains.py:59
Trk::open
@ open
Definition: BinningType.h:40
readCCLHist.float
float
Definition: readCCLHist.py:83