BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
TofCheckDigi.cxx
Go to the documentation of this file.
1#include "TofRec/TofCheckDigi.h"
2#include "TofRec/TofConstants.h"
3#include "TofCaliSvc/ITofCaliSvc.h"
4// #include "TofQElecSvc/ITofQElecSvc.h"
5#include "Identifier/Identifier.h"
6#include "Identifier/TofID.h"
7#include "McTruth/TofMcHit.h"
8#include "McTruth/McParticle.h"
9#include <iostream>
10
12// extern ITofQElecSvc* tofQElecSvc;
13
14TofCheckDigi::TofCheckDigi( NTuple::Tuple*& digi, NTuple::Tuple*& barrel, NTuple::Tuple*& endcap, NTuple::Tuple*& mrpc, NTuple::Tuple*& ext, NTuple::Tuple*& tof, NTuple::Tuple*& bhabha ):digi_tuple(digi),barrel_tuple(barrel),endcap_tuple(endcap),mrpc_tuple(mrpc),ext_tuple(ext),tof_tuple(tof),bb_tuple(bhabha) {
15 if(!digi_tuple) {
16 std::cerr<<" Error: invalid pionter in TofCheckDigi(NTuple::Tuple*) for digi_tuple "<<std::endl;
17 }
18 else{
19 digi_tuple->addItem("run", digi_run );
20 digi_tuple->addItem("event", digi_event );
21 digi_tuple->addItem("barrel", digi_barrel );
22 digi_tuple->addItem("endcap", digi_endcap );
23 digi_tuple->addItem("layer", digi_layer );
24 digi_tuple->addItem("tofid", digi_tofId );
25 digi_tuple->addItem("strip", digi_strip );
26 digi_tuple->addItem("end", digi_end );
27 digi_tuple->addItem("adc", digi_adc );
28 digi_tuple->addItem("tdc", digi_tdc );
29 digi_tuple->addItem("qclock", digi_qclock );
30 digi_tuple->addItem("tclock", digi_tclock );
31 digi_tuple->addItem("over", digi_overflow );
32 digi_tuple->addItem("noq", digi_noq );
33 digi_tuple->addItem("not", digi_not );
34 digi_tuple->addItem("multiq", digi_multiq );
35 digi_tuple->addItem("multit", digi_multit );
36 digi_tuple->addItem("overq", digi_overq );
37 digi_tuple->addItem("overt", digi_overt );
38 digi_tuple->addItem("t0", digi_t0 );
39 digi_tuple->addItem("t0stat", digi_t0stat );
40 digi_tuple->addItem("crate", digi_crate );
41 digi_tuple->addItem("geo", digi_geo );
42 digi_tuple->addItem("tdcnum", digi_tdcnum );
43 digi_tuple->addItem("err", digi_err );
44 }
45
46 if(!barrel_tuple) {
47 std::cerr<<" Error: invalid pionter in TofCheckDigi(NTuple::Tuple*) for barrel_tuple "<<std::endl;
48 }
49 else{
50 barrel_tuple->addItem("run", barrel_run );
51 barrel_tuple->addItem("event", barrel_event );
52 barrel_tuple->addItem("tofid", barrel_tofId );
53 barrel_tuple->addItem("icluster", barrel_tofTrackId );
54 barrel_tuple->addItem("layer", barrel_layer );
55 barrel_tuple->addItem("qch1", barrel_qchannel1 );
56 barrel_tuple->addItem("tch1", barrel_tchannel1 );
57 barrel_tuple->addItem("qch2", barrel_qchannel2 );
58 barrel_tuple->addItem("tch2", barrel_tchannel2 );
59 barrel_tuple->addItem("qtc1", barrel_qtc1 );
60 barrel_tuple->addItem("adc1", barrel_adc1 );
61 barrel_tuple->addItem("tdc1", barrel_tdc1 );
62 barrel_tuple->addItem("qtc2", barrel_qtc2 );
63 barrel_tuple->addItem("adc2", barrel_adc2 );
64 barrel_tuple->addItem("tdc2", barrel_tdc2 );
65 barrel_tuple->addItem("qclock1", barrel_qclock1 );
66 barrel_tuple->addItem("tclock1", barrel_tclock1 );
67 barrel_tuple->addItem("qclock2", barrel_qclock2 );
68 barrel_tuple->addItem("tclock2", barrel_tclock2 );
69 barrel_tuple->addItem("qual", barrel_quality );
70 barrel_tuple->addItem("tmatched", barrel_tmatched );
71 barrel_tuple->addItem("qtimes1", barrel_qtimes1 );
72 barrel_tuple->addItem("ttimes1", barrel_ttimes1 );
73 barrel_tuple->addItem("qtimes2", barrel_qtimes2 );
74 barrel_tuple->addItem("ttimes2", barrel_ttimes2 );
75 barrel_tuple->addItem("times1", barrel_times1 );
76 barrel_tuple->addItem("times2", barrel_times2 );
77 barrel_tuple->addItem("times", barrel_times );
78 barrel_tuple->addItem("qnum1", barrel_qnum1 );
79 barrel_tuple->addItem("tnum1", barrel_tnum1 );
80 barrel_tuple->addItem("qnum2", barrel_qnum2 );
81 barrel_tuple->addItem("tnum2", barrel_tnum2 );
82 barrel_tuple->addItem("tsum", barrel_tsum );
83 barrel_tuple->addItem("tsub", barrel_tsub );
84 barrel_tuple->addItem("ztdc", barrel_ztdc );
85 barrel_tuple->addItem("zadc", barrel_zadc );
86 barrel_tuple->addItem("t0", barrel_t0 );
87 barrel_tuple->addItem("t0stat", barrel_t0stat );
88 }
89
90 if(!endcap_tuple) {
91 std::cerr<<" Error: invalid pionter in TofCheckDigi(NTuple::Tuple*) for endcap_tuple "<<std::endl;
92 }
93 else{
94 endcap_tuple->addItem("run", endcap_run );
95 endcap_tuple->addItem("event", endcap_event );
96 endcap_tuple->addItem("tofid", endcap_tofId );
97 endcap_tuple->addItem("icluster", endcap_tofTrackId );
98 endcap_tuple->addItem("qch", endcap_qchannel );
99 endcap_tuple->addItem("tch", endcap_tchannel );
100 endcap_tuple->addItem("qtc", endcap_qtc );
101 endcap_tuple->addItem("adc", endcap_adc );
102 endcap_tuple->addItem("tdc", endcap_tdc );
103 endcap_tuple->addItem("qual", endcap_quality );
104 endcap_tuple->addItem("qclock", endcap_qclock );
105 endcap_tuple->addItem("tclock", endcap_tclock );
106 endcap_tuple->addItem("qtimes", endcap_qtimes );
107 endcap_tuple->addItem("ttimes", endcap_ttimes );
108 endcap_tuple->addItem("times", endcap_times );
109 endcap_tuple->addItem("qnum", endcap_qnum );
110 endcap_tuple->addItem("tnum", endcap_tnum );
111 endcap_tuple->addItem("t0", endcap_t0 );
112 endcap_tuple->addItem("t0stat", endcap_t0stat );
113 }
114
115 if(!mrpc_tuple) {
116 std::cerr<<" Error: invalid pionter in TofCheckDigi(NTuple::Tuple*) for mrpc_tuple "<<std::endl;
117 }
118 else{
119 mrpc_tuple->addItem("run", mrpc_run );
120 mrpc_tuple->addItem("event", mrpc_event );
121 mrpc_tuple->addItem("tofid", mrpc_tofId );
122 mrpc_tuple->addItem("strip", mrpc_strip );
123 mrpc_tuple->addItem("icluster", mrpc_tofTrackId );
124 mrpc_tuple->addItem("ttch1", mrpc_ttch1 );
125 mrpc_tuple->addItem("tlch1", mrpc_tlch1 );
126 mrpc_tuple->addItem("ttch2", mrpc_ttch2 );
127 mrpc_tuple->addItem("tlch2", mrpc_tlch2 );
128 mrpc_tuple->addItem("tt1", mrpc_tt1 );
129 mrpc_tuple->addItem("tl1", mrpc_tl1 );
130 mrpc_tuple->addItem("tt2", mrpc_tt2 );
131 mrpc_tuple->addItem("tl2", mrpc_tl2 );
132 mrpc_tuple->addItem("tot1", mrpc_tot1 );
133 mrpc_tuple->addItem("tot2", mrpc_tot2 );
134 mrpc_tuple->addItem("qual", mrpc_quality );
135 mrpc_tuple->addItem("tmatched", mrpc_tmatched );
136 mrpc_tuple->addItem("tttimes1", mrpc_tttimes1 );
137 mrpc_tuple->addItem("tltimes1", mrpc_tltimes1 );
138 mrpc_tuple->addItem("tttimes2", mrpc_tttimes2 );
139 mrpc_tuple->addItem("tltimes2", mrpc_tltimes2 );
140 mrpc_tuple->addItem("times1", mrpc_times1 );
141 mrpc_tuple->addItem("times2", mrpc_times2 );
142 mrpc_tuple->addItem("times", mrpc_times );
143 mrpc_tuple->addItem("ttnum1", mrpc_ttnum1 );
144 mrpc_tuple->addItem("tlnum1", mrpc_tlnum1 );
145 mrpc_tuple->addItem("ttnum2", mrpc_ttnum2 );
146 mrpc_tuple->addItem("tlnum2", mrpc_tlnum2 );
147 mrpc_tuple->addItem("tsum", mrpc_tsum );
148 mrpc_tuple->addItem("tsub", mrpc_tsub );
149 mrpc_tuple->addItem("ztdc", mrpc_ztdc );
150 mrpc_tuple->addItem("zadc", mrpc_zadc );
151 mrpc_tuple->addItem("t0", mrpc_t0 );
152 mrpc_tuple->addItem("t0stat", mrpc_t0stat );
153 }
154
155 if(!ext_tuple) {
156 std::cerr<<" Error: invalid pionter in TofCheckDigi(NTuple::Tuple*) for ext_tple"<<std::endl;
157 }
158 else{
159 ext_tuple->addItem("run", ext_run );
160 ext_tuple->addItem("event", ext_event );
161 ext_tuple->addItem("track", ext_trackid );
162 ext_tuple->addItem("costheta", ext_costheta );
163 ext_tuple->addItem("kal", 5, ext_kalman );
164 ext_tuple->addItem("x1", 5, ext_x1 );
165 ext_tuple->addItem("x2", 5, ext_x2 );
166 ext_tuple->addItem("y1", 5, ext_y1 );
167 ext_tuple->addItem("y2", 5, ext_y2 );
168 ext_tuple->addItem("z1", 5, ext_z1 );
169 ext_tuple->addItem("z2", 5, ext_z2 );
170 ext_tuple->addItem("tofid1", 5, ext_tofid1 );
171 ext_tuple->addItem("tofid2", 5, ext_tofid2 );
172 ext_tuple->addItem("strip1", 5, ext_strip1 );
173 ext_tuple->addItem("strip2", 5, ext_strip2 );
174 ext_tuple->addItem("texp1", 5, ext_texp1 );
175 ext_tuple->addItem("texp2", 5, ext_texp2 );
176 ext_tuple->addItem("p", ext_p );
177 ext_tuple->addItem("path1", 5, ext_path1 );
178 ext_tuple->addItem("path2", 5, ext_path2 );
179 ext_tuple->addItem("zrhit1", 5, ext_zrhit1 );
180 ext_tuple->addItem("zrhit2", 5, ext_zrhit2 );
181 ext_tuple->addItem("errzr1", 5, ext_errzr1 );
182 ext_tuple->addItem("errzr2", 5, ext_errzr2 );
183 ext_tuple->addItem("cost1", 5, ext_theta1 );
184 ext_tuple->addItem("cost2", 5, ext_theta2 );
185 ext_tuple->addItem("phi1", 5, ext_phi1 );
186 ext_tuple->addItem("phi2", 5, ext_phi2 );
187 ext_tuple->addItem("hitcase1", 5, ext_hitcase1 );
188 ext_tuple->addItem("hitcase2", 5, ext_hitcase2 );
189 ext_tuple->addItem("hitcase", 5, ext_hitcase );
190 ext_tuple->addItem("qual", 5, ext_quality );
191 }
192
193 if(!tof_tuple) {
194 std::cerr<<" Error: invalid pionter in TofCheckDigi(NTuple::Tuple*) for tof_tple"<<std::endl;
195 }
196 else{
197 tof_tuple->addItem("run", tof_run );
198 tof_tuple->addItem("event", tof_event );
199 tof_tuple->addItem("toftrack", tof_toftrackid );
200 tof_tuple->addItem("track", tof_trackid );
201 tof_tuple->addItem("charge", tof_charge );
202 tof_tuple->addItem("pt", 5, tof_pt );
203 tof_tuple->addItem("p", 5, tof_p );
204 tof_tuple->addItem("id1", tof_id1 );
205 tof_tuple->addItem("id2", tof_id2 );
206 tof_tuple->addItem("istrip1", tof_istrip1 );
207 tof_tuple->addItem("istrip2", tof_istrip2 );
208 tof_tuple->addItem("dstrip1", tof_dstrip1 );
209 tof_tuple->addItem("dstrip2", tof_dstrip2 );
210 tof_tuple->addItem("barrel", tof_barrel );
211 tof_tuple->addItem("hitcase", tof_hitcase );
212 tof_tuple->addItem("mom", tof_momentum );
213 tof_tuple->addItem("path1", tof_path1 );
214 tof_tuple->addItem("path2", tof_path2 );
215 tof_tuple->addItem("zrhit1", tof_zrhit1 );
216 tof_tuple->addItem("zrhit2", tof_zrhit2 );
217 tof_tuple->addItem("errzr1", tof_errzr1 );
218 tof_tuple->addItem("errzr2", tof_errzr2 );
219 tof_tuple->addItem("xhit1", tof_xhit1 );
220 tof_tuple->addItem("yhit1", tof_yhit1 );
221 tof_tuple->addItem("xhit2", tof_xhit2 );
222 tof_tuple->addItem("yhit2", tof_yhit2 );
223 tof_tuple->addItem("kal", 5, tof_kal );
224 tof_tuple->addItem("zr1", 5, tof_zr1 );
225 tof_tuple->addItem("zr2", 5, tof_zr2 );
226 tof_tuple->addItem("ztdc1", tof_ztdc1 );
227 tof_tuple->addItem("ztdc2", tof_ztdc2 );
228 tof_tuple->addItem("zadc1", tof_zadc1 );
229 tof_tuple->addItem("zadc2", tof_zadc2 );
230 tof_tuple->addItem("zt1", tof_zt1 );
231 tof_tuple->addItem("zt2", tof_zt2 );
232 tof_tuple->addItem("zt3", tof_zt3 );
233 tof_tuple->addItem("zt4", tof_zt4 );
234 tof_tuple->addItem("zq1", tof_zq1 );
235 tof_tuple->addItem("zq2", tof_zq2 );
236 tof_tuple->addItem("zq3", tof_zq3 );
237 tof_tuple->addItem("zq4", tof_zq4 );
238 tof_tuple->addItem("size1", tof_size1 );
239 tof_tuple->addItem("size2", tof_size2 );
240 tof_tuple->addItem("size3", tof_size3 );
241 tof_tuple->addItem("size4", tof_size4 );
242 tof_tuple->addItem("theta1", tof_theta1 );
243 tof_tuple->addItem("theta2", tof_theta2 );
244 tof_tuple->addItem("phi1", tof_phi1 );
245 tof_tuple->addItem("phi2", tof_phi2 );
246 tof_tuple->addItem("qual1", tof_quality1 );
247 tof_tuple->addItem("qual2", tof_quality2 );
248 tof_tuple->addItem("qual", tof_quality );
249 tof_tuple->addItem("change", tof_changed );
250 tof_tuple->addItem("tofid1", tof_tofid1 );
251 tof_tuple->addItem("tofid2", tof_tofid2 );
252 tof_tuple->addItem("strip1", tof_strip1 );
253 tof_tuple->addItem("strip2", tof_strip2 );
254 tof_tuple->addItem("board1", tof_board1 );
255 tof_tuple->addItem("board2", tof_board2 );
256 tof_tuple->addItem("crate1", tof_crate1 );
257 tof_tuple->addItem("crate2", tof_crate2 );
258 tof_tuple->addItem("fee1", tof_fee1 );
259 tof_tuple->addItem("fee2", tof_fee2 );
260 tof_tuple->addItem("channel1", tof_channel1 );
261 tof_tuple->addItem("channel2", tof_channel2 );
262 tof_tuple->addItem("channel3", tof_channel3 );
263 tof_tuple->addItem("channel4", tof_channel4 );
264 tof_tuple->addItem("ph11", tof_ph11 );
265 tof_tuple->addItem("ph12", tof_ph12 );
266 tof_tuple->addItem("ph21", tof_ph21 );
267 tof_tuple->addItem("ph22", tof_ph22 );
268 tof_tuple->addItem("ph1", tof_ph1 );
269 tof_tuple->addItem("ph2", tof_ph2 );
270 tof_tuple->addItem("ph", tof_ph );
271 tof_tuple->addItem("tofe11", tof_tofe11 );
272 tof_tuple->addItem("tofe12", tof_tofe12 );
273 tof_tuple->addItem("tofe21", tof_tofe21 );
274 tof_tuple->addItem("tofe22", tof_tofe22 );
275 tof_tuple->addItem("tofe1", tof_tofe1 );
276 tof_tuple->addItem("tofe2", tof_tofe2 );
277 tof_tuple->addItem("tofe", tof_tofe );
278 tof_tuple->addItem("tofmu11", tof_tofmu11 );
279 tof_tuple->addItem("tofmu12", tof_tofmu12 );
280 tof_tuple->addItem("tofmu21", tof_tofmu21 );
281 tof_tuple->addItem("tofmu22", tof_tofmu22 );
282 tof_tuple->addItem("tofmu1", tof_tofmu1 );
283 tof_tuple->addItem("tofmu2", tof_tofmu2 );
284 tof_tuple->addItem("tofmu", tof_tofmu );
285 tof_tuple->addItem("tofpi11", tof_tofpi11 );
286 tof_tuple->addItem("tofpi12", tof_tofpi12 );
287 tof_tuple->addItem("tofpi21", tof_tofpi21 );
288 tof_tuple->addItem("tofpi22", tof_tofpi22 );
289 tof_tuple->addItem("tofpi1", tof_tofpi1 );
290 tof_tuple->addItem("tofpi2", tof_tofpi2 );
291 tof_tuple->addItem("tofpi", tof_tofpi );
292 tof_tuple->addItem("tofk11", tof_tofk11 );
293 tof_tuple->addItem("tofk12", tof_tofk12 );
294 tof_tuple->addItem("tofk21", tof_tofk21 );
295 tof_tuple->addItem("tofk22", tof_tofk22 );
296 tof_tuple->addItem("tofk1", tof_tofk1 );
297 tof_tuple->addItem("tofk2", tof_tofk2 );
298 tof_tuple->addItem("tofk", tof_tofk );
299 tof_tuple->addItem("tofp11", tof_tofp11 );
300 tof_tuple->addItem("tofp12", tof_tofp12 );
301 tof_tuple->addItem("tofp21", tof_tofp21 );
302 tof_tuple->addItem("tofp22", tof_tofp22 );
303 tof_tuple->addItem("tofp1", tof_tofp1 );
304 tof_tuple->addItem("tofp2", tof_tofp2 );
305 tof_tuple->addItem("tofp", tof_tofp );
306 tof_tuple->addItem("qch1", tof_qch1 );
307 tof_tuple->addItem("qch2", tof_qch2 );
308 tof_tuple->addItem("qch3", tof_qch3 );
309 tof_tuple->addItem("qch4", tof_qch4 );
310 tof_tuple->addItem("adc1", tof_adc1 );
311 tof_tuple->addItem("adc2", tof_adc2 );
312 tof_tuple->addItem("adc3", tof_adc3 );
313 tof_tuple->addItem("adc4", tof_adc4 );
314 tof_tuple->addItem("tdc1", tof_tdc1 );
315 tof_tuple->addItem("tdc2", tof_tdc2 );
316 tof_tuple->addItem("tdc3", tof_tdc3 );
317 tof_tuple->addItem("tdc4", tof_tdc4 );
318 tof_tuple->addItem("texpe1", tof_texpe1 );
319 tof_tuple->addItem("texpmu1", tof_texpmu1 );
320 tof_tuple->addItem("texppi1", tof_texppi1 );
321 tof_tuple->addItem("texpk1", tof_texpk1 );
322 tof_tuple->addItem("texpp1", tof_texpp1 );
323 tof_tuple->addItem("texpe2", tof_texpe2 );
324 tof_tuple->addItem("texpmu2", tof_texpmu2 );
325 tof_tuple->addItem("texppi2", tof_texppi2 );
326 tof_tuple->addItem("texpk2", tof_texpk2 );
327 tof_tuple->addItem("texpp2", tof_texpp2 );
328 tof_tuple->addItem("texpe", tof_texpe );
329 tof_tuple->addItem("texpmu", tof_texpmu );
330 tof_tuple->addItem("texppi", tof_texppi );
331 tof_tuple->addItem("texpk", tof_texpk );
332 tof_tuple->addItem("texpp", tof_texpp );
333 tof_tuple->addItem("tdiff1", tof_tdiff1 );
334 tof_tuple->addItem("tdiff2", tof_tdiff2 );
335 tof_tuple->addItem("trigcond", tof_trigcond );
336 tof_tuple->addItem("trigchan", tof_trigchan );
337 tof_tuple->addItem("trigwindow", tof_trigwindow );
338 tof_tuple->addItem("trigtype", tof_trigtype );
339 tof_tuple->addItem("t0", tof_estime );
340 tof_tuple->addItem("t0stat", tof_t0stat );
341 tof_tuple->addItem("mctrkid", tof_mctrkid );
342 tof_tuple->addItem("mcp", tof_mcp );
343 tof_tuple->addItem("mctofp", tof_mctofp );
344 tof_tuple->addItem("mczrhit", tof_mczrhit );
345 tof_tuple->addItem("mcpath", tof_mcpath );
346 tof_tuple->addItem("mctexp", tof_mctexp );
347 }
348
349 if(!bb_tuple) {
350 std::cerr<<" Error: invalid pionter in TofCheckDigi(NTuple::Tuple*) for bb_tple"<<std::endl;
351 }
352 else{
353 bb_tuple->addItem("run", bb_run );
354 bb_tuple->addItem("event", bb_event );
355 bb_tuple->addItem("trksize", bb_trksize );
356 bb_tuple->addItem("mdcsize", bb_mdcsize );
357 bb_tuple->addItem("emcsize", bb_emcsize );
358 bb_tuple->addItem("trk1", bb_trk1 );
359 bb_tuple->addItem("pmdc1", bb_pmdc1 );
360 bb_tuple->addItem("ptmdc1", bb_ptmdc1 );
361 bb_tuple->addItem("theta1", bb_theta1 );
362 bb_tuple->addItem("phi1", bb_phi1 );
363 bb_tuple->addItem("x1", bb_x1 );
364 bb_tuple->addItem("y1", bb_y1 );
365 bb_tuple->addItem("z1", bb_z1 );
366 bb_tuple->addItem("r1", bb_r1 );
367 bb_tuple->addItem("charge1", bb_charge1 );
368 bb_tuple->addItem("chi1", bb_chi1 );
369 bb_tuple->addItem("ndof1", bb_ndof1 );
370 bb_tuple->addItem("layer1", bb_layer1 );
371 bb_tuple->addItem("trk2", bb_trk2 );
372 bb_tuple->addItem("pmdc2", bb_pmdc2 );
373 bb_tuple->addItem("ptmdc2", bb_ptmdc2 );
374 bb_tuple->addItem("theta2", bb_theta2 );
375 bb_tuple->addItem("phi2", bb_phi2 );
376 bb_tuple->addItem("x2", bb_x2 );
377 bb_tuple->addItem("y2", bb_y2 );
378 bb_tuple->addItem("z2", bb_z2 );
379 bb_tuple->addItem("r2", bb_r2 );
380 bb_tuple->addItem("charge2", bb_charge2 );
381 bb_tuple->addItem("chi2", bb_chi2 );
382 bb_tuple->addItem("ndof2", bb_ndof2 );
383 bb_tuple->addItem("layer2", bb_layer2 );
384 bb_tuple->addItem("dang", bb_dang );
385 bb_tuple->addItem("dphi", bb_dphi );
386 bb_tuple->addItem("pe1", bb_pe1 );
387 bb_tuple->addItem("pte1", bb_pte1 );
388 bb_tuple->addItem("pe2", bb_pe2 );
389 bb_tuple->addItem("pte2", bb_pte2 );
390 bb_tuple->addItem("pmu1", bb_pmu1 );
391 bb_tuple->addItem("ptmu1", bb_ptmu1 );
392 bb_tuple->addItem("pmu2", bb_pmu2 );
393 bb_tuple->addItem("ptmu2", bb_ptmu2 );
394 bb_tuple->addItem("extx1", bb_extx1 );
395 bb_tuple->addItem("exty1", bb_exty1 );
396 bb_tuple->addItem("extz1", bb_extz1 );
397 bb_tuple->addItem("extx2", bb_extx2 );
398 bb_tuple->addItem("exty2", bb_exty2 );
399 bb_tuple->addItem("extz2", bb_extz2 );
400 bb_tuple->addItem("emctrk1", bb_emctrk1 );
401 bb_tuple->addItem("emcx1", bb_emcx1 );
402 bb_tuple->addItem("emcy1", bb_emcy1 );
403 bb_tuple->addItem("emcz1", bb_emcz1 );
404 bb_tuple->addItem("ep1", bb_ep1 );
405 bb_tuple->addItem("th1", bb_th1 );
406 bb_tuple->addItem("ph1", bb_ph1 );
407 bb_tuple->addItem("emctrk2", bb_emctrk2 );
408 bb_tuple->addItem("emcx2", bb_emcx2 );
409 bb_tuple->addItem("emcy2", bb_emcy2 );
410 bb_tuple->addItem("emcz2", bb_emcz2 );
411 bb_tuple->addItem("ep2", bb_ep2 );
412 bb_tuple->addItem("th2", bb_th2 );
413 bb_tuple->addItem("ph2", bb_ph2 );
414 bb_tuple->addItem("dr1", bb_dr1 );
415 bb_tuple->addItem("drxy1", bb_drxy1 );
416 bb_tuple->addItem("dz1", bb_dz1 );
417 bb_tuple->addItem("dr2", bb_dr2 );
418 bb_tuple->addItem("drxy2", bb_drxy2 );
419 bb_tuple->addItem("dz2", bb_dz2 );
420 bb_tuple->addItem("etot", bb_etot );
421 }
422
423 return;
424}
425
426
427void TofCheckDigi::FillCol(Event::EventHeader& eventHeader, TofDigiCol& tofDigiCol, double estime, int t0stat ) {
428 if( tofDigiCol.size() <= 0 ) return;
429 TofDigiCol::iterator iter_digi = tofDigiCol.begin();
430 for( ; iter_digi!=tofDigiCol.end(); iter_digi++ ) {
431 unsigned int overflow = (*iter_digi)->getOverflow();
432 if( ( overflow & 0xfe000000 ) == 0xfe000000 ) {
433 if( digi_tuple ) {
434 digi_run = eventHeader.runNumber();
435 digi_event = eventHeader.eventNumber();
436 digi_barrel = -1;
437 digi_endcap = -1;
438 digi_layer = -1;
439 digi_tofId = -1;
440 digi_strip = -1;
441 digi_end = -1;
442 digi_adc = 0x7fffffff; // adc 13bits
443 digi_tdc = 0x7fffffff;
444 digi_qclock = 1000.0;
445 digi_tclock = 1000.0;
446 digi_overflow = overflow;
447 digi_noq = -1;
448 digi_not = -1;
449 digi_multiq = -1;
450 digi_multit = -1;
451 digi_overq = -1;
452 digi_overt = -1;
453 digi_t0 = -1;
454 digi_t0stat = -1;
455 digi_crate = ( ( overflow &0x1000000 ) >> 24 );
456 digi_geo = ( ( overflow &0x0f80000 ) >> 19 );
457 digi_tdcnum = ( ( overflow &0x0078000 ) >> 15 );
458 digi_err = ( overflow &0x0007fff );
459 digi_tuple->write();
460 }
461 }
462 else {
463 Identifier iden = (*iter_digi)->identify();
464 unsigned int adc = (*iter_digi)->getChargeChannel();
465 unsigned int tdc = (*iter_digi)->getTimeChannel();
466 if( digi_tuple ) {
467 digi_run = eventHeader.runNumber();
468 digi_event = eventHeader.eventNumber();
469 digi_barrel = TofID::barrel_ec(iden);
470 digi_endcap = TofID::endcap(iden);
471 digi_layer = TofID::layer(iden);
472 digi_strip = TofID::strip(iden);
473 digi_end = TofID::end(iden);
474 if( TofID::is_scin(iden) ) {
475 digi_tofId = TofID::phi_module(iden);
476 digi_adc = ( adc & 0x1fff ); // adc 13bits
477 }
478 if( TofID::is_mrpc(iden) ) {
479 digi_tofId = TofID::module(iden);
480 digi_adc = adc;
481 }
482 if( adc == 0x7fffffff ) digi_adc = adc;
483 digi_tdc = tdc;
484 digi_qclock = ( ( adc & 0x7e000 ) >> 13 ); // adc high 6 bits, time clock
485 if( adc == 0x7fffffff ) digi_qclock = 1000.;
486 digi_tclock = ( ( tdc & 0x7e000 ) >> 13 ); // tdc high 6 bits, time clock
487 if( tdc == 0x7fffffff ) digi_tclock = 1000.;
488 digi_overflow = overflow;
489 digi_noq = ( ( overflow & 0x20 ) >> 5 );
490 digi_not = ( ( overflow & 0x10 ) >> 4 );
491 digi_multiq = ( ( overflow & 0x08 ) >> 3 );
492 digi_multit = ( ( overflow & 0x04 ) >> 2 );
493 digi_overq = ( ( overflow & 0x02 ) >> 1 );
494 digi_overt = ( overflow & 0x01 );
495 digi_t0 = estime;
496 digi_t0stat = t0stat;
497 digi_crate = -1;
498 digi_geo = -1;
499 digi_tdcnum = -1;
500 digi_tdcnum = -1;
501 digi_err = -1;
502 digi_tuple->write();
503 }
504 }
505 }
506
507 return;
508}
509
510
511void TofCheckDigi::Fill_Barrel(Event::EventHeader& eventHeader, TofData*& bTof, double estime, int t0stat ) {
512 barrel_run = eventHeader.runNumber();
513 barrel_event = eventHeader.eventNumber();
514 barrel_tofId = bTof->tofId();
515 barrel_tofTrackId = bTof->tofTrackId();
516 barrel_layer = bTof->layer();
517 barrel_qchannel1 = bTof->adcChannelEast();
518 barrel_tchannel1 = bTof->tdcChannelEast();
519 barrel_qchannel2 = bTof->adcChannelWest();
520 barrel_tchannel2 = bTof->tdcChannelWest();
521 barrel_qtc1 = bTof->qtc1();
522 barrel_adc1 = bTof->adc1();
523 barrel_tdc1 = bTof->tdc1();
524 barrel_qtc2 = bTof->qtc2();
525 barrel_adc2 = bTof->adc2();
526 barrel_tdc2 = bTof->tdc2();
527 barrel_qclock1 = bTof->qclock1();
528 barrel_tclock1 = bTof->tclock1();
529 barrel_qclock2 = bTof->qclock2();
530 barrel_tclock2 = bTof->tclock2();
531 barrel_quality = bTof->quality();
532 barrel_tmatched = bTof->tmatched();
533 barrel_qtimes1 = bTof->qtimes1();
534 barrel_ttimes1 = bTof->ttimes1();
535 barrel_qtimes2 = bTof->qtimes2();
536 barrel_ttimes2 = bTof->ttimes2();
537 barrel_times1 = bTof->eastTimes();
538 barrel_times2 = bTof->westTimes();
539 barrel_times = bTof->times();
540 barrel_qnum1 = bTof->qnumber1();
541 barrel_tnum1 = bTof->tnumber1();
542 barrel_qnum2 = bTof->qnumber2();
543 barrel_tnum2 = bTof->tnumber2();
544 barrel_tsum = ( bTof->tdc1() + bTof->tdc2() )/2.0;
545 barrel_tsub = ( bTof->tdc1() - bTof->tdc2() )/2.0;
546 barrel_ztdc = tofCaliSvc->ZTDC( bTof->tdc1(), bTof->tdc2(), bTof->tofId() );
547 barrel_zadc = tofCaliSvc->ZADC( bTof->adc1(), bTof->adc2(), bTof->tofId() );
548 barrel_t0 = estime;
549 barrel_t0stat = t0stat;
550 barrel_tuple->write();
551 return;
552}
553
554
555void TofCheckDigi::Fill_Endcap(Event::EventHeader& eventHeader, TofData*& eTof, double estime, int t0stat) {
556 endcap_run = eventHeader.runNumber();
557 endcap_event = eventHeader.eventNumber();
558 endcap_tofId = eTof->tofId();
559 endcap_tofTrackId = eTof->tofTrackId();
560 endcap_qchannel = eTof->adcChannel();
561 endcap_tchannel = eTof->tdcChannel();
562 endcap_qtc = eTof->qtc();
563 endcap_adc = eTof->adc();
564 endcap_tdc = eTof->tdc();
565 endcap_quality = eTof->quality();
566 endcap_qclock = eTof->qclock();
567 endcap_tclock = eTof->tclock();
568 endcap_qtimes = eTof->qtimes1();
569 endcap_ttimes = eTof->ttimes1();
570 endcap_times = eTof->times();
571 endcap_qnum = eTof->qnumber1();
572 endcap_tnum = eTof->tnumber1();
573 endcap_t0 = estime;
574 endcap_t0stat = t0stat;
575 endcap_tuple->write();
576 return;
577}
578
579
580void TofCheckDigi::Fill_MRPC(Event::EventHeader& eventHeader, TofData*& mrpcTof, double estime, int t0stat) {
581 mrpc_run = eventHeader.runNumber();
582 mrpc_event = eventHeader.eventNumber();
583 mrpc_tofId = mrpcTof->tofId();
584 mrpc_strip = mrpcTof->strip();
585 mrpc_tofTrackId = mrpcTof->tofTrackId();
586 mrpc_ttch1 = mrpcTof->adcChannelEast();
587 mrpc_tlch1 = mrpcTof->tdcChannelEast();
588 mrpc_ttch2 = mrpcTof->adcChannelWest();
589 mrpc_tlch2 = mrpcTof->tdcChannelWest();
590 mrpc_tt1 = mrpcTof->qtc1();
591 mrpc_tl1 = mrpcTof->tdc1();
592 mrpc_tt2 = mrpcTof->qtc2();
593 mrpc_tl2 = mrpcTof->tdc2();
594 mrpc_tot1 = mrpcTof->adc1();
595 mrpc_tot2 = mrpcTof->adc2();
596 mrpc_quality = mrpcTof->quality();
597 mrpc_tmatched = mrpcTof->tmatched();
598 mrpc_tttimes1 = mrpcTof->qtimes1();
599 mrpc_tltimes1 = mrpcTof->ttimes1();
600 mrpc_tttimes2 = mrpcTof->qtimes2();
601 mrpc_tltimes2 = mrpcTof->ttimes2();
602 mrpc_times1 = mrpcTof->eastTimes();
603 mrpc_times2 = mrpcTof->westTimes();
604 mrpc_times = mrpcTof->times();
605 mrpc_ttnum1 = mrpcTof->qnumber1();
606 mrpc_tlnum1 = mrpcTof->tnumber1();
607 mrpc_ttnum2 = mrpcTof->qnumber2();
608 mrpc_tlnum2 = mrpcTof->tnumber2();
609 mrpc_tsum = ( mrpcTof->tdc1() + mrpcTof->tdc2() )/2.0;
610 mrpc_tsub = ( mrpcTof->tdc1() - mrpcTof->tdc2() )/2.0;
611 mrpc_ztdc = tofCaliSvc->ZTDC( mrpcTof->tdc1(), mrpcTof->tdc2(), mrpcTof->tofId() );
612 mrpc_zadc = tofCaliSvc->ZADC( mrpcTof->adc1(), mrpcTof->adc2(), mrpcTof->tofId() );
613 mrpc_t0 = estime;
614 mrpc_t0stat = t0stat;
615 mrpc_tuple->write();
616 return;
617}
618
619
620void TofCheckDigi::FillCol(Event::EventHeader& eventHeader, TofDataMap& tofDataMap, double estime, int t0stat) {
621 if( tofDataMap.empty() ) return;
622 IterTofDataMap iter = tofDataMap.begin();
623 for( ; iter != tofDataMap.end(); iter++ ) {
624 Identifier iden = TofID::cell_id( (*iter).first );
625 if( TofID::is_scin( iden ) ) {
626 if( TofID::is_barrel( iden ) ) {
627 Fill_Barrel( eventHeader, (*iter).second, estime, t0stat );
628 }
629 else {
630 Fill_Endcap( eventHeader, (*iter).second, estime, t0stat );
631 }
632 }
633 if( TofID::is_mrpc( iden ) ) {
634 Fill_MRPC( eventHeader, (*iter).second, estime, t0stat );
635 }
636 }
637 return;
638}
639
640
641void TofCheckDigi::FillCol(Event::EventHeader& eventHeader, std::vector<TofData*>& tofDataVec, double estime, int t0stat) {
642 if( tofDataVec.size() <= 0 ) return;
643 std::vector<TofData*>::iterator iter = tofDataVec.begin();
644 for( ; iter != tofDataVec.end(); iter++ ) {
645 if( (*iter)->barrel() ) {
646 Fill_Barrel( eventHeader, (*iter), estime, t0stat );
647 }
648 else {
649 Fill_Endcap( eventHeader, (*iter), estime, t0stat );
650 }
651 }
652 return;
653}
654
655
656void TofCheckDigi::Fill(Event::EventHeader& eventHeader, RecMdcTrack*& mdcTrack, RecMdcKalTrack*& mdcKalTrack, RecExtTrack*& extTrack ) {
657
658 ext_run = eventHeader.runNumber();
659 ext_event = eventHeader.eventNumber();
660 ext_trackid = extTrack->trackId();
661 ext_p = mdcTrack->p();
662 ext_costheta= cos( mdcTrack->theta() );
663
664 int hitcase1[5], hitcase2[5], hitcase[5];
665 int tofId1[5], tofId2[5];
666
667 for( unsigned int i=0; i<5; i++ ) {
668
669 ext_tofid1[i] = -9;
670 ext_tofid2[i] = -9;
671 ext_strip1[i] = -9;
672 ext_strip2[i] = -9;
673 ext_zrhit1[i] = -99.;
674 ext_zrhit2[i] = -99.;
675 ext_x1[i] = -999.;
676 ext_x2[i] = -999.;
677 ext_y1[i] = -999.;
678 ext_y2[i] = -999.;
679 ext_z1[i] = -999.;
680 ext_z2[i] = -999.;
681
682 hitcase1[i] = 7;
683 hitcase2[i] = 7;
684 hitcase[i] = 7;
685
686 ext_kalman[i] = mdcKalTrack->getStat( 1, i );
687 ext_x1[i] = (extTrack->tof1Position(i)).x();
688 ext_x2[i] = (extTrack->tof2Position(i)).x();
689 ext_y1[i] = (extTrack->tof1Position(i)).y();
690 ext_y2[i] = (extTrack->tof2Position(i)).y();
691 ext_z1[i] = (extTrack->tof1Position(i)).z();
692 ext_z2[i] = (extTrack->tof2Position(i)).z();
693
694 tofId1[i] = extTrack->tof1VolumeNumber( i );
695 tofId2[i] = extTrack->tof2VolumeNumber( i );
696
697 if( tofId1[i]>=0 && tofId1[i]<=87 ) {
698 ext_tofid1[i] = tofId1[i];
699 hitcase1[i] = 0;
700 }
701 else if( tofId1[i]>=176 && tofId1[i]<=223 ) {
702 ext_tofid1[i] = tofId1[i] - 176 + 48;
703 hitcase1[i] = 4;
704 }
705 else if( tofId1[i]>=224 && tofId1[i]<=271 ) {
706 ext_tofid1[i] = tofId1[i] - 176 - 48;
707 hitcase1[i] = 3;
708 }
709 else if( tofId1[i]>=272 && tofId1[i]<=1135 ) {
710 int module = tofId1[i] - 176 - 96;
711 ext_strip1[i] = module%12;
712 ext_tofid1[i] = module/12;
713 if( tofId1[i]>=272 && tofId1[i]<=703 ) {
714 hitcase1[i] = 5;
715 }
716 else if( tofId1[i]>=704 && tofId1[i]<=1135 ) {
717 hitcase1[i] = 6;
718 }
719 }
720
721 if( tofId2[i]>=88 && tofId2[i]<=175 ) {
722 ext_tofid2[i] = tofId2[i];
723 hitcase2[i] = 1;
724 }
725 else if( tofId2[i]>=272 && tofId2[i]<=1135 ) {
726 int module = tofId2[i] - 176 - 96;
727 ext_strip2[i] = module%12;
728 ext_tofid2[i] = module/12;
729 if( tofId2[i]>=272 && tofId2[i]<=703 ) {
730 hitcase2[i] = 5;
731 }
732 else if( tofId2[i]>=704 && tofId2[i]<=1135 ) {
733 hitcase2[i] = 6;
734 }
735 }
736
737 /*
738 ext_p[i] = extTrack->tof1Momentum( i ).r();
739 if( tofId1[i]<0 ) {
740 ext_p[i] = extTrack->tof2Momentum( i ).r();
741 }
742 */
743
744 if( ( hitcase1[i] == 0 ) || ( hitcase1[i] == 2 ) ) {
745 ext_texp1[i] = extTrack->tof1( i );
746 ext_path1[i] = extTrack->tof1Path( i );
747 ext_zrhit1[i] = extTrack->tof1Position( i ).z();
748 ext_errzr1[i] = extTrack->tof1PosSigmaAlongZ( i );
749 ext_theta1[i] = extTrack->tof1Momentum( i ).rho()/extTrack->tof1Momentum( i ).r();
750 ext_phi1[i] = extTrack->tof1Position( i ).phi();
751 }
752 else if( ( hitcase1[i] == 3 ) || ( hitcase1[i] == 4 ) ) {
753 ext_texp1[i] = extTrack->tof1( i );
754 ext_path1[i] = extTrack->tof1Path( i );
755 ext_zrhit1[i] = extTrack->tof1Position( i ).rho();
756 ext_errzr1[i] = sqrt( extTrack->tof1PosSigmaAlongX( i )*extTrack->tof1PosSigmaAlongX( i ) + extTrack->tof1PosSigmaAlongY( i )*extTrack->tof1PosSigmaAlongY( i ) );
757 ext_theta1[i] = extTrack->tof1Momentum( i ).z()/extTrack->tof1Momentum( i ).r();
758 ext_phi1[i] = extTrack->tof1Position( i ).phi();
759 }
760 else if( ( hitcase1[i] == 5 ) || ( hitcase1[i] == 6 ) ) {
761 ext_texp1[i] = extTrack->tof1( i );
762 ext_path1[i] = extTrack->tof1Path( i );
763 ext_zrhit1[i] = extTrack->tof1Position( i ).x();
764 ext_errzr1[i] = extTrack->tof1PosSigmaAlongX( i );
765 ext_theta1[i] = extTrack->tof1Momentum( i ).z()/extTrack->tof1Momentum( i ).r();
766 ext_phi1[i] = extTrack->tof1Position( i ).phi();
767 }
768
769 if( ( hitcase2[i] == 5 ) || ( hitcase2[i] == 6 ) ) {
770 ext_texp2[i] = extTrack->tof2( i );
771 ext_path2[i] = extTrack->tof2Path( i );
772 ext_zrhit2[i] = extTrack->tof2Position( i ).x();
773 ext_errzr2[i] = extTrack->tof2PosSigmaAlongX( i );
774 ext_theta1[i] = extTrack->tof2Momentum( i ).z()/extTrack->tof1Momentum( i ).r();
775 ext_phi2[i] = extTrack->tof2Position( i ).phi();
776 }
777 else if( hitcase2[i] == 1 ) {
778 ext_texp2[i] = extTrack->tof2( i );
779 ext_path2[i] = extTrack->tof2Path( i );
780 ext_zrhit2[i] = extTrack->tof2Position( i ).z();
781 ext_errzr2[i] = extTrack->tof2PosSigmaAlongZ( i );
782 ext_theta2[i] = extTrack->tof2Momentum( i ).rho()/extTrack->tof2Momentum( i ).r();
783 ext_phi2[i] = extTrack->tof2Position( i ).phi();
784 }
785
786 if( ( hitcase1[i] == 7 ) && ( hitcase2[i] == 7 ) ) { ext_quality[i] = 3; }
787 else { ext_quality[i] = 0; }
788
789 if( hitcase1[i] == 0 ) {
790 if( hitcase2[i] == 1 ) { hitcase[i] = 2; }
791 else if( hitcase2[i] == 7 ) { hitcase[i] = 0; }
792 }
793 else if( ( hitcase1[i] == 3 ) || ( hitcase1[i] == 4 ) ) {
794 if( hitcase2[i] == 7 ) { hitcase[i] == hitcase1[i]; }
795 }
796 else if( ( hitcase1[i] == 5 ) || ( hitcase1[i] == 6 ) ) {
797 if( hitcase2[i] == 7 ) { hitcase[i] == hitcase1[i]; }
798 }
799
800 if( hitcase2[i] == 1 ) {
801 if( hitcase1[i] == 7 ) { hitcase[i] = 1; }
802 }
803 else if( ( hitcase2[i] == 5 ) || ( hitcase2[i] == 6 ) ) {
804 if( hitcase1[i] == 7 ) { hitcase[i] == hitcase2[i]; }
805 else if( hitcase1[i] == hitcase2[i] ) { hitcase[i] == hitcase2[i]; }
806 }
807
808 ext_hitcase1[i] = hitcase1[i];
809 ext_hitcase2[i] = hitcase2[i];
810 ext_hitcase[i] = hitcase[i];
811 }
812
813 ext_tuple->write();
814
815 return;
816}
817
818
819void TofCheckDigi::Fill_TofTrack(Event::EventHeader& eventHeader, TofTrack*& tof, double estime, int t0stat ) {
820
821 tof_run = eventHeader.runNumber();
822 tof_event = eventHeader.eventNumber();
823 tof_toftrackid = tof->tofTrackId();
824 tof_trackid = tof->trackId();
825 tof_id1 = tof->id1();
826 tof_id2 = tof->id2();
827 tof_istrip1 = tof->istrip1();
828 tof_istrip2 = tof->istrip2();
829 tof_barrel = tof->barrel();
830 tof_hitcase = tof->hitCase();
831 tof_momentum = tof->p();
832 tof_path1 = tof->path1();
833 tof_path2 = tof->path2();
834 tof_zrhit1 = tof->zrhit1();
835 tof_zrhit2 = tof->zrhit2();
836 tof_errzr1 = tof->errzrhit1();
837 tof_errzr2 = tof->errzrhit2();
838 tof_xhit1 = tof->xhit1();
839 tof_yhit1 = tof->yhit1();
840 tof_xhit2 = tof->xhit2();
841 tof_yhit2 = tof->yhit2();
842 for( unsigned int i=0; i<5; i++ ) {
843 tof_kal[i] = tof->kal(i);
844 tof_zr1[i] = tof->zr1(i);
845 tof_zr2[i] = tof->zr2(i);
846 }
847 tof_ztdc1 = tof->ztdc1();
848 tof_ztdc2 = tof->ztdc2();
849 tof_zadc1 = tof->zadc1();
850 tof_zadc2 = tof->zadc2();
851 tof_zt1 = -999.0;
852 tof_zt2 = -999.0;
853 tof_zt3 = -999.0;
854 tof_zt4 = -999.0;
855 tof_zq1 = -999.0;
856 tof_zq2 = -999.0;
857 tof_zq3 = -999.0;
858 tof_zq4 = -999.0;
859 if( tof->hitCase() == 0 || tof->hitCase() == 2 ) {
860 tof_zt1 = tofCaliSvc->ZTDC1( tof->tdc2(), tof->tofId1(), tof->zrhit1() );
861 tof_zt2 = tofCaliSvc->ZTDC2( tof->tdc1(), tof->tofId1(), tof->zrhit1() );
862 tof_zq1 = tofCaliSvc->ZADC1( tof->adc2(), tof->tofId1(), tof->zrhit1() );
863 tof_zq2 = tofCaliSvc->ZADC2( tof->adc1(), tof->tofId1(), tof->zrhit1() );
864 }
865 if( tof->hitCase() == 1 || tof->hitCase() == 2 ) {
866 tof_zt3 = tofCaliSvc->ZTDC1( tof->tdc4(), tof->tofId2(), tof->zrhit2() );
867 tof_zt4 = tofCaliSvc->ZTDC2( tof->tdc3(), tof->tofId2(), tof->zrhit2() );
868 tof_zq3 = tofCaliSvc->ZADC1( tof->adc4(), tof->tofId2(), tof->zrhit2() );
869 tof_zq4 = tofCaliSvc->ZADC2( tof->adc3(), tof->tofId2(), tof->zrhit2() );
870 }
871 tof_size1 = tof->size1();
872 tof_size2 = tof->size2();
873 tof_size3 = tof->size3();
874 tof_size4 = tof->size4();
875 tof_theta1 = tof->theta1();
876 tof_theta2 = tof->theta2();
877 tof_phi1 = tof->phi1();
878 tof_phi2 = tof->phi2();
879 tof_quality1 = tof->quality1();
880 tof_quality2 = tof->quality2();
881 tof_quality = tof->quality();
882 tof_tofid1 = tof->tofId1();
883 tof_tofid2 = tof->tofId2();
884 tof_strip1 = tof->strip1();
885 tof_strip2 = tof->strip2();
886 /*
887 tof_board1 = tofQElecSvc->Board( tof->hitCase()<3, tof->tofId1(), true );
888 tof_board2 = tofQElecSvc->Board( tof->hitCase()<3, tof->tofId2(), true );
889 tof_crate1 = tofQElecSvc->Crate( tof->hitCase()<3, tof->tofId1(), true );
890 tof_crate2 = tofQElecSvc->Crate( tof->hitCase()<3, tof->tofId2(), true );
891 tof_fee1 = tofQElecSvc->Fee( tof->hitCase()<3, tof->tofId1(), true );
892 tof_fee2 = tofQElecSvc->Fee( tof->hitCase()<3, tof->tofId2(), true );
893 tof_channel1 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId1(),true );
894 tof_channel2 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId1(),false );
895 tof_channel3 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId2(),true );
896 tof_channel4 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId2(),false );
897 */
898 tof_ph11 = tof->ph11();
899 tof_ph12 = tof->ph12();
900 tof_ph21 = tof->ph21();
901 tof_ph22 = tof->ph22();
902 tof_ph1 = tof->ph1();
903 tof_ph2 = tof->ph2();
904 tof_ph = tof->ph();
905 tof_tofe11 = tof->tof11(0);
906 tof_tofe12 = tof->tof12(0);
907 tof_tofe21 = tof->tof21(0);
908 tof_tofe22 = tof->tof22(0);
909 tof_tofe1 = tof->tof1(0);
910 tof_tofe2 = tof->tof2(0);
911 tof_tofe = tof->tof(0);
912 tof_tofmu11 = tof->tof11(1);
913 tof_tofmu12 = tof->tof12(1);
914 tof_tofmu21 = tof->tof21(1);
915 tof_tofmu22 = tof->tof22(1);
916 tof_tofmu1 = tof->tof1(1);
917 tof_tofmu2 = tof->tof2(1);
918 tof_tofmu = tof->tof(1);
919 tof_tofpi11 = tof->tof11(2);
920 tof_tofpi12 = tof->tof12(2);
921 tof_tofpi21 = tof->tof21(2);
922 tof_tofpi22 = tof->tof22(2);
923 tof_tofpi1 = tof->tof1(2);
924 tof_tofpi2 = tof->tof2(2);
925 tof_tofpi = tof->tof(2);
926 tof_tofk11 = tof->tof11(3);
927 tof_tofk12 = tof->tof12(3);
928 tof_tofk21 = tof->tof21(3);
929 tof_tofk22 = tof->tof22(3);
930 tof_tofk1 = tof->tof1(3);
931 tof_tofk2 = tof->tof2(3);
932 tof_tofk = tof->tof(3);
933 tof_tofp11 = tof->tof11(4);
934 tof_tofp12 = tof->tof12(4);
935 tof_tofp21 = tof->tof21(4);
936 tof_tofp22 = tof->tof22(4);
937 tof_tofp1 = tof->tof1(4);
938 tof_tofp2 = tof->tof2(4);
939 tof_tofp = tof->tof(4);
940 tof_qch1 = tof->qch1();
941 tof_qch2 = tof->qch2();
942 tof_qch3 = tof->qch3();
943 tof_qch4 = tof->qch4();
944 tof_adc1 = tof->adc1();
945 tof_adc2 = tof->adc2();
946 tof_adc3 = tof->adc3();
947 tof_adc4 = tof->adc4();
948 tof_tdc1 = tof->tdc1();
949 tof_tdc2 = tof->tdc2();
950 tof_tdc3 = tof->tdc3();
951 tof_tdc4 = tof->tdc4();
952 tof_texpe1 = tof->texpInner(0);
953 tof_texpmu1 = tof->texpInner(1);
954 tof_texppi1 = tof->texpInner(2);
955 tof_texpk1 = tof->texpInner(3);
956 tof_texpp1 = tof->texpInner(4);
957 tof_texpe2 = tof->texpOuter(0);
958 tof_texpmu2 = tof->texpOuter(1);
959 tof_texppi2 = tof->texpOuter(2);
960 tof_texpk2 = tof->texpOuter(3);
961 tof_texpp2 = tof->texpOuter(4);
962 tof_texpe = tof->texp(0);
963 tof_texpmu = tof->texp(1);
964 tof_texppi = tof->texp(2);
965 tof_texpk = tof->texp(3);
966 tof_texpp = tof->texp(4);
967 tof_tdiff1 = tof->tdiff1();
968 tof_tdiff2 = tof->tdiff2();
969 tof_estime = estime;
970 tof_t0stat = t0stat;
971 tof_tuple->write();
972
973 return;
974}
975
976
977void TofCheckDigi::Fill_TofTrack(Event::EventHeader& eventHeader, TofTrack*& tof, double estime, int t0stat, TrigData& trigData ) {
978
979 tof_run = eventHeader.runNumber();
980 tof_event = eventHeader.eventNumber();
981 tof_toftrackid = tof->tofTrackId();
982 tof_trackid = tof->trackId();
983 tof_id1 = tof->id1();
984 tof_id2 = tof->id2();
985 tof_istrip1 = tof->istrip1();
986 tof_istrip2 = tof->istrip2();
987 tof_barrel = tof->barrel();
988 tof_hitcase = tof->hitCase();
989 tof_momentum = tof->p();
990 tof_path1 = tof->path1();
991 tof_path2 = tof->path2();
992 tof_zrhit1 = tof->zrhit1();
993 tof_zrhit2 = tof->zrhit2();
994 tof_errzr1 = tof->errzrhit1();
995 tof_errzr2 = tof->errzrhit2();
996 tof_xhit1 = tof->xhit1();
997 tof_yhit1 = tof->yhit1();
998 tof_xhit2 = tof->xhit2();
999 tof_yhit2 = tof->yhit2();
1000 for( unsigned int i=0; i<5; i++ ) {
1001 tof_kal[i] = tof->kal(i);
1002 tof_zr1[i] = tof->zr1(i);
1003 tof_zr2[i] = tof->zr2(i);
1004 }
1005 tof_ztdc1 = tof->ztdc1();
1006 tof_ztdc2 = tof->ztdc2();
1007 tof_zadc1 = tof->zadc1();
1008 tof_zadc2 = tof->zadc2();
1009 tof_zt1 = -999.0;
1010 tof_zt2 = -999.0;
1011 tof_zt3 = -999.0;
1012 tof_zt4 = -999.0;
1013 tof_zq1 = -999.0;
1014 tof_zq2 = -999.0;
1015 tof_zq3 = -999.0;
1016 tof_zq4 = -999.0;
1017 if( tof->hitCase() == 0 || tof->hitCase() == 2 ) {
1018 tof_zt1 = tofCaliSvc->ZTDC1( tof->tdc2(), tof->tofId1(), tof->zrhit1() );
1019 tof_zt2 = tofCaliSvc->ZTDC2( tof->tdc1(), tof->tofId1(), tof->zrhit1() );
1020 tof_zq1 = tofCaliSvc->ZADC1( tof->adc2(), tof->tofId1(), tof->zrhit1() );
1021 tof_zq2 = tofCaliSvc->ZADC2( tof->adc1(), tof->tofId1(), tof->zrhit1() );
1022 }
1023 if( tof->hitCase() == 1 || tof->hitCase() == 2 ) {
1024 tof_zt3 = tofCaliSvc->ZTDC1( tof->tdc4(), tof->tofId2(), tof->zrhit2() );
1025 tof_zt4 = tofCaliSvc->ZTDC2( tof->tdc3(), tof->tofId2(), tof->zrhit2() );
1026 tof_zq3 = tofCaliSvc->ZADC1( tof->adc4(), tof->tofId2(), tof->zrhit2() );
1027 tof_zq4 = tofCaliSvc->ZADC2( tof->adc3(), tof->tofId2(), tof->zrhit2() );
1028 }
1029 tof_size1 = tof->size1();
1030 tof_size2 = tof->size2();
1031 tof_size3 = tof->size3();
1032 tof_size4 = tof->size4();
1033 tof_theta1 = tof->theta1();
1034 tof_theta2 = tof->theta2();
1035 tof_phi1 = tof->phi1();
1036 tof_phi2 = tof->phi2();
1037 tof_quality1 = tof->quality1();
1038 tof_quality2 = tof->quality2();
1039 tof_quality = tof->quality();
1040 tof_tofid1 = tof->tofId1();
1041 tof_tofid2 = tof->tofId2();
1042 tof_strip1 = tof->strip1();
1043 tof_strip2 = tof->strip2();
1044 /*
1045 tof_board1 = tofQElecSvc->Board( tof->hitCase()<3, tof->tofId1(), true );
1046 tof_board2 = tofQElecSvc->Board( tof->hitCase()<3, tof->tofId2(), true );
1047 tof_crate1 = tofQElecSvc->Crate( tof->hitCase()<3, tof->tofId1(), true );
1048 tof_crate2 = tofQElecSvc->Crate( tof->hitCase()<3, tof->tofId2(), true );
1049 tof_fee1 = tofQElecSvc->Fee( tof->hitCase()<3, tof->tofId1(), true );
1050 tof_fee2 = tofQElecSvc->Fee( tof->hitCase()<3, tof->tofId2(), true );
1051 tof_channel1 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId1(),true );
1052 tof_channel2 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId1(),false );
1053 tof_channel3 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId2(),true );
1054 tof_channel4 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId2(),false );
1055 */
1056 tof_ph11 = tof->ph11();
1057 tof_ph12 = tof->ph12();
1058 tof_ph21 = tof->ph21();
1059 tof_ph22 = tof->ph22();
1060 tof_ph1 = tof->ph1();
1061 tof_ph2 = tof->ph2();
1062 tof_ph = tof->ph();
1063 tof_tofe11 = tof->tof11(0);
1064 tof_tofe12 = tof->tof12(0);
1065 tof_tofe21 = tof->tof21(0);
1066 tof_tofe22 = tof->tof22(0);
1067 tof_tofe1 = tof->tof1(0);
1068 tof_tofe2 = tof->tof2(0);
1069 tof_tofe = tof->tof(0);
1070 tof_tofmu11 = tof->tof11(1);
1071 tof_tofmu12 = tof->tof12(1);
1072 tof_tofmu21 = tof->tof21(1);
1073 tof_tofmu22 = tof->tof22(1);
1074 tof_tofmu1 = tof->tof1(1);
1075 tof_tofmu2 = tof->tof2(1);
1076 tof_tofmu = tof->tof(1);
1077 tof_tofpi11 = tof->tof11(2);
1078 tof_tofpi12 = tof->tof12(2);
1079 tof_tofpi21 = tof->tof21(2);
1080 tof_tofpi22 = tof->tof22(2);
1081 tof_tofpi1 = tof->tof1(2);
1082 tof_tofpi2 = tof->tof2(2);
1083 tof_tofpi = tof->tof(2);
1084 tof_tofk11 = tof->tof11(3);
1085 tof_tofk12 = tof->tof12(3);
1086 tof_tofk21 = tof->tof21(3);
1087 tof_tofk22 = tof->tof22(3);
1088 tof_tofk1 = tof->tof1(3);
1089 tof_tofk2 = tof->tof2(3);
1090 tof_tofk = tof->tof(3);
1091 tof_tofp11 = tof->tof11(4);
1092 tof_tofp12 = tof->tof12(4);
1093 tof_tofp21 = tof->tof21(4);
1094 tof_tofp22 = tof->tof22(4);
1095 tof_tofp1 = tof->tof1(4);
1096 tof_tofp2 = tof->tof2(4);
1097 tof_tofp = tof->tof(4);
1098 tof_qch1 = tof->qch1();
1099 tof_qch2 = tof->qch2();
1100 tof_qch3 = tof->qch3();
1101 tof_qch4 = tof->qch4();
1102 tof_adc1 = tof->adc1();
1103 tof_adc2 = tof->adc2();
1104 tof_adc3 = tof->adc3();
1105 tof_adc4 = tof->adc4();
1106 tof_tdc1 = tof->tdc1();
1107 tof_tdc2 = tof->tdc2();
1108 tof_tdc3 = tof->tdc3();
1109 tof_tdc4 = tof->tdc4();
1110 tof_texpe1 = tof->texpInner(0);
1111 tof_texpmu1 = tof->texpInner(1);
1112 tof_texppi1 = tof->texpInner(2);
1113 tof_texpk1 = tof->texpInner(3);
1114 tof_texpp1 = tof->texpInner(4);
1115 tof_texpe2 = tof->texpOuter(0);
1116 tof_texpmu2 = tof->texpOuter(1);
1117 tof_texppi2 = tof->texpOuter(2);
1118 tof_texpk2 = tof->texpOuter(3);
1119 tof_texpp2 = tof->texpOuter(4);
1120 tof_texpe = tof->texp(0);
1121 tof_texpmu = tof->texp(1);
1122 tof_texppi = tof->texp(2);
1123 tof_texpk = tof->texp(3);
1124 tof_texpp = tof->texp(4);
1125 tof_tdiff1 = tof->tdiff1();
1126 tof_tdiff2 = tof->tdiff2();
1127 unsigned int trigCondition = 0;
1128 for( int i=0 ; i < 48; i++ ) {
1129 trigCondition = ( trigCondition | ( ( trigData.getTrigCondition(i) ) << i ) );
1130 }
1131 tof_trigcond = trigCondition;
1132 unsigned int trigChannel = 0;
1133 for( int i=0 ; i < 16; i++ ) {
1134 trigChannel = ( trigChannel | ( ( trigData.getTrigChannel(i) ) << i ) );
1135 }
1136 tof_trigchan = trigChannel;
1137 tof_trigwindow = trigData.getTimeWindow();
1138 tof_trigtype = trigData.getTimingType();
1139 tof_estime = estime;
1140 tof_t0stat = t0stat;
1141 tof_tuple->write();
1142
1143 return;
1144}
1145
1146
1147void TofCheckDigi::Fill_TofTrack(Event::EventHeader& eventHeader, TofTrack*& tof, double estime, int t0stat, RecMdcKalTrackCol& mdcKalTrackCol ) {
1148
1149 tof_run = eventHeader.runNumber();
1150 tof_event = eventHeader.eventNumber();
1151 tof_toftrackid = tof->tofTrackId();
1152 tof_trackid = tof->trackId();
1153 RecMdcKalTrackCol::iterator iter = mdcKalTrackCol.begin();
1154 for( ; iter != mdcKalTrackCol.end(); iter++ ) {
1155 if( (*iter)->trackId() == tof->trackId() ) {
1156 double kappa = 10000.0;
1157 double tanl = -10000.0;
1158
1159 (*iter)->setPidType( RecMdcKalTrack::electron );
1160 kappa = (*iter)->kappa();
1161 tanl = (*iter)->tanl();
1162 if( kappa>0 ) { tof_charge = 1; }
1163 else { tof_charge = -1; }
1164 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
1165 tof_pt[0] = 1.0/kappa;
1166 tof_p[0] = abs(sqrt(1.0+tanl*tanl)*tof_pt[0]);
1167
1168 (*iter)->setPidType( RecMdcKalTrack::muon );
1169 kappa = (*iter)->kappa();
1170 tanl = (*iter)->tanl();
1171 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
1172 tof_pt[1] = 1.0/kappa;
1173 tof_p[1] = abs(sqrt(1.0+tanl*tanl)*tof_pt[1]);
1174
1175 (*iter)->setPidType( RecMdcKalTrack::pion );
1176 kappa = (*iter)->kappa();
1177 tanl = (*iter)->tanl();
1178 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
1179 tof_pt[2] = 1.0/kappa;
1180 tof_p[2] = abs(sqrt(1.0+tanl*tanl)*tof_pt[2]);
1181
1182 (*iter)->setPidType( RecMdcKalTrack::kaon );
1183 kappa = (*iter)->kappa();
1184 tanl = (*iter)->tanl();
1185 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
1186 tof_pt[3] = 1.0/kappa;
1187 tof_p[3] = abs(sqrt(1.0+tanl*tanl)*tof_pt[3]);
1188
1189 (*iter)->setPidType( RecMdcKalTrack::proton );
1190 kappa = (*iter)->kappa();
1191 tanl = (*iter)->tanl();
1192 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
1193 tof_pt[4] = 1.0/kappa;
1194 tof_p[4] = abs(sqrt(1.0+tanl*tanl)*tof_pt[4]);
1195
1196 break;
1197 }
1198 }
1199 tof_id1 = tof->id1();
1200 tof_id2 = tof->id2();
1201 tof_istrip1 = tof->istrip1();
1202 tof_istrip2 = tof->istrip2();
1203 tof_dstrip1 = tof->dstrip1();
1204 tof_dstrip2 = tof->dstrip2();
1205 tof_barrel = tof->barrel();
1206 tof_hitcase = tof->hitCase();
1207 tof_momentum = tof->p();
1208 tof_path1 = tof->path1();
1209 tof_path2 = tof->path2();
1210 tof_zrhit1 = tof->zrhit1();
1211 tof_zrhit2 = tof->zrhit2();
1212 tof_errzr1 = tof->errzrhit1();
1213 tof_errzr2 = tof->errzrhit2();
1214 tof_xhit1 = tof->xhit1();
1215 tof_yhit1 = tof->yhit1();
1216 tof_xhit2 = tof->xhit2();
1217 tof_yhit2 = tof->yhit2();
1218 for( unsigned int i=0; i<5; i++ ) {
1219 tof_kal[i] = tof->kal(i);
1220 tof_zr1[i] = tof->zr1(i);
1221 tof_zr2[i] = tof->zr2(i);
1222 }
1223 tof_ztdc1 = tof->ztdc1();
1224 tof_ztdc2 = tof->ztdc2();
1225 tof_zadc1 = tof->zadc1();
1226 tof_zadc2 = tof->zadc2();
1227 tof_zt1 = -999.0;
1228 tof_zt2 = -999.0;
1229 tof_zt3 = -999.0;
1230 tof_zt4 = -999.0;
1231 tof_zq1 = -999.0;
1232 tof_zq2 = -999.0;
1233 tof_zq3 = -999.0;
1234 tof_zq4 = -999.0;
1235 if( tof->hitCase() == 0 || tof->hitCase() == 2 ) {
1236 tof_zt1 = tofCaliSvc->ZTDC1( tof->tdc2(), tof->tofId1(), tof->zrhit1() );
1237 tof_zt2 = tofCaliSvc->ZTDC2( tof->tdc1(), tof->tofId1(), tof->zrhit1() );
1238 tof_zq1 = tofCaliSvc->ZADC1( tof->adc2(), tof->tofId1(), tof->zrhit1() );
1239 tof_zq2 = tofCaliSvc->ZADC2( tof->adc1(), tof->tofId1(), tof->zrhit1() );
1240 }
1241 if( tof->hitCase() == 1 || tof->hitCase() == 2 ) {
1242 tof_zt3 = tofCaliSvc->ZTDC1( tof->tdc4(), tof->tofId2(), tof->zrhit2() );
1243 tof_zt4 = tofCaliSvc->ZTDC2( tof->tdc3(), tof->tofId2(), tof->zrhit2() );
1244 tof_zq3 = tofCaliSvc->ZADC1( tof->adc4(), tof->tofId2(), tof->zrhit2() );
1245 tof_zq4 = tofCaliSvc->ZADC2( tof->adc3(), tof->tofId2(), tof->zrhit2() );
1246 }
1247 tof_size1 = tof->size1();
1248 tof_size2 = tof->size2();
1249 tof_size3 = tof->size3();
1250 tof_size4 = tof->size4();
1251 tof_theta1 = tof->theta1();
1252 tof_theta2 = tof->theta2();
1253 tof_phi1 = tof->phi1();
1254 tof_phi2 = tof->phi2();
1255 tof_quality1 = tof->quality1();
1256 tof_quality2 = tof->quality2();
1257 tof_quality = tof->quality();
1258 tof_tofid1 = tof->tofId1();
1259 tof_tofid2 = tof->tofId2();
1260 tof_strip1 = tof->strip1();
1261 tof_strip2 = tof->strip2();
1262 /*
1263 tof_board1 = tofQElecSvc->Board( tof->hitCase()<3, tof->tofId1(), true );
1264 tof_board2 = tofQElecSvc->Board( tof->hitCase()<3, tof->tofId2(), true );
1265 tof_crate1 = tofQElecSvc->Crate( tof->hitCase()<3, tof->tofId1(), true );
1266 tof_crate2 = tofQElecSvc->Crate( tof->hitCase()<3, tof->tofId2(), true );
1267 tof_fee1 = tofQElecSvc->Fee( tof->hitCase()<3, tof->tofId1(), true );
1268 tof_fee2 = tofQElecSvc->Fee( tof->hitCase()<3, tof->tofId2(), true );
1269 tof_channel1 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId1(),true );
1270 tof_channel2 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId1(),false );
1271 tof_channel3 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId2(),true );
1272 tof_channel4 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId2(),false );
1273 */
1274 tof_ph11 = tof->ph11();
1275 tof_ph12 = tof->ph12();
1276 tof_ph21 = tof->ph21();
1277 tof_ph22 = tof->ph22();
1278 tof_ph1 = tof->ph1();
1279 tof_ph2 = tof->ph2();
1280 tof_ph = tof->ph();
1281 tof_tofe11 = tof->tof11(0);
1282 tof_tofe12 = tof->tof12(0);
1283 tof_tofe21 = tof->tof21(0);
1284 tof_tofe22 = tof->tof22(0);
1285 tof_tofe1 = tof->tof1(0);
1286 tof_tofe2 = tof->tof2(0);
1287 tof_tofe = tof->tof(0);
1288 tof_tofmu11 = tof->tof11(1);
1289 tof_tofmu12 = tof->tof12(1);
1290 tof_tofmu21 = tof->tof21(1);
1291 tof_tofmu22 = tof->tof22(1);
1292 tof_tofmu1 = tof->tof1(1);
1293 tof_tofmu2 = tof->tof2(1);
1294 tof_tofmu = tof->tof(1);
1295 tof_tofpi11 = tof->tof11(2);
1296 tof_tofpi12 = tof->tof12(2);
1297 tof_tofpi21 = tof->tof21(2);
1298 tof_tofpi22 = tof->tof22(2);
1299 tof_tofpi1 = tof->tof1(2);
1300 tof_tofpi2 = tof->tof2(2);
1301 tof_tofpi = tof->tof(2);
1302 tof_tofk11 = tof->tof11(3);
1303 tof_tofk12 = tof->tof12(3);
1304 tof_tofk21 = tof->tof21(3);
1305 tof_tofk22 = tof->tof22(3);
1306 tof_tofk1 = tof->tof1(3);
1307 tof_tofk2 = tof->tof2(3);
1308 tof_tofk = tof->tof(3);
1309 tof_tofp11 = tof->tof11(4);
1310 tof_tofp12 = tof->tof12(4);
1311 tof_tofp21 = tof->tof21(4);
1312 tof_tofp22 = tof->tof22(4);
1313 tof_tofp1 = tof->tof1(4);
1314 tof_tofp2 = tof->tof2(4);
1315 tof_tofp = tof->tof(4);
1316 tof_qch1 = tof->qch1();
1317 tof_qch2 = tof->qch2();
1318 tof_qch3 = tof->qch3();
1319 tof_qch4 = tof->qch4();
1320 tof_adc1 = tof->adc1();
1321 tof_adc2 = tof->adc2();
1322 tof_adc3 = tof->adc3();
1323 tof_adc4 = tof->adc4();
1324 tof_tdc1 = tof->tdc1();
1325 tof_tdc2 = tof->tdc2();
1326 tof_tdc3 = tof->tdc3();
1327 tof_tdc4 = tof->tdc4();
1328 tof_texpe1 = tof->texpInner(0);
1329 tof_texpmu1 = tof->texpInner(1);
1330 tof_texppi1 = tof->texpInner(2);
1331 tof_texpk1 = tof->texpInner(3);
1332 tof_texpp1 = tof->texpInner(4);
1333 tof_texpe2 = tof->texpOuter(0);
1334 tof_texpmu2 = tof->texpOuter(1);
1335 tof_texppi2 = tof->texpOuter(2);
1336 tof_texpk2 = tof->texpOuter(3);
1337 tof_texpp2 = tof->texpOuter(4);
1338 tof_texpe = tof->texp(0);
1339 tof_texpmu = tof->texp(1);
1340 tof_texppi = tof->texp(2);
1341 tof_texpk = tof->texp(3);
1342 tof_texpp = tof->texp(4);
1343 tof_tdiff1 = tof->tdiff1();
1344 tof_tdiff2 = tof->tdiff2();
1345 tof_estime = estime;
1346 tof_t0stat = t0stat;
1347 tof_tuple->write();
1348
1349 return;
1350}
1351
1352
1353void TofCheckDigi::Fill_TofTrack(Event::EventHeader& eventHeader, TofTrack*& tof, double estime, int t0stat, RecMdcKalTrackCol& mdcKalTrackCol, TofMcHitCol& tofMcCol, McParticleCol& mcParticleCol, std::string calibData ) {
1354
1355 tof_run = eventHeader.runNumber();
1356 tof_event = eventHeader.eventNumber();
1357 tof_toftrackid = tof->tofTrackId();
1358 tof_trackid = tof->trackId();
1359 RecMdcKalTrackCol::iterator iter = mdcKalTrackCol.begin();
1360 for( ; iter != mdcKalTrackCol.end(); iter++ ) {
1361 if( (*iter)->trackId() == tof->trackId() ) {
1362 double kappa = 10000.0;
1363 double tanl = -10000.0;
1364
1365 (*iter)->setPidType( RecMdcKalTrack::electron );
1366 kappa = (*iter)->kappa();
1367 tanl = (*iter)->tanl();
1368 if( kappa>0 ) { tof_charge = 1; }
1369 else { tof_charge = -1; }
1370 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
1371 tof_pt[0] = 1.0/kappa;
1372 tof_p[0] = abs(sqrt(1.0+tanl*tanl)*tof_pt[0]);
1373
1374 (*iter)->setPidType( RecMdcKalTrack::muon );
1375 kappa = (*iter)->kappa();
1376 tanl = (*iter)->tanl();
1377 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
1378 tof_pt[1] = 1.0/kappa;
1379 tof_p[1] = abs(sqrt(1.0+tanl*tanl)*tof_pt[1]);
1380
1381 (*iter)->setPidType( RecMdcKalTrack::pion );
1382 kappa = (*iter)->kappa();
1383 tanl = (*iter)->tanl();
1384 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
1385 tof_pt[2] = 1.0/kappa;
1386 tof_p[2] = abs(sqrt(1.0+tanl*tanl)*tof_pt[2]);
1387
1388 (*iter)->setPidType( RecMdcKalTrack::kaon );
1389 kappa = (*iter)->kappa();
1390 tanl = (*iter)->tanl();
1391 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
1392 tof_pt[3] = 1.0/kappa;
1393 tof_p[3] = abs(sqrt(1.0+tanl*tanl)*tof_pt[3]);
1394
1395 (*iter)->setPidType( RecMdcKalTrack::proton );
1396 kappa = (*iter)->kappa();
1397 tanl = (*iter)->tanl();
1398 if( abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
1399 tof_pt[4] = 1.0/kappa;
1400 tof_p[4] = abs(sqrt(1.0+tanl*tanl)*tof_pt[4]);
1401
1402 break;
1403 }
1404 }
1405 tof_id1 = tof->id1();
1406 tof_id2 = tof->id2();
1407 tof_istrip1 = tof->istrip1();
1408 tof_istrip2 = tof->istrip2();
1409 tof_barrel = tof->barrel();
1410 tof_hitcase = tof->hitCase();
1411 tof_momentum = tof->p();
1412 tof_path1 = tof->path1();
1413 tof_path2 = tof->path2();
1414 tof_zrhit1 = tof->zrhit1();
1415 tof_zrhit2 = tof->zrhit2();
1416 tof_errzr1 = tof->errzrhit1();
1417 tof_errzr2 = tof->errzrhit2();
1418 tof_xhit1 = tof->xhit1();
1419 tof_yhit1 = tof->yhit1();
1420 tof_xhit2 = tof->xhit2();
1421 tof_yhit2 = tof->yhit2();
1422 for( unsigned int i=0; i<5; i++ ) {
1423 tof_kal[i] = tof->kal(i);
1424 tof_zr1[i] = tof->zr1(i);
1425 tof_zr2[i] = tof->zr2(i);
1426 }
1427 tof_ztdc1 = tof->ztdc1();
1428 tof_ztdc2 = tof->ztdc2();
1429 tof_zadc1 = tof->zadc1();
1430 tof_zadc2 = tof->zadc2();
1431 tof_zt1 = -999.0;
1432 tof_zt2 = -999.0;
1433 tof_zt3 = -999.0;
1434 tof_zt4 = -999.0;
1435 tof_zq1 = -999.0;
1436 tof_zq2 = -999.0;
1437 tof_zq3 = -999.0;
1438 tof_zq4 = -999.0;
1439 if( tof->hitCase() == 0 || tof->hitCase() == 2 ) {
1440 tof_zt1 = tofCaliSvc->ZTDC1( tof->tdc2(), tof->tofId1(), tof->zrhit1() );
1441 tof_zt2 = tofCaliSvc->ZTDC2( tof->tdc1(), tof->tofId1(), tof->zrhit1() );
1442 tof_zq1 = tofCaliSvc->ZADC1( tof->adc2(), tof->tofId1(), tof->zrhit1() );
1443 tof_zq2 = tofCaliSvc->ZADC2( tof->adc1(), tof->tofId1(), tof->zrhit1() );
1444 }
1445 if( tof->hitCase() == 1 || tof->hitCase() == 2 ) {
1446 tof_zt3 = tofCaliSvc->ZTDC1( tof->tdc4(), tof->tofId2(), tof->zrhit2() );
1447 tof_zt4 = tofCaliSvc->ZTDC2( tof->tdc3(), tof->tofId2(), tof->zrhit2() );
1448 tof_zq3 = tofCaliSvc->ZADC1( tof->adc4(), tof->tofId2(), tof->zrhit2() );
1449 tof_zq4 = tofCaliSvc->ZADC2( tof->adc3(), tof->tofId2(), tof->zrhit2() );
1450 }
1451 tof_size1 = tof->size1();
1452 tof_size2 = tof->size2();
1453 tof_size3 = tof->size3();
1454 tof_size4 = tof->size4();
1455 tof_theta1 = tof->theta1();
1456 tof_theta2 = tof->theta2();
1457 tof_phi1 = tof->phi1();
1458 tof_phi2 = tof->phi2();
1459 tof_quality1 = tof->quality1();
1460 tof_quality2 = tof->quality2();
1461 tof_quality = tof->quality();
1462 tof_tofid1 = tof->tofId1();
1463 tof_tofid2 = tof->tofId2();
1464 tof_strip1 = tof->strip1();
1465 tof_strip2 = tof->strip2();
1466 /*
1467 tof_board1 = tofQElecSvc->Board( tof->hitCase()<3, tof->tofId1(), true );
1468 tof_board2 = tofQElecSvc->Board( tof->hitCase()<3, tof->tofId2(), true );
1469 tof_crate1 = tofQElecSvc->Crate( tof->hitCase()<3, tof->tofId1(), true );
1470 tof_crate2 = tofQElecSvc->Crate( tof->hitCase()<3, tof->tofId2(), true );
1471 tof_fee1 = tofQElecSvc->Fee( tof->hitCase()<3, tof->tofId1(), true );
1472 tof_fee2 = tofQElecSvc->Fee( tof->hitCase()<3, tof->tofId2(), true );
1473 tof_channel1 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId1(),true );
1474 tof_channel2 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId1(),false );
1475 tof_channel3 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId2(),true );
1476 tof_channel4 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId2(),false );
1477 */
1478 tof_ph11 = tof->ph11();
1479 tof_ph12 = tof->ph12();
1480 tof_ph21 = tof->ph21();
1481 tof_ph22 = tof->ph22();
1482 tof_ph1 = tof->ph1();
1483 tof_ph2 = tof->ph2();
1484 tof_ph = tof->ph();
1485 tof_tofe11 = tof->tof11(0);
1486 tof_tofe12 = tof->tof12(0);
1487 tof_tofe21 = tof->tof21(0);
1488 tof_tofe22 = tof->tof22(0);
1489 tof_tofe1 = tof->tof1(0);
1490 tof_tofe2 = tof->tof2(0);
1491 tof_tofe = tof->tof(0);
1492 tof_tofmu11 = tof->tof11(1);
1493 tof_tofmu12 = tof->tof12(1);
1494 tof_tofmu21 = tof->tof21(1);
1495 tof_tofmu22 = tof->tof22(1);
1496 tof_tofmu1 = tof->tof1(1);
1497 tof_tofmu2 = tof->tof2(1);
1498 tof_tofmu = tof->tof(1);
1499 tof_tofpi11 = tof->tof11(2);
1500 tof_tofpi12 = tof->tof12(2);
1501 tof_tofpi21 = tof->tof21(2);
1502 tof_tofpi22 = tof->tof22(2);
1503 tof_tofpi1 = tof->tof1(2);
1504 tof_tofpi2 = tof->tof2(2);
1505 tof_tofpi = tof->tof(2);
1506 tof_tofk11 = tof->tof11(3);
1507 tof_tofk12 = tof->tof12(3);
1508 tof_tofk21 = tof->tof21(3);
1509 tof_tofk22 = tof->tof22(3);
1510 tof_tofk1 = tof->tof1(3);
1511 tof_tofk2 = tof->tof2(3);
1512 tof_tofk = tof->tof(3);
1513 tof_tofp11 = tof->tof11(4);
1514 tof_tofp12 = tof->tof12(4);
1515 tof_tofp21 = tof->tof21(4);
1516 tof_tofp22 = tof->tof22(4);
1517 tof_tofp1 = tof->tof1(4);
1518 tof_tofp2 = tof->tof2(4);
1519 tof_tofp = tof->tof(4);
1520 tof_qch1 = tof->qch1();
1521 tof_qch2 = tof->qch2();
1522 tof_qch3 = tof->qch3();
1523 tof_qch4 = tof->qch4();
1524 tof_adc1 = tof->adc1();
1525 tof_adc2 = tof->adc2();
1526 tof_adc3 = tof->adc3();
1527 tof_adc4 = tof->adc4();
1528 tof_tdc1 = tof->tdc1();
1529 tof_tdc2 = tof->tdc2();
1530 tof_tdc3 = tof->tdc3();
1531 tof_tdc4 = tof->tdc4();
1532 tof_texpe1 = tof->texpInner(0);
1533 tof_texpmu1 = tof->texpInner(1);
1534 tof_texppi1 = tof->texpInner(2);
1535 tof_texpk1 = tof->texpInner(3);
1536 tof_texpp1 = tof->texpInner(4);
1537 tof_texpe2 = tof->texpOuter(0);
1538 tof_texpmu2 = tof->texpOuter(1);
1539 tof_texppi2 = tof->texpOuter(2);
1540 tof_texpk2 = tof->texpOuter(3);
1541 tof_texpp2 = tof->texpOuter(4);
1542 tof_texpe = tof->texp(0);
1543 tof_texpmu = tof->texp(1);
1544 tof_texppi = tof->texp(2);
1545 tof_texpk = tof->texp(3);
1546 tof_texpp = tof->texp(4);
1547 tof_tdiff1 = tof->tdiff1();
1548 tof_tdiff2 = tof->tdiff2();
1549 tof_estime = estime;
1550 tof_t0stat = t0stat;
1551
1552 int particleId = 0;
1553 if( calibData == "Bhabha" ) { particleId = 11; }
1554 else if( calibData == "Dimu" ) { particleId = 13; }
1555 else if( calibData == "pion" ) { particleId = 211; }
1556 else if( calibData == "kaon" ) { particleId = 321; }
1557 else if( calibData == "proton" ) { particleId = 2212; }
1558 else {
1559 cout << "Reconstruction::TofRec::TofCheckDigi::Fill_TofTrack: For MC, Wrong Input Particle ID!" << endl;
1560 }
1561
1562 tof_mcp = -100.0;
1563 tof_mctofp = -100.0;
1564 tof_mctrkid = -100.0;
1565 tof_mcpath = -100.0;
1566 tof_mctexp = -100.0;
1567 tof_mczrhit = -1000.0;
1568
1569 McParticleCol::iterator iter_mc = mcParticleCol.begin();
1570 for( ; iter_mc != mcParticleCol.end(); iter_mc++ ) {
1571 int pid = (*iter_mc)->particleProperty();
1572 if( abs(pid) != particleId ) continue;
1573 if( ( particleId==11 || particleId==13 ) && ( ( pid>0 && tof_charge>0 ) || ( pid<0 && tof_charge<0 ) ) ) continue;
1574 if( ( particleId!=11 && particleId!=13 ) && ( ( pid>0 && tof_charge<0 ) || ( pid<0 && tof_charge>0 ) ) ) continue;
1575
1576 int trkIndex = (*iter_mc)->trackIndex();
1577 tof_mcp = (*iter_mc)->initialFourMomentum().rho();
1578
1579 TofMcHitCol::iterator iter_mc_tof = tofMcCol.begin();
1580 for( ; iter_mc_tof != tofMcCol.end(); iter_mc_tof++ ) {
1581 if( trkIndex != (*iter_mc_tof)->getTrackIndex() ) continue;
1582 double mcposx = (*iter_mc_tof)->getPositionX();
1583 double mcposy = (*iter_mc_tof)->getPositionY();
1584 double mcposr = 0.1*sqrt(mcposx*mcposx+mcposy*mcposy);
1585 double mcposz = 0.1*(*iter_mc_tof)->getPositionZ();
1586 double mcpx = (*iter_mc_tof)->getPx();
1587 double mcpy = (*iter_mc_tof)->getPy();
1588 double mcpz = (*iter_mc_tof)->getPz();
1589 double mctofp = 0.001*sqrt(mcpx*mcpx+mcpy*mcpy+mcpz*mcpz);
1590 tof_mctofp = mctofp;
1591 tof_mctrkid = (*iter_mc_tof)->getTrackIndex();
1592 tof_mcpath = 0.1*(*iter_mc_tof)->getTrackLength();
1593 tof_mctexp = (*iter_mc_tof)->getFlightTime();
1594 if( tof->hitCase()==0 || tof->hitCase()==1 || tof->hitCase()==2 ) {
1595 tof_mczrhit = mcposz;
1596 }
1597 else if( tof->hitCase()==3 || tof->hitCase()==4 ) {
1598 tof_mczrhit = mcposr;
1599 }
1600 }
1601 }
1602
1603 tof_tuple->write();
1604
1605 return;
1606}
1607
1608
1609void TofCheckDigi::FillCol(Event::EventHeader& eventHeader, RecMdcTrackCol& mdcTrackCol, RecMdcKalTrackCol& mdcKalTrackCol, RecExtTrackCol& recExtTrackCol) {
1610 if( mdcTrackCol.size()<=0 || mdcKalTrackCol.size() <= 0 || recExtTrackCol.size() <= 0 ) return;
1611 RecExtTrackCol::iterator iter_ext = recExtTrackCol.begin();
1612 for( ; iter_ext!=recExtTrackCol.end(); iter_ext++ ) {
1613 RecMdcKalTrackCol::iterator iter_kal = mdcKalTrackCol.begin();
1614 for( ; iter_kal!=mdcKalTrackCol.end(); iter_kal++ ) {
1615 RecMdcTrackCol::iterator iter_mdc = mdcTrackCol.begin();
1616 for( ; iter_mdc!=mdcTrackCol.end(); iter_mdc++ ) {
1617 if( (*iter_kal)->getTrackId() != (*iter_mdc)->trackId() ) continue;
1618 if( (*iter_kal)->getTrackId() == (*iter_ext)->trackId() ) break;
1619 }
1620 if( iter_mdc != mdcTrackCol.end() ) {
1621 Fill( eventHeader, *iter_mdc, *iter_kal, *iter_ext );
1622 }
1623 }
1624 }
1625 return;
1626}
1627
1628
1629void TofCheckDigi::FillCol(Event::EventHeader& eventHeader, RecExtTrackCol& extTrackCol, RecMdcTrackCol& mdcTrackCol, RecEmcShowerCol& emcShowerCol, RecMdcKalTrackCol& mdcKalTrackCol) {
1630 bb_run = eventHeader.runNumber();
1631 bb_event = eventHeader.eventNumber();
1632 bb_trksize = extTrackCol.size();
1633 bb_mdcsize = mdcTrackCol.size();
1634 bb_emcsize = emcShowerCol.size();
1635
1636 RecMdcTrackCol::iterator iter_mdc1 = mdcTrackCol.begin();
1637 RecMdcTrackCol::iterator iter_mdc2 = mdcTrackCol.begin() + 1;
1638
1639 Hep3Vector p1 = (*iter_mdc1)->p3();
1640 Hep3Vector p2 = (*iter_mdc2)->p3();
1641
1642 bb_trk1 = (*iter_mdc1)->trackId();
1643 bb_pmdc1 = (*iter_mdc1)->p();
1644 bb_ptmdc1 = (*iter_mdc1)->pxy();
1645 bb_theta1 = (*iter_mdc1)->theta();
1646 bb_phi1 = (*iter_mdc1)->phi();
1647 bb_x1 = (*iter_mdc1)->x();
1648 bb_y1 = (*iter_mdc1)->y();
1649 bb_z1 = (*iter_mdc1)->z();
1650 bb_r1 = (*iter_mdc1)->r();
1651 bb_charge1 = (*iter_mdc1)->charge();
1652 bb_chi1 = (*iter_mdc1)->chi2();
1653 bb_ndof1 = (*iter_mdc1)->ndof();
1654 bb_layer1 = (*iter_mdc1)->lastLayer();
1655 bb_trk2 = (*iter_mdc2)->trackId();
1656 bb_pmdc2 = (*iter_mdc2)->p();
1657 bb_ptmdc2 = (*iter_mdc2)->pxy();
1658 bb_theta2 = (*iter_mdc2)->theta();
1659 bb_phi2 = (*iter_mdc2)->phi();
1660 bb_x2 = (*iter_mdc2)->x();
1661 bb_y2 = (*iter_mdc2)->y();
1662 bb_z2 = (*iter_mdc2)->z();
1663 bb_r2 = (*iter_mdc2)->r();
1664 bb_charge2 = (*iter_mdc2)->charge();
1665 bb_chi2 = (*iter_mdc2)->chi2();
1666 bb_ndof2 = (*iter_mdc2)->ndof();
1667 bb_layer2 = (*iter_mdc2)->lastLayer();
1668
1669 bb_dang = 180.0 - p1.angle( p2.unit() )*180.0/pi;
1670 bb_dphi = abs( (*iter_mdc1)->phi() - (*iter_mdc2)->phi() )*180.0/pi;
1671
1672 RecMdcKalTrackCol::iterator iter_kal1 = mdcKalTrackCol.begin();
1673 RecMdcKalTrackCol::iterator iter_kal2 = mdcKalTrackCol.begin() + 1;
1674
1675 if( ( (*iter_kal1)->trackId() == (*iter_mdc2)->trackId() ) && ( (*iter_kal2)->trackId() == (*iter_mdc1)->trackId() ) ) {
1676 RecMdcKalTrackCol::iterator iter_tmp = iter_kal1;
1677 iter_kal1 = iter_kal2;
1678 iter_kal2 = iter_tmp;
1679 }
1680
1681 // RecMdcKalTrack::setPidType (RecMdcKalTrack::electron);
1682 (*iter_kal1)->setPidType( RecMdcKalTrack::electron );
1683 (*iter_kal2)->setPidType( RecMdcKalTrack::electron );
1684 double tanl1 = (*iter_kal1)->tanl();
1685 double kappa1 = (*iter_kal1)->kappa();
1686 double tanl2 = (*iter_kal2)->tanl();
1687 double kappa2 = (*iter_kal2)->kappa();
1688 bb_pe1 = sqrt(1.0+tanl1*tanl1)/kappa1;
1689 bb_pte1 = 1.0/kappa1;
1690 bb_pe2 = sqrt(1.0+tanl2*tanl2)/kappa2;
1691 bb_pte2 = 1.0/kappa2;
1692 // RecMdcKalTrack::setPidType (RecMdcKalTrack::muon);
1693 (*iter_kal1)->setPidType( RecMdcKalTrack::muon );
1694 (*iter_kal2)->setPidType( RecMdcKalTrack::muon );
1695 tanl1 = (*iter_kal1)->tanl();
1696 kappa1 = (*iter_kal1)->kappa();
1697 tanl2 = (*iter_kal2)->tanl();
1698 kappa2 = (*iter_kal2)->kappa();
1699 bb_pmu1 = sqrt(1.0+tanl1*tanl1)/kappa1;
1700 bb_ptmu1 = 1.0/kappa1;
1701 bb_pmu2 = sqrt(1.0+tanl2*tanl2)/kappa2;
1702 bb_ptmu2 = 1.0/kappa2;
1703
1704 RecExtTrackCol::iterator iter_ext1 = extTrackCol.begin();
1705 RecExtTrackCol::iterator iter_ext2 = extTrackCol.begin() + 1;
1706
1707 Hep3Vector extPos1 = (*iter_ext1)->emcPosition();
1708 Hep3Vector extPos2 = (*iter_ext2)->emcPosition();
1709
1710 bb_extx1 = extPos1.x();
1711 bb_exty1 = extPos1.y();
1712 bb_extz1 = extPos1.z();
1713 bb_extx2 = extPos2.x();
1714 bb_exty2 = extPos2.y();
1715 bb_extz2 = extPos2.z();
1716
1717 RecEmcShowerCol::iterator iter_emc1 = emcShowerCol.begin();
1718 RecEmcShowerCol::iterator iter_emc2 = emcShowerCol.begin() + 1;
1719
1720 Hep3Vector emcPos1((*iter_emc1)->x(),(*iter_emc1)->y(),(*iter_emc1)->z());
1721 Hep3Vector emcPos2((*iter_emc2)->x(),(*iter_emc2)->y(),(*iter_emc2)->z());
1722
1723 // cout << "ext 1 --- " << extPos1 << " ext 2 --- " << extPos2 <<
1724 // "emc 1 --- " << emcPos1 << " emc 2 --- " << emcPos2 << endl;
1725
1726 Hep3Vector dis1 = extPos1 - emcPos1;
1727 Hep3Vector dis2 = extPos2 - emcPos1;
1728
1729 // cout << " r1 = " << dis1.r() << " r2 = " << dis2.r() << endl;
1730
1731 if( dis1.r() > dis2.r() ) {
1732 RecEmcShowerCol::iterator iter_tmp = iter_emc1;
1733 iter_emc1 = iter_emc2;
1734 iter_emc2 = iter_tmp;
1735 Hep3Vector emc_tmp = emcPos1;
1736 emcPos1 = emcPos2;
1737 emcPos2 = emc_tmp;
1738 }
1739 dis1 = extPos1 - emcPos1;
1740 dis2 = extPos2 - emcPos2;
1741
1742 bb_emctrk1 = (*iter_emc1)->trackId();
1743 bb_emcx1 = (*iter_emc1)->x();
1744 bb_emcy1 = (*iter_emc1)->y();
1745 bb_emcz1 = (*iter_emc1)->z();
1746 bb_ep1 = (*iter_emc1)->energy()/(*iter_mdc1)->p();;
1747 bb_th1 = (*iter_emc1)->theta();
1748 bb_ph1 = (*iter_emc1)->phi();
1749 bb_emctrk2 = (*iter_emc2)->trackId();
1750 bb_emcx2 = (*iter_emc2)->x();
1751 bb_emcy2 = (*iter_emc2)->y();
1752 bb_emcz2 = (*iter_emc2)->z();
1753 bb_ep2 = (*iter_emc2)->energy()/(*iter_mdc2)->p();;
1754 bb_th2 = (*iter_emc2)->theta();
1755 bb_ph2 = (*iter_emc2)->phi();
1756 bb_dr1 = dis1.r();
1757 bb_drxy1 = dis1.rho();
1758 bb_dz1 = dis1.z();
1759 bb_dr2 = dis2.r();
1760 bb_drxy2 = dis2.rho();
1761 bb_dz2 = dis2.z();
1762
1763 double etot = 0.0;
1764 RecEmcShowerCol::iterator iter_emc = emcShowerCol.begin();
1765 for( ; iter_emc != emcShowerCol.end(); iter_emc++ ) {
1766 etot += (*iter_emc)->energy();
1767 }
1768 bb_etot = etot - (*iter_emc1)->energy() - (*iter_emc2)->energy();
1769
1770 bb_tuple->write();
1771
1772 return;
1773}
Double_t etot
Double_t x[10]
ObjectVector< RecExtTrack > RecExtTrackCol
std::multimap< unsignedint, TofData * >::iterator IterTofDataMap
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
double cos(const BesAngle a)
ObjectVector< RecMdcKalTrack > RecMdcKalTrackCol
ObjectVector< RecMdcTrack > RecMdcTrackCol
ObjectVector< TofDigi > TofDigiCol
ITofCaliSvc * tofCaliSvc
ITofCaliSvc * tofCaliSvc
virtual const double ZTDC(double tleft, double tright, unsigned id)=0
virtual const double ZTDC2(double tleft, unsigned id, double z)=0
virtual const double ZTDC1(double tright, unsigned id, double z)=0
virtual const double ZADC(double qleft, double qright, unsigned id)=0
virtual const double ZADC2(double qleft, unsigned id, double z)=0
virtual const double ZADC1(double qright, unsigned id, double z)=0
void Fill_TofTrack(Event::EventHeader &, TofTrack *&, double, int)
void Fill_MRPC(Event::EventHeader &, TofData *&, double, int)
void Fill(Event::EventHeader &, RecMdcTrack *&, RecMdcKalTrack *&, RecExtTrack *&)
void Fill_Endcap(Event::EventHeader &, TofData *&, double, int)
void Fill_Barrel(Event::EventHeader &, TofData *&, double, int)
TofCheckDigi(NTuple::Tuple *&digi, NTuple::Tuple *&barrel, NTuple::Tuple *&endcap, NTuple::Tuple *&mrpc, NTuple::Tuple *&ext, NTuple::Tuple *&tof, NTuple::Tuple *&bhabha)
void FillCol(Event::EventHeader &, TofDigiCol &, double, int)
int tdcChannel()
Definition: TofData.cxx:764
double qtc2()
Definition: TofData.cxx:701
int qnumber2()
Definition: TofData.cxx:899
int qtimes2()
Definition: TofData.cxx:845
unsigned int westTimes()
Definition: TofData.cxx:872
int ttimes1()
Definition: TofData.cxx:836
double adc2()
Definition: TofData.cxx:656
int tclock1()
Definition: TofData.cxx:782
int qclock1()
Definition: TofData.cxx:773
int tclock()
Definition: TofData.cxx:818
double adc()
Definition: TofData.cxx:674
double tdc2()
Definition: TofData.cxx:665
double qtc1()
Definition: TofData.cxx:692
int tdcChannelWest()
Definition: TofData.cxx:746
int adcChannel()
Definition: TofData.cxx:755
int qtimes1()
Definition: TofData.cxx:827
int tnumber1()
Definition: TofData.cxx:890
int adcChannelWest()
Definition: TofData.cxx:737
double tdc1()
Definition: TofData.cxx:647
int qnumber1()
Definition: TofData.cxx:881
int adcChannelEast()
Definition: TofData.cxx:719
int qclock()
Definition: TofData.cxx:809
int ttimes2()
Definition: TofData.cxx:854
double adc1()
Definition: TofData.cxx:638
int qclock2()
Definition: TofData.cxx:791
unsigned int eastTimes()
Definition: TofData.cxx:863
int tnumber2()
Definition: TofData.cxx:908
double tdc()
Definition: TofData.cxx:683
int tclock2()
Definition: TofData.cxx:800
int tdcChannelEast()
Definition: TofData.cxx:728
double qtc()
Definition: TofData.cxx:710
static int endcap(const Identifier &id)
Definition: TofID.cxx:124
static int strip(const Identifier &id)
Definition: TofID.cxx:136
static Identifier cell_id(int barrel_ec, int layer, int phi_module, int end)
For a single crystal.
Definition: TofID.cxx:143
static bool is_scin(const Identifier &id)
Definition: TofID.cxx:102
static int end(const Identifier &id)
Definition: TofID.cxx:79
static bool is_barrel(const Identifier &id)
Test for barrel.
Definition: TofID.cxx:49
static bool is_mrpc(const Identifier &id)
Definition: TofID.cxx:113
static int phi_module(const Identifier &id)
Definition: TofID.cxx:73
static int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
Definition: TofID.cxx:61
static int layer(const Identifier &id)
Definition: TofID.cxx:66
static int module(const Identifier &id)
Definition: TofID.cxx:130
double tof2(unsigned int i) const
double tof11(unsigned int i) const
double tof12(unsigned int i) const
double zr1(unsigned int i) const
int kal(unsigned int i) const
double tof(unsigned int i) const
double texpInner(unsigned int i) const
double tof21(unsigned int i) const
double tof1(unsigned int i) const
double texpOuter(unsigned int i) const
double texp(unsigned int i) const
double tof22(unsigned int i) const
double zr2(unsigned int i) const