162 if ( iExist1 == -1 ) { iExist1 = 2; }
163 if ( iExist2 == -1 ) { iExist2 = 2; }
174 m_id1 =
tofId1 - 176 + 48;
177 if ( costheta > 0.0 )
186 m_id1 =
tofId1 - 176 - 48;
189 if ( costheta < 0.0 )
198 m_id1 =
tofId1 - 176 - 96;
199 m_istrip1 = m_id1 % 12;
203 if ( costheta > 0.0 )
216 if ( costheta < 0.0 )
243 m_id2 =
tofId2 - 176 - 96;
244 m_istrip2 = m_id2 % 12;
250 if ( costheta > 0.0 )
263 if ( costheta < 0.0 )
277 m_trackId = extTrack->
trackId();
289 m_path1 = extTrack->
tof1Path( iExist1 );
292 for (
unsigned int i = 0; i < 5; i++ )
294 m_texpInner[i] = extTrack->
tof1( i );
295 if ( fabs( m_texpInner[i] + 99.0 ) < 1.0e-6 )
298 p[iExist1] / sqrt(
p[iExist1] *
p[iExist1] +
mass[iExist1] *
mass[iExist1] );
299 double betaNew =
p[i] / sqrt(
p[i] *
p[i] +
mass[i] *
mass[i] );
300 m_texpInner[i] = beta * extTrack->
tof1( iExist1 ) / betaNew;
309 for (
unsigned int i = 0; i < 5; i++ )
313 if ( fabs( m_zr1[i] + 99.0 ) < 1.0e-6 )
316 m_ezr1[i] = m_errzr1;
328 for (
unsigned int i = 0; i < 5; i++ )
334 if ( fabs( m_zr1[i] + 99.0 ) < 1.0e-6 )
337 m_ezr1[i] = m_errzr1;
348 for (
unsigned int i = 0; i < 5; i++ )
352 if ( fabs( m_zr1[i] + 99.0 ) < 1.0e-6 )
355 m_ezr1[i] = m_errzr1;
360 for (
unsigned int i = 0; i < 5; i++ )
361 { m_texpOuter[i] = m_texpInner[i] * 136.573 / 133.673; }
370 m_path2 = extTrack->
tof2Path( iExist2 );
373 for (
unsigned int i = 0; i < 5; i++ )
375 m_texpOuter[i] = extTrack->
tof2( i );
376 if ( fabs( m_texpOuter[i] + 99.0 ) < 1.0e-6 )
379 p[iExist2] / sqrt(
p[iExist2] *
p[iExist2] +
mass[iExist2] *
mass[iExist2] );
380 double betaNew =
p[i] / sqrt(
p[i] *
p[i] +
mass[i] *
mass[i] );
381 m_texpOuter[i] = beta * extTrack->
tof2( iExist2 ) / betaNew;
390 for (
unsigned int i = 0; i < 5; i++ )
394 if ( fabs( m_zr2[i] + 99.0 ) < 1.0e-6 )
397 m_ezr2[i] = m_errzr2;
408 for (
unsigned int i = 0; i < 5; i++ )
412 if ( fabs( m_zr2[i] + 99.0 ) < 1.0e-6 )
415 m_ezr2[i] = m_errzr2;
420 for (
unsigned int i = 0; i < 5; i++ )
421 { m_texpInner[i] = m_texpOuter[i] * 133.673 / 136.573; }
426 if ( m_hitCase ==
NoHit ) { m_quality = 11; }
428 for (
unsigned int i = 0; i < 5; i++ ) { m_kal[i] =
kal[i]; }
520 if ( m_hitCase ==
NoHit )
return;
522 unsigned int identify[11];
523 unsigned int count[11];
524 for (
unsigned int i = 0; i < 11; i++ )
526 identify[i] = 0x0000c000;
529 unsigned int countTot1 = 0;
530 unsigned int countTot2 = 0;
536 count[0] = tofDataMap.count( identify[0] );
537 int tofid1 = tofid0 - 1;
538 if ( tofid1 == -1 ) { tofid1 = 87; }
540 count[1] = tofDataMap.count( identify[1] );
541 int tofid2 = tofid0 + 1;
542 if ( tofid2 == 88 ) { tofid2 = 0; }
544 count[2] = tofDataMap.count( identify[2] );
549 unsigned int whichEndcap = 0;
557 count[0] = tofDataMap.count( identify[0] );
558 int tofid1 = tofid0 - 1;
559 if ( tofid1 == -1 ) { tofid1 = 47; }
561 count[1] = tofDataMap.count( identify[1] );
562 int tofid2 = tofid0 + 1;
563 if ( tofid2 == 48 ) { tofid2 = 0; }
565 count[2] = tofDataMap.count( identify[2] );
569 ( ( m_id1 > -1 ) && ( m_istrip1 > -1 ) ) )
572 for ( ;
iter != tofDataMap.end();
iter++ )
578 if ( m_id1 ==
tof->tofId() &&
abs( m_istrip1 -
tof->strip() ) <=
abs( m_delStrip1 ) )
579 { m_delStrip1 = m_istrip1 -
tof->strip(); }
580 if ( (
abs( m_id1 -
tof->tofId() ) == 1 || ( m_id1 == 0 &&
tof->tofId() == 35 ) ||
581 ( m_id1 == 35 &&
tof->tofId() == 0 ) || ( m_id1 == 36 &&
tof->tofId() == 71 ) ||
582 ( m_id1 == 71 &&
tof->tofId() == 36 ) ) &&
583 abs( m_istrip1 -
tof->strip() ) <=
abs( m_delStrip1 ) )
584 { m_delStrip2 = m_istrip1 -
tof->strip(); }
588 unsigned int whichEndcap = 0;
595 int strip0 = m_istrip1;
598 int strip3 = strip0 - 2;
599 int strip4 = strip0 + 2;
600 int tofid1 = tofid0 - 1;
601 if ( tofid1 == -1 ) { tofid1 = 35; }
602 int tofid2 = tofid0 + 1;
603 if ( tofid2 == 36 ) { tofid2 = 0; }
606 count[0] = tofDataMap.count( identify[0] );
608 count[5] = tofDataMap.count( identify[5] );
610 count[6] = tofDataMap.count( identify[6] );
621 count[1] = tofDataMap.count( identify[1] );
623 count[7] = tofDataMap.count( identify[7] );
625 count[9] = tofDataMap.count( identify[9] );
637 count[2] = tofDataMap.count( identify[2] );
639 count[8] = tofDataMap.count( identify[8] );
641 count[10] = tofDataMap.count( identify[10] );
643 if ( strip3 == -1 || strip3 == -2 ) {
count[3] = 0; }
647 count[3] = tofDataMap.count( identify[3] );
649 if ( strip4 == 12 || strip4 == 13 ) {
count[4] = 0; }
653 count[4] = tofDataMap.count( identify[4] );
657 for (
unsigned int i = 0; i < 11; i++ )
661 pair<IterTofDataMap, IterTofDataMap> range = tofDataMap.equal_range( identify[i] );
663 for (
unsigned int j = 0; j <
count[i]; j++,
iter++ )
666 else if ( i == 1 || i == 2 ) {
tofDataAnalysis( ( *iter ).second, 2 ); }
670 countTot1 = countTot1 +
count[i];
673 if ( countTot1 == 0 )
684 for (
unsigned int i = 0; i < 11; i++ )
686 identify[i] = 0x0000c000;
691 int tofid0 = m_id2 - 88;
693 count[0] = tofDataMap.count( identify[0] );
694 int tofid1 = tofid0 - 1;
695 if ( tofid1 == -1 ) { tofid1 = 87; }
697 count[1] = tofDataMap.count( identify[1] );
698 int tofid2 = tofid0 + 1;
699 if ( tofid2 == 88 ) { tofid2 = 0; }
701 count[2] = tofDataMap.count( identify[2] );
703 for (
unsigned int i = 0; i < 3; i++ )
707 pair<IterTofDataMap, IterTofDataMap> range = tofDataMap.equal_range( identify[i] );
709 for (
unsigned int j = 0; j <
count[i]; j++,
iter++ )
715 countTot2 = countTot2 +
count[i];
718 if ( countTot2 == 0 )
730 ( ( m_id2 > -1 ) && ( m_istrip2 > -1 ) ) )
733 for ( ;
iter != tofDataMap.end();
iter++ )
739 if ( m_id2 ==
tof->tofId() &&
abs( m_istrip2 -
tof->strip() ) <=
abs( m_delStrip1 ) )
740 { m_delStrip1 = m_istrip2 -
tof->strip(); }
741 if ( (
abs( m_id2 -
tof->tofId() ) == 1 || ( m_id2 == 0 &&
tof->tofId() == 35 ) ||
742 ( m_id2 == 35 &&
tof->tofId() == 0 ) || ( m_id2 == 36 &&
tof->tofId() == 71 ) ||
743 ( m_id2 == 71 &&
tof->tofId() == 36 ) ) &&
744 abs( m_istrip2 -
tof->strip() ) <=
abs( m_delStrip2 ) )
745 { m_delStrip2 = m_istrip2 -
tof->strip(); }
749 unsigned int whichEndcap = 0;
756 int strip0 = m_istrip2;
759 int strip3 = strip0 - 2;
760 int strip4 = strip0 + 2;
761 int tofid1 = tofid0 - 1;
762 if ( tofid1 == -1 ) { tofid1 = 35; }
763 int tofid2 = tofid0 + 1;
764 if ( tofid2 == 36 ) { tofid2 = 0; }
767 count[0] = tofDataMap.count( identify[0] );
769 count[5] = tofDataMap.count( identify[5] );
771 count[6] = tofDataMap.count( identify[6] );
782 count[1] = tofDataMap.count( identify[1] );
784 count[7] = tofDataMap.count( identify[7] );
786 count[9] = tofDataMap.count( identify[9] );
798 count[2] = tofDataMap.count( identify[2] );
800 count[8] = tofDataMap.count( identify[8] );
802 count[10] = tofDataMap.count( identify[10] );
804 if ( strip3 == -1 || strip3 == -2 ) {
count[3] = 0; }
808 count[3] = tofDataMap.count( identify[3] );
810 if ( strip4 == 12 || strip4 == 13 ) {
count[4] = 0; }
814 count[4] = tofDataMap.count( identify[4] );
817 for (
unsigned int i = 0; i < 11; i++ )
821 pair<IterTofDataMap, IterTofDataMap> range = tofDataMap.equal_range( identify[i] );
823 for (
unsigned int j = 0; j <
count[i]; j++,
iter++ )
826 else if ( i == 1 || i == 2 ) {
tofDataAnalysis( ( *iter ).second, 5 ); }
830 countTot2 = countTot2 +
count[i];
834 if ( countTot1 == 0 && countTot2 == 0 )
915 std::vector<TofTrack*>*& tofTrackVec ) {
917 if ( m_hitCase ==
NoHit )
return;
922 if ( ( m_quality1 & 0x10 ) == 0 ) { m_hitCase =
NoHit; }
927 if ( ( m_quality2 & 0x10 ) == 0 ) { m_hitCase =
NoHit; }
932 if ( ( m_quality1 & 0x10 ) == 0 ) { m_hitCase =
OuterLayer; }
934 if ( ( m_quality2 & 0x10 ) == 0 )
938 else { cout <<
"TofRec::TofTrack::match: 2- Impossible!" << endl; }
945 findEtfData( m_tofData1, m_tofData2, m_tofData3, m_zrhit1, 1 );
946 findEtfData( m_tofData4, m_tofData5, m_tofData6, m_zrhit2, 2 );
948 else { cout <<
"TofRec::TofTrack::match: 1- Impossible!" << endl; }
950 if ( forCalibration )
955 if ( ( ( m_quality1 & 0xf ) == 0xf ) && ( ( m_quality2 & 0xf ) == 0xf ) )
957 m_quality1 = ( m_quality1 | 0x800 );
958 m_quality2 = ( m_quality2 | 0x800 );
962 std::vector<int>::iterator
iter = deadId.begin();
963 for ( ;
iter != deadId.end();
iter++ )
974 if ( m_tofId1 == tofId )
976 if ( ( m_quality2 & 0xf ) == 0xf )
978 if ( ( ( east == 0 ) && ( ( ( m_quality1 & 0xf ) == 0x3 ) ||
979 ( ( m_quality1 & 0xf ) == 0x7 ) ||
980 ( ( m_quality1 & 0xf ) == 0xb ) ) ) ||
981 ( ( east == 1 ) && ( ( ( m_quality1 & 0xf ) == 0xc ) ||
982 ( ( m_quality1 & 0xf ) == 0xd ) ||
983 ( ( m_quality1 & 0xf ) == 0xe ) ) ) )
985 m_quality1 = ( m_quality1 | 0x800 );
986 m_quality2 = ( m_quality2 | 0x800 );
991 else if ( layer == 1 )
993 if ( m_tofId2 == ( tofId + 88 ) )
995 if ( ( m_quality1 & 0xf ) == 0xf )
997 if ( ( ( east == 0 ) && ( ( ( m_quality2 & 0xf ) == 0x3 ) ||
998 ( ( m_quality2 & 0xf ) == 0x7 ) ||
999 ( ( m_quality2 & 0xf ) == 0xb ) ) ) ||
1000 ( ( east == 1 ) && ( ( ( m_quality2 & 0xf ) == 0xc ) ||
1001 ( ( m_quality2 & 0xf ) == 0xd ) ||
1002 ( ( m_quality2 & 0xf ) == 0xe ) ) ) )
1004 m_quality1 = ( m_quality1 | 0x800 );
1005 m_quality2 = ( m_quality2 | 0x800 );
1017 if ( ( m_quality1 & 0xf ) == 0xf )
1019 m_quality1 = ( m_quality1 | 0x800 );
1023 std::vector<int>::iterator
iter = deadId.begin();
1024 for ( ;
iter != deadId.end();
iter++ )
1035 if ( m_tofId1 == tofId )
1037 if ( ( ( east == 0 ) &&
1038 ( ( ( m_quality1 & 0xf ) == 0x3 ) || ( ( m_quality1 & 0xf ) == 0x7 ) ||
1039 ( ( m_quality1 & 0xf ) == 0xb ) ) ) ||
1041 ( ( ( m_quality1 & 0xf ) == 0xc ) || ( ( m_quality1 & 0xf ) == 0xd ) ||
1042 ( ( m_quality1 & 0xf ) == 0xe ) ) ) )
1043 { m_quality1 = ( m_quality1 | 0x800 ); }
1053 ( ( m_quality1 & 0xf ) == 0xc ) )
1055 m_quality1 = ( m_quality1 | 0x800 );
1061 if ( ( ( m_quality1 & 0xf000 ) == 0x1000 ) || ( ( m_quality1 & 0xf000 ) == 0x2000 ) )
1063 if ( ( m_quality1 & 0xf ) == 0xf )
1065 m_quality1 = ( m_quality1 | 0x800 );
1068 else if ( ( ( m_quality1 & 0xf000 ) == 0x4000 ) )
1070 std::vector<int>::iterator
iter = deadId.begin();
1071 for ( ;
iter != deadId.end();
iter++ )
1081 if ( ( m_tofId1 == ( endcap * 36 + tofid ) ) && ( m_strip1 == strip ) )
1083 if ( ( ( east == 0 ) &&
1084 ( ( ( m_quality1 & 0xf ) == 0x3 ) || ( ( m_quality1 & 0xf ) == 0x7 ) ||
1085 ( ( m_quality1 & 0xf ) == 0xb ) ) ) ||
1087 ( ( ( m_quality1 & 0xf ) == 0xc ) || ( ( m_quality1 & 0xf ) == 0xd ) ||
1088 ( ( m_quality1 & 0xf ) == 0xe ) ) ) )
1089 { m_quality1 = ( m_quality1 | 0x800 ); }
1095 if ( ( ( m_quality2 & 0xf000 ) == 0x1000 ) || ( ( m_quality2 & 0xf000 ) == 0x2000 ) )
1097 if ( ( m_quality2 & 0xf ) == 0xf )
1099 m_quality2 = ( m_quality2 | 0x800 );
1102 else if ( ( m_quality2 & 0xf000 ) == 0x4000 )
1104 std::vector<int>::iterator
iter = deadId.begin();
1105 for ( ;
iter != deadId.end();
iter++ )
1115 if ( ( m_tofId2 == ( endcap * 36 + tofid ) ) && ( m_strip2 == strip ) )
1117 if ( ( ( east == 0 ) &&
1118 ( ( ( m_quality2 & 0xf ) == 0x3 ) || ( ( m_quality2 & 0xf ) == 0x7 ) ||
1119 ( ( m_quality2 & 0xf ) == 0xb ) ) ) ||
1121 ( ( ( m_quality2 & 0xf ) == 0xc ) || ( ( m_quality2 & 0xf ) == 0xd ) ||
1122 ( ( m_quality2 & 0xf ) == 0xe ) ) ) )
1123 { m_quality2 = ( m_quality2 | 0x800 ); }
1139 std::vector<TofData*> tofDataVec2,
double zrhit,
1140 unsigned int iflag, std::vector<TofTrack*>*& tofTrackVec ) {
1142 unsigned int qual = 0xf;
1144 if ( tofDataVec2.size() == 0 )
1146 if ( tofDataVec1.size() == 0 ) { qual = 0; }
1147 else if ( tofDataVec1.size() == 1 )
1149 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1153 else if ( tofDataVec1.size() > 1 )
1158 else { cout <<
"TofRec::TofTrack::findTofDataBarrel: 1- Impossible!" << endl; }
1160 else if ( ( tofDataVec2.size() == 1 ) )
1162 if ( tofDataVec1.size() == 0 )
1164 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1168 else if ( tofDataVec1.size() == 1 )
1170 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1171 if ( ( ( *iter1 )->quality() & 0x1ff ) == 0x01f &&
1173 {
tof = ( *iter1 ); }
1176 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1181 else if ( tofDataVec1.size() > 1 )
1184 if ( (
tofData1->quality() & 0x1ff ) == 0x01f &&
1189 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1194 else { cout <<
"TofRec::TofTrack::findTofDataBarrel: 2- Impossible!" << endl; }
1196 else if ( ( tofDataVec2.size() > 1 ) )
1198 if ( tofDataVec1.size() == 0 )
1203 else if ( tofDataVec1.size() == 1 )
1205 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1206 if ( ( ( *iter1 )->quality() & 0x1ff ) == 0x01f &&
1208 {
tof = ( *iter1 ); }
1216 else if ( tofDataVec1.size() > 1 )
1219 if ( (
tofData1->quality() & 0x1ff ) == 0x01f &&
1229 else { cout <<
"TofRec::TofTrack::findTofDataBarrel: 3- Impossible!" << endl; }
1237 bool z1 =
false, z2 =
false;
1238 bool zc1 =
false, zc2 =
false;
1243 zc1 = ( m_zrhit1 >
tof->ztdc() );
1244 std::vector<TofTrack*>::iterator
iter = tofTrackVec->begin();
1245 for ( ;
iter != tofTrackVec->end();
iter++ )
1249 if (
tof->tofId() == ( *iter )->tofId1() )
1253 zc2 = ( ( *iter )->zrhit1() >
tof->ztdc() );
1257 else if ( iflag == 2 )
1260 zc1 = ( m_zrhit2 >
tof->ztdc() );
1261 std::vector<TofTrack*>::iterator
iter = tofTrackVec->begin();
1262 for ( ;
iter != tofTrackVec->end();
iter++ )
1266 if (
tof->tofId() == ( *iter )->tofId2() )
1270 zc2 = ( ( *iter )->zrhit2() >
tof->ztdc() );
1275 if ( ( z1 && z2 ) || ( ( !z1 ) && ( !z2 ) ) )
1282 else if ( !zc1 && zc2 )
1288 else if ( z1 && !z2 )
1293 else if ( !z1 && z2 ) { qual = 0; }
1299 if ( ( iflag == 1 ) || ( iflag == 3 ) ) { m_quality1 = ( m_quality1 | 0x300 ); }
1300 else if ( iflag == 2 ) { m_quality2 = ( m_quality2 | 0x300 ); }
1302 { cout <<
"TofRec::TofTrack::findTofDataBarrel: the 1- IFLAG is Out of Range!" << endl; }
1306 qual = ( qual << 12 );
1307 if ( ( iflag == 1 ) || ( iflag == 3 ) ) { m_quality1 = ( m_quality1 | qual ); }
1308 else if ( iflag == 2 ) { m_quality2 = ( m_quality2 | qual ); }
1310 { cout <<
"TofRec::TofTrack::findTofDataBarrel: the 2- IFLAG is Out of Range!" << endl; }
1416 std::vector<TofData*> tofDataVec2,
double zr1[5] ) {
1418 unsigned int iflag = 3;
1419 unsigned int qual = 0xf;
1421 if ( tofDataVec2.size() == 0 )
1423 if ( tofDataVec1.size() == 0 ) { qual = 0; }
1424 else if ( tofDataVec1.size() == 1 )
1426 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1430 else if ( tofDataVec1.size() > 1 )
1435 else { cout <<
"TofRec::TofTrack::findTofDataEndcap: 1- Impossible!" << endl; }
1437 else if ( ( tofDataVec2.size() == 1 ) )
1439 if ( tofDataVec1.size() == 0 )
1441 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1445 else if ( tofDataVec1.size() == 1 )
1447 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1448 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1452 else if ( tofDataVec1.size() > 1 )
1455 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1459 else { cout <<
"TofRec::TofTrack::findTofDataBarrel: 2- Impossible!" << endl; }
1461 else if ( ( tofDataVec2.size() > 1 ) )
1463 if ( tofDataVec1.size() == 0 )
1468 else if ( tofDataVec1.size() == 1 )
1470 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1475 else if ( tofDataVec1.size() > 1 )
1482 else { cout <<
"TofRec::TofTrack::findTofDataBarrel: 3- Impossible!" << endl; }
1485 if ( qual == 0 ) { m_quality1 = ( m_quality1 | 0x300 ); }
1488 qual = ( qual << 12 );
1489 m_quality1 = ( m_quality1 | qual );
1562 std::vector<TofData*> tofDataVec2,
1563 std::vector<TofData*> tofDataVec3,
double zrhit,
1564 unsigned int iflag ) {
1570 bool findSignal =
false;
1572 if ( tofDataVec1.size() == 0 && tofDataVec2.size() == 0 && tofDataVec3.size() == 0 )
1574 if ( iflag == 1 ) { m_quality1 = ( m_quality1 | 0x300 ); }
1575 else if ( iflag == 2 ) { m_quality2 = ( m_quality2 | 0x300 ); }
1579 if ( tofDataVec1.size() > 0 )
1582 if ( (
tof1->quality() & 0xf ) == 0xf )
1588 if ( !findSignal && tofDataVec2.size() > 0 )
1591 if ( (
tof2->quality() & 0xf ) == 0xf )
1597 if ( !findSignal && tofDataVec3.size() > 0 )
1600 if ( ( tof3->
quality() & 0xf ) == 0xf )
1606 if ( !findSignal && tofDataVec1.size() > 0 )
1608 if ( ( (
tof1->quality() & 0xf ) == 0xc ) || ( (
tof1->quality() & 0xf ) == 0x3 ) )
1614 if ( !findSignal && tofDataVec2.size() > 0 )
1616 if ( ( (
tof2->quality() & 0xf ) == 0xc ) || ( (
tof2->quality() & 0xf ) == 0x3 ) )
1622 if ( !findSignal && tofDataVec3.size() > 0 )
1624 if ( ( ( tof3->
quality() & 0xf ) == 0xc ) || ( ( tof3->
quality() & 0xf ) == 0x3 ) )
1632 if ( iflag == 1 ) { m_quality1 = ( m_quality1 | 0x300 ); }
1633 else if ( iflag == 2 ) { m_quality2 = ( m_quality2 | 0x300 ); }
1973 if ( iflag == 1 &&
tof->tofId() != m_id2 )
1975 m_tofId1 =
tof->tofId();
1976 m_strip1 =
tof->strip();
1977 m_qch1 =
tof->adcChannelEast();
1978 m_adc1 =
tof->adc1();
1979 m_tdc1 =
tof->tdc1();
1980 m_qch2 =
tof->adcChannelWest();
1981 m_adc2 =
tof->adc2();
1982 m_tdc2 =
tof->tdc2();
1983 m_ztdc1 =
tof->ztdc();
1984 m_zadc1 =
tof->zadc();
1985 m_quality1 = ( m_quality1 | ( 0x1f &
tof->quality() ) );
1986 if ( ( (
tof->quality() & 0x5 ) != 0x5 ) ||
1987 ( ( (
tof->quality() & 0x5 ) == 0x5 ) &&
1989 { m_quality1 = ( m_quality1 | 0x100 ); }
1990 if ( ( (
tof->quality() & 0xa ) != 0xa ) ||
1991 ( ( (
tof->quality() & 0xa ) == 0xa ) &&
1993 { m_quality1 = ( m_quality1 | 0x200 ); }
1994 m_quality1 = ( m_quality1 | ( qual << 12 ) );
1996 if (
abs(
tof->tofId() - m_id1 ) == 1 || (
tof->tofId() == 0 && m_id1 == 35 ) ||
1997 (
tof->tofId() == 35 && m_id1 == 0 ) || (
tof->tofId() == 36 && m_id1 == 71 ) ||
1998 (
tof->tofId() == 71 && m_id1 == 36 ) )
2000 for (
unsigned int i = 0; i < 5; i++ ) { m_texpInner[i] = m_texpOuter[i]; }
2003 else if ( iflag == 2 &&
tof->tofId() != m_id1 )
2005 m_tofId2 =
tof->tofId();
2006 m_strip2 =
tof->strip();
2007 m_qch3 =
tof->adcChannelEast();
2008 m_adc3 =
tof->adc1();
2009 m_tdc3 =
tof->tdc1();
2010 m_qch4 =
tof->adcChannelWest();
2011 m_adc4 =
tof->adc2();
2012 m_tdc4 =
tof->tdc2();
2013 m_ztdc2 =
tof->ztdc();
2014 m_zadc2 =
tof->zadc();
2015 m_quality2 = ( m_quality2 | ( 0x1f &
tof->quality() ) );
2016 if ( ( (
tof->quality() & 0x5 ) != 0x5 ) ||
2017 ( ( (
tof->quality() & 0x5 ) == 0x5 ) &&
2019 { m_quality2 = ( m_quality2 | 0x100 ); }
2020 if ( ( (
tof->quality() & 0xa ) != 0xa ) ||
2021 ( ( (
tof->quality() & 0xa ) == 0xa ) &&
2023 { m_quality2 = ( m_quality2 | 0x200 ); }
2024 m_quality2 = ( m_quality2 | ( qual << 12 ) );
2026 if (
abs(
tof->tofId() - m_id2 ) == 1 || (
tof->tofId() == 0 && m_id2 == 35 ) ||
2027 (
tof->tofId() == 35 && m_id2 == 0 ) || (
tof->tofId() == 36 && m_id2 == 71 ) ||
2028 (
tof->tofId() == 71 && m_id2 == 36 ) )
2030 for (
unsigned int i = 0; i < 5; i++ ) { m_texpOuter[i] = m_texpInner[i]; }
2049 bool innerEast = ( ( m_quality1 & 0xc ) == 0xc );
2050 bool innerWest = ( ( m_quality1 & 0x3 ) == 0x3 );
2051 bool outerEast = ( ( m_quality2 & 0xc ) == 0xc );
2052 bool outerWest = ( ( m_quality2 & 0x3 ) == 0x3 );
2053 bool innerLayer = ( ( m_quality1 & 0xf ) == 0xf );
2054 bool outerLayer = ( ( m_quality2 & 0xf ) == 0xf );
2056 bool endcapData = ( ( m_quality1 & 0xc ) == 0xc );
2060 for (
unsigned int i = 0; i < 5; i++ )
2062 m_texp[i] =
tofCaliSvc->BTimeCluster( m_texpInner[i], m_texpOuter[i], m_zr1[i], m_zr2[i],
2063 m_tofId1, m_tofId2 );
2066 tofCaliSvc->BTimeCluster( m_path1, m_path2, m_zrhit1, m_zrhit2, m_tofId1, m_tofId2 );
2073 for (
unsigned int i = 0; i < 5; i++ )
2076 tofCaliSvc->BTime1( m_adc1, m_tdc1 - m_estime, m_zr1[i], m_tofId1, m_estime );
2078 m_sigma11 =
tofCaliSvc->BSigma1( m_zrhit1, m_tofId1 );
2084 for (
unsigned int i = 0; i < 5; i++ )
2087 tofCaliSvc->BTime2( m_adc2, m_tdc2 - m_estime, m_zr1[i], m_tofId1, m_estime );
2089 m_sigma12 =
tofCaliSvc->BSigma2( m_zrhit1, m_tofId1 );
2095 for (
unsigned int i = 0; i < 5; i++ )
2096 { m_tof1[i] =
tofCaliSvc->BTimeCounter( m_tof11[i], m_tof12[i], m_zr1[i], m_tofId1 ); }
2097 m_sigma1 =
tofCaliSvc->BSigmaCounter( m_zrhit1, m_tofId1 );
2098 m_ph1 =
tofCaliSvc->BPulseHeight( m_adc1, m_adc2, m_zrhit1, m_theta1, m_tofId1 );
2103 for (
unsigned int i = 0; i < 5; i++ )
2106 tofCaliSvc->BTime1( m_adc3, m_tdc3 - m_estime, m_zr2[i], m_tofId2, m_estime );
2108 m_sigma21 =
tofCaliSvc->BSigma1( m_zrhit2, m_tofId2 );
2114 for (
unsigned int i = 0; i < 5; i++ )
2117 tofCaliSvc->BTime2( m_adc4, m_tdc4 - m_estime, m_zr2[i], m_tofId2, m_estime );
2119 m_sigma22 =
tofCaliSvc->BSigma2( m_zrhit2, m_tofId2 );
2125 for (
unsigned int i = 0; i < 5; i++ )
2126 { m_tof2[i] =
tofCaliSvc->BTimeCounter( m_tof21[i], m_tof22[i], m_zr2[i], m_tofId2 ); }
2127 m_sigma2 =
tofCaliSvc->BSigmaCounter( m_zrhit2, m_tofId2 );
2128 m_ph2 =
tofCaliSvc->BPulseHeight( m_adc3, m_adc4, m_zrhit2, m_theta2, m_tofId2 );
2131 if ( innerLayer && outerLayer )
2133 for (
unsigned int i = 0; i < 5; i++ )
2135 m_tof[i] =
tofCaliSvc->BTimeCluster( m_tof1[i], m_tof2[i], m_zr1[i], m_zr2[i],
2136 m_tofId1, m_tofId2 );
2138 m_sigma =
tofCaliSvc->BSigmaCluster( m_zrhit1, m_zrhit2, m_tofId1, m_tofId2 );
2139 m_ph =
tofCaliSvc->BTimeCluster( m_ph1, m_ph2, m_zrhit1, m_zrhit2, m_tofId1, m_tofId2 );
2147 for (
unsigned int i = 0; i < 5; i++ )
2148 { m_tof11[i] =
tofCaliSvc->ETime( m_adc1, m_tdc1 - m_estime, m_zr1[i], m_tofId1 ); }
2149 m_sigma11 =
tofCaliSvc->ESigma( m_zrhit1, m_tofId1 );
2150 m_ph11 =
tofCaliSvc->EPulseHeight( m_adc1, m_zrhit1, m_theta1, m_tofId1 );
2152 if ( ( m_quality1 & 0xa000 ) != 0 ) { m_quality = 4; }
2160 if ( m_tofId1 > -1 )
2162 for (
unsigned int i = 0; i < 5; i++ )
2166 m_tof11[i] =
tofCaliSvc->EtfTime1( m_adc1, m_tdc1 - m_estime, m_zr1[i], m_tofId1,
2167 m_strip1, m_estime );
2171 m_tof11[i] =
tofCaliSvc->EtfTimeMC1( m_adc1, m_tdc1 - m_estime, m_zr1[i], m_tofId1,
2172 m_strip1, m_estime );
2180 if ( m_tofId1 > -1 )
2182 for (
unsigned int i = 0; i < 5; i++ )
2186 m_tof12[i] =
tofCaliSvc->EtfTime2( m_adc2, m_tdc2 - m_estime, m_zr1[i], m_tofId1,
2187 m_strip1, m_estime );
2191 m_tof12[i] =
tofCaliSvc->EtfTimeMC2( m_adc2, m_tdc2 - m_estime, m_zr1[i], m_tofId1,
2192 m_strip1, m_estime );
2200 if ( m_tofId2 > -1 )
2202 for (
unsigned int i = 0; i < 5; i++ )
2206 m_tof21[i] =
tofCaliSvc->EtfTime1( m_adc3, m_tdc3 - m_estime, m_zr2[i], m_tofId2,
2207 m_strip2, m_estime );
2211 m_tof21[i] =
tofCaliSvc->EtfTimeMC1( m_adc3, m_tdc3 - m_estime, m_zr2[i], m_tofId2,
2212 m_strip2, m_estime );
2220 if ( m_tofId2 > -1 )
2222 for (
unsigned int i = 0; i < 5; i++ )
2226 m_tof22[i] =
tofCaliSvc->EtfTime2( m_adc4, m_tdc4 - m_estime, m_zr2[i], m_tofId2,
2227 m_strip2, m_estime );
2231 m_tof22[i] =
tofCaliSvc->EtfTimeMC2( m_adc4, m_tdc4 - m_estime, m_zr2[i], m_tofId2,
2232 m_strip2, m_estime );
2240 if ( m_tofId1 > -1 )
2242 m_tof1[0] =
tofCaliSvc->EtfTime( m_tof11[0], m_tof12[0] );
2252 for (
unsigned int i = 1; i < 5; i++ ) { m_tof1[i] = m_tof1[0]; }
2253 m_ph1 = ( m_adc1 + m_adc2 ) / 2.0;
2258 if ( m_tofId2 > -1 )
2260 m_tof2[0] =
tofCaliSvc->EtfTime( m_tof21[0], m_tof22[0] );
2269 for (
unsigned int i = 1; i < 5; i++ ) { m_tof2[i] = m_tof2[0]; }
2270 m_ph2 = ( m_adc3 + m_adc4 ) / 2.0;
2280 if ( innerLayer && outerLayer ) { m_quality = 1; }
2284 if ( innerLayer || outerLayer ) { m_quality = 2; }
2288 if ( innerEast || innerWest || outerEast || outerWest ) { m_quality = 3; }
2293 if ( ( ( m_quality1 & 0xa000 ) != 0 ) || ( ( m_quality2 & 0xa000 ) != 0 ) )
2294 { m_quality = m_quality + 3; }
2297 if ( ( ( m_quality1 & 0x100 ) == 0x100 ) || ( ( m_quality2 & 0x100 ) == 0x100 ) )
2299 if ( ( m_quality == 1 ) || ( m_quality == 4 ) ) { m_quality = 7; }
2300 else if ( ( m_quality == 2 ) || ( m_quality == 5 ) ) { m_quality = 8; }
2301 else if ( ( m_quality == 3 ) || ( m_quality == 6 ) ) { m_quality = 9; }
2302 else { cout <<
"TofRec::TofTrack::setCalibration: Impossible!" << endl; }
2317 bool innerEast = ( ( m_quality1 & 0xc ) == 0xc );
2318 bool innerWest = ( ( m_quality1 & 0x3 ) == 0x3 );
2319 bool outerEast = ( ( m_quality2 & 0xc ) == 0xc );
2320 bool outerWest = ( ( m_quality2 & 0x3 ) == 0x3 );
2342 if ( outerEast && outerWest )
2351 else { cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 11- Impossible!" << endl; }
2355 recTofTrackCol->push_back( atrack11 );
2375 if ( outerEast && outerWest )
2384 else { cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 12- Impossible!" << endl; }
2388 recTofTrackCol->push_back( atrack12 );
2391 if ( innerEast && innerWest )
2402 if ( outerEast && outerWest )
2411 else { cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 1- Impossible!" << endl; }
2414 recTofTrackCol->push_back( atrack1 );
2434 if ( innerEast || innerWest )
2442 else { cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 21- Impossible!" << endl; }
2446 recTofTrackCol->push_back( atrack21 );
2466 if ( innerEast || innerWest )
2474 else { cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 22- Impossible!" << endl; }
2478 recTofTrackCol->push_back( atrack22 );
2481 if ( outerEast && outerWest )
2492 if ( innerEast && innerWest )
2501 else { cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 2- Impossible!" << endl; }
2504 recTofTrackCol->push_back( atrack2 );
2507 if ( innerEast && innerWest && outerEast && outerWest )
2515 recTofTrackCol->push_back( atrack );
2532 else { cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: endcap- Impossible!" << endl; }
2535 recTofTrackCol->push_back( atrack );
2541 if ( innerEast || innerWest )
2559 recTofTrackCol->push_back( atrack1 );
2577 recTofTrackCol->push_back( atrack2 );
2580 if ( innerEast && innerWest )
2595 recTofTrackCol->push_back( atrack );
2616 recTofTrackCol->push_back( atrack1 );
2634 recTofTrackCol->push_back( atrack2 );
2637 if ( outerEast && outerWest )
2652 recTofTrackCol->push_back( atrack );
2657 if ( m_hitCase ==
NoHit )
2665 recTofTrackCol->push_back( atrack );