ResimTags.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 
4 from __future__ import print_function
5 def CreateTags():
6  preqes = [ 25, 30, 40 ]
7  prethrs = [ 1, 3 ]
8  prerefs = [ "Opt", "Pes" ]
9 
10  defqes = [ 35 ]
11  defthrs = [ 2 ]
12  defrefs = [ "Non" ]
13 
14  areas = {}
15  noises = {}
16  snrs = {}
17  reflected = {}
18 
19 
20  sets = [ ("DEF", defqes, defrefs, defthrs),
21  ("EFF", preqes, defrefs, defthrs),
22  ("REF", defqes, prerefs, defthrs),
23  ("THR", defqes, defrefs, prethrs) ]
24 
25 
26  params = {}
27 
28  # Fixed noise value
29  noise = 100
30  snr = 5
31  peakadc = 9
32 
33  for ( name, iqes, irefs, ithrs ) in sets:
34  for qe in iqes:
35  for ref in irefs:
36  for thr in ithrs:
37  tag = "{0}{1:02d}QE{2}Refl{3:d}PE".format(name, qe, ref, thr)
38 
39  # Reduce Eff by 30% for shadowing
40  qeval = float(qe) / 1000.
41 
42  # Produce the parameter tables
43  params[tag] = {}
44  params[tag]["qe"] = qeval
45  params[tag]["darkrate"] = noise
46  params[tag]["linerms"] = float(peakadc)/snr
47  params[tag]["thresh"] = int( (float(thr)-0.3) * peakadc )
48 
49  # Reflections
50  if ref == "Opt":
51  params[tag]["refqe"] = 1.44*qeval
52  elif ref == "Pes":
53  params[tag]["refqe"] = 0.84*qeval
54  params[tag]["qe"] /= 2
55  else:
56  params[tag]["refqe"] = 0
57 
58 
59  tags = sorted(params.keys())
60  return tags, params
61 
62 
63 def print_seq(tags, form):
64  for tag in tags[:-1]:
65  print(form.format(tag)+",")
66  else:
67  print(form.format(tags[-1]))
68 
69 
70 tags, params = CreateTags()
71 
72 
73 
74 print("""
75 #include "largeantmodules_dune.fcl"
76 #include "detsimmodules_dune.fcl"
77 #include "opticaldetectormodules_dune.fcl"
78 #include "OpSlicer.fcl"
79 #include "FlashMatchAna.fcl"
80 #include "SNAna.fcl"
81 """)
82 print("BEGIN_PROLOG")
83 print()
84 
85 print()
86 print("############################################################################")
87 print("pd_detsim_modules: {")
88 for tag in tags:
89  print(" opdigi{0}: @local::dunefd_opdigi_threegang".format(tag))
90 print("}")
91 print()
92 
93 for tag in tags:
94  pm = params[tag]
95  print("pd_detsim_modules.opdigi{0}.QEOverride: {1:.6f}".format(tag, pm["qe"]))
96  print("pd_detsim_modules.opdigi{0}.QERefOverride: {1:.6f}".format(tag, pm["refqe"]))
97  print("pd_detsim_modules.opdigi{0}.DarkNoiseRate: {1:d} #Hz".format(tag, pm["darkrate"]))
98  print("pd_detsim_modules.opdigi{0}.LineNoiseRMS: {1:.3f}".format(tag, pm["linerms"]))
99  print("pd_detsim_modules.opdigi{0}.algo_threshold.ADCThreshold: {1:.3f}".format(tag, pm["thresh"]))
100  print()
101 
102 print("pd_detsim_path: [")
103 print_seq(tags, " opdigi{0}")
104 print(" ]")
105 
106 
107 
108 
109 print("")
110 print("############################################################################")
111 print("pd_reco_modules: {")
112 for tag in tags:
113  print(" ophit{0}: @local::dunefd_ophit".format(tag))
114 for tag in tags:
115  print(" opflash{0}: @local::dunefd_opflash".format(tag))
116 for tag in tags:
117  print(" opslicer{0}: @local::standard_opslicer".format(tag))
118 print("}")
119 print()
120 
121 for tag in tags:
122  pm = params[tag]
123  print("pd_reco_modules.ophit{0}.InputModule: opdigi{0}".format(tag))
124  print("pd_reco_modules.opflash{0}.InputModule: ophit{0}".format(tag))
125  print("pd_reco_modules.opslicer{0}.OpHitModuleLabel: ophit{0}".format(tag))
126  print()
127 
128 recoparts = []
129 print("pd_reco_path: [")
130 print_seq(tags, " ophit{0}, opflash{0}, opslicer{0}")
131 print(" ]")
132 
133 
134 
135 
136 
137 
138 print("")
139 print("############################################################################")
140 print("pd_ana_modules: {")
141 for tag in tags:
142  print(" flashmatch{0}: @local::marley_flashmatchana".format(tag))
143 for tag in tags:
144  print(" slicematch{0}: @local::marley_flashmatchana".format(tag))
145 for tag in tags:
146  print(" snana{0}: @local::standard_snana".format(tag))
147 
148 print("}")
149 print()
150 
151 for tag in tags:
152  pm = params[tag]
153  print("pd_ana_modules.flashmatch{0}.OpDetWaveformLabel: opdigi{0}".format(tag))
154  print("pd_ana_modules.flashmatch{0}.OpHitModuleLabel: ophit{0}".format(tag))
155  print("pd_ana_modules.flashmatch{0}.OpFlashModuleLabel: opflash{0}".format(tag))
156  print("pd_ana_modules.slicematch{0}.OpDetWaveformLabel: opdigi{0}".format(tag))
157  print("pd_ana_modules.slicematch{0}.OpHitModuleLabel: ophit{0}".format(tag))
158  print("pd_ana_modules.slicematch{0}.OpFlashModuleLabel: opslice{0}".format(tag))
159  print("pd_ana_modules.snana{0}.OpHitModuleLabel: ophit{0}".format(tag))
160  print()
161 
162 print("pd_ana_path: [")
163 print_seq(tags, " flashmatch{0}, slicematch{0}, snana{0}")
164 print(" ]")
165 
166 
167 print("END_PROLOG")
static bool format(QChar::Decomposition tag, QString &str, int index, int len)
Definition: qstring.cpp:11496
def CreateTags()
Definition: ResimTags.py:5
def print_seq(tags, form)
Definition: ResimTags.py:63