1#include "GaudiKernel/Bootstrap.h"
2#include "GaudiKernel/IDataProviderSvc.h"
3#include "GaudiKernel/ISvcLocator.h"
4#include "GaudiKernel/SmartDataPtr.h"
6#include "DstEvent/TofHitStatus.h"
7#include "EventModel/EventModel.h"
8#include "EvtRecEvent/EvtRecEvent.h"
9#include "EvtRecEvent/EvtRecTrack.h"
11#include "VertexDbSvc/IVertexDbSvc.h"
12#include "VertexFit/Helix.h"
14#include "DTagTool/DTagTool.h"
27 , m_tag1desigma( 1.0 )
28 , m_tag2desigma( 1.0 ) {
30 SmartDataPtr<EvtRecEvent> evtRecEvent(
eventSvc(),
"/Event/EvtRec/EvtRecEvent" );
33 cout << MSG::FATAL <<
"Could not find EvtRecEvent" << endl;
37 SmartDataPtr<EvtRecTrackCol> evtRecTrackCol(
eventSvc(),
"/Event/EvtRec/EvtRecTrackCol" );
38 if ( !evtRecTrackCol )
40 cout << MSG::FATAL <<
"Could not find EvtRecTrackCol" << endl;
44 StatusCode sc = Gaudi::svcLocator()->service(
"SimplePIDSvc", m_simplePIDSvc );
51 m_chargebegin = evtRecTrackCol->begin();
52 m_chargeend = evtRecTrackCol->begin() + evtRecEvent->totalCharged();
53 m_showerbegin = evtRecTrackCol->begin() + evtRecEvent->totalCharged();
54 m_showerend = evtRecTrackCol->begin() + evtRecEvent->totalTracks();
60 cout <<
"Could not find EvtRecDTagCol" << endl;
65 SmartDataPtr<EvtRecVeeVertexCol> evtRecVeeVertexCol(
eventSvc(),
66 "/Event/EvtRec/EvtRecVeeVertexCol" );
67 if ( !evtRecVeeVertexCol )
69 cout <<
"Could not find EvtRecVeeVertexCol" << endl;
74 SmartDataPtr<EvtRecPi0Col> recPi0Col(
eventSvc(),
"/Event/EvtRec/EvtRecPi0Col" );
77 cout <<
"Could not find EvtRecPi0Col" << endl;
83 SmartDataPtr<EvtRecEtaToGGCol> recEtaToGGCol(
eventSvc(),
"/Event/EvtRec/EvtRecEtaToGGCol" );
86 cout <<
"Could not find EvtRecEtaToGGCol" << endl;
90 m_iterbegin = evtRecDTagCol->begin();
91 m_iterend = evtRecDTagCol->end();
92 m_pi0iterbegin = recPi0Col->begin();
93 m_pi0iterend = recPi0Col->end();
94 m_etaiterbegin = recEtaToGGCol->begin();
95 m_etaiterend = recEtaToGGCol->end();
96 m_ksiterbegin = evtRecVeeVertexCol->begin();
97 m_ksiterend = evtRecVeeVertexCol->end();
99 if ( evtRecDTagCol->size() > 0 ) m_isdtaglistempty =
false;
100 else m_isdtaglistempty =
true;
107 for ( EvtRecDTagCol::iterator
iter = m_iterbegin;
iter != m_iterend;
iter++ )
110 if ( (
int)( ( *iter )->decayMode() ) < 200 ) m_d0modes.push_back( index );
111 else if ( (
int)( ( *iter )->decayMode() ) < 400 ) m_dpmodes.push_back( index );
112 else if ( (
int)( ( *iter )->decayMode() ) < 1000 ) m_dsmodes.push_back( index );
133 EvtRecDTagCol::iterator pair1_iter2,
134 EvtRecDTagCol::iterator pair2_iter1,
135 EvtRecDTagCol::iterator pair2_iter2,
double mD,
string smass ) {
139 if ( smass ==
"mbc" )
141 value1 = fabs( 0.5 * ( ( *pair1_iter1 )->mBC() + ( *pair1_iter2 )->mBC() ) - mD );
142 value2 = fabs( 0.5 * ( ( *pair2_iter1 )->mBC() + ( *pair2_iter2 )->mBC() ) - mD );
144 else if ( smass ==
"de" )
146 value1 = pow( ( *pair1_iter1 )->deltaE() / m_tag1desigma, 2 ) +
147 pow( ( *pair1_iter2 )->deltaE() / m_tag2desigma, 2 );
148 value2 = pow( ( *pair2_iter1 )->deltaE() / m_tag1desigma, 2 ) +
149 pow( ( *pair2_iter2 )->deltaE() / m_tag2desigma, 2 );
151 else if ( smass ==
"inv" )
153 value1 = fabs( 0.5 * ( ( *pair1_iter1 )->mass() + ( *pair1_iter2 )->mass() ) - mD );
154 value2 = fabs( 0.5 * ( ( *pair2_iter1 )->mass() + ( *pair2_iter2 )->mass() ) - mD );
157 if ( value1 <= value2 )
return true;
165 for ( EvtRecDTagCol::iterator
iter = m_iterbegin;
iter != m_iterend;
iter++ )
170 if ( ( *iter )->decayMode() == decaymode && ( *iter )->type() == 1 )
171 mode.push_back( index );
175 if ( ( *iter )->decayMode() == decaymode )
mode.push_back( index );
188 for ( EvtRecDTagCol::iterator
iter = m_iterbegin;
iter != m_iterend;
iter++ )
193 if ( ( *iter )->decayMode() == decaymode && ( *iter )->type() == 1 )
194 mode.push_back( index );
198 if ( ( *iter )->decayMode() == decaymode )
mode.push_back( index );
223 bool isStcand =
false;
227 EvtRecDTagCol::iterator iter_dtag = m_iterbegin;
228 for ( ; iter_dtag != m_iterend; iter_dtag++ )
233 if ( ( *iter_dtag )->type() != 1 || ( *iter_dtag )->decayMode() !=
mode ||
234 ( *iter_dtag )->charm() != tagcharm )
239 if ( ( *iter_dtag )->decayMode() !=
mode || ( *iter_dtag )->charm() != tagcharm )
242 if ( fabs( ( *iter_dtag )->deltaE() ) < fabs( de_min ) )
245 m_iterstag = iter_dtag;
246 de_min = ( *iter_dtag )->deltaE();
257 bool isStcand =
false;
261 EvtRecDTagCol::iterator iter_dtag = m_iterbegin;
262 for ( ; iter_dtag != m_iterend; iter_dtag++ )
267 if ( ( *iter_dtag )->type() != 1 || ( *iter_dtag )->decayMode() !=
mode )
continue;
271 if ( ( *iter_dtag )->decayMode() !=
mode )
continue;
274 if ( fabs( ( *iter_dtag )->deltaE() ) < fabs( de_min ) )
277 m_iterstag = iter_dtag;
278 de_min = ( *iter_dtag )->deltaE();
294 return findDTag(
static_cast<int>( mode1 ),
static_cast<int>( mode2 ), smass );
300 return findDTag(
static_cast<int>( mode1 ), tagcharm1,
static_cast<int>( mode2 ), tagcharm2,
308 return findADTag(
static_cast<int>( mode1 ),
static_cast<int>( mode2 ) );
314 return findADTag(
static_cast<int>( mode1 ), tagcharm1,
static_cast<int>( mode2 ),
321 int tagcharm1 = ( mode1 < 10 || mode1 >= 200 ) ? +1 : 0;
322 int tagcharm2 = ( mode2 < 10 || mode2 >= 200 ) ? -1 : 0;
324 if ( tagcharm1 * tagcharm2 > 0 )
326 cout <<
"double tagging warning! two modes can't have same nonzero charmness" << endl;
332 if ( mode1 < 200 && mode2 < 200 ) mDcand = 1.86484;
333 else if ( mode1 >= 200 && mode1 < 400 && mode2 >= 200 && mode2 < 400 ) mDcand = 1.86966;
334 else if ( mode1 >= 400 && mode1 < 1000 && mode2 >= 400 && mode2 < 1000 ) mDcand = 1.96835;
337 cout <<
"double tag modes are not from same particle ! " << endl;
341 vector<int> igood1, igood2;
342 igood1.clear(), igood2.clear();
344 EvtRecDTagCol::iterator iter_dtag = m_iterbegin;
347 for ( ; iter_dtag != m_iterend; iter_dtag++ )
349 int iter_mode = ( *iter_dtag )->decayMode();
350 int iter_charm = ( *iter_dtag )->charm();
351 int iter_type = ( *iter_dtag )->type();
355 if ( iter_mode == mode1 && iter_charm == tagcharm1 && iter_type == 1 )
356 igood1.push_back( index );
357 if ( tagcharm1 != 0 && iter_mode == mode1 && iter_charm == -tagcharm1 && iter_type == 1 )
358 igood1.push_back( index );
360 if ( iter_mode == mode2 && iter_charm == tagcharm2 && iter_type == 1 )
361 igood2.push_back( index );
362 if ( tagcharm2 != 0 && iter_mode == mode2 && iter_charm == -tagcharm2 && iter_type == 1 )
363 igood2.push_back( index );
367 if ( iter_mode == mode1 && iter_charm == tagcharm1 ) igood1.push_back( index );
368 if ( tagcharm1 != 0 && iter_mode == mode1 && iter_charm == -tagcharm1 )
369 igood1.push_back( index );
371 if ( iter_mode == mode2 && iter_charm == tagcharm2 ) igood2.push_back( index );
372 if ( tagcharm2 != 0 && iter_mode == mode2 && iter_charm == -tagcharm2 )
373 igood2.push_back( index );
380 if ( igood1.size() < 1 || igood2.size() < 1 )
return false;
382 bool isDtcand =
false;
383 int index_i = 0, index_j = 0;
385 EvtRecDTagCol::iterator iter_i, iter_j;
387 for (
int i = 0; i < igood1.size(); i++ )
390 iter_i = m_iterbegin + igood1[i];
392 int charm_i = ( *iter_i )->charm();
393 for (
int j = 0; j < igood2.size(); j++ )
395 iter_j = m_iterbegin + igood2[j];
397 int charm_j = ( *iter_j )->charm();
398 if ( charm_i * charm_j > 0 || igood2[j] == igood1[i] )
continue;
404 m_iterdtag1 = iter_i;
405 m_iterdtag2 = iter_j;
408 if (
compare( iter_i, iter_j, m_iterdtag1, m_iterdtag2, mDcand, smass ) )
410 m_iterdtag1 = iter_i;
411 m_iterdtag2 = iter_j;
423 if ( tagcharm1 * tagcharm2 > 0 )
425 cout <<
"double tagging warning! two modes can't have same nonzero charmness" << endl;
431 if ( mode1 < 200 && mode2 < 200 ) mDcand = 1.86484;
432 else if ( mode1 >= 200 && mode1 < 400 && mode2 >= 200 && mode2 < 400 ) mDcand = 1.86966;
433 else if ( mode1 >= 400 && mode1 < 1000 && mode2 >= 400 && mode2 < 1000 ) mDcand = 1.96835;
436 cout <<
"double tag modes are not from same particle ! " << endl;
440 vector<int> igood1, igood2;
441 igood1.clear(), igood2.clear();
443 EvtRecDTagCol::iterator iter_dtag = m_iterbegin;
445 for ( ; iter_dtag != m_iterend; iter_dtag++ )
447 int iter_mode = ( *iter_dtag )->decayMode();
448 int iter_charm = ( *iter_dtag )->charm();
449 int iter_type = ( *iter_dtag )->type();
453 if ( iter_mode == mode1 && iter_charm == tagcharm1 && iter_type == 1 )
454 igood1.push_back( index );
456 if ( iter_mode == mode2 && iter_charm == tagcharm2 && iter_type == 1 )
457 igood2.push_back( index );
461 if ( iter_mode == mode1 && iter_charm == tagcharm1 ) igood1.push_back( index );
463 if ( iter_mode == mode2 && iter_charm == tagcharm2 ) igood2.push_back( index );
471 if ( igood1.size() < 1 || igood2.size() < 1 )
return false;
473 bool isDtcand =
false;
474 int index_i = 0, index_j = 0;
476 EvtRecDTagCol::iterator iter_i, iter_j;
478 for (
int i = 0; i < igood1.size(); i++ )
481 iter_i = m_iterbegin + igood1[i];
482 int charm_i = ( *iter_i )->charm();
483 for (
int j = 0; j < igood2.size(); j++ )
485 iter_j = m_iterbegin + igood2[j];
486 int charm_j = ( *iter_j )->charm();
487 if ( charm_i * charm_j > 0 || igood2[j] == igood1[i] )
continue;
493 m_iterdtag1 = iter_i;
494 m_iterdtag2 = iter_j;
497 if (
compare( iter_i, iter_j, m_iterdtag1, m_iterdtag2, mDcand, smass ) )
499 m_iterdtag1 = iter_i;
500 m_iterdtag2 = iter_j;
513 int tagcharm1 = ( mode1 < 10 || mode1 >= 200 ) ? +1 : 0;
514 int tagcharm2 = ( mode2 < 10 || mode2 >= 200 ) ? -1 : 0;
516 if ( tagcharm1 * tagcharm2 > 0 )
518 cout <<
"double tagging warning! two modes can't have same nonzero charmness" << endl;
524 if ( mode1 < 200 && mode2 < 200 ) mDcand = 1.86484;
525 else if ( mode1 >= 200 && mode1 < 400 && mode2 >= 200 && mode2 < 400 ) mDcand = 1.86966;
526 else if ( mode1 >= 400 && mode1 < 1000 && mode2 >= 400 && mode2 < 1000 ) mDcand = 1.96835;
529 cout <<
"double tag modes are not from same particle ! " << endl;
533 vector<int> igood1, igood2;
534 igood1.clear(), igood2.clear();
536 EvtRecDTagCol::iterator iter_dtag = m_iterbegin;
539 for ( ; iter_dtag != m_iterend; iter_dtag++ )
541 int iter_mode = ( *iter_dtag )->decayMode();
542 int iter_charm = ( *iter_dtag )->charm();
543 int iter_type = ( *iter_dtag )->type();
547 if ( iter_mode == mode1 && iter_charm == tagcharm1 && iter_type == 1 )
548 igood1.push_back( index );
549 if ( tagcharm1 != 0 && iter_mode == mode1 && iter_charm == -tagcharm1 && iter_type == 1 )
550 igood1.push_back( index );
552 if ( iter_mode == mode2 && iter_charm == tagcharm2 && iter_type == 1 )
553 igood2.push_back( index );
554 if ( tagcharm2 != 0 && iter_mode == mode2 && iter_charm == -tagcharm2 && iter_type == 1 )
555 igood2.push_back( index );
559 if ( iter_mode == mode1 && iter_charm == tagcharm1 ) igood1.push_back( index );
560 if ( tagcharm1 != 0 && iter_mode == mode1 && iter_charm == -tagcharm1 )
561 igood1.push_back( index );
563 if ( iter_mode == mode2 && iter_charm == tagcharm2 ) igood2.push_back( index );
564 if ( tagcharm2 != 0 && iter_mode == mode2 && iter_charm == -tagcharm2 )
565 igood2.push_back( index );
573 bool isDtcand =
false;
574 EvtRecDTagCol::iterator iter_i, iter_j;
576 for (
int i = 0; i < igood1.size(); i++ )
579 iter_i = m_iterbegin + igood1[i];
580 int charm_i = ( *iter_i )->charm();
582 for (
int j = 0; j < igood2.size(); j++ )
584 iter_j = m_iterbegin + igood2[j];
585 int charm_j = ( *iter_j )->charm();
586 if ( charm_i * charm_j > 0 || igood2[j] == igood1[i] )
continue;
589 m_viterdtag1.push_back( m_iterbegin + igood1[i] );
590 m_viterdtag2.push_back( m_iterbegin + igood2[j] );
595 if ( m_viterdtag1.size() > 0 ) { isDtcand =
true; }
602 if ( tagcharm1 * tagcharm2 > 0 )
604 cout <<
"double tagging warning! two modes can't have same nonzero charmness" << endl;
610 if ( mode1 < 200 && mode2 < 200 ) mDcand = 1.86484;
611 else if ( mode1 >= 200 && mode1 < 400 && mode2 >= 200 && mode2 < 400 ) mDcand = 1.86966;
612 else if ( mode1 >= 400 && mode1 < 1000 && mode2 >= 400 && mode2 < 1000 ) mDcand = 1.96835;
615 cout <<
"double tag modes are not from same particle ! " << endl;
619 vector<int> igood1, igood2;
620 igood1.clear(), igood2.clear();
622 EvtRecDTagCol::iterator iter_dtag = m_iterbegin;
624 for ( ; iter_dtag != m_iterend; iter_dtag++ )
626 int iter_mode = ( *iter_dtag )->decayMode();
627 int iter_charm = ( *iter_dtag )->charm();
628 int iter_type = ( *iter_dtag )->type();
632 if ( iter_mode == mode1 && iter_charm == tagcharm1 && iter_type == 1 )
633 igood1.push_back( index );
635 if ( iter_mode == mode2 && iter_charm == tagcharm2 && iter_type == 1 )
636 igood2.push_back( index );
640 if ( iter_mode == mode1 && iter_charm == tagcharm1 ) igood1.push_back( index );
642 if ( iter_mode == mode2 && iter_charm == tagcharm2 ) igood2.push_back( index );
650 bool isDtcand =
false;
651 double deltaM = 1.00;
652 int index_i = 0, index_j = 0;
653 EvtRecDTagCol::iterator iter_i, iter_j;
655 for (
int i = 0; i < igood1.size(); i++ )
658 iter_i = m_iterbegin + igood1[i];
659 int charm_i = ( *iter_i )->charm();
660 for (
int j = 0; j < igood2.size(); j++ )
662 iter_j = m_iterbegin + igood2[j];
663 int charm_j = ( *iter_j )->charm();
664 if ( charm_i * charm_j > 0 || igood2[j] == igood1[i] )
continue;
668 m_viterdtag1.push_back( m_iterbegin + igood1[i] );
669 m_viterdtag2.push_back( m_iterbegin + igood2[j] );
674 if ( m_viterdtag1.size() > 0 ) isDtcand =
true;
685 cout <<
" print mode:" << ( *iter )->decayMode() << endl;
686 cout <<
"beam energy is:" << ( *iter )->beamE() << endl;
687 cout <<
"mBC is:" << ( *iter )->mBC() << endl;
688 cout <<
"deltaE is:" << ( *iter )->deltaE() << endl;
689 cout <<
"inv mass is:" << ( *iter )->mass() << endl;
690 cout <<
"charge is:" << ( *iter )->charge() << endl;
691 cout <<
"charm is:" << ( *iter )->charm() << endl;
692 cout <<
"num of children is:" << ( *iter )->numOfChildren() << endl;
694 cout <<
"found " << ( *iter )->tracks().size() <<
" same side tracks." << endl;
695 cout <<
"found " << ( *iter )->otherTracks().size() <<
" other side tracks." << endl;
696 cout <<
"found " << ( *iter )->showers().size() <<
" same side showers." << endl;
697 cout <<
"found " << ( *iter )->otherShowers().size() <<
" other side showers." << endl;
704 HepLorentzVector p41 = ( *pi0Itr )->hiPfit();
705 HepLorentzVector p42 = ( *pi0Itr )->loPfit();
706 return ( p41 + p42 );
716 HepLorentzVector p41 =
p4shower( emctrk1 );
717 HepLorentzVector p42 =
p4shower( emctrk2 );
718 return ( p41 + p42 );
722HepLorentzVector
DTagTool::etap4( EvtRecEtaToGGCol::iterator etaItr,
bool isconstrain ) {
726 HepLorentzVector p41 = ( *etaItr )->hiPfit();
727 HepLorentzVector p42 = ( *etaItr )->loPfit();
728 return ( p41 + p42 );
738 HepLorentzVector p41 =
p4shower( emctrk1 );
739 HepLorentzVector p42 =
p4shower( emctrk2 );
740 return ( p41 + p42 );
746 SmartRefVector<EvtRecTrack> showers = ( *iter_dtag )->showers();
747 if ( showers.size() < 2 * numpi0 )
749 cout <<
"too many pi0 required" << endl;
756 for ( EvtRecPi0Col::iterator pi0Itr = m_pi0iterbegin; pi0Itr < m_pi0iterend; pi0Itr++ )
763 int heGammaTrkId = heGammaTrk->
trackId();
764 int leGammaTrkId = leGammaTrk->
trackId();
766 for (
int index = 0; index < numpi0; ++index )
771 for (
int i = index * 2; i < index * 2 + 2; ++i )
774 if ( !isheid && heGammaTrkId == showers[i]->trackId() ) isheid =
true;
775 if ( !isleid && leGammaTrkId == showers[i]->trackId() ) isleid =
true;
778 if ( isheid && isleid ) canid.push_back( pi0Itr - m_pi0iterbegin );
781 if ( canid.size() == numpi0 )
794 SmartRefVector<EvtRecTrack> showers = ( *iter_dtag )->showers();
795 if ( showers.size() < 2 * numeta )
797 cout <<
"too many eta required" << endl;
804 for ( EvtRecEtaToGGCol::iterator etaItr = m_etaiterbegin; etaItr < m_etaiterend; etaItr++ )
811 int heGammaTrkId = heGammaTrk->
trackId();
812 int leGammaTrkId = leGammaTrk->
trackId();
814 for (
int index = 0; index < numeta; ++index )
819 for (
int i = index * 2; i < index * 2 + 2; ++i )
822 if ( !isheid && heGammaTrkId == showers[i]->trackId() ) isheid =
true;
823 if ( !isleid && leGammaTrkId == showers[i]->trackId() ) isleid =
true;
826 if ( isheid && isleid ) canid.push_back( etaItr - m_etaiterbegin );
829 if ( canid.size() == numeta )
842 SmartRefVector<EvtRecTrack> tracks = ( *iter_dtag )->tracks();
843 if ( tracks.size() < 2 * numks )
845 cout <<
"too many kshort required" << endl;
851 if ( tracks.size() == 0 )
return canid;
853 for ( EvtRecVeeVertexCol::iterator ksItr = m_ksiterbegin; ksItr < m_ksiterend; ksItr++ )
857 if ( ( *ksItr )->vertexId() != 310 )
continue;
859 EvtRecTrack* aKsChild1Trk = ( *ksItr )->daughter( 0 );
860 EvtRecTrack* aKsChild2Trk = ( *ksItr )->daughter( 1 );
862 int ksChild1TrkId = aKsChild1Trk->
trackId();
863 int ksChild2TrkId = aKsChild2Trk->
trackId();
865 for (
int index = 0; index < numks; ++index )
870 for (
int i = index * 2; i < index * 2 + 2; ++i )
872 if ( !isc1id && ksChild1TrkId == tracks[i]->trackId() ) isc1id =
true;
873 if ( !isc2id && ksChild2TrkId == tracks[i]->trackId() ) isc2id =
true;
876 if ( isc1id && isc2id ) canid.push_back( ksItr - m_ksiterbegin );
879 if ( canid.size() == numks )
891 double Eemc = shower->
energy();
892 double phi = shower->
phi();
893 double theta = shower->
theta();
894 HepLorentzVector
p4( Eemc *
sin( theta ) *
cos( phi ), Eemc *
sin( theta ) *
sin( phi ),
895 Eemc *
cos( theta ), Eemc );
930 double dr( 0 ), phi0( 0 ), kappa( 0 ), dz( 0 ), tanl( 0 );
939 if ( kappa > 0.0000000001 ) charge = 1;
940 else if ( kappa < -0.0000000001 ) charge = -1;
943 if ( kappa != 0 ) pxy = 1.0 / fabs( kappa );
945 double px = pxy * ( -
sin( phi0 ) );
946 double py = pxy *
cos( phi0 );
947 double pz = pxy * tanl;
949 double e = sqrt( pxy * pxy + pz * pz +
mass *
mass );
951 return HepLorentzVector( px, py, pz, e );
956 SmartRefVector<EvtRecTrack> pionid = ( *m_iterbegin )->pionId();
958 for (
int i = 0; i < pionid.size(); i++ )
960 if ( trk->
trackId() == pionid[i]->trackId() )
971 SmartRefVector<EvtRecTrack> kaonid = ( *m_iterbegin )->kaonId();
973 for (
int i = 0; i < kaonid.size(); i++ )
975 if ( trk->
trackId() == kaonid[i]->trackId() )
987 m_simplePIDSvc->preparePID( trk );
988 return ( m_simplePIDSvc->iselectron(
true ) );
1023 double dedxchi = -99;
1030 dedxchi = dedxTrk->
chiMu();
1036 ptrk = mdcKalTrk->
p();
1044 double eop = Eemc / ptrk;
1049 depth = mucTrk->
depth();
1052 if ( fabs( dedxchi ) < 5 && fabs( Eemc ) > 0.15 && fabs( Eemc ) < 0.3 &&
1053 ( depth >= 80 * ptrk - 60 || depth > 40 ) )
1062 Hep3Vector xorigin( 0, 0, 0 );
1064 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc ).ignore();
1069 xorigin.setX( dbv[0] );
1070 xorigin.setY( dbv[1] );
1071 xorigin.setZ( dbv[2] );
1077 HepSymMatrix Ea = mdcKalTrk->
getZError();
1079 HepPoint3D IP( xorigin[0], xorigin[1], xorigin[2] );
1080 VFHelix helixp( pivot, a, Ea );
1082 HepVector
vec = helixp.
a();
1083 double vrl =
vec[0];
1084 double vzl =
vec[3];
1085 double costheta =
cos( mdcKalTrk->
theta() );
1087 if ( fabs( vrl ) < 1 && fabs( vzl ) < 10 && fabs( costheta ) < 0.93 )
return true;
1095 Hep3Vector xorigin( 0, 0, 0 );
1097 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc ).ignore();
1102 xorigin.setX( dbv[0] );
1103 xorigin.setY( dbv[1] );
1104 xorigin.setZ( dbv[2] );
1110 HepSymMatrix Ea = mdcKalTrk->
getZError();
1112 HepPoint3D IP( xorigin[0], xorigin[1], xorigin[2] );
1113 VFHelix helixp( pivot, a, Ea );
1115 HepVector
vec = helixp.
a();
1116 double vrl =
vec[0];
1117 double vzl =
vec[3];
1118 double costheta =
cos( mdcKalTrk->
theta() );
1120 if ( fabs( vzl ) < 20 && fabs( costheta ) < 0.93 ) {
return true; }
1127 double eraw = emcTrk->
energy();
1129 double costh =
cos( emcTrk->
theta() );
1130 if ( ( ( fabs( costh ) < 0.80 && eraw > 0.025 ) ||
1131 ( fabs( costh ) > 0.86 && fabs( costh ) < 0.92 && eraw > 0.05 ) ) &&
1141 Hep3Vector xorigin( 0, 0, 0 );
1143 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc ).ignore();
1148 xorigin.setX( dbv[0] );
1149 xorigin.setY( dbv[1] );
1150 xorigin.setZ( dbv[2] );
1153 SmartDataPtr<EvtRecTrackCol> evtRecTrackCol(
eventSvc(),
1157 Hep3Vector emcpos( emcTrk->
x(), emcTrk->
y(), emcTrk->
z() );
1158 Hep3Vector Gm_Vec( emcTrk->
x(), emcTrk->
y(), emcTrk->
z() );
1159 Hep3Vector Gm_Mom = Gm_Vec - xorigin;
1160 Gm_Mom.setMag( emcTrk->
energy() );
1161 HepLorentzVector shP4( Gm_Mom, emcTrk->
energy() );
1163 double costh = shP4.vect().cosTheta();
1164 double eraw = emcTrk->
energy();
1167 if ( !( ( fabs( costh ) < 0.80 && eraw > 0.025 ) ||
1168 ( fabs( costh ) > 0.86 && fabs( costh ) < 0.92 && eraw > 0.05 ) ) )
1171 for (
int j = 0; j < evtRecEvent->totalCharged(); j++ )
1174 if ( !( *jtTrk )->isExtTrackValid() )
continue;
1178 double angd = extpos.angle( emcpos );
1179 if ( angd < dang ) dang = angd;
1181 if ( dang >= 200 )
return false;
1182 dang = dang * 180 / ( CLHEP::pi );
1183 if ( fabs( dang ) < shwDang )
return false;
1190 vector<EvtRecTrackIterator> iGood;
1197 if ( iGood.size() != 2 )
return true;
1200 double time1 = -99, time2 = -99;
1201 for ( vector<EvtRecTrackIterator>::size_type i = 0; i < 2; i++ )
1203 if ( ( *iGood[i] )->isTofTrackValid() )
1205 SmartRefVector<RecTofTrack> tofTrkCol = ( *iGood[i] )->tofTrack();
1206 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
1208 for ( ; iter_tof != tofTrkCol.end(); iter_tof++ )
1211 status->
setStatus( ( *iter_tof )->status() );
1214 if ( i == 0 ) time1 = ( *iter_tof )->tof();
1215 else time2 = ( *iter_tof )->tof();
1221 if ( time1 != -99 && time2 != -99 && fabs( time1 - time2 ) > 5 )
return false;
1227 if (
isMuon( *iGood[0] ) &&
isMuon( *iGood[1] ) )
return false;
1233 bool gotgoodshower =
false;
1238 if ( !( *iter )->isEmcShowerValid() )
continue;
1241 double eraw = emcTrk->
energy();
1243 if ( !( eraw > 0.05 &&
time > 0 &&
time < 14 ) )
continue;
1248 if ( angle1 > 20 && angle2 > 20 )
1250 gotgoodshower =
true;
1255 return gotgoodshower;
1264 double angle = -100;
1267 Hep3Vector emcpos( emcTrk->
x(), emcTrk->
y(), emcTrk->
z() );
1274 Hep3Vector temp( -99, -99, -99 );
1275 if ( extpos == temp )
return angle;
1277 return extpos.angle( emcpos ) * 180 / CLHEP::pi;
1282 SmartRefVector<EvtRecTrack> tracks1 = ( *iter1 )->tracks();
1283 SmartRefVector<EvtRecTrack> showers1 = ( *iter1 )->showers();
1284 SmartRefVector<EvtRecTrack> tracks2 = ( *iter2 )->tracks();
1285 SmartRefVector<EvtRecTrack> showers2 = ( *iter2 )->showers();
1288 for (
int i = 0; i < tracks1.size(); i++ )
1290 for (
int j = 0; j < tracks2.size(); j++ )
1292 if ( tracks1[i] == tracks2[j] )
return true;
1297 for (
int i = 0; i < showers1.size(); i++ )
1299 for (
int j = 0; j < showers2.size(); j++ )
1301 if ( showers1[i] == showers2[j] )
return true;
1310 if ( m_evtSvc == 0 )
1313 StatusCode sc = Gaudi::svcLocator()->service(
"EventDataSvc", m_evtSvc,
true );
1314 if ( sc.isFailure() ) { assert(
false ); }
HepGeom::Point3D< double > HepPoint3D
EvtRecTrackCol::iterator EvtRecTrackIterator
DOUBLE_PRECISION count[3]
double sin(const BesAngle a)
double cos(const BesAngle a)
const Hep3Vector emcPosition() const
const int emcVolumeNumber() const
const double theta() const
static void setPidType(PidType pidType)
bool isMdcKalTrackValid()
RecEmcShower * emcShower()
RecMdcKalTrack * mdcKalTrack()
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
const HepVector & getZHelix() const
HepVector & getZHelixMu()
const HepSymMatrix & getZError() const
void setStatus(unsigned int status)
const HepPoint3D & pivot(void) const
returns pivot position.
const HepVector & a(void) const
returns helix parameters.
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecDTagCol
_EXTERN_ std::string EvtRecTrackCol