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;
534 int strip3 = strip0 - 2;
535 int strip4 = strip0 + 2;
536 int tofid1 = tofid0 - 1;
537 if( tofid1 == -1 ) { tofid1 = 35; }
538 int tofid2 = tofid0 + 1;
539 if( tofid2 == 36 ) { tofid2 = 0; }
542 count[0] = tofDataMap.count( identify[0] );
544 count[5] = tofDataMap.count( identify[5] );
546 count[6] = tofDataMap.count( identify[6] );
555 count[1] = tofDataMap.count( identify[1] );
557 count[7] = tofDataMap.count( identify[7] );
559 count[9] = tofDataMap.count( identify[9] );
569 count[2] = tofDataMap.count( identify[2] );
571 count[8] = tofDataMap.count( identify[8] );
573 count[10] = tofDataMap.count( identify[10] );
575 if( strip3 == -1 || strip3 == -2 ) {
count[3] = 0; }
578 count[3] = tofDataMap.count( identify[3] );
580 if( strip4 == 12 || strip4 == 13 ) {
count[4] = 0; }
583 count[4] = tofDataMap.count( identify[4] );
587 for(
unsigned int i=0; i<11; i++ ) {
589 pair< IterTofDataMap, IterTofDataMap > range = tofDataMap.equal_range( identify[i] );
591 for(
unsigned int j=0; j<
count[i]; j++,
iter++ ) {
595 else if( i==1 || i==2 ) {
603 countTot1 = countTot1 +
count[i];
606 if( countTot1 == 0 ) {
619 for(
unsigned int i=0; i<11; i++ ) {
620 identify[i] = 0x0000c000;
624 int tofid0 = m_id2 - 88;
626 count[0] = tofDataMap.count( identify[0] );
627 int tofid1 = tofid0 - 1;
628 if( tofid1 == -1 ) { tofid1 = 87; }
630 count[1] = tofDataMap.count( identify[1] );
631 int tofid2 = tofid0 + 1;
632 if( tofid2 == 88 ) { tofid2 = 0; }
634 count[2] = tofDataMap.count( identify[2] );
636 for(
unsigned int i=0; i<3; i++ ) {
638 pair< IterTofDataMap, IterTofDataMap > range = tofDataMap.equal_range( identify[i] );
640 for(
unsigned int j=0; j<
count[i]; j++,
iter++ ) {
649 countTot2 = countTot2 +
count[i];
652 if( countTot2 == 0 ) {
665 for( ;
iter != tofDataMap.end();
iter++ ) {
669 if( m_id2 ==
tof->tofId() &&
abs( m_istrip2 -
tof->strip() )<=
abs(m_delStrip1) ) {
670 m_delStrip1 = m_istrip2 -
tof->strip();
672 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) ) {
673 m_delStrip2 = m_istrip2 -
tof->strip();
678 unsigned int whichEndcap = 0;
684 int strip0 = m_istrip2;
687 int strip3 = strip0 - 2;
688 int strip4 = strip0 + 2;
689 int tofid1 = tofid0 - 1;
690 if( tofid1 == -1 ) { tofid1 = 35; }
691 int tofid2 = tofid0 + 1;
692 if( tofid2 == 36 ) { tofid2 = 0; }
695 count[0] = tofDataMap.count( identify[0] );
697 count[5] = tofDataMap.count( identify[5] );
699 count[6] = tofDataMap.count( identify[6] );
708 count[1] = tofDataMap.count( identify[1] );
710 count[7] = tofDataMap.count( identify[7] );
712 count[9] = tofDataMap.count( identify[9] );
722 count[2] = tofDataMap.count( identify[2] );
724 count[8] = tofDataMap.count( identify[8] );
726 count[10] = tofDataMap.count( identify[10] );
728 if( strip3 == -1 || strip3 == -2 ) {
count[3] = 0; }
731 count[3] = tofDataMap.count( identify[3] );
733 if( strip4 == 12 || strip4 == 13 ) {
count[4] = 0; }
736 count[4] = tofDataMap.count( identify[4] );
739 for(
unsigned int i=0; i<11; i++ ) {
741 pair< IterTofDataMap, IterTofDataMap > range = tofDataMap.equal_range( identify[i] );
743 for(
unsigned int j=0; j<
count[i]; j++,
iter++ ) {
747 else if( i==1 || i==2 ) {
755 countTot2 = countTot2 +
count[i];
759 if( countTot1==0 && countTot2==0 ) {
773 unsigned int qual =
tof->quality();
775 if( ( qual & 0x10 ) == 0 ) {
776 qual = ( qual | 0x10 );
777 if(
tof->barrel() ||
tof->is_mrpc() ) {
778 if( (
tof->quality() == 0x7 ) || (
tof->quality() == 0xd ) ) {
779 qual = ( qual | 0x20 );
782 if( (
tof->quality() == 0xb ) || (
tof->quality() == 0xe ) ) {
783 qual = ( qual | 0x40 );
786 if( (
tof->quality() == 0x3 ) || (
tof->quality() == 0xc ) ) {
787 qual = ( qual | 0x80 );
790 if(
tof->barrel() ) {
791 if( (
tof->quality() & 0x5 ) == 0x5 ) {
793 tof->setZTdc( ztdc );
796 if( (
tof->quality() & 0xa ) == 0xa ) {
798 tof->setZAdc( zadc );
801 if(
tof->is_mrpc() ) {
802 if( (
tof->quality() & 0x5 ) == 0x5 ) {
804 tof->setZTdc( ztdc );
807 tof->setQuality( qual );
810 if( iflag == 1 ) { m_tofData1.push_back(
tof ); }
811 else if( iflag == 2 ) { m_tofData2.push_back(
tof ); }
812 else if( iflag == 3 ) { m_tofData3.push_back(
tof ); }
813 else if( iflag == 4 ) { m_tofData4.push_back(
tof ); }
814 else if( iflag == 5 ) { m_tofData5.push_back(
tof ); }
815 else if( iflag == 6 ) { m_tofData6.push_back(
tof ); }
817 cout <<
"TofRec::TofTrack::TofDataAnalylsis: the Flag should be 1-4, out of the Range!" << endl;
827void TofTrack::match(
bool forCalibration, std::vector<int> deadId, std::vector<TofTrack*>*& tofTrackVec ) {
829 if( m_hitCase ==
NoHit )
return;
833 if( ( m_quality1 & 0x10 ) == 0 ) { m_hitCase =
NoHit; }
837 if( ( m_quality2 & 0x10 ) == 0 ) { m_hitCase =
NoHit; }
841 if( ( m_quality1 & 0x10 ) == 0 ) { m_hitCase =
OuterLayer; }
843 if( ( m_quality2 & 0x10 ) == 0 ) {
851 cout <<
"TofRec::TofTrack::match: 2- Impossible!" << endl;
859 findEtfData( m_tofData1, m_tofData2, m_tofData3, m_zrhit1, 1 );
860 findEtfData( m_tofData4, m_tofData5, m_tofData6, m_zrhit2, 2 );
863 cout <<
"TofRec::TofTrack::match: 1- Impossible!" << endl;
866 if( forCalibration ) {
869 if( ( ( m_quality1 & 0xf ) == 0xf ) && ( ( m_quality2 & 0xf ) == 0xf ) ) {
870 m_quality1 = ( m_quality1 | 0x800 );
871 m_quality2 = ( m_quality2 | 0x800 );
874 std::vector<int>::iterator
iter = deadId.begin();
875 for( ;
iter != deadId.end();
iter++ ) {
883 if( m_tofId1 == tofId ) {
884 if( ( m_quality2 & 0xf ) == 0xf ) {
885 if( ( ( east == 0 ) && ( ( m_quality1 & 0xf ) == 0x3 ) ) || ( ( east == 1 ) && ( ( m_quality1 & 0xf ) == 0xc ) ) ) {
886 m_quality1 = ( m_quality1 | 0x800 );
887 m_quality2 = ( m_quality2 | 0x800 );
893 else if( layer == 1 ) {
894 if( m_tofId2 == (tofId+88) ) {
895 if( ( m_quality1 & 0xf ) == 0xf ) {
896 if( ( ( east == 0 ) && ( ( m_quality2 & 0xf ) == 0x3 ) ) || ( ( east == 1 ) && ( ( m_quality2 & 0xf ) == 0xc ) ) ) {
897 m_quality1 = ( m_quality1 | 0x800 );
898 m_quality2 = ( m_quality2 | 0x800 );
909 if( ( m_quality1 & 0xf ) == 0xf ) {
910 m_quality1 = ( m_quality1 | 0x800 );
913 std::vector<int>::iterator
iter = deadId.begin();
914 for( ;
iter != deadId.end();
iter++ ) {
922 if( m_tofId1 == tofId ) {
923 if( ( ( east == 0 ) && ( ( m_quality1 & 0xf ) == 0x3 ) ) || ( ( east == 1 ) && ( ( m_quality1 & 0xf ) == 0xc ) ) ) {
924 m_quality1 = ( m_quality1 | 0x800 );
934 if( ( ( m_hitCase ==
EastEndcap ) || ( m_hitCase ==
WestEndcap ) ) && ( ( m_quality1 & 0xf ) == 0xc ) ) {
935 m_quality1 = ( m_quality1 | 0x800 );
940 if( ( ( m_quality1 & 0xf000 ) == 0x1000 ) || ( ( m_quality1 & 0xf000 ) == 0x2000 ) ) {
941 if( ( m_quality1 & 0xf ) == 0xf ) {
942 m_quality1 = ( m_quality1 | 0x800 );
945 if( ( ( m_quality2 & 0xf000 ) == 0x1000 ) || ( ( m_quality2 & 0xf000 ) == 0x2000 ) ) {
946 if( ( m_quality2 & 0xf ) == 0xf ) {
947 m_quality2 = ( m_quality2 | 0x800 );
962void TofTrack::findTofDataBarrel( std::vector<TofData*> tofDataVec1, std::vector<TofData*> tofDataVec2,
double zrhit,
unsigned int iflag, std::vector<TofTrack*>*& tofTrackVec ) {
964 unsigned int qual = 0xf;
966 if( tofDataVec2.size() == 0 ) {
967 if( tofDataVec1.size() == 0 ) {
970 else if( tofDataVec1.size() == 1 ) {
971 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
975 else if( tofDataVec1.size() > 1 ) {
980 cout <<
"TofRec::TofTrack::findTofDataBarrel: 1- Impossible!" << endl;
983 else if( ( tofDataVec2.size() == 1 ) ) {
984 if( tofDataVec1.size() == 0 ) {
985 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
989 else if( tofDataVec1.size() == 1 ) {
990 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
991 if( ((*iter1)->quality()&0x1ff)==0x01f &&
abs((*iter1)->ztdc()-zrhit)<
ztdc_Cut ) {
995 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1000 else if( tofDataVec1.size() > 1 ) {
1006 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1012 cout <<
"TofRec::TofTrack::findTofDataBarrel: 2- Impossible!" << endl;
1015 else if( ( tofDataVec2.size() > 1 ) ) {
1016 if( tofDataVec1.size() == 0 ) {
1020 else if( tofDataVec1.size() == 1 ) {
1021 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1022 if( ((*iter1)->quality()&0x1ff)==0x01f &&
abs((*iter1)->ztdc()-zrhit)<
ztdc_Cut ) {
1031 else if( tofDataVec1.size() > 1 ) {
1043 cout <<
"TofRec::TofTrack::findTofDataBarrel: 3- Impossible!" << endl;
1048 if( !(
tof->used()) ) {
1052 bool z1=
false, z2=
false;
1053 bool zc1=
false, zc2=
false;
1057 zc1 = ( m_zrhit1 >
tof->ztdc() );
1058 std::vector<TofTrack*>::iterator
iter = tofTrackVec->begin();
1059 for( ;
iter!=tofTrackVec->end();
iter++ ) {
1061 if(
tof->tofId()==(*iter)->tofId1() ) {
1064 zc2 = ( (*iter)->zrhit1() >
tof->ztdc() );
1068 else if( iflag==2 ) {
1070 zc1 = ( m_zrhit2 >
tof->ztdc() );
1071 std::vector<TofTrack*>::iterator
iter = tofTrackVec->begin();
1072 for( ;
iter!=tofTrackVec->end();
iter++ ) {
1074 if(
tof->tofId()==(*iter)->tofId2() ) {
1077 zc2 = ( (*iter)->zrhit2() >
tof->ztdc() );
1082 if( ( z1 && z2 )||( (!z1) && (!z2) ) ) {
1087 else if( !zc1 && zc2 ) {
1092 else if( z1 && !z2 ) {
1096 else if( !z1 && z2 ) {
1103 if( ( iflag == 1 ) || ( iflag == 3 ) ) {
1104 m_quality1 = ( m_quality1 | 0x300 );
1106 else if( iflag == 2 ) {
1107 m_quality2 = ( m_quality2 | 0x300 );
1110 cout <<
"TofRec::TofTrack::findTofDataBarrel: the 1- IFLAG is Out of Range!" << endl;
1114 qual = ( qual << 12 );
1115 if( ( iflag == 1 ) || ( iflag == 3 ) ) {
1116 m_quality1 = ( m_quality1 | qual );
1118 else if( iflag == 2 ) {
1119 m_quality2 = ( m_quality2 | qual );
1122 cout <<
"TofRec::TofTrack::findTofDataBarrel: the 2- IFLAG is Out of Range!" << endl;
1135 if( tofDataVec.size() == 0 ) {
1136 cout <<
"TofRec::TofTrack::ChooseTofData: Size of TofData Vector is Zero!" << endl;
1139 std::vector<TofData*>::iterator igood = tofDataVec.begin();
1140 if( tofDataVec.size() > 1 ) {
1141 double deltaZ = 1000.0;
1142 std::vector<TofData*>::iterator
iter = tofDataVec.begin();
1144 for( ;
iter != tofDataVec.end();
iter++ ) {
1145 if( ( (*iter)->quality() & 0x5 ) == 0x5 ) {
1146 if(
abs( (*iter)->ztdc() - zrhit ) < deltaZ ) {
1147 deltaZ =
abs( (*iter)->ztdc() - zrhit );
1153 if( deltaZ > 999.0 ) {
1154 iter = tofDataVec.begin();
1155 for( ;
iter != tofDataVec.end();
iter++ ) {
1156 if( ( (*iter)->quality() & 0xa ) == 0xa ) {
1157 if(
abs( (*iter)->zadc() - zrhit ) < deltaZ ) {
1158 deltaZ =
abs( (*iter)->zadc() - zrhit );
1165 if( deltaZ > 999.0 ) {
1166 unsigned int ibad = 0xf0;
1167 iter = tofDataVec.begin();
1168 for( ;
iter != tofDataVec.end();
iter++ ) {
1169 if( ( (*iter)->quality() & 0xf0 ) < ibad ) {
1171 ibad = ( (*iter)->quality() & 0xf0 );
1173 else if( ( (*iter)->quality() & 0xf0 ) == ibad ) {
1174 if( ( (*iter)->adc1() + (*iter)->adc2() ) > ( (*igood)->adc1() + (*igood)->adc2() ) ) {
1176 ibad = ( (*iter)->quality() & 0xf0 );
1215 unsigned int iflag = 3;
1216 unsigned int qual = 0xf;
1218 if( tofDataVec2.size() == 0 ) {
1219 if( tofDataVec1.size() == 0 ) {
1222 else if( tofDataVec1.size() == 1 ) {
1223 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1227 else if( tofDataVec1.size() > 1 ) {
1232 cout <<
"TofRec::TofTrack::findTofDataEndcap: 1- Impossible!" << endl;
1235 else if( ( tofDataVec2.size() == 1 ) ) {
1236 if( tofDataVec1.size() == 0 ) {
1237 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1241 else if( tofDataVec1.size() == 1 ) {
1242 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1243 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1247 else if( tofDataVec1.size() > 1 ) {
1249 std::vector<TofData*>::iterator iter2 = tofDataVec2.begin();
1254 cout <<
"TofRec::TofTrack::findTofDataBarrel: 2- Impossible!" << endl;
1257 else if( ( tofDataVec2.size() > 1 ) ) {
1258 if( tofDataVec1.size() == 0 ) {
1262 else if( tofDataVec1.size() == 1 ) {
1263 std::vector<TofData*>::iterator iter1 = tofDataVec1.begin();
1268 else if( tofDataVec1.size() > 1 ) {
1275 cout <<
"TofRec::TofTrack::findTofDataBarrel: 3- Impossible!" << endl;
1280 m_quality1 = ( m_quality1 | 0x300 );
1283 qual = ( qual << 12 );
1284 m_quality1 = ( m_quality1 | qual );
1295 if( tofDataVec.size() == 0 ) {
1296 cout <<
"TofRec::TofTrack::ChooseTofData: Size of TofData Vector is Zero!" << endl;
1299 std::vector<TofData*>::iterator igood = tofDataVec.begin();
1300 if( tofDataVec.size() > 1 ) {
1301 bool multihit =
false;
1302 std::vector<TofData*>::iterator
iter = tofDataVec.begin();
1303 for( ;
iter != tofDataVec.end();
iter++ ) {
1304 if( (*iter)->qtimes1()>1 ) { multihit =
true; }
1306 iter = tofDataVec.begin();
1308 double tcorr = -999.0;
1309 double deltaTMin = 999.0;
1310 for( ;
iter != tofDataVec.end();
iter++ ) {
1311 tcorr =
tofCaliSvc->
ETime( (*iter)->adc(), (*iter)->tdc()-m_estime,
zr1[2], (*iter)->tofId() );
1312 for(
unsigned int i=0; i<5; i++ ) {
1313 if(
abs(tcorr-m_texpInner[i]) < deltaTMin ) {
1314 deltaTMin =
abs(tcorr-m_texpInner[i]);
1322 for( ;
iter != tofDataVec.end();
iter++ ) {
1323 if( (*iter)->adc() > maxQ ) {
1324 maxQ = (*iter)->adc();
1350void TofTrack::findEtfData( std::vector<TofData*> tofDataVec1, std::vector<TofData*> tofDataVec2, std::vector<TofData*> tofDataVec3,
double zrhit,
unsigned int iflag ) {
1356 bool findSignal =
false;
1358 if( tofDataVec1.size()==0 && tofDataVec2.size()==0 && tofDataVec3.size()==0 ) {
1360 m_quality1 = ( m_quality1 | 0x300 );
1362 else if( iflag == 2 ) {
1363 m_quality2 = ( m_quality2 | 0x300 );
1367 if( tofDataVec1.size()>0 ) {
1369 if( (
tof1->quality() & 0xf ) == 0xf ) {
1374 if( !findSignal && tofDataVec2.size() > 0 ) {
1376 if( (
tof2->quality() & 0xf ) == 0xf ) {
1381 if( !findSignal && tofDataVec3.size() > 0 ) {
1383 if( ( tof3->
quality() & 0xf ) == 0xf ) {
1388 if( !findSignal && tofDataVec1.size()>0 ) {
1389 if( ( (
tof1->quality() & 0xf ) == 0xc ) || ( (
tof1->quality() & 0xf ) == 0x3 ) ) {
1394 if( !findSignal && tofDataVec2.size() > 0 ) {
1395 if( ( (
tof2->quality() & 0xf ) == 0xc ) || ( (
tof2->quality() & 0xf ) == 0x3 ) ) {
1400 if( !findSignal && tofDataVec3.size() > 0 ) {
1401 if( ( ( tof3->
quality() & 0xf ) == 0xc ) || ( ( tof3->
quality() & 0xf ) == 0x3 ) ) {
1408 m_quality1 = ( m_quality1 | 0x300 );
1410 else if( iflag == 2 ) {
1411 m_quality2 = ( m_quality2 | 0x300 );
1423 if( tofDataVec.size() == 0 ) {
1426 std::vector<TofData*>::iterator igood = tofDataVec.begin();
1427 if( tofDataVec.size() == 1 ) {
1430 else if( tofDataVec.size() > 1 ) {
1431 double deltaZ = 1000.0;
1432 std::vector<TofData*>::iterator
iter = tofDataVec.begin();
1433 for( ;
iter != tofDataVec.end();
iter++ ) {
1434 if( ( (*iter)->quality() & 0xf ) == 0xf ) {
1435 if(
abs( (*iter)->ztdc() - zrhit ) < deltaZ ) {
1436 deltaZ =
abs( (*iter)->ztdc() - zrhit );
1442 if( deltaZ > 999.0 ) {
1444 iter = tofDataVec.begin();
1445 for( ;
iter != tofDataVec.end();
iter++ ) {
1446 if( ( (*iter)->quality() & 0xc ) == 0xc ) {
1447 if( (*iter)->adc1() > maxQ ) {
1448 maxQ = (*iter)->adc1();
1452 else if( ( (*iter)->quality() & 0x3 ) == 0x3 ) {
1453 if( (*iter)->adc2() > maxQ ) {
1454 maxQ = (*iter)->adc2();
1469 if( tofDataVec.size() == 0 ) {
1472 std::vector<TofData*>::iterator igood = tofDataVec.begin();
1473 if( tofDataVec.size() == 1 ) {
1476 else if( tofDataVec.size() > 1 ) {
1478 std::vector<TofData*>::iterator
iter = tofDataVec.begin();
1479 for( ;
iter != tofDataVec.end();
iter++ ) {
1480 if( ( (*iter)->quality() & 0xc ) == 0xc ) {
1481 if( (*iter)->adc1() > maxQ ) {
1482 maxQ = (*iter)->adc1();
1486 else if( ( (*iter)->quality() & 0x3 ) == 0x3 ) {
1487 if( (*iter)->adc2() > maxQ ) {
1488 maxQ = (*iter)->adc2();
1504 m_tofId1 =
tof->tofId();
1505 m_strip1 =
tof->strip();
1507 m_qch1 =
tof->qtc1();
1510 m_qch1 =
tof->adcChannelEast();
1512 m_adc1 =
tof->adc1();
1513 m_tdc1 =
tof->tdc1();
1515 m_qch2 =
tof->qtc2();
1518 m_qch2 =
tof->adcChannelWest();
1520 m_adc2 =
tof->adc2();
1521 m_tdc2 =
tof->tdc2();
1522 m_ztdc1 =
tof->ztdc();
1523 m_zadc1 =
tof->zadc();
1524 m_quality1 = ( m_quality1 | ( 0x1f &
tof->quality() ) );
1525 if( ( (
tof->quality() & 0x5 ) != 0x5 ) || ( ( (
tof->quality() & 0x5 ) == 0x5 ) && (
abs(
tof->ztdc() - m_zrhit1 ) >
ztdc_Cut ) ) ) {
1526 m_quality1 = ( m_quality1 | 0x100 );
1528 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && (
abs(
tof->zadc() - m_zrhit1 ) >
zadc_Cut ) ) ) {
1529 m_quality1 = ( m_quality1 | 0x200 );
1532 else if( iflag == 2 ) {
1533 m_tofId2 =
tof->tofId();
1534 m_strip2 =
tof->strip();
1536 m_qch3 =
tof->qtc1();
1539 m_qch3 =
tof->adcChannelEast();
1541 m_adc3 =
tof->adc1();
1542 m_tdc3 =
tof->tdc1();
1544 m_qch4 =
tof->qtc2();
1547 m_qch4 =
tof->adcChannelWest();
1549 m_adc4 =
tof->adc2();
1550 m_tdc4 =
tof->tdc2();
1551 m_ztdc2 =
tof->ztdc();
1552 m_zadc2 =
tof->zadc();
1553 m_quality2 = ( m_quality2 | ( 0x1f &
tof->quality() ) );
1554 if( ( (
tof->quality() & 0x5 ) != 0x5 ) || ( ( (
tof->quality() & 0x5 ) == 0x5 ) && (
abs(
tof->ztdc() - m_zrhit2 ) >
ztdc_Cut ) ) ) {
1555 m_quality2 = ( m_quality2 | 0x100 );
1557 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && (
abs(
tof->zadc() - m_zrhit2 ) >
zadc_Cut ) ) ) {
1558 m_quality2 = ( m_quality2 | 0x200 );
1561 else if( iflag == 3 ) {
1562 m_tofId1 =
tof->tofId();
1564 m_qch1 =
tof->qtc();
1567 m_qch1 =
tof->adcChannel();
1569 m_adc1 =
tof->adc();
1570 m_tdc1 =
tof->tdc();
1571 m_quality1 = ( m_quality1 | ( 0x1f &
tof->quality() ) );
1572 m_quality1 = ( m_quality1 | 0x300 );
1575 cout <<
"TofRec::TofTrack::getTofData: Flag which sign the Barrel/Endcap or Inner/Outer is wrong! Please check it!" << endl;
1588 m_tofId1 =
tof->tofId();
1589 m_strip1 =
tof->strip();
1591 m_qch1 =
tof->qtc1();
1594 m_qch1 =
tof->adcChannelEast();
1596 m_adc1 =
tof->adc1();
1597 m_tdc1 =
tof->tdc1();
1601 m_ztdc1 =
tof->ztdc();
1602 m_zadc1 =
tof->zadc();
1603 m_quality1 = ( ( m_quality1 & 0xfffffff0 ) | ( 0x1c &
tof->quality() ) );
1604 if( ( (
tof->quality() & 0x5 ) != 0x5 ) || ( ( (
tof->quality() & 0x5 ) == 0x5 ) && (
abs(
tof->ztdc() - m_zrhit1 ) >
ztdc_Cut ) ) ) {
1605 m_quality1 = ( m_quality1 | 0x100 );
1607 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && (
abs(
tof->zadc() - m_zrhit1 ) >
zadc_Cut ) ) ) {
1608 m_quality1 = ( m_quality1 | 0x200 );
1611 else if( iflag == 2 ) {
1612 m_tofId2 =
tof->tofId();
1614 m_qch3 =
tof->qtc1();
1617 m_qch3 =
tof->adcChannelEast();
1619 m_adc3 =
tof->adc1();
1620 m_tdc3 =
tof->tdc1();
1624 m_ztdc2 =
tof->ztdc();
1625 m_zadc2 =
tof->zadc();
1626 m_quality2 = ( ( m_quality2 & 0xfffffff0 ) | ( 0x1c &
tof->quality() ) );
1627 if( ( (
tof->quality() & 0x5 ) != 0x5 ) || ( ( (
tof->quality() & 0x5 ) == 0x5 ) && (
abs(
tof->ztdc() - m_zrhit2 ) >
ztdc_Cut ) ) ) {
1628 m_quality2 = ( m_quality2 | 0x100 );
1630 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && (
abs(
tof->zadc() - m_zrhit2 ) >
zadc_Cut ) ) ) {
1631 m_quality2 = ( m_quality2 | 0x200 );
1635 cout <<
"TofRec::TofTrack::getTofDataEast: Flag which sign the Barrel/Endcap or Inner/Outer is wrong! Please check it!" << endl;
1648 m_tofId1 =
tof->tofId();
1649 m_strip1 =
tof->strip();
1654 m_qch2 =
tof->qtc2();
1657 m_qch2 =
tof->adcChannelWest();
1659 m_adc2 =
tof->adc2();
1660 m_tdc2 =
tof->tdc2();
1661 m_ztdc1 =
tof->ztdc();
1662 m_zadc1 =
tof->zadc();
1663 m_quality1 = ( ( m_quality1 & 0xfffffff0 ) | ( 0x13 &
tof->quality() ) );
1664 if( ( (
tof->quality() & 0x5 ) != 0x5 ) || ( ( (
tof->quality() & 0x5 ) == 0x5 ) && (
abs(
tof->ztdc() - m_zrhit1 ) >
ztdc_Cut ) ) ) {
1665 m_quality1 = ( m_quality1 | 0x100 );
1667 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && (
abs(
tof->zadc() - m_zrhit1 ) >
zadc_Cut ) ) ) {
1668 m_quality1 = ( m_quality1 | 0x200 );
1671 else if( iflag == 2 ) {
1672 m_tofId2 =
tof->tofId();
1677 m_qch4 =
tof->qtc2();
1680 m_qch4 =
tof->adcChannelWest();
1682 m_adc4 =
tof->adc2();
1683 m_tdc4 =
tof->tdc2();
1684 m_ztdc2 =
tof->ztdc();
1685 m_zadc2 =
tof->zadc();
1686 m_quality2 = ( ( m_quality2 & 0xfffffff0 ) | ( 0x13 &
tof->quality() ) );
1687 if( ( (
tof->quality() & 0x5 ) != 0x5 ) || ( ( (
tof->quality() & 0x5 ) == 0x5 ) && (
abs(
tof->ztdc() - m_zrhit2 ) >
ztdc_Cut ) ) ) {
1688 m_quality2 = ( m_quality2 | 0x100 );
1690 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && (
abs(
tof->zadc() - m_zrhit2 ) >
zadc_Cut ) ) ) {
1691 m_quality2 = ( m_quality2 | 0x200 );
1695 cout <<
"TofRec::TofTrack::getTofDataWest: Flag which sign the Barrel/Endcap or Inner/Outer is wrong! Please check it!" << endl;
1718 m_quality1 = ( m_quality1 & 0x700 );
1722 else if( iflag == 2 ) {
1732 m_quality2 = ( m_quality2 & 0x700 );
1737 cout <<
"TofRec::TofTrack::getTofData: Flag which sign the Barrel/Endcap or Inner/Outer is wrong! Please check it!" << endl;
1749 if( iflag == 1 &&
tof->tofId() != m_id2 ) {
1750 m_tofId1 =
tof->tofId();
1751 m_strip1 =
tof->strip();
1752 m_qch1 =
tof->adcChannelEast();
1753 m_adc1 =
tof->adc1();
1754 m_tdc1 =
tof->tdc1();
1755 m_qch2 =
tof->adcChannelWest();
1756 m_adc2 =
tof->adc2();
1757 m_tdc2 =
tof->tdc2();
1758 m_ztdc1 =
tof->ztdc();
1759 m_zadc1 =
tof->zadc();
1760 m_quality1 = ( m_quality1 | ( 0x1f &
tof->quality() ) );
1761 if( ( (
tof->quality() & 0x5 ) != 0x5 ) || ( ( (
tof->quality() & 0x5 ) == 0x5 ) && (
abs(
tof->ztdc() - m_zrhit1 ) >
ztdc_Cut ) ) ) {
1762 m_quality1 = ( m_quality1 | 0x100 );
1764 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && (
abs(
tof->zadc() - m_zrhit1 ) >
zadc_Cut ) ) ) {
1765 m_quality1 = ( m_quality1 | 0x200 );
1767 m_quality1 = ( m_quality1 | ( qual << 12 ) );
1770 else if( iflag == 2 &&
tof->tofId() != m_id1 ) {
1771 m_tofId2 =
tof->tofId();
1772 m_strip2 =
tof->strip();
1773 m_qch3 =
tof->adcChannelEast();
1774 m_adc3 =
tof->adc1();
1775 m_tdc3 =
tof->tdc1();
1776 m_qch4 =
tof->adcChannelWest();
1777 m_adc4 =
tof->adc2();
1778 m_tdc4 =
tof->tdc2();
1779 m_ztdc2 =
tof->ztdc();
1780 m_zadc2 =
tof->zadc();
1781 m_quality2 = ( m_quality2 | ( 0x1f &
tof->quality() ) );
1782 if( ( (
tof->quality() & 0x5 ) != 0x5 ) || ( ( (
tof->quality() & 0x5 ) == 0x5 ) && (
abs(
tof->ztdc() - m_zrhit2 ) >
ztdc_Cut ) ) ) {
1783 m_quality2 = ( m_quality2 | 0x100 );
1785 if( ( (
tof->quality() & 0xa ) != 0xa ) || ( ( (
tof->quality() & 0xa ) == 0xa ) && (
abs(
tof->zadc() - m_zrhit2 ) >
zadc_Cut ) ) ) {
1786 m_quality2 = ( m_quality2 | 0x200 );
1788 m_quality2 = ( m_quality2 | ( qual << 12 ) );
1807 bool innerEast = ( ( m_quality1 & 0xc ) == 0xc );
1808 bool innerWest = ( ( m_quality1 & 0x3 ) == 0x3 );
1809 bool outerEast = ( ( m_quality2 & 0xc ) == 0xc );
1810 bool outerWest = ( ( m_quality2 & 0x3 ) == 0x3 );
1811 bool innerLayer = ( ( m_quality1 & 0xf ) == 0xf );
1812 bool outerLayer = ( ( m_quality2 & 0xf ) == 0xf );
1814 bool endcapData = ( ( m_quality1 & 0xc ) == 0xc );
1817 for(
unsigned int i=0; i<5; i++ ) {
1818 m_texp[i] =
tofCaliSvc->
BTimeCluster( m_texpInner[i], m_texpOuter[i], m_zr1[i], m_zr2[i], m_tofId1, m_tofId2 );
1825 for(
unsigned int i=0; i<5; i++ ) {
1826 m_tof11[i] =
tofCaliSvc->
BTime1( m_adc1, m_tdc1-m_estime, m_zr1[i], m_tofId1, m_estime );
1833 for(
unsigned int i=0; i<5; i++ ) {
1834 m_tof12[i] =
tofCaliSvc->
BTime2( m_adc2, m_tdc2-m_estime, m_zr1[i], m_tofId1, m_estime );
1841 for(
unsigned int i=0; i<5; i++ ) {
1849 for(
unsigned int i=0; i<5; i++ ) {
1850 m_tof21[i] =
tofCaliSvc->
BTime1( m_adc3, m_tdc3-m_estime, m_zr2[i], m_tofId2, m_estime );
1857 for(
unsigned int i=0; i<5; i++ ) {
1858 m_tof22[i] =
tofCaliSvc->
BTime2( m_adc4, m_tdc4-m_estime, m_zr2[i], m_tofId2, m_estime );
1865 for(
unsigned int i=0; i<5; i++ ) {
1872 if( innerLayer && outerLayer ) {
1873 for(
unsigned int i=0; i<5; i++ ) {
1883 for(
unsigned int i=0; i<5; i++ ) {
1884 m_tof11[i] =
tofCaliSvc->
ETime( m_adc1, m_tdc1-m_estime, m_zr1[i], m_tofId1 );
1889 if( (m_quality1&0xa000)!=0 ) { m_quality = 4; }
1896 for(
unsigned int i=0; i<5; i++ ) {
1898 m_tof11[i] =
tofCaliSvc->
EtfTime1( m_adc1, m_tdc1-m_estime, m_zr1[i], m_tofId1, m_strip1, m_estime );
1901 m_tof11[i] =
tofCaliSvc->
EtfTimeMC1( m_adc1, m_tdc1-m_estime, m_zr1[i], m_tofId1, m_strip1, m_estime );
1909 for(
unsigned int i=0; i<5; i++ ) {
1911 m_tof12[i] =
tofCaliSvc->
EtfTime2( m_adc2, m_tdc2-m_estime, m_zr1[i], m_tofId1, m_strip1, m_estime );
1914 m_tof12[i] =
tofCaliSvc->
EtfTimeMC2( m_adc2, m_tdc2-m_estime, m_zr1[i], m_tofId1, m_strip1, m_estime );
1922 for(
unsigned int i=0; i<5; i++ ) {
1924 m_tof21[i] =
tofCaliSvc->
EtfTime1( m_adc3, m_tdc3-m_estime, m_zr2[i], m_tofId2, m_strip2, m_estime );
1927 m_tof21[i] =
tofCaliSvc->
EtfTimeMC1( m_adc3, m_tdc3-m_estime, m_zr2[i], m_tofId2, m_strip2, m_estime );
1935 for(
unsigned int i=0; i<5; i++ ) {
1937 m_tof22[i] =
tofCaliSvc->
EtfTime2( m_adc4, m_tdc4-m_estime, m_zr2[i], m_tofId2, m_strip2, m_estime );
1940 m_tof22[i] =
tofCaliSvc->
EtfTimeMC2( m_adc4, m_tdc4-m_estime, m_zr2[i], m_tofId2, m_strip2, m_estime );
1956 for(
unsigned int i=1; i<5; i++ ) {
1957 m_tof1[i] = m_tof1[0];
1959 m_ph1 = ( m_adc1 + m_adc2 )/2.0;
1971 for(
unsigned int i=1; i<5; i++ ) {
1972 m_tof2[i] = m_tof2[0];
1974 m_ph2 = ( m_adc3 + m_adc4 )/2.0;
1983 if( innerLayer && outerLayer ) {
1988 if( innerLayer || outerLayer ) {
1993 if( innerEast || innerWest || outerEast || outerWest ) {
2000 if( ( (m_quality1&0xa000)!=0 ) || ( (m_quality2&0xa000)!=0 ) ) {
2001 m_quality = m_quality + 3;
2005 if( ( (m_quality1&0x100)==0x100 ) || ( (m_quality2&0x100)==0x100 ) ) {
2006 if( ( m_quality == 1 ) || ( m_quality == 4 ) ) { m_quality = 7; }
2007 else if( ( m_quality == 2 ) || ( m_quality == 5 ) ) { m_quality = 8; }
2008 else if( ( m_quality == 3 ) || ( m_quality == 6 ) ) { m_quality = 9; }
2010 cout <<
"TofRec::TofTrack::setCalibration: Impossible!" << endl;
2027 bool innerEast = ( ( m_quality1 & 0xc ) == 0xc );
2028 bool innerWest = ( ( m_quality1 & 0x3 ) == 0x3 );
2029 bool outerEast = ( ( m_quality2 & 0xc ) == 0xc );
2030 bool outerWest = ( ( m_quality2 & 0x3 ) == 0x3 );
2046 if( outerEast && outerWest ) {
2054 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 11- Impossible!" << endl;
2059 recTofTrackCol->push_back( atrack11 );
2074 if( outerEast && outerWest ) {
2082 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 12- Impossible!" << endl;
2087 recTofTrackCol->push_back( atrack12 );
2090 if( innerEast && innerWest ) {
2098 if( outerEast && outerWest ) {
2106 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 1- Impossible!" << endl;
2110 recTofTrackCol->push_back( atrack1 );
2125 if( innerEast || innerWest ) {
2133 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 21- Impossible!" << endl;
2138 recTofTrackCol->push_back( atrack21 );
2153 if( innerEast || innerWest ) {
2161 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 22- Impossible!" << endl;
2166 recTofTrackCol->push_back( atrack22 );
2169 if( outerEast && outerWest ) {
2177 if( innerEast && innerWest ) {
2185 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: 2- Impossible!" << endl;
2189 recTofTrackCol->push_back( atrack2 );
2192 if( innerEast && innerWest && outerEast && outerWest ) {
2199 recTofTrackCol->push_back( atrack );
2215 cout <<
"TofRec::TofTrack:convert2RecTofTrackCol: endcap- Impossible!" << endl;
2219 recTofTrackCol->push_back( atrack );
2224 if( innerEast || innerWest ) {
2238 recTofTrackCol->push_back( atrack1 );
2253 recTofTrackCol->push_back( atrack2 );
2256 if( innerEast && innerWest ) {
2268 recTofTrackCol->push_back( atrack );
2286 recTofTrackCol->push_back( atrack1 );
2301 recTofTrackCol->push_back( atrack2 );
2304 if( outerEast && outerWest ) {
2316 recTofTrackCol->push_back( atrack );
2323 if( m_hitCase ==
NoHit ) {
2330 recTofTrackCol->push_back( atrack );
2347 for(
int i=0; i<6; i++ ) {
2352 track->
setT0( m_estime );
2359 if( ( layerorend == 11 ) || ( layerorend == 12 ) || ( layerorend == 1 ) ) {
2364 track->
setTofID( 12*m_tofId1+m_strip1 );
2369 track->
setTexp( m_texpInner );
2374 if( ( layerorend==21 ) || ( layerorend==22 ) || ( layerorend==2 ) ) {
2379 track->
setTofID( 12*m_tofId2+m_strip2 );
2384 track->
setTexp( m_texpOuter );
2389 if( layerorend==0 ) {
2399 if( layerorend == 3 ) {
2404 track->
setTofID( 12*m_id1 + m_strip1 );
2409 track->
setTexp( m_texpInner );
2419 for(
unsigned int i=0; i<6; i++ ) {
2423 if( layerorend == 0 ) {
2424 track->
setPh( m_ph );
2425 track->
setTof( m_tof[0] );
2427 for(
unsigned int i=0; i<5; i++ ) {
2428 toffset[i] = m_tof[0] - m_tof[i];
2431 track->
setBeta( m_path/m_tof[0]/30.0 );
2433 else if( layerorend == 1 ) {
2434 track->
setPh( m_ph1 );
2435 track->
setTof( m_tof1[0] );
2437 for(
unsigned int i=0; i<5; i++ ) {
2438 toffset[i] = m_tof1[0] - m_tof1[i];
2441 track->
setBeta( m_path1/m_tof1[0]/30.0 );
2443 else if( layerorend == 2 ) {
2444 track->
setPh( m_ph2 );
2445 track->
setTof( m_tof2[0] );
2447 for(
unsigned int i=0; i<5; i++ ) {
2448 toffset[i] = m_tof2[0] - m_tof2[i];
2451 track->
setBeta( m_path2/m_tof2[0]/30.0 );
2453 else if( layerorend == 11 ) {
2454 track->
setPh( m_ph11 );
2455 track->
setTof( m_tof11[0] );
2457 for(
unsigned int i=0; i<5; i++ ) {
2458 toffset[i] = m_tof11[0] - m_tof11[i];
2461 track->
setBeta( m_path1/m_tof11[0]/30.0 );
2463 else if( layerorend == 12 ) {
2464 track->
setPh( m_ph12 );
2465 track->
setTof( m_tof12[0] );
2467 for(
unsigned int i=0; i<5; i++ ) {
2468 toffset[i] = m_tof12[0] - m_tof12[i];
2471 track->
setBeta( m_path1/m_tof12[0]/30.0 );
2473 else if( layerorend == 21 ) {
2474 track->
setPh( m_ph21 );
2475 track->
setTof( m_tof21[0] );
2477 for(
unsigned int i=0; i<5; i++ ) {
2478 toffset[i] = m_tof21[0] - m_tof21[i];
2481 track->
setBeta( m_path2/m_tof21[0]/30.0 );
2483 else if( layerorend == 22 ) {
2484 track->
setPh( m_ph22 );
2485 track->
setTof( m_tof22[0] );
2487 for(
unsigned int i=0; i<5; i++ ) {
2488 toffset[i] = m_tof22[0] - m_tof22[i];
2491 track->
setBeta( m_path2/m_tof22[0]/30.0 );
2494 cout <<
"TofRec TofTrack::SetRecTofTrack layerorend = " << layerorend << endl;
2502 if( ( m_quality1 & 0x800 ) == 0x800 ) {
2505 ahit->
setRun( runNumber );
2507 ahit->
setMod( m_tofId1 );
2511 for(
int i=0; i<5; i++ ) {
2512 ahit->
setTpred( i, m_texpInner[i] );
2514 if( calibData ==
"Dimu" ) {
2525 ahit->
setTdc1( m_tdc1-m_estime );
2526 ahit->
setTdc2( m_tdc2-m_estime );
2533 ahit->
setP( m_momentum );
2534 ahit->
setQ( m_ph1 );
2537 btofCalHitCol->push_back( ahit );
2539 if( ( m_quality2 & 0x800 ) == 0x800 ) {
2542 bhit->
setRun( runNumber );
2544 bhit->
setMod( m_tofId2 );
2548 for(
int i=0; i<5; i++ ) {
2549 bhit->
setTpred( i, m_texpOuter[i] );
2551 if( calibData ==
"Dimu" ) {
2562 bhit->
setTdc1( m_tdc3-m_estime );
2563 bhit->
setTdc2( m_tdc4-m_estime );
2570 bhit->
setP( m_momentum );
2571 bhit->
setQ( m_ph2 );
2576 btofCalHitCol->push_back( bhit );
2587 if( ( m_quality1 & 0x800 ) != 0x800 )
return;
2590 chit->
setRun( runNumber );
2592 chit->
setMod( m_tofId1 );
2595 for(
int i=0; i<5; i++ ) {
2596 chit->
setTpred( i, m_texpInner[i] );
2598 if( calibData ==
"Dimu" ) {
2609 chit->
setTdc( m_tdc1-m_estime );
2615 chit->
setQ( m_ph1 );
2616 chit->
setP( m_momentum );
2619 etofCalHitCol->push_back( chit );
2627 if( ( m_quality1 & 0x800 ) == 0x800 ) {
2630 ahit->
setRun( runNumber );
2632 ahit->
setMod( m_tofId1 );
2636 for(
int i=0; i<5; i++ ) {
2637 ahit->
setTpred( i, m_texpInner[i] );
2639 if( calibData ==
"Dimu" ) {
2648 ahit->
setTdc1( m_tdc1-m_estime );
2649 ahit->
setTdc2( m_tdc2-m_estime );
2654 ahit->
setP( m_momentum );
2655 ahit->
setQ( m_ph1 );
2658 btofCalHitCol->push_back( ahit );
2661 if( ( m_quality2 & 0x800 ) == 0x800 ) {
2664 bhit->
setRun( runNumber );
2666 bhit->
setMod( m_tofId2 );
2670 for(
int i=0; i<5; i++ ) {
2671 bhit->
setTpred( i, m_texpOuter[i] );
2673 if( calibData ==
"Dimu" ) {
2682 bhit->
setTdc1( m_tdc3-m_estime );
2683 bhit->
setTdc2( m_tdc4-m_estime );
2688 bhit->
setP( m_momentum );
2689 bhit->
setQ( m_ph2 );
2692 btofCalHitCol->push_back( bhit );
std::multimap< unsigned int, TofData * > TofDataMap
std::multimap< unsignedint, TofData * >::iterator IterTofDataMap
DOUBLE_PRECISION count[2]
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 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