290 MsgStream log(
msgSvc(), name());
291 log << MSG::INFO <<
"in execute()" << endreq;
293 vector<double> Curve_Para, Sigma_Para;
298 if(i==0) vFlag[0] = (int) dedxcursvc->
getCurve(i);
299 else Curve_Para.push_back( dedxcursvc->
getCurve(i) );
303 if(i==0) vFlag[1] = (int) dedxcursvc->
getSigma(i);
304 else Sigma_Para.push_back( dedxcursvc->
getSigma(i) );
308 if(vFlag[0] ==1 && Curve_Para.size() != 5)
309 cout<<
" size of dedx curve paramters for version 1 is not right!"<<endl;
310 if(vFlag[0] ==2 && Curve_Para.size() != 16)
311 cout<<
" size of dedx curve paramters for version 2 is not right!"<<endl;
313 if(vFlag[1] ==1 && Sigma_Para.size() != 14)
314 cout<<
" size of dedx sigma paramters for version 1 is not right!"<<endl;
315 if(vFlag[1] ==2 && Sigma_Para.size() != 21)
316 cout<<
" size of dedx sigma paramters for version 2 is not right!"<<endl;
317 if(vFlag[1] ==3 && Sigma_Para.size() != 18)
318 cout<<
" size of dedx sigma paramters for version 3 is not right!"<<endl;
319 if(vFlag[1] ==4 && Sigma_Para.size() != 19)
320 cout<<
" size of dedx sigma paramters for version 4 is not right!"<<endl;
321 if(vFlag[1] ==5 && Sigma_Para.size() != 22)
322 cout<<
" size of dedx sigma paramters for version 5 is not right!"<<endl;
326 DataObject *aReconEvent;
327 eventSvc()->findObject(
"/Event/Recon",aReconEvent);
328 if(aReconEvent==
NULL)
331 StatusCode sc = eventSvc()->registerObject(
"/Event/Recon",aReconEvent);
332 if(sc!=StatusCode::SUCCESS)
334 log << MSG::FATAL <<
"Could not register ReconEvent" <<endreq;
335 return( StatusCode::FAILURE);
339 SmartIF<IDataManagerSvc> dataManSvc(eventSvc());
341 DataObject *aDedxcol;
342 eventSvc()->findObject(
"/Event/Recon/RecMdcDedxCol",aDedxcol);
345 dataManSvc->clearSubTree(
"/Event/Recon/RecMdcDedxCol");
346 eventSvc()->unregisterObject(
"/Event/Recon/RecMdcDedxCol");
351 if(!dedxsc.isSuccess())
353 log << MSG::FATAL <<
" Could not register Mdc dedx collection" <<endreq;
354 return ( StatusCode::FAILURE);
357 DataObject *aDedxhitcol;
358 eventSvc()->findObject(
"/Event/Recon/RecMdcDedxHitCol",aDedxhitcol);
359 if(aDedxhitcol !=
NULL)
361 dataManSvc->clearSubTree(
"/Event/Recon/RecMdcDedxHitCol");
362 eventSvc()->unregisterObject(
"/Event/Recon/RecMdcDedxHitCol");
365 StatusCode dedxhitsc;
367 if(!dedxhitsc.isSuccess())
369 log << MSG::FATAL <<
" Could not register Mdc dedx collection" <<endreq;
370 return ( StatusCode::FAILURE);
373 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
376 log << MSG::INFO <<
"Could not find Event Header" << endreq;
377 return( StatusCode::FAILURE);
379 int eventNO = eventHeader->eventNumber();
380 int runNO = eventHeader->runNumber();
381 log << MSG::INFO <<
"now begin the event: runNO= "<<runNO<<
" eventNO= "<< eventNO<< endreq;
397 if(runNO < 0) vFlag[2]=1;
402 SmartDataPtr<RecEsTimeCol> estimeCol(eventSvc(),
"/Event/Recon/RecEsTimeCol");
405 log << MSG::WARNING <<
"Could not find EvTimeCol" << endreq;
409 RecEsTimeCol::iterator iter_evt = estimeCol->begin();
410 for(; iter_evt!=estimeCol->end(); iter_evt++)
412 tes = (*iter_evt)->getTest();
413 esTimeflag = (*iter_evt)->getStat();
425 log << MSG::DEBUG <<
"recalg: "<<recalg<<endreq;
431 SmartDataPtr<RecMdcKalTrackCol> newtrkCol(eventSvc(),
"/Event/Recon/RecMdcKalTrackCol");
434 log << MSG::WARNING <<
"Could not find RecMdcKalTrackCol" << endreq;
435 return StatusCode::SUCCESS;
438 ntrk = newtrkCol->size();
439 log << MSG::DEBUG <<
"track collection size: " << newtrkCol->size() <<endreq;
441 RecMdcKalTrackCol::iterator trk = newtrkCol->begin();
443 for( ; trk != newtrkCol->end(); trk++)
449 if(gothits.size()==0)
452 int trkid=(*trk)->trackId();
458 if(gothits.size()<2)
continue;
459 kaltrackrec(trk, mdcid, tes, runNO, eventNO, runFlag, log );
470 SmartDataPtr<RecMdcTrackCol> newtrkCol(eventSvc(),
"/Event/Recon/RecMdcTrackCol");
473 log << MSG::WARNING <<
"Could not find RecMdcTrackCol" << endreq;
474 return StatusCode::SUCCESS;
477 ntrk = newtrkCol->size();
478 log << MSG::DEBUG <<
"track collection size: " << newtrkCol->size() <<endreq;
480 vector<double> phlist;
481 vector<double> phlist_hit;
482 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;
483 int charge=0,layid=0,localwid=0,w0id=0,wid=0,lr=-2;
484 double adc_raw=0,tdc_raw=0,zhit=0,driftd=0,driftD=0,driftT=0,dd=0,eangle=0;
486 double ph=0,ph_hit=0,pathlength=0,rphi_path=0;
488 RecMdcTrackCol::iterator trk = newtrkCol->begin();
489 for( ; trk != newtrkCol->end(); trk++)
494 log << MSG::DEBUG <<
" %%%%% trk id = "<<trk_ex.
trk_id() <<endreq;
495 log << MSG::DEBUG <<
" %%%%% initial id = "<<(*trk)->trackId() <<endreq;
497 HepVector a = (*trk)->helix();
498 HepSymMatrix tkErrM = (*trk)->err();
499 m_d0E = tkErrM[0][0];
500 m_phi0E = tkErrM[1][1];
501 m_cpaE = tkErrM[2][2];
502 m_z0E = tkErrM[3][3];
506 log << MSG::DEBUG <<
"MDC Helix 5 parameters: "<<a[0]<<
" "<<a[1]<<
" "<<a[2]<<
" "<<a[3]<<
" "<<a[4]<<endreq;
511 sintheta =
sin(M_PI_2-atan(a[4]));
512 m_Pt = 1.0/fabs( a[2] );
513 m_P = m_Pt*sqrt(1 + a[4]*a[4]);
514 charge = ( a[2] > 0 )? 1 : -1;
520 Nhits = gothits.size();
521 log << MSG::DEBUG <<
"hits size = " <<gothits.size()<<endreq;
524 delete dedxhitrefvec;
530 HitRefVec::iterator it_gothit = gothits.begin();
531 for( ; it_gothit != gothits.end(); it_gothit++)
533 mdcid = (*it_gothit)->getMdcId();
537 wid = w0id + localwid;
538 adc_raw = (*it_gothit)->getAdc();
539 tdc_raw = (*it_gothit)->getTdc();
540 log << MSG::INFO <<
"hit layer id " <<layid<<
" wire id: " <<localwid<<
" adc_raw: " <<adc_raw<<
" tdc_raw: "<<tdc_raw<<endreq;
541 zhit = (*it_gothit)->getZhit();
542 lr = (*it_gothit)->getFlagLR();
543 if(lr == 2) cout<<
"lr = "<<lr<<endl;
544 if(lr == 0 || lr == 2) driftD = (*it_gothit)->getDriftDistLeft();
545 else driftD = (*it_gothit)->getDriftDistRight();
547 driftd =
abs(driftD);
548 dd = (*it_gothit)->getDoca();
549 if(lr == 0 || lr == 2 ) dd = -
abs(dd);
550 if(lr == 1 ) dd =
abs(dd);
551 driftT = (*it_gothit)->getDriftT();
553 eangle = (*it_gothit)->getEntra();
554 eangle = eangle/
M_PI;
555 pathlength=exsvc->
PathL( ntpFlag, exhel, layid, localwid, zhit);
556 rphi_path=pathlength * sintheta;
559 ph=exsvc->
StandardHitCorrec(0,runFlag,ntpFlag,runNO,eventNO,pathlength,wid,layid,adc_raw,dd,eangle,
costheta);
564 if(runNO<=5911 && runNO>=5854 && layid ==14)
continue;
589 if (ph<0.0||ph==0)
continue;
603 if(m_rootfile!=
"no rootfile")
605 m_hitNo_wire->Fill(wid);
611 m_charge1 = (*trk)->charge();
617 m_localwid = localwid;
624 m_driftdist = driftD;
627 m_pathL = pathlength;
631 m_trackId1 = trk_ex.
trk_id();
632 StatusCode status2 = m_nt2->write();
633 if ( status2.isFailure() )
634 log << MSG::ERROR <<
"Cannot fill Ntuple n102" << endreq;
638 phlist.push_back(ph);
639 phlist_hit.push_back(ph_hit);
642 dedxhitList->push_back( dedxhit );
643 dedxhitrefvec->push_back( dedxhit );
648 ex_trks.push_back(trk_ex );
649 m_trkalgs.push_back(m_trkalg);
651 delete dedxhitrefvec;
656 log << MSG::DEBUG <<
"size in processing: " << ex_trks.size() <<endreq;
665 SmartDataPtr<RecMdcKalTrackCol> newtrkCol(eventSvc(),
"/Event/Recon/RecMdcKalTrackCol");
668 log << MSG::WARNING <<
"Could not find RecMdcKalTrackCol" << endreq;
669 return StatusCode::SUCCESS;
672 ntrk = newtrkCol->size();
673 log << MSG::DEBUG <<
"track collection size: " << newtrkCol->size() <<endreq;
675 vector<double> phlist;
676 vector<double> phlist_hit;
677 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;
678 int charge=0,layid=0,localwid=0,w0id=0,wid=0,lr=-2;
679 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;
681 double ph=0,ph_hit=0,pathlength=0,rphi_path=0;
684 RecMdcKalTrackCol::iterator trk = newtrkCol->begin();
685 for( ; trk != newtrkCol->end(); trk++)
690 log << MSG::DEBUG <<
" %%%%% trk id = "<<trk_ex.
trk_id() <<endreq;
691 log << MSG::DEBUG <<
" %%%%% initial id = "<<(*trk)->trackId() <<endreq;
695 if(ParticleFlag>-1&&ParticleFlag<5)
699 tkErrM = dstTrk->
getFError(ParticleFlag);
703 a = (*trk)->getFHelix();
704 tkErrM = (*trk)->getFError();
707 log << MSG::DEBUG <<
"FHelix 5 parameters: "<<a[0]<<
" "<<a[1] <<
" "<<a[2]<<
" "<<a[3]<<
" "<<a[4]<<endreq;
709 m_d0E = tkErrM[0][0];
710 m_phi0E = tkErrM[1][1];
711 m_cpaE = tkErrM[2][2];
712 m_z0E = tkErrM[3][3];
717 sintheta =
sin(M_PI_2-atan(a[4]));
718 m_Pt = 1.0/fabs( a[2] );
719 m_P = m_Pt*sqrt(1 + a[4]*a[4]);
721 charge = ( a[2] > 0 )? 1 : -1;
729 Nhits = gothits.size();
730 log << MSG::DEBUG <<
"hits size = " <<gothits.size()<<endreq;
733 delete dedxhitrefvec;
739 HelixSegRefVec::iterator it_gothit = gothits.begin();
740 for( ; it_gothit != gothits.end(); it_gothit++)
742 HepVector a_hit_in = (*it_gothit)->getHelixIncl();
747 p_hit = 1.0/fabs(a_hit_in(3))*sqrt(1+a_hit_in(5)*a_hit_in(5));
750 mdcid = (*it_gothit)->getMdcId();
754 wid = w0id + localwid;
755 adc_raw = (*it_gothit)->getAdc();
756 tdc_raw = (*it_gothit)->getTdc();
757 log << MSG::INFO <<
"hit layer id " <<layid<<
" wire id: " <<localwid<<
" adc_raw: " <<adc_raw<<
" tdc_raw: "<<tdc_raw<<endreq;
758 zhit = (*it_gothit)->getZhit();
759 lr = (*it_gothit)->getFlagLR();
760 if(lr == 2) cout<<
"lr = "<<lr<<endl;
761 driftD = (*it_gothit)->getDD();
762 driftd =
abs(driftD);
763 driftT = (*it_gothit)->getDT();
764 dd_in = (*it_gothit)->getDocaIncl();
765 dd_ex = (*it_gothit)->getDocaExcl();
767 if(lr==-1 || lr == 2) {dd_in = dd_in; dd_ex = dd_ex;}
768 else if(lr ==1) {dd_in = -dd_in; dd_ex = -dd_ex;}
772 eangle = (*it_gothit)->getEntra();
773 eangle = eangle/
M_PI;
774 pathlength=exsvc->
PathL( ntpFlag, exhel_hit_in, layid, localwid, zhit);
775 rphi_path=pathlength * sintheta;
777 ph=exsvc->
StandardHitCorrec(0,runFlag,ntpFlag,runNO,eventNO,pathlength,wid,layid,adc_raw,dd_in,eangle,
costheta);
782 if(runNO<=5911 && runNO>=5854 && layid ==14)
continue;
807 if (ph<0.0||ph==0)
continue;
821 if(m_rootfile!=
"no rootfile")
823 m_hitNo_wire->Fill(wid);
829 m_charge1 = (*trk)->charge();
835 m_localwid = localwid;
842 m_driftdist = driftD;
845 m_pathL = pathlength;
850 m_trackId1 = trk_ex.
trk_id();
851 StatusCode status2 = m_nt2->write();
852 if ( status2.isFailure() )
853 log << MSG::ERROR <<
"Cannot fill Ntuple n102" << endreq;
857 phlist.push_back(ph);
858 phlist_hit.push_back(ph_hit);
861 dedxhitList->push_back( dedxhit );
862 dedxhitrefvec->push_back( dedxhit );
867 ex_trks.push_back(trk_ex );
868 m_trkalgs.push_back(m_trkalg);
870 delete dedxhitrefvec;
875 log << MSG::DEBUG <<
"size in processing: " << ex_trks.size() <<endreq;
880 if( ntrk != ex_trks.size())
881 log << MSG::DEBUG <<
"ntrkCol size: "<<ntrk<<
" dedxtrk size: "<<ex_trks.size()<< endreq;
883 double poca_x=0,poca_y=0,poca_z=0;
885 int Nhit=0,Nphlisthit=0;
887 double phtm=0,median=0,geometric=0,geometric_trunc=0,harmonic=0,harmonic_trunc=0,transform=0,logtrunc=0;
890 float probpid_temp=-0.01,expect_temp=-0.01,sigma_temp=-0.01,chidedx_temp=-0.01;
892 double dEdx_meas_hit=0;
893 double dEdx_meas=0,dEdx_meas_esat=0,dEdx_meas_norun=0;
897 for(std::vector<MdcDedxTrk>::iterator it = ex_trks.begin(); it != ex_trks.end(); it++, idedxid++ )
899 log << MSG::DEBUG <<
"-------------------------------------------------------"<< endreq;
900 log << MSG::DEBUG <<
" trk id ="<< it->trk_id()<<
" : P ="<<it->P() <<
" Pt ="<<it->Pt()<<
" : theta ="<<it->theta() <<
" : phi ="<<it->phi()<<
" : charge = "<<it->charge()<<endreq;
901 log << MSG::DEBUG <<
"all hits on track: "<<it->nsample()<<
" phlist size: "<<it->get_phlist().size()<<endreq;
903 if(it->trk_ptr_kal()!=0)
905 poca_x = it->trk_ptr_kal()->x();
906 poca_y = it->trk_ptr_kal()->y();
907 poca_z = it->trk_ptr_kal()->z();
909 else if(it->trk_ptr()!=0)
911 poca_x = it->trk_ptr()->x();
912 poca_y = it->trk_ptr()->y();
913 poca_z = it->trk_ptr()->z();
917 sintheta =
sin(it->theta());
921 Nhit = it->nsample();
922 Nphlisthit = it->get_phlist_hit().size();
926 phtm = it->cal_dedx( truncate );
936 if(m_alg==1) dEdx_meas_hit = it->cal_dedx_bitrunc(truncate, 0, usedhit);
937 else if(m_alg==2) dEdx_meas_hit = it-> cal_dedx_transform(1);
938 else if(m_alg==3) dEdx_meas_hit = it->cal_dedx_log(1.0, 1);
939 else cout<<
"-------------Truncate Algorithm Error!!!------------------------"<<endl;
940 if(m_alg==1 && usedhit==0)
942 cout<<
"***************bad extrk with no hits!!!!!******************"<<endl;
946 usedhit = (int)(Nphlisthit*truncate);
950 dEdx_meas_esat = exsvc->
StandardTrackCorrec(1,runFlag, ntpFlag, runNO, eventNO, dEdx_meas_hit,
cos(it->theta()), tes );
951 dEdx_meas_norun = exsvc->
StandardTrackCorrec(2,runFlag, ntpFlag, runNO, eventNO, dEdx_meas_hit,
cos(it->theta()), tes );
952 log << MSG::INFO <<
"===================== " << endreq << endreq;
953 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;
954 log << MSG::INFO <<
"ptrk " <<
ptrk <<
" costhe " <<
costheta <<
" runno " << runNO <<
" evtno " << eventNO << endreq;
957 trk_recalg = m_trkalgs[idedxid];
960 it->set_dEdx( landau ,
dEdx_meas, trk_recalg, runFlag, vFlag , tes, Curve_Para, Sigma_Para, ex_calib);
968 if(it->pprob()[i]>probpid_temp)
971 probpid_temp = it->pprob()[i];
972 expect_temp = it->pexpect()[i];
973 sigma_temp = it->pexp_sigma()[i];
974 chidedx_temp = it->pchi_dedx()[i];
977 log<< MSG::INFO<<
"expect dE/dx: type: "<<parType_temp<<
" probpid: "<<probpid_temp<<
" expect: "<<expect_temp<<
" sigma: "<<sigma_temp<<
" chidedx: "<<chidedx_temp<<endreq;
992 resdedx->
setChi( it->pchi_dedx() );
1024 m_sintheta=sintheta;
1031 m_trackId = it->trk_id();
1032 m_recalg = trk_recalg;
1035 m_nphlisthit=Nphlisthit;
1037 for(
int i=0; i<Nphlisthit; i++) m_dEdx_hit[i] = it->get_phlist_hit()[i];
1039 m_parttype = parType_temp;
1040 m_prob = probpid_temp;
1041 m_expect = expect_temp;
1042 m_sigma = sigma_temp;
1043 m_chidedx = chidedx_temp;
1044 m_chidedxe=it->pchi_dedx()[0];
1045 m_chidedxmu=it->pchi_dedx()[1];
1046 m_chidedxpi=it->pchi_dedx()[2];
1047 m_chidedxk=it->pchi_dedx()[3];
1048 m_chidedxp=it->pchi_dedx()[4];
1049 for(
int i=0;i<5;i++)
1051 m_probpid[i]= it->pprob()[i];
1052 m_expectid[i]= it->pexpect()[i];
1053 m_sigmaid[i]= it->pexp_sigma()[i];
1056 StatusCode status = m_nt1->write();
1057 if ( status.isFailure() )
1059 log << MSG::ERROR <<
"Cannot fill Ntuple n103" << endreq;
1063 log<< MSG::INFO<<
"-----------------Summary of this ExTrack----------------"<<endreq
1064 <<
"dEdx_mean: "<<
dEdx_meas<<
" type: "<<parType_temp<<
" probpid: "<<probpid_temp
1065 <<
" expect: "<<expect_temp<<
" sigma: "<<sigma_temp<<
" chidedx: "<<chidedx_temp<<endreq<<endreq;
1067 dedxList->push_back( resdedx );
1073 SmartDataPtr<RecMdcDedxCol> newexCol(eventSvc(),
"/Event/Recon/RecMdcDedxCol");
1076 log << MSG::FATAL <<
"Could not find RecMdcDedxCol" << endreq;
1077 return( StatusCode::SUCCESS);
1079 log << MSG::DEBUG <<
"----------------Begin to check RecMdcDedxCol-----------------"<<endreq;
1080 RecMdcDedxCol::iterator it_dedx = newexCol->begin();
1081 for( ; it_dedx != newexCol->end(); it_dedx++)
1083 log << MSG::INFO <<
"retrieved MDC dE/dx:" << endreq
1084 <<
"dEdx Id: " << (*it_dedx)->trackId()
1085 <<
" part Id: " << (*it_dedx)->particleType()
1086 <<
" measured dEdx: " << (*it_dedx)->probPH()
1087 <<
" dEdx std: " << (*it_dedx)->normPH() << endreq
1088 <<
"hits on track: "<<(*it_dedx)->numTotalHits()
1089 <<
" usedhits: " << (*it_dedx)->numGoodHits() << endreq
1090 <<
"Electron: expect: " << (*it_dedx)->getDedxExpect(0)
1091 <<
" sigma: " << (*it_dedx)->getSigmaDedx(0)
1092 <<
" chi: " << (*it_dedx)->chi(0)
1093 <<
" prob: " << (*it_dedx)->getPidProb(0) << endreq
1094 <<
"Muon: expect: " << (*it_dedx)->getDedxExpect(1)
1095 <<
" sigma: " << (*it_dedx)->getSigmaDedx(1)
1096 <<
" chi: " << (*it_dedx)->chi(1)
1097 <<
" prob: " << (*it_dedx)->getPidProb(1) << endreq
1098 <<
"Pion: expect: " << (*it_dedx)->getDedxExpect(2)
1099 <<
" sigma: " << (*it_dedx)->getSigmaDedx(2)
1100 <<
" chi: " << (*it_dedx)->chi(2)
1101 <<
" prob: " << (*it_dedx)->getPidProb(2) << endreq
1102 <<
"Kaon: expect: " << (*it_dedx)->getDedxExpect(3)
1103 <<
" sigma: " << (*it_dedx)->getSigmaDedx(3)
1104 <<
" chi: " << (*it_dedx)->chi(3)
1105 <<
" prob: " << (*it_dedx)->getPidProb(3) << endreq
1106 <<
"Proton: expect: " << (*it_dedx)->getDedxExpect(4)
1107 <<
" sigma: " << (*it_dedx)->getSigmaDedx(4)
1108 <<
" chi: " << (*it_dedx)->chi(4)
1109 <<
" prob: " << (*it_dedx)->getPidProb(4) << endreq;
1111 return StatusCode::SUCCESS;
1123 vector<double> phlist;
1124 vector<double> phlist_hit;
1125 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;
1126 int charge=0,layid=0,localwid=0,w0id=0,wid=0,lr=-2;
1127 double adc_raw=0,tdc_raw=0,zhit=0,driftd=0,driftD=0,driftT=0,dd=0,eangle=0;
1129 double ph=0,ph_hit=0,pathlength=0,rphi_path=0;
1132 log << MSG::DEBUG <<
" %%%%% trk id = "<<trk_ex.
trk_id() <<endreq;
1133 log << MSG::DEBUG <<
" %%%%% initial id = "<<(*trk)->trackId() <<endreq;
1135 HepVector a = (*trk)->helix();
1136 HepSymMatrix tkErrM = (*trk)->err();
1137 m_d0E = tkErrM[0][0];
1138 m_phi0E = tkErrM[1][1];
1139 m_cpaE = tkErrM[2][2];
1140 m_z0E = tkErrM[3][3];
1144 log << MSG::DEBUG <<
"MDC Helix 5 parameters: "<<a[0]<<
" "<<a[1]<<
" "<<a[2]<<
" "<<a[3]<<
" "<<a[4]<<endreq;
1149 sintheta =
sin(M_PI_2-atan(a[4]));
1150 m_Pt = 1.0/fabs( a[2] );
1151 m_P = m_Pt*sqrt(1 + a[4]*a[4]);
1152 charge = ( a[2] > 0 )? 1 : -1;
1157 HitRefVec gothits= (*trk)->getVecHits();
1158 Nhits = gothits.size();
1159 log << MSG::DEBUG <<
"hits size = " <<gothits.size()<<endreq;
1163 HitRefVec::iterator it_gothit = gothits.begin();
1164 for( ; it_gothit != gothits.end(); it_gothit++)
1166 mdcid = (*it_gothit)->getMdcId();
1170 wid = w0id + localwid;
1171 adc_raw = (*it_gothit)->getAdc();
1172 tdc_raw = (*it_gothit)->getTdc();
1173 log << MSG::INFO <<
"hit layer id " <<layid<<
" wire id: " <<localwid<<
" adc_raw: " <<adc_raw<<
" tdc_raw: "<<tdc_raw<<endreq;
1174 zhit = (*it_gothit)->getZhit();
1175 lr = (*it_gothit)->getFlagLR();
1176 if(lr == 2) cout<<
"lr = "<<lr<<endl;
1177 if(lr == 0 || lr == 2) driftD = (*it_gothit)->getDriftDistLeft();
1178 else driftD = (*it_gothit)->getDriftDistRight();
1180 driftd =
abs(driftD);
1181 dd = (*it_gothit)->getDoca();
1182 if(lr == 0 || lr == 2 ) dd = -
abs(dd);
1183 if(lr == 1 ) dd =
abs(dd);
1184 driftT = (*it_gothit)->getDriftT();
1186 eangle = (*it_gothit)->getEntra();
1187 eangle = eangle/
M_PI;
1188 pathlength=exsvc->
PathL( ntpFlag, exhel, layid, localwid, zhit);
1189 rphi_path=pathlength * sintheta;
1192 ph=exsvc->
StandardHitCorrec(0,runFlag,ntpFlag,runNO,eventNO,pathlength,wid,layid,adc_raw,dd,eangle,
costheta);
1197 if(runNO<=5911 && runNO>=5854 && layid ==14)
continue;
1222 if (ph<0.0||ph==0)
continue;
1236 if(m_rootfile!=
"no rootfile")
1238 m_hitNo_wire->Fill(wid);
1244 m_charge1 = (*trk)->charge();
1247 m_tdc_raw = tdc_raw;
1250 m_localwid = localwid;
1257 m_driftdist = driftD;
1260 m_pathL = pathlength;
1264 m_trackId1 = trk_ex.
trk_id();
1265 StatusCode status2 = m_nt2->write();
1266 if ( status2.isFailure() )
1267 log << MSG::ERROR <<
"Cannot fill Ntuple n102" << endreq;
1271 phlist.push_back(ph);
1272 phlist_hit.push_back(ph_hit);
1275 dedxhitList->push_back( dedxhit );
1276 dedxhitrefvec->push_back( dedxhit );
1281 ex_trks.push_back(trk_ex );
1282 m_trkalgs.push_back(m_trkalg);
1284 delete dedxhitrefvec;
1293 vector<double> phlist;
1294 vector<double> phlist_hit;
1295 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;
1296 int charge=0,layid=0,localwid=0,w0id=0,wid=0,lr=-2;
1297 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;
1299 double ph=0,ph_hit=0,pathlength=0,rphi_path=0;
1302 log << MSG::DEBUG <<
" %%%%% trk id = "<<trk_ex.
trk_id() <<endreq;
1303 log << MSG::DEBUG <<
" %%%%% initial id = "<<(*trk)->trackId() <<endreq;
1306 HepSymMatrix tkErrM;
1307 if(ParticleFlag>-1&&ParticleFlag<5)
1311 tkErrM = dstTrk->
getFError(ParticleFlag);
1315 a = (*trk)->getFHelix();
1316 tkErrM = (*trk)->getFError();
1318 log << MSG::DEBUG <<
"FHelix 5 parameters: "<<a[0]<<
" "<<a[1] <<
" "<<a[2]<<
" "<<a[3]<<
" "<<a[4]<<endreq;
1321 m_d0E = tkErrM[0][0];
1322 m_phi0E = tkErrM[1][1];
1323 m_cpaE = tkErrM[2][2];
1324 m_z0E = tkErrM[3][3];
1329 sintheta =
sin(M_PI_2-atan(a[4]));
1330 m_Pt = 1.0/fabs( a[2] );
1331 m_P = m_Pt*sqrt(1 + a[4]*a[4]);
1333 charge = ( a[2] > 0 )? 1 : -1;
1341 Nhits = gothits.size();
1342 log << MSG::DEBUG <<
"hits size = " <<gothits.size()<<endreq;
1346 HelixSegRefVec::iterator it_gothit = gothits.begin();
1347 for( ; it_gothit != gothits.end(); it_gothit++)
1349 HepVector a_hit_in = (*it_gothit)->getHelixIncl();
1354 p_hit = 1.0/fabs(a_hit_in(3))*sqrt(1+a_hit_in(5)*a_hit_in(5));
1357 mdcid = (*it_gothit)->getMdcId();
1361 wid = w0id + localwid;
1362 adc_raw = (*it_gothit)->getAdc();
1363 tdc_raw = (*it_gothit)->getTdc();
1364 log << MSG::INFO <<
"hit layer id " <<layid<<
" wire id: " <<localwid<<
" adc_raw: " <<adc_raw<<
" tdc_raw: "<<tdc_raw<<endreq;
1365 zhit = (*it_gothit)->getZhit();
1366 lr = (*it_gothit)->getFlagLR();
1367 if(lr == 2) cout<<
"lr = "<<lr<<endl;
1368 driftD = (*it_gothit)->getDD();
1369 driftd =
abs(driftD);
1370 driftT = (*it_gothit)->getDT();
1371 dd_in = (*it_gothit)->getDocaIncl();
1372 dd_ex = (*it_gothit)->getDocaExcl();
1374 if(lr==-1 || lr == 2) {dd_in = dd_in; dd_ex = dd_ex;}
1375 else if(lr ==1) {dd_in = -dd_in; dd_ex = -dd_ex;}
1379 eangle = (*it_gothit)->getEntra();
1380 eangle = eangle/
M_PI;
1381 pathlength=exsvc->
PathL( ntpFlag, exhel_hit_in, layid, localwid, zhit);
1382 rphi_path=pathlength * sintheta;
1385 ph=exsvc->
StandardHitCorrec(0,runFlag,ntpFlag,runNO,eventNO,pathlength,wid,layid,adc_raw,dd_in,eangle,
costheta);
1393 if(runNO<=5911 && runNO>=5854 && layid ==14)
continue;
1418 if (ph<0.0||ph==0)
continue;
1432 if(m_rootfile!=
"no rootfile")
1434 m_hitNo_wire->Fill(wid);
1440 m_charge1 = (*trk)->charge();
1443 m_tdc_raw = tdc_raw;
1446 m_localwid = localwid;
1453 m_driftdist = driftD;
1456 m_pathL = pathlength;
1461 m_trackId1 = trk_ex.
trk_id();
1462 StatusCode status2 = m_nt2->write();
1463 if ( status2.isFailure() )
1464 log << MSG::ERROR <<
"Cannot fill Ntuple n102" << endreq;
1468 phlist.push_back(ph);
1469 phlist_hit.push_back(ph_hit);
1472 dedxhitList->push_back( dedxhit );
1473 dedxhitrefvec->push_back( dedxhit );
1478 ex_trks.push_back(trk_ex );
1479 m_trkalgs.push_back(m_trkalg);
1481 delete dedxhitrefvec;