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"
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 ) {
71 for(
unsigned int i=0; i<5; i++ ) {
102 for(
unsigned int i=0; i<5; i++ ) {
103 m_texpInner[i] = -99.0;
104 m_texpOuter[i] = -99.0;
124 if( m_tofData1.size()>0 ) {
127 if( m_tofData2.size()>0 ) {
130 if( m_tofData3.size()>0 ) {
133 if( m_tofData4.size()>0 ) {
189 if( iExist1 == -1 ) { iExist1 = 2; }
190 if( iExist2 == -1 ) { iExist2 = 2; }
199 m_id1 =
tofId1 - 176 + 48;
209 m_id1 =
tofId1 - 176 - 48;
219 m_id1 =
tofId1 - 176 - 96;
220 m_istrip1 = m_id1%12;
254 else if( m_hitCase==
NoHit ) {
259 m_id2 =
tofId2 - 176 - 96;
260 m_istrip2 = m_id2%12;
286 m_trackId = extTrack->
trackId();
294 m_path1 = extTrack->
tof1Path(iExist1);
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;
310 for(
unsigned int i=0; i<5; i++ ) {
313 if( fabs(m_zr1[i]+99.0)<1.0e-6 ) {
315 m_ezr1[i] = m_errzr1;
324 for(
unsigned int i=0; i<5; i++ ) {
327 if( fabs(m_zr1[i]+99.0)<1.0e-6 ) {
329 m_ezr1[i] = m_errzr1;
338 for(
unsigned int i=0; i<5; i++ ) {
341 if( fabs(m_zr1[i]+99.0)<1.0e-6 ) {
343 m_ezr1[i] = m_errzr1;
350 m_path2 = extTrack->
tof2Path(iExist2);
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;
366 for(
unsigned int i=0; i<5; i++ ) {
369 if( fabs(m_zr2[i]+99.0)<1.0e-6 ) {
371 m_ezr2[i] = m_errzr2;
380 for(
unsigned int i=0; i<5; i++ ) {
383 if( fabs(m_zr2[i]+99.0)<1.0e-6 ) {
385 m_ezr2[i] = m_errzr2;
391 if( m_hitCase ==
NoHit ) { m_quality = 11; }
393 for(
unsigned int i=0; i<5; i++ ) {
408 if( (
abs(m_id1-track->
id1())<=1 ) || ( m_id1==0 && track->
id1()==87 ) || ( m_id1==87 && track->
id1()==0 ) ) {
410 m_quality1 = ( m_quality1 | 0x400 );
415 if( (
abs(m_id2-track->
id2())<=1 ) || ( m_id2==88 && track->
id2()==175 ) || ( m_id2==175 && track->
id2()==88 ) ) {
417 m_quality2 = ( m_quality2 | 0x400 );
424 if( (
abs(m_id1-track->
id1())<=1 ) || ( m_id1==0 && track->
id1()==47 ) || ( m_id1==47 && track->
id1()==0 ) ) {
426 m_quality1 = ( m_quality1 | 0x400 );
432 if( (
abs(m_id1-track->
id1())<=1 ) || ( m_id1==48 && track->
id1()==95 ) || ( m_id1==95 && track->
id1()==48 ) ) {
434 m_quality1 = ( m_quality1 | 0x400 );
441 if( ( m_id1==track->
id1() ) &&
abs(m_istrip1-track->
strip1())<=1 ) {
443 m_quality1 = ( m_quality1 | 0x400 );
447 if( ( m_id2==track->
id2() ) &&
abs(m_istrip2-track->
strip2())<=1 ) {
449 m_quality1 = ( m_quality1 | 0x400 );
466 if( m_hitCase ==
NoHit )
return;
468 unsigned int identify[11];
469 unsigned int count[11];
470 for(
unsigned int i=0; i<11; i++ ) {
471 identify[i] = 0x0000c000;
474 unsigned int countTot1 = 0;
475 unsigned int countTot2 = 0;
480 count[0] = tofDataMap.count( identify[0] );
481 int tofid1 = tofid0 - 1;
482 if( tofid1 == -1 ) { tofid1 = 87; }
484 count[1] = tofDataMap.count( identify[1] );
485 int tofid2 = tofid0 + 1;
486 if( tofid2 == 88 ) { tofid2 = 0; }
488 count[2] = tofDataMap.count( identify[2] );
492 unsigned int whichEndcap = 0;
499 count[0] = tofDataMap.count( identify[0] );
500 int tofid1 = tofid0 - 1;
501 if( tofid1 == -1 ) { tofid1 = 47; }
503 count[1] = tofDataMap.count( identify[1] );
504 int tofid2 = tofid0 + 1;
505 if( tofid2 == 48 ) { tofid2 = 0; }
507 count[2] = tofDataMap.count( identify[2] );
512 for( ;
iter != tofDataMap.end();
iter++ ) {
516 if( m_id1 ==
tof->tofId() &&
abs( m_istrip1 -
tof->strip() )<=
abs(m_delStrip1) ) {
517 m_delStrip1 = m_istrip1 -
tof->strip();
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();
525 unsigned int whichEndcap = 0;
531 int strip0 = m_istrip1;
533 count[0] = tofDataMap.count( identify[0] );
535 if(
strip1 == -1 ) { count[1] = 0; }
538 count[1] = tofDataMap.count( identify[1] );
541 if(
strip2 == 12 ) { count[2] = 0; }
544 count[2] = tofDataMap.count( identify[2] );
546 int strip3 = strip0 - 2;
547 if( strip3 == -1 || strip3 == -2 ) { count[3] = 0; }
550 count[3] = tofDataMap.count( identify[3] );
552 int strip4 = strip0 + 2;
553 if( strip4 == 12 || strip4 == 13 ) { count[4] = 0; }
556 count[4] = tofDataMap.count( identify[4] );
558 int tofid1 = tofid0 - 1;
559 if( tofid1 == -1 ) { tofid1 = 35; }
561 count[5] = tofDataMap.count( identify[5] );
562 int tofid2 = tofid0 + 1;
563 if( tofid2 == 36 ) { tofid2 = 0; }
565 count[6] = tofDataMap.count( identify[6] );
567 count[7] = tofDataMap.count( identify[7] );
569 count[8] = tofDataMap.count( identify[8] );
571 count[9] = tofDataMap.count( identify[9] );
573 count[10] = tofDataMap.count( identify[10] );
576 for(
unsigned int i=0; i<11; i++ ) {
578 pair< IterTofDataMap, IterTofDataMap > range = tofDataMap.equal_range( identify[i] );
580 for(
unsigned int j=0; j<count[i]; j++,
iter++ ) {
584 else if( i==1 || i==2 ) {
592 countTot1 = countTot1 + count[i];
595 if( countTot1 == 0 ) {
608 int tofid0 = m_id2 - 88;
610 count[0] = tofDataMap.count( identify[0] );
611 int tofid1 = tofid0 - 1;
612 if( tofid1 == -1 ) { tofid1 = 87; }
614 count[1] = tofDataMap.count( identify[1] );
615 int tofid2 = tofid0 + 1;
616 if( tofid2 == 88 ) { tofid2 = 0; }
618 count[2] = tofDataMap.count( identify[2] );
620 for(
unsigned int i=0; i<3; i++ ) {
622 pair< IterTofDataMap, IterTofDataMap > range = tofDataMap.equal_range( identify[i] );
624 for(
unsigned int j=0; j<count[i]; j++,
iter++ ) {
633 countTot2 = countTot2 + count[i];
636 if( countTot2 == 0 ) {
649 for( ;
iter != tofDataMap.end();
iter++ ) {
653 if( m_id2 ==
tof->tofId() &&
abs( m_istrip2 -
tof->strip() )<=
abs(m_delStrip1) ) {
654 m_delStrip1 = m_istrip2 -
tof->strip();
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();
662 unsigned int whichEndcap = 0;
668 int strip0 = m_istrip2;
670 count[0] = tofDataMap.count( identify[0] );
672 if(
strip1 == -1 ) { count[1] = 0; }
675 count[1] = tofDataMap.count( identify[1] );
678 if(
strip2 == 12 ) { count[2] = 0; }
681 count[2] = tofDataMap.count( identify[2] );
683 int strip3 = strip0 - 2;
684 if( strip3 == -1 || strip3 == -2 ) { count[3] = 0; }
687 count[3] = tofDataMap.count( identify[3] );
689 int strip4 = strip0 + 2;
690 if( strip4 == 12 || strip4 == 13 ) { count[4] = 0; }
693 count[4] = tofDataMap.count( identify[4] );
695 int tofid1 = tofid0 - 1;
696 if( tofid1 == -1 ) { tofid1 = 35; }
698 count[5] = tofDataMap.count( identify[5] );
699 int tofid2 = tofid0 + 1;
700 if( tofid2 == 36 ) { tofid2 = 0; }
702 count[6] = tofDataMap.count( identify[6] );
704 count[7] = tofDataMap.count( identify[7] );
706 count[8] = tofDataMap.count( identify[8] );
708 count[9] = tofDataMap.count( identify[9] );
710 count[10] = tofDataMap.count( identify[10] );
712 for(
unsigned int i=0; i<11; i++ ) {
714 pair< IterTofDataMap, IterTofDataMap > range = tofDataMap.equal_range( identify[i] );
716 for(
unsigned int j=0; j<count[i]; j++,
iter++ ) {
720 else if( i==1 || i==2 ) {
728 countTot2 = countTot2 + count[i];
732 if( countTot1==0 && countTot2==0 ) {
746 unsigned int qual =
tof->quality();
748 if( ( qual & 0x10 ) == 0 ) {
749 qual = ( qual | 0x10 );
750 if(
tof->barrel() ||
tof->is_mrpc() ) {
751 if( (
tof->quality() == 0x7 ) || (
tof->quality() == 0xd ) ) {
752 qual = ( qual | 0x20 );
755 if( (
tof->quality() == 0xb ) || (
tof->quality() == 0xe ) ) {
756 qual = ( qual | 0x40 );
759 if( (
tof->quality() == 0x3 ) || (
tof->quality() == 0xc ) ) {
760 qual = ( qual | 0x80 );
763 if(
tof->barrel() ) {
764 if( (
tof->quality() & 0x5 ) == 0x5 ) {
766 tof->setZTdc( ztdc );
769 if( (
tof->quality() & 0xa ) == 0xa ) {
771 tof->setZAdc( zadc );
774 if(
tof->is_mrpc() ) {
775 if( (
tof->quality() & 0x5 ) == 0x5 ) {
777 tof->setZTdc( ztdc );
780 tof->setQuality( qual );
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 ); }
790 cout <<
"TofRec::TofTrack::TofDataAnalylsis: the Flag should be 1-4, out of the Range!" << endl;
800void TofTrack::match(
bool forCalibration, std::vector<int> deadId, std::vector<TofTrack*>*& tofTrackVec ) {
802 if( m_hitCase ==
NoHit )
return;
806 if( ( m_quality1 & 0x10 ) == 0 ) { m_hitCase =
NoHit; }
810 if( ( m_quality2 & 0x10 ) == 0 ) { m_hitCase =
NoHit; }
814 if( ( m_quality1 & 0x10 ) == 0 ) { m_hitCase =
OuterLayer; }
816 if( ( m_quality2 & 0x10 ) == 0 ) {
824 cout <<
"TofRec::TofTrack::match: 2- Impossible!" << endl;
832 findEtfData( m_tofData1, m_tofData2, m_tofData3, m_zrhit1, 1 );
833 findEtfData( m_tofData4, m_tofData5, m_tofData6, m_zrhit2, 2 );
836 cout <<
"TofRec::TofTrack::match: 1- Impossible!" << endl;
839 if( forCalibration ) {
842 if( ( ( m_quality1 & 0xf ) == 0xf ) && ( ( m_quality2 & 0xf ) == 0xf ) ) {
843 m_quality1 = ( m_quality1 | 0x800 );
844 m_quality2 = ( m_quality2 | 0x800 );
847 std::vector<int>::iterator
iter = deadId.begin();
848 for( ;
iter != deadId.end();
iter++ ) {
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 );
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 );
882 if( ( m_quality1 & 0xf ) == 0xf ) {
883 m_quality1 = ( m_quality1 | 0x800 );
886 std::vector<int>::iterator
iter = deadId.begin();
887 for( ;
iter != deadId.end();
iter++ ) {
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 );
907 if( ( ( m_hitCase ==
EastEndcap ) || ( m_hitCase ==
WestEndcap ) ) && ( ( m_quality1 & 0xf ) == 0xc ) ) {
908 m_quality1 = ( m_quality1 | 0x800 );
913 if( ( ( m_quality1 & 0xf000 ) == 0x1000 ) || ( ( m_quality1 & 0xf000 ) == 0x2000 ) ) {
914 if( ( m_quality1 & 0xf ) == 0xf ) {
915 m_quality1 = ( m_quality1 | 0x800 );
918 if( ( ( m_quality2 & 0xf000 ) == 0x1000 ) || ( ( m_quality2 & 0xf000 ) == 0x2000 ) ) {
919 if( ( m_quality2 & 0xf ) == 0xf ) {
920 m_quality2 = ( m_quality2 | 0x800 );
935void TofTrack::findTofDataBarrel( std::vector<TofData*> tofDataVec1, std::vector<TofData*> tofDataVec2,
double zrhit,
unsigned int iflag, std::vector<TofTrack*>*& tofTrackVec ) {
937 unsigned int qual = 0xf;
939 if( tofDataVec2.size() == 0 ) {
940 if( tofDataVec1.size() == 0 ) {
943 else if( tofDataVec1.size() == 1 ) {
944 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
948 else if( tofDataVec1.size() > 1 ) {
953 cout <<
"TofRec::TofTrack::findTofDataBarrel: 1- Impossible!" << endl;
956 else if( ( tofDataVec2.size() == 1 ) ) {
957 if( tofDataVec1.size() == 0 ) {
958 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
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 ) {
968 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
973 else if( tofDataVec1.size() > 1 ) {
979 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
985 cout <<
"TofRec::TofTrack::findTofDataBarrel: 2- Impossible!" << endl;
988 else if( ( tofDataVec2.size() > 1 ) ) {
989 if( tofDataVec1.size() == 0 ) {
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 ) {
1004 else if( tofDataVec1.size() > 1 ) {
1016 cout <<
"TofRec::TofTrack::findTofDataBarrel: 3- Impossible!" << endl;
1021 if( !(
tof->used()) ) {
1025 bool z1=
false, z2=
false;
1026 bool zc1=
false, zc2=
false;
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() ) {
1036 zc2 = ( (*iter)->zrhit1() >
tof->ztdc() );
1040 else if( iflag==2 ) {
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() ) {
1048 zc2 = ( (*iter)->zrhit2() >
tof->ztdc() );
1053 if( ( z1 && z2 )||( (!z1) && (!z2) ) ) {
1058 else if( !zc1 && zc2 ) {
1063 else if( z1 && !z2 ) {
1067 else if( !z1 && z2 ) {
1074 if( ( iflag == 1 ) || ( iflag == 3 ) ) {
1075 m_quality1 = ( m_quality1 | 0x300 );
1077 else if( iflag == 2 ) {
1078 m_quality2 = ( m_quality2 | 0x300 );
1081 cout <<
"TofRec::TofTrack::findTofDataBarrel: the 1- IFLAG is Out of Range!" << endl;
1085 qual = ( qual << 12 );
1086 if( ( iflag == 1 ) || ( iflag == 3 ) ) {
1087 m_quality1 = ( m_quality1 | qual );
1089 else if( iflag == 2 ) {
1090 m_quality2 = ( m_quality2 | qual );
1093 cout <<
"TofRec::TofTrack::findTofDataBarrel: the 2- IFLAG is Out of Range!" << endl;
1106 if( tofDataVec.size() == 0 ) {
1107 cout <<
"TofRec::TofTrack::ChooseTofData: Size of TofData Vector is Zero!" << endl;
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();
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 );
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 );
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 ) {
1142 ibad = ( (*iter)->quality() & 0xf0 );
1144 else if( ( (*iter)->quality() & 0xf0 ) == ibad ) {
1145 if( ( (*iter)->adc1() + (*iter)->adc2() ) > ( (*igood)->adc1() + (*igood)->adc2() ) ) {
1147 ibad = ( (*iter)->quality() & 0xf0 );
1186 unsigned int iflag = 3;
1187 unsigned int qual = 0xf;
1189 if( tofDataVec2.size() == 0 ) {
1190 if( tofDataVec1.size() == 0 ) {
1193 else if( tofDataVec1.size() == 1 ) {
1194 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1198 else if( tofDataVec1.size() > 1 ) {
1203 cout <<
"TofRec::TofTrack::findTofDataEndcap: 1- Impossible!" << endl;
1206 else if( ( tofDataVec2.size() == 1 ) ) {
1207 if( tofDataVec1.size() == 0 ) {
1208 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1212 else if( tofDataVec1.size() == 1 ) {
1213 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1214 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1218 else if( tofDataVec1.size() > 1 ) {
1220 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1225 cout <<
"TofRec::TofTrack::findTofDataBarrel: 2- Impossible!" << endl;
1228 else if( ( tofDataVec2.size() > 1 ) ) {
1229 if( tofDataVec1.size() == 0 ) {
1233 else if( tofDataVec1.size() == 1 ) {
1234 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1239 else if( tofDataVec1.size() > 1 ) {
1246 cout <<
"TofRec::TofTrack::findTofDataBarrel: 3- Impossible!" << endl;
1251 m_quality1 = ( m_quality1 | 0x300 );
1254 qual = ( qual << 12 );
1255 m_quality1 = ( m_quality1 | qual );
1266 if( tofDataVec.size() == 0 ) {
1267 cout <<
"TofRec::TofTrack::ChooseTofData: Size of TofData Vector is Zero!" << endl;
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; }
1277 iter = tofDataVec.begin();
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]);
1293 for( ;
iter != tofDataVec.end();
iter++ ) {
1294 if( (*iter)->adc() > maxQ ) {
1295 maxQ = (*iter)->adc();
1321void TofTrack::findEtfData( std::vector<TofData*> tofDataVec1, std::vector<TofData*> tofDataVec2, std::vector<TofData*> tofDataVec3,
double zrhit,
unsigned int iflag ) {
1327 bool findSignal =
false;
1329 if( tofDataVec1.size()==0 && tofDataVec2.size()==0 && tofDataVec3.size()==0 ) {
1331 m_quality1 = ( m_quality1 | 0x300 );
1333 else if( iflag == 2 ) {
1334 m_quality2 = ( m_quality2 | 0x300 );
1338 if( tofDataVec1.size()>0 ) {
1340 if( (
tof1->quality() & 0xf ) == 0xf ) {
1345 if( !findSignal && tofDataVec2.size() > 0 ) {
1347 if( (
tof2->quality() & 0xf ) == 0xf ) {
1352 if( !findSignal && tofDataVec3.size() > 0 ) {
1354 if( ( tof3->
quality() & 0xf ) == 0xf ) {
1359 if( !findSignal && tofDataVec1.size()>0 ) {
1360 if( ( (
tof1->quality() & 0xf ) == 0xc ) || ( (
tof1->quality() & 0xf ) == 0x3 ) ) {
1365 if( !findSignal && tofDataVec2.size() > 0 ) {
1366 if( ( (
tof2->quality() & 0xf ) == 0xc ) || ( (
tof2->quality() & 0xf ) == 0x3 ) ) {
1371 if( !findSignal && tofDataVec3.size() > 0 ) {
1372 if( ( ( tof3->
quality() & 0xf ) == 0xc ) || ( ( tof3->
quality() & 0xf ) == 0x3 ) ) {
1379 m_quality1 = ( m_quality1 | 0x300 );
1381 else if( iflag == 2 ) {
1382 m_quality2 = ( m_quality2 | 0x300 );
1394 if( tofDataVec.size() == 0 ) {
1397 std::vector<TofData*>::iterator igood = tofDataVec.begin();
1398 if( tofDataVec.size() == 1 ) {
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 );
1413 if( deltaZ > 999.0 ) {
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();
1423 else if( ( (*iter)->quality() & 0x3 ) == 0x3 ) {
1424 if( (*iter)->adc2() > maxQ ) {
1425 maxQ = (*iter)->adc2();
1440 if( tofDataVec.size() == 0 ) {
1443 std::vector<TofData*>::iterator igood = tofDataVec.begin();
1444 if( tofDataVec.size() == 1 ) {
1447 else if( tofDataVec.size() > 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();
1457 else if( ( (*iter)->quality() & 0x3 ) == 0x3 ) {
1458 if( (*iter)->adc2() > maxQ ) {
1459 maxQ = (*iter)->adc2();
1475 m_tofId1 =
tof->tofId();
1476 m_strip1 =
tof->strip();
1478 m_qch1 =
tof->qtc1();
1481 m_qch1 =
tof->adcChannelEast();
1483 m_adc1 =
tof->adc1();
1484 m_tdc1 =
tof->tdc1();
1486 m_qch2 =
tof->qtc2();
1489 m_qch2 =
tof->adcChannelWest();
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 );
1499 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && (
abs(
tof->zadc() - m_zrhit1 ) >
zadc_Cut ) ) ) {
1500 m_quality1 = ( m_quality1 | 0x200 );
1503 else if( iflag == 2 ) {
1504 m_tofId2 =
tof->tofId();
1505 m_strip2 =
tof->strip();
1507 m_qch3 =
tof->qtc1();
1510 m_qch3 =
tof->adcChannelEast();
1512 m_adc3 =
tof->adc1();
1513 m_tdc3 =
tof->tdc1();
1515 m_qch4 =
tof->qtc2();
1518 m_qch4 =
tof->adcChannelWest();
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 );
1528 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && (
abs(
tof->zadc() - m_zrhit2 ) >
zadc_Cut ) ) ) {
1529 m_quality2 = ( m_quality2 | 0x200 );
1532 else if( iflag == 3 ) {
1533 m_tofId1 =
tof->tofId();
1535 m_qch1 =
tof->qtc();
1538 m_qch1 =
tof->adcChannel();
1540 m_adc1 =
tof->adc();
1541 m_tdc1 =
tof->tdc();
1542 m_quality1 = ( m_quality1 | ( 0x1f &
tof->quality() ) );
1543 m_quality1 = ( m_quality1 | 0x300 );
1546 cout <<
"TofRec::TofTrack::getTofData: Flag which sign the Barrel/Endcap or Inner/Outer is wrong! Please check it!" << endl;
1559 m_tofId1 =
tof->tofId();
1560 m_strip1 =
tof->strip();
1562 m_qch1 =
tof->qtc1();
1565 m_qch1 =
tof->adcChannelEast();
1567 m_adc1 =
tof->adc1();
1568 m_tdc1 =
tof->tdc1();
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 );
1578 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && (
abs(
tof->zadc() - m_zrhit1 ) >
zadc_Cut ) ) ) {
1579 m_quality1 = ( m_quality1 | 0x200 );
1582 else if( iflag == 2 ) {
1583 m_tofId2 =
tof->tofId();
1585 m_qch3 =
tof->qtc1();
1588 m_qch3 =
tof->adcChannelEast();
1590 m_adc3 =
tof->adc1();
1591 m_tdc3 =
tof->tdc1();
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 );
1601 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && (
abs(
tof->zadc() - m_zrhit2 ) >
zadc_Cut ) ) ) {
1602 m_quality2 = ( m_quality2 | 0x200 );
1606 cout <<
"TofRec::TofTrack::getTofDataEast: Flag which sign the Barrel/Endcap or Inner/Outer is wrong! Please check it!" << endl;
1619 m_tofId1 =
tof->tofId();
1620 m_strip1 =
tof->strip();
1625 m_qch2 =
tof->qtc2();
1628 m_qch2 =
tof->adcChannelWest();
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 );
1638 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && (
abs(
tof->zadc() - m_zrhit1 ) >
zadc_Cut ) ) ) {
1639 m_quality1 = ( m_quality1 | 0x200 );
1642 else if( iflag == 2 ) {
1643 m_tofId2 =
tof->tofId();
1648 m_qch4 =
tof->qtc2();
1651 m_qch4 =
tof->adcChannelWest();
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 );
1661 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && (
abs(
tof->zadc() - m_zrhit2 ) >
zadc_Cut ) ) ) {
1662 m_quality2 = ( m_quality2 | 0x200 );
1666 cout <<
"TofRec::TofTrack::getTofDataWest: Flag which sign the Barrel/Endcap or Inner/Outer is wrong! Please check it!" << endl;
1689 m_quality1 = ( m_quality1 & 0x700 );
1693 else if( iflag == 2 ) {
1703 m_quality2 = ( m_quality2 & 0x700 );
1708 cout <<
"TofRec::TofTrack::getTofData: Flag which sign the Barrel/Endcap or Inner/Outer is wrong! Please check it!" << endl;
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 );
1735 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && (
abs(
tof->zadc() - m_zrhit1 ) >
zadc_Cut ) ) ) {
1736 m_quality1 = ( m_quality1 | 0x200 );
1738 m_quality1 = ( m_quality1 | ( qual << 12 ) );
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 );
1756 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && (
abs(
tof->zadc() - m_zrhit2 ) >
zadc_Cut ) ) ) {
1757 m_quality2 = ( m_quality2 | 0x200 );
1759 m_quality2 = ( m_quality2 | ( qual << 12 ) );
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 );
1785 bool endcapData = ( ( m_quality1 & 0xc ) == 0xc );
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 );
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 );
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 );
1812 for(
unsigned int i=0; i<5; i++ ) {
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 );
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 );
1836 for(
unsigned int i=0; i<5; i++ ) {
1843 if( innerLayer && outerLayer ) {
1844 for(
unsigned int i=0; i<5; i++ ) {
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 );
1860 if( (m_quality1&0xa000)!=0 ) { m_quality = 4; }
1867 for(
unsigned int i=0; i<5; i++ ) {
1869 m_tof11[i] =
tofCaliSvc->
EtfTime1( m_adc1, m_tdc1-m_estime, m_zr1[i], m_tofId1, m_strip1, m_estime );
1872 m_tof11[i] =
tofCaliSvc->
EtfTimeMC1( m_adc1, m_tdc1-m_estime, m_zr1[i], m_tofId1, m_strip1, m_estime );
1880 for(
unsigned int i=0; i<5; i++ ) {
1882 m_tof12[i] =
tofCaliSvc->
EtfTime2( m_adc2, m_tdc2-m_estime, m_zr1[i], m_tofId1, m_strip1, m_estime );
1885 m_tof12[i] =
tofCaliSvc->
EtfTimeMC2( m_adc2, m_tdc2-m_estime, m_zr1[i], m_tofId1, m_strip1, m_estime );
1893 for(
unsigned int i=0; i<5; i++ ) {
1895 m_tof21[i] =
tofCaliSvc->
EtfTime1( m_adc3, m_tdc3-m_estime, m_zr2[i], m_tofId2, m_strip2, m_estime );
1898 m_tof21[i] =
tofCaliSvc->
EtfTimeMC1( m_adc3, m_tdc3-m_estime, m_zr2[i], m_tofId2, m_strip2, m_estime );
1906 for(
unsigned int i=0; i<5; i++ ) {
1908 m_tof22[i] =
tofCaliSvc->
EtfTime2( m_adc4, m_tdc4-m_estime, m_zr2[i], m_tofId2, m_strip2, m_estime );
1911 m_tof22[i] =
tofCaliSvc->
EtfTimeMC2( m_adc4, m_tdc4-m_estime, m_zr2[i], m_tofId2, m_strip2, m_estime );
1920 m_tof1[0] =
tofCaliSvc->
EtfTime( m_adc1, m_adc2, m_tdc1-m_estime, m_tdc2-m_estime, m_tofId1, m_strip1, m_estime );
1923 m_tof1[0] =
tofCaliSvc->
EtfTimeMC( m_adc1, m_adc2, m_tdc1-m_estime, m_tdc2-m_estime, m_tofId1, m_strip1, m_estime );
1925 for(
unsigned int i=1; i<5; i++ ) {
1926 m_tof1[i] = m_tof1[0];
1928 m_ph1 = ( m_adc1 + m_adc2 )/2.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 );
1937 m_tof2[0] =
tofCaliSvc->
EtfTimeMC( m_adc3, m_adc4, m_tdc3-m_estime, m_tdc4-m_estime, m_tofId2, m_strip2, m_estime );
1939 for(
unsigned int i=1; i<5; i++ ) {
1940 m_tof2[i] = m_tof2[0];
1942 m_ph2 = ( m_adc3 + m_adc4 )/2.0;
1951 if( innerLayer && outerLayer ) {
1956 if( innerLayer || outerLayer ) {
1961 if( innerEast || innerWest || outerEast || outerWest ) {
1968 if( ( (m_quality1&0xa000)!=0 ) || ( (m_quality2&0xa000)!=0 ) ) {
1969 m_quality = m_quality + 3;
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; }
1978 cout <<
"TofRec::TofTrack::setCalibration: Impossible!" << endl;
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 );
2014 if( outerEast && outerWest ) {
2022 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 11- Impossible!" << endl;
2027 recTofTrackCol->push_back( atrack11 );
2042 if( outerEast && outerWest ) {
2050 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 12- Impossible!" << endl;
2055 recTofTrackCol->push_back( atrack12 );
2058 if( innerEast && innerWest ) {
2066 if( outerEast && outerWest ) {
2074 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 1- Impossible!" << endl;
2078 recTofTrackCol->push_back( atrack1 );
2093 if( innerEast || innerWest ) {
2101 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 21- Impossible!" << endl;
2106 recTofTrackCol->push_back( atrack21 );
2121 if( innerEast || innerWest ) {
2129 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 22- Impossible!" << endl;
2134 recTofTrackCol->push_back( atrack22 );
2137 if( outerEast && outerWest ) {
2145 if( innerEast && innerWest ) {
2153 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 2- Impossible!" << endl;
2157 recTofTrackCol->push_back( atrack2 );
2160 if( innerEast && innerWest && outerEast && outerWest ) {
2167 recTofTrackCol->push_back( atrack );
2183 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: endcap- Impossible!" << endl;
2187 recTofTrackCol->push_back( atrack );
2192 if( innerEast || innerWest ) {
2206 recTofTrackCol->push_back( atrack1 );
2221 recTofTrackCol->push_back( atrack2 );
2224 if( innerEast && innerWest ) {
2236 recTofTrackCol->push_back( atrack );
2254 recTofTrackCol->push_back( atrack1 );
2269 recTofTrackCol->push_back( atrack2 );
2272 if( outerEast && outerWest ) {
2284 recTofTrackCol->push_back( atrack );
2291 if( m_hitCase ==
NoHit ) {
2298 recTofTrackCol->push_back( atrack );
2315 for(
int i=0; i<6; i++ ) {
2320 track->
setT0( m_estime );
2327 if( ( layerorend == 11 ) || ( layerorend == 12 ) || ( layerorend == 1 ) ) {
2332 track->
setTofID( 12*m_tofId1+m_strip1 );
2337 track->
setTexp( m_texpInner );
2342 if( ( layerorend==21 ) || ( layerorend==22 ) || ( layerorend==2 ) ) {
2347 track->
setTofID( 12*m_tofId2+m_strip2 );
2352 track->
setTexp( m_texpOuter );
2357 if( layerorend==0 ) {
2367 if( layerorend == 3 ) {
2372 track->
setTofID( 12*m_id1 + m_strip1 );
2377 track->
setTexp( m_texpInner );
2387 for(
unsigned int i=0; i<6; i++ ) {
2391 if( layerorend == 0 ) {
2392 track->
setPh( m_ph );
2393 track->
setTof( m_tof[0] );
2395 for(
unsigned int i=0; i<5; i++ ) {
2396 toffset[i] = m_tof[0] - m_tof[i];
2399 track->
setBeta( m_path/m_tof[0]/30.0 );
2401 else if( layerorend == 1 ) {
2402 track->
setPh( m_ph1 );
2403 track->
setTof( m_tof1[0] );
2405 for(
unsigned int i=0; i<5; i++ ) {
2406 toffset[i] = m_tof1[0] - m_tof1[i];
2409 track->
setBeta( m_path1/m_tof1[0]/30.0 );
2411 else if( layerorend == 2 ) {
2412 track->
setPh( m_ph2 );
2413 track->
setTof( m_tof2[0] );
2415 for(
unsigned int i=0; i<5; i++ ) {
2416 toffset[i] = m_tof2[0] - m_tof2[i];
2419 track->
setBeta( m_path2/m_tof2[0]/30.0 );
2421 else if( layerorend == 11 ) {
2422 track->
setPh( m_ph11 );
2423 track->
setTof( m_tof11[0] );
2425 for(
unsigned int i=0; i<5; i++ ) {
2426 toffset[i] = m_tof11[0] - m_tof11[i];
2429 track->
setBeta( m_path1/m_tof11[0]/30.0 );
2431 else if( layerorend == 12 ) {
2432 track->
setPh( m_ph12 );
2433 track->
setTof( m_tof12[0] );
2435 for(
unsigned int i=0; i<5; i++ ) {
2436 toffset[i] = m_tof12[0] - m_tof12[i];
2439 track->
setBeta( m_path1/m_tof12[0]/30.0 );
2441 else if( layerorend == 21 ) {
2442 track->
setPh( m_ph21 );
2443 track->
setTof( m_tof21[0] );
2445 for(
unsigned int i=0; i<5; i++ ) {
2446 toffset[i] = m_tof21[0] - m_tof21[i];
2449 track->
setBeta( m_path2/m_tof21[0]/30.0 );
2451 else if( layerorend == 22 ) {
2452 track->
setPh( m_ph22 );
2453 track->
setTof( m_tof22[0] );
2455 for(
unsigned int i=0; i<5; i++ ) {
2456 toffset[i] = m_tof22[0] - m_tof22[i];
2459 track->
setBeta( m_path2/m_tof22[0]/30.0 );
2462 cout <<
"TofRec TofTrack::SetRecTofTrack layerorend = " << layerorend << endl;
2470 if( ( m_quality1 & 0x800 ) == 0x800 ) {
2473 ahit->
setRun( runNumber );
2475 ahit->
setMod( m_tofId1 );
2479 for(
int i=0; i<5; i++ ) {
2480 ahit->
setTpred( i, m_texpInner[i] );
2482 if( calibData ==
"Dimu" ) {
2493 ahit->
setTdc1( m_tdc1-m_estime );
2494 ahit->
setTdc2( m_tdc2-m_estime );
2501 ahit->
setP( m_momentum );
2502 ahit->
setQ( m_ph1 );
2505 btofCalHitCol->push_back( ahit );
2507 if( ( m_quality2 & 0x800 ) == 0x800 ) {
2510 bhit->
setRun( runNumber );
2512 bhit->
setMod( m_tofId2 );
2516 for(
int i=0; i<5; i++ ) {
2517 bhit->
setTpred( i, m_texpOuter[i] );
2519 if( calibData ==
"Dimu" ) {
2530 bhit->
setTdc1( m_tdc3-m_estime );
2531 bhit->
setTdc2( m_tdc4-m_estime );
2538 bhit->
setP( m_momentum );
2539 bhit->
setQ( m_ph2 );
2544 btofCalHitCol->push_back( bhit );
2555 if( ( m_quality1 & 0x800 ) != 0x800 )
return;
2558 chit->
setRun( runNumber );
2560 chit->
setMod( m_tofId1 );
2563 for(
int i=0; i<5; i++ ) {
2564 chit->
setTpred( i, m_texpInner[i] );
2566 if( calibData ==
"Dimu" ) {
2577 chit->
setTdc( m_tdc1-m_estime );
2583 chit->
setQ( m_ph1 );
2584 chit->
setP( m_momentum );
2587 etofCalHitCol->push_back( chit );
2595 if( ( m_quality1 & 0x800 ) == 0x800 ) {
2598 ahit->
setRun( runNumber );
2600 ahit->
setMod( m_tofId1 );
2604 for(
int i=0; i<5; i++ ) {
2605 ahit->
setTpred( i, m_texpInner[i] );
2607 if( calibData ==
"Dimu" ) {
2616 ahit->
setTdc1( m_tdc1-m_estime );
2617 ahit->
setTdc2( m_tdc2-m_estime );
2622 ahit->
setP( m_momentum );
2623 ahit->
setQ( m_ph1 );
2626 btofCalHitCol->push_back( ahit );
2629 if( ( m_quality2 & 0x800 ) == 0x800 ) {
2632 bhit->
setRun( runNumber );
2634 bhit->
setMod( m_tofId2 );
2638 for(
int i=0; i<5; i++ ) {
2639 bhit->
setTpred( i, m_texpOuter[i] );
2641 if( calibData ==
"Dimu" ) {
2650 bhit->
setTdc1( m_tdc3-m_estime );
2651 bhit->
setTdc2( m_tdc4-m_estime );
2656 bhit->
setP( m_momentum );
2657 bhit->
setQ( m_ph2 );
2660 btofCalHitCol->push_back( bhit );
std::multimap< unsigned int, TofData * > TofDataMap
std::multimap< unsignedint, TofData * >::iterator IterTofDataMap
ObjectVector< RecBTofCalHit > RecBTofCalHitCol
ObjectVector< RecETofCalHit > RecETofCalHitCol
ObjectVector< RecTofTrack > RecTofTrackCol
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 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 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 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