288 MsgStream log(
msgSvc(), name());
289 log << MSG::INFO <<
"in execute()" << endreq;
291 vector<double> Curve_Para, Sigma_Para;
296 if(i==0) vFlag[0] = (int) dedxcursvc->
getCurve(i);
297 else Curve_Para.push_back( dedxcursvc->
getCurve(i) );
301 if(i==0) vFlag[1] = (int) dedxcursvc->
getSigma(i);
302 else Sigma_Para.push_back( dedxcursvc->
getSigma(i) );
306 if(vFlag[0] ==1 && Curve_Para.size() != 5)
307 cout<<
" size of dedx curve paramters for version 1 is not right!"<<endl;
308 if(vFlag[0] ==2 && Curve_Para.size() != 16)
309 cout<<
" size of dedx curve paramters for version 2 is not right!"<<endl;
311 if(vFlag[1] ==1 && Sigma_Para.size() != 14)
312 cout<<
" size of dedx sigma paramters for version 1 is not right!"<<endl;
313 if(vFlag[1] ==2 && Sigma_Para.size() != 21)
314 cout<<
" size of dedx sigma paramters for version 2 is not right!"<<endl;
315 if(vFlag[1] ==3 && Sigma_Para.size() != 18)
316 cout<<
" size of dedx sigma paramters for version 3 is not right!"<<endl;
317 if(vFlag[1] ==4 && Sigma_Para.size() != 19)
318 cout<<
" size of dedx sigma paramters for version 4 is not right!"<<endl;
319 if(vFlag[1] ==5 && Sigma_Para.size() != 22)
320 cout<<
" size of dedx sigma paramters for version 5 is not right!"<<endl;
324 DataObject *aReconEvent;
325 eventSvc()->findObject(
"/Event/Recon",aReconEvent);
326 if(aReconEvent==NULL)
329 StatusCode sc = eventSvc()->registerObject(
"/Event/Recon",aReconEvent);
330 if(sc!=StatusCode::SUCCESS)
332 log << MSG::FATAL <<
"Could not register ReconEvent" <<endreq;
333 return( StatusCode::FAILURE);
337 SmartIF<IDataManagerSvc> dataManSvc(eventSvc());
339 DataObject *aDedxcol;
340 eventSvc()->findObject(
"/Event/Recon/RecMdcDedxCol",aDedxcol);
343 dataManSvc->clearSubTree(
"/Event/Recon/RecMdcDedxCol");
344 eventSvc()->unregisterObject(
"/Event/Recon/RecMdcDedxCol");
349 if(!dedxsc.isSuccess())
351 log << MSG::FATAL <<
" Could not register Mdc dedx collection" <<endreq;
352 return ( StatusCode::FAILURE);
355 DataObject *aDedxhitcol;
356 eventSvc()->findObject(
"/Event/Recon/RecMdcDedxHitCol",aDedxhitcol);
357 if(aDedxhitcol != NULL)
359 dataManSvc->clearSubTree(
"/Event/Recon/RecMdcDedxHitCol");
360 eventSvc()->unregisterObject(
"/Event/Recon/RecMdcDedxHitCol");
363 StatusCode dedxhitsc;
365 if(!dedxhitsc.isSuccess())
367 log << MSG::FATAL <<
" Could not register Mdc dedx collection" <<endreq;
368 return ( StatusCode::FAILURE);
371 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
374 log << MSG::INFO <<
"Could not find Event Header" << endreq;
375 return( StatusCode::FAILURE);
377 int eventNO = eventHeader->eventNumber();
378 int runNO = eventHeader->runNumber();
379 log << MSG::INFO <<
"now begin the event: runNO= "<<runNO<<
" eventNO= "<< eventNO<< endreq;
395 if(runNO < 0) vFlag[2]=1;
400 SmartDataPtr<RecEsTimeCol> estimeCol(eventSvc(),
"/Event/Recon/RecEsTimeCol");
403 log << MSG::WARNING <<
"Could not find EvTimeCol" << endreq;
407 RecEsTimeCol::iterator iter_evt = estimeCol->begin();
408 for(; iter_evt!=estimeCol->end(); iter_evt++)
410 tes = (*iter_evt)->getTest();
411 esTimeflag = (*iter_evt)->getStat();
423 log << MSG::DEBUG <<
"recalg: "<<recalg<<endreq;
429 SmartDataPtr<RecMdcKalTrackCol> newtrkCol(eventSvc(),
"/Event/Recon/RecMdcKalTrackCol");
432 log << MSG::WARNING <<
"Could not find RecMdcKalTrackCol" << endreq;
433 return StatusCode::SUCCESS;
436 ntrk = newtrkCol->size();
437 log << MSG::DEBUG <<
"track collection size: " << newtrkCol->size() <<endreq;
439 RecMdcKalTrackCol::iterator trk = newtrkCol->begin();
441 for( ; trk != newtrkCol->end(); trk++)
447 if(gothits.size()==0)
450 int trkid=(*trk)->trackId();
456 if(gothits.size()<2)
continue;
457 kaltrackrec(trk, mdcid, tes, runNO, runFlag, log );
468 SmartDataPtr<RecMdcTrackCol> newtrkCol(eventSvc(),
"/Event/Recon/RecMdcTrackCol");
471 log << MSG::WARNING <<
"Could not find RecMdcTrackCol" << endreq;
472 return StatusCode::SUCCESS;
475 ntrk = newtrkCol->size();
476 log << MSG::DEBUG <<
"track collection size: " << newtrkCol->size() <<endreq;
478 vector<double> phlist;
479 vector<double> phlist_hit;
480 double m_d0E=0,m_phi0E=0,m_cpaE=0,m_z0E=0,phi0=0,costheta=0,sintheta=0,m_Pt=0,m_P=0;
481 int charge=0,layid=0,localwid=0,w0id=0,wid=0,lr=-2;
482 double adc_raw=0,tdc_raw=0,zhit=0,driftd=0,driftD=0,driftT=0,dd=0,eangle=0;
484 double ph=0,ph_hit=0,pathlength=0,rphi_path=0;
486 RecMdcTrackCol::iterator trk = newtrkCol->begin();
487 for( ; trk != newtrkCol->end(); trk++)
492 log << MSG::DEBUG <<
" %%%%% trk id = "<<trk_ex.
trk_id() <<endreq;
493 log << MSG::DEBUG <<
" %%%%% initial id = "<<(*trk)->trackId() <<endreq;
495 HepVector a = (*trk)->helix();
496 HepSymMatrix tkErrM = (*trk)->err();
497 m_d0E = tkErrM[0][0];
498 m_phi0E = tkErrM[1][1];
499 m_cpaE = tkErrM[2][2];
500 m_z0E = tkErrM[3][3];
504 log << MSG::DEBUG <<
"MDC Helix 5 parameters: "<<a[0]<<
" "<<a[1]<<
" "<<a[2]<<
" "<<a[3]<<
" "<<a[4]<<endreq;
507 costheta =
cos(M_PI_2-atan(a[4]));
509 sintheta =
sin(M_PI_2-atan(a[4]));
510 m_Pt = 1.0/fabs( a[2] );
511 m_P = m_Pt*sqrt(1 + a[4]*a[4]);
512 charge = ( a[2] > 0 )? 1 : -1;
518 Nhits = gothits.size();
519 log << MSG::DEBUG <<
"hits size = " <<gothits.size()<<endreq;
522 delete dedxhitrefvec;
528 HitRefVec::iterator it_gothit = gothits.begin();
529 for( ; it_gothit != gothits.end(); it_gothit++)
531 mdcid = (*it_gothit)->getMdcId();
535 wid = w0id + localwid;
536 adc_raw = (*it_gothit)->getAdc();
537 tdc_raw = (*it_gothit)->getTdc();
538 log << MSG::INFO <<
"hit layer id " <<layid<<
" wire id: " <<localwid<<
" adc_raw: " <<adc_raw<<
" tdc_raw: "<<tdc_raw<<endreq;
539 zhit = (*it_gothit)->getZhit();
540 lr = (*it_gothit)->getFlagLR();
541 if(lr == 2) cout<<
"lr = "<<lr<<endl;
542 if(lr == 0 || lr == 2) driftD = (*it_gothit)->getDriftDistLeft();
543 else driftD = (*it_gothit)->getDriftDistRight();
545 driftd =
abs(driftD);
546 dd = (*it_gothit)->getDoca();
547 if(lr == 0 || lr == 2 ) dd = -
abs(dd);
548 if(lr == 1 ) dd =
abs(dd);
549 driftT = (*it_gothit)->getDriftT();
551 eangle = (*it_gothit)->getEntra();
552 eangle = eangle/
M_PI;
553 pathlength=exsvc->
PathL( ntpFlag, exhel, layid, localwid, zhit);
554 rphi_path=pathlength * sintheta;
557 ph=exsvc->
StandardHitCorrec(0,runFlag,ntpFlag,runNO,pathlength,wid,layid,adc_raw,dd,eangle,costheta);
562 if(runNO<=5911 && runNO>=5854 && layid ==14)
continue;
587 if (ph<0.0||ph==0)
continue;
601 if(m_rootfile!=
"no rootfile")
603 m_hitNo_wire->Fill(wid);
609 m_charge1 = (*trk)->charge();
615 m_localwid = localwid;
621 m_driftdist = driftD;
623 m_costheta1 = costheta;
624 m_pathL = pathlength;
628 m_trackId1 = trk_ex.
trk_id();
629 StatusCode status2 = m_nt2->write();
630 if ( status2.isFailure() )
631 log << MSG::ERROR <<
"Cannot fill Ntuple n102" << endreq;
635 phlist.push_back(ph);
636 phlist_hit.push_back(ph_hit);
639 dedxhitList->push_back( dedxhit );
640 dedxhitrefvec->push_back( dedxhit );
645 ex_trks.push_back(trk_ex );
646 m_trkalgs.push_back(m_trkalg);
648 delete dedxhitrefvec;
653 log << MSG::DEBUG <<
"size in processing: " << ex_trks.size() <<endreq;
662 SmartDataPtr<RecMdcKalTrackCol> newtrkCol(eventSvc(),
"/Event/Recon/RecMdcKalTrackCol");
665 log << MSG::WARNING <<
"Could not find RecMdcKalTrackCol" << endreq;
666 return StatusCode::SUCCESS;
669 ntrk = newtrkCol->size();
670 log << MSG::DEBUG <<
"track collection size: " << newtrkCol->size() <<endreq;
672 vector<double> phlist;
673 vector<double> phlist_hit;
674 double m_d0E=0,m_phi0E=0,m_cpaE=0,m_z0E=0,phi0=0,costheta=0,sintheta=0,m_Pt=0,m_P=0;
675 int charge=0,layid=0,localwid=0,w0id=0,wid=0,lr=-2;
676 double p_hit=0,adc_raw=0,tdc_raw=0,zhit=0,driftd=0,driftD=0,driftT=0,dd_in=0,dd_ex=0,eangle=0;
678 double ph=0,ph_hit=0,pathlength=0,rphi_path=0;
681 RecMdcKalTrackCol::iterator trk = newtrkCol->begin();
682 for( ; trk != newtrkCol->end(); trk++)
687 log << MSG::DEBUG <<
" %%%%% trk id = "<<trk_ex.
trk_id() <<endreq;
688 log << MSG::DEBUG <<
" %%%%% initial id = "<<(*trk)->trackId() <<endreq;
692 if(ParticleFlag>-1&&ParticleFlag<5)
696 tkErrM = dstTrk->
getFError(ParticleFlag);
700 a = (*trk)->getFHelix();
701 tkErrM = (*trk)->getFError();
704 log << MSG::DEBUG <<
"FHelix 5 parameters: "<<a[0]<<
" "<<a[1] <<
" "<<a[2]<<
" "<<a[3]<<
" "<<a[4]<<endreq;
706 m_d0E = tkErrM[0][0];
707 m_phi0E = tkErrM[1][1];
708 m_cpaE = tkErrM[2][2];
709 m_z0E = tkErrM[3][3];
712 costheta =
cos(M_PI_2-atan(a[4]));
714 sintheta =
sin(M_PI_2-atan(a[4]));
715 m_Pt = 1.0/fabs( a[2] );
716 m_P = m_Pt*sqrt(1 + a[4]*a[4]);
718 charge = ( a[2] > 0 )? 1 : -1;
726 Nhits = gothits.size();
727 log << MSG::DEBUG <<
"hits size = " <<gothits.size()<<endreq;
730 delete dedxhitrefvec;
736 HelixSegRefVec::iterator it_gothit = gothits.begin();
737 for( ; it_gothit != gothits.end(); it_gothit++)
739 HepVector a_hit_in = (*it_gothit)->getHelixIncl();
744 p_hit = 1.0/fabs(a_hit_in(3))*sqrt(1+a_hit_in(5)*a_hit_in(5));
747 mdcid = (*it_gothit)->getMdcId();
751 wid = w0id + localwid;
752 adc_raw = (*it_gothit)->getAdc();
753 tdc_raw = (*it_gothit)->getTdc();
754 log << MSG::INFO <<
"hit layer id " <<layid<<
" wire id: " <<localwid<<
" adc_raw: " <<adc_raw<<
" tdc_raw: "<<tdc_raw<<endreq;
755 zhit = (*it_gothit)->getZhit();
756 lr = (*it_gothit)->getFlagLR();
757 if(lr == 2) cout<<
"lr = "<<lr<<endl;
758 driftD = (*it_gothit)->getDD();
759 driftd =
abs(driftD);
760 driftT = (*it_gothit)->getDT();
761 dd_in = (*it_gothit)->getDocaIncl();
762 dd_ex = (*it_gothit)->getDocaExcl();
764 if(lr==-1 || lr == 2) {dd_in = dd_in; dd_ex = dd_ex;}
765 else if(lr ==1) {dd_in = -dd_in; dd_ex = -dd_ex;}
769 eangle = (*it_gothit)->getEntra();
770 eangle = eangle/
M_PI;
771 pathlength=exsvc->
PathL( ntpFlag, exhel_hit_in, layid, localwid, zhit);
772 rphi_path=pathlength * sintheta;
774 ph=exsvc->
StandardHitCorrec(0,runFlag,ntpFlag,runNO,pathlength,wid,layid,adc_raw,dd_in,eangle,costheta);
779 if(runNO<=5911 && runNO>=5854 && layid ==14)
continue;
804 if (ph<0.0||ph==0)
continue;
818 if(m_rootfile!=
"no rootfile")
820 m_hitNo_wire->Fill(wid);
826 m_charge1 = (*trk)->charge();
832 m_localwid = localwid;
838 m_driftdist = driftD;
840 m_costheta1 = costheta;
841 m_pathL = pathlength;
846 m_trackId1 = trk_ex.
trk_id();
847 StatusCode status2 = m_nt2->write();
848 if ( status2.isFailure() )
849 log << MSG::ERROR <<
"Cannot fill Ntuple n102" << endreq;
853 phlist.push_back(ph);
854 phlist_hit.push_back(ph_hit);
857 dedxhitList->push_back( dedxhit );
858 dedxhitrefvec->push_back( dedxhit );
863 ex_trks.push_back(trk_ex );
864 m_trkalgs.push_back(m_trkalg);
866 delete dedxhitrefvec;
871 log << MSG::DEBUG <<
"size in processing: " << ex_trks.size() <<endreq;
876 if( ntrk != ex_trks.size())
877 log << MSG::DEBUG <<
"ntrkCol size: "<<ntrk<<
" dedxtrk size: "<<ex_trks.size()<< endreq;
879 double poca_x=0,poca_y=0,poca_z=0;
880 float sintheta=0,costheta=0,ptrk=0,charge=0;
881 int Nhit=0,Nphlisthit=0;
883 double phtm=0,median=0,geometric=0,geometric_trunc=0,harmonic=0,harmonic_trunc=0,transform=0,logtrunc=0;
886 float probpid_temp=-0.01,expect_temp=-0.01,sigma_temp=-0.01,chidedx_temp=-0.01;
888 double dEdx_meas_hit=0;
889 double dEdx_meas=0,dEdx_meas_esat=0,dEdx_meas_norun=0;
893 for(std::vector<MdcDedxTrk>::iterator it = ex_trks.begin(); it != ex_trks.end(); it++, idedxid++ )
895 log << MSG::DEBUG <<
"-------------------------------------------------------"<< endreq;
896 log << MSG::DEBUG <<
" trk id ="<< it->trk_id()<<
" : P ="<<it->P() <<
" Pt ="<<it->Pt()<<
" : theta ="<<it->theta() <<
" : phi ="<<it->phi()<<
" : charge = "<<it->charge()<<endreq;
897 log << MSG::DEBUG <<
"all hits on track: "<<it->nsample()<<
" phlist size: "<<it->get_phlist().size()<<endreq;
899 if(it->trk_ptr_kal()!=0)
901 poca_x = it->trk_ptr_kal()->x();
902 poca_y = it->trk_ptr_kal()->y();
903 poca_z = it->trk_ptr_kal()->z();
905 else if(it->trk_ptr()!=0)
907 poca_x = it->trk_ptr()->x();
908 poca_y = it->trk_ptr()->y();
909 poca_z = it->trk_ptr()->z();
913 sintheta =
sin(it->theta());
914 costheta =
cos(it->theta());
916 charge = it->charge();
917 Nhit = it->nsample();
918 Nphlisthit = it->get_phlist_hit().size();
922 phtm = it->cal_dedx( truncate );
932 if(m_alg==1) dEdx_meas_hit = it->cal_dedx_bitrunc(truncate, 0, usedhit);
933 else if(m_alg==2) dEdx_meas_hit = it-> cal_dedx_transform(1);
934 else if(m_alg==3) dEdx_meas_hit = it->cal_dedx_log(1.0, 1);
935 else cout<<
"-------------Truncate Algorithm Error!!!------------------------"<<endl;
936 if(m_alg==1 && usedhit==0)
938 cout<<
"***************bad extrk with no hits!!!!!******************"<<endl;
942 usedhit = (int)(Nphlisthit*truncate);
946 dEdx_meas_esat = exsvc->
StandardTrackCorrec(1,runFlag, ntpFlag, runNO, dEdx_meas_hit,
cos(it->theta()), tes );
947 dEdx_meas_norun = exsvc->
StandardTrackCorrec(2,runFlag, ntpFlag, runNO, dEdx_meas_hit,
cos(it->theta()), tes );
948 log << MSG::INFO <<
"===================== " << endreq << endreq;
949 log << MSG::DEBUG <<
"dEdx_meas_hit: "<<dEdx_meas_hit<<
" dEdx_meas: "<<dEdx_meas<<
" dEdx_meas_esat: "<<dEdx_meas_esat<<
" dEdx_meas_norun: "<<dEdx_meas_norun<<
" ptrk: "<<it->P()<<endreq;
950 log << MSG::INFO <<
"ptrk " << ptrk <<
" costhe " << costheta <<
" runno " << runNO <<
" evtno " << eventNO << endreq;
953 trk_recalg = m_trkalgs[idedxid];
955 if(dEdx_meas<0 || dEdx_meas==0)
continue;
956 it->set_dEdx( landau , dEdx_meas, trk_recalg, runFlag, vFlag , tes, Curve_Para, Sigma_Para, ex_calib);
964 if(it->pprob()[i]>probpid_temp)
967 probpid_temp = it->pprob()[i];
968 expect_temp = it->pexpect()[i];
969 sigma_temp = it->pexp_sigma()[i];
970 chidedx_temp = it->pchi_dedx()[i];
973 log<< MSG::INFO<<
"expect dE/dx: type: "<<parType_temp<<
" probpid: "<<probpid_temp<<
" expect: "<<expect_temp<<
" sigma: "<<sigma_temp<<
" chidedx: "<<chidedx_temp<<endreq;
988 resdedx->
setChi( it->pchi_dedx() );
1014 m_dEdx_meas = dEdx_meas;
1020 m_sintheta=sintheta;
1021 m_costheta=costheta;
1027 m_trackId = it->trk_id();
1028 m_recalg = trk_recalg;
1031 m_nphlisthit=Nphlisthit;
1033 for(
int i=0; i<Nphlisthit; i++) m_dEdx_hit[i] = it->get_phlist_hit()[i];
1035 m_parttype = parType_temp;
1036 m_prob = probpid_temp;
1037 m_expect = expect_temp;
1038 m_sigma = sigma_temp;
1039 m_chidedx = chidedx_temp;
1040 m_chidedxe=it->pchi_dedx()[0];
1041 m_chidedxmu=it->pchi_dedx()[1];
1042 m_chidedxpi=it->pchi_dedx()[2];
1043 m_chidedxk=it->pchi_dedx()[3];
1044 m_chidedxp=it->pchi_dedx()[4];
1045 for(
int i=0;i<5;i++)
1047 m_probpid[i]= it->pprob()[i];
1048 m_expectid[i]= it->pexpect()[i];
1049 m_sigmaid[i]= it->pexp_sigma()[i];
1052 StatusCode status = m_nt1->write();
1053 if ( status.isFailure() )
1055 log << MSG::ERROR <<
"Cannot fill Ntuple n103" << endreq;
1059 log<< MSG::INFO<<
"-----------------Summary of this ExTrack----------------"<<endreq
1060 <<
"dEdx_mean: "<<dEdx_meas<<
" type: "<<parType_temp<<
" probpid: "<<probpid_temp
1061 <<
" expect: "<<expect_temp<<
" sigma: "<<sigma_temp<<
" chidedx: "<<chidedx_temp<<endreq<<endreq;
1063 dedxList->push_back( resdedx );
1069 SmartDataPtr<RecMdcDedxCol> newexCol(eventSvc(),
"/Event/Recon/RecMdcDedxCol");
1072 log << MSG::FATAL <<
"Could not find RecMdcDedxCol" << endreq;
1073 return( StatusCode::SUCCESS);
1075 log << MSG::DEBUG <<
"----------------Begin to check RecMdcDedxCol-----------------"<<endreq;
1076 RecMdcDedxCol::iterator it_dedx = newexCol->begin();
1077 for( ; it_dedx != newexCol->end(); it_dedx++)
1079 log << MSG::INFO <<
"retrieved MDC dE/dx:" << endreq
1080 <<
"dEdx Id: " << (*it_dedx)->trackId()
1081 <<
" part Id: " << (*it_dedx)->particleType()
1082 <<
" measured dEdx: " << (*it_dedx)->probPH()
1083 <<
" dEdx std: " << (*it_dedx)->normPH() << endreq
1084 <<
"hits on track: "<<(*it_dedx)->numTotalHits()
1085 <<
" usedhits: " << (*it_dedx)->numGoodHits() << endreq
1086 <<
"Electron: expect: " << (*it_dedx)->getDedxExpect(0)
1087 <<
" sigma: " << (*it_dedx)->getSigmaDedx(0)
1088 <<
" chi: " << (*it_dedx)->chi(0)
1089 <<
" prob: " << (*it_dedx)->getPidProb(0) << endreq
1090 <<
"Muon: expect: " << (*it_dedx)->getDedxExpect(1)
1091 <<
" sigma: " << (*it_dedx)->getSigmaDedx(1)
1092 <<
" chi: " << (*it_dedx)->chi(1)
1093 <<
" prob: " << (*it_dedx)->getPidProb(1) << endreq
1094 <<
"Pion: expect: " << (*it_dedx)->getDedxExpect(2)
1095 <<
" sigma: " << (*it_dedx)->getSigmaDedx(2)
1096 <<
" chi: " << (*it_dedx)->chi(2)
1097 <<
" prob: " << (*it_dedx)->getPidProb(2) << endreq
1098 <<
"Kaon: expect: " << (*it_dedx)->getDedxExpect(3)
1099 <<
" sigma: " << (*it_dedx)->getSigmaDedx(3)
1100 <<
" chi: " << (*it_dedx)->chi(3)
1101 <<
" prob: " << (*it_dedx)->getPidProb(3) << endreq
1102 <<
"Proton: expect: " << (*it_dedx)->getDedxExpect(4)
1103 <<
" sigma: " << (*it_dedx)->getSigmaDedx(4)
1104 <<
" chi: " << (*it_dedx)->chi(4)
1105 <<
" prob: " << (*it_dedx)->getPidProb(4) << endreq;
1107 return StatusCode::SUCCESS;
1119 vector<double> phlist;
1120 vector<double> phlist_hit;
1121 double m_d0E=0,m_phi0E=0,m_cpaE=0,m_z0E=0,phi0=0,costheta=0,sintheta=0,m_Pt=0,m_P=0;
1122 int charge=0,layid=0,localwid=0,w0id=0,wid=0,lr=-2;
1123 double adc_raw=0,tdc_raw=0,zhit=0,driftd=0,driftD=0,driftT=0,dd=0,eangle=0;
1125 double ph=0,ph_hit=0,pathlength=0,rphi_path=0;
1128 log << MSG::DEBUG <<
" %%%%% trk id = "<<trk_ex.
trk_id() <<endreq;
1129 log << MSG::DEBUG <<
" %%%%% initial id = "<<(*trk)->trackId() <<endreq;
1131 HepVector a = (*trk)->helix();
1132 HepSymMatrix tkErrM = (*trk)->err();
1133 m_d0E = tkErrM[0][0];
1134 m_phi0E = tkErrM[1][1];
1135 m_cpaE = tkErrM[2][2];
1136 m_z0E = tkErrM[3][3];
1140 log << MSG::DEBUG <<
"MDC Helix 5 parameters: "<<a[0]<<
" "<<a[1]<<
" "<<a[2]<<
" "<<a[3]<<
" "<<a[4]<<endreq;
1143 costheta =
cos(M_PI_2-atan(a[4]));
1145 sintheta =
sin(M_PI_2-atan(a[4]));
1146 m_Pt = 1.0/fabs( a[2] );
1147 m_P = m_Pt*sqrt(1 + a[4]*a[4]);
1148 charge = ( a[2] > 0 )? 1 : -1;
1153 HitRefVec gothits= (*trk)->getVecHits();
1154 Nhits = gothits.size();
1155 log << MSG::DEBUG <<
"hits size = " <<gothits.size()<<endreq;
1159 HitRefVec::iterator it_gothit = gothits.begin();
1160 for( ; it_gothit != gothits.end(); it_gothit++)
1162 mdcid = (*it_gothit)->getMdcId();
1166 wid = w0id + localwid;
1167 adc_raw = (*it_gothit)->getAdc();
1168 tdc_raw = (*it_gothit)->getTdc();
1169 log << MSG::INFO <<
"hit layer id " <<layid<<
" wire id: " <<localwid<<
" adc_raw: " <<adc_raw<<
" tdc_raw: "<<tdc_raw<<endreq;
1170 zhit = (*it_gothit)->getZhit();
1171 lr = (*it_gothit)->getFlagLR();
1172 if(lr == 2) cout<<
"lr = "<<lr<<endl;
1173 if(lr == 0 || lr == 2) driftD = (*it_gothit)->getDriftDistLeft();
1174 else driftD = (*it_gothit)->getDriftDistRight();
1176 driftd =
abs(driftD);
1177 dd = (*it_gothit)->getDoca();
1178 if(lr == 0 || lr == 2 ) dd = -
abs(dd);
1179 if(lr == 1 ) dd =
abs(dd);
1180 driftT = (*it_gothit)->getDriftT();
1182 eangle = (*it_gothit)->getEntra();
1183 eangle = eangle/
M_PI;
1184 pathlength=exsvc->
PathL( ntpFlag, exhel, layid, localwid, zhit);
1185 rphi_path=pathlength * sintheta;
1188 ph=exsvc->
StandardHitCorrec(0,runFlag,ntpFlag,runNO,pathlength,wid,layid,adc_raw,dd,eangle,costheta);
1193 if(runNO<=5911 && runNO>=5854 && layid ==14)
continue;
1218 if (ph<0.0||ph==0)
continue;
1232 if(m_rootfile!=
"no rootfile")
1234 m_hitNo_wire->Fill(wid);
1240 m_charge1 = (*trk)->charge();
1243 m_tdc_raw = tdc_raw;
1246 m_localwid = localwid;
1252 m_driftdist = driftD;
1254 m_costheta1 = costheta;
1255 m_pathL = pathlength;
1259 m_trackId1 = trk_ex.
trk_id();
1260 StatusCode status2 = m_nt2->write();
1261 if ( status2.isFailure() )
1262 log << MSG::ERROR <<
"Cannot fill Ntuple n102" << endreq;
1266 phlist.push_back(ph);
1267 phlist_hit.push_back(ph_hit);
1270 dedxhitList->push_back( dedxhit );
1271 dedxhitrefvec->push_back( dedxhit );
1276 ex_trks.push_back(trk_ex );
1277 m_trkalgs.push_back(m_trkalg);
1279 delete dedxhitrefvec;
1288 vector<double> phlist;
1289 vector<double> phlist_hit;
1290 double m_d0E=0,m_phi0E=0,m_cpaE=0,m_z0E=0,phi0=0,costheta=0,sintheta=0,m_Pt=0,m_P=0;
1291 int charge=0,layid=0,localwid=0,w0id=0,wid=0,lr=-2;
1292 double p_hit=0,adc_raw=0,tdc_raw=0,zhit=0,driftd=0,driftD=0,driftT=0,dd_in=0,dd_ex=0,eangle=0;
1294 double ph=0,ph_hit=0,pathlength=0,rphi_path=0;
1297 log << MSG::DEBUG <<
" %%%%% trk id = "<<trk_ex.
trk_id() <<endreq;
1298 log << MSG::DEBUG <<
" %%%%% initial id = "<<(*trk)->trackId() <<endreq;
1301 HepSymMatrix tkErrM;
1302 if(ParticleFlag>-1&&ParticleFlag<5)
1306 tkErrM = dstTrk->
getFError(ParticleFlag);
1310 a = (*trk)->getFHelix();
1311 tkErrM = (*trk)->getFError();
1313 log << MSG::DEBUG <<
"FHelix 5 parameters: "<<a[0]<<
" "<<a[1] <<
" "<<a[2]<<
" "<<a[3]<<
" "<<a[4]<<endreq;
1316 m_d0E = tkErrM[0][0];
1317 m_phi0E = tkErrM[1][1];
1318 m_cpaE = tkErrM[2][2];
1319 m_z0E = tkErrM[3][3];
1322 costheta =
cos(M_PI_2-atan(a[4]));
1324 sintheta =
sin(M_PI_2-atan(a[4]));
1325 m_Pt = 1.0/fabs( a[2] );
1326 m_P = m_Pt*sqrt(1 + a[4]*a[4]);
1328 charge = ( a[2] > 0 )? 1 : -1;
1336 Nhits = gothits.size();
1337 log << MSG::DEBUG <<
"hits size = " <<gothits.size()<<endreq;
1341 HelixSegRefVec::iterator it_gothit = gothits.begin();
1342 for( ; it_gothit != gothits.end(); it_gothit++)
1344 HepVector a_hit_in = (*it_gothit)->getHelixIncl();
1349 p_hit = 1.0/fabs(a_hit_in(3))*sqrt(1+a_hit_in(5)*a_hit_in(5));
1352 mdcid = (*it_gothit)->getMdcId();
1356 wid = w0id + localwid;
1357 adc_raw = (*it_gothit)->getAdc();
1358 tdc_raw = (*it_gothit)->getTdc();
1359 log << MSG::INFO <<
"hit layer id " <<layid<<
" wire id: " <<localwid<<
" adc_raw: " <<adc_raw<<
" tdc_raw: "<<tdc_raw<<endreq;
1360 zhit = (*it_gothit)->getZhit();
1361 lr = (*it_gothit)->getFlagLR();
1362 if(lr == 2) cout<<
"lr = "<<lr<<endl;
1363 driftD = (*it_gothit)->getDD();
1364 driftd =
abs(driftD);
1365 driftT = (*it_gothit)->getDT();
1366 dd_in = (*it_gothit)->getDocaIncl();
1367 dd_ex = (*it_gothit)->getDocaExcl();
1369 if(lr==-1 || lr == 2) {dd_in = dd_in; dd_ex = dd_ex;}
1370 else if(lr ==1) {dd_in = -dd_in; dd_ex = -dd_ex;}
1374 eangle = (*it_gothit)->getEntra();
1375 eangle = eangle/
M_PI;
1376 pathlength=exsvc->
PathL( ntpFlag, exhel_hit_in, layid, localwid, zhit);
1377 rphi_path=pathlength * sintheta;
1380 ph=exsvc->
StandardHitCorrec(0,runFlag,ntpFlag,runNO,pathlength,wid,layid,adc_raw,dd_in,eangle,costheta);
1388 if(runNO<=5911 && runNO>=5854 && layid ==14)
continue;
1413 if (ph<0.0||ph==0)
continue;
1427 if(m_rootfile!=
"no rootfile")
1429 m_hitNo_wire->Fill(wid);
1435 m_charge1 = (*trk)->charge();
1438 m_tdc_raw = tdc_raw;
1441 m_localwid = localwid;
1447 m_driftdist = driftD;
1449 m_costheta1 = costheta;
1450 m_pathL = pathlength;
1455 m_trackId1 = trk_ex.
trk_id();
1456 StatusCode status2 = m_nt2->write();
1457 if ( status2.isFailure() )
1458 log << MSG::ERROR <<
"Cannot fill Ntuple n102" << endreq;
1462 phlist.push_back(ph);
1463 phlist_hit.push_back(ph_hit);
1466 dedxhitList->push_back( dedxhit );
1467 dedxhitrefvec->push_back( dedxhit );
1472 ex_trks.push_back(trk_ex );
1473 m_trkalgs.push_back(m_trkalg);
1475 delete dedxhitrefvec;