BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
MrpcCheckDigi.cxx
Go to the documentation of this file.
4// #include "TofQElecSvc/ITofQElecSvc.h"
6#include "Identifier/TofID.h"
7#include "McTruth/TofMcHit.h"
9#include <iostream>
10
12// extern ITofQElecSvc* tofQElecSvc;
13
14MrpcCheckDigi::MrpcCheckDigi( 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) {
15 if(!digi_tuple) {
16 std::cerr<<" Error: invalid pionter in MrpcCheckDigi(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("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 );
42 }
43
44 if(!barrel_tuple) {
45 std::cerr<<" Error: invalid pionter in MrpcCheckDigi(NTuple::Tuple*) for barrel_tuple "<<std::endl;
46 }
47 else{
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 );
86 }
87
88 if(!endcap_tuple) {
89 std::cerr<<" Error: invalid pionter in TofCheckDigi(NTuple::Tuple*) for endcap_tuple "<<std::endl;
90 }
91 else{
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 );
111 }
112
113 if(!ext_tuple) {
114 std::cerr<<" Error: invalid pionter in MrpcCheckDigi(NTuple::Tuple*) for ext_tple"<<std::endl;
115 }
116 else{
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 );
138 }
139
140 if(!tof_tuple) {
141 std::cerr<<" Error: invalid pionter in MrpcCheckDigi(NTuple::Tuple*) for tof_tple"<<std::endl;
142 }
143 else{
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 );
281 }
282
283 if(!bb_tuple) {
284 std::cerr<<" Error: invalid pionter in MrpcCheckDigi(NTuple::Tuple*) for bb_tple"<<std::endl;
285 }
286 else{
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 );
355 }
356
357 return;
358}
359
360
361void MrpcCheckDigi::FillCol(Event::EventHeader& eventHeader, TofDigiCol& tofDigiCol, double estime, int t0stat ) {
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 ) {
367 if( digi_tuple ) {
368 digi_run = eventHeader.runNumber();
369 digi_event = eventHeader.eventNumber();
370 digi_barrel = -1;
371 digi_layer = -1;
372 digi_tofId = -1;
373 digi_end = -1;
374 digi_adc = 0x7fffffff; // adc 13bits
375 digi_tdc = 0x7fffffff;
376 digi_qclock = 1000.0;
377 digi_tclock = 1000.0;
378 digi_overflow = overflow;
379 digi_noq = -1;
380 digi_not = -1;
381 digi_multiq = -1;
382 digi_multit = -1;
383 digi_overq = -1;
384 digi_overt = -1;
385 digi_t0 = -1;
386 digi_t0stat = -1;
387 digi_crate = ( ( overflow &0x1000000 ) >> 24 );
388 digi_geo = ( ( overflow &0x0f80000 ) >> 19 );
389 digi_tdcnum = ( ( overflow &0x0078000 ) >> 15 );
390 digi_err = ( overflow &0x0007fff );
391 digi_tuple->write();
392 }
393 }
394 else {
395 Identifier iden = (*iter_digi)->identify();
396 int barrel_ec = TofID::barrel_ec(iden);
397 int layer = TofID::layer(iden);
398 int imod = TofID::phi_module(iden);
399 int end = TofID::end(iden);
400 unsigned int adc = (*iter_digi)->getChargeChannel();
401 unsigned int tdc = (*iter_digi)->getTimeChannel();
402 if( digi_tuple ) {
403 digi_run = eventHeader.runNumber();
404 digi_event = eventHeader.eventNumber();
405 digi_barrel = barrel_ec;
406 digi_layer = layer;
407 digi_tofId = imod;
408 digi_end = end;
409 digi_adc = ( adc & 0x1fff ); // adc 13bits
410 if( adc == 0x7fffffff ) digi_adc = adc;
411 digi_tdc = tdc;
412 digi_qclock = ( ( adc & 0x7e000 ) >> 13 ); // adc high 6 bits, time clock
413 if( adc == 0x7fffffff ) digi_qclock = 1000.;
414 digi_tclock = ( ( tdc & 0x7e000 ) >> 13 ); // tdc high 6 bits, time clock
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 );
423 digi_t0 = estime;
424 digi_t0stat = t0stat;
425 digi_crate = -1;
426 digi_geo = -1;
427 digi_tdcnum = -1;
428 digi_tdcnum = -1;
429 digi_err = -1;
430 digi_tuple->write();
431 }
432 }
433 }
434
435 return;
436}
437
438
439void MrpcCheckDigi::Fill_Barrel(Event::EventHeader& eventHeader, TofData*& bTof, double estime, int t0stat ) {
440 barrel_run = eventHeader.runNumber();
441 barrel_event = eventHeader.eventNumber();
442 barrel_tofId = bTof->tofId();
443 barrel_tofTrackId = bTof->tofTrackId();
444 barrel_layer = bTof->layer();
445 barrel_qchannel1 = bTof->adcChannelEast();
446 barrel_tchannel1 = bTof->tdcChannelEast();
447 barrel_qchannel2 = bTof->adcChannelWest();
448 barrel_tchannel2 = bTof->tdcChannelWest();
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();
460 barrel_tmatched = bTof->tmatched();
461 barrel_qtimes1 = bTof->qtimes1();
462 barrel_ttimes1 = bTof->ttimes1();
463 barrel_qtimes2 = bTof->qtimes2();
464 barrel_ttimes2 = bTof->ttimes2();
465 barrel_times1 = bTof->eastTimes();
466 barrel_times2 = bTof->westTimes();
467 barrel_times = bTof->times();
468 barrel_qnum1 = bTof->qnumber1();
469 barrel_tnum1 = bTof->tnumber1();
470 barrel_qnum2 = bTof->qnumber2();
471 barrel_tnum2 = bTof->tnumber2();
472 barrel_tsum = ( bTof->tdc1() + bTof->tdc2() )/2.0;
473 barrel_tsub = ( bTof->tdc1() - bTof->tdc2() )/2.0;
474 barrel_ztdc = tofCaliSvc->ZTDC( bTof->tdc1(), bTof->tdc2(), bTof->tofId() );
475 barrel_zadc = tofCaliSvc->ZADC( bTof->adc1(), bTof->adc2(), bTof->tofId() );
476 barrel_t0 = estime;
477 barrel_t0stat = t0stat;
478 barrel_tuple->write();
479 return;
480}
481
482
483void MrpcCheckDigi::Fill_Endcap(Event::EventHeader& eventHeader, TofData*& eTof, double estime, int t0stat) {
484 endcap_run = eventHeader.runNumber();
485 endcap_event = eventHeader.eventNumber();
486 endcap_tofId = eTof->tofId();
487 endcap_tofTrackId = eTof->tofTrackId();
488 endcap_qchannel = eTof->adcChannel();
489 endcap_tchannel = eTof->tdcChannel();
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();
499 endcap_qnum = eTof->qnumber1();
500 endcap_tnum = eTof->tnumber1();
501 endcap_t0 = estime;
502 endcap_t0stat = t0stat;
503 endcap_tuple->write();
504 return;
505}
506
507
508void MrpcCheckDigi::FillCol(Event::EventHeader& eventHeader, TofDataMap& tofDataMap, double estime, int t0stat) {
509 if( tofDataMap.empty() ) return;
510 IterTofDataMap iter = tofDataMap.begin();
511 for( ; iter != tofDataMap.end(); iter++ ) {
512 if( ((*iter).second)->barrel() ) {
513 Fill_Barrel( eventHeader, (*iter).second, estime, t0stat );
514 }
515 else {
516 Fill_Endcap( eventHeader, (*iter).second, estime, t0stat );
517 }
518 }
519 return;
520}
521
522
523void MrpcCheckDigi::FillCol(Event::EventHeader& eventHeader, std::vector<TofData*>& tofDataVec, double estime, int 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() ) {
528 Fill_Barrel( eventHeader, (*iter), estime, t0stat );
529 }
530 else {
531 Fill_Endcap( eventHeader, (*iter), estime, t0stat );
532 }
533 }
534 return;
535}
536
537
538void MrpcCheckDigi::Fill(Event::EventHeader& eventHeader, RecMdcKalTrack*& mdcKalTrack, RecExtTrack*& extTrack ) {
539
540 ext_run = eventHeader.runNumber();
541 ext_event = eventHeader.eventNumber();
542 ext_trackid = extTrack->trackId();
543
544 int hitcase[5], tofId1[5], tofId2[5];
545
546 for( unsigned int i=0; i<5; i++ ) {
547
548 hitcase[i] = 5;
549
550 ext_kalman[i] = mdcKalTrack->getStat( 1, i );
551
552 tofId1[i] = extTrack->tof1VolumeNumber( i );
553 tofId2[i] = extTrack->tof2VolumeNumber( i );
554
555 if( tofId1[i]>=0 && tofId1[i]<=87 ) {
556 ext_tofid1[i] = tofId1[i];
557 hitcase[i] = 0;
558 }
559 else if( tofId1[i]>=176 && tofId1[i]<=223 ) {
560 ext_tofid1[i] = tofId1[i] - 176 + 48;
561 hitcase[i] = 4;
562 }
563 else if( tofId1[i]>=224 && tofId1[i]<=271 ) {
564 ext_tofid1[i] = tofId1[i] - 176 - 48;
565 hitcase[i] = 3;
566 }
567
568 if( tofId2[i]>=88 && tofId2[i]<=175 ) {
569 ext_tofid2[i] = tofId2[i];
570 if( hitcase[i] == 0 ) {
571 hitcase[i] = 2;
572 }
573 else if( hitcase[i] == 5 ) {
574 hitcase[i] = 1;
575 }
576 }
577
578 ext_p[i] = extTrack->tof1Momentum( i ).r();
579
580 if( ( hitcase[i] == 0 ) || ( hitcase[i] == 2 ) ) {
581 ext_texp1[i] = extTrack->tof1( i );
582 ext_path1[i] = extTrack->tof1Path( i );
583 ext_zrhit1[i] = extTrack->tof1Position( i ).z();
584 ext_errzr1[i] = extTrack->tof1PosSigmaAlongZ( i );
585 ext_theta1[i] = extTrack->tof1Momentum( i ).rho()/extTrack->tof1Momentum( i ).r();
586 ext_phi1[i] = extTrack->tof1Position( i ).phi();
587 }
588 else if( ( hitcase[i] == 3 ) || ( hitcase[i] == 4 ) ) {
589 ext_texp1[i] = extTrack->tof1( i );
590 ext_path1[i] = extTrack->tof1Path( i );
591 ext_zrhit1[i] = extTrack->tof1Position( i ).rho();
592 ext_errzr1[i] = sqrt( extTrack->tof1PosSigmaAlongX( i )*extTrack->tof1PosSigmaAlongX( i ) + extTrack->tof1PosSigmaAlongY( i )*extTrack->tof1PosSigmaAlongY( i ) );
593 ext_theta1[i] = extTrack->tof1Momentum( i ).z()/extTrack->tof1Momentum( i ).r();
594 ext_phi1[i] = extTrack->tof1Position( i ).phi();
595 }
596
597 if( ( hitcase[i] == 1 ) || ( hitcase[i] == 2 ) ) {
598 ext_texp2[i] = extTrack->tof2( i );
599 ext_path2[i] = extTrack->tof2Path( i );
600 ext_zrhit2[i] = extTrack->tof2Position( i ).z();
601 ext_errzr2[i] = extTrack->tof2PosSigmaAlongZ( i );
602 ext_theta2[i] = extTrack->tof2Momentum( i ).rho()/extTrack->tof2Momentum( i ).r();
603 ext_phi2[i] = extTrack->tof2Position( i ).phi();
604 }
605
606 if( hitcase[i] == 5 ) { ext_quality[i] = 3; }
607 else { ext_quality[i] = 0; }
608
609 ext_hitcase[i] = hitcase[i];
610
611 }
612
613 ext_tuple->write();
614
615 return;
616}
617
618
619void MrpcCheckDigi::Fill_TofTrack(Event::EventHeader& eventHeader, MrpcTrack*& tof, double estime, int t0stat ) {
620
621 tof_run = eventHeader.runNumber();
622 tof_event = eventHeader.eventNumber();
623 tof_toftrackid = tof->tofTrackId();
624 tof_trackid = tof->trackId();
625 tof_id1 = tof->id1();
626 tof_id2 = tof->id2();
627 tof_barrel = tof->barrel();
628 tof_hitcase = tof->hitCase();
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);
640 }
641 tof_ztdc1 = tof->ztdc1();
642 tof_ztdc2 = tof->ztdc2();
643 tof_zadc1 = tof->zadc1();
644 tof_zadc2 = tof->zadc2();
645 tof_zt1 = -999.0;
646 tof_zt2 = -999.0;
647 tof_zt3 = -999.0;
648 tof_zt4 = -999.0;
649 tof_zq1 = -999.0;
650 tof_zq2 = -999.0;
651 tof_zq3 = -999.0;
652 tof_zq4 = -999.0;
653 if( tof->hitCase() == 0 || tof->hitCase() == 2 ) {
654 tof_zt1 = tofCaliSvc->ZTDC1( tof->tdc2(), tof->tofId1(), tof->zrhit1() );
655 tof_zt2 = tofCaliSvc->ZTDC2( tof->tdc1(), tof->tofId1(), tof->zrhit1() );
656 tof_zq1 = tofCaliSvc->ZADC1( tof->adc2(), tof->tofId1(), tof->zrhit1() );
657 tof_zq2 = tofCaliSvc->ZADC2( tof->adc1(), tof->tofId1(), tof->zrhit1() );
658 }
659 if( tof->hitCase() == 1 || tof->hitCase() == 2 ) {
660 tof_zt3 = tofCaliSvc->ZTDC1( tof->tdc4(), tof->tofId2(), tof->zrhit2() );
661 tof_zt4 = tofCaliSvc->ZTDC2( tof->tdc3(), tof->tofId2(), tof->zrhit2() );
662 tof_zq3 = tofCaliSvc->ZADC1( tof->adc4(), tof->tofId2(), tof->zrhit2() );
663 tof_zq4 = tofCaliSvc->ZADC2( tof->adc3(), tof->tofId2(), tof->zrhit2() );
664 }
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();
673 tof_quality1 = tof->quality1();
674 tof_quality2 = tof->quality2();
675 tof_quality = tof->quality();
676 tof_tofid1 = tof->tofId1();
677 tof_tofid2 = tof->tofId2();
678 /*
679 tof_board1 = tofQElecSvc->Board( tof->hitCase()<3, tof->tofId1(), true );
680 tof_board2 = tofQElecSvc->Board( tof->hitCase()<3, tof->tofId2(), true );
681 tof_crate1 = tofQElecSvc->Crate( tof->hitCase()<3, tof->tofId1(), true );
682 tof_crate2 = tofQElecSvc->Crate( tof->hitCase()<3, tof->tofId2(), true );
683 tof_fee1 = tofQElecSvc->Fee( tof->hitCase()<3, tof->tofId1(), true );
684 tof_fee2 = tofQElecSvc->Fee( tof->hitCase()<3, tof->tofId2(), true );
685 tof_channel1 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId1(),true );
686 tof_channel2 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId1(),false );
687 tof_channel3 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId2(),true );
688 tof_channel4 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId2(),false );
689 */
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();
696 tof_ph = tof->ph();
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();
744 tof_texpe1 = tof->texpInner(0);
745 tof_texpmu1 = tof->texpInner(1);
746 tof_texppi1 = tof->texpInner(2);
747 tof_texpk1 = tof->texpInner(3);
748 tof_texpp1 = tof->texpInner(4);
749 tof_texpe2 = tof->texpOuter(0);
750 tof_texpmu2 = tof->texpOuter(1);
751 tof_texppi2 = tof->texpOuter(2);
752 tof_texpk2 = tof->texpOuter(3);
753 tof_texpp2 = tof->texpOuter(4);
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();
761 tof_estime = estime;
762 tof_t0stat = t0stat;
763 tof_tuple->write();
764
765 return;
766}
767
768
769void MrpcCheckDigi::Fill_TofTrack(Event::EventHeader& eventHeader, MrpcTrack*& tof, double estime, int t0stat, TrigData& trigData ) {
770
771 tof_run = eventHeader.runNumber();
772 tof_event = eventHeader.eventNumber();
773 tof_toftrackid = tof->tofTrackId();
774 tof_trackid = tof->trackId();
775 tof_id1 = tof->id1();
776 tof_id2 = tof->id2();
777 tof_barrel = tof->barrel();
778 tof_hitcase = tof->hitCase();
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);
790 }
791 tof_ztdc1 = tof->ztdc1();
792 tof_ztdc2 = tof->ztdc2();
793 tof_zadc1 = tof->zadc1();
794 tof_zadc2 = tof->zadc2();
795 tof_zt1 = -999.0;
796 tof_zt2 = -999.0;
797 tof_zt3 = -999.0;
798 tof_zt4 = -999.0;
799 tof_zq1 = -999.0;
800 tof_zq2 = -999.0;
801 tof_zq3 = -999.0;
802 tof_zq4 = -999.0;
803 if( tof->hitCase() == 0 || tof->hitCase() == 2 ) {
804 tof_zt1 = tofCaliSvc->ZTDC1( tof->tdc2(), tof->tofId1(), tof->zrhit1() );
805 tof_zt2 = tofCaliSvc->ZTDC2( tof->tdc1(), tof->tofId1(), tof->zrhit1() );
806 tof_zq1 = tofCaliSvc->ZADC1( tof->adc2(), tof->tofId1(), tof->zrhit1() );
807 tof_zq2 = tofCaliSvc->ZADC2( tof->adc1(), tof->tofId1(), tof->zrhit1() );
808 }
809 if( tof->hitCase() == 1 || tof->hitCase() == 2 ) {
810 tof_zt3 = tofCaliSvc->ZTDC1( tof->tdc4(), tof->tofId2(), tof->zrhit2() );
811 tof_zt4 = tofCaliSvc->ZTDC2( tof->tdc3(), tof->tofId2(), tof->zrhit2() );
812 tof_zq3 = tofCaliSvc->ZADC1( tof->adc4(), tof->tofId2(), tof->zrhit2() );
813 tof_zq4 = tofCaliSvc->ZADC2( tof->adc3(), tof->tofId2(), tof->zrhit2() );
814 }
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();
823 tof_quality1 = tof->quality1();
824 tof_quality2 = tof->quality2();
825 tof_quality = tof->quality();
826 tof_tofid1 = tof->tofId1();
827 tof_tofid2 = tof->tofId2();
828 /*
829 tof_board1 = tofQElecSvc->Board( tof->hitCase()<3, tof->tofId1(), true );
830 tof_board2 = tofQElecSvc->Board( tof->hitCase()<3, tof->tofId2(), true );
831 tof_crate1 = tofQElecSvc->Crate( tof->hitCase()<3, tof->tofId1(), true );
832 tof_crate2 = tofQElecSvc->Crate( tof->hitCase()<3, tof->tofId2(), true );
833 tof_fee1 = tofQElecSvc->Fee( tof->hitCase()<3, tof->tofId1(), true );
834 tof_fee2 = tofQElecSvc->Fee( tof->hitCase()<3, tof->tofId2(), true );
835 tof_channel1 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId1(),true );
836 tof_channel2 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId1(),false );
837 tof_channel3 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId2(),true );
838 tof_channel4 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId2(),false );
839 */
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();
846 tof_ph = tof->ph();
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();
894 tof_texpe1 = tof->texpInner(0);
895 tof_texpmu1 = tof->texpInner(1);
896 tof_texppi1 = tof->texpInner(2);
897 tof_texpk1 = tof->texpInner(3);
898 tof_texpp1 = tof->texpInner(4);
899 tof_texpe2 = tof->texpOuter(0);
900 tof_texpmu2 = tof->texpOuter(1);
901 tof_texppi2 = tof->texpOuter(2);
902 tof_texpk2 = tof->texpOuter(3);
903 tof_texpp2 = tof->texpOuter(4);
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 ) );
914 }
915 tof_trig = trigChannel;
916 tof_estime = estime;
917 tof_t0stat = t0stat;
918 tof_tuple->write();
919
920 return;
921}
922
923
924void MrpcCheckDigi::Fill_TofTrack(Event::EventHeader& eventHeader, MrpcTrack*& tof, double estime, int t0stat, RecMdcKalTrackCol& mdcKalTrackCol ) {
925
926 tof_run = eventHeader.runNumber();
927 tof_event = eventHeader.eventNumber();
928 tof_toftrackid = tof->tofTrackId();
929 tof_trackid = tof->trackId();
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;
935
936 (*iter)->setPidType( RecMdcKalTrack::electron );
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]);
944
945 (*iter)->setPidType( RecMdcKalTrack::muon );
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]);
951
952 (*iter)->setPidType( RecMdcKalTrack::pion );
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]);
958
959 (*iter)->setPidType( RecMdcKalTrack::kaon );
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]);
965
966 (*iter)->setPidType( RecMdcKalTrack::proton );
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]);
972
973 break;
974 }
975 }
976 tof_id1 = tof->id1();
977 tof_id2 = tof->id2();
978 tof_barrel = tof->barrel();
979 tof_hitcase = tof->hitCase();
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);
991 }
992 tof_ztdc1 = tof->ztdc1();
993 tof_ztdc2 = tof->ztdc2();
994 tof_zadc1 = tof->zadc1();
995 tof_zadc2 = tof->zadc2();
996 tof_zt1 = -999.0;
997 tof_zt2 = -999.0;
998 tof_zt3 = -999.0;
999 tof_zt4 = -999.0;
1000 tof_zq1 = -999.0;
1001 tof_zq2 = -999.0;
1002 tof_zq3 = -999.0;
1003 tof_zq4 = -999.0;
1004 if( tof->hitCase() == 0 || tof->hitCase() == 2 ) {
1005 tof_zt1 = tofCaliSvc->ZTDC1( tof->tdc2(), tof->tofId1(), tof->zrhit1() );
1006 tof_zt2 = tofCaliSvc->ZTDC2( tof->tdc1(), tof->tofId1(), tof->zrhit1() );
1007 tof_zq1 = tofCaliSvc->ZADC1( tof->adc2(), tof->tofId1(), tof->zrhit1() );
1008 tof_zq2 = tofCaliSvc->ZADC2( tof->adc1(), tof->tofId1(), tof->zrhit1() );
1009 }
1010 if( tof->hitCase() == 1 || tof->hitCase() == 2 ) {
1011 tof_zt3 = tofCaliSvc->ZTDC1( tof->tdc4(), tof->tofId2(), tof->zrhit2() );
1012 tof_zt4 = tofCaliSvc->ZTDC2( tof->tdc3(), tof->tofId2(), tof->zrhit2() );
1013 tof_zq3 = tofCaliSvc->ZADC1( tof->adc4(), tof->tofId2(), tof->zrhit2() );
1014 tof_zq4 = tofCaliSvc->ZADC2( tof->adc3(), tof->tofId2(), tof->zrhit2() );
1015 }
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();
1024 tof_quality1 = tof->quality1();
1025 tof_quality2 = tof->quality2();
1026 tof_quality = tof->quality();
1027 tof_tofid1 = tof->tofId1();
1028 tof_tofid2 = tof->tofId2();
1029 /*
1030 tof_board1 = tofQElecSvc->Board( tof->hitCase()<3, tof->tofId1(), true );
1031 tof_board2 = tofQElecSvc->Board( tof->hitCase()<3, tof->tofId2(), true );
1032 tof_crate1 = tofQElecSvc->Crate( tof->hitCase()<3, tof->tofId1(), true );
1033 tof_crate2 = tofQElecSvc->Crate( tof->hitCase()<3, tof->tofId2(), true );
1034 tof_fee1 = tofQElecSvc->Fee( tof->hitCase()<3, tof->tofId1(), true );
1035 tof_fee2 = tofQElecSvc->Fee( tof->hitCase()<3, tof->tofId2(), true );
1036 tof_channel1 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId1(),true );
1037 tof_channel2 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId1(),false );
1038 tof_channel3 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId2(),true );
1039 tof_channel4 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId2(),false );
1040 */
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();
1047 tof_ph = tof->ph();
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();
1095 tof_texpe1 = tof->texpInner(0);
1096 tof_texpmu1 = tof->texpInner(1);
1097 tof_texppi1 = tof->texpInner(2);
1098 tof_texpk1 = tof->texpInner(3);
1099 tof_texpp1 = tof->texpInner(4);
1100 tof_texpe2 = tof->texpOuter(0);
1101 tof_texpmu2 = tof->texpOuter(1);
1102 tof_texppi2 = tof->texpOuter(2);
1103 tof_texpk2 = tof->texpOuter(3);
1104 tof_texpp2 = tof->texpOuter(4);
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;
1114 tof_tuple->write();
1115
1116 return;
1117}
1118
1119
1120void MrpcCheckDigi::Fill_TofTrack(Event::EventHeader& eventHeader, MrpcTrack*& tof, double estime, int t0stat, RecMdcKalTrackCol& mdcKalTrackCol, TofMcHitCol& tofMcCol, McParticleCol& mcParticleCol, std::string calibData ) {
1121
1122 tof_run = eventHeader.runNumber();
1123 tof_event = eventHeader.eventNumber();
1124 tof_toftrackid = tof->tofTrackId();
1125 tof_trackid = tof->trackId();
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;
1131
1132 (*iter)->setPidType( RecMdcKalTrack::electron );
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]);
1140
1141 (*iter)->setPidType( RecMdcKalTrack::muon );
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]);
1147
1148 (*iter)->setPidType( RecMdcKalTrack::pion );
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]);
1154
1155 (*iter)->setPidType( RecMdcKalTrack::kaon );
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]);
1161
1162 (*iter)->setPidType( RecMdcKalTrack::proton );
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]);
1168
1169 break;
1170 }
1171 }
1172 tof_id1 = tof->id1();
1173 tof_id2 = tof->id2();
1174 tof_barrel = tof->barrel();
1175 tof_hitcase = tof->hitCase();
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);
1187 }
1188 tof_ztdc1 = tof->ztdc1();
1189 tof_ztdc2 = tof->ztdc2();
1190 tof_zadc1 = tof->zadc1();
1191 tof_zadc2 = tof->zadc2();
1192 tof_zt1 = -999.0;
1193 tof_zt2 = -999.0;
1194 tof_zt3 = -999.0;
1195 tof_zt4 = -999.0;
1196 tof_zq1 = -999.0;
1197 tof_zq2 = -999.0;
1198 tof_zq3 = -999.0;
1199 tof_zq4 = -999.0;
1200 if( tof->hitCase() == 0 || tof->hitCase() == 2 ) {
1201 tof_zt1 = tofCaliSvc->ZTDC1( tof->tdc2(), tof->tofId1(), tof->zrhit1() );
1202 tof_zt2 = tofCaliSvc->ZTDC2( tof->tdc1(), tof->tofId1(), tof->zrhit1() );
1203 tof_zq1 = tofCaliSvc->ZADC1( tof->adc2(), tof->tofId1(), tof->zrhit1() );
1204 tof_zq2 = tofCaliSvc->ZADC2( tof->adc1(), tof->tofId1(), tof->zrhit1() );
1205 }
1206 if( tof->hitCase() == 1 || tof->hitCase() == 2 ) {
1207 tof_zt3 = tofCaliSvc->ZTDC1( tof->tdc4(), tof->tofId2(), tof->zrhit2() );
1208 tof_zt4 = tofCaliSvc->ZTDC2( tof->tdc3(), tof->tofId2(), tof->zrhit2() );
1209 tof_zq3 = tofCaliSvc->ZADC1( tof->adc4(), tof->tofId2(), tof->zrhit2() );
1210 tof_zq4 = tofCaliSvc->ZADC2( tof->adc3(), tof->tofId2(), tof->zrhit2() );
1211 }
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();
1220 tof_quality1 = tof->quality1();
1221 tof_quality2 = tof->quality2();
1222 tof_quality = tof->quality();
1223 tof_tofid1 = tof->tofId1();
1224 tof_tofid2 = tof->tofId2();
1225 /*
1226 tof_board1 = tofQElecSvc->Board( tof->hitCase()<3, tof->tofId1(), true );
1227 tof_board2 = tofQElecSvc->Board( tof->hitCase()<3, tof->tofId2(), true );
1228 tof_crate1 = tofQElecSvc->Crate( tof->hitCase()<3, tof->tofId1(), true );
1229 tof_crate2 = tofQElecSvc->Crate( tof->hitCase()<3, tof->tofId2(), true );
1230 tof_fee1 = tofQElecSvc->Fee( tof->hitCase()<3, tof->tofId1(), true );
1231 tof_fee2 = tofQElecSvc->Fee( tof->hitCase()<3, tof->tofId2(), true );
1232 tof_channel1 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId1(),true );
1233 tof_channel2 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId1(),false );
1234 tof_channel3 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId2(),true );
1235 tof_channel4 = tofQElecSvc->Channel(tof->hitCase()<3,tof->tofId2(),false );
1236 */
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();
1243 tof_ph = tof->ph();
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();
1291 tof_texpe1 = tof->texpInner(0);
1292 tof_texpmu1 = tof->texpInner(1);
1293 tof_texppi1 = tof->texpInner(2);
1294 tof_texpk1 = tof->texpInner(3);
1295 tof_texpp1 = tof->texpInner(4);
1296 tof_texpe2 = tof->texpOuter(0);
1297 tof_texpmu2 = tof->texpOuter(1);
1298 tof_texppi2 = tof->texpOuter(2);
1299 tof_texpk2 = tof->texpOuter(3);
1300 tof_texpp2 = tof->texpOuter(4);
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;
1310
1311 int particleId = 0;
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; }
1317 else {
1318 cout << "Reconstruction::TofRec::TofCheckDigi::Fill_TofTrack: For MC, Wrong Input Particle ID!" << endl;
1319 }
1320
1321 tof_mcp = -100.0;
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;
1327
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;
1334
1335 int trkIndex = (*iter_mc)->trackIndex();
1336 tof_mcp = (*iter_mc)->initialFourMomentum().rho();
1337
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();
1353 if( tof->hitCase()==0 || tof->hitCase()==1 || tof->hitCase()==2 ) {
1354 tof_mczrhit = mcposz;
1355 }
1356 else if( tof->hitCase()==3 || tof->hitCase()==4 ) {
1357 tof_mczrhit = mcposr;
1358 }
1359 }
1360 }
1361
1362 tof_tuple->write();
1363
1364 return;
1365}
1366
1367
1368void MrpcCheckDigi::FillCol(Event::EventHeader& eventHeader, RecMdcKalTrackCol& mdcKalTrackCol, RecExtTrackCol& recExtTrackCol) {
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;
1375 }
1376 if( iter_kal != mdcKalTrackCol.end() ) {
1377 Fill( eventHeader, *iter_kal, *iter_ext );
1378 }
1379 }
1380 return;
1381}
1382
1383
1384void MrpcCheckDigi::FillCol(Event::EventHeader& eventHeader, RecExtTrackCol& extTrackCol, RecMdcTrackCol& mdcTrackCol, RecEmcShowerCol& emcShowerCol, RecMdcKalTrackCol& mdcKalTrackCol) {
1385 bb_run = eventHeader.runNumber();
1386 bb_event = eventHeader.eventNumber();
1387 bb_trksize = extTrackCol.size();
1388 bb_mdcsize = mdcTrackCol.size();
1389 bb_emcsize = emcShowerCol.size();
1390
1391 RecMdcTrackCol::iterator iter_mdc1 = mdcTrackCol.begin();
1392 RecMdcTrackCol::iterator iter_mdc2 = mdcTrackCol.begin() + 1;
1393
1394 Hep3Vector p1 = (*iter_mdc1)->p3();
1395 Hep3Vector p2 = (*iter_mdc2)->p3();
1396
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();
1423
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;
1426
1427 RecMdcKalTrackCol::iterator iter_kal1 = mdcKalTrackCol.begin();
1428 RecMdcKalTrackCol::iterator iter_kal2 = mdcKalTrackCol.begin() + 1;
1429
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;
1434 }
1435
1436 // RecMdcKalTrack::setPidType (RecMdcKalTrack::electron);
1437 (*iter_kal1)->setPidType( RecMdcKalTrack::electron );
1438 (*iter_kal2)->setPidType( RecMdcKalTrack::electron );
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;
1447 // RecMdcKalTrack::setPidType (RecMdcKalTrack::muon);
1448 (*iter_kal1)->setPidType( RecMdcKalTrack::muon );
1449 (*iter_kal2)->setPidType( RecMdcKalTrack::muon );
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;
1458
1459 RecExtTrackCol::iterator iter_ext1 = extTrackCol.begin();
1460 RecExtTrackCol::iterator iter_ext2 = extTrackCol.begin() + 1;
1461
1462 Hep3Vector extPos1 = (*iter_ext1)->emcPosition();
1463 Hep3Vector extPos2 = (*iter_ext2)->emcPosition();
1464
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();
1471
1472 RecEmcShowerCol::iterator iter_emc1 = emcShowerCol.begin();
1473 RecEmcShowerCol::iterator iter_emc2 = emcShowerCol.begin() + 1;
1474
1475 Hep3Vector emcPos1((*iter_emc1)->x(),(*iter_emc1)->y(),(*iter_emc1)->z());
1476 Hep3Vector emcPos2((*iter_emc2)->x(),(*iter_emc2)->y(),(*iter_emc2)->z());
1477
1478 // cout << "ext 1 --- " << extPos1 << " ext 2 --- " << extPos2 <<
1479 // "emc 1 --- " << emcPos1 << " emc 2 --- " << emcPos2 << endl;
1480
1481 Hep3Vector dis1 = extPos1 - emcPos1;
1482 Hep3Vector dis2 = extPos2 - emcPos1;
1483
1484 // cout << " r1 = " << dis1.r() << " r2 = " << dis2.r() << endl;
1485
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;
1491 emcPos1 = emcPos2;
1492 emcPos2 = emc_tmp;
1493 }
1494 dis1 = extPos1 - emcPos1;
1495 dis2 = extPos2 - emcPos2;
1496
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();
1511 bb_dr1 = dis1.r();
1512 bb_drxy1 = dis1.rho();
1513 bb_dz1 = dis1.z();
1514 bb_dr2 = dis2.r();
1515 bb_drxy2 = dis2.rho();
1516 bb_dz2 = dis2.z();
1517
1518 double etot = 0.0;
1519 RecEmcShowerCol::iterator iter_emc = emcShowerCol.begin();
1520 for( ; iter_emc != emcShowerCol.end(); iter_emc++ ) {
1521 etot += (*iter_emc)->energy();
1522 }
1523 bb_etot = etot;
1524
1525 bb_tuple->write();
1526
1527 return;
1528}
Double_t etot
double abs(const EvtComplex &c)
Definition: EvtComplex.hh:212
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
ITofCaliSvc * tofCaliSvc
ObjectVector< RecEmcShower > RecEmcShowerCol
Definition: RecEmcShower.h:171
ObjectVector< RecExtTrack > RecExtTrackCol
Definition: RecExtTrack.h:209
ObjectVector< RecMdcKalTrack > RecMdcKalTrackCol
ObjectVector< RecMdcTrack > RecMdcTrackCol
Definition: RecMdcTrack.h:79
std::multimap< unsigned int, TofData * > TofDataMap
Definition: TofData.h:244
std::multimap< unsignedint, TofData * >::iterator IterTofDataMap
Definition: TofData.h:245
ObjectVector< TofDigi > TofDigiCol
Definition: TofDigi.h:41
ITofCaliSvc * tofCaliSvc
const double tof1Path() const
Definition: DstExtTrack.h:68
const Hep3Vector tof1Position() const
Definition: DstExtTrack.h:58
const int tof1VolumeNumber() const
Definition: DstExtTrack.h:64
const double tof1() const
Definition: DstExtTrack.h:66
const Hep3Vector tof2Momentum() const
Definition: DstExtTrack.h:96
const Hep3Vector tof1Momentum() const
Definition: DstExtTrack.h:60
const double tof2() const
Definition: DstExtTrack.h:102
const double tof2PosSigmaAlongZ() const
Definition: DstExtTrack.h:106
const double tof1PosSigmaAlongX() const
Definition: DstExtTrack.h:74
const double tof2Path() const
Definition: DstExtTrack.h:104
const int trackId() const
Definition: DstExtTrack.h:43
const double tof1PosSigmaAlongY() const
Definition: DstExtTrack.h:76
const double tof1PosSigmaAlongZ() const
Definition: DstExtTrack.h:70
const int tof2VolumeNumber() const
Definition: DstExtTrack.h:100
const Hep3Vector tof2Position() const
Definition: DstExtTrack.h:94
int eventNumber() const
Retrieve event number.
Definition: EventHeader.h:37
int runNumber() const
Retrieve run number.
Definition: EventHeader.h:42
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 &, MrpcTrack *&, double, int)
void Fill(Event::EventHeader &, RecMdcKalTrack *&, RecExtTrack *&)
void Fill_Barrel(Event::EventHeader &, TofData *&, double, int)
void FillCol(Event::EventHeader &, TofDigiCol &, double, int)
void Fill_Endcap(Event::EventHeader &, TofData *&, double, int)
MrpcCheckDigi(NTuple::Tuple *&digi, NTuple::Tuple *&barrel, NTuple::Tuple *&endcap, NTuple::Tuple *&ext, NTuple::Tuple *&tof, NTuple::Tuple *&bhabha)
double tof2(unsigned int i) const
Definition: MrpcTrack.h:76
double adc2() const
Definition: MrpcTrack.h:84
double zrhit1() const
Definition: MrpcTrack.h:37
double qch4() const
Definition: MrpcTrack.h:82
int size2() const
Definition: MrpcTrack.h:49
ExtTrackCase hitCase() const
Definition: MrpcTrack.h:32
double tdc4() const
Definition: MrpcTrack.h:90
int id2() const
Definition: MrpcTrack.h:30
double tdiff2() const
Definition: MrpcTrack.h:103
unsigned int quality() const
Definition: MrpcTrack.h:58
double phi2() const
Definition: MrpcTrack.h:55
double tof22(unsigned int i) const
Definition: MrpcTrack.h:74
double zadc2() const
Definition: MrpcTrack.h:99
double ph12() const
Definition: MrpcTrack.h:64
double qch3() const
Definition: MrpcTrack.h:81
double qch1() const
Definition: MrpcTrack.h:79
int id1() const
Definition: MrpcTrack.h:29
double zrhit2() const
Definition: MrpcTrack.h:38
unsigned int barrel() const
Definition: MrpcTrack.h:31
double ztdc1() const
Definition: MrpcTrack.h:96
double errzr1() const
Definition: MrpcTrack.h:39
double tof1(unsigned int i) const
Definition: MrpcTrack.h:75
double texp(unsigned int i) const
Definition: MrpcTrack.h:94
double path2() const
Definition: MrpcTrack.h:36
double ph() const
Definition: MrpcTrack.h:69
double tof11(unsigned int i) const
Definition: MrpcTrack.h:71
double tof(unsigned int i) const
Definition: MrpcTrack.h:77
double tdc2() const
Definition: MrpcTrack.h:88
int size3() const
Definition: MrpcTrack.h:50
int trackId() const
Definition: MrpcTrack.h:27
unsigned int quality2() const
Definition: MrpcTrack.h:57
double qch2() const
Definition: MrpcTrack.h:80
double adc3() const
Definition: MrpcTrack.h:85
double errzr2() const
Definition: MrpcTrack.h:40
double texpOuter(unsigned int i) const
Definition: MrpcTrack.h:93
unsigned int quality1() const
Definition: MrpcTrack.h:56
double theta2() const
Definition: MrpcTrack.h:53
double texpInner(unsigned int i) const
Definition: MrpcTrack.h:92
double ph21() const
Definition: MrpcTrack.h:65
double ph2() const
Definition: MrpcTrack.h:68
double path1() const
Definition: MrpcTrack.h:35
int kal(unsigned int i) const
Definition: MrpcTrack.h:41
double tof21(unsigned int i) const
Definition: MrpcTrack.h:73
double ph22() const
Definition: MrpcTrack.h:66
double tdc1() const
Definition: MrpcTrack.h:87
double adc1() const
Definition: MrpcTrack.h:83
double tdiff1() const
Definition: MrpcTrack.h:102
double zadc1() const
Definition: MrpcTrack.h:98
double phi1() const
Definition: MrpcTrack.h:54
int size1() const
Definition: MrpcTrack.h:48
double theta1() const
Definition: MrpcTrack.h:52
int tofTrackId() const
Definition: MrpcTrack.h:28
double tof12(unsigned int i) const
Definition: MrpcTrack.h:72
double ph11() const
Definition: MrpcTrack.h:63
double ph1() const
Definition: MrpcTrack.h:67
double p() const
Definition: MrpcTrack.h:33
double adc4() const
Definition: MrpcTrack.h:86
int size4() const
Definition: MrpcTrack.h:51
double ztdc2() const
Definition: MrpcTrack.h:97
double tdc3() const
Definition: MrpcTrack.h:89
int tofId2() const
Definition: MrpcTrack.h:61
int tofId1() const
Definition: MrpcTrack.h:60
int getStat(int i, int pid) const
int tdcChannel()
Definition: TofData.cxx:688
double qtc2()
Definition: TofData.cxx:625
int tofTrackId() const
Definition: TofData.h:135
int tofId()
Definition: TofData.cxx:494
int qnumber2()
Definition: TofData.cxx:823
int qtimes2()
Definition: TofData.cxx:769
unsigned int quality() const
Definition: TofData.h:170
unsigned int westTimes()
Definition: TofData.cxx:796
int ttimes1()
Definition: TofData.cxx:760
double adc2()
Definition: TofData.cxx:580
int tclock1()
Definition: TofData.cxx:706
int qclock1()
Definition: TofData.cxx:697
int tclock()
Definition: TofData.cxx:742
double adc()
Definition: TofData.cxx:598
unsigned int times() const
Definition: TofData.h:137
double tdc2()
Definition: TofData.cxx:589
double qtc1()
Definition: TofData.cxx:616
int tdcChannelWest()
Definition: TofData.cxx:670
int adcChannel()
Definition: TofData.cxx:679
int qtimes1()
Definition: TofData.cxx:751
int layer() const
Definition: TofData.h:134
int tnumber1()
Definition: TofData.cxx:814
int adcChannelWest()
Definition: TofData.cxx:661
double tdc1()
Definition: TofData.cxx:571
int qnumber1()
Definition: TofData.cxx:805
int adcChannelEast()
Definition: TofData.cxx:643
int qclock()
Definition: TofData.cxx:733
int ttimes2()
Definition: TofData.cxx:778
double adc1()
Definition: TofData.cxx:562
int qclock2()
Definition: TofData.cxx:715
bool tmatched() const
Definition: TofData.h:171
unsigned int eastTimes()
Definition: TofData.cxx:787
int tnumber2()
Definition: TofData.cxx:832
double tdc()
Definition: TofData.cxx:607
int tclock2()
Definition: TofData.cxx:724
int tdcChannelEast()
Definition: TofData.cxx:652
double qtc()
Definition: TofData.cxx:634
static int end(const Identifier &id)
Definition: TofID.cxx:129
static int phi_module(const Identifier &id)
Definition: TofID.cxx:117
static int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
Definition: TofID.cxx:95
static int layer(const Identifier &id)
Definition: TofID.cxx:109
const int getTrigChannel(int i) const
Definition: TrigData.h:35
ObjectList< McParticle > McParticleCol
Definition: McParticle.h:205
ObjectVector< TofMcHit > TofMcHitCol
Definition: TofMcHit.h:100
const float pi
Definition: vector3.h:133