140def countToolFromAlgData(flags, ad):
141 """Count Algorithms write out a Count object determined
142 from TOBS produced by a single Input Algorithm."""
143
144
145
146 countToolSelector = {
147 'cTauMultiplicity': CompFactory.GlobalSim.cTauMultiplicityAlgTool,
148 ('EnergyThreshold', 'jXE'): CompFactory.GlobalSim.EnergyThresholdAlgTool_jXE,
149 }
150
151
152
153 key = None
154 if ad.klass == 'EnergyThreshold':
155 key = (ad.klass, ad.inputs[0])
156
157 else:
158 key = ad.klass
159
160 tool = countToolSelector[key](ad.name)
161 tool.alg_instance_name = ad.name
162 tool.nbits = int(countAlgValue(ad, 'nbits'))
163 tool.TOBArrayReadKey = writeHandleKeys[ad.input_sns[0]]
164 tool.CountWriteKey = ad.name +
'_Count_' +
str(ad.sn)
165 writeHandleKeys[ad.sn] = tool.CountWriteKey
166
167 if ad.klass in ('EnergyThreshold',):
168
169
170 tool.hundredMeVThreshold = int(ad.threshold)*10 + 5
171
172 if ad.klass == 'cTauMultiplicity':
173 tool.do_dump = do_dump
175
176 threshold_name = countAlgValue(ad, 'threshold')
177 title = "cTauMultiplicity_accept #eta Et_" + threshold_name
178
179 monTool.defineHistogram("accept_eta,accept_et",
180 path="EXPERT",
181 type="TH2F",
182 title=title,
183 xbins=200, xmin=-200, xmax=200,
184 ybins=100, ymin=0, ymax=100)
185
186 title_stub = "cTauMultiplicityc " + threshold_name + " "
187 title = title_stub + "counts"
188 monTool.defineHistogram("counts",
189 path="EXPERT",
190 type="TH1F",
191 title=title,
192 xbins=15, xmin=0, xmax=15)
193
194 title = title_stub + "TOB Et"
195 monTool.defineHistogram("Et",
196 path="EXPERT",
197 type="TH1F",
198 title=title,
199 xbins=200, xmin=0, xmax=400)
200
201
202 title = title_stub + "#phi #eta"
203 monTool.defineHistogram("phi,eta",
204 path="EXPERT",
205 type="TH2F",
206 title=title,
207 xbins=200, xmin=0, xmax=400,
208 ybins=128, ymin=0, ymax=128)
209
210
211 title = title_stub + "Et #eta"
212 monTool.defineHistogram("Et,eta",
213 path="EXPERT",
214 type="TH2F",
215 title=title,
216 xbins=200, xmin=0, xmax=200,
217 ybins=200, ymin=0, ymax=400)
218
219 title = title_stub + "loose partial isolation"
220 monTool.defineHistogram("iso_loose",
221 path="EXPERT",
222 type="TH1F",
223 title=title,
224 xbins=200, xmin=0, xmax=10)
225
226 title = title_stub + "medium partial isolation"
227 monTool.defineHistogram("iso_medium",
228 path="EXPERT",
229 type="TH1F",
230 title=title,
231 xbins=200, xmin=0, xmax=10)
232
233
234 title = title_stub + "tight partial isolation"
235 monTool.defineHistogram("iso_tight",
236 path="EXPERT",
237 type="TH1F",
238 title=title,
239 xbins=200, xmin=0, xmax=10)
240
241 tool.monTool = monTool
242
243 return tool
244