1#include "TofRec/TofCheckDigi.h"
2#include "TofRec/TofConstants.h"
3#include "TofCaliSvc/ITofCaliSvc.h"
5#include "Identifier/Identifier.h"
6#include "Identifier/TofID.h"
7#include "McTruth/TofMcHit.h"
8#include "McTruth/McParticle.h"
14TofCheckDigi::TofCheckDigi( NTuple::Tuple*& digi, NTuple::Tuple*& barrel, NTuple::Tuple*& endcap, NTuple::Tuple*& ext, NTuple::Tuple*& tof, NTuple::Tuple*& bhabha ):digi_tuple(digi),barrel_tuple(barrel),endcap_tuple(endcap),ext_tuple(ext),tof_tuple(tof),bb_tuple(bhabha) {
16 std::cerr<<
" Error: invalid pionter in TofCheckDigi(NTuple::Tuple*) for digi_tuple "<<std::endl;
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(
"layer", digi_layer );
23 digi_tuple->addItem(
"tofid", digi_tofId );
24 digi_tuple->addItem(
"end", digi_end );
25 digi_tuple->addItem(
"adc", digi_adc );
26 digi_tuple->addItem(
"tdc", digi_tdc );
27 digi_tuple->addItem(
"qclock", digi_qclock );
28 digi_tuple->addItem(
"tclock", digi_tclock );
29 digi_tuple->addItem(
"over", digi_overflow );
30 digi_tuple->addItem(
"noq", digi_noq );
31 digi_tuple->addItem(
"not", digi_not );
32 digi_tuple->addItem(
"multiq", digi_multiq );
33 digi_tuple->addItem(
"multit", digi_multit );
34 digi_tuple->addItem(
"overq", digi_overq );
35 digi_tuple->addItem(
"overt", digi_overt );
36 digi_tuple->addItem(
"t0", digi_t0 );
37 digi_tuple->addItem(
"t0stat", digi_t0stat );
38 digi_tuple->addItem(
"crate", digi_crate );
39 digi_tuple->addItem(
"geo", digi_geo );
40 digi_tuple->addItem(
"tdcnum", digi_tdcnum );
41 digi_tuple->addItem(
"err", digi_err );
45 std::cerr<<
" Error: invalid pionter in TofCheckDigi(NTuple::Tuple*) for barrel_tuple "<<std::endl;
48 barrel_tuple->addItem(
"run", barrel_run );
49 barrel_tuple->addItem(
"event", barrel_event );
50 barrel_tuple->addItem(
"tofid", barrel_tofId );
51 barrel_tuple->addItem(
"icluster", barrel_tofTrackId );
52 barrel_tuple->addItem(
"layer", barrel_layer );
53 barrel_tuple->addItem(
"qch1", barrel_qchannel1 );
54 barrel_tuple->addItem(
"tch1", barrel_tchannel1 );
55 barrel_tuple->addItem(
"qch2", barrel_qchannel2 );
56 barrel_tuple->addItem(
"tch2", barrel_tchannel2 );
57 barrel_tuple->addItem(
"qtc1", barrel_qtc1 );
58 barrel_tuple->addItem(
"adc1", barrel_adc1 );
59 barrel_tuple->addItem(
"tdc1", barrel_tdc1 );
60 barrel_tuple->addItem(
"qtc2", barrel_qtc2 );
61 barrel_tuple->addItem(
"adc2", barrel_adc2 );
62 barrel_tuple->addItem(
"tdc2", barrel_tdc2 );
63 barrel_tuple->addItem(
"qclock1", barrel_qclock1 );
64 barrel_tuple->addItem(
"tclock1", barrel_tclock1 );
65 barrel_tuple->addItem(
"qclock2", barrel_qclock2 );
66 barrel_tuple->addItem(
"tclock2", barrel_tclock2 );
67 barrel_tuple->addItem(
"qual", barrel_quality );
68 barrel_tuple->addItem(
"tmatched", barrel_tmatched );
69 barrel_tuple->addItem(
"qtimes1", barrel_qtimes1 );
70 barrel_tuple->addItem(
"ttimes1", barrel_ttimes1 );
71 barrel_tuple->addItem(
"qtimes2", barrel_qtimes2 );
72 barrel_tuple->addItem(
"ttimes2", barrel_ttimes2 );
73 barrel_tuple->addItem(
"times1", barrel_times1 );
74 barrel_tuple->addItem(
"times2", barrel_times2 );
75 barrel_tuple->addItem(
"times", barrel_times );
76 barrel_tuple->addItem(
"qnum1", barrel_qnum1 );
77 barrel_tuple->addItem(
"tnum1", barrel_tnum1 );
78 barrel_tuple->addItem(
"qnum2", barrel_qnum2 );
79 barrel_tuple->addItem(
"tnum2", barrel_tnum2 );
80 barrel_tuple->addItem(
"tsum", barrel_tsum );
81 barrel_tuple->addItem(
"tsub", barrel_tsub );
82 barrel_tuple->addItem(
"ztdc", barrel_ztdc );
83 barrel_tuple->addItem(
"zadc", barrel_zadc );
84 barrel_tuple->addItem(
"t0", barrel_t0 );
85 barrel_tuple->addItem(
"t0stat", barrel_t0stat );
89 std::cerr<<
" Error: invalid pionter in TofCheckDigi(NTuple::Tuple*) for endcap_tuple "<<std::endl;
92 endcap_tuple->addItem(
"run", endcap_run );
93 endcap_tuple->addItem(
"event", endcap_event );
94 endcap_tuple->addItem(
"tofid", endcap_tofId );
95 endcap_tuple->addItem(
"icluster", endcap_tofTrackId );
96 endcap_tuple->addItem(
"qch", endcap_qchannel );
97 endcap_tuple->addItem(
"tch", endcap_tchannel );
98 endcap_tuple->addItem(
"qtc", endcap_qtc );
99 endcap_tuple->addItem(
"adc", endcap_adc );
100 endcap_tuple->addItem(
"tdc", endcap_tdc );
101 endcap_tuple->addItem(
"qual", endcap_quality );
102 endcap_tuple->addItem(
"qclock", endcap_qclock );
103 endcap_tuple->addItem(
"tclock", endcap_tclock );
104 endcap_tuple->addItem(
"qtimes", endcap_qtimes );
105 endcap_tuple->addItem(
"ttimes", endcap_ttimes );
106 endcap_tuple->addItem(
"times", endcap_times );
107 endcap_tuple->addItem(
"qnum", endcap_qnum );
108 endcap_tuple->addItem(
"tnum", endcap_tnum );
109 endcap_tuple->addItem(
"t0", endcap_t0 );
110 endcap_tuple->addItem(
"t0stat", endcap_t0stat );
114 std::cerr<<
" Error: invalid pionter in TofCheckDigi(NTuple::Tuple*) for ext_tple"<<std::endl;
117 ext_tuple->addItem(
"run", ext_run );
118 ext_tuple->addItem(
"event", ext_event );
119 ext_tuple->addItem(
"track", ext_trackid );
120 ext_tuple->addItem(
"kal", 5, ext_kalman );
121 ext_tuple->addItem(
"tofid1", 5, ext_tofid1 );
122 ext_tuple->addItem(
"tofid2", 5, ext_tofid2 );
123 ext_tuple->addItem(
"texp1", 5, ext_texp1 );
124 ext_tuple->addItem(
"texp2", 5, ext_texp2 );
125 ext_tuple->addItem(
"p", 5, ext_p );
126 ext_tuple->addItem(
"path1", 5, ext_path1 );
127 ext_tuple->addItem(
"path2", 5, ext_path2 );
128 ext_tuple->addItem(
"zrhit1", 5, ext_zrhit1 );
129 ext_tuple->addItem(
"zrhit2", 5, ext_zrhit2 );
130 ext_tuple->addItem(
"errzr1", 5, ext_errzr1 );
131 ext_tuple->addItem(
"errzr2", 5, ext_errzr2 );
132 ext_tuple->addItem(
"cost1", 5, ext_theta1 );
133 ext_tuple->addItem(
"cost2", 5, ext_theta2 );
134 ext_tuple->addItem(
"phi1", 5, ext_phi1 );
135 ext_tuple->addItem(
"phi2", 5, ext_phi2 );
136 ext_tuple->addItem(
"hitcase", 5, ext_hitcase );
137 ext_tuple->addItem(
"qual", 5, ext_quality );
141 std::cerr<<
" Error: invalid pionter in TofCheckDigi(NTuple::Tuple*) for tof_tple"<<std::endl;
144 tof_tuple->addItem(
"run", tof_run );
145 tof_tuple->addItem(
"event", tof_event );
146 tof_tuple->addItem(
"toftrack", tof_toftrackid );
147 tof_tuple->addItem(
"track", tof_trackid );
148 tof_tuple->addItem(
"charge", tof_charge );
149 tof_tuple->addItem(
"pt", 5, tof_pt );
150 tof_tuple->addItem(
"p", 5, tof_p );
151 tof_tuple->addItem(
"id1", tof_id1 );
152 tof_tuple->addItem(
"id2", tof_id2 );
153 tof_tuple->addItem(
"barrel", tof_barrel );
154 tof_tuple->addItem(
"hitcase", tof_hitcase );
155 tof_tuple->addItem(
"mom", tof_momentum );
156 tof_tuple->addItem(
"path1", tof_path1 );
157 tof_tuple->addItem(
"path2", tof_path2 );
158 tof_tuple->addItem(
"zrhit1", tof_zrhit1 );
159 tof_tuple->addItem(
"zrhit2", tof_zrhit2 );
160 tof_tuple->addItem(
"errzr1", tof_errzr1 );
161 tof_tuple->addItem(
"errzr2", tof_errzr2 );
162 tof_tuple->addItem(
"kal", 5, tof_kal );
163 tof_tuple->addItem(
"zr1", 5, tof_zr1 );
164 tof_tuple->addItem(
"zr2", 5, tof_zr2 );
165 tof_tuple->addItem(
"ztdc1", tof_ztdc1 );
166 tof_tuple->addItem(
"ztdc2", tof_ztdc2 );
167 tof_tuple->addItem(
"zadc1", tof_zadc1 );
168 tof_tuple->addItem(
"zadc2", tof_zadc2 );
169 tof_tuple->addItem(
"zt1", tof_zt1 );
170 tof_tuple->addItem(
"zt2", tof_zt2 );
171 tof_tuple->addItem(
"zt3", tof_zt3 );
172 tof_tuple->addItem(
"zt4", tof_zt4 );
173 tof_tuple->addItem(
"zq1", tof_zq1 );
174 tof_tuple->addItem(
"zq2", tof_zq2 );
175 tof_tuple->addItem(
"zq3", tof_zq3 );
176 tof_tuple->addItem(
"zq4", tof_zq4 );
177 tof_tuple->addItem(
"size1", tof_size1 );
178 tof_tuple->addItem(
"size2", tof_size2 );
179 tof_tuple->addItem(
"size3", tof_size3 );
180 tof_tuple->addItem(
"size4", tof_size4 );
181 tof_tuple->addItem(
"theta1", tof_theta1 );
182 tof_tuple->addItem(
"theta2", tof_theta2 );
183 tof_tuple->addItem(
"phi1", tof_phi1 );
184 tof_tuple->addItem(
"phi2", tof_phi2 );
185 tof_tuple->addItem(
"qual1", tof_quality1 );
186 tof_tuple->addItem(
"qual2", tof_quality2 );
187 tof_tuple->addItem(
"qual", tof_quality );
188 tof_tuple->addItem(
"change", tof_changed );
189 tof_tuple->addItem(
"tofid1", tof_tofid1 );
190 tof_tuple->addItem(
"tofid2", tof_tofid2 );
191 tof_tuple->addItem(
"board1", tof_board1 );
192 tof_tuple->addItem(
"board2", tof_board2 );
193 tof_tuple->addItem(
"crate1", tof_crate1 );
194 tof_tuple->addItem(
"crate2", tof_crate2 );
195 tof_tuple->addItem(
"fee1", tof_fee1 );
196 tof_tuple->addItem(
"fee2", tof_fee2 );
197 tof_tuple->addItem(
"channel1", tof_channel1 );
198 tof_tuple->addItem(
"channel2", tof_channel2 );
199 tof_tuple->addItem(
"channel3", tof_channel3 );
200 tof_tuple->addItem(
"channel4", tof_channel4 );
201 tof_tuple->addItem(
"ph11", tof_ph11 );
202 tof_tuple->addItem(
"ph12", tof_ph12 );
203 tof_tuple->addItem(
"ph21", tof_ph21 );
204 tof_tuple->addItem(
"ph22", tof_ph22 );
205 tof_tuple->addItem(
"ph1", tof_ph1 );
206 tof_tuple->addItem(
"ph2", tof_ph2 );
207 tof_tuple->addItem(
"ph", tof_ph );
208 tof_tuple->addItem(
"tofe11", tof_tofe11 );
209 tof_tuple->addItem(
"tofe12", tof_tofe12 );
210 tof_tuple->addItem(
"tofe21", tof_tofe21 );
211 tof_tuple->addItem(
"tofe22", tof_tofe22 );
212 tof_tuple->addItem(
"tofe1", tof_tofe1 );
213 tof_tuple->addItem(
"tofe2", tof_tofe2 );
214 tof_tuple->addItem(
"tofe", tof_tofe );
215 tof_tuple->addItem(
"tofmu11", tof_tofmu11 );
216 tof_tuple->addItem(
"tofmu12", tof_tofmu12 );
217 tof_tuple->addItem(
"tofmu21", tof_tofmu21 );
218 tof_tuple->addItem(
"tofmu22", tof_tofmu22 );
219 tof_tuple->addItem(
"tofmu1", tof_tofmu1 );
220 tof_tuple->addItem(
"tofmu2", tof_tofmu2 );
221 tof_tuple->addItem(
"tofmu", tof_tofmu );
222 tof_tuple->addItem(
"tofpi11", tof_tofpi11 );
223 tof_tuple->addItem(
"tofpi12", tof_tofpi12 );
224 tof_tuple->addItem(
"tofpi21", tof_tofpi21 );
225 tof_tuple->addItem(
"tofpi22", tof_tofpi22 );
226 tof_tuple->addItem(
"tofpi1", tof_tofpi1 );
227 tof_tuple->addItem(
"tofpi2", tof_tofpi2 );
228 tof_tuple->addItem(
"tofpi", tof_tofpi );
229 tof_tuple->addItem(
"tofk11", tof_tofk11 );
230 tof_tuple->addItem(
"tofk12", tof_tofk12 );
231 tof_tuple->addItem(
"tofk21", tof_tofk21 );
232 tof_tuple->addItem(
"tofk22", tof_tofk22 );
233 tof_tuple->addItem(
"tofk1", tof_tofk1 );
234 tof_tuple->addItem(
"tofk2", tof_tofk2 );
235 tof_tuple->addItem(
"tofk", tof_tofk );
236 tof_tuple->addItem(
"tofp11", tof_tofp11 );
237 tof_tuple->addItem(
"tofp12", tof_tofp12 );
238 tof_tuple->addItem(
"tofp21", tof_tofp21 );
239 tof_tuple->addItem(
"tofp22", tof_tofp22 );
240 tof_tuple->addItem(
"tofp1", tof_tofp1 );
241 tof_tuple->addItem(
"tofp2", tof_tofp2 );
242 tof_tuple->addItem(
"tofp", tof_tofp );
243 tof_tuple->addItem(
"qch1", tof_qch1 );
244 tof_tuple->addItem(
"qch2", tof_qch2 );
245 tof_tuple->addItem(
"qch3", tof_qch3 );
246 tof_tuple->addItem(
"qch4", tof_qch4 );
247 tof_tuple->addItem(
"adc1", tof_adc1 );
248 tof_tuple->addItem(
"adc2", tof_adc2 );
249 tof_tuple->addItem(
"adc3", tof_adc3 );
250 tof_tuple->addItem(
"adc4", tof_adc4 );
251 tof_tuple->addItem(
"tdc1", tof_tdc1 );
252 tof_tuple->addItem(
"tdc2", tof_tdc2 );
253 tof_tuple->addItem(
"tdc3", tof_tdc3 );
254 tof_tuple->addItem(
"tdc4", tof_tdc4 );
255 tof_tuple->addItem(
"texpe1", tof_texpe1 );
256 tof_tuple->addItem(
"texpmu1", tof_texpmu1 );
257 tof_tuple->addItem(
"texppi1", tof_texppi1 );
258 tof_tuple->addItem(
"texpk1", tof_texpk1 );
259 tof_tuple->addItem(
"texpp1", tof_texpp1 );
260 tof_tuple->addItem(
"texpe2", tof_texpe2 );
261 tof_tuple->addItem(
"texpmu2", tof_texpmu2 );
262 tof_tuple->addItem(
"texppi2", tof_texppi2 );
263 tof_tuple->addItem(
"texpk2", tof_texpk2 );
264 tof_tuple->addItem(
"texpp2", tof_texpp2 );
265 tof_tuple->addItem(
"texpe", tof_texpe );
266 tof_tuple->addItem(
"texpmu", tof_texpmu );
267 tof_tuple->addItem(
"texppi", tof_texppi );
268 tof_tuple->addItem(
"texpk", tof_texpk );
269 tof_tuple->addItem(
"texpp", tof_texpp );
270 tof_tuple->addItem(
"tdiff1", tof_tdiff1 );
271 tof_tuple->addItem(
"tdiff2", tof_tdiff2 );
272 tof_tuple->addItem(
"trig", tof_trig );
273 tof_tuple->addItem(
"t0", tof_estime );
274 tof_tuple->addItem(
"t0stat", tof_t0stat );
275 tof_tuple->addItem(
"mctrkid", tof_mctrkid );
276 tof_tuple->addItem(
"mcp", tof_mcp );
277 tof_tuple->addItem(
"mctofp", tof_mctofp );
278 tof_tuple->addItem(
"mczrhit", tof_mczrhit );
279 tof_tuple->addItem(
"mcpath", tof_mcpath );
280 tof_tuple->addItem(
"mctexp", tof_mctexp );
284 std::cerr<<
" Error: invalid pionter in TofCheckDigi(NTuple::Tuple*) for bb_tple"<<std::endl;
287 bb_tuple->addItem(
"run", bb_run );
288 bb_tuple->addItem(
"event", bb_event );
289 bb_tuple->addItem(
"trksize", bb_trksize );
290 bb_tuple->addItem(
"mdcsize", bb_mdcsize );
291 bb_tuple->addItem(
"emcsize", bb_emcsize );
292 bb_tuple->addItem(
"trk1", bb_trk1 );
293 bb_tuple->addItem(
"pmdc1", bb_pmdc1 );
294 bb_tuple->addItem(
"ptmdc1", bb_ptmdc1 );
295 bb_tuple->addItem(
"theta1", bb_theta1 );
296 bb_tuple->addItem(
"phi1", bb_phi1 );
297 bb_tuple->addItem(
"x1", bb_x1 );
298 bb_tuple->addItem(
"y1", bb_y1 );
299 bb_tuple->addItem(
"z1", bb_z1 );
300 bb_tuple->addItem(
"r1", bb_r1 );
301 bb_tuple->addItem(
"charge1", bb_charge1 );
302 bb_tuple->addItem(
"chi1", bb_chi1 );
303 bb_tuple->addItem(
"ndof1", bb_ndof1 );
304 bb_tuple->addItem(
"layer1", bb_layer1 );
305 bb_tuple->addItem(
"trk2", bb_trk2 );
306 bb_tuple->addItem(
"pmdc2", bb_pmdc2 );
307 bb_tuple->addItem(
"ptmdc2", bb_ptmdc2 );
308 bb_tuple->addItem(
"theta2", bb_theta2 );
309 bb_tuple->addItem(
"phi2", bb_phi2 );
310 bb_tuple->addItem(
"x2", bb_x2 );
311 bb_tuple->addItem(
"y2", bb_y2 );
312 bb_tuple->addItem(
"z2", bb_z2 );
313 bb_tuple->addItem(
"r2", bb_r2 );
314 bb_tuple->addItem(
"charge2", bb_charge2 );
315 bb_tuple->addItem(
"chi2", bb_chi2 );
316 bb_tuple->addItem(
"ndof2", bb_ndof2 );
317 bb_tuple->addItem(
"layer2", bb_layer2 );
318 bb_tuple->addItem(
"dang", bb_dang );
319 bb_tuple->addItem(
"dphi", bb_dphi );
320 bb_tuple->addItem(
"pe1", bb_pe1 );
321 bb_tuple->addItem(
"pte1", bb_pte1 );
322 bb_tuple->addItem(
"pe2", bb_pe2 );
323 bb_tuple->addItem(
"pte2", bb_pte2 );
324 bb_tuple->addItem(
"pmu1", bb_pmu1 );
325 bb_tuple->addItem(
"ptmu1", bb_ptmu1 );
326 bb_tuple->addItem(
"pmu2", bb_pmu2 );
327 bb_tuple->addItem(
"ptmu2", bb_ptmu2 );
328 bb_tuple->addItem(
"extx1", bb_extx1 );
329 bb_tuple->addItem(
"exty1", bb_exty1 );
330 bb_tuple->addItem(
"extz1", bb_extz1 );
331 bb_tuple->addItem(
"extx2", bb_extx2 );
332 bb_tuple->addItem(
"exty2", bb_exty2 );
333 bb_tuple->addItem(
"extz2", bb_extz2 );
334 bb_tuple->addItem(
"emctrk1", bb_emctrk1 );
335 bb_tuple->addItem(
"emcx1", bb_emcx1 );
336 bb_tuple->addItem(
"emcy1", bb_emcy1 );
337 bb_tuple->addItem(
"emcz1", bb_emcz1 );
338 bb_tuple->addItem(
"e1", bb_e1 );
339 bb_tuple->addItem(
"th1", bb_th1 );
340 bb_tuple->addItem(
"ph1", bb_ph1 );
341 bb_tuple->addItem(
"emctrk2", bb_emctrk2 );
342 bb_tuple->addItem(
"emcx2", bb_emcx2 );
343 bb_tuple->addItem(
"emcy2", bb_emcy2 );
344 bb_tuple->addItem(
"emcz2", bb_emcz2 );
345 bb_tuple->addItem(
"e2", bb_e2 );
346 bb_tuple->addItem(
"th2", bb_th2 );
347 bb_tuple->addItem(
"ph2", bb_ph2 );
348 bb_tuple->addItem(
"dr1", bb_dr1 );
349 bb_tuple->addItem(
"drxy1", bb_drxy1 );
350 bb_tuple->addItem(
"dz1", bb_dz1 );
351 bb_tuple->addItem(
"dr2", bb_dr2 );
352 bb_tuple->addItem(
"drxy2", bb_drxy2 );
353 bb_tuple->addItem(
"dz2", bb_dz2 );
354 bb_tuple->addItem(
"etot", bb_etot );
362 if( tofDigiCol.size() <= 0 )
return;
363 TofDigiCol::iterator iter_digi = tofDigiCol.begin();
364 for( ; iter_digi!=tofDigiCol.end(); iter_digi++ ) {
365 unsigned int overflow = (*iter_digi)->getOverflow();
366 if( ( overflow & 0xfe000000 ) == 0xfe000000 ) {
374 digi_adc = 0x7fffffff;
375 digi_tdc = 0x7fffffff;
376 digi_qclock = 1000.0;
377 digi_tclock = 1000.0;
378 digi_overflow = overflow;
387 digi_crate = ( ( overflow &0x1000000 ) >> 24 );
388 digi_geo = ( ( overflow &0x0f80000 ) >> 19 );
389 digi_tdcnum = ( ( overflow &0x0078000 ) >> 15 );
390 digi_err = ( overflow &0x0007fff );
400 unsigned int adc = (*iter_digi)->getChargeChannel();
401 unsigned int tdc = (*iter_digi)->getTimeChannel();
405 digi_barrel = barrel_ec;
409 digi_adc = ( adc & 0x1fff );
410 if( adc == 0x7fffffff ) digi_adc = adc;
412 digi_qclock = ( ( adc & 0x7e000 ) >> 13 );
413 if( adc == 0x7fffffff ) digi_qclock = 1000.;
414 digi_tclock = ( ( tdc & 0x7e000 ) >> 13 );
415 if( tdc == 0x7fffffff ) digi_tclock = 1000.;
416 digi_overflow = overflow;
417 digi_noq = ( ( overflow & 0x20 ) >> 5 );
418 digi_not = ( ( overflow & 0x10 ) >> 4 );
419 digi_multiq = ( ( overflow & 0x08 ) >> 3 );
420 digi_multit = ( ( overflow & 0x04 ) >> 2 );
421 digi_overq = ( ( overflow & 0x02 ) >> 1 );
422 digi_overt = ( overflow & 0x01 );
424 digi_t0stat = t0stat;
442 barrel_tofId = bTof->
tofId();
444 barrel_layer = bTof->
layer();
449 barrel_qtc1 = bTof->
qtc1();
450 barrel_adc1 = bTof->
adc1();
451 barrel_tdc1 = bTof->
tdc1();
452 barrel_qtc2 = bTof->
qtc2();
453 barrel_adc2 = bTof->
adc2();
454 barrel_tdc2 = bTof->
tdc2();
455 barrel_qclock1 = bTof->
qclock1();
456 barrel_tclock1 = bTof->
tclock1();
457 barrel_qclock2 = bTof->
qclock2();
458 barrel_tclock2 = bTof->
tclock2();
459 barrel_quality = bTof->
quality();
461 barrel_qtimes1 = bTof->
qtimes1();
462 barrel_ttimes1 = bTof->
ttimes1();
463 barrel_qtimes2 = bTof->
qtimes2();
464 barrel_ttimes2 = bTof->
ttimes2();
467 barrel_times = bTof->
times();
472 barrel_tsum = ( bTof->
tdc1() + bTof->
tdc2() )/2.0;
473 barrel_tsub = ( bTof->
tdc1() - bTof->
tdc2() )/2.0;
477 barrel_t0stat = t0stat;
478 barrel_tuple->write();
486 endcap_tofId = eTof->
tofId();
490 endcap_qtc = eTof->
qtc();
491 endcap_adc = eTof->
adc();
492 endcap_tdc = eTof->
tdc();
493 endcap_quality = eTof->
quality();
494 endcap_qclock = eTof->
qclock();
495 endcap_tclock = eTof->
tclock();
496 endcap_qtimes = eTof->
qtimes1();
497 endcap_ttimes = eTof->
ttimes1();
498 endcap_times = eTof->
times();
502 endcap_t0stat = t0stat;
503 endcap_tuple->write();
509 if( tofDataMap.empty() )
return;
511 for( ;
iter != tofDataMap.end();
iter++ ) {
512 if( ((*iter).second)->barrel() ) {
513 Fill_Barrel( eventHeader, (*iter).second, estime, t0stat );
516 Fill_Endcap( eventHeader, (*iter).second, estime, t0stat );
524 if( tofDataVec.size() <= 0 )
return;
525 std::vector<TofData*>::iterator
iter = tofDataVec.begin();
526 for( ;
iter != tofDataVec.end();
iter++ ) {
527 if( (*iter)->barrel() ) {
542 ext_trackid = extTrack->
trackId();
544 int hitcase[5], tofId1[5], tofId2[5];
546 for(
unsigned int i=0; i<5; i++ ) {
550 ext_kalman[i] = mdcKalTrack->
getStat( 1, i );
555 if( tofId1[i]>=0 && tofId1[i]<=87 ) {
556 ext_tofid1[i] = tofId1[i];
559 else if( tofId1[i]>=176 && tofId1[i]<=223 ) {
560 ext_tofid1[i] = tofId1[i] - 176 + 48;
563 else if( tofId1[i]>=224 && tofId1[i]<=271 ) {
564 ext_tofid1[i] = tofId1[i] - 176 - 48;
568 if( tofId2[i]>=88 && tofId2[i]<=175 ) {
569 ext_tofid2[i] = tofId2[i];
570 if( hitcase[i] == 0 ) {
573 else if( hitcase[i] == 5 ) {
580 if( ( hitcase[i] == 0 ) || ( hitcase[i] == 2 ) ) {
581 ext_texp1[i] = extTrack->
tof1( i );
582 ext_path1[i] = extTrack->
tof1Path( i );
588 else if( ( hitcase[i] == 3 ) || ( hitcase[i] == 4 ) ) {
589 ext_texp1[i] = extTrack->
tof1( i );
590 ext_path1[i] = extTrack->
tof1Path( i );
597 if( ( hitcase[i] == 1 ) || ( hitcase[i] == 2 ) ) {
598 ext_texp2[i] = extTrack->
tof2( i );
599 ext_path2[i] = extTrack->
tof2Path( i );
606 if( hitcase[i] == 5 ) { ext_quality[i] = 3; }
607 else { ext_quality[i] = 0; }
609 ext_hitcase[i] = hitcase[i];
625 tof_id1 = tof->
id1();
626 tof_id2 = tof->
id2();
627 tof_barrel = tof->
barrel();
629 tof_momentum = tof->
p();
630 tof_path1 = tof->
path1();
631 tof_path2 = tof->
path2();
632 tof_zrhit1 = tof->
zrhit1();
633 tof_zrhit2 = tof->
zrhit2();
634 tof_errzr1 = tof->
errzr1();
635 tof_errzr2 = tof->
errzr2();
636 for(
unsigned int i=0; i<5; i++ ) {
637 tof_kal[i] = tof->
kal(i);
638 tof_zr1[i] = tof->
zrhit1(i);
639 tof_zr2[i] = tof->
zrhit2(i);
641 tof_ztdc1 = tof->
ztdc1();
642 tof_ztdc2 = tof->
ztdc2();
643 tof_zadc1 = tof->
zadc1();
644 tof_zadc2 = tof->
zadc2();
665 tof_size1 = tof->
size1();
666 tof_size2 = tof->
size2();
667 tof_size3 = tof->
size3();
668 tof_size4 = tof->
size4();
669 tof_theta1 = tof->
theta1();
670 tof_theta2 = tof->
theta2();
671 tof_phi1 = tof->
phi1();
672 tof_phi2 = tof->
phi2();
676 tof_tofid1 = tof->
tofId1();
677 tof_tofid2 = tof->
tofId2();
690 tof_ph11 = tof->
ph11();
691 tof_ph12 = tof->
ph12();
692 tof_ph21 = tof->
ph21();
693 tof_ph22 = tof->
ph22();
694 tof_ph1 = tof->
ph1();
695 tof_ph2 = tof->
ph2();
697 tof_tofe11 = tof->
tof11(0);
698 tof_tofe12 = tof->
tof12(0);
699 tof_tofe21 = tof->
tof21(0);
700 tof_tofe22 = tof->
tof22(0);
701 tof_tofe1 = tof->
tof1(0);
702 tof_tofe2 = tof->
tof2(0);
703 tof_tofe = tof->
tof(0);
704 tof_tofmu11 = tof->
tof11(1);
705 tof_tofmu12 = tof->
tof12(1);
706 tof_tofmu21 = tof->
tof21(1);
707 tof_tofmu22 = tof->
tof22(1);
708 tof_tofmu1 = tof->
tof1(1);
709 tof_tofmu2 = tof->
tof2(1);
710 tof_tofmu = tof->
tof(1);
711 tof_tofpi11 = tof->
tof11(2);
712 tof_tofpi12 = tof->
tof12(2);
713 tof_tofpi21 = tof->
tof21(2);
714 tof_tofpi22 = tof->
tof22(2);
715 tof_tofpi1 = tof->
tof1(2);
716 tof_tofpi2 = tof->
tof2(2);
717 tof_tofpi = tof->
tof(2);
718 tof_tofk11 = tof->
tof11(3);
719 tof_tofk12 = tof->
tof12(3);
720 tof_tofk21 = tof->
tof21(3);
721 tof_tofk22 = tof->
tof22(3);
722 tof_tofk1 = tof->
tof1(3);
723 tof_tofk2 = tof->
tof2(3);
724 tof_tofk = tof->
tof(3);
725 tof_tofp11 = tof->
tof11(4);
726 tof_tofp12 = tof->
tof12(4);
727 tof_tofp21 = tof->
tof21(4);
728 tof_tofp22 = tof->
tof22(4);
729 tof_tofp1 = tof->
tof1(4);
730 tof_tofp2 = tof->
tof2(4);
731 tof_tofp = tof->
tof(4);
732 tof_qch1 = tof->
qch1();
733 tof_qch2 = tof->
qch2();
734 tof_qch3 = tof->
qch3();
735 tof_qch4 = tof->
qch4();
736 tof_adc1 = tof->
adc1();
737 tof_adc2 = tof->
adc2();
738 tof_adc3 = tof->
adc3();
739 tof_adc4 = tof->
adc4();
740 tof_tdc1 = tof->
tdc1();
741 tof_tdc2 = tof->
tdc2();
742 tof_tdc3 = tof->
tdc3();
743 tof_tdc4 = tof->
tdc4();
754 tof_texpe = tof->
texp(0);
755 tof_texpmu = tof->
texp(1);
756 tof_texppi = tof->
texp(2);
757 tof_texpk = tof->
texp(3);
758 tof_texpp = tof->
texp(4);
759 tof_tdiff1 = tof->
tdiff1();
760 tof_tdiff2 = tof->
tdiff2();
775 tof_id1 = tof->
id1();
776 tof_id2 = tof->
id2();
777 tof_barrel = tof->
barrel();
779 tof_momentum = tof->
p();
780 tof_path1 = tof->
path1();
781 tof_path2 = tof->
path2();
782 tof_zrhit1 = tof->
zrhit1();
783 tof_zrhit2 = tof->
zrhit2();
784 tof_errzr1 = tof->
errzr1();
785 tof_errzr2 = tof->
errzr2();
786 for(
unsigned int i=0; i<5; i++ ) {
787 tof_kal[i] = tof->
kal(i);
788 tof_zr1[i] = tof->
zrhit1(i);
789 tof_zr2[i] = tof->
zrhit2(i);
791 tof_ztdc1 = tof->
ztdc1();
792 tof_ztdc2 = tof->
ztdc2();
793 tof_zadc1 = tof->
zadc1();
794 tof_zadc2 = tof->
zadc2();
815 tof_size1 = tof->
size1();
816 tof_size2 = tof->
size2();
817 tof_size3 = tof->
size3();
818 tof_size4 = tof->
size4();
819 tof_theta1 = tof->
theta1();
820 tof_theta2 = tof->
theta2();
821 tof_phi1 = tof->
phi1();
822 tof_phi2 = tof->
phi2();
826 tof_tofid1 = tof->
tofId1();
827 tof_tofid2 = tof->
tofId2();
840 tof_ph11 = tof->
ph11();
841 tof_ph12 = tof->
ph12();
842 tof_ph21 = tof->
ph21();
843 tof_ph22 = tof->
ph22();
844 tof_ph1 = tof->
ph1();
845 tof_ph2 = tof->
ph2();
847 tof_tofe11 = tof->
tof11(0);
848 tof_tofe12 = tof->
tof12(0);
849 tof_tofe21 = tof->
tof21(0);
850 tof_tofe22 = tof->
tof22(0);
851 tof_tofe1 = tof->
tof1(0);
852 tof_tofe2 = tof->
tof2(0);
853 tof_tofe = tof->
tof(0);
854 tof_tofmu11 = tof->
tof11(1);
855 tof_tofmu12 = tof->
tof12(1);
856 tof_tofmu21 = tof->
tof21(1);
857 tof_tofmu22 = tof->
tof22(1);
858 tof_tofmu1 = tof->
tof1(1);
859 tof_tofmu2 = tof->
tof2(1);
860 tof_tofmu = tof->
tof(1);
861 tof_tofpi11 = tof->
tof11(2);
862 tof_tofpi12 = tof->
tof12(2);
863 tof_tofpi21 = tof->
tof21(2);
864 tof_tofpi22 = tof->
tof22(2);
865 tof_tofpi1 = tof->
tof1(2);
866 tof_tofpi2 = tof->
tof2(2);
867 tof_tofpi = tof->
tof(2);
868 tof_tofk11 = tof->
tof11(3);
869 tof_tofk12 = tof->
tof12(3);
870 tof_tofk21 = tof->
tof21(3);
871 tof_tofk22 = tof->
tof22(3);
872 tof_tofk1 = tof->
tof1(3);
873 tof_tofk2 = tof->
tof2(3);
874 tof_tofk = tof->
tof(3);
875 tof_tofp11 = tof->
tof11(4);
876 tof_tofp12 = tof->
tof12(4);
877 tof_tofp21 = tof->
tof21(4);
878 tof_tofp22 = tof->
tof22(4);
879 tof_tofp1 = tof->
tof1(4);
880 tof_tofp2 = tof->
tof2(4);
881 tof_tofp = tof->
tof(4);
882 tof_qch1 = tof->
qch1();
883 tof_qch2 = tof->
qch2();
884 tof_qch3 = tof->
qch3();
885 tof_qch4 = tof->
qch4();
886 tof_adc1 = tof->
adc1();
887 tof_adc2 = tof->
adc2();
888 tof_adc3 = tof->
adc3();
889 tof_adc4 = tof->
adc4();
890 tof_tdc1 = tof->
tdc1();
891 tof_tdc2 = tof->
tdc2();
892 tof_tdc3 = tof->
tdc3();
893 tof_tdc4 = tof->
tdc4();
904 tof_texpe = tof->
texp(0);
905 tof_texpmu = tof->
texp(1);
906 tof_texppi = tof->
texp(2);
907 tof_texpk = tof->
texp(3);
908 tof_texpp = tof->
texp(4);
909 tof_tdiff1 = tof->
tdiff1();
910 tof_tdiff2 = tof->
tdiff2();
911 unsigned int trigChannel = 0;
912 for(
int i=0 ; i < 16; i++ ) {
913 trigChannel = ( trigChannel | ( ( trigData.
getTrigChannel(i) ) << i ) );
915 tof_trig = trigChannel;
930 RecMdcKalTrackCol::iterator
iter = mdcKalTrackCol.begin();
931 for( ;
iter != mdcKalTrackCol.end();
iter++ ) {
932 if( (*iter)->trackId() == tof->
trackId() ) {
933 double kappa = 10000.0;
934 double tanl = -10000.0;
937 kappa = (*iter)->kappa();
938 tanl = (*iter)->tanl();
939 if( kappa>0 ) { tof_charge = 1; }
940 else { tof_charge = -1; }
941 if(
abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
942 tof_pt[0] = 1.0/kappa;
943 tof_p[0] =
abs(sqrt(1.0+tanl*tanl)*tof_pt[0]);
946 kappa = (*iter)->kappa();
947 tanl = (*iter)->tanl();
948 if(
abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
949 tof_pt[1] = 1.0/kappa;
950 tof_p[1] =
abs(sqrt(1.0+tanl*tanl)*tof_pt[1]);
953 kappa = (*iter)->kappa();
954 tanl = (*iter)->tanl();
955 if(
abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
956 tof_pt[2] = 1.0/kappa;
957 tof_p[2] =
abs(sqrt(1.0+tanl*tanl)*tof_pt[2]);
960 kappa = (*iter)->kappa();
961 tanl = (*iter)->tanl();
962 if(
abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
963 tof_pt[3] = 1.0/kappa;
964 tof_p[3] =
abs(sqrt(1.0+tanl*tanl)*tof_pt[3]);
967 kappa = (*iter)->kappa();
968 tanl = (*iter)->tanl();
969 if(
abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
970 tof_pt[4] = 1.0/kappa;
971 tof_p[4] =
abs(sqrt(1.0+tanl*tanl)*tof_pt[4]);
976 tof_id1 = tof->
id1();
977 tof_id2 = tof->
id2();
978 tof_barrel = tof->
barrel();
980 tof_momentum = tof->
p();
981 tof_path1 = tof->
path1();
982 tof_path2 = tof->
path2();
983 tof_zrhit1 = tof->
zrhit1();
984 tof_zrhit2 = tof->
zrhit2();
985 tof_errzr1 = tof->
errzr1();
986 tof_errzr2 = tof->
errzr2();
987 for(
unsigned int i=0; i<5; i++ ) {
988 tof_kal[i] = tof->
kal(i);
989 tof_zr1[i] = tof->
zrhit1(i);
990 tof_zr2[i] = tof->
zrhit2(i);
992 tof_ztdc1 = tof->
ztdc1();
993 tof_ztdc2 = tof->
ztdc2();
994 tof_zadc1 = tof->
zadc1();
995 tof_zadc2 = tof->
zadc2();
1016 tof_size1 = tof->
size1();
1017 tof_size2 = tof->
size2();
1018 tof_size3 = tof->
size3();
1019 tof_size4 = tof->
size4();
1020 tof_theta1 = tof->
theta1();
1021 tof_theta2 = tof->
theta2();
1022 tof_phi1 = tof->
phi1();
1023 tof_phi2 = tof->
phi2();
1027 tof_tofid1 = tof->
tofId1();
1028 tof_tofid2 = tof->
tofId2();
1041 tof_ph11 = tof->
ph11();
1042 tof_ph12 = tof->
ph12();
1043 tof_ph21 = tof->
ph21();
1044 tof_ph22 = tof->
ph22();
1045 tof_ph1 = tof->
ph1();
1046 tof_ph2 = tof->
ph2();
1048 tof_tofe11 = tof->
tof11(0);
1049 tof_tofe12 = tof->
tof12(0);
1050 tof_tofe21 = tof->
tof21(0);
1051 tof_tofe22 = tof->
tof22(0);
1052 tof_tofe1 = tof->
tof1(0);
1053 tof_tofe2 = tof->
tof2(0);
1054 tof_tofe = tof->
tof(0);
1055 tof_tofmu11 = tof->
tof11(1);
1056 tof_tofmu12 = tof->
tof12(1);
1057 tof_tofmu21 = tof->
tof21(1);
1058 tof_tofmu22 = tof->
tof22(1);
1059 tof_tofmu1 = tof->
tof1(1);
1060 tof_tofmu2 = tof->
tof2(1);
1061 tof_tofmu = tof->
tof(1);
1062 tof_tofpi11 = tof->
tof11(2);
1063 tof_tofpi12 = tof->
tof12(2);
1064 tof_tofpi21 = tof->
tof21(2);
1065 tof_tofpi22 = tof->
tof22(2);
1066 tof_tofpi1 = tof->
tof1(2);
1067 tof_tofpi2 = tof->
tof2(2);
1068 tof_tofpi = tof->
tof(2);
1069 tof_tofk11 = tof->
tof11(3);
1070 tof_tofk12 = tof->
tof12(3);
1071 tof_tofk21 = tof->
tof21(3);
1072 tof_tofk22 = tof->
tof22(3);
1073 tof_tofk1 = tof->
tof1(3);
1074 tof_tofk2 = tof->
tof2(3);
1075 tof_tofk = tof->
tof(3);
1076 tof_tofp11 = tof->
tof11(4);
1077 tof_tofp12 = tof->
tof12(4);
1078 tof_tofp21 = tof->
tof21(4);
1079 tof_tofp22 = tof->
tof22(4);
1080 tof_tofp1 = tof->
tof1(4);
1081 tof_tofp2 = tof->
tof2(4);
1082 tof_tofp = tof->
tof(4);
1083 tof_qch1 = tof->
qch1();
1084 tof_qch2 = tof->
qch2();
1085 tof_qch3 = tof->
qch3();
1086 tof_qch4 = tof->
qch4();
1087 tof_adc1 = tof->
adc1();
1088 tof_adc2 = tof->
adc2();
1089 tof_adc3 = tof->
adc3();
1090 tof_adc4 = tof->
adc4();
1091 tof_tdc1 = tof->
tdc1();
1092 tof_tdc2 = tof->
tdc2();
1093 tof_tdc3 = tof->
tdc3();
1094 tof_tdc4 = tof->
tdc4();
1105 tof_texpe = tof->
texp(0);
1106 tof_texpmu = tof->
texp(1);
1107 tof_texppi = tof->
texp(2);
1108 tof_texpk = tof->
texp(3);
1109 tof_texpp = tof->
texp(4);
1110 tof_tdiff1 = tof->
tdiff1();
1111 tof_tdiff2 = tof->
tdiff2();
1112 tof_estime = estime;
1113 tof_t0stat = t0stat;
1126 RecMdcKalTrackCol::iterator
iter = mdcKalTrackCol.begin();
1127 for( ;
iter != mdcKalTrackCol.end();
iter++ ) {
1128 if( (*iter)->trackId() == tof->
trackId() ) {
1129 double kappa = 10000.0;
1130 double tanl = -10000.0;
1133 kappa = (*iter)->kappa();
1134 tanl = (*iter)->tanl();
1135 if( kappa>0 ) { tof_charge = 1; }
1136 else { tof_charge = -1; }
1137 if(
abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
1138 tof_pt[0] = 1.0/kappa;
1139 tof_p[0] =
abs(sqrt(1.0+tanl*tanl)*tof_pt[0]);
1142 kappa = (*iter)->kappa();
1143 tanl = (*iter)->tanl();
1144 if(
abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
1145 tof_pt[1] = 1.0/kappa;
1146 tof_p[1] =
abs(sqrt(1.0+tanl*tanl)*tof_pt[1]);
1149 kappa = (*iter)->kappa();
1150 tanl = (*iter)->tanl();
1151 if(
abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
1152 tof_pt[2] = 1.0/kappa;
1153 tof_p[2] =
abs(sqrt(1.0+tanl*tanl)*tof_pt[2]);
1156 kappa = (*iter)->kappa();
1157 tanl = (*iter)->tanl();
1158 if(
abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
1159 tof_pt[3] = 1.0/kappa;
1160 tof_p[3] =
abs(sqrt(1.0+tanl*tanl)*tof_pt[3]);
1163 kappa = (*iter)->kappa();
1164 tanl = (*iter)->tanl();
1165 if(
abs(kappa)<1.0e-6 ) { kappa = 1.0e-6; }
1166 tof_pt[4] = 1.0/kappa;
1167 tof_p[4] =
abs(sqrt(1.0+tanl*tanl)*tof_pt[4]);
1172 tof_id1 = tof->
id1();
1173 tof_id2 = tof->
id2();
1174 tof_barrel = tof->
barrel();
1176 tof_momentum = tof->
p();
1177 tof_path1 = tof->
path1();
1178 tof_path2 = tof->
path2();
1179 tof_zrhit1 = tof->
zrhit1();
1180 tof_zrhit2 = tof->
zrhit2();
1181 tof_errzr1 = tof->
errzr1();
1182 tof_errzr2 = tof->
errzr2();
1183 for(
unsigned int i=0; i<5; i++ ) {
1184 tof_kal[i] = tof->
kal(i);
1185 tof_zr1[i] = tof->
zrhit1(i);
1186 tof_zr2[i] = tof->
zrhit2(i);
1188 tof_ztdc1 = tof->
ztdc1();
1189 tof_ztdc2 = tof->
ztdc2();
1190 tof_zadc1 = tof->
zadc1();
1191 tof_zadc2 = tof->
zadc2();
1212 tof_size1 = tof->
size1();
1213 tof_size2 = tof->
size2();
1214 tof_size3 = tof->
size3();
1215 tof_size4 = tof->
size4();
1216 tof_theta1 = tof->
theta1();
1217 tof_theta2 = tof->
theta2();
1218 tof_phi1 = tof->
phi1();
1219 tof_phi2 = tof->
phi2();
1223 tof_tofid1 = tof->
tofId1();
1224 tof_tofid2 = tof->
tofId2();
1237 tof_ph11 = tof->
ph11();
1238 tof_ph12 = tof->
ph12();
1239 tof_ph21 = tof->
ph21();
1240 tof_ph22 = tof->
ph22();
1241 tof_ph1 = tof->
ph1();
1242 tof_ph2 = tof->
ph2();
1244 tof_tofe11 = tof->
tof11(0);
1245 tof_tofe12 = tof->
tof12(0);
1246 tof_tofe21 = tof->
tof21(0);
1247 tof_tofe22 = tof->
tof22(0);
1248 tof_tofe1 = tof->
tof1(0);
1249 tof_tofe2 = tof->
tof2(0);
1250 tof_tofe = tof->
tof(0);
1251 tof_tofmu11 = tof->
tof11(1);
1252 tof_tofmu12 = tof->
tof12(1);
1253 tof_tofmu21 = tof->
tof21(1);
1254 tof_tofmu22 = tof->
tof22(1);
1255 tof_tofmu1 = tof->
tof1(1);
1256 tof_tofmu2 = tof->
tof2(1);
1257 tof_tofmu = tof->
tof(1);
1258 tof_tofpi11 = tof->
tof11(2);
1259 tof_tofpi12 = tof->
tof12(2);
1260 tof_tofpi21 = tof->
tof21(2);
1261 tof_tofpi22 = tof->
tof22(2);
1262 tof_tofpi1 = tof->
tof1(2);
1263 tof_tofpi2 = tof->
tof2(2);
1264 tof_tofpi = tof->
tof(2);
1265 tof_tofk11 = tof->
tof11(3);
1266 tof_tofk12 = tof->
tof12(3);
1267 tof_tofk21 = tof->
tof21(3);
1268 tof_tofk22 = tof->
tof22(3);
1269 tof_tofk1 = tof->
tof1(3);
1270 tof_tofk2 = tof->
tof2(3);
1271 tof_tofk = tof->
tof(3);
1272 tof_tofp11 = tof->
tof11(4);
1273 tof_tofp12 = tof->
tof12(4);
1274 tof_tofp21 = tof->
tof21(4);
1275 tof_tofp22 = tof->
tof22(4);
1276 tof_tofp1 = tof->
tof1(4);
1277 tof_tofp2 = tof->
tof2(4);
1278 tof_tofp = tof->
tof(4);
1279 tof_qch1 = tof->
qch1();
1280 tof_qch2 = tof->
qch2();
1281 tof_qch3 = tof->
qch3();
1282 tof_qch4 = tof->
qch4();
1283 tof_adc1 = tof->
adc1();
1284 tof_adc2 = tof->
adc2();
1285 tof_adc3 = tof->
adc3();
1286 tof_adc4 = tof->
adc4();
1287 tof_tdc1 = tof->
tdc1();
1288 tof_tdc2 = tof->
tdc2();
1289 tof_tdc3 = tof->
tdc3();
1290 tof_tdc4 = tof->
tdc4();
1301 tof_texpe = tof->
texp(0);
1302 tof_texpmu = tof->
texp(1);
1303 tof_texppi = tof->
texp(2);
1304 tof_texpk = tof->
texp(3);
1305 tof_texpp = tof->
texp(4);
1306 tof_tdiff1 = tof->
tdiff1();
1307 tof_tdiff2 = tof->
tdiff2();
1308 tof_estime = estime;
1309 tof_t0stat = t0stat;
1312 if( calibData ==
"Bhabha" ) { particleId = 11; }
1313 else if( calibData ==
"Dimu" ) { particleId = 13; }
1314 else if( calibData ==
"pion" ) { particleId = 211; }
1315 else if( calibData ==
"kaon" ) { particleId = 321; }
1316 else if( calibData ==
"proton" ) { particleId = 2212; }
1318 cout <<
"Reconstruction::TofRec::TofCheckDigi::Fill_TofTrack: For MC, Wrong Input Particle ID!" << endl;
1322 tof_mctofp = -100.0;
1323 tof_mctrkid = -100.0;
1324 tof_mcpath = -100.0;
1325 tof_mctexp = -100.0;
1326 tof_mczrhit = -1000.0;
1328 McParticleCol::iterator iter_mc = mcParticleCol.begin();
1329 for( ; iter_mc != mcParticleCol.end(); iter_mc++ ) {
1330 int pid = (*iter_mc)->particleProperty();
1331 if(
abs(pid) != particleId )
continue;
1332 if( ( particleId==11 || particleId==13 ) && ( ( pid>0 && tof_charge>0 ) || ( pid<0 && tof_charge<0 ) ) )
continue;
1333 if( ( particleId!=11 && particleId!=13 ) && ( ( pid>0 && tof_charge<0 ) || ( pid<0 && tof_charge>0 ) ) )
continue;
1335 int trkIndex = (*iter_mc)->trackIndex();
1336 tof_mcp = (*iter_mc)->initialFourMomentum().rho();
1338 TofMcHitCol::iterator iter_mc_tof = tofMcCol.begin();
1339 for( ; iter_mc_tof != tofMcCol.end(); iter_mc_tof++ ) {
1340 if( trkIndex != (*iter_mc_tof)->getTrackIndex() )
continue;
1341 double mcposx = (*iter_mc_tof)->getPositionX();
1342 double mcposy = (*iter_mc_tof)->getPositionY();
1343 double mcposr = 0.1*sqrt(mcposx*mcposx+mcposy*mcposy);
1344 double mcposz = 0.1*(*iter_mc_tof)->getPositionZ();
1345 double mcpx = (*iter_mc_tof)->getPx();
1346 double mcpy = (*iter_mc_tof)->getPy();
1347 double mcpz = (*iter_mc_tof)->getPz();
1348 double mctofp = 0.001*sqrt(mcpx*mcpx+mcpy*mcpy+mcpz*mcpz);
1349 tof_mctofp = mctofp;
1350 tof_mctrkid = (*iter_mc_tof)->getTrackIndex();
1351 tof_mcpath = 0.1*(*iter_mc_tof)->getTrackLength();
1352 tof_mctexp = (*iter_mc_tof)->getFlightTime();
1354 tof_mczrhit = mcposz;
1357 tof_mczrhit = mcposr;
1369 if( mdcKalTrackCol.size() <= 0 || recExtTrackCol.size() <= 0 )
return;
1370 RecExtTrackCol::iterator iter_ext = recExtTrackCol.begin();
1371 for( ; iter_ext!=recExtTrackCol.end(); iter_ext++ ) {
1372 RecMdcKalTrackCol::iterator iter_kal = mdcKalTrackCol.begin();
1373 for( ; iter_kal!=mdcKalTrackCol.end(); iter_kal++ ) {
1374 if( (*iter_kal)->getTrackId() == (*iter_ext)->trackId() )
break;
1376 if( iter_kal != mdcKalTrackCol.end() ) {
1377 Fill( eventHeader, *iter_kal, *iter_ext );
1387 bb_trksize = extTrackCol.size();
1388 bb_mdcsize = mdcTrackCol.size();
1389 bb_emcsize = emcShowerCol.size();
1391 RecMdcTrackCol::iterator iter_mdc1 = mdcTrackCol.begin();
1392 RecMdcTrackCol::iterator iter_mdc2 = mdcTrackCol.begin() + 1;
1394 Hep3Vector p1 = (*iter_mdc1)->p3();
1395 Hep3Vector p2 = (*iter_mdc2)->p3();
1397 bb_trk1 = (*iter_mdc1)->trackId();
1398 bb_pmdc1 = (*iter_mdc1)->p();
1399 bb_ptmdc1 = (*iter_mdc1)->pxy();
1400 bb_theta1 = (*iter_mdc1)->theta();
1401 bb_phi1 = (*iter_mdc1)->phi();
1402 bb_x1 = (*iter_mdc1)->x();
1403 bb_y1 = (*iter_mdc1)->y();
1404 bb_z1 = (*iter_mdc1)->z();
1405 bb_r1 = (*iter_mdc1)->r();
1406 bb_charge1 = (*iter_mdc1)->charge();
1407 bb_chi1 = (*iter_mdc1)->chi2();
1408 bb_ndof1 = (*iter_mdc1)->ndof();
1409 bb_layer1 = (*iter_mdc1)->lastLayer();
1410 bb_trk2 = (*iter_mdc2)->trackId();
1411 bb_pmdc2 = (*iter_mdc2)->p();
1412 bb_ptmdc2 = (*iter_mdc2)->pxy();
1413 bb_theta2 = (*iter_mdc2)->theta();
1414 bb_phi2 = (*iter_mdc2)->phi();
1415 bb_x2 = (*iter_mdc2)->x();
1416 bb_y2 = (*iter_mdc2)->y();
1417 bb_z2 = (*iter_mdc2)->z();
1418 bb_r2 = (*iter_mdc2)->r();
1419 bb_charge2 = (*iter_mdc2)->charge();
1420 bb_chi2 = (*iter_mdc2)->chi2();
1421 bb_ndof2 = (*iter_mdc2)->ndof();
1422 bb_layer2 = (*iter_mdc2)->lastLayer();
1424 bb_dang = 180.0 - p1.angle( p2.unit() )*180.0/
pi;
1425 bb_dphi =
abs( (*iter_mdc1)->phi() - (*iter_mdc2)->phi() )*180.0/
pi;
1427 RecMdcKalTrackCol::iterator iter_kal1 = mdcKalTrackCol.begin();
1428 RecMdcKalTrackCol::iterator iter_kal2 = mdcKalTrackCol.begin() + 1;
1430 if( ( (*iter_kal1)->trackId() == (*iter_mdc2)->trackId() ) && ( (*iter_kal2)->trackId() == (*iter_mdc1)->trackId() ) ) {
1431 RecMdcKalTrackCol::iterator iter_tmp = iter_kal1;
1432 iter_kal1 = iter_kal2;
1433 iter_kal2 = iter_tmp;
1439 double tanl1 = (*iter_kal1)->tanl();
1440 double kappa1 = (*iter_kal1)->kappa();
1441 double tanl2 = (*iter_kal2)->tanl();
1442 double kappa2 = (*iter_kal2)->kappa();
1443 bb_pe1 = sqrt(1.0+tanl1*tanl1)/kappa1;
1444 bb_pte1 = 1.0/kappa1;
1445 bb_pe2 = sqrt(1.0+tanl2*tanl2)/kappa2;
1446 bb_pte2 = 1.0/kappa2;
1450 tanl1 = (*iter_kal1)->tanl();
1451 kappa1 = (*iter_kal1)->kappa();
1452 tanl2 = (*iter_kal2)->tanl();
1453 kappa2 = (*iter_kal2)->kappa();
1454 bb_pmu1 = sqrt(1.0+tanl1*tanl1)/kappa1;
1455 bb_ptmu1 = 1.0/kappa1;
1456 bb_pmu2 = sqrt(1.0+tanl2*tanl2)/kappa2;
1457 bb_ptmu2 = 1.0/kappa2;
1459 RecExtTrackCol::iterator iter_ext1 = extTrackCol.begin();
1460 RecExtTrackCol::iterator iter_ext2 = extTrackCol.begin() + 1;
1462 Hep3Vector extPos1 = (*iter_ext1)->emcPosition();
1463 Hep3Vector extPos2 = (*iter_ext2)->emcPosition();
1465 bb_extx1 = extPos1.x();
1466 bb_exty1 = extPos1.y();
1467 bb_extz1 = extPos1.z();
1468 bb_extx2 = extPos2.x();
1469 bb_exty2 = extPos2.y();
1470 bb_extz2 = extPos2.z();
1472 RecEmcShowerCol::iterator iter_emc1 = emcShowerCol.begin();
1473 RecEmcShowerCol::iterator iter_emc2 = emcShowerCol.begin() + 1;
1475 Hep3Vector emcPos1((*iter_emc1)->x(),(*iter_emc1)->y(),(*iter_emc1)->z());
1476 Hep3Vector emcPos2((*iter_emc2)->x(),(*iter_emc2)->y(),(*iter_emc2)->z());
1481 Hep3Vector dis1 = extPos1 - emcPos1;
1482 Hep3Vector dis2 = extPos2 - emcPos1;
1486 if( dis1.r() > dis2.r() ) {
1487 RecEmcShowerCol::iterator iter_tmp = iter_emc1;
1488 iter_emc1 = iter_emc2;
1489 iter_emc2 = iter_tmp;
1490 Hep3Vector emc_tmp = emcPos1;
1494 dis1 = extPos1 - emcPos1;
1495 dis2 = extPos2 - emcPos2;
1497 bb_emctrk1 = (*iter_emc1)->trackId();
1498 bb_emcx1 = (*iter_emc1)->x();
1499 bb_emcy1 = (*iter_emc1)->y();
1500 bb_emcz1 = (*iter_emc1)->z();
1501 bb_e1 = (*iter_emc1)->energy();
1502 bb_th1 = (*iter_emc1)->theta();
1503 bb_ph1 = (*iter_emc1)->phi();
1504 bb_emctrk2 = (*iter_emc2)->trackId();
1505 bb_emcx2 = (*iter_emc2)->x();
1506 bb_emcy2 = (*iter_emc2)->y();
1507 bb_emcz2 = (*iter_emc2)->z();
1508 bb_e2 = (*iter_emc2)->energy();
1509 bb_th2 = (*iter_emc2)->theta();
1510 bb_ph2 = (*iter_emc2)->phi();
1512 bb_drxy1 = dis1.rho();
1515 bb_drxy2 = dis2.rho();
1519 RecEmcShowerCol::iterator iter_emc = emcShowerCol.begin();
1520 for( ; iter_emc != emcShowerCol.end(); iter_emc++ ) {
1521 etot += (*iter_emc)->energy();
ObjectVector< RecEmcShower > RecEmcShowerCol
ObjectVector< RecExtTrack > RecExtTrackCol
std::multimap< unsigned int, TofData * > TofDataMap
std::multimap< unsignedint, TofData * >::iterator IterTofDataMap
double abs(const EvtComplex &c)
ObjectVector< RecMdcKalTrack > RecMdcKalTrackCol
ObjectVector< RecMdcTrack > RecMdcTrackCol
ObjectVector< TofDigi > TofDigiCol
const double tof1Path() const
const Hep3Vector tof1Position() const
const int tof1VolumeNumber() const
const double tof1() const
const Hep3Vector tof2Momentum() const
const Hep3Vector tof1Momentum() const
const double tof2() const
const double tof2PosSigmaAlongZ() const
const double tof1PosSigmaAlongX() const
const double tof2Path() const
const int trackId() const
const double tof1PosSigmaAlongY() const
const double tof1PosSigmaAlongZ() const
const int tof2VolumeNumber() const
const Hep3Vector tof2Position() const
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
int getStat(int i, int pid) const
void Fill_TofTrack(Event::EventHeader &, TofTrack *&, double, int)
void Fill_Endcap(Event::EventHeader &, TofData *&, double, int)
void Fill_Barrel(Event::EventHeader &, TofData *&, double, int)
void Fill(Event::EventHeader &, RecMdcKalTrack *&, RecExtTrack *&)
void FillCol(Event::EventHeader &, TofDigiCol &, double, int)
TofCheckDigi(NTuple::Tuple *&digi, NTuple::Tuple *&barrel, NTuple::Tuple *&endcap, NTuple::Tuple *&ext, NTuple::Tuple *&tof, NTuple::Tuple *&bhabha)
unsigned int quality() const
unsigned int times() const
static int end(const Identifier &id)
static int phi_module(const Identifier &id)
static int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
static int layer(const Identifier &id)
double tof2(unsigned int i) const
double tof11(unsigned int i) const
double tof12(unsigned int i) const
ExtTrackCase hitCase() const
int kal(unsigned int i) const
unsigned int quality1() 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
unsigned int quality() const
unsigned int barrel() const
unsigned int quality2() const
const int getTrigChannel(int i) const