32 for(
unsigned int i=0; i<5; i++ ) {
39 if( m_tofData1.size()>0 ) {
42 if( m_tofData2.size()>0 ) {
45 if( m_tofData3.size()>0 ) {
48 if( m_tofData4.size()>0 ) {
51 if( m_tofData5.size()>0 ) {
54 if( m_tofData6.size()>0 ) {
77 for(
unsigned int i=0; i<5; i++ ) {
108 for(
unsigned int i=0; i<5; i++ ) {
109 m_texpInner[i] = -99.0;
110 m_texpOuter[i] = -99.0;
130 if( m_tofData1.size()>0 ) {
133 if( m_tofData2.size()>0 ) {
136 if( m_tofData3.size()>0 ) {
139 if( m_tofData4.size()>0 ) {
142 if( m_tofData5.size()>0 ) {
145 if( m_tofData6.size()>0 ) {
201 if( iExist1 == -1 ) { iExist1 = 2; }
202 if( iExist2 == -1 ) { iExist2 = 2; }
211 m_id1 =
tofId1 - 176 + 48;
221 m_id1 =
tofId1 - 176 - 48;
231 m_id1 =
tofId1 - 176 - 96;
232 m_istrip1 = m_id1%12;
266 else if( m_hitCase==
NoHit ) {
271 m_id2 =
tofId2 - 176 - 96;
272 m_istrip2 = m_id2%12;
298 m_trackId = extTrack->
trackId();
306 m_path1 = extTrack->
tof1Path(iExist1);
309 for(
unsigned int i=0; i<5; i++ ) {
310 m_texpInner[i] = extTrack->
tof1(i);
311 if( fabs(m_texpInner[i]+99.0)<1.0e-6 ) {
312 double beta =
p[iExist1]/sqrt(
p[iExist1]*
p[iExist1]+
mass[iExist1]*
mass[iExist1]);
313 double betaNew =
p[i]/sqrt(
p[i]*
p[i]+
mass[i]*
mass[i]);
314 m_texpInner[i] = beta*extTrack->
tof1(iExist1)/betaNew;
322 for(
unsigned int i=0; i<5; i++ ) {
325 if( fabs(m_zr1[i]+99.0)<1.0e-6 ) {
327 m_ezr1[i] = m_errzr1;
336 for(
unsigned int i=0; i<5; i++ ) {
339 if( fabs(m_zr1[i]+99.0)<1.0e-6 ) {
341 m_ezr1[i] = m_errzr1;
350 for(
unsigned int i=0; i<5; i++ ) {
353 if( fabs(m_zr1[i]+99.0)<1.0e-6 ) {
355 m_ezr1[i] = m_errzr1;
359 for(
unsigned int i=0; i<5; i++ ) {
360 m_texpOuter[i] = m_texpInner[i] * 136.573/133.673;
367 m_path2 = extTrack->
tof2Path(iExist2);
370 for(
unsigned int i=0; i<5; i++ ) {
371 m_texpOuter[i] = extTrack->
tof2(i);
372 if( fabs(m_texpOuter[i]+99.0)<1.0e-6 ) {
373 double beta =
p[iExist2]/sqrt(
p[iExist2]*
p[iExist2]+
mass[iExist2]*
mass[iExist2]);
374 double betaNew =
p[i]/sqrt(
p[i]*
p[i]+
mass[i]*
mass[i]);
375 m_texpOuter[i] = beta*extTrack->
tof2(iExist2)/betaNew;
383 for(
unsigned int i=0; i<5; i++ ) {
386 if( fabs(m_zr2[i]+99.0)<1.0e-6 ) {
388 m_ezr2[i] = m_errzr2;
397 for(
unsigned int i=0; i<5; i++ ) {
400 if( fabs(m_zr2[i]+99.0)<1.0e-6 ) {
402 m_ezr2[i] = m_errzr2;
406 for(
unsigned int i=0; i<5; i++ ) {
407 m_texpInner[i] = m_texpOuter[i] * 133.673/136.573;
413 if( m_hitCase ==
NoHit ) { m_quality = 11; }
415 for(
unsigned int i=0; i<5; i++ ) {
430 if( (
abs(m_id1-track->
id1())<=1 ) || ( m_id1==0 && track->
id1()==87 ) || ( m_id1==87 && track->
id1()==0 ) ) {
432 m_quality1 = ( m_quality1 | 0x400 );
437 if( (
abs(m_id2-track->
id2())<=1 ) || ( m_id2==88 && track->
id2()==175 ) || ( m_id2==175 && track->
id2()==88 ) ) {
439 m_quality2 = ( m_quality2 | 0x400 );
446 if( (
abs(m_id1-track->
id1())<=1 ) || ( m_id1==0 && track->
id1()==47 ) || ( m_id1==47 && track->
id1()==0 ) ) {
448 m_quality1 = ( m_quality1 | 0x400 );
454 if( (
abs(m_id1-track->
id1())<=1 ) || ( m_id1==48 && track->
id1()==95 ) || ( m_id1==95 && track->
id1()==48 ) ) {
456 m_quality1 = ( m_quality1 | 0x400 );
463 if( ( m_id1==track->
id1() ) && abs(m_istrip1-track->
strip1())<=1 ) {
465 m_quality1 = ( m_quality1 | 0x400 );
469 if( ( m_id2==track->
id2() ) && abs(m_istrip2-track->
strip2())<=1 ) {
471 m_quality1 = ( m_quality1 | 0x400 );
488 if( m_hitCase ==
NoHit )
return;
490 unsigned int identify[11];
491 unsigned int count[11];
492 for(
unsigned int i=0; i<11; i++ ) {
493 identify[i] = 0x0000c000;
496 unsigned int countTot1 = 0;
497 unsigned int countTot2 = 0;
502 count[0] = tofDataMap.count( identify[0] );
503 int tofid1 = tofid0 - 1;
504 if( tofid1 == -1 ) { tofid1 = 87; }
506 count[1] = tofDataMap.count( identify[1] );
507 int tofid2 = tofid0 + 1;
508 if( tofid2 == 88 ) { tofid2 = 0; }
510 count[2] = tofDataMap.count( identify[2] );
514 unsigned int whichEndcap = 0;
521 count[0] = tofDataMap.count( identify[0] );
522 int tofid1 = tofid0 - 1;
523 if( tofid1 == -1 ) { tofid1 = 47; }
525 count[1] = tofDataMap.count( identify[1] );
526 int tofid2 = tofid0 + 1;
527 if( tofid2 == 48 ) { tofid2 = 0; }
529 count[2] = tofDataMap.count( identify[2] );
534 for( ;
iter != tofDataMap.end();
iter++ ) {
538 if( m_id1 ==
tof->tofId() && abs( m_istrip1 -
tof->strip() )<=abs(m_delStrip1) ) {
539 m_delStrip1 = m_istrip1 -
tof->strip();
541 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) ) {
542 m_delStrip2 = m_istrip1 -
tof->strip();
547 unsigned int whichEndcap = 0;
553 int strip0 = m_istrip1;
556 int strip3 = strip0 - 2;
557 int strip4 = strip0 + 2;
558 int tofid1 = tofid0 - 1;
559 if( tofid1 == -1 ) { tofid1 = 35; }
560 int tofid2 = tofid0 + 1;
561 if( tofid2 == 36 ) { tofid2 = 0; }
564 count[0] = tofDataMap.count( identify[0] );
566 count[5] = tofDataMap.count( identify[5] );
568 count[6] = tofDataMap.count( identify[6] );
577 count[1] = tofDataMap.count( identify[1] );
579 count[7] = tofDataMap.count( identify[7] );
581 count[9] = tofDataMap.count( identify[9] );
591 count[2] = tofDataMap.count( identify[2] );
593 count[8] = tofDataMap.count( identify[8] );
595 count[10] = tofDataMap.count( identify[10] );
597 if( strip3 == -1 || strip3 == -2 ) {
count[3] = 0; }
600 count[3] = tofDataMap.count( identify[3] );
602 if( strip4 == 12 || strip4 == 13 ) {
count[4] = 0; }
605 count[4] = tofDataMap.count( identify[4] );
609 for(
unsigned int i=0; i<11; i++ ) {
611 pair< IterTofDataMap, IterTofDataMap > range = tofDataMap.equal_range( identify[i] );
613 for(
unsigned int j=0; j<
count[i]; j++,
iter++ ) {
617 else if( i==1 || i==2 ) {
625 countTot1 = countTot1 +
count[i];
628 if( countTot1 == 0 ) {
641 for(
unsigned int i=0; i<11; i++ ) {
642 identify[i] = 0x0000c000;
646 int tofid0 = m_id2 - 88;
648 count[0] = tofDataMap.count( identify[0] );
649 int tofid1 = tofid0 - 1;
650 if( tofid1 == -1 ) { tofid1 = 87; }
652 count[1] = tofDataMap.count( identify[1] );
653 int tofid2 = tofid0 + 1;
654 if( tofid2 == 88 ) { tofid2 = 0; }
656 count[2] = tofDataMap.count( identify[2] );
658 for(
unsigned int i=0; i<3; i++ ) {
660 pair< IterTofDataMap, IterTofDataMap > range = tofDataMap.equal_range( identify[i] );
662 for(
unsigned int j=0; j<
count[i]; j++,
iter++ ) {
671 countTot2 = countTot2 +
count[i];
674 if( countTot2 == 0 ) {
687 for( ;
iter != tofDataMap.end();
iter++ ) {
691 if( m_id2 ==
tof->tofId() && abs( m_istrip2 -
tof->strip() )<=abs(m_delStrip1) ) {
692 m_delStrip1 = m_istrip2 -
tof->strip();
694 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) ) {
695 m_delStrip2 = m_istrip2 -
tof->strip();
700 unsigned int whichEndcap = 0;
706 int strip0 = m_istrip2;
709 int strip3 = strip0 - 2;
710 int strip4 = strip0 + 2;
711 int tofid1 = tofid0 - 1;
712 if( tofid1 == -1 ) { tofid1 = 35; }
713 int tofid2 = tofid0 + 1;
714 if( tofid2 == 36 ) { tofid2 = 0; }
717 count[0] = tofDataMap.count( identify[0] );
719 count[5] = tofDataMap.count( identify[5] );
721 count[6] = tofDataMap.count( identify[6] );
730 count[1] = tofDataMap.count( identify[1] );
732 count[7] = tofDataMap.count( identify[7] );
734 count[9] = tofDataMap.count( identify[9] );
744 count[2] = tofDataMap.count( identify[2] );
746 count[8] = tofDataMap.count( identify[8] );
748 count[10] = tofDataMap.count( identify[10] );
750 if( strip3 == -1 || strip3 == -2 ) {
count[3] = 0; }
753 count[3] = tofDataMap.count( identify[3] );
755 if( strip4 == 12 || strip4 == 13 ) {
count[4] = 0; }
758 count[4] = tofDataMap.count( identify[4] );
761 for(
unsigned int i=0; i<11; i++ ) {
763 pair< IterTofDataMap, IterTofDataMap > range = tofDataMap.equal_range( identify[i] );
765 for(
unsigned int j=0; j<
count[i]; j++,
iter++ ) {
769 else if( i==1 || i==2 ) {
777 countTot2 = countTot2 +
count[i];
781 if( countTot1==0 && countTot2==0 ) {
795 unsigned int qual =
tof->quality();
797 if( ( qual & 0x10 ) == 0 ) {
798 qual = ( qual | 0x10 );
799 if(
tof->barrel() ||
tof->is_mrpc() ) {
800 if( (
tof->quality() == 0x7 ) || (
tof->quality() == 0xd ) ) {
801 qual = ( qual | 0x20 );
804 if( (
tof->quality() == 0xb ) || (
tof->quality() == 0xe ) ) {
805 qual = ( qual | 0x40 );
808 if( (
tof->quality() == 0x3 ) || (
tof->quality() == 0xc ) ) {
809 qual = ( qual | 0x80 );
812 if(
tof->barrel() ) {
813 if( (
tof->quality() & 0x5 ) == 0x5 ) {
815 tof->setZTdc( ztdc );
818 if( (
tof->quality() & 0xa ) == 0xa ) {
820 tof->setZAdc( zadc );
823 if(
tof->is_mrpc() ) {
824 if( (
tof->quality() & 0x5 ) == 0x5 ) {
826 tof->setZTdc( ztdc );
829 tof->setQuality( qual );
832 if( iflag == 1 ) { m_tofData1.push_back(
tof ); }
833 else if( iflag == 2 ) { m_tofData2.push_back(
tof ); }
834 else if( iflag == 3 ) { m_tofData3.push_back(
tof ); }
835 else if( iflag == 4 ) { m_tofData4.push_back(
tof ); }
836 else if( iflag == 5 ) { m_tofData5.push_back(
tof ); }
837 else if( iflag == 6 ) { m_tofData6.push_back(
tof ); }
839 cout <<
"TofRec::TofTrack::TofDataAnalylsis: the Flag should be 1-4, out of the Range!" << endl;
849void TofTrack::match(
bool forCalibration, std::vector<int> deadId, std::vector<TofTrack*>*& tofTrackVec ) {
851 if( m_hitCase ==
NoHit )
return;
855 if( ( m_quality1 & 0x10 ) == 0 ) { m_hitCase =
NoHit; }
859 if( ( m_quality2 & 0x10 ) == 0 ) { m_hitCase =
NoHit; }
863 if( ( m_quality1 & 0x10 ) == 0 ) { m_hitCase =
OuterLayer; }
865 if( ( m_quality2 & 0x10 ) == 0 ) {
873 cout <<
"TofRec::TofTrack::match: 2- Impossible!" << endl;
881 findEtfData( m_tofData1, m_tofData2, m_tofData3, m_zrhit1, 1 );
882 findEtfData( m_tofData4, m_tofData5, m_tofData6, m_zrhit2, 2 );
885 cout <<
"TofRec::TofTrack::match: 1- Impossible!" << endl;
888 if( forCalibration ) {
891 if( ( ( m_quality1 & 0xf ) == 0xf ) && ( ( m_quality2 & 0xf ) == 0xf ) ) {
892 m_quality1 = ( m_quality1 | 0x800 );
893 m_quality2 = ( m_quality2 | 0x800 );
896 std::vector<int>::iterator
iter = deadId.begin();
897 for( ;
iter != deadId.end();
iter++ ) {
905 if( m_tofId1 == tofId ) {
906 if( ( m_quality2 & 0xf ) == 0xf ) {
907 if( ( ( east == 0 ) && ( ( ( m_quality1 & 0xf ) == 0x3 ) || ( ( m_quality1 & 0xf ) == 0x7 ) || ( ( m_quality1 & 0xf ) == 0xb ) ) ) || ( ( east == 1 ) && ( ( ( m_quality1 & 0xf ) == 0xc ) || ( ( m_quality1 & 0xf ) == 0xd ) || ( ( m_quality1 & 0xf ) == 0xe ) ) ) ) {
908 m_quality1 = ( m_quality1 | 0x800 );
909 m_quality2 = ( m_quality2 | 0x800 );
915 else if( layer == 1 ) {
916 if( m_tofId2 == (tofId+88) ) {
917 if( ( m_quality1 & 0xf ) == 0xf ) {
918 if( ( ( east == 0 ) && ( ( ( m_quality2 & 0xf ) == 0x3 ) || ( ( m_quality2 & 0xf ) == 0x7 ) || ( ( m_quality2 & 0xf ) == 0xb ) ) ) || ( ( east == 1 ) && ( ( ( m_quality2 & 0xf ) == 0xc ) || ( ( m_quality2 & 0xf ) == 0xd ) || ( ( m_quality2 & 0xf ) == 0xe ) ) ) ) {
919 m_quality1 = ( m_quality1 | 0x800 );
920 m_quality2 = ( m_quality2 | 0x800 );
931 if( ( m_quality1 & 0xf ) == 0xf ) {
932 m_quality1 = ( m_quality1 | 0x800 );
935 std::vector<int>::iterator
iter = deadId.begin();
936 for( ;
iter != deadId.end();
iter++ ) {
944 if( m_tofId1 == tofId ) {
945 if( ( ( east == 0 ) && ( ( ( m_quality1 & 0xf ) == 0x3 ) || ( ( m_quality1 & 0xf ) == 0x7 ) || ( ( m_quality1 & 0xf ) == 0xb ) ) ) || ( ( east == 1 ) && ( ( ( m_quality1 & 0xf ) == 0xc ) || ( ( m_quality1 & 0xf ) == 0xd ) || ( ( m_quality1 & 0xf ) == 0xe ) ) ) ) {
946 m_quality1 = ( m_quality1 | 0x800 );
956 if( ( ( m_hitCase ==
EastEndcap ) || ( m_hitCase ==
WestEndcap ) ) && ( ( m_quality1 & 0xf ) == 0xc ) ) {
957 m_quality1 = ( m_quality1 | 0x800 );
962 if( ( ( m_quality1 & 0xf000 ) == 0x1000 ) || ( ( m_quality1 & 0xf000 ) == 0x2000 ) ) {
963 if( ( m_quality1 & 0xf ) == 0xf ) {
964 m_quality1 = ( m_quality1 | 0x800 );
967 else if( ( ( m_quality1 & 0xf000 ) == 0x4000 ) ) {
968 std::vector<int>::iterator
iter = deadId.begin();
969 for( ;
iter != deadId.end();
iter++ ) {
974 int tofid = TofID::module( iden );
977 if( ( m_tofId1 == ( endcap*36 + tofid ) ) && ( m_strip1 == strip ) ) {
978 if( ( ( east == 0 ) && ( ( ( m_quality1 & 0xf ) == 0x3 ) || ( ( m_quality1 & 0xf ) == 0x7 ) || ( ( m_quality1 & 0xf ) == 0xb ) ) ) || ( ( east == 1 ) && ( ( ( m_quality1 & 0xf ) == 0xc ) || ( ( m_quality1 & 0xf ) == 0xd ) || ( ( m_quality1 & 0xf ) == 0xe ) ) ) ) {
979 m_quality1 = ( m_quality1 | 0x800 );
986 if( ( ( m_quality2 & 0xf000 ) == 0x1000 ) || ( ( m_quality2 & 0xf000 ) == 0x2000 ) ) {
987 if( ( m_quality2 & 0xf ) == 0xf ) {
988 m_quality2 = ( m_quality2 | 0x800 );
991 else if( ( m_quality2 & 0xf000 ) == 0x4000 ) {
992 std::vector<int>::iterator
iter = deadId.begin();
993 for( ;
iter != deadId.end();
iter++ ) {
998 int tofid = TofID::module( iden );
1001 if( ( m_tofId2 == ( endcap*36 + tofid ) ) && ( m_strip2 == strip ) ) {
1002 if( ( ( east == 0 ) && ( ( ( m_quality2 & 0xf ) == 0x3 ) || ( ( m_quality2 & 0xf ) == 0x7 ) || ( ( m_quality2 & 0xf ) == 0xb ) ) ) || ( ( east == 1 ) && ( ( ( m_quality2 & 0xf ) == 0xc ) || ( ( m_quality2 & 0xf ) == 0xd ) || ( ( m_quality2 & 0xf ) == 0xe ) ) ) ) {
1003 m_quality2 = ( m_quality2 | 0x800 );
1020void TofTrack::findTofDataBarrel( std::vector<TofData*> tofDataVec1, std::vector<TofData*> tofDataVec2,
double zrhit,
unsigned int iflag, std::vector<TofTrack*>*& tofTrackVec ) {
1022 unsigned int qual = 0xf;
1024 if( tofDataVec2.size() == 0 ) {
1025 if( tofDataVec1.size() == 0 ) {
1028 else if( tofDataVec1.size() == 1 ) {
1029 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1033 else if( tofDataVec1.size() > 1 ) {
1038 cout <<
"TofRec::TofTrack::findTofDataBarrel: 1- Impossible!" << endl;
1041 else if( ( tofDataVec2.size() == 1 ) ) {
1042 if( tofDataVec1.size() == 0 ) {
1043 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1047 else if( tofDataVec1.size() == 1 ) {
1048 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1049 if( ((*iter1)->quality()&0x1ff)==0x01f && abs((*iter1)->ztdc()-zrhit)<
ztdc_Cut ) {
1053 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1058 else if( tofDataVec1.size() > 1 ) {
1064 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1070 cout <<
"TofRec::TofTrack::findTofDataBarrel: 2- Impossible!" << endl;
1073 else if( ( tofDataVec2.size() > 1 ) ) {
1074 if( tofDataVec1.size() == 0 ) {
1078 else if( tofDataVec1.size() == 1 ) {
1079 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1080 if( ((*iter1)->quality()&0x1ff)==0x01f && abs((*iter1)->ztdc()-zrhit)<
ztdc_Cut ) {
1089 else if( tofDataVec1.size() > 1 ) {
1101 cout <<
"TofRec::TofTrack::findTofDataBarrel: 3- Impossible!" << endl;
1106 if( !(
tof->used()) ) {
1110 bool z1=
false, z2=
false;
1111 bool zc1=
false, zc2=
false;
1115 zc1 = ( m_zrhit1 >
tof->ztdc() );
1116 std::vector<TofTrack*>::iterator
iter = tofTrackVec->begin();
1117 for( ;
iter!=tofTrackVec->end();
iter++ ) {
1119 if(
tof->tofId()==(*iter)->tofId1() ) {
1122 zc2 = ( (*iter)->zrhit1() >
tof->ztdc() );
1126 else if( iflag==2 ) {
1128 zc1 = ( m_zrhit2 >
tof->ztdc() );
1129 std::vector<TofTrack*>::iterator
iter = tofTrackVec->begin();
1130 for( ;
iter!=tofTrackVec->end();
iter++ ) {
1132 if(
tof->tofId()==(*iter)->tofId2() ) {
1135 zc2 = ( (*iter)->zrhit2() >
tof->ztdc() );
1140 if( ( z1 && z2 )||( (!z1) && (!z2) ) ) {
1145 else if( !zc1 && zc2 ) {
1150 else if( z1 && !z2 ) {
1154 else if( !z1 && z2 ) {
1161 if( ( iflag == 1 ) || ( iflag == 3 ) ) {
1162 m_quality1 = ( m_quality1 | 0x300 );
1164 else if( iflag == 2 ) {
1165 m_quality2 = ( m_quality2 | 0x300 );
1168 cout <<
"TofRec::TofTrack::findTofDataBarrel: the 1- IFLAG is Out of Range!" << endl;
1172 qual = ( qual << 12 );
1173 if( ( iflag == 1 ) || ( iflag == 3 ) ) {
1174 m_quality1 = ( m_quality1 | qual );
1176 else if( iflag == 2 ) {
1177 m_quality2 = ( m_quality2 | qual );
1180 cout <<
"TofRec::TofTrack::findTofDataBarrel: the 2- IFLAG is Out of Range!" << endl;
1193 if( tofDataVec.size() == 0 ) {
1194 cout <<
"TofRec::TofTrack::ChooseTofData: Size of TofData Vector is Zero!" << endl;
1197 std::vector<TofData*>::iterator igood = tofDataVec.begin();
1198 if( tofDataVec.size() > 1 ) {
1199 double deltaZ = 1000.0;
1200 std::vector<TofData*>::iterator
iter = tofDataVec.begin();
1202 for( ;
iter != tofDataVec.end();
iter++ ) {
1203 if( ( (*iter)->quality() & 0x5 ) == 0x5 ) {
1204 if(
abs( (*iter)->ztdc() - zrhit ) < deltaZ ) {
1205 deltaZ =
abs( (*iter)->ztdc() - zrhit );
1211 if( deltaZ > 999.0 ) {
1212 iter = tofDataVec.begin();
1213 for( ;
iter != tofDataVec.end();
iter++ ) {
1214 if( ( (*iter)->quality() & 0xa ) == 0xa ) {
1215 if(
abs( (*iter)->zadc() - zrhit ) < deltaZ ) {
1216 deltaZ =
abs( (*iter)->zadc() - zrhit );
1223 if( deltaZ > 999.0 ) {
1224 unsigned int ibad = 0xf0;
1225 iter = tofDataVec.begin();
1226 for( ;
iter != tofDataVec.end();
iter++ ) {
1227 if( ( (*iter)->quality() & 0xf0 ) < ibad ) {
1229 ibad = ( (*iter)->quality() & 0xf0 );
1231 else if( ( (*iter)->quality() & 0xf0 ) == ibad ) {
1232 if( ( (*iter)->adc1() + (*iter)->adc2() ) > ( (*igood)->adc1() + (*igood)->adc2() ) ) {
1234 ibad = ( (*iter)->quality() & 0xf0 );
1273 unsigned int iflag = 3;
1274 unsigned int qual = 0xf;
1276 if( tofDataVec2.size() == 0 ) {
1277 if( tofDataVec1.size() == 0 ) {
1280 else if( tofDataVec1.size() == 1 ) {
1281 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1285 else if( tofDataVec1.size() > 1 ) {
1290 cout <<
"TofRec::TofTrack::findTofDataEndcap: 1- Impossible!" << endl;
1293 else if( ( tofDataVec2.size() == 1 ) ) {
1294 if( tofDataVec1.size() == 0 ) {
1295 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1299 else if( tofDataVec1.size() == 1 ) {
1300 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1301 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1305 else if( tofDataVec1.size() > 1 ) {
1307 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1312 cout <<
"TofRec::TofTrack::findTofDataBarrel: 2- Impossible!" << endl;
1315 else if( ( tofDataVec2.size() > 1 ) ) {
1316 if( tofDataVec1.size() == 0 ) {
1320 else if( tofDataVec1.size() == 1 ) {
1321 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1326 else if( tofDataVec1.size() > 1 ) {
1333 cout <<
"TofRec::TofTrack::findTofDataBarrel: 3- Impossible!" << endl;
1338 m_quality1 = ( m_quality1 | 0x300 );
1341 qual = ( qual << 12 );
1342 m_quality1 = ( m_quality1 | qual );
1353 if( tofDataVec.size() == 0 ) {
1354 cout <<
"TofRec::TofTrack::ChooseTofData: Size of TofData Vector is Zero!" << endl;
1357 std::vector<TofData*>::iterator igood = tofDataVec.begin();
1358 if( tofDataVec.size() > 1 ) {
1359 bool multihit =
false;
1360 std::vector<TofData*>::iterator
iter = tofDataVec.begin();
1361 for( ;
iter != tofDataVec.end();
iter++ ) {
1362 if( (*iter)->qtimes1()>1 ) { multihit =
true; }
1364 iter = tofDataVec.begin();
1366 double tcorr = -999.0;
1367 double deltaTMin = 999.0;
1368 for( ;
iter != tofDataVec.end();
iter++ ) {
1369 tcorr =
tofCaliSvc->
ETime( (*iter)->adc(), (*iter)->tdc()-m_estime,
zr1[2], (*iter)->tofId() );
1370 for(
unsigned int i=0; i<5; i++ ) {
1371 if(
abs(tcorr-m_texpInner[i]) < deltaTMin ) {
1372 deltaTMin =
abs(tcorr-m_texpInner[i]);
1380 for( ;
iter != tofDataVec.end();
iter++ ) {
1381 if( (*iter)->adc() > maxQ ) {
1382 maxQ = (*iter)->adc();
1408void TofTrack::findEtfData( std::vector<TofData*> tofDataVec1, std::vector<TofData*> tofDataVec2, std::vector<TofData*> tofDataVec3,
double zrhit,
unsigned int iflag ) {
1414 bool findSignal =
false;
1416 if( tofDataVec1.size()==0 && tofDataVec2.size()==0 && tofDataVec3.size()==0 ) {
1418 m_quality1 = ( m_quality1 | 0x300 );
1420 else if( iflag == 2 ) {
1421 m_quality2 = ( m_quality2 | 0x300 );
1425 if( tofDataVec1.size()>0 ) {
1427 if( (
tof1->quality() & 0xf ) == 0xf ) {
1432 if( !findSignal && tofDataVec2.size() > 0 ) {
1434 if( (
tof2->quality() & 0xf ) == 0xf ) {
1439 if( !findSignal && tofDataVec3.size() > 0 ) {
1441 if( ( tof3->
quality() & 0xf ) == 0xf ) {
1446 if( !findSignal && tofDataVec1.size()>0 ) {
1447 if( ( (
tof1->quality() & 0xf ) == 0xc ) || ( (
tof1->quality() & 0xf ) == 0x3 ) ) {
1452 if( !findSignal && tofDataVec2.size() > 0 ) {
1453 if( ( (
tof2->quality() & 0xf ) == 0xc ) || ( (
tof2->quality() & 0xf ) == 0x3 ) ) {
1458 if( !findSignal && tofDataVec3.size() > 0 ) {
1459 if( ( ( tof3->
quality() & 0xf ) == 0xc ) || ( ( tof3->
quality() & 0xf ) == 0x3 ) ) {
1466 m_quality1 = ( m_quality1 | 0x300 );
1468 else if( iflag == 2 ) {
1469 m_quality2 = ( m_quality2 | 0x300 );
1481 if( tofDataVec.size() == 0 ) {
1484 std::vector<TofData*>::iterator igood = tofDataVec.begin();
1485 if( tofDataVec.size() == 1 ) {
1488 else if( tofDataVec.size() > 1 ) {
1489 double deltaZ = 1000.0;
1490 std::vector<TofData*>::iterator
iter = tofDataVec.begin();
1491 for( ;
iter != tofDataVec.end();
iter++ ) {
1492 if( ( (*iter)->quality() & 0xf ) == 0xf ) {
1493 if(
abs( (*iter)->ztdc() - zrhit ) < deltaZ ) {
1494 deltaZ =
abs( (*iter)->ztdc() - zrhit );
1500 if( deltaZ > 999.0 ) {
1502 iter = tofDataVec.begin();
1503 for( ;
iter != tofDataVec.end();
iter++ ) {
1504 if( ( (*iter)->quality() & 0xc ) == 0xc ) {
1505 if( (*iter)->adc1() > maxQ ) {
1506 maxQ = (*iter)->adc1();
1510 else if( ( (*iter)->quality() & 0x3 ) == 0x3 ) {
1511 if( (*iter)->adc2() > maxQ ) {
1512 maxQ = (*iter)->adc2();
1527 if( tofDataVec.size() == 0 ) {
1530 std::vector<TofData*>::iterator igood = tofDataVec.begin();
1531 if( tofDataVec.size() == 1 ) {
1534 else if( tofDataVec.size() > 1 ) {
1536 std::vector<TofData*>::iterator
iter = tofDataVec.begin();
1537 for( ;
iter != tofDataVec.end();
iter++ ) {
1538 if( ( (*iter)->quality() & 0xc ) == 0xc ) {
1539 if( (*iter)->adc1() > maxQ ) {
1540 maxQ = (*iter)->adc1();
1544 else if( ( (*iter)->quality() & 0x3 ) == 0x3 ) {
1545 if( (*iter)->adc2() > maxQ ) {
1546 maxQ = (*iter)->adc2();
1562 m_tofId1 =
tof->tofId();
1563 m_strip1 =
tof->strip();
1565 m_qch1 =
tof->qtc1();
1568 m_qch1 =
tof->adcChannelEast();
1570 m_adc1 =
tof->adc1();
1571 m_tdc1 =
tof->tdc1();
1573 m_qch2 =
tof->qtc2();
1576 m_qch2 =
tof->adcChannelWest();
1578 m_adc2 =
tof->adc2();
1579 m_tdc2 =
tof->tdc2();
1580 m_ztdc1 =
tof->ztdc();
1581 m_zadc1 =
tof->zadc();
1582 m_quality1 = ( m_quality1 | ( 0x1f &
tof->quality() ) );
1583 if( ( (
tof->quality() & 0x5 ) != 0x5 ) || ( ( (
tof->quality() & 0x5 ) == 0x5 ) && ( abs(
tof->ztdc() - m_zrhit1 ) >
ztdc_Cut ) ) ) {
1584 m_quality1 = ( m_quality1 | 0x100 );
1586 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && ( abs(
tof->zadc() - m_zrhit1 ) >
zadc_Cut ) ) ) {
1587 m_quality1 = ( m_quality1 | 0x200 );
1590 else if( iflag == 2 ) {
1591 m_tofId2 =
tof->tofId();
1592 m_strip2 =
tof->strip();
1594 m_qch3 =
tof->qtc1();
1597 m_qch3 =
tof->adcChannelEast();
1599 m_adc3 =
tof->adc1();
1600 m_tdc3 =
tof->tdc1();
1602 m_qch4 =
tof->qtc2();
1605 m_qch4 =
tof->adcChannelWest();
1607 m_adc4 =
tof->adc2();
1608 m_tdc4 =
tof->tdc2();
1609 m_ztdc2 =
tof->ztdc();
1610 m_zadc2 =
tof->zadc();
1611 m_quality2 = ( m_quality2 | ( 0x1f &
tof->quality() ) );
1612 if( ( (
tof->quality() & 0x5 ) != 0x5 ) || ( ( (
tof->quality() & 0x5 ) == 0x5 ) && ( abs(
tof->ztdc() - m_zrhit2 ) >
ztdc_Cut ) ) ) {
1613 m_quality2 = ( m_quality2 | 0x100 );
1615 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && ( abs(
tof->zadc() - m_zrhit2 ) >
zadc_Cut ) ) ) {
1616 m_quality2 = ( m_quality2 | 0x200 );
1619 else if( iflag == 3 ) {
1620 m_tofId1 =
tof->tofId();
1622 m_qch1 =
tof->qtc();
1625 m_qch1 =
tof->adcChannel();
1627 m_adc1 =
tof->adc();
1628 m_tdc1 =
tof->tdc();
1629 m_quality1 = ( m_quality1 | ( 0x1f &
tof->quality() ) );
1630 m_quality1 = ( m_quality1 | 0x300 );
1633 cout <<
"TofRec::TofTrack::getTofData: Flag which sign the Barrel/Endcap or Inner/Outer is wrong! Please check it!" << endl;
1646 m_tofId1 =
tof->tofId();
1647 m_strip1 =
tof->strip();
1649 m_qch1 =
tof->qtc1();
1652 m_qch1 =
tof->adcChannelEast();
1654 m_adc1 =
tof->adc1();
1655 m_tdc1 =
tof->tdc1();
1659 m_ztdc1 =
tof->ztdc();
1660 m_zadc1 =
tof->zadc();
1661 m_quality1 = ( ( m_quality1 & 0xfffffff0 ) | ( 0x1c &
tof->quality() ) );
1662 if( ( (
tof->quality() & 0x5 ) != 0x5 ) || ( ( (
tof->quality() & 0x5 ) == 0x5 ) && ( abs(
tof->ztdc() - m_zrhit1 ) >
ztdc_Cut ) ) ) {
1663 m_quality1 = ( m_quality1 | 0x100 );
1665 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && ( abs(
tof->zadc() - m_zrhit1 ) >
zadc_Cut ) ) ) {
1666 m_quality1 = ( m_quality1 | 0x200 );
1669 else if( iflag == 2 ) {
1670 m_tofId2 =
tof->tofId();
1672 m_qch3 =
tof->qtc1();
1675 m_qch3 =
tof->adcChannelEast();
1677 m_adc3 =
tof->adc1();
1678 m_tdc3 =
tof->tdc1();
1682 m_ztdc2 =
tof->ztdc();
1683 m_zadc2 =
tof->zadc();
1684 m_quality2 = ( ( m_quality2 & 0xfffffff0 ) | ( 0x1c &
tof->quality() ) );
1685 if( ( (
tof->quality() & 0x5 ) != 0x5 ) || ( ( (
tof->quality() & 0x5 ) == 0x5 ) && ( abs(
tof->ztdc() - m_zrhit2 ) >
ztdc_Cut ) ) ) {
1686 m_quality2 = ( m_quality2 | 0x100 );
1688 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && ( abs(
tof->zadc() - m_zrhit2 ) >
zadc_Cut ) ) ) {
1689 m_quality2 = ( m_quality2 | 0x200 );
1693 cout <<
"TofRec::TofTrack::getTofDataEast: Flag which sign the Barrel/Endcap or Inner/Outer is wrong! Please check it!" << endl;
1706 m_tofId1 =
tof->tofId();
1707 m_strip1 =
tof->strip();
1712 m_qch2 =
tof->qtc2();
1715 m_qch2 =
tof->adcChannelWest();
1717 m_adc2 =
tof->adc2();
1718 m_tdc2 =
tof->tdc2();
1719 m_ztdc1 =
tof->ztdc();
1720 m_zadc1 =
tof->zadc();
1721 m_quality1 = ( ( m_quality1 & 0xfffffff0 ) | ( 0x13 &
tof->quality() ) );
1722 if( ( (
tof->quality() & 0x5 ) != 0x5 ) || ( ( (
tof->quality() & 0x5 ) == 0x5 ) && ( abs(
tof->ztdc() - m_zrhit1 ) >
ztdc_Cut ) ) ) {
1723 m_quality1 = ( m_quality1 | 0x100 );
1725 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && ( abs(
tof->zadc() - m_zrhit1 ) >
zadc_Cut ) ) ) {
1726 m_quality1 = ( m_quality1 | 0x200 );
1729 else if( iflag == 2 ) {
1730 m_tofId2 =
tof->tofId();
1735 m_qch4 =
tof->qtc2();
1738 m_qch4 =
tof->adcChannelWest();
1740 m_adc4 =
tof->adc2();
1741 m_tdc4 =
tof->tdc2();
1742 m_ztdc2 =
tof->ztdc();
1743 m_zadc2 =
tof->zadc();
1744 m_quality2 = ( ( m_quality2 & 0xfffffff0 ) | ( 0x13 &
tof->quality() ) );
1745 if( ( (
tof->quality() & 0x5 ) != 0x5 ) || ( ( (
tof->quality() & 0x5 ) == 0x5 ) && ( abs(
tof->ztdc() - m_zrhit2 ) >
ztdc_Cut ) ) ) {
1746 m_quality2 = ( m_quality2 | 0x100 );
1748 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && ( abs(
tof->zadc() - m_zrhit2 ) >
zadc_Cut ) ) ) {
1749 m_quality2 = ( m_quality2 | 0x200 );
1753 cout <<
"TofRec::TofTrack::getTofDataWest: Flag which sign the Barrel/Endcap or Inner/Outer is wrong! Please check it!" << endl;
1776 m_quality1 = ( m_quality1 & 0x700 );
1780 else if( iflag == 2 ) {
1790 m_quality2 = ( m_quality2 & 0x700 );
1795 cout <<
"TofRec::TofTrack::getTofData: Flag which sign the Barrel/Endcap or Inner/Outer is wrong! Please check it!" << endl;
1807 if( iflag == 1 &&
tof->tofId() != m_id2 ) {
1808 m_tofId1 =
tof->tofId();
1809 m_strip1 =
tof->strip();
1810 m_qch1 =
tof->adcChannelEast();
1811 m_adc1 =
tof->adc1();
1812 m_tdc1 =
tof->tdc1();
1813 m_qch2 =
tof->adcChannelWest();
1814 m_adc2 =
tof->adc2();
1815 m_tdc2 =
tof->tdc2();
1816 m_ztdc1 =
tof->ztdc();
1817 m_zadc1 =
tof->zadc();
1818 m_quality1 = ( m_quality1 | ( 0x1f &
tof->quality() ) );
1819 if( ( (
tof->quality() & 0x5 ) != 0x5 ) || ( ( (
tof->quality() & 0x5 ) == 0x5 ) && ( abs(
tof->ztdc() - m_zrhit1 ) >
ztdc_Cut ) ) ) {
1820 m_quality1 = ( m_quality1 | 0x100 );
1822 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && ( abs(
tof->zadc() - m_zrhit1 ) >
zadc_Cut ) ) ) {
1823 m_quality1 = ( m_quality1 | 0x200 );
1825 m_quality1 = ( m_quality1 | ( qual << 12 ) );
1827 if(
abs(
tof->tofId()-m_id1)== 1 || (
tof->tofId()==0 && m_id1==35 ) || (
tof->tofId()==35 && m_id1==0 ) || (
tof->tofId()==36 && m_id1==71 ) || (
tof->tofId()==71 && m_id1==36 ) ) {
1828 for(
unsigned int i=0; i<5; i++ ) {
1829 m_texpInner[i] = m_texpOuter[i];
1833 else if( iflag == 2 &&
tof->tofId() != m_id1 ) {
1834 m_tofId2 =
tof->tofId();
1835 m_strip2 =
tof->strip();
1836 m_qch3 =
tof->adcChannelEast();
1837 m_adc3 =
tof->adc1();
1838 m_tdc3 =
tof->tdc1();
1839 m_qch4 =
tof->adcChannelWest();
1840 m_adc4 =
tof->adc2();
1841 m_tdc4 =
tof->tdc2();
1842 m_ztdc2 =
tof->ztdc();
1843 m_zadc2 =
tof->zadc();
1844 m_quality2 = ( m_quality2 | ( 0x1f &
tof->quality() ) );
1845 if( ( (
tof->quality() & 0x5 ) != 0x5 ) || ( ( (
tof->quality() & 0x5 ) == 0x5 ) && ( abs(
tof->ztdc() - m_zrhit2 ) >
ztdc_Cut ) ) ) {
1846 m_quality2 = ( m_quality2 | 0x100 );
1848 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && ( abs(
tof->zadc() - m_zrhit2 ) >
zadc_Cut ) ) ) {
1849 m_quality2 = ( m_quality2 | 0x200 );
1851 m_quality2 = ( m_quality2 | ( qual << 12 ) );
1853 if(
abs(
tof->tofId()-m_id2)== 1 || (
tof->tofId()==0 && m_id2==35 ) || (
tof->tofId()==35 && m_id2==0 ) || (
tof->tofId()==36 && m_id2==71 ) || (
tof->tofId()==71 && m_id2==36 ) ) {
1854 for(
unsigned int i=0; i<5; i++ ) {
1855 m_texpOuter[i] = m_texpInner[i];
1875 bool innerEast = ( ( m_quality1 & 0xc ) == 0xc );
1876 bool innerWest = ( ( m_quality1 & 0x3 ) == 0x3 );
1877 bool outerEast = ( ( m_quality2 & 0xc ) == 0xc );
1878 bool outerWest = ( ( m_quality2 & 0x3 ) == 0x3 );
1879 bool innerLayer = ( ( m_quality1 & 0xf ) == 0xf );
1880 bool outerLayer = ( ( m_quality2 & 0xf ) == 0xf );
1882 bool endcapData = ( ( m_quality1 & 0xc ) == 0xc );
1885 for(
unsigned int i=0; i<5; i++ ) {
1886 m_texp[i] =
tofCaliSvc->
BTimeCluster( m_texpInner[i], m_texpOuter[i], m_zr1[i], m_zr2[i], m_tofId1, m_tofId2 );
1893 for(
unsigned int i=0; i<5; i++ ) {
1894 m_tof11[i] =
tofCaliSvc->
BTime1( m_adc1, m_tdc1-m_estime, m_zr1[i], m_tofId1, m_estime );
1901 for(
unsigned int i=0; i<5; i++ ) {
1902 m_tof12[i] =
tofCaliSvc->
BTime2( m_adc2, m_tdc2-m_estime, m_zr1[i], m_tofId1, m_estime );
1909 for(
unsigned int i=0; i<5; i++ ) {
1917 for(
unsigned int i=0; i<5; i++ ) {
1918 m_tof21[i] =
tofCaliSvc->
BTime1( m_adc3, m_tdc3-m_estime, m_zr2[i], m_tofId2, m_estime );
1925 for(
unsigned int i=0; i<5; i++ ) {
1926 m_tof22[i] =
tofCaliSvc->
BTime2( m_adc4, m_tdc4-m_estime, m_zr2[i], m_tofId2, m_estime );
1933 for(
unsigned int i=0; i<5; i++ ) {
1940 if( innerLayer && outerLayer ) {
1941 for(
unsigned int i=0; i<5; i++ ) {
1951 for(
unsigned int i=0; i<5; i++ ) {
1952 m_tof11[i] =
tofCaliSvc->
ETime( m_adc1, m_tdc1-m_estime, m_zr1[i], m_tofId1 );
1957 if( (m_quality1&0xa000)!=0 ) { m_quality = 4; }
1964 for(
unsigned int i=0; i<5; i++ ) {
1966 m_tof11[i] =
tofCaliSvc->
EtfTime1( m_adc1, m_tdc1-m_estime, m_zr1[i], m_tofId1, m_strip1, m_estime );
1969 m_tof11[i] =
tofCaliSvc->
EtfTimeMC1( m_adc1, m_tdc1-m_estime, m_zr1[i], m_tofId1, m_strip1, m_estime );
1977 for(
unsigned int i=0; i<5; i++ ) {
1979 m_tof12[i] =
tofCaliSvc->
EtfTime2( m_adc2, m_tdc2-m_estime, m_zr1[i], m_tofId1, m_strip1, m_estime );
1982 m_tof12[i] =
tofCaliSvc->
EtfTimeMC2( m_adc2, m_tdc2-m_estime, m_zr1[i], m_tofId1, m_strip1, m_estime );
1990 for(
unsigned int i=0; i<5; i++ ) {
1992 m_tof21[i] =
tofCaliSvc->
EtfTime1( m_adc3, m_tdc3-m_estime, m_zr2[i], m_tofId2, m_strip2, m_estime );
1995 m_tof21[i] =
tofCaliSvc->
EtfTimeMC1( m_adc3, m_tdc3-m_estime, m_zr2[i], m_tofId2, m_strip2, m_estime );
2003 for(
unsigned int i=0; i<5; i++ ) {
2005 m_tof22[i] =
tofCaliSvc->
EtfTime2( m_adc4, m_tdc4-m_estime, m_zr2[i], m_tofId2, m_strip2, m_estime );
2008 m_tof22[i] =
tofCaliSvc->
EtfTimeMC2( m_adc4, m_tdc4-m_estime, m_zr2[i], m_tofId2, m_strip2, m_estime );
2024 for(
unsigned int i=1; i<5; i++ ) {
2025 m_tof1[i] = m_tof1[0];
2027 m_ph1 = ( m_adc1 + m_adc2 )/2.0;
2039 for(
unsigned int i=1; i<5; i++ ) {
2040 m_tof2[i] = m_tof2[0];
2042 m_ph2 = ( m_adc3 + m_adc4 )/2.0;
2051 if( innerLayer && outerLayer ) {
2056 if( innerLayer || outerLayer ) {
2061 if( innerEast || innerWest || outerEast || outerWest ) {
2068 if( ( (m_quality1&0xa000)!=0 ) || ( (m_quality2&0xa000)!=0 ) ) {
2069 m_quality = m_quality + 3;
2073 if( ( (m_quality1&0x100)==0x100 ) || ( (m_quality2&0x100)==0x100 ) ) {
2074 if( ( m_quality == 1 ) || ( m_quality == 4 ) ) { m_quality = 7; }
2075 else if( ( m_quality == 2 ) || ( m_quality == 5 ) ) { m_quality = 8; }
2076 else if( ( m_quality == 3 ) || ( m_quality == 6 ) ) { m_quality = 9; }
2078 cout <<
"TofRec::TofTrack::setCalibration: Impossible!" << endl;
2095 bool innerEast = ( ( m_quality1 & 0xc ) == 0xc );
2096 bool innerWest = ( ( m_quality1 & 0x3 ) == 0x3 );
2097 bool outerEast = ( ( m_quality2 & 0xc ) == 0xc );
2098 bool outerWest = ( ( m_quality2 & 0x3 ) == 0x3 );
2114 if( outerEast && outerWest ) {
2122 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 11- Impossible!" << endl;
2127 recTofTrackCol->push_back( atrack11 );
2142 if( outerEast && outerWest ) {
2150 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 12- Impossible!" << endl;
2155 recTofTrackCol->push_back( atrack12 );
2158 if( innerEast && innerWest ) {
2166 if( outerEast && outerWest ) {
2174 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 1- Impossible!" << endl;
2178 recTofTrackCol->push_back( atrack1 );
2193 if( innerEast || innerWest ) {
2201 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 21- Impossible!" << endl;
2206 recTofTrackCol->push_back( atrack21 );
2221 if( innerEast || innerWest ) {
2229 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 22- Impossible!" << endl;
2234 recTofTrackCol->push_back( atrack22 );
2237 if( outerEast && outerWest ) {
2245 if( innerEast && innerWest ) {
2253 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 2- Impossible!" << endl;
2257 recTofTrackCol->push_back( atrack2 );
2260 if( innerEast && innerWest && outerEast && outerWest ) {
2267 recTofTrackCol->push_back( atrack );
2283 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: endcap- Impossible!" << endl;
2287 recTofTrackCol->push_back( atrack );
2292 if( innerEast || innerWest ) {
2306 recTofTrackCol->push_back( atrack1 );
2321 recTofTrackCol->push_back( atrack2 );
2324 if( innerEast && innerWest ) {
2336 recTofTrackCol->push_back( atrack );
2354 recTofTrackCol->push_back( atrack1 );
2369 recTofTrackCol->push_back( atrack2 );
2372 if( outerEast && outerWest ) {
2384 recTofTrackCol->push_back( atrack );
2391 if( m_hitCase ==
NoHit ) {
2398 recTofTrackCol->push_back( atrack );
2415 for(
int i=0; i<6; i++ ) {
2420 track->
setT0( m_estime );
2427 if( ( layerorend == 11 ) || ( layerorend == 12 ) || ( layerorend == 1 ) ) {
2432 track->
setTofID( 12*m_tofId1+m_strip1 );
2437 track->
setTexp( m_texpInner );
2442 if( ( layerorend==21 ) || ( layerorend==22 ) || ( layerorend==2 ) ) {
2447 track->
setTofID( 12*m_tofId2+m_strip2 );
2452 track->
setTexp( m_texpOuter );
2457 if( layerorend==0 ) {
2467 if( layerorend == 3 ) {
2472 track->
setTofID( 12*m_id1 + m_strip1 );
2477 track->
setTexp( m_texpInner );
2487 for(
unsigned int i=0; i<6; i++ ) {
2491 if( layerorend == 0 ) {
2492 track->
setPh( m_ph );
2493 track->
setTof( m_tof[0] );
2495 for(
unsigned int i=0; i<5; i++ ) {
2496 toffset[i] = m_tof[0] - m_tof[i];
2499 track->
setBeta( m_path/m_tof[0]/30.0 );
2501 else if( layerorend == 1 ) {
2502 track->
setPh( m_ph1 );
2503 track->
setTof( m_tof1[0] );
2505 for(
unsigned int i=0; i<5; i++ ) {
2506 toffset[i] = m_tof1[0] - m_tof1[i];
2509 track->
setBeta( m_path1/m_tof1[0]/30.0 );
2511 else if( layerorend == 2 ) {
2512 track->
setPh( m_ph2 );
2513 track->
setTof( m_tof2[0] );
2515 for(
unsigned int i=0; i<5; i++ ) {
2516 toffset[i] = m_tof2[0] - m_tof2[i];
2519 track->
setBeta( m_path2/m_tof2[0]/30.0 );
2521 else if( layerorend == 11 ) {
2522 track->
setPh( m_ph11 );
2523 track->
setTof( m_tof11[0] );
2525 for(
unsigned int i=0; i<5; i++ ) {
2526 toffset[i] = m_tof11[0] - m_tof11[i];
2529 track->
setBeta( m_path1/m_tof11[0]/30.0 );
2531 else if( layerorend == 12 ) {
2532 track->
setPh( m_ph12 );
2533 track->
setTof( m_tof12[0] );
2535 for(
unsigned int i=0; i<5; i++ ) {
2536 toffset[i] = m_tof12[0] - m_tof12[i];
2539 track->
setBeta( m_path1/m_tof12[0]/30.0 );
2541 else if( layerorend == 21 ) {
2542 track->
setPh( m_ph21 );
2543 track->
setTof( m_tof21[0] );
2545 for(
unsigned int i=0; i<5; i++ ) {
2546 toffset[i] = m_tof21[0] - m_tof21[i];
2549 track->
setBeta( m_path2/m_tof21[0]/30.0 );
2551 else if( layerorend == 22 ) {
2552 track->
setPh( m_ph22 );
2553 track->
setTof( m_tof22[0] );
2555 for(
unsigned int i=0; i<5; i++ ) {
2556 toffset[i] = m_tof22[0] - m_tof22[i];
2559 track->
setBeta( m_path2/m_tof22[0]/30.0 );
2562 cout <<
"TofRec TofTrack::SetRecTofTrack layerorend = " << layerorend << endl;
2570 if( ( m_quality1 & 0x800 ) == 0x800 ) {
2573 ahit->
setRun( runNumber );
2575 ahit->
setMod( m_tofId1 );
2579 for(
int i=0; i<5; i++ ) {
2580 ahit->
setTpred( i, m_texpInner[i] );
2582 if( calibData ==
"Dimu" ) {
2593 ahit->
setTdc1( m_tdc1-m_estime );
2594 ahit->
setTdc2( m_tdc2-m_estime );
2601 ahit->
setP( m_momentum );
2602 ahit->
setQ( m_ph1 );
2605 btofCalHitCol->push_back( ahit );
2607 if( ( m_quality2 & 0x800 ) == 0x800 ) {
2610 bhit->
setRun( runNumber );
2612 bhit->
setMod( m_tofId2 );
2616 for(
int i=0; i<5; i++ ) {
2617 bhit->
setTpred( i, m_texpOuter[i] );
2619 if( calibData ==
"Dimu" ) {
2630 bhit->
setTdc1( m_tdc3-m_estime );
2631 bhit->
setTdc2( m_tdc4-m_estime );
2638 bhit->
setP( m_momentum );
2639 bhit->
setQ( m_ph2 );
2644 btofCalHitCol->push_back( bhit );
2655 if( ( m_quality1 & 0x800 ) != 0x800 )
return;
2658 chit->
setRun( runNumber );
2660 chit->
setMod( m_tofId1 );
2663 for(
int i=0; i<5; i++ ) {
2664 chit->
setTpred( i, m_texpInner[i] );
2666 if( calibData ==
"Dimu" ) {
2677 chit->
setTdc( m_tdc1-m_estime );
2683 chit->
setQ( m_ph1 );
2684 chit->
setP( m_momentum );
2687 etofCalHitCol->push_back( chit );
2695 if( ( m_quality1 & 0x800 ) == 0x800 ) {
2698 ahit->
setRun( runNumber );
2700 ahit->
setMod( m_tofId1 );
2704 for(
int i=0; i<5; i++ ) {
2705 ahit->
setTpred( i, m_texpInner[i] );
2707 if( calibData ==
"Dimu" ) {
2716 ahit->
setTdc1( m_tdc1-m_estime );
2717 ahit->
setTdc2( m_tdc2-m_estime );
2722 ahit->
setP( m_momentum );
2723 ahit->
setQ( m_ph1 );
2726 btofCalHitCol->push_back( ahit );
2729 if( ( m_quality2 & 0x800 ) == 0x800 ) {
2732 bhit->
setRun( runNumber );
2734 bhit->
setMod( m_tofId2 );
2738 for(
int i=0; i<5; i++ ) {
2739 bhit->
setTpred( i, m_texpOuter[i] );
2741 if( calibData ==
"Dimu" ) {
2750 bhit->
setTdc1( m_tdc3-m_estime );
2751 bhit->
setTdc2( m_tdc4-m_estime );
2756 bhit->
setP( m_momentum );
2757 bhit->
setQ( m_ph2 );
2760 btofCalHitCol->push_back( bhit );
DOUBLE_PRECISION count[3]
ObjectVector< RecBTofCalHit > RecBTofCalHitCol
ObjectVector< RecETofCalHit > RecETofCalHitCol
ObjectVector< RecTofTrack > RecTofTrackCol
std::multimap< unsigned int, TofData * > TofDataMap
std::multimap< unsignedint, TofData * >::iterator IterTofDataMap
const double tof1Path() const
const Hep3Vector tof1Position() const
const int tof1VolumeNumber() const
const double tof1() const
const Hep3Vector tof2Momentum() const
const Hep3Vector tof1Momentum() const
const double tof2() const
const double tof2PosSigmaAlongZ() const
const double tof1PosSigmaAlongX() const
const double tof2Path() const
const int trackId() const
const double tof1PosSigmaAlongY() const
const double tof2PosSigmaAlongX() const
const double tof1PosSigmaAlongZ() const
const int tof2VolumeNumber() const
const Hep3Vector tof2Position() const
void setStatus(unsigned int status)
void setSigma(double sigma[6])
void setToffset(double toffset[6])
void setEnergy(double energy)
void setPath(double path)
void setTofTrackID(int tofTrackID)
void setQuality(int quality)
void setZrHit(double zrhit)
void setErrTof(double etof)
void setErrT0(double errt0)
void setTexp(double texp[5])
void setBeta(double beta)
void setErrEnergy(double errenergy)
void setTrackID(int trackID)
void setErrZ(double errz)
void setErrPhi(double errphi)
void setSigmaElectron(double se)
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 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 setsinTheta(double sint)
void setnext(RecBTofCalHit *n)
void setTdc2(double tdc2)
void setdZHit(double dzHit)
void setAdc2(double adc2)
void setTdc1(double tdc1)
void setZHit(double zHit)
void setDeltaPhi(double deltaPhi)
void setTpred(int idx, double t)
void setAdc1(double adc1)
void setdRHit(double drHit)
void setDeltaPhi(double deltaPhi)
void setRHit(double rHit)
void setcosTheta(double cost)
void setTpred(int idx, double t)
unsigned int quality() const
void setMRPCReadout(bool east)
unsigned int value() const
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 int endcap(const Identifier &id)
static int strip(const Identifier &id)
static Identifier cell_id(int barrel_ec, int layer, int phi_module, int end)
For a single crystal.
static int end(const Identifier &id)
static bool is_mrpc(const Identifier &id)
static int phi_module(const Identifier &id)
static int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
static value_type getIntID(int barrel_ec, int layer, int phi_module, int end)
static int layer(const Identifier &id)
void setTofData(TofDataMap tofDataMap)
double tof2(unsigned int i) const
std::vector< TofData * > tofData1() const
TofData * chooseTofDataEndcap(std::vector< TofData * > tofDataVec, double zr1[5])
ExtTrackCase hitCase() const
double zr1(unsigned int i) const
int kal(unsigned int i) const
void getEtfData(TofData *tof, unsigned int iflag, unsigned int qual)
unsigned int quality1() const
double tof(unsigned int i) const
void convert2RecTofTrackCol(RecTofTrackCol *recTofTrackCol)
void tofDataAnalysis(TofData *tof, unsigned int iflag)
void findEtfData(std::vector< TofData * > tofDataVec1, std::vector< TofData * > tofDataVec2, std::vector< TofData * > tofDataVec3, double zrhit, unsigned int iflag)
void buildRecTofTrack(RecTofTrack *track, int layerorend)
void getTofData(TofData *tof, unsigned int iflag)
void match(bool forCalibration, std::vector< int > deadId, std::vector< TofTrack * > *&tofTrackVec)
void findTofDataEndcap(std::vector< TofData * > tofDataVec1, std::vector< TofData * > tofDataVec2, double zr1[5])
TofData * chooseEtfData2(std::vector< TofData * > tofDataVec, double zrhit)
double tof1(unsigned int i) const
void setQuality1(int qual1)
TofTrack(int run, int event)
void setRecTofTrack(RecTofTrack *track, int layerorend)
void convert2RecBTofCalHitColBarrel(int runNumber, int eventNumber, RecBTofCalHitCol *btofCalHitCol, std::string calibData)
void convert2RecETofCalHitCol(int runNumber, int eventNumber, RecETofCalHitCol *etofCalHitCol, std::string calibData)
void convert2RecBTofCalHitColETF(int runNumber, int eventNumber, RecBTofCalHitCol *btofCalHitCol, std::string calibData)
TofData * compareTofData(TofData *tofData1, TofData *tofData2, double zrhit)
void getTofDataNohit(unsigned int iflag)
TofData * chooseTofData(std::vector< TofData * > tofDataVec, double zrhit)
void getTofDataWest(TofData *tof, unsigned int iflag)
TofData * chooseEtfData1(std::vector< TofData * > tofDataVec, double zrhit)
void getMultiHit(TofTrack *&)
void setQuality2(int qual2)
TofData * compareTofDataEndcap(TofData *tofData1, TofData *tofData2)
std::vector< TofData * > tofData2() const
unsigned int barrel() const
void setExtTrack(RecExtTrack *extTrack, double costheta, double p[5], int kal[5], double t0, int t0Stat)
void getTofDataEast(TofData *tof, unsigned int iflag)
void findTofDataBarrel(std::vector< TofData * > tofDataVec1, std::vector< TofData * > tofDataVec2, double zrhit, unsigned int iflag, std::vector< TofTrack * > *&tofTrackVec)
unsigned int quality2() const