BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
TofTrack.cxx
Go to the documentation of this file.
1#include "Identifier/Identifier.h"
2#include "Identifier/TofID.h"
3#include "TofCaliSvc/ITofCaliSvc.h"
4#include "DstEvent/TofHitStatus.h"
5#include "TofRec/TofConstants.h"
6#include "TofRec/TofTrack.h"
7
9
10TofTrack::TofTrack( int run, int event ) {
11 m_run = run;
12 m_event = event;
13 m_trackId = -1;
14 m_tofTrackId = -1;
15 m_id1 = -9;
16 m_id2 = -9;
17 m_istrip1 = -9;
18 m_istrip2 = -9;
19 m_hitCase = NoHit;
20 m_momentum = -99.0;
21 m_path = 0.0;
22 m_path1 = 0.0;
23 m_path2 = 0.0;
24 m_zrhit1 = 99.0;
25 m_errzr1 = 99.0;
26 m_zrhit2 = 99.0;
27 m_errzr2 = 99.0;
28 m_xhit1 = 99.0;
29 m_yhit1 = 99.0;
30 m_xhit2 = 99.0;
31 m_yhit2 = 99.0;
32 for( unsigned int i=0; i<5; i++ ) {
33 m_kal[i] = -1;
34 m_zr1[i] = 99.0;
35 m_zr2[i] = 99.0;
36 m_ezr1[i] = 99.0;
37 m_ezr2[i] = 99.0;
38 }
39 if( m_tofData1.size()>0 ) {
40 m_tofData1.clear();
41 }
42 if( m_tofData2.size()>0 ) {
43 m_tofData2.clear();
44 }
45 if( m_tofData3.size()>0 ) {
46 m_tofData3.clear();
47 }
48 if( m_tofData4.size()>0 ) {
49 m_tofData4.clear();
50 }
51 m_quality1 = 0;
52 m_quality2 = 0;
53 m_quality = 10;
54
55 m_delStrip1 = 20;
56 m_delStrip2 = 20;
57
58 m_tofId1 = -9;
59 m_tofId2 = -9;
60 m_strip1 = -9;
61 m_strip2 = -9;
62
63 m_ph11 = -99.0;
64 m_ph12 = -99.0;
65 m_ph21 = -99.0;
66 m_ph22 = -99.0;
67 m_ph1 = -99.0;
68 m_ph2 = -99.0;
69 m_ph = -99.0;
70
71 for( unsigned int i=0; i<5; i++ ) {
72 m_tof11[i] = 0.0;
73 m_tof12[i] = 0.0;
74 m_tof21[i] = 0.0;
75 m_tof22[i] = 0.0;
76 m_tof1[i] = 0.0;
77 m_tof2[i] = 0.0;
78 m_tof[i] = 0.0;
79 }
80
81 m_sigma11 = -99.0;
82 m_sigma12 = -99.0;
83 m_sigma21 = -99.0;
84 m_sigma22 = -99.0;
85 m_sigma1 = -99.0;
86 m_sigma2 = -99.0;
87 m_sigma = -99.0;
88
89 m_qch1 = -99.0;
90 m_qch2 = -99.0;
91 m_qch3 = -99.0;
92 m_qch4 = -99.0;
93 m_adc1 = -99.0;
94 m_adc2 = -99.0;
95 m_adc3 = -99.0;
96 m_adc4 = -99.0;
97 m_tdc1 = -99.0;
98 m_tdc2 = -99.0;
99 m_tdc3 = -99.0;
100 m_tdc4 = -99.0;
101
102 for( unsigned int i=0; i<5; i++ ) {
103 m_texpInner[i] = -99.0;
104 m_texpOuter[i] = -99.0;
105 m_texp[i] = -99.0;
106 }
107
108 m_ztdc1 = -99.0;
109 m_ztdc2 = -99.0;
110 m_zadc1 = -99.0;
111 m_zadc2 = -99.0;
112
113 m_estime = -99.0;
114 m_tdiff1 = -99.0;
115 m_tdiff2 = -99.0;
116
117 m_flag = 0;
118
119 return;
120}
121
122
124 if( m_tofData1.size()>0 ) {
125 m_tofData1.clear();
126 }
127 if( m_tofData2.size()>0 ) {
128 m_tofData2.clear();
129 }
130 if( m_tofData3.size()>0 ) {
131 m_tofData3.clear();
132 }
133 if( m_tofData4.size()>0 ) {
134 m_tofData4.clear();
135 }
136 return;
137}
138
139//------- setExtTrack ----------------------------------------------
140// get information from RecExtTrackCol
141// tofId1(), tofId2(), hitCase(),
142// p(), path1(), path2(), zrhit1(), zrhit2(), errz1(), errz2()
143// quality() = 3 ( no hit )
144//
145void TofTrack::setExtTrack( RecExtTrack* extTrack, double costheta, double p[5], int kal[5], double t0, int t0Stat ) {
146
147 m_estime = t0;
148 m_t0Stat = t0Stat;
149
150 int tofId1 = extTrack->tof1VolumeNumber();
151 int tofId2 = extTrack->tof2VolumeNumber();
152
153 int iExist1 = -1;
154 int iExist2 = -1;
155 if( tofId1<0 ) {
156 if( extTrack->tof1VolumeNumber(3)>-1 ) {
157 iExist1 = 3;
158 }
159 else if( extTrack->tof1VolumeNumber(1)>-1 ) {
160 iExist1 = 1;
161 }
162 else if( extTrack->tof1VolumeNumber(4)>-1 ) {
163 iExist1 = 4;
164 }
165 else if( extTrack->tof1VolumeNumber(0)>-1 ) {
166 iExist1 = 0;
167 }
168 if( iExist1!=-1 ) {
169 tofId1 = extTrack->tof1VolumeNumber(iExist1);
170 }
171 }
172 if( tofId2<0 ) {
173 if( extTrack->tof2VolumeNumber(3)>-1 ) {
174 iExist2 = 3;
175 }
176 else if( extTrack->tof2VolumeNumber(1)>-1 ) {
177 iExist2 = 1;
178 }
179 else if( extTrack->tof2VolumeNumber(4)>-1 ) {
180 iExist2 = 4;
181 }
182 else if( extTrack->tof2VolumeNumber(0)>-1 ) {
183 iExist2 = 0;
184 }
185 if( iExist2!=-1 ) {
186 tofId2 = extTrack->tof2VolumeNumber(iExist2);
187 }
188 }
189 if( iExist1 == -1 ) { iExist1 = 2; }
190 if( iExist2 == -1 ) { iExist2 = 2; }
191
192 m_barrel = 3;
193 if( tofId1>=0 && tofId1<=87 ) {
194 m_id1 = tofId1;
195 m_barrel = 1;
196 m_hitCase = InnerLayer;
197 }
198 else if( tofId1>=176 && tofId1<=223 ) {
199 m_id1 = tofId1 - 176 + 48;
200 m_barrel = 2;
201 m_hitCase = WestEndcap;
202 if( costheta>0.0 ) {
203 m_id1 = -9;
204 m_barrel = 3;
205 m_hitCase = NoHit;
206 }
207 }
208 else if( tofId1>=224 && tofId1<=271 ) {
209 m_id1 = tofId1 - 176 - 48;
210 m_barrel = 0;
211 m_hitCase = EastEndcap;
212 if( costheta<0.0 ) {
213 m_id1 = -9;
214 m_barrel = 3;
215 m_hitCase = NoHit;
216 }
217 }
218 else if( tofId1>=272 && tofId1<=1135 ) {
219 m_id1 = tofId1 - 176 - 96;
220 m_istrip1 = m_id1%12;
221 m_id1 = m_id1/12;
222 if( tofId1>=272 && tofId1<=703 ) {
223 if( costheta>0.0 ) {
224 m_barrel = 4;
225 m_hitCase = EastEndcapMRPC;
226 }
227 else {
228 m_id1 = -9;
229 m_istrip1 = -9;
230 }
231 }
232 else if( tofId1>=704 && tofId1<=1135 ) {
233 if( costheta<0.0 ) {
234 m_barrel = 5;
235 m_hitCase = WestEndcapMRPC;
236 }
237 else {
238 m_id1 = -9;
239 m_istrip1 = -9;
240 }
241 }
242 }
243 else {
244 m_barrel = 3;
245 m_hitCase = NoHit;
246 }
247
248 if( tofId2>=88 && tofId2<=175 ) {
249 m_id2 = tofId2;
250 m_barrel = 1;
251 if( m_hitCase == InnerLayer ) {
252 m_hitCase = DoubleLayer;
253 }
254 else if( m_hitCase==NoHit ) {
255 m_hitCase = OuterLayer;
256 }
257 }
258 else if( tofId2>=272 && tofId2<=1135 ) {
259 m_id2 = tofId2 - 176 - 96;
260 m_istrip2 = m_id2%12;
261 m_id2 = m_id2/12;
262 if( m_hitCase==EastEndcapMRPC || m_hitCase==WestEndcapMRPC || m_hitCase==NoHit ) {
263 if( tofId2>=272 && tofId2<=703 ) {
264 if( costheta>0.0 ) {
265 m_barrel = 4;
266 m_hitCase = EastEndcapMRPC;
267 }
268 else {
269 m_id2 = -9;
270 m_istrip2 = -9;
271 }
272 }
273 else if( tofId2>=704 && tofId2<=1135 ) {
274 if( costheta<0.0 ) {
275 m_barrel = 5;
276 m_hitCase = WestEndcapMRPC;
277 }
278 else {
279 m_id2 = -9;
280 m_istrip2 = -9;
281 }
282 }
283 }
284 }
285
286 m_trackId = extTrack->trackId();
287
288 m_momentum = extTrack->tof1Momentum().r();
289 if( !( tofId1>=272 && tofId1<=1135 ) && ( m_hitCase == EastEndcapMRPC || m_hitCase == WestEndcapMRPC ) ){
290 m_momentum = extTrack->tof2Momentum().r();
291 }
292
293 if( m_hitCase == InnerLayer || m_hitCase == DoubleLayer || m_hitCase == EastEndcap || m_hitCase == WestEndcap || ( ( m_hitCase == EastEndcapMRPC || m_hitCase == WestEndcapMRPC ) && ( tofId1>=272 && tofId1<=1135 ) ) ) {
294 m_path1 = extTrack->tof1Path(iExist1);
295 m_theta1 = extTrack->tof1Momentum(iExist1).rho()/extTrack->tof1Momentum(iExist1).r();
296 m_phi1 = extTrack->tof1Position(iExist1).phi();
297 for( unsigned int i=0; i<5; i++ ) {
298 m_texpInner[i] = extTrack->tof1(i);
299 if( fabs(m_texpInner[i]+99.0)<1.0e-6 ) {
300 double beta = p[iExist1]/sqrt(p[iExist1]*p[iExist1]+mass[iExist1]*mass[iExist1]);
301 double betaNew = p[i]/sqrt(p[i]*p[i]+mass[i]*mass[i]);
302 m_texpInner[i] = beta*extTrack->tof1(iExist1)/betaNew;
303 }
304 }
305 if( m_hitCase == InnerLayer || m_hitCase == DoubleLayer ) {
306 m_xhit1 = extTrack->tof1Position(iExist1).x();
307 m_yhit1 = extTrack->tof1Position(iExist1).y();
308 m_zrhit1 = extTrack->tof1Position(iExist1).z();
309 m_errzr1 = extTrack->tof1PosSigmaAlongZ(iExist1);
310 for( unsigned int i=0; i<5; i++ ) {
311 m_zr1[i] = extTrack->tof1Position(i).z();
312 m_ezr1[i] = extTrack->tof1PosSigmaAlongZ(i);
313 if( fabs(m_zr1[i]+99.0)<1.0e-6 ) {
314 m_zr1[i] = m_zrhit1;
315 m_ezr1[i] = m_errzr1;
316 }
317 }
318 }
319 else if( m_hitCase == EastEndcap || m_hitCase == WestEndcap ) {
320 m_xhit1 = extTrack->tof1Position(iExist1).x();
321 m_yhit1 = extTrack->tof1Position(iExist1).y();
322 m_zrhit1 = extTrack->tof1Position(iExist1).rho();
323 m_errzr1 = sqrt( extTrack->tof1PosSigmaAlongX(iExist1)*extTrack->tof1PosSigmaAlongX(iExist1) + extTrack->tof1PosSigmaAlongY(iExist1)*extTrack->tof1PosSigmaAlongY(iExist1) );
324 for( unsigned int i=0; i<5; i++ ) {
325 m_zr1[i] = extTrack->tof1Position(i).rho();
326 m_ezr1[i] = sqrt( extTrack->tof1PosSigmaAlongX(i)*extTrack->tof1PosSigmaAlongX(i) + extTrack->tof1PosSigmaAlongY(i)*extTrack->tof1PosSigmaAlongY(i) );
327 if( fabs(m_zr1[i]+99.0)<1.0e-6 ) {
328 m_zr1[i] = m_zrhit1;
329 m_ezr1[i] = m_errzr1;
330 }
331 }
332 }
333 else if( ( m_hitCase == EastEndcapMRPC || m_hitCase == WestEndcapMRPC ) && ( tofId1>=272 && tofId1<=1135 ) ) {
334 m_xhit1 = extTrack->tof1Position(iExist1).x();
335 m_yhit1 = extTrack->tof1Position(iExist1).z();
336 m_zrhit1 = extTrack->tof1Position(iExist1).x();
337 m_errzr1 = extTrack->tof1PosSigmaAlongX(iExist1);
338 for( unsigned int i=0; i<5; i++ ) {
339 m_zr1[i] = extTrack->tof1Position(i).x();
340 m_ezr1[i] = extTrack->tof1PosSigmaAlongX(i);
341 if( fabs(m_zr1[i]+99.0)<1.0e-6 ) {
342 m_zr1[i] = m_zrhit1;
343 m_ezr1[i] = m_errzr1;
344 }
345 }
346 }
347 }
348
349 if( m_hitCase == OuterLayer || m_hitCase == DoubleLayer || ( ( m_hitCase == EastEndcapMRPC || m_hitCase == WestEndcapMRPC ) && ( tofId2>=272 && tofId2<=1135 ) ) ) {
350 m_path2 = extTrack->tof2Path(iExist2);
351 m_theta2 = extTrack->tof2Momentum(iExist2).rho()/extTrack->tof2Momentum(iExist2).r();
352 m_phi2 = extTrack->tof2Position(iExist2).phi();
353 for( unsigned int i=0; i<5; i++ ) {
354 m_texpOuter[i] = extTrack->tof2(i);
355 if( fabs(m_texpOuter[i]+99.0)<1.0e-6 ) {
356 double beta = p[iExist2]/sqrt(p[iExist2]*p[iExist2]+mass[iExist2]*mass[iExist2]);
357 double betaNew = p[i]/sqrt(p[i]*p[i]+mass[i]*mass[i]);
358 m_texpOuter[i] = beta*extTrack->tof2(iExist2)/betaNew;
359 }
360 }
361 if( m_hitCase == OuterLayer || m_hitCase == DoubleLayer ) {
362 m_xhit2 = extTrack->tof2Position(iExist2).x();
363 m_yhit2 = extTrack->tof2Position(iExist2).y();
364 m_zrhit2 = extTrack->tof2Position(iExist2).z();
365 m_errzr2 = extTrack->tof2PosSigmaAlongZ(iExist2);
366 for( unsigned int i=0; i<5; i++ ) {
367 m_zr2[i] = extTrack->tof2Position(i).z();
368 m_ezr2[i] = extTrack->tof2PosSigmaAlongZ(i);
369 if( fabs(m_zr2[i]+99.0)<1.0e-6 ) {
370 m_zr2[i] = m_zrhit2;
371 m_ezr2[i] = m_errzr2;
372 }
373 }
374 }
375 else if( ( m_hitCase == EastEndcapMRPC || m_hitCase == WestEndcapMRPC ) && ( tofId2>=272 && tofId2<=1135 ) ) {
376 m_xhit2 = extTrack->tof2Position(iExist2).x();
377 m_yhit2 = extTrack->tof2Position(iExist2).z();
378 m_zrhit2 = extTrack->tof2Position(iExist2).x();
379 m_errzr2 = extTrack->tof2PosSigmaAlongX(iExist2);
380 for( unsigned int i=0; i<5; i++ ) {
381 m_zr2[i] = extTrack->tof2Position(i).x();
382 m_ezr2[i] = extTrack->tof2PosSigmaAlongX(i);
383 if( fabs(m_zr2[i]+99.0)<1.0e-6 ) {
384 m_zr2[i] = m_zrhit2;
385 m_ezr2[i] = m_errzr2;
386 }
387 }
388 }
389 }
390
391 if( m_hitCase == NoHit ) { m_quality = 11; }
392
393 for( unsigned int i=0; i<5; i++ ) {
394 m_kal[i] = kal[i];
395 }
396
397 return;
398}
399
400
401//------- get Multi hit ----------------------------------------------
402// get Multi-hit of one TOF Counter
403//
405 if( m_hitCase == InnerLayer || m_hitCase == OuterLayer || m_hitCase == DoubleLayer ) {
406
407 if( ( m_hitCase==InnerLayer || m_hitCase==DoubleLayer ) && ( track->hitCase()==InnerLayer || track->hitCase()==DoubleLayer ) ) {
408 if( ( abs(m_id1-track->id1())<=1 ) || ( m_id1==0 && track->id1()==87 ) || ( m_id1==87 && track->id1()==0 ) ) {
409 track->setQuality1( ( track->quality1() | 0x400 ) );
410 m_quality1 = ( m_quality1 | 0x400 );
411 }
412 }
413
414 if( ( m_hitCase==OuterLayer || m_hitCase==DoubleLayer ) && ( track->hitCase()==OuterLayer || track->hitCase()==DoubleLayer ) ) {
415 if( ( abs(m_id2-track->id2())<=1 ) || ( m_id2==88 && track->id2()==175 ) || ( m_id2==175 && track->id2()==88 ) ) {
416 track->setQuality2( ( track->quality2() | 0x400 ) );
417 m_quality2 = ( m_quality2 | 0x400 );
418 }
419 }
420
421 }
422 else if( m_hitCase == EastEndcap ) {
423 if( track->hitCase()==EastEndcap ) {
424 if( ( abs(m_id1-track->id1())<=1 ) || ( m_id1==0 && track->id1()==47 ) || ( m_id1==47 && track->id1()==0 ) ) {
425 track->setQuality1( ( track->quality1() | 0x400 ) );
426 m_quality1 = ( m_quality1 | 0x400 );
427 }
428 }
429 }
430 else if( m_hitCase == WestEndcap ) {
431 if( track->hitCase()==WestEndcap ) {
432 if( ( abs(m_id1-track->id1())<=1 ) || ( m_id1==48 && track->id1()==95 ) || ( m_id1==95 && track->id1()==48 ) ) {
433 track->setQuality1( ( track->quality1() | 0x400 ) );
434 m_quality1 = ( m_quality1 | 0x400 );
435 }
436 }
437 }
438 if( m_hitCase == EastEndcapMRPC || m_hitCase == WestEndcapMRPC ) {
439 if( ( m_hitCase==EastEndcapMRPC && track->hitCase()==EastEndcapMRPC ) || ( m_hitCase==WestEndcapMRPC && track->hitCase()==WestEndcapMRPC ) ) {
440 if( m_id1>=0 ) {
441 if( ( m_id1==track->id1() ) && abs(m_istrip1-track->strip1())<=1 ) {
442 track->setQuality1( ( track->quality1() | 0x400 ) );
443 m_quality1 = ( m_quality1 | 0x400 );
444 }
445 }
446 if( m_id2>=0 ) {
447 if( ( m_id2==track->id2() ) && abs(m_istrip2-track->strip2())<=1 ) {
448 track->setQuality1( ( track->quality1() | 0x400 ) );
449 m_quality1 = ( m_quality1 | 0x400 );
450 }
451 }
452 }
453 }
454
455 return;
456}
457
458
459//------- setTofData --------------------------------------------
460// do TOF hits and extrapolated track match
461// tofTrackId(), tofMod1(), tofMod2()
462// quality() = 3 ( no hit )
463//
465
466 if( m_hitCase == NoHit ) return;
467
468 unsigned int identify[11];
469 unsigned int count[11];
470 for( unsigned int i=0; i<11; i++ ) {
471 identify[i] = 0x0000c000;
472 count[i] = 0;
473 }
474 unsigned int countTot1 = 0;
475 unsigned int countTot2 = 0;
476
477 if( ( ( m_hitCase == InnerLayer ) || ( m_hitCase == DoubleLayer ) ) && ( m_id1 > -1 ) ) {
478 int tofid0 = m_id1;
479 identify[0] = TofID::getIntID( 1, 0, tofid0, 0 );
480 count[0] = tofDataMap.count( identify[0] );
481 int tofid1 = tofid0 - 1;
482 if( tofid1 == -1 ) { tofid1 = 87; }
483 identify[1] = TofID::getIntID( 1, 0, tofid1, 0 );
484 count[1] = tofDataMap.count( identify[1] );
485 int tofid2 = tofid0 + 1;
486 if( tofid2 == 88 ) { tofid2 = 0; }
487 identify[2] = TofID::getIntID( 1, 0, tofid2, 0 );
488 count[2] = tofDataMap.count( identify[2] );
489 }
490
491 if( ( ( m_hitCase == EastEndcap ) || ( m_hitCase == WestEndcap ) )&& ( m_id1 > -1 ) ) {
492 unsigned int whichEndcap = 0;
493 int tofid0 = m_id1;
494 if( m_hitCase == WestEndcap ) {
495 whichEndcap = 2;
496 tofid0 = m_id1 - 48;
497 }
498 identify[0] = TofID::getIntID( whichEndcap, 0, tofid0, 0 );
499 count[0] = tofDataMap.count( identify[0] );
500 int tofid1 = tofid0 - 1;
501 if( tofid1 == -1 ) { tofid1 = 47; }
502 identify[1] = TofID::getIntID( whichEndcap, 0, tofid1, 0 );
503 count[1] = tofDataMap.count( identify[1] );
504 int tofid2 = tofid0 + 1;
505 if( tofid2 == 48 ) { tofid2 = 0; }
506 identify[2] = TofID::getIntID( whichEndcap, 0, tofid2, 0 );
507 count[2] = tofDataMap.count( identify[2] );
508 }
509
510 if( ( ( m_hitCase == EastEndcapMRPC ) || ( m_hitCase == WestEndcapMRPC ) ) && ( ( m_id1 > -1 ) && ( m_istrip1 > -1 ) ) ) {
511 IterTofDataMap iter = tofDataMap.begin();
512 for( ; iter != tofDataMap.end(); iter++ ) {
513 Identifier iden = TofID::cell_id( (*iter).first );
514 if( TofID::is_mrpc( iden ) ) {
515 TofData* tof = (*iter).second;
516 if( m_id1 == tof->tofId() && abs( m_istrip1 - tof->strip() )<=abs(m_delStrip1) ) {
517 m_delStrip1 = m_istrip1 - tof->strip();
518 }
519 if( ( abs( m_id1 - tof->tofId() )==1 || ( m_id1==0 && tof->tofId()==35 ) || ( m_id1==35 && tof->tofId()==0 ) || ( m_id1==36 && tof->tofId()==71 ) || ( m_id1==71 && tof->tofId()==36 ) ) && abs( m_istrip1 - tof->strip() )<=abs(m_delStrip1) ) {
520 m_delStrip2 = m_istrip1 - tof->strip();
521 }
522 }
523 }
524
525 unsigned int whichEndcap = 0;
526 int tofid0 = m_id1;
527 if( m_hitCase == WestEndcapMRPC ) {
528 whichEndcap = 1;
529 tofid0 = m_id1 - 36;
530 }
531 int strip0 = m_istrip1;
532 identify[0] = TofID::getIntID( 3, whichEndcap, tofid0, strip0, 0 );
533 count[0] = tofDataMap.count( identify[0] );
534 int strip1 = strip0 - 1;
535 if( strip1 == -1 ) { count[1] = 0; }
536 else {
537 identify[1] = TofID::getIntID( 3, whichEndcap, tofid0, strip1, 0 );
538 count[1] = tofDataMap.count( identify[1] );
539 }
540 int strip2 = strip0 + 1;
541 if( strip2 == 12 ) { count[2] = 0; }
542 else {
543 identify[2] = TofID::getIntID( 3, whichEndcap, tofid0, strip2, 0 );
544 count[2] = tofDataMap.count( identify[2] );
545 }
546 int strip3 = strip0 - 2;
547 if( strip3 == -1 || strip3 == -2 ) { count[3] = 0; }
548 else {
549 identify[3] = TofID::getIntID( 3, whichEndcap, tofid0, strip3, 0 );
550 count[3] = tofDataMap.count( identify[3] );
551 }
552 int strip4 = strip0 + 2;
553 if( strip4 == 12 || strip4 == 13 ) { count[4] = 0; }
554 else {
555 identify[4] = TofID::getIntID( 3, whichEndcap, tofid0, strip4, 0 );
556 count[4] = tofDataMap.count( identify[4] );
557 }
558 int tofid1 = tofid0 - 1;
559 if( tofid1 == -1 ) { tofid1 = 35; }
560 identify[5] = TofID::getIntID( 3, whichEndcap, tofid1, strip0, 0 );
561 count[5] = tofDataMap.count( identify[5] );
562 int tofid2 = tofid0 + 1;
563 if( tofid2 == 36 ) { tofid2 = 0; }
564 identify[6] = TofID::getIntID( 3, whichEndcap, tofid2, strip0, 0 );
565 count[6] = tofDataMap.count( identify[6] );
566 identify[7] = TofID::getIntID( 3, whichEndcap, tofid1, strip1, 0 );
567 count[7] = tofDataMap.count( identify[7] );
568 identify[8] = TofID::getIntID( 3, whichEndcap, tofid1, strip2, 0 );
569 count[8] = tofDataMap.count( identify[8] );
570 identify[9] = TofID::getIntID( 3, whichEndcap, tofid2, strip1, 0 );
571 count[9] = tofDataMap.count( identify[9] );
572 identify[10] = TofID::getIntID( 3, whichEndcap, tofid2, strip2, 0 );
573 count[10] = tofDataMap.count( identify[10] );
574 }
575
576 for( unsigned int i=0; i<11; i++ ) {
577 if( count[i] > 0 ) {
578 pair< IterTofDataMap, IterTofDataMap > range = tofDataMap.equal_range( identify[i] );
579 IterTofDataMap iter = range.first;
580 for( unsigned int j=0; j<count[i]; j++,iter++ ) {
581 if( i==0 ) {
582 tofDataAnalysis( (*iter).second, 1 );
583 }
584 else if( i==1 || i==2 ) {
585 tofDataAnalysis( (*iter).second, 2 );
586 }
587 else {
588 tofDataAnalysis( (*iter).second, 3 );
589 }
590 }
591 }
592 countTot1 = countTot1 + count[i];
593 }
594
595 if( countTot1 == 0 ) {
596 if( m_hitCase == DoubleLayer ) {
597 m_hitCase = OuterLayer;
598 }
599 else if( ( m_hitCase == EastEndcapMRPC ) || ( m_hitCase == WestEndcapMRPC ) ) {
600 }
601 else {
602 m_hitCase = NoHit;
603 m_quality = 12;
604 }
605 }
606
607 if( ( ( m_hitCase == OuterLayer ) || ( m_hitCase == DoubleLayer ) ) && ( m_id2 > 87 ) ) {
608 int tofid0 = m_id2 - 88;
609 identify[0] = TofID::getIntID( 1, 1, tofid0, 0 );
610 count[0] = tofDataMap.count( identify[0] );
611 int tofid1 = tofid0 - 1;
612 if( tofid1 == -1 ) { tofid1 = 87; }
613 identify[1] = TofID::getIntID( 1, 1, tofid1, 0 );
614 count[1] = tofDataMap.count( identify[1] );
615 int tofid2 = tofid0 + 1;
616 if( tofid2 == 88 ) { tofid2 = 0; }
617 identify[2] = TofID::getIntID( 1, 1, tofid2, 0 );
618 count[2] = tofDataMap.count( identify[2] );
619
620 for( unsigned int i=0; i<3; i++ ) {
621 if( count[i] > 0 ) {
622 pair< IterTofDataMap, IterTofDataMap > range = tofDataMap.equal_range( identify[i] );
623 IterTofDataMap iter = range.first;
624 for( unsigned int j=0; j<count[i]; j++,iter++ ) {
625 if( i==0 ) {
626 tofDataAnalysis( (*iter).second, 3 );
627 }
628 else {
629 tofDataAnalysis( (*iter).second, 4 );
630 }
631 }
632 }
633 countTot2 = countTot2 + count[i];
634 }
635
636 if( countTot2 == 0 ) {
637 if( m_hitCase != DoubleLayer ) {
638 m_hitCase = NoHit;
639 m_quality = 12;
640 }
641 else {
642 m_hitCase = InnerLayer;
643 }
644 }
645 }
646
647 if( ( ( m_hitCase == EastEndcapMRPC ) || ( m_hitCase == WestEndcapMRPC ) ) && ( ( m_id2 > -1 ) && ( m_istrip2 > -1 ) ) ) {
648 IterTofDataMap iter = tofDataMap.begin();
649 for( ; iter != tofDataMap.end(); iter++ ) {
650 Identifier iden = TofID::cell_id( (*iter).first );
651 if( TofID::is_mrpc( iden ) ) {
652 TofData* tof = (*iter).second;
653 if( m_id2 == tof->tofId() && abs( m_istrip2 - tof->strip() )<=abs(m_delStrip1) ) {
654 m_delStrip1 = m_istrip2 - tof->strip();
655 }
656 if( ( abs( m_id2 - tof->tofId() )==1 || ( m_id2==0 && tof->tofId()==35 ) || ( m_id2==35 && tof->tofId()==0 ) || ( m_id2==36 && tof->tofId()==71 ) || ( m_id2==71 && tof->tofId()==36 ) ) && abs( m_istrip2 - tof->strip() )<=abs(m_delStrip2) ) {
657 m_delStrip2 = m_istrip2 - tof->strip();
658 }
659 }
660 }
661
662 unsigned int whichEndcap = 0;
663 int tofid0 = m_id2;
664 if( m_hitCase == WestEndcapMRPC ) {
665 whichEndcap = 1;
666 tofid0 = m_id2 - 36;
667 }
668 int strip0 = m_istrip2;
669 identify[0] = TofID::getIntID( 3, whichEndcap, tofid0, strip0, 0 );
670 count[0] = tofDataMap.count( identify[0] );
671 int strip1 = strip0 - 1;
672 if( strip1 == -1 ) { count[1] = 0; }
673 else {
674 identify[1] = TofID::getIntID( 3, whichEndcap, tofid0, strip1, 0 );
675 count[1] = tofDataMap.count( identify[1] );
676 }
677 int strip2 = strip0 + 1;
678 if( strip2 == 12 ) { count[2] = 0; }
679 else {
680 identify[2] = TofID::getIntID( 3, whichEndcap, tofid0, strip2, 0 );
681 count[2] = tofDataMap.count( identify[2] );
682 }
683 int strip3 = strip0 - 2;
684 if( strip3 == -1 || strip3 == -2 ) { count[3] = 0; }
685 else {
686 identify[3] = TofID::getIntID( 3, whichEndcap, tofid0, strip3, 0 );
687 count[3] = tofDataMap.count( identify[3] );
688 }
689 int strip4 = strip0 + 2;
690 if( strip4 == 12 || strip4 == 13 ) { count[4] = 0; }
691 else {
692 identify[4] = TofID::getIntID( 3, whichEndcap, tofid0, strip4, 0 );
693 count[4] = tofDataMap.count( identify[4] );
694 }
695 int tofid1 = tofid0 - 1;
696 if( tofid1 == -1 ) { tofid1 = 35; }
697 identify[5] = TofID::getIntID( 3, whichEndcap, tofid1, strip0, 0 );
698 count[5] = tofDataMap.count( identify[5] );
699 int tofid2 = tofid0 + 1;
700 if( tofid2 == 36 ) { tofid2 = 0; }
701 identify[6] = TofID::getIntID( 3, whichEndcap, tofid2, strip0, 0 );
702 count[6] = tofDataMap.count( identify[6] );
703 identify[7] = TofID::getIntID( 3, whichEndcap, tofid1, strip1, 0 );
704 count[7] = tofDataMap.count( identify[7] );
705 identify[8] = TofID::getIntID( 3, whichEndcap, tofid1, strip2, 0 );
706 count[8] = tofDataMap.count( identify[8] );
707 identify[9] = TofID::getIntID( 3, whichEndcap, tofid2, strip1, 0 );
708 count[9] = tofDataMap.count( identify[9] );
709 identify[10] = TofID::getIntID( 3, whichEndcap, tofid2, strip2, 0 );
710 count[10] = tofDataMap.count( identify[10] );
711
712 for( unsigned int i=0; i<11; i++ ) {
713 if( count[i] > 0 ) {
714 pair< IterTofDataMap, IterTofDataMap > range = tofDataMap.equal_range( identify[i] );
715 IterTofDataMap iter = range.first;
716 for( unsigned int j=0; j<count[i]; j++,iter++ ) {
717 if( i==0 ) {
718 tofDataAnalysis( (*iter).second, 4 );
719 }
720 else if( i==1 || i==2 ) {
721 tofDataAnalysis( (*iter).second, 5 );
722 }
723 else {
724 tofDataAnalysis( (*iter).second, 6 );
725 }
726 }
727 }
728 countTot2 = countTot2 + count[i];
729 }
730 }
731
732 if( countTot1==0 && countTot2==0 ) {
733 m_hitCase = NoHit;
734 m_quality = 12;
735 }
736
737 return;
738}
739
740
741//------- tofDataAnalysis ----------------------------------------
742// analysis tof data
743//
744void TofTrack::tofDataAnalysis( TofData* tof, unsigned int iflag ) {
745
746 unsigned int qual = tof->quality();
747
748 if( ( qual & 0x10 ) == 0 ) {
749 qual = ( qual | 0x10 ); // zadc, ztdc unmatched, and track matched
750 if( tof->barrel() || tof->is_mrpc() ) { // Barrel, Endcap has been done
751 if( ( tof->quality() == 0x7 ) || ( tof->quality() == 0xd ) ) {
752 qual = ( qual | 0x20 ); // lost one Q
753 }
754
755 if( ( tof->quality() == 0xb ) || ( tof->quality() == 0xe ) ) {
756 qual = ( qual | 0x40 ); // lost one T
757 }
758
759 if( ( tof->quality() == 0x3 ) || ( tof->quality() == 0xc ) ) {
760 qual = ( qual | 0x80 ); // single end
761 }
762 }
763 if( tof->barrel() ) {
764 if( ( tof->quality() & 0x5 ) == 0x5 ) {
765 double ztdc = tofCaliSvc->ZTDC( tof->tdc1(), tof->tdc2(), tof->tofId() );
766 tof->setZTdc( ztdc );
767 }
768
769 if( ( tof->quality() & 0xa ) == 0xa ) {
770 double zadc = tofCaliSvc->ZADC( tof->adc1(), tof->adc2(), tof->tofId() );
771 tof->setZAdc( zadc );
772 }
773 }
774 if( tof->is_mrpc() ) {
775 if( ( tof->quality() & 0x5 ) == 0x5 ) {
776 double ztdc = tofCaliSvc->EtfZTDC( tof->tdc1(), tof->tdc2(), tof->tofId(), tof->strip() );
777 tof->setZTdc( ztdc );
778 }
779 }
780 tof->setQuality( qual );
781 }
782
783 if( iflag == 1 ) { m_tofData1.push_back( tof ); }
784 else if( iflag == 2 ) { m_tofData2.push_back( tof ); }
785 else if( iflag == 3 ) { m_tofData3.push_back( tof ); }
786 else if( iflag == 4 ) { m_tofData4.push_back( tof ); }
787 else if( iflag == 5 ) { m_tofData5.push_back( tof ); }
788 else if( iflag == 6 ) { m_tofData6.push_back( tof ); }
789 else {
790 cout << "TofRec::TofTrack::TofDataAnalylsis: the Flag should be 1-4, out of the Range!" << endl;
791 }
792
793 return;
794}
795
796
797//------- match --------------------------------------------------
798// Tof Data - Extrapolated Track Match
799//
800void TofTrack::match( bool forCalibration, std::vector<int> deadId, std::vector<TofTrack*>*& tofTrackVec ) {
801
802 if( m_hitCase == NoHit ) return;
803
804 if( m_hitCase == InnerLayer ) {
805 findTofDataBarrel( m_tofData1, m_tofData2, m_zrhit1, 1, tofTrackVec );
806 if( ( m_quality1 & 0x10 ) == 0 ) { m_hitCase = NoHit; }
807 }
808 else if( m_hitCase == OuterLayer ) {
809 findTofDataBarrel( m_tofData3, m_tofData4, m_zrhit2, 2, tofTrackVec );
810 if( ( m_quality2 & 0x10 ) == 0 ) { m_hitCase = NoHit; }
811 }
812 else if( m_hitCase == DoubleLayer ) {
813 findTofDataBarrel( m_tofData1, m_tofData2, m_zrhit1, 1, tofTrackVec );
814 if( ( m_quality1 & 0x10 ) == 0 ) { m_hitCase = OuterLayer; }
815 findTofDataBarrel( m_tofData3, m_tofData4, m_zrhit2, 2, tofTrackVec );
816 if( ( m_quality2 & 0x10 ) == 0 ) {
817 if( m_hitCase == DoubleLayer ) {
818 m_hitCase = InnerLayer;
819 }
820 else if( m_hitCase == OuterLayer ) {
821 m_hitCase = NoHit;
822 }
823 else {
824 cout << "TofRec::TofTrack::match: 2- Impossible!" << endl;
825 }
826 }
827 }
828 else if( ( m_hitCase == EastEndcap ) || ( m_hitCase == WestEndcap ) ) {
829 findTofDataEndcap( m_tofData1, m_tofData2, m_zr1 );
830 }
831 else if( ( m_hitCase == EastEndcapMRPC ) || ( m_hitCase == WestEndcapMRPC ) ) {
832 findEtfData( m_tofData1, m_tofData2, m_tofData3, m_zrhit1, 1 );
833 findEtfData( m_tofData4, m_tofData5, m_tofData6, m_zrhit2, 2 );
834 }
835 else {
836 cout << "TofRec::TofTrack::match: 1- Impossible!" << endl;
837 }
838
839 if( forCalibration ) {
840 // set Data Sample for Calibration, double layer, only one hit for counter, T and Q.
841 if( m_hitCase == DoubleLayer ) {
842 if( ( ( m_quality1 & 0xf ) == 0xf ) && ( ( m_quality2 & 0xf ) == 0xf ) ) {
843 m_quality1 = ( m_quality1 | 0x800 ); // Calibration Sample
844 m_quality2 = ( m_quality2 | 0x800 ); // Calibration Sample
845 }
846 else {
847 std::vector<int>::iterator iter = deadId.begin();
848 for( ; iter != deadId.end(); iter++ ) {
849 Identifier iden = Identifier(*iter);
850 int barrel = TofID::barrel_ec(iden);
851 int layer = TofID::layer(iden);
852 int tofId = TofID::phi_module(iden);
853 int east = TofID::end(iden);
854 if( barrel == 1 ) {
855 if( layer==0 ) {
856 if( m_tofId1 == tofId ) {
857 if( ( m_quality2 & 0xf ) == 0xf ) {
858 if( ( ( east == 0 ) && ( ( m_quality1 & 0xf ) == 0x3 ) ) || ( ( east == 1 ) && ( ( m_quality1 & 0xf ) == 0xc ) ) ) {
859 m_quality1 = ( m_quality1 | 0x800 );
860 m_quality2 = ( m_quality2 | 0x800 );
861
862 }
863 }
864 }
865 }
866 else if( layer == 1 ) {
867 if( m_tofId2 == (tofId+88) ) {
868 if( ( m_quality1 & 0xf ) == 0xf ) {
869 if( ( ( east == 0 ) && ( ( m_quality2 & 0xf ) == 0x3 ) ) || ( ( east == 1 ) && ( ( m_quality2 & 0xf ) == 0xc ) ) ) {
870 m_quality1 = ( m_quality1 | 0x800 );
871 m_quality2 = ( m_quality2 | 0x800 );
872 }
873 }
874 }
875 }
876 }
877 }
878 }
879 }
880 // set Data Sample for Calibration, only one hit for counter, T and Q.
881 else if( m_hitCase == InnerLayer ) {
882 if( ( m_quality1 & 0xf ) == 0xf ) {
883 m_quality1 = ( m_quality1 | 0x800 ); // Calibration Sample
884 }
885 else {
886 std::vector<int>::iterator iter = deadId.begin();
887 for( ; iter != deadId.end(); iter++ ) {
888 Identifier iden = Identifier(*iter);
889 int barrel = TofID::barrel_ec(iden);
890 int layer = TofID::layer(iden);
891 int tofId = TofID::phi_module(iden);
892 int east = TofID::end(iden);
893 if( barrel == 1 ) {
894 if( layer==0 ) {
895 if( m_tofId1 == tofId ) {
896 if( ( ( east == 0 ) && ( ( m_quality1 & 0xf ) == 0x3 ) ) || ( ( east == 1 ) && ( ( m_quality1 & 0xf ) == 0xc ) ) ) {
897 m_quality1 = ( m_quality1 | 0x800 );
898 }
899 }
900 }
901 }
902 }
903 }
904 }
905
906 // set Data Sample for Calibration, only one hit for counter, T and Q.
907 if( ( ( m_hitCase == EastEndcap ) || ( m_hitCase == WestEndcap ) ) && ( ( m_quality1 & 0xf ) == 0xc ) ) {
908 m_quality1 = ( m_quality1 | 0x800 ); // Calibration Sample
909 }
910
911 // set Data Sample for Calibration.
912 if( ( m_hitCase == EastEndcapMRPC ) || ( m_hitCase == WestEndcapMRPC ) ) {
913 if( ( ( m_quality1 & 0xf000 ) == 0x1000 ) || ( ( m_quality1 & 0xf000 ) == 0x2000 ) ) {
914 if( ( m_quality1 & 0xf ) == 0xf ) {
915 m_quality1 = ( m_quality1 | 0x800 ); // Calibration Sample
916 }
917 }
918 if( ( ( m_quality2 & 0xf000 ) == 0x1000 ) || ( ( m_quality2 & 0xf000 ) == 0x2000 ) ) {
919 if( ( m_quality2 & 0xf ) == 0xf ) {
920 m_quality2 = ( m_quality2 | 0x800 ); // Calibration Sample
921 }
922 }
923 }
924
925 }
926
927 return;
928}
929
930
931//------- findTofDataBarrel ----------------------------------------
932// find the right TOF information in TOF data vector
933// of the exact TOF ID and of the neighbor
934//
935void TofTrack::findTofDataBarrel( std::vector<TofData*> tofDataVec1, std::vector<TofData*> tofDataVec2, double zrhit, unsigned int iflag, std::vector<TofTrack*>*& tofTrackVec ) {
936
937 unsigned int qual = 0xf;
938 TofData* tof = 0;
939 if( tofDataVec2.size() == 0 ) {
940 if( tofDataVec1.size() == 0 ) {
941 qual = 0;
942 }
943 else if( tofDataVec1.size() == 1 ) {
944 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
945 tof = (*iter1);
946 qual = 0x1;
947 }
948 else if( tofDataVec1.size() > 1 ) {
949 tof= chooseTofData( tofDataVec1, zrhit );
950 qual = 0x2;
951 }
952 else {
953 cout << "TofRec::TofTrack::findTofDataBarrel: 1- Impossible!" << endl;
954 }
955 }
956 else if( ( tofDataVec2.size() == 1 ) ) {
957 if( tofDataVec1.size() == 0 ) {
958 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
959 tof = (*iter2);
960 qual = 0x4;
961 }
962 else if( tofDataVec1.size() == 1 ) {
963 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
964 if( ((*iter1)->quality()&0x1ff)==0x01f && abs((*iter1)->ztdc()-zrhit)<ztdc_Cut ) {
965 tof = (*iter1);
966 }
967 else {
968 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
969 tof = compareTofData( (*iter1), (*iter2), zrhit );
970 }
971 qual = 0x5;
972 }
973 else if( tofDataVec1.size() > 1 ) {
974 TofData* tofData1 = chooseTofData( tofDataVec1, zrhit );
975 if( (tofData1->quality()&0x1ff)==0x01f && abs(tofData1->ztdc()-zrhit)<ztdc_Cut ) {
976 tof = tofData1;
977 }
978 else {
979 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
980 tof = compareTofData( tofData1, (*iter2), zrhit );
981 }
982 qual = 0x6;
983 }
984 else {
985 cout << "TofRec::TofTrack::findTofDataBarrel: 2- Impossible!" << endl;
986 }
987 }
988 else if( ( tofDataVec2.size() > 1 ) ) {
989 if( tofDataVec1.size() == 0 ) {
990 tof = chooseTofData( tofDataVec2, zrhit );
991 qual = 0x8;
992 }
993 else if( tofDataVec1.size() == 1 ) {
994 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
995 if( ((*iter1)->quality()&0x1ff)==0x01f && abs((*iter1)->ztdc()-zrhit)<ztdc_Cut ) {
996 tof = (*iter1);
997 }
998 else {
999 TofData* tofData2 = chooseTofData( tofDataVec2, zrhit );
1000 tof = compareTofData( (*iter1), tofData2, zrhit );
1001 }
1002 qual = 0x9;
1003 }
1004 else if( tofDataVec1.size() > 1 ) {
1005 TofData* tofData1 = chooseTofData( tofDataVec1, zrhit );
1006 if( (tofData1->quality()&0x1ff)==0x01f && abs(tofData1->ztdc()-zrhit)<ztdc_Cut ) {
1007 tof = tofData1;
1008 }
1009 else {
1010 TofData* tofData2 = chooseTofData( tofDataVec2, zrhit );
1011 tof = compareTofData( tofData1, tofData2, zrhit );
1012 }
1013 qual = 0xa;
1014 }
1015 else {
1016 cout << "TofRec::TofTrack::findTofDataBarrel: 3- Impossible!" << endl;
1017 }
1018 }
1019
1020 if( qual != 0 ) {
1021 if( !(tof->used()) ) {
1022 getTofData( tof, iflag );
1023 }
1024 else {
1025 bool z1=false, z2=false;
1026 bool zc1=false, zc2=false;
1027 TofTrack* track=0;
1028 if( iflag==1 ) {
1029 z1 = ( abs( m_zrhit1 - tof->ztdc() ) < ztdc_Cut );
1030 zc1 = ( m_zrhit1 > tof->ztdc() );
1031 std::vector<TofTrack*>::iterator iter = tofTrackVec->begin();
1032 for( ; iter!=tofTrackVec->end(); iter++ ) {
1033 if( tof->tofId()==(*iter)->tofId1() ) {
1034 track = (*iter);
1035 z2 = ( abs( (*iter)->zrhit1() - tof->ztdc() ) < ztdc_Cut );
1036 zc2 = ( (*iter)->zrhit1() > tof->ztdc() );
1037 }
1038 }
1039 }
1040 else if( iflag==2 ) {
1041 z1 = ( abs( m_zrhit2 - tof->ztdc() ) < ztdc_Cut );
1042 zc1 = ( m_zrhit2 > tof->ztdc() );
1043 std::vector<TofTrack*>::iterator iter = tofTrackVec->begin();
1044 for( ; iter!=tofTrackVec->end(); iter++ ) {
1045 if( tof->tofId()==(*iter)->tofId2() ) {
1046 track = (*iter);
1047 z2 = ( abs( (*iter)->zrhit2() - tof->ztdc() ) < ztdc_Cut );
1048 zc2 = ( (*iter)->zrhit2() > tof->ztdc() );
1049 }
1050 }
1051 }
1052
1053 if( ( z1 && z2 )||( (!z1) && (!z2) ) ) {
1054 if( zc1 && !zc2 ) {
1055 getTofDataEast( tof, iflag );
1056 track->getTofDataWest( tof, iflag );
1057 }
1058 else if( !zc1 && zc2 ) {
1059 getTofDataWest( tof, iflag );
1060 track->getTofDataEast( tof, iflag );
1061 }
1062 }
1063 else if( z1 && !z2 ) {
1064 getTofData( tof, iflag );
1065 track->getTofDataNohit( iflag );
1066 }
1067 else if( !z1 && z2 ) {
1068 qual = 0;
1069 }
1070 }
1071 }
1072
1073 if( qual == 0 ) {
1074 if( ( iflag == 1 ) || ( iflag == 3 ) ) {
1075 m_quality1 = ( m_quality1 | 0x300 );
1076 }
1077 else if( iflag == 2 ) {
1078 m_quality2 = ( m_quality2 | 0x300 );
1079 }
1080 else {
1081 cout << "TofRec::TofTrack::findTofDataBarrel: the 1- IFLAG is Out of Range!" << endl;
1082 }
1083 }
1084 else {
1085 qual = ( qual << 12 );
1086 if( ( iflag == 1 ) || ( iflag == 3 ) ) {
1087 m_quality1 = ( m_quality1 | qual );
1088 }
1089 else if( iflag == 2 ) {
1090 m_quality2 = ( m_quality2 | qual );
1091 }
1092 else {
1093 cout << "TofRec::TofTrack::findTofDataBarrel: the 2- IFLAG is Out of Range!" << endl;
1094 }
1095 }
1096
1097 return;
1098}
1099
1100
1101//------- chooseTofData -------------------------------------------
1102// choose the most possible TofData from TofDataVector
1103// ZTDC, ZADC, SingleEnd/NoQ/NoT are jugded.
1104//
1105TofData* TofTrack::chooseTofData( std::vector<TofData*> tofDataVec, double zrhit ) {
1106 if( tofDataVec.size() == 0 ) {
1107 cout << "TofRec::TofTrack::ChooseTofData: Size of TofData Vector is Zero!" << endl;
1108 return 0;
1109 }
1110 std::vector<TofData*>::iterator igood = tofDataVec.begin();
1111 if( tofDataVec.size() > 1 ) {
1112 double deltaZ = 1000.0;
1113 std::vector<TofData*>::iterator iter = tofDataVec.begin();
1114 // ZTDC compare
1115 for( ; iter != tofDataVec.end(); iter++ ) {
1116 if( ( (*iter)->quality() & 0x5 ) == 0x5 ) {
1117 if( abs( (*iter)->ztdc() - zrhit ) < deltaZ ) {
1118 deltaZ = abs( (*iter)->ztdc() - zrhit );
1119 igood = iter;
1120 }
1121 }
1122 }
1123 // ZADC compare
1124 if( deltaZ > 999.0 ) {
1125 iter = tofDataVec.begin();
1126 for( ; iter != tofDataVec.end(); iter++ ) {
1127 if( ( (*iter)->quality() & 0xa ) == 0xa ) {
1128 if( abs( (*iter)->zadc() - zrhit ) < deltaZ ) {
1129 deltaZ = abs( (*iter)->zadc() - zrhit );
1130 igood = iter;
1131 }
1132 }
1133 }
1134 }
1135 // Max Q
1136 if( deltaZ > 999.0 ) {
1137 unsigned int ibad = 0xf0;
1138 iter = tofDataVec.begin();
1139 for( ; iter != tofDataVec.end(); iter++ ) {
1140 if( ( (*iter)->quality() & 0xf0 ) < ibad ) {
1141 igood = iter;
1142 ibad = ( (*iter)->quality() & 0xf0 );
1143 }
1144 else if( ( (*iter)->quality() & 0xf0 ) == ibad ) {
1145 if( ( (*iter)->adc1() + (*iter)->adc2() ) > ( (*igood)->adc1() + (*igood)->adc2() ) ) {
1146 igood = iter;
1147 ibad = ( (*iter)->quality() & 0xf0 );
1148 }
1149 }
1150 }
1151 }
1152 }
1153
1154 return (*igood);
1155}
1156
1157
1158//------- compareTofData -------------------------------------------
1159// choose the most possible TofData from TofDataVector
1160// ZTDC, ZADC, SingleEnd/NoQ/NoT are jugded.
1161//
1162TofData* TofTrack::compareTofData( TofData* tofData1, TofData* tofData2, double zrhit ) {
1163 TofData* tof = tofData1;
1164 // ZTDC compare
1165 if( abs(tofData1->ztdc() - zrhit ) > abs(tofData2->ztdc() - zrhit ) ) {
1166 // SingleEnd/NoT/NoQ compare
1167 if( ( tofData1->quality() & 0xf0 ) >= ( tofData1->quality() & 0xf0 ) ) {
1168 // QDC compare
1169 // if( ( tofData1->adc1() + tofData1->adc2() ) < ( tofData2->adc1() + tofData2->adc2() ) ) {
1170 tof = tofData2;
1171 // }
1172 }
1173 // }
1174 }
1175
1176 return tof;
1177}
1178
1179
1180//------- findTofDataEndcap --------------------------------------
1181// find the right TOF information in TOF data vector
1182// of the exact TOF ID and of the neighbor
1183//
1184void TofTrack::findTofDataEndcap( std::vector<TofData*> tofDataVec1, std::vector<TofData*> tofDataVec2, double zr1[5] ) {
1185
1186 unsigned int iflag = 3;
1187 unsigned int qual = 0xf;
1188
1189 if( tofDataVec2.size() == 0 ) {
1190 if( tofDataVec1.size() == 0 ) {
1191 qual = 0;
1192 }
1193 else if( tofDataVec1.size() == 1 ) {
1194 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1195 getTofData( (*iter1), iflag );
1196 qual = 0x1;
1197 }
1198 else if( tofDataVec1.size() > 1 ) {
1199 getTofData( chooseTofDataEndcap( tofDataVec1, zr1 ), iflag );
1200 qual = 0x2;
1201 }
1202 else {
1203 cout << "TofRec::TofTrack::findTofDataEndcap: 1- Impossible!" << endl;
1204 }
1205 }
1206 else if( ( tofDataVec2.size() == 1 ) ) {
1207 if( tofDataVec1.size() == 0 ) {
1208 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1209 getTofData( (*iter2), iflag );
1210 qual = 0x4;
1211 }
1212 else if( tofDataVec1.size() == 1 ) {
1213 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1214 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1215 getTofData( compareTofDataEndcap( (*iter1), (*iter2) ), iflag );
1216 qual = 0x5;
1217 }
1218 else if( tofDataVec1.size() > 1 ) {
1219 TofData* tofData1 = chooseTofDataEndcap( tofDataVec1, zr1 );
1220 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1221 getTofData( compareTofDataEndcap( tofData1, (*iter2) ), iflag );
1222 qual = 0x6;
1223 }
1224 else {
1225 cout << "TofRec::TofTrack::findTofDataBarrel: 2- Impossible!" << endl;
1226 }
1227 }
1228 else if( ( tofDataVec2.size() > 1 ) ) {
1229 if( tofDataVec1.size() == 0 ) {
1230 getTofData( chooseTofDataEndcap( tofDataVec2, zr1 ), iflag );
1231 qual = 0x8;
1232 }
1233 else if( tofDataVec1.size() == 1 ) {
1234 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1235 TofData* tofData2 = chooseTofDataEndcap( tofDataVec2, zr1 );
1236 getTofData( compareTofDataEndcap( (*iter1), tofData2 ), iflag );
1237 qual = 0x9;
1238 }
1239 else if( tofDataVec1.size() > 1 ) {
1240 TofData* tofData1 = chooseTofDataEndcap( tofDataVec1, zr1 );
1241 TofData* tofData2 = chooseTofDataEndcap( tofDataVec2, zr1 );
1243 qual = 0xa;
1244 }
1245 else {
1246 cout << "TofRec::TofTrack::findTofDataBarrel: 3- Impossible!" << endl;
1247 }
1248 }
1249
1250 if( qual == 0 ) {
1251 m_quality1 = ( m_quality1 | 0x300 );
1252 }
1253 else {
1254 qual = ( qual << 12 );
1255 m_quality1 = ( m_quality1 | qual );
1256 }
1257
1258 return;
1259}
1260
1261
1262//------- chooseTofDataEndcap --------------------------------
1263// choose the most possible TofData from TofDataVector
1264//
1265TofData* TofTrack::chooseTofDataEndcap( std::vector<TofData*> tofDataVec, double zr1[5] ) {
1266 if( tofDataVec.size() == 0 ) {
1267 cout << "TofRec::TofTrack::ChooseTofData: Size of TofData Vector is Zero!" << endl;
1268 return 0;
1269 }
1270 std::vector<TofData*>::iterator igood = tofDataVec.begin();
1271 if( tofDataVec.size() > 1 ) {
1272 bool multihit = false;
1273 std::vector<TofData*>::iterator iter = tofDataVec.begin();
1274 for( ; iter != tofDataVec.end(); iter++ ) {
1275 if( (*iter)->qtimes1()>1 ) { multihit = true; }
1276 }
1277 iter = tofDataVec.begin();
1278 if( multihit ) {
1279 double tcorr = -999.0;
1280 double deltaTMin = 999.0;
1281 for( ; iter != tofDataVec.end(); iter++ ) {
1282 tcorr = tofCaliSvc->ETime( (*iter)->adc(), (*iter)->tdc()-m_estime, zr1[2], (*iter)->tofId() );
1283 for( unsigned int i=0; i<5; i++ ) {
1284 if( abs(tcorr-m_texpInner[i]) < deltaTMin ) {
1285 deltaTMin = abs(tcorr-m_texpInner[i]);
1286 igood = iter;
1287 }
1288 }
1289 }
1290 }
1291 else {
1292 double maxQ = 0.0;
1293 for( ; iter != tofDataVec.end(); iter++ ) {
1294 if( (*iter)->adc() > maxQ ) {
1295 maxQ = (*iter)->adc();
1296 igood = iter;
1297 }
1298 }
1299 }
1300 }
1301 return (*igood);
1302}
1303
1304
1305//------- compareTofDataEndcap -------------------------------
1306// choose the most possible TofData from TofDataVector
1307//
1309 TofData* tof = tofData1;
1310 if( tof->adc() < tofData2->adc() ) {
1311 tof = tofData2;
1312 }
1313 return tof;
1314}
1315
1316
1317//------- findTofDataEtf --------------------------------------
1318// find the right TOF information in TOF data vector
1319// of the exact TOF ID and of the neighbor
1320//
1321void TofTrack::findEtfData( std::vector<TofData*> tofDataVec1, std::vector<TofData*> tofDataVec2, std::vector<TofData*> tofDataVec3, double zrhit, unsigned int iflag ) {
1322
1323 TofData *tof1 = 0;
1324 TofData *tof2 = 0;
1325 TofData *tof3 = 0;
1326
1327 bool findSignal = false;
1328
1329 if( tofDataVec1.size()==0 && tofDataVec2.size()==0 && tofDataVec3.size()==0 ) {
1330 if( iflag == 1 ) {
1331 m_quality1 = ( m_quality1 | 0x300 );
1332 }
1333 else if( iflag == 2 ) {
1334 m_quality2 = ( m_quality2 | 0x300 );
1335 }
1336 }
1337 else {
1338 if( tofDataVec1.size()>0 ) {
1339 tof1 = chooseEtfData1( tofDataVec1, zrhit );
1340 if( ( tof1->quality() & 0xf ) == 0xf ) {
1341 getEtfData( tof1, iflag, 1 );
1342 findSignal = true;
1343 }
1344 }
1345 if( !findSignal && tofDataVec2.size() > 0 ) {
1346 tof2 = chooseEtfData1( tofDataVec2, zrhit );
1347 if( ( tof2->quality() & 0xf ) == 0xf ) {
1348 getEtfData( tof2, iflag, 2 );
1349 findSignal = true;
1350 }
1351 }
1352 if( !findSignal && tofDataVec3.size() > 0 ) {
1353 tof3 = chooseEtfData2( tofDataVec3, zrhit );
1354 if( ( tof3->quality() & 0xf ) == 0xf ) {
1355 getEtfData( tof3, iflag, 3 );
1356 findSignal = true;
1357 }
1358 }
1359 if( !findSignal && tofDataVec1.size()>0 ) {
1360 if( ( ( tof1->quality() & 0xf ) == 0xc ) || ( ( tof1->quality() & 0xf ) == 0x3 ) ) {
1361 getEtfData( tof1, iflag, 4 );
1362 findSignal = true;
1363 }
1364 }
1365 if( !findSignal && tofDataVec2.size() > 0 ) {
1366 if( ( ( tof2->quality() & 0xf ) == 0xc ) || ( ( tof2->quality() & 0xf ) == 0x3 ) ) {
1367 getEtfData( tof2, iflag, 5 );
1368 findSignal = true;
1369 }
1370 }
1371 if( !findSignal && tofDataVec3.size() > 0 ) {
1372 if( ( ( tof3->quality() & 0xf ) == 0xc ) || ( ( tof3->quality() & 0xf ) == 0x3 ) ) {
1373 getEtfData( tof3, iflag, 6 );
1374 findSignal = true;
1375 }
1376 }
1377 if( findSignal ) {
1378 if( iflag == 1 ) {
1379 m_quality1 = ( m_quality1 | 0x300 );
1380 }
1381 else if( iflag == 2 ) {
1382 m_quality2 = ( m_quality2 | 0x300 );
1383 }
1384 }
1385 }
1386
1387 return;
1388}
1389
1390//------- chooseEtfData -------------------------------
1391// choose the most possible TofData from TofDataVector
1392//
1393TofData* TofTrack::chooseEtfData1( std::vector<TofData*> tofDataVec, double zrhit ) {
1394 if( tofDataVec.size() == 0 ) {
1395 return 0;
1396 }
1397 std::vector<TofData*>::iterator igood = tofDataVec.begin();
1398 if( tofDataVec.size() == 1 ) {
1399 return (*igood);
1400 }
1401 else if( tofDataVec.size() > 1 ) {
1402 double deltaZ = 1000.0;
1403 std::vector<TofData*>::iterator iter = tofDataVec.begin();
1404 for( ; iter != tofDataVec.end(); iter++ ) {
1405 if( ( (*iter)->quality() & 0xf ) == 0xf ) {
1406 if( abs( (*iter)->ztdc() - zrhit ) < deltaZ ) {
1407 deltaZ = abs( (*iter)->ztdc() - zrhit );
1408 igood = iter;
1409 }
1410 }
1411 }
1412 // Max Q
1413 if( deltaZ > 999.0 ) {
1414 double maxQ = -1;
1415 iter = tofDataVec.begin();
1416 for( ; iter != tofDataVec.end(); iter++ ) {
1417 if( ( (*iter)->quality() & 0xc ) == 0xc ) {
1418 if( (*iter)->adc1() > maxQ ) {
1419 maxQ = (*iter)->adc1();
1420 igood = iter;
1421 }
1422 }
1423 else if( ( (*iter)->quality() & 0x3 ) == 0x3 ) {
1424 if( (*iter)->adc2() > maxQ ) {
1425 maxQ = (*iter)->adc2();
1426 igood = iter;
1427 }
1428 }
1429 }
1430 }
1431 }
1432
1433 return (*igood);
1434}
1435
1436//------- chooseEtfData -------------------------------
1437// choose the most possible TofData from TofDataVector
1438//
1439TofData* TofTrack::chooseEtfData2( std::vector<TofData*> tofDataVec, double zrhit ) {
1440 if( tofDataVec.size() == 0 ) {
1441 return 0;
1442 }
1443 std::vector<TofData*>::iterator igood = tofDataVec.begin();
1444 if( tofDataVec.size() == 1 ) {
1445 return (*igood);
1446 }
1447 else if( tofDataVec.size() > 1 ) {
1448 double maxQ = -1;
1449 std::vector<TofData*>::iterator iter = tofDataVec.begin();
1450 for( ; iter != tofDataVec.end(); iter++ ) {
1451 if( ( (*iter)->quality() & 0xc ) == 0xc ) {
1452 if( (*iter)->adc1() > maxQ ) {
1453 maxQ = (*iter)->adc1();
1454 igood = iter;
1455 }
1456 }
1457 else if( ( (*iter)->quality() & 0x3 ) == 0x3 ) {
1458 if( (*iter)->adc2() > maxQ ) {
1459 maxQ = (*iter)->adc2();
1460 igood = iter;
1461 }
1462 }
1463 }
1464 }
1465
1466 return (*igood);
1467}
1468
1469//------- getTofData -----------------------------------------
1470// set Tof Data of Inner / Outer Layer Barrel TOF and Endcap TOF
1471//
1472void TofTrack::getTofData( TofData* tof, unsigned int iflag ) {
1473
1474 if( iflag == 1 ) {
1475 m_tofId1 = tof->tofId();
1476 m_strip1 = tof->strip();
1477 if( tofCaliSvc->QElec() ) {
1478 m_qch1 = tof->qtc1();
1479 }
1480 else {
1481 m_qch1 = tof->adcChannelEast();
1482 }
1483 m_adc1 = tof->adc1();
1484 m_tdc1 = tof->tdc1();
1485 if( tofCaliSvc->QElec() ) {
1486 m_qch2 = tof->qtc2();
1487 }
1488 else {
1489 m_qch2 = tof->adcChannelWest();
1490 }
1491 m_adc2 = tof->adc2();
1492 m_tdc2 = tof->tdc2();
1493 m_ztdc1 = tof->ztdc();
1494 m_zadc1 = tof->zadc();
1495 m_quality1 = ( m_quality1 | ( 0x1f & tof->quality() ) );
1496 if( ( ( tof->quality() & 0x5 ) != 0x5 ) || ( ( ( tof->quality() & 0x5 ) == 0x5 ) && ( abs( tof->ztdc() - m_zrhit1 ) > ztdc_Cut ) ) ) {
1497 m_quality1 = ( m_quality1 | 0x100 );
1498 }
1499 if( ( ( tof->quality() & 0xa ) != 0xa ) || ( ( ( tof->quality() & 0xa ) == 0xa ) && ( abs( tof->zadc() - m_zrhit1 ) > zadc_Cut ) ) ) {
1500 m_quality1 = ( m_quality1 | 0x200 );
1501 }
1502 }
1503 else if( iflag == 2 ) {
1504 m_tofId2 = tof->tofId();
1505 m_strip2 = tof->strip();
1506 if( tofCaliSvc->QElec() ) {
1507 m_qch3 = tof->qtc1();
1508 }
1509 else {
1510 m_qch3 = tof->adcChannelEast();
1511 }
1512 m_adc3 = tof->adc1();
1513 m_tdc3 = tof->tdc1();
1514 if( tofCaliSvc->QElec() ) {
1515 m_qch4 = tof->qtc2();
1516 }
1517 else {
1518 m_qch4 = tof->adcChannelWest();
1519 }
1520 m_adc4 = tof->adc2();
1521 m_tdc4 = tof->tdc2();
1522 m_ztdc2 = tof->ztdc();
1523 m_zadc2 = tof->zadc();
1524 m_quality2 = ( m_quality2 | ( 0x1f & tof->quality() ) );
1525 if( ( ( tof->quality() & 0x5 ) != 0x5 ) || ( ( ( tof->quality() & 0x5 ) == 0x5 ) && ( abs( tof->ztdc() - m_zrhit2 ) > ztdc_Cut ) ) ) {
1526 m_quality2 = ( m_quality2 | 0x100 );
1527 }
1528 if( ( ( tof->quality() & 0xa ) != 0xa ) || ( ( ( tof->quality() & 0xa ) == 0xa ) && ( abs( tof->zadc() - m_zrhit2 ) > zadc_Cut ) ) ) {
1529 m_quality2 = ( m_quality2 | 0x200 );
1530 }
1531 }
1532 else if( iflag == 3 ) {
1533 m_tofId1 = tof->tofId();
1534 if( tofCaliSvc->QElec() ) {
1535 m_qch1 = tof->qtc();
1536 }
1537 else {
1538 m_qch1 = tof->adcChannel();
1539 }
1540 m_adc1 = tof->adc();
1541 m_tdc1 = tof->tdc();
1542 m_quality1 = ( m_quality1 | ( 0x1f & tof->quality() ) );
1543 m_quality1 = ( m_quality1 | 0x300 );
1544 }
1545 else {
1546 cout << "TofRec::TofTrack::getTofData: Flag which sign the Barrel/Endcap or Inner/Outer is wrong! Please check it!" << endl;
1547 }
1548 tof->setUsed();
1549 return;
1550}
1551
1552
1553//------- getTofDataEast ------------------------------------
1554// set Tof Data of Inner / Outer Layer Barrel TOF and Endcap TOF
1555//
1556void TofTrack::getTofDataEast( TofData* tof, unsigned int iflag ) {
1557
1558 if( iflag == 1 ) {
1559 m_tofId1 = tof->tofId();
1560 m_strip1 = tof->strip();
1561 if( tofCaliSvc->QElec() ) {
1562 m_qch1 = tof->qtc1();
1563 }
1564 else {
1565 m_qch1 = tof->adcChannelEast();
1566 }
1567 m_adc1 = tof->adc1();
1568 m_tdc1 = tof->tdc1();
1569 m_qch2 = -999.0;
1570 m_adc2 = -999.0;
1571 m_tdc2 = -999.0;
1572 m_ztdc1 = tof->ztdc();
1573 m_zadc1 = tof->zadc();
1574 m_quality1 = ( ( m_quality1 & 0xfffffff0 ) | ( 0x1c & tof->quality() ) );
1575 if( ( ( tof->quality() & 0x5 ) != 0x5 ) || ( ( ( tof->quality() & 0x5 ) == 0x5 ) && ( abs( tof->ztdc() - m_zrhit1 ) > ztdc_Cut ) ) ) {
1576 m_quality1 = ( m_quality1 | 0x100 );
1577 }
1578 if( ( ( tof->quality() & 0xa ) != 0xa ) || ( ( ( tof->quality() & 0xa ) == 0xa ) && ( abs( tof->zadc() - m_zrhit1 ) > zadc_Cut ) ) ) {
1579 m_quality1 = ( m_quality1 | 0x200 );
1580 }
1581 }
1582 else if( iflag == 2 ) {
1583 m_tofId2 = tof->tofId();
1584 if( tofCaliSvc->QElec() ) {
1585 m_qch3 = tof->qtc1();
1586 }
1587 else {
1588 m_qch3 = tof->adcChannelEast();
1589 }
1590 m_adc3 = tof->adc1();
1591 m_tdc3 = tof->tdc1();
1592 m_qch4 = -999.0;
1593 m_adc4 = -999.0;
1594 m_tdc4 = -999.0;
1595 m_ztdc2 = tof->ztdc();
1596 m_zadc2 = tof->zadc();
1597 m_quality2 = ( ( m_quality2 & 0xfffffff0 ) | ( 0x1c & tof->quality() ) );
1598 if( ( ( tof->quality() & 0x5 ) != 0x5 ) || ( ( ( tof->quality() & 0x5 ) == 0x5 ) && ( abs( tof->ztdc() - m_zrhit2 ) > ztdc_Cut ) ) ) {
1599 m_quality2 = ( m_quality2 | 0x100 );
1600 }
1601 if( ( ( tof->quality() & 0xa ) != 0xa ) || ( ( ( tof->quality() & 0xa ) == 0xa ) && ( abs( tof->zadc() - m_zrhit2 ) > zadc_Cut ) ) ) {
1602 m_quality2 = ( m_quality2 | 0x200 );
1603 }
1604 }
1605 else {
1606 cout << "TofRec::TofTrack::getTofDataEast: Flag which sign the Barrel/Endcap or Inner/Outer is wrong! Please check it!" << endl;
1607 }
1608 tof->setUsed();
1609 return;
1610}
1611
1612
1613//------- getTofDataWest ------------------------------------
1614// set Tof Data of Inner / Outer Layer Barrel TOF and Endcap TOF
1615//
1616void TofTrack::getTofDataWest( TofData* tof, unsigned int iflag ) {
1617
1618 if( iflag == 1 ) {
1619 m_tofId1 = tof->tofId();
1620 m_strip1 = tof->strip();
1621 m_qch1 = -999.0;
1622 m_adc1 = -999.0;
1623 m_tdc1 = -999.0;
1624 if( tofCaliSvc->QElec() ) {
1625 m_qch2 = tof->qtc2();
1626 }
1627 else {
1628 m_qch2 = tof->adcChannelWest();
1629 }
1630 m_adc2 = tof->adc2();
1631 m_tdc2 = tof->tdc2();
1632 m_ztdc1 = tof->ztdc();
1633 m_zadc1 = tof->zadc();
1634 m_quality1 = ( ( m_quality1 & 0xfffffff0 ) | ( 0x13 & tof->quality() ) );
1635 if( ( ( tof->quality() & 0x5 ) != 0x5 ) || ( ( ( tof->quality() & 0x5 ) == 0x5 ) && ( abs( tof->ztdc() - m_zrhit1 ) > ztdc_Cut ) ) ) {
1636 m_quality1 = ( m_quality1 | 0x100 );
1637 }
1638 if( ( ( tof->quality() & 0xa ) != 0xa ) || ( ( ( tof->quality() & 0xa ) == 0xa ) && ( abs( tof->zadc() - m_zrhit1 ) > zadc_Cut ) ) ) {
1639 m_quality1 = ( m_quality1 | 0x200 );
1640 }
1641 }
1642 else if( iflag == 2 ) {
1643 m_tofId2 = tof->tofId();
1644 m_qch3 = -999.0;
1645 m_adc3 = -999.0;
1646 m_tdc3 = -999.0;
1647 if( tofCaliSvc->QElec() ) {
1648 m_qch4 = tof->qtc2();
1649 }
1650 else {
1651 m_qch4 = tof->adcChannelWest();
1652 }
1653 m_adc4 = tof->adc2();
1654 m_tdc4 = tof->tdc2();
1655 m_ztdc2 = tof->ztdc();
1656 m_zadc2 = tof->zadc();
1657 m_quality2 = ( ( m_quality2 & 0xfffffff0 ) | ( 0x13 & tof->quality() ) );
1658 if( ( ( tof->quality() & 0x5 ) != 0x5 ) || ( ( ( tof->quality() & 0x5 ) == 0x5 ) && ( abs( tof->ztdc() - m_zrhit2 ) > ztdc_Cut ) ) ) {
1659 m_quality2 = ( m_quality2 | 0x100 );
1660 }
1661 if( ( ( tof->quality() & 0xa ) != 0xa ) || ( ( ( tof->quality() & 0xa ) == 0xa ) && ( abs( tof->zadc() - m_zrhit2 ) > zadc_Cut ) ) ) {
1662 m_quality2 = ( m_quality2 | 0x200 );
1663 }
1664 }
1665 else {
1666 cout << "TofRec::TofTrack::getTofDataWest: Flag which sign the Barrel/Endcap or Inner/Outer is wrong! Please check it!" << endl;
1667 }
1668 tof->setUsed();
1669 return;
1670}
1671
1672
1673//------- getTofData -----------------------------------------
1674// set Tof Data of Inner / Outer Layer Barrel TOF and Endcap TOF
1675//
1676void TofTrack::getTofDataNohit( unsigned int iflag ) {
1677
1678 if( iflag == 1 ) {
1679 m_tofId1 = -99;
1680 m_strip1 = -99;
1681 m_qch1 = -999.0;
1682 m_adc1 = -999.0;
1683 m_tdc1 = -999.0;
1684 m_qch2 = -999.0;
1685 m_adc2 = -999.0;
1686 m_tdc2 = -999.0;
1687 m_ztdc1 = -999.0;
1688 m_zadc1 = -999.0;
1689 m_quality1 = ( m_quality1 & 0x700 );
1690 if( m_hitCase == InnerLayer ) { m_hitCase = NoHit; }
1691 else if( m_hitCase == DoubleLayer ) { m_hitCase = OuterLayer; }
1692 }
1693 else if( iflag == 2 ) {
1694 m_tofId2 = -99;
1695 m_qch3 = -999.0;
1696 m_adc3 = -999.0;
1697 m_tdc3 = -999.0;
1698 m_qch4 = -999.0;
1699 m_adc4 = -999.0;
1700 m_tdc4 = -999.0;
1701 m_ztdc2 = -999.0;
1702 m_zadc2 = -999.0;
1703 m_quality2 = ( m_quality2 & 0x700 );
1704 if( m_hitCase == OuterLayer ) { m_hitCase = NoHit; }
1705 else if( m_hitCase == DoubleLayer ) { m_hitCase = InnerLayer; }
1706 }
1707 else {
1708 cout << "TofRec::TofTrack::getTofData: Flag which sign the Barrel/Endcap or Inner/Outer is wrong! Please check it!" << endl;
1709 }
1710
1711 return;
1712}
1713
1714
1715//------- getTofData -----------------------------------------
1716// set Tof Data of MRPC Endcap TOF
1717//
1718void TofTrack::getEtfData( TofData* tof, unsigned int iflag, unsigned int qual ) {
1719
1720 if( iflag == 1 && tof->tofId() != m_id2 ) {
1721 m_tofId1 = tof->tofId();
1722 m_strip1 = tof->strip();
1723 m_qch1 = tof->adcChannelEast();
1724 m_adc1 = tof->adc1();
1725 m_tdc1 = tof->tdc1();
1726 m_qch2 = tof->adcChannelWest();
1727 m_adc2 = tof->adc2();
1728 m_tdc2 = tof->tdc2();
1729 m_ztdc1 = tof->ztdc();
1730 m_zadc1 = tof->zadc();
1731 m_quality1 = ( m_quality1 | ( 0x1f & tof->quality() ) );
1732 if( ( ( tof->quality() & 0x5 ) != 0x5 ) || ( ( ( tof->quality() & 0x5 ) == 0x5 ) && ( abs( tof->ztdc() - m_zrhit1 ) > ztdc_Cut ) ) ) {
1733 m_quality1 = ( m_quality1 | 0x100 );
1734 }
1735 if( ( ( tof->quality() & 0xa ) != 0xa ) || ( ( ( tof->quality() & 0xa ) == 0xa ) && ( abs( tof->zadc() - m_zrhit1 ) > zadc_Cut ) ) ) {
1736 m_quality1 = ( m_quality1 | 0x200 );
1737 }
1738 m_quality1 = ( m_quality1 | ( qual << 12 ) );
1739 tof->setUsed();
1740 }
1741 else if( iflag == 2 && tof->tofId() != m_id1 ) {
1742 m_tofId2 = tof->tofId();
1743 m_strip2 = tof->strip();
1744 m_qch3 = tof->adcChannelEast();
1745 m_adc3 = tof->adc1();
1746 m_tdc3 = tof->tdc1();
1747 m_qch4 = tof->adcChannelWest();
1748 m_adc4 = tof->adc2();
1749 m_tdc4 = tof->tdc2();
1750 m_ztdc2 = tof->ztdc();
1751 m_zadc2 = tof->zadc();
1752 m_quality2 = ( m_quality2 | ( 0x1f & tof->quality() ) );
1753 if( ( ( tof->quality() & 0x5 ) != 0x5 ) || ( ( ( tof->quality() & 0x5 ) == 0x5 ) && ( abs( tof->ztdc() - m_zrhit2 ) > ztdc_Cut ) ) ) {
1754 m_quality2 = ( m_quality2 | 0x100 );
1755 }
1756 if( ( ( tof->quality() & 0xa ) != 0xa ) || ( ( ( tof->quality() & 0xa ) == 0xa ) && ( abs( tof->zadc() - m_zrhit2 ) > zadc_Cut ) ) ) {
1757 m_quality2 = ( m_quality2 | 0x200 );
1758 }
1759 m_quality2 = ( m_quality2 | ( qual << 12 ) );
1760 tof->setUsed();
1761 }
1762
1763 return;
1764}
1765
1766
1767//------- setCalibration() ----------------------------------------
1768// get calibration constants
1769// ph11() - ph22(), tof11() -- tof22()
1770// ph1() ph2() ph(), tof1() tof2() tof()
1771//
1773
1774 bool barrel = ( ( m_hitCase == InnerLayer ) || ( m_hitCase == OuterLayer ) || ( m_hitCase == DoubleLayer ) );
1775 bool endcap = ( ( m_hitCase == EastEndcap ) || ( m_hitCase == WestEndcap ) );
1776 bool endcapMRPC = ( ( m_hitCase == EastEndcapMRPC ) || ( m_hitCase == WestEndcapMRPC ) );
1777
1778 bool innerEast = ( ( m_quality1 & 0xc ) == 0xc );
1779 bool innerWest = ( ( m_quality1 & 0x3 ) == 0x3 );
1780 bool outerEast = ( ( m_quality2 & 0xc ) == 0xc );
1781 bool outerWest = ( ( m_quality2 & 0x3 ) == 0x3 );
1782 bool innerLayer = ( ( m_quality1 & 0xf ) == 0xf );
1783 bool outerLayer = ( ( m_quality2 & 0xf ) == 0xf );
1784
1785 bool endcapData = ( ( m_quality1 & 0xc ) == 0xc );
1786
1787 if( m_hitCase == DoubleLayer ) {
1788 for( unsigned int i=0; i<5; i++ ) {
1789 m_texp[i] = tofCaliSvc->BTimeCluster( m_texpInner[i], m_texpOuter[i], m_zr1[i], m_zr2[i], m_tofId1, m_tofId2 );
1790 }
1791 m_path = tofCaliSvc->BTimeCluster( m_path1, m_path2, m_zrhit1, m_zrhit2, m_tofId1, m_tofId2 );
1792 }
1793
1794 if( barrel ) {
1795 if( innerEast ) {
1796 for( unsigned int i=0; i<5; i++ ) {
1797 m_tof11[i] = tofCaliSvc->BTime1( m_adc1, m_tdc1-m_estime, m_zr1[i], m_tofId1, m_estime );
1798 }
1799 m_sigma11 = tofCaliSvc->BSigma1( m_zrhit1, m_tofId1 );
1800 m_ph11 = m_adc1;
1801 }
1802
1803 if( innerWest ) {
1804 for( unsigned int i=0; i<5; i++ ) {
1805 m_tof12[i] = tofCaliSvc->BTime2( m_adc2, m_tdc2-m_estime, m_zr1[i], m_tofId1, m_estime );
1806 }
1807 m_sigma12 = tofCaliSvc->BSigma2( m_zrhit1, m_tofId1 );
1808 m_ph12 = m_adc2;
1809 }
1810
1811 if( innerLayer ) {
1812 for( unsigned int i=0; i<5; i++ ) {
1813 m_tof1[i] = tofCaliSvc->BTimeCounter( m_tof11[i], m_tof12[i], m_zr1[i], m_tofId1 );
1814 }
1815 m_sigma1 = tofCaliSvc->BSigmaCounter( m_zrhit1, m_tofId1 );
1816 m_ph1 = tofCaliSvc->BPulseHeight( m_adc1, m_adc2, m_zrhit1, m_theta1, m_tofId1 );
1817 }
1818
1819 if( outerEast ) {
1820 for( unsigned int i=0; i<5; i++ ) {
1821 m_tof21[i] = tofCaliSvc->BTime1( m_adc3, m_tdc3-m_estime, m_zr2[i], m_tofId2, m_estime );
1822 }
1823 m_sigma21 = tofCaliSvc->BSigma1( m_zrhit2, m_tofId2 );
1824 m_ph21 = m_adc3;
1825 }
1826
1827 if( outerWest ) {
1828 for( unsigned int i=0; i<5; i++ ) {
1829 m_tof22[i] = tofCaliSvc->BTime2( m_adc4, m_tdc4-m_estime, m_zr2[i], m_tofId2, m_estime );
1830 }
1831 m_sigma22 = tofCaliSvc->BSigma2( m_zrhit2, m_tofId2 );
1832 m_ph22 = m_adc4;
1833 }
1834
1835 if( outerLayer ) {
1836 for( unsigned int i=0; i<5; i++ ) {
1837 m_tof2[i] = tofCaliSvc->BTimeCounter( m_tof21[i], m_tof22[i], m_zr2[i], m_tofId2 );
1838 }
1839 m_sigma2 = tofCaliSvc->BSigmaCounter( m_zrhit2, m_tofId2 );
1840 m_ph2 = tofCaliSvc->BPulseHeight( m_adc3, m_adc4, m_zrhit2, m_theta2, m_tofId2 );
1841 }
1842
1843 if( innerLayer && outerLayer ) {
1844 for( unsigned int i=0; i<5; i++ ) {
1845 m_tof[i] = tofCaliSvc->BTimeCluster( m_tof1[i], m_tof2[i], m_zr1[i], m_zr2[i], m_tofId1, m_tofId2 );
1846 }
1847 m_sigma = tofCaliSvc->BSigmaCluster( m_zrhit1, m_zrhit2, m_tofId1, m_tofId2 );
1848 m_ph = tofCaliSvc->BTimeCluster( m_ph1, m_ph2, m_zrhit1, m_zrhit2, m_tofId1, m_tofId2 );
1849 }
1850 }
1851
1852 if( endcap ) {
1853 if( endcapData ) {
1854 for( unsigned int i=0; i<5; i++ ) {
1855 m_tof11[i] = tofCaliSvc->ETime( m_adc1, m_tdc1-m_estime, m_zr1[i], m_tofId1 );
1856 }
1857 m_sigma11 = tofCaliSvc->ESigma( m_zrhit1, m_tofId1 );
1858 m_ph11 = tofCaliSvc->EPulseHeight( m_adc1, m_zrhit1, m_theta1, m_tofId1 );
1859 m_quality = 1;
1860 if( (m_quality1&0xa000)!=0 ) { m_quality = 4; }
1861 }
1862 }
1863
1864 if( endcapMRPC ) {
1865 if( innerEast ) {
1866 if( m_tofId1>-1 ) {
1867 for( unsigned int i=0; i<5; i++ ) {
1868 if( m_run > 0 ) {
1869 m_tof11[i] = tofCaliSvc->EtfTime1( m_adc1, m_tdc1-m_estime, m_zr1[i], m_tofId1, m_strip1, m_estime );
1870 }
1871 else {
1872 m_tof11[i] = tofCaliSvc->EtfTimeMC1( m_adc1, m_tdc1-m_estime, m_zr1[i], m_tofId1, m_strip1, m_estime );
1873 }
1874 }
1875 m_ph11 = m_adc1;
1876 }
1877 }
1878 if( innerWest ) {
1879 if( m_tofId1>-1 ) {
1880 for( unsigned int i=0; i<5; i++ ) {
1881 if( m_run > 0 ) {
1882 m_tof12[i] = tofCaliSvc->EtfTime2( m_adc2, m_tdc2-m_estime, m_zr1[i], m_tofId1, m_strip1, m_estime );
1883 }
1884 else {
1885 m_tof12[i] = tofCaliSvc->EtfTimeMC2( m_adc2, m_tdc2-m_estime, m_zr1[i], m_tofId1, m_strip1, m_estime );
1886 }
1887 }
1888 m_ph12 = m_adc2;
1889 }
1890 }
1891 if( outerEast ) {
1892 if( m_tofId2>-1 ) {
1893 for( unsigned int i=0; i<5; i++ ) {
1894 if( m_run > 0 ) {
1895 m_tof21[i] = tofCaliSvc->EtfTime1( m_adc3, m_tdc3-m_estime, m_zr2[i], m_tofId2, m_strip2, m_estime );
1896 }
1897 else {
1898 m_tof21[i] = tofCaliSvc->EtfTimeMC1( m_adc3, m_tdc3-m_estime, m_zr2[i], m_tofId2, m_strip2, m_estime );
1899 }
1900 }
1901 m_ph21 = m_adc3;
1902 }
1903 }
1904 if( outerWest ) {
1905 if( m_tofId2>-1 ) {
1906 for( unsigned int i=0; i<5; i++ ) {
1907 if( m_run > 0 ) {
1908 m_tof22[i] = tofCaliSvc->EtfTime2( m_adc4, m_tdc4-m_estime, m_zr2[i], m_tofId2, m_strip2, m_estime );
1909 }
1910 else {
1911 m_tof22[i] = tofCaliSvc->EtfTimeMC2( m_adc4, m_tdc4-m_estime, m_zr2[i], m_tofId2, m_strip2, m_estime );
1912 }
1913 }
1914 m_ph22 = m_adc4;
1915 }
1916 }
1917 if( innerLayer ) {
1918 if( m_tofId1>-1 ) {
1919 if( m_run > 0 ) {
1920 m_tof1[0] = tofCaliSvc->EtfTime( m_adc1, m_adc2, m_tdc1-m_estime, m_tdc2-m_estime, m_tofId1, m_strip1, m_estime );
1921 }
1922 else {
1923 m_tof1[0] = tofCaliSvc->EtfTimeMC( m_adc1, m_adc2, m_tdc1-m_estime, m_tdc2-m_estime, m_tofId1, m_strip1, m_estime );
1924 }
1925 for( unsigned int i=1; i<5; i++ ) {
1926 m_tof1[i] = m_tof1[0];
1927 }
1928 m_ph1 = ( m_adc1 + m_adc2 )/2.0;
1929 }
1930 }
1931 if( outerLayer ) {
1932 if( m_tofId2>-1 ) {
1933 if( m_run > 0 ) {
1934 m_tof2[0] = tofCaliSvc->EtfTime( m_adc3, m_adc4, m_tdc3-m_estime, m_tdc4-m_estime, m_tofId2, m_strip2, m_estime );
1935 }
1936 else {
1937 m_tof2[0] = tofCaliSvc->EtfTimeMC( m_adc3, m_adc4, m_tdc3-m_estime, m_tdc4-m_estime, m_tofId2, m_strip2, m_estime );
1938 }
1939 for( unsigned int i=1; i<5; i++ ) {
1940 m_tof2[i] = m_tof2[0];
1941 }
1942 m_ph2 = ( m_adc3 + m_adc4 )/2.0;
1943 }
1944 }
1945 }
1946
1947 // set Quality of Barrel TOF
1948 if( barrel ) {
1949
1950 // double layer
1951 if( innerLayer && outerLayer ) {
1952 m_quality = 1;
1953 }
1954 else {
1955 // single layer
1956 if( innerLayer || outerLayer ) {
1957 m_quality = 2;
1958 }
1959 else {
1960 // single-end of one layer
1961 if( innerEast || innerWest || outerEast || outerWest ) {
1962 m_quality = 3;
1963 }
1964 }
1965 }
1966
1967 // multi-hit
1968 if( ( (m_quality1&0xa000)!=0 ) || ( (m_quality2&0xa000)!=0 ) ) {
1969 m_quality = m_quality + 3;
1970 }
1971
1972 // ztdc and extrapolated zhit is not matched
1973 if( ( (m_quality1&0x100)==0x100 ) || ( (m_quality2&0x100)==0x100 ) ) {
1974 if( ( m_quality == 1 ) || ( m_quality == 4 ) ) { m_quality = 7; }
1975 else if( ( m_quality == 2 ) || ( m_quality == 5 ) ) { m_quality = 8; }
1976 else if( ( m_quality == 3 ) || ( m_quality == 6 ) ) { m_quality = 9; }
1977 else {
1978 cout << "TofRec::TofTrack::setCalibration: Impossible!" << endl;
1979 }
1980 }
1981
1982 }
1983
1984 return;
1985}
1986
1987
1988//------- convert2RecTofTrackCol() -----------------------------------
1989// generate RecTofTrackCol
1990//
1992
1993 bool barrel = ( ( m_hitCase == InnerLayer ) || ( m_hitCase == OuterLayer ) || ( m_hitCase == DoubleLayer ) );
1994
1995 bool innerEast = ( ( m_quality1 & 0xc ) == 0xc );
1996 bool innerWest = ( ( m_quality1 & 0x3 ) == 0x3 );
1997 bool outerEast = ( ( m_quality2 & 0xc ) == 0xc );
1998 bool outerWest = ( ( m_quality2 & 0x3 ) == 0x3 );
1999
2000 if( barrel ) {
2001
2002 if( innerEast ) {
2003 RecTofTrack* atrack11 = new RecTofTrack;
2004 buildRecTofTrack( atrack11, 11 ); // innerlayer east readout
2005 TofHitStatus* hitStatus11 = new TofHitStatus;
2006 if( innerWest ) {
2007 hitStatus11->setBarrelReadout( 1, true ); // innerlayer east readout
2008 }
2009 else {
2010 if( m_hitCase == InnerLayer ) {
2011 hitStatus11->setBarrelCluster( 11 ); // innerlayer east cluster
2012 }
2013 else if( m_hitCase == DoubleLayer ) {
2014 if( outerEast && outerWest ) {
2015 hitStatus11->setBarrelCounter( 11 ); // innerlayer east counter
2016 }
2017 else {
2018 hitStatus11->setBarrelCluster( 11 ); // innerlayer east cluster
2019 }
2020 }
2021 else {
2022 cout << "TofRec::TofTrack:convert2RecTofTrackCol: 11- Impossible!" << endl;
2023 }
2024 }
2025 atrack11->setStatus( hitStatus11->value() );
2026 delete hitStatus11;
2027 recTofTrackCol->push_back( atrack11 );
2028 }
2029
2030 if( innerWest ) {
2031 RecTofTrack* atrack12 = new RecTofTrack;
2032 buildRecTofTrack( atrack12, 12 ); // innerlayer west readout
2033 TofHitStatus* hitStatus12 = new TofHitStatus;
2034 if( innerEast ) {
2035 hitStatus12->setBarrelReadout( 1, false ); // innerlayer west
2036 }
2037 else {
2038 if( m_hitCase == InnerLayer ) {
2039 hitStatus12->setBarrelCluster( 12 ); // innerlayer west cluster
2040 }
2041 else if( m_hitCase == DoubleLayer ) {
2042 if( outerEast && outerWest ) {
2043 hitStatus12->setBarrelCounter( 12 ); // innerlayer west counter
2044 }
2045 else {
2046 hitStatus12->setBarrelCluster( 12 ); // innerlayer west cluster
2047 }
2048 }
2049 else {
2050 cout << "TofRec::TofTrack:convert2RecTofTrackCol: 12- Impossible!" << endl;
2051 }
2052 }
2053 atrack12->setStatus( hitStatus12->value() );
2054 delete hitStatus12;
2055 recTofTrackCol->push_back( atrack12 );
2056 }
2057
2058 if( innerEast && innerWest ) {
2059 RecTofTrack* atrack1 = new RecTofTrack;
2060 buildRecTofTrack( atrack1, 1 ); // innerlayer counter
2061 TofHitStatus* hitStatus1 = new TofHitStatus;
2062 if( m_hitCase == InnerLayer ) {
2063 hitStatus1->setBarrelCluster( 1 ); // innerlayer cluster and counter
2064 }
2065 else if( m_hitCase == DoubleLayer ) {
2066 if( outerEast && outerWest ) {
2067 hitStatus1->setBarrelCounter( 1 ); // innerlayer counter
2068 }
2069 else {
2070 hitStatus1->setBarrelCluster( 1 ); // innerlayer cluster and counter
2071 }
2072 }
2073 else {
2074 cout << "TofRec::TofTrack:convert2RecTofTrackCol: 1- Impossible!" << endl;
2075 }
2076 atrack1->setStatus( hitStatus1->value() );
2077 delete hitStatus1;
2078 recTofTrackCol->push_back( atrack1 );
2079 }
2080
2081 if( outerEast ) {
2082 RecTofTrack* atrack21 = new RecTofTrack;
2083 buildRecTofTrack( atrack21, 21 ); // outerlayer east readout
2084 TofHitStatus* hitStatus21 = new TofHitStatus;
2085 if( outerWest ) {
2086 hitStatus21->setBarrelReadout( 2, true ); // outerlayer east readout
2087 }
2088 else {
2089 if( m_hitCase == OuterLayer ) {
2090 hitStatus21->setBarrelCluster( 21 ); // outerlayer east cluster
2091 }
2092 else if( m_hitCase == DoubleLayer ) {
2093 if( innerEast || innerWest ) {
2094 hitStatus21->setBarrelCounter( 21 ); // outerlayer east counter
2095 }
2096 // else {
2097 // hitStatus21->setBarrelCluster( 21 ); // outerlayer east cluster
2098 // }
2099 }
2100 else {
2101 cout << "TofRec::TofTrack:convert2RecTofTrackCol: 21- Impossible!" << endl;
2102 }
2103 }
2104 atrack21->setStatus( hitStatus21->value() );
2105 delete hitStatus21;
2106 recTofTrackCol->push_back( atrack21 );
2107 }
2108
2109 if( outerWest ) {
2110 RecTofTrack* atrack22 = new RecTofTrack;
2111 buildRecTofTrack( atrack22, 22 ); // outerlayer west readout
2112 TofHitStatus* hitStatus22 = new TofHitStatus;
2113 if( outerEast ) {
2114 hitStatus22->setBarrelReadout( 2, false ); // outerlayer west readout
2115 }
2116 else {
2117 if( m_hitCase == OuterLayer ) {
2118 hitStatus22->setBarrelCluster( 22 ); // outerlayer west cluster
2119 }
2120 else if( m_hitCase == DoubleLayer ) {
2121 if( innerEast || innerWest ) {
2122 hitStatus22->setBarrelCounter( 22 ); // outerlayer west counter
2123 }
2124 // else {
2125 // hitStatus22->setBarrelCluster( 22 ); // outerlayer west cluster
2126 // }
2127 }
2128 else {
2129 cout << "TofRec::TofTrack:convert2RecTofTrackCol: 22- Impossible!" << endl;
2130 }
2131 }
2132 atrack22->setStatus( hitStatus22->value() );
2133 delete hitStatus22;
2134 recTofTrackCol->push_back( atrack22 );
2135 }
2136
2137 if( outerEast && outerWest ) {
2138 RecTofTrack* atrack2 = new RecTofTrack;
2139 buildRecTofTrack( atrack2, 2 ); // outerlayer counter
2140 TofHitStatus* hitStatus2 = new TofHitStatus;
2141 if( m_hitCase == OuterLayer ) {
2142 hitStatus2->setBarrelCluster( 2 ); // outerlayer cluster and counter
2143 }
2144 else if( m_hitCase == DoubleLayer ) {
2145 if( innerEast && innerWest ) {
2146 hitStatus2->setBarrelCounter( 2 ); // outerlayer counter
2147 }
2148 else {
2149 hitStatus2->setBarrelCluster( 2 ); // outerlayer cluster and counter
2150 }
2151 }
2152 else {
2153 cout << "TofRec::TofTrack:convert2RecTofTrackCol: 2- Impossible!" << endl;
2154 }
2155 atrack2->setStatus( hitStatus2->value() );
2156 delete hitStatus2;
2157 recTofTrackCol->push_back( atrack2 );
2158 }
2159
2160 if( innerEast && innerWest && outerEast && outerWest ) {
2161 RecTofTrack* atrack = new RecTofTrack;
2162 buildRecTofTrack( atrack, 0 ); // doublelayer cluster
2163 TofHitStatus* hitStatus = new TofHitStatus;
2164 hitStatus->setBarrelCluster( 3 ); // doublelayer cluster
2165 atrack->setStatus( hitStatus->value() );
2166 delete hitStatus;
2167 recTofTrackCol->push_back( atrack );
2168 }
2169
2170 }
2171
2172 if( ( m_hitCase == EastEndcap ) || ( m_hitCase == WestEndcap ) ) {
2173 RecTofTrack* atrack = new RecTofTrack;
2174 buildRecTofTrack( atrack, 11 ); // eastendcap counter
2175 TofHitStatus* hitStatus = new TofHitStatus;
2176 if( m_hitCase == EastEndcap ) {
2177 hitStatus->setEndcapCluster( true ); // east endcap cluster counter readout
2178 }
2179 else if( m_hitCase == WestEndcap ) {
2180 hitStatus->setEndcapCluster( false ); // west endcap cluster counter readout
2181 }
2182 else {
2183 cout << "TofRec::TofTrack:convert2RecTofTrackCol: endcap- Impossible!" << endl;
2184 }
2185 atrack->setStatus( hitStatus->value() );
2186 delete hitStatus;
2187 recTofTrackCol->push_back( atrack );
2188 }
2189
2190 if( ( m_hitCase == EastEndcapMRPC ) || ( m_hitCase == WestEndcapMRPC ) ) {
2191
2192 if( innerEast || innerWest ) {
2193
2194 if( innerEast ) {
2195 RecTofTrack* atrack1 = new RecTofTrack;
2196 buildRecTofTrack( atrack1, 11 ); // mrpc east readout
2197 TofHitStatus* hitStatus1 = new TofHitStatus;
2198 if( innerWest ) {
2199 hitStatus1->setMRPCReadout( true ); // mrpc east readout
2200 }
2201 else {
2202 hitStatus1->setMRPCCluster( false, true ); // mrpc east cluster
2203 }
2204 atrack1->setStatus( hitStatus1->value() );
2205 delete hitStatus1;
2206 recTofTrackCol->push_back( atrack1 );
2207 }
2208
2209 if( innerWest ) {
2210 RecTofTrack* atrack2 = new RecTofTrack;
2211 buildRecTofTrack( atrack2, 12 ); // mrpc west readout
2212 TofHitStatus* hitStatus2 = new TofHitStatus;
2213 if( innerEast ) {
2214 hitStatus2->setMRPCReadout( false ); // mrpc west readout
2215 }
2216 else {
2217 hitStatus2->setMRPCCluster( false, false ); // mrpc east cluster
2218 }
2219 atrack2->setStatus( hitStatus2->value() );
2220 delete hitStatus2;
2221 recTofTrackCol->push_back( atrack2 );
2222 }
2223
2224 if( innerEast && innerWest ) {
2225 RecTofTrack* atrack = new RecTofTrack;
2226 buildRecTofTrack( atrack, 1 ); // mrpc east readout
2227 TofHitStatus* hitStatus = new TofHitStatus;
2228 if( m_hitCase == EastEndcapMRPC ) {
2229 hitStatus->setMRPCCluster( true, true ); // mrpc east cluster
2230 }
2231 else {
2232 hitStatus->setMRPCCluster( true, false );// mrpc west cluster
2233 }
2234 atrack->setStatus( hitStatus->value() );
2235 delete hitStatus;
2236 recTofTrackCol->push_back( atrack );
2237 }
2238
2239 }
2240 else {
2241
2242 if( outerEast ) {
2243 RecTofTrack* atrack1 = new RecTofTrack;
2244 buildRecTofTrack( atrack1, 21 ); // mrpc east readout
2245 TofHitStatus* hitStatus1 = new TofHitStatus;
2246 if( outerWest ) {
2247 hitStatus1->setMRPCReadout( true ); // mrpc east readout
2248 }
2249 else {
2250 hitStatus1->setMRPCCluster( false, true ); // mrpc east cluster
2251 }
2252 atrack1->setStatus( hitStatus1->value() );
2253 delete hitStatus1;
2254 recTofTrackCol->push_back( atrack1 );
2255 }
2256
2257 if( outerWest ) {
2258 RecTofTrack* atrack2 = new RecTofTrack;
2259 buildRecTofTrack( atrack2, 22 ); // mrpc west readout
2260 TofHitStatus* hitStatus2 = new TofHitStatus;
2261 if( outerEast ) {
2262 hitStatus2->setMRPCReadout( false ); // mrpc west readout
2263 }
2264 else {
2265 hitStatus2->setMRPCCluster( false, false ); // mrpc east cluster
2266 }
2267 atrack2->setStatus( hitStatus2->value() );
2268 delete hitStatus2;
2269 recTofTrackCol->push_back( atrack2 );
2270 }
2271
2272 if( outerEast && outerWest ) {
2273 RecTofTrack* atrack = new RecTofTrack;
2274 buildRecTofTrack( atrack, 2 ); // mrpc east readout
2275 TofHitStatus* hitStatus = new TofHitStatus;
2276 if( m_hitCase == EastEndcapMRPC ) {
2277 hitStatus->setMRPCCluster( true, true ); // mrpc east cluster
2278 }
2279 else {
2280 hitStatus->setMRPCCluster( true, false );// mrpc west cluster
2281 }
2282 atrack->setStatus( hitStatus->value() );
2283 delete hitStatus;
2284 recTofTrackCol->push_back( atrack );
2285 }
2286
2287 }
2288
2289 }
2290
2291 if( m_hitCase == NoHit ) {
2292 RecTofTrack* atrack = new RecTofTrack;
2293 buildRecTofTrack( atrack, 3 ); // no hit
2294 TofHitStatus* hitStatus = new TofHitStatus;
2295 hitStatus->setNoHit(); // no hit
2296 atrack->setStatus( hitStatus->value() );
2297 delete hitStatus;
2298 recTofTrackCol->push_back( atrack );
2299 }
2300
2301 return;
2302}
2303
2304
2305
2306void TofTrack::buildRecTofTrack( RecTofTrack* track, int layerorend ) {
2307
2308 track->setTofTrackID( m_tofTrackId );
2309 track->setTrackID( m_trackId );
2310
2311 track->setErrTof( 0.0 );
2312 track->setBeta( 0.0 );
2313
2314 double sigma[6];
2315 for( int i=0; i<6; i++ ) {
2316 sigma[i] = 0.0;
2317 }
2318 track->setSigma( sigma );
2319 track->setQuality( m_quality );
2320 track->setT0( m_estime );
2321 track->setErrT0( 0.0 );
2322 track->setPhi( 9999.0 );
2323 track->setErrPhi( 9999.0 );
2324 track->setEnergy( 9999.0 );
2325 track->setErrEnergy( 9999.0 );
2326
2327 if( ( layerorend == 11 ) || ( layerorend == 12 ) || ( layerorend == 1 ) ) {
2328 if( m_strip1<0 ) {
2329 track->setTofID( m_tofId1 ); // scintillator
2330 }
2331 else {
2332 track->setTofID( 12*m_tofId1+m_strip1 ); // MRPC
2333 }
2334 track->setPath( m_path1 );
2335 track->setZrHit( m_zrhit1 );
2336 track->setErrZ( m_errzr1 );
2337 track->setTexp( m_texpInner );
2338
2339 setRecTofTrack( track, layerorend );
2340 }
2341
2342 if( ( layerorend==21 ) || ( layerorend==22 ) || ( layerorend==2 ) ) {
2343 if( m_strip2<0 ) {
2344 track->setTofID( m_tofId2 ); // scintillator
2345 }
2346 else {
2347 track->setTofID( 12*m_tofId2+m_strip2 ); // MRPC
2348 }
2349 track->setPath( m_path2 );
2350 track->setZrHit( m_zrhit2 );
2351 track->setErrZ( m_errzr2 );
2352 track->setTexp( m_texpOuter );
2353
2354 setRecTofTrack( track, layerorend );
2355 }
2356
2357 if( layerorend==0 ) {
2358 track->setTofID( m_tofId1 );
2359 track->setPath( m_path2 );
2360 track->setZrHit( m_zrhit2 );
2361 track->setErrZ( m_errzr2 );
2362 track->setTexp( m_texp );
2363
2364 setRecTofTrack( track, layerorend );
2365 }
2366
2367 if( layerorend == 3 ) {
2368 if( m_strip1<0 ) {
2369 track->setTofID( m_id1 ); // scintillator
2370 }
2371 else {
2372 track->setTofID( 12*m_id1 + m_strip1 ); // mrpc
2373 }
2374 track->setPath( m_path1 );
2375 track->setZrHit( m_zrhit1 );
2376 track->setErrZ( m_errzr1 );
2377 track->setTexp( m_texpInner );
2378 }
2379
2380 return;
2381}
2382
2383
2384void TofTrack::setRecTofTrack( RecTofTrack* track, int layerorend ) {
2385
2386 double toffset[6];
2387 for( unsigned int i=0; i<6; i++ ) {
2388 toffset[i] = 0.0;
2389 }
2390
2391 if( layerorend == 0 ) { // cluster or double layer hit
2392 track->setPh( m_ph );
2393 track->setTof( m_tof[0] );
2394 track->setSigmaElectron( m_sigma );
2395 for( unsigned int i=0; i<5; i++ ) {
2396 toffset[i] = m_tof[0] - m_tof[i];
2397 }
2398 track->setToffset( toffset );
2399 track->setBeta( m_path/m_tof[0]/30.0 );
2400 }
2401 else if( layerorend == 1 ) { // inner layer
2402 track->setPh( m_ph1 );
2403 track->setTof( m_tof1[0] );
2404 track->setSigmaElectron( m_sigma1 );
2405 for( unsigned int i=0; i<5; i++ ) {
2406 toffset[i] = m_tof1[0] - m_tof1[i];
2407 }
2408 track->setToffset( toffset );
2409 track->setBeta( m_path1/m_tof1[0]/30.0 );
2410 }
2411 else if( layerorend == 2 ) { // outer layer
2412 track->setPh( m_ph2 );
2413 track->setTof( m_tof2[0] );
2414 track->setSigmaElectron( m_sigma2 );
2415 for( unsigned int i=0; i<5; i++ ) {
2416 toffset[i] = m_tof2[0] - m_tof2[i];
2417 }
2418 track->setToffset( toffset );
2419 track->setBeta( m_path2/m_tof2[0]/30.0 );
2420 }
2421 else if( layerorend == 11 ) { // inner layer east end readout
2422 track->setPh( m_ph11 );
2423 track->setTof( m_tof11[0] );
2424 track->setSigmaElectron( m_sigma11 );
2425 for( unsigned int i=0; i<5; i++ ) {
2426 toffset[i] = m_tof11[0] - m_tof11[i];
2427 }
2428 track->setToffset( toffset );
2429 track->setBeta( m_path1/m_tof11[0]/30.0 );
2430 }
2431 else if( layerorend == 12 ) { // inner layer west end readout
2432 track->setPh( m_ph12 );
2433 track->setTof( m_tof12[0] );
2434 track->setSigmaElectron( m_sigma12 );
2435 for( unsigned int i=0; i<5; i++ ) {
2436 toffset[i] = m_tof12[0] - m_tof12[i];
2437 }
2438 track->setToffset( toffset );
2439 track->setBeta( m_path1/m_tof12[0]/30.0 );
2440 }
2441 else if( layerorend == 21 ) { // outer layer east end readout
2442 track->setPh( m_ph21 );
2443 track->setTof( m_tof21[0] );
2444 track->setSigmaElectron( m_sigma21 );
2445 for( unsigned int i=0; i<5; i++ ) {
2446 toffset[i] = m_tof21[0] - m_tof21[i];
2447 }
2448 track->setToffset( toffset );
2449 track->setBeta( m_path2/m_tof21[0]/30.0 );
2450 }
2451 else if( layerorend == 22 ) { // outer layer west end readout
2452 track->setPh( m_ph22 );
2453 track->setTof( m_tof22[0] );
2454 track->setSigmaElectron( m_sigma22 );
2455 for( unsigned int i=0; i<5; i++ ) {
2456 toffset[i] = m_tof22[0] - m_tof22[i];
2457 }
2458 track->setToffset( toffset );
2459 track->setBeta( m_path2/m_tof22[0]/30.0 );
2460 }
2461 else{
2462 cout << "TofRec TofTrack::SetRecTofTrack layerorend = " << layerorend << endl;
2463 }
2464 return;
2465}
2466
2467
2468void TofTrack::convert2RecBTofCalHitColBarrel( int runNumber, int eventNumber, RecBTofCalHitCol* btofCalHitCol, std::string calibData ) {
2469
2470 if( ( m_quality1 & 0x800 ) == 0x800 ) {
2471
2472 RecBTofCalHit* ahit = new RecBTofCalHit;
2473 ahit->setRun( runNumber );
2474 ahit->setEvent( eventNumber );
2475 ahit->setMod( m_tofId1 );
2476 ahit->setQual( m_hitCase );
2477 ahit->setdZHit( 1 );
2478
2479 for( int i=0; i<5; i++ ) {
2480 ahit->setTpred( i, m_texpInner[i] );
2481 }
2482 if( calibData == "Dimu" ) {
2483 ahit->setTpred( m_texpInner[1] );
2484 ahit->setZHit( m_zr1[1] );
2485 // ahit->setdZHit( m_ezr1[1] );
2486 }
2487 else {
2488 ahit->setTpred( m_texpInner[0] );
2489 ahit->setZHit( m_zr1[0] );
2490 // ahit->setdZHit( m_ezr1[0] );
2491 }
2492
2493 ahit->setTdc1( m_tdc1-m_estime );
2494 ahit->setTdc2( m_tdc2-m_estime );
2495 ahit->setAdc1( m_adc1 );
2496 ahit->setAdc2( m_adc2 );
2497 // ahit->setZHit( m_zrhit1 );
2498 // ahit->setdZHit( m_errzr1 );
2499 ahit->setDeltaPhi( m_estime );
2500 ahit->setsinTheta( m_theta1 );
2501 ahit->setP( m_momentum );
2502 ahit->setQ( m_ph1 );
2503 ahit->setPath( m_path1 );
2504
2505 btofCalHitCol->push_back( ahit );
2506
2507 if( ( m_quality2 & 0x800 ) == 0x800 ) {
2508
2509 RecBTofCalHit* bhit = new RecBTofCalHit;
2510 bhit->setRun( runNumber );
2511 bhit->setEvent( eventNumber );
2512 bhit->setMod( m_tofId2 );
2513 bhit->setQual( m_hitCase );
2514 bhit->setdZHit( 1 );
2515
2516 for( int i=0; i<5; i++ ) {
2517 bhit->setTpred( i, m_texpOuter[i] );
2518 }
2519 if( calibData == "Dimu" ) {
2520 bhit->setTpred( m_texpOuter[1] );
2521 bhit->setZHit( m_zr2[1] );
2522 // bhit->setdZHit( m_ezr2[1] );
2523 }
2524 else {
2525 bhit->setTpred( m_texpOuter[0] );
2526 bhit->setZHit( m_zr2[0] );
2527 // bhit->setdZHit( m_ezr2[0] );
2528 }
2529
2530 bhit->setTdc1( m_tdc3-m_estime );
2531 bhit->setTdc2( m_tdc4-m_estime );
2532 bhit->setAdc1( m_adc3 );
2533 bhit->setAdc2( m_adc4 );
2534 // bhit->setZHit( m_zrhit2 );
2535 // bhit->setdZHit( m_errzr2 );
2536 bhit->setDeltaPhi( m_estime );
2537 bhit->setsinTheta( m_theta2 );
2538 bhit->setP( m_momentum );
2539 bhit->setQ( m_ph2 );
2540 bhit->setPath( m_path2 );
2541
2542 ahit->setnext(bhit);
2543
2544 btofCalHitCol->push_back( bhit );
2545
2546 }
2547 }
2548
2549 return;
2550}
2551
2552
2553void TofTrack::convert2RecETofCalHitCol( int runNumber, int eventNumber, RecETofCalHitCol* etofCalHitCol, std::string calibData ) {
2554
2555 if( ( m_quality1 & 0x800 ) != 0x800 ) return;
2556
2557 RecETofCalHit* chit = new RecETofCalHit;
2558 chit->setRun( runNumber );
2559 chit->setEvent( eventNumber );
2560 chit->setMod( m_tofId1 );
2561 chit->setQual( m_hitCase );
2562
2563 for( int i=0; i<5; i++ ) {
2564 chit->setTpred( i, m_texpInner[i] );
2565 }
2566 if( calibData == "Dimu" ) {
2567 chit->setTpred( m_texpInner[1] );
2568 chit->setRHit( m_zr1[1] );
2569 chit->setdRHit( m_ezr1[1] );
2570 }
2571 else {
2572 chit->setTpred( m_texpInner[0] );
2573 chit->setRHit( m_zr1[0] );
2574 chit->setdRHit( m_ezr1[0] );
2575 }
2576
2577 chit->setTdc( m_tdc1-m_estime );
2578 chit->setAdc( m_adc1 );
2579 // chit->setRHit( m_zrhit1 );
2580 // chit->setdRHit( m_errzr1 );
2581 chit->setDeltaPhi( m_estime );
2582 chit->setcosTheta( m_theta1 );
2583 chit->setQ( m_ph1 );
2584 chit->setP( m_momentum );
2585 chit->setPath( m_path1 );
2586
2587 etofCalHitCol->push_back( chit );
2588
2589 return;
2590}
2591
2592
2593void TofTrack::convert2RecBTofCalHitColETF( int runNumber, int eventNumber, RecBTofCalHitCol* btofCalHitCol, std::string calibData ) {
2594
2595 if( ( m_quality1 & 0x800 ) == 0x800 ) {
2596
2597 RecBTofCalHit* ahit = new RecBTofCalHit;
2598 ahit->setRun( runNumber );
2599 ahit->setEvent( eventNumber );
2600 ahit->setMod( m_tofId1 );
2601 ahit->setQual( m_hitCase );
2602 ahit->setdZHit( 0 );
2603
2604 for( int i=0; i<5; i++ ) {
2605 ahit->setTpred( i, m_texpInner[i] );
2606 }
2607 if( calibData == "Dimu" ) {
2608 ahit->setTpred( m_texpInner[1] );
2609 ahit->setZHit( m_zr1[1] );
2610 }
2611 else {
2612 ahit->setTpred( m_texpInner[0] );
2613 ahit->setZHit( m_zr1[0] );
2614 }
2615
2616 ahit->setTdc1( m_tdc1-m_estime );
2617 ahit->setTdc2( m_tdc2-m_estime );
2618 ahit->setAdc1( m_adc1 );
2619 ahit->setAdc2( m_adc2 );
2620 ahit->setDeltaPhi( m_estime );
2621 ahit->setsinTheta( m_strip1 );
2622 ahit->setP( m_momentum );
2623 ahit->setQ( m_ph1 );
2624 ahit->setPath( m_path1 );
2625
2626 btofCalHitCol->push_back( ahit );
2627 }
2628
2629 if( ( m_quality2 & 0x800 ) == 0x800 ) {
2630
2631 RecBTofCalHit* bhit = new RecBTofCalHit;
2632 bhit->setRun( runNumber );
2633 bhit->setEvent( eventNumber );
2634 bhit->setMod( m_tofId2 );
2635 bhit->setQual( m_hitCase );
2636 bhit->setdZHit( 0 );
2637
2638 for( int i=0; i<5; i++ ) {
2639 bhit->setTpred( i, m_texpOuter[i] );
2640 }
2641 if( calibData == "Dimu" ) {
2642 bhit->setTpred( m_texpOuter[1] );
2643 bhit->setZHit( m_zr2[1] );
2644 }
2645 else {
2646 bhit->setTpred( m_texpOuter[0] );
2647 bhit->setZHit( m_zr2[0] );
2648 }
2649
2650 bhit->setTdc1( m_tdc3-m_estime );
2651 bhit->setTdc2( m_tdc4-m_estime );
2652 bhit->setAdc1( m_adc3 );
2653 bhit->setAdc2( m_adc4 );
2654 bhit->setDeltaPhi( m_estime );
2655 bhit->setsinTheta( m_strip2 );
2656 bhit->setP( m_momentum );
2657 bhit->setQ( m_ph2 );
2658 bhit->setPath( m_path2 );
2659
2660 btofCalHitCol->push_back( bhit );
2661 }
2662
2663 return;
2664}
2665
2666
2667// set Quality using quality1 and quality2
2669
2670 return;
2671}
std::multimap< unsignedint, TofData * >::iterator IterTofDataMap
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
ObjectVector< RecBTofCalHit > RecBTofCalHitCol
ObjectVector< RecETofCalHit > RecETofCalHitCol
ObjectVector< RecTofTrack > RecTofTrackCol
ITofCaliSvc * tofCaliSvc
ITofCaliSvc * tofCaliSvc
void qualityAnalysis()
Definition: TofTrack.cxx:2668
virtual const double BSigmaCounter(double zHit, unsigned id)=0
virtual const double BSigma2(double zHit, unsigned id)=0
virtual const double BTimeCluster(double tlayer1, double tlayer2, double z1, double z2, unsigned id1, unsigned int id2)=0
virtual const double EPulseHeight(double ADC, double rHit, double cost, unsigned int id)=0
virtual const double BTime2(double ADC, double TDC, double zHit, unsigned id, double t0)=0
virtual const double BTime1(double ADC, double TDC, double zHit, unsigned id, double t0)=0
virtual const int QElec()=0
virtual const double EtfTime1(double ADC, double TDC, double zHit, unsigned id, unsigned strip, double t0)=0
virtual const double EtfTime2(double ADC, double TDC, double zHit, unsigned id, unsigned strip, double t0)=0
virtual const double BTimeCounter(double tleft, double tright, double z, unsigned id)=0
virtual const double ZTDC(double tleft, double tright, unsigned id)=0
virtual const double EtfTimeMC2(double ADC, double TDC, double zHit, unsigned id, unsigned strip, double t0)=0
virtual const double BSigmaCluster(double zHit1, double zHit2, unsigned id1, unsigned id2)=0
virtual const double EtfTime(double ADC1, double ADC2, double TDC1, double TDC2, unsigned int id, unsigned int strip, double t0)=0
virtual const double BPulseHeight(double ADC1, double ADC2, double zHit, double sint, unsigned int id)=0
virtual const double BSigma1(double zHit, unsigned id)=0
virtual const double ESigma(double rHit, unsigned id)=0
virtual const double EtfTimeMC(double ADC1, double ADC2, double TDC1, double TDC2, unsigned int id, unsigned int strip, double t0)=0
virtual const double ZADC(double qleft, double qright, unsigned id)=0
virtual const double EtfZTDC(double tleft, double tright, unsigned int id, unsigned int strip)=0
virtual const double EtfTimeMC1(double ADC, double TDC, double zHit, unsigned id, unsigned strip, double t0)=0
virtual const double ETime(double ADC, double TDC, double rHit, unsigned id)=0
void setMRPCReadout(bool east)
void setMRPCCluster(bool cluster, bool east)
void setBarrelReadout(unsigned int layer, bool east)
void setEndcapCluster(bool east)
void setBarrelCounter(unsigned int layer)
void setBarrelCluster(unsigned int layer)
static Identifier cell_id(int barrel_ec, int layer, int phi_module, int end)
For a single crystal.
Definition: TofID.cxx:143
static int end(const Identifier &id)
Definition: TofID.cxx:79
static bool is_mrpc(const Identifier &id)
Definition: TofID.cxx:113
static int phi_module(const Identifier &id)
Definition: TofID.cxx:73
static int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
Definition: TofID.cxx:61
static value_type getIntID(int barrel_ec, int layer, int phi_module, int end)
Definition: TofID.cxx:178
static int layer(const Identifier &id)
Definition: TofID.cxx:66
void setTofData(TofDataMap tofDataMap)
Definition: TofTrack.cxx:464
double tof2(unsigned int i) const
std::vector< TofData * > tofData1() const
TofData * chooseTofDataEndcap(std::vector< TofData * > tofDataVec, double zr1[5])
Definition: TofTrack.cxx:1265
double zr1(unsigned int i) const
int kal(unsigned int i) const
void getEtfData(TofData *tof, unsigned int iflag, unsigned int qual)
Definition: TofTrack.cxx:1718
double tof(unsigned int i) const
void convert2RecTofTrackCol(RecTofTrackCol *recTofTrackCol)
Definition: TofTrack.cxx:1991
void tofDataAnalysis(TofData *tof, unsigned int iflag)
Definition: TofTrack.cxx:744
void findEtfData(std::vector< TofData * > tofDataVec1, std::vector< TofData * > tofDataVec2, std::vector< TofData * > tofDataVec3, double zrhit, unsigned int iflag)
Definition: TofTrack.cxx:1321
void buildRecTofTrack(RecTofTrack *track, int layerorend)
Definition: TofTrack.cxx:2306
void getTofData(TofData *tof, unsigned int iflag)
Definition: TofTrack.cxx:1472
void match(bool forCalibration, std::vector< int > deadId, std::vector< TofTrack * > *&tofTrackVec)
Definition: TofTrack.cxx:800
void findTofDataEndcap(std::vector< TofData * > tofDataVec1, std::vector< TofData * > tofDataVec2, double zr1[5])
Definition: TofTrack.cxx:1184
TofData * chooseEtfData2(std::vector< TofData * > tofDataVec, double zrhit)
Definition: TofTrack.cxx:1439
double tof1(unsigned int i) const
void setCalibration()
Definition: TofTrack.cxx:1772
TofTrack(int run, int event)
Definition: TofTrack.cxx:10
void setRecTofTrack(RecTofTrack *track, int layerorend)
Definition: TofTrack.cxx:2384
void convert2RecBTofCalHitColBarrel(int runNumber, int eventNumber, RecBTofCalHitCol *btofCalHitCol, std::string calibData)
Definition: TofTrack.cxx:2468
void convert2RecETofCalHitCol(int runNumber, int eventNumber, RecETofCalHitCol *etofCalHitCol, std::string calibData)
Definition: TofTrack.cxx:2553
void convert2RecBTofCalHitColETF(int runNumber, int eventNumber, RecBTofCalHitCol *btofCalHitCol, std::string calibData)
Definition: TofTrack.cxx:2593
TofData * compareTofData(TofData *tofData1, TofData *tofData2, double zrhit)
Definition: TofTrack.cxx:1162
void getTofDataNohit(unsigned int iflag)
Definition: TofTrack.cxx:1676
TofData * chooseTofData(std::vector< TofData * > tofDataVec, double zrhit)
Definition: TofTrack.cxx:1105
void getTofDataWest(TofData *tof, unsigned int iflag)
Definition: TofTrack.cxx:1616
TofData * chooseEtfData1(std::vector< TofData * > tofDataVec, double zrhit)
Definition: TofTrack.cxx:1393
void getMultiHit(TofTrack *&)
Definition: TofTrack.cxx:404
TofData * compareTofDataEndcap(TofData *tofData1, TofData *tofData2)
Definition: TofTrack.cxx:1308
std::vector< TofData * > tofData2() const
void setExtTrack(RecExtTrack *extTrack, double costheta, double p[5], int kal[5], double t0, int t0Stat)
Definition: TofTrack.cxx:145
void getTofDataEast(TofData *tof, unsigned int iflag)
Definition: TofTrack.cxx:1556
void findTofDataBarrel(std::vector< TofData * > tofDataVec1, std::vector< TofData * > tofDataVec2, double zrhit, unsigned int iflag, std::vector< TofTrack * > *&tofTrackVec)
Definition: TofTrack.cxx:935