4 from itertools
import product
6 from argparse
import ArgumentParser
8 parser = ArgumentParser()
9 parser.add_argument(
"--outFilePreFix", help=
"Output JSON file",
11 parser.add_argument(
"--scaleError", help=
"Scale the uncertainties of the MM",type=float, default = 5.)
12 parser.add_argument(
"--addErrorMMClusterTime", help=
"add fixed error to the uncertainties of the MM",type=float, default = 0.)
15 if __name__ ==
"__main__":
21 for stationName, stationEta, stationPhi, multilayer, gasGap, author
in product([
"MMS",
"MML"], [-2,-1,1,2],
range(1,9), [1,2],
range(1,5), [0,65]):
22 constant = args.scaleError * 0.0815
23 linear = args.scaleError * 0.0
24 quad = args.scaleError * 1.56
27 maxStrip = (5
if abs(stationEta)==1
else 3)*1024
29 calibEntry = dict({
"station": stationName,
"eta":stationEta,
"phi": stationPhi,
"multilayer": multilayer,
"gasGap": gasGap,
"minStrip": minStrip,
"maxStrip": maxStrip,
"modelName":
"tanThetaPolynomial" ,
"modelPars": [constant, linear, quad],
"clusterAuthor": author})
30 logging.debug(calibEntry)
32 dbEntriesMMCSide.append(calibEntry)
34 dbEntriesMMASide.append(calibEntry)
37 for stationName, stationEta, stationPhi, multilayer, gasGap, author
in product([
"MMS",
"MML"], [-2,-1,1,2],
range(1,9), [1,2],
range(1,5), [66]):
38 constant = args.scaleError* 0.0615 + args.addErrorMMClusterTime
39 linear = args.scaleError * 0
40 quad = args.scaleError * 0.275
43 maxStrip = (5
if abs(stationEta)==1
else 3)*1024
45 calibEntry = dict({
"station": stationName,
"eta":stationEta,
"phi": stationPhi,
"multilayer": multilayer,
"gasGap": gasGap,
"minStrip": minStrip,
"maxStrip": maxStrip,
"modelName":
"tanThetaPolynomial" ,
"modelPars": [constant, linear, quad],
"clusterAuthor": author})
46 logging.debug(calibEntry)
48 dbEntriesMMCSide.append(calibEntry)
50 dbEntriesMMCSide.append(calibEntry)
53 dbEntriessTGCASide = []
54 dbEntriessTGCCSide = []
55 maxStripStgc = dict({
"QL1": 408 ,
"QL2": 366,
"QL3": 353,
"QS1": 406,
"QS2": 365,
"QS3": 307})
56 for stationName, stationEta, stationPhi, multilayer, gasGap
in product([
"STL",
"STS"], [-3, -2,-1,1,2,3],
range(1,9), [1,2],
range(1,5)):
57 chamberKey = f
"Q{stationName[2]}{abs(stationEta)}"
59 maxStrip = maxStripStgc[chamberKey]
61 const = args.scaleError * 0.151
62 linear = args.scaleError * 0
63 quad = args.scaleError * 0.201
66 calibEntry = dict({
"station": stationName,
"eta":stationEta,
"phi": stationPhi,
"multilayer": multilayer,
"gasGap": gasGap,
"minStrip": minStrip,
"maxStrip": maxStrip,
"modelName":
"tanThetaPolynomial" ,
"modelPars": [const, linear, quad],
"clusterAuthor": author})
67 logging.debug(calibEntry)
69 dbEntriessTGCCSide.append(calibEntry)
71 dbEntriessTGCASide.append(calibEntry)
74 const = args.scaleError * 0.175
75 linear = args.scaleError * 0
76 quad = args.scaleError * 0.201
77 calibEntry = dict({
"station": stationName,
"eta":stationEta,
"phi": stationPhi,
"multilayer": multilayer,
"gasGap": gasGap,
"minStrip": minStrip,
"maxStrip": maxStrip,
"modelName":
"tanThetaPolynomial" ,
"modelPars": [const, linear, quad],
"clusterAuthor": author})
78 logging.debug(calibEntry)
80 dbEntriessTGCCSide.append(calibEntry)
82 dbEntriessTGCASide.append(calibEntry)
86 outFileName = f
"{args.outFilePreFix}_scale_x{args.scaleError}_mmConstOffset_{args.addErrorMMClusterTime}.json"
87 with open(outFileName,
'w')
as outStream:
88 json.dump(dbEntriesMMASide + dbEntriesMMCSide +dbEntriessTGCASide + dbEntriessTGCCSide, outStream)
91 outFileName = f
"{args.outFilePreFix}_MMonly_ASide_scale_x{args.scaleError}_mmConstOffset_{args.addErrorMMClusterTime}.json"
92 with open(outFileName,
'w')
as outStream:
93 json.dump(dbEntriesMMASide, outStream)
95 outFileName = f
"{args.outFilePreFix}_MMonly_CSide_scale_x{args.scaleError}_mmConstOffset_{args.addErrorMMClusterTime}.json"
96 with open(outFileName,
'w')
as outStream:
97 json.dump(dbEntriesMMCSide, outStream)
99 outFileName = f
"{args.outFilePreFix}_sTGConly_ASide_scale_x{args.scaleError}.json"
100 with open(outFileName,
'w')
as outStream:
101 json.dump(dbEntriessTGCASide, outStream)
103 outFileName = f
"{args.outFilePreFix}_sTGConly_CSide_scale_x{args.scaleError}.json"
104 with open(outFileName,
'w')
as outStream:
105 json.dump(dbEntriessTGCCSide, outStream)