287{
288 MsgStream log(
msgSvc(), name());
289 log << MSG::INFO << "in execute()" << endreq;
290
291 vector<double> Curve_Para, Sigma_Para;
292 int vFlag[3];
293
295 {
296 if(i==0) vFlag[0] = (int) dedxcursvc->
getCurve(i);
297 else Curve_Para.push_back( dedxcursvc->
getCurve(i) );
298 }
300 {
301 if(i==0) vFlag[1] = (int) dedxcursvc->
getSigma(i);
302 else Sigma_Para.push_back( dedxcursvc->
getSigma(i) );
303 }
304
305
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;
310
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;
321
322
323
324 DataObject *aReconEvent;
325 eventSvc()->findObject("/Event/Recon",aReconEvent);
326 if(aReconEvent==NULL)
327 {
329 StatusCode sc = eventSvc()->registerObject("/Event/Recon",aReconEvent);
330 if(sc!=StatusCode::SUCCESS)
331 {
332 log << MSG::FATAL << "Could not register ReconEvent" <<endreq;
333 return( StatusCode::FAILURE);
334 }
335 }
336
337 SmartIF<IDataManagerSvc> dataManSvc(eventSvc());
338
339 DataObject *aDedxcol;
340 eventSvc()->findObject("/Event/Recon/RecMdcDedxCol",aDedxcol);
341 if(aDedxcol != NULL)
342 {
343 dataManSvc->clearSubTree("/Event/Recon/RecMdcDedxCol");
344 eventSvc()->unregisterObject("/Event/Recon/RecMdcDedxCol");
345 }
347 StatusCode dedxsc;
349 if(!dedxsc.isSuccess())
350 {
351 log << MSG::FATAL << " Could not register Mdc dedx collection" <<endreq;
352 return ( StatusCode::FAILURE);
353 }
354
355 DataObject *aDedxhitcol;
356 eventSvc()->findObject("/Event/Recon/RecMdcDedxHitCol",aDedxhitcol);
357 if(aDedxhitcol != NULL)
358 {
359 dataManSvc->clearSubTree("/Event/Recon/RecMdcDedxHitCol");
360 eventSvc()->unregisterObject("/Event/Recon/RecMdcDedxHitCol");
361 }
363 StatusCode dedxhitsc;
365 if(!dedxhitsc.isSuccess())
366 {
367 log << MSG::FATAL << " Could not register Mdc dedx collection" <<endreq;
368 return ( StatusCode::FAILURE);
369 }
370
371 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
372 if (!eventHeader)
373 {
374 log << MSG::INFO << "Could not find Event Header" << endreq;
375 return( StatusCode::FAILURE);
376 }
377 int eventNO = eventHeader->eventNumber();
378 int runNO = eventHeader->runNumber();
379 log << MSG::INFO << "now begin the event: runNO= "<<runNO<<" eventNO= "<< eventNO<< endreq;
383 {
385 }
387 int runFlag;
392 else runFlag =4;
393
394
395 if(runNO < 0) vFlag[2]=1;
396 else vFlag[2]=0;
397
398 double tes = -999.0;
399 int esTimeflag = -1;
400 SmartDataPtr<RecEsTimeCol> estimeCol(eventSvc(),"/Event/Recon/RecEsTimeCol");
401 if( ! estimeCol)
402 {
403 log << MSG::WARNING << "Could not find EvTimeCol" << endreq;
404 }
405 else
406 {
407 RecEsTimeCol::iterator iter_evt = estimeCol->begin();
408 for(; iter_evt!=estimeCol->end(); iter_evt++)
409 {
410 tes = (*iter_evt)->getTest();
411 esTimeflag = (*iter_evt)->getStat();
412 }
413 }
414
415
416
418 int ntrk;
419 ex_trks.clear();
420 m_trkalgs.clear();
421 if( !doNewGlobal )
422 {
423 log << MSG::DEBUG << "recalg: "<<recalg<<endreq;
424
425
426 if(recalg ==2 )
427 {
428
429 SmartDataPtr<RecMdcKalTrackCol> newtrkCol(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
430 if (!newtrkCol)
431 {
432 log << MSG::WARNING << "Could not find RecMdcKalTrackCol" << endreq;
433 return StatusCode::SUCCESS;
434 }
436 ntrk = newtrkCol->size();
437 log << MSG::DEBUG << "track collection size: " << newtrkCol->size() <<endreq;
438
439 RecMdcKalTrackCol::iterator trk = newtrkCol->begin();
440
441 for( ; trk != newtrkCol->end(); trk++)
442 {
444
446
447 if(gothits.size()==0)
448 {
449 m_trkalg=0;
450 int trkid=(*trk)->trackId();
452 }
453 else
454 {
455 m_trkalg=1;
456 if(gothits.size()<2) continue;
457 kaltrackrec(trk, mdcid, tes, runNO, runFlag, log );
458 }
459 }
460 }
461
462
463 else if(recalg ==0 )
464 {
465 m_trkalg=0;
466
467
468 SmartDataPtr<RecMdcTrackCol> newtrkCol(eventSvc(),"/Event/Recon/RecMdcTrackCol");
469 if (!newtrkCol)
470 {
471 log << MSG::WARNING << "Could not find RecMdcTrackCol" << endreq;
472 return StatusCode::SUCCESS;
473 }
475 ntrk = newtrkCol->size();
476 log << MSG::DEBUG << "track collection size: " << newtrkCol->size() <<endreq;
477
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;
483 int Nhits=0;
484 double ph=0,ph_hit=0,pathlength=0,rphi_path=0;
485
486 RecMdcTrackCol::iterator trk = newtrkCol->begin();
487 for( ; trk != newtrkCol->end(); trk++)
488 {
490
492 log << MSG::DEBUG <<" %%%%% trk id = "<<trk_ex.trk_id() <<endreq;
493 log << MSG::DEBUG <<" %%%%% initial id = "<<(*trk)->trackId() <<endreq;
494
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];
501
504 log << MSG::DEBUG <<"MDC Helix 5 parameters: "<<a[0]<<" "<<a[1]<<" "<<a[2]<<" "<<a[3]<<" "<<a[4]<<endreq;
505
506 phi0= a[1];
507 costheta =
cos(M_PI_2-atan(a[4]));
508
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;
513
515
516
518 Nhits = gothits.size();
519 log << MSG::DEBUG << "hits size = " <<gothits.size()<<endreq;
520 if(gothits.size()<2)
521 {
522 delete dedxhitrefvec;
523 continue;
524 }
525
526
528 HitRefVec::iterator it_gothit = gothits.begin();
529 for( ; it_gothit != gothits.end(); it_gothit++)
530 {
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();
544
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();
550
551 eangle = (*it_gothit)->getEntra();
552 eangle = eangle/
M_PI;
553 pathlength=exsvc->
PathL( ntpFlag, exhel, layid, localwid, zhit);
554 rphi_path=pathlength * sintheta;
555
556
557 ph=exsvc->
StandardHitCorrec(0,runFlag,ntpFlag,runNO,pathlength,wid,layid,adc_raw,dd,eangle,costheta);
559
560
561
562 if(runNO<=5911 && runNO>=5854 && layid ==14) continue;
563 if(runNO<0)
564 {
565 if (layid<8)
566 {
568 }
569 else if(layid >= 8)
570 {
572 }
573 }
574 else if(runNO>=0)
575 {
576 if(layid <8)
577 {
579 }
580 else if(layid >= 8)
581 {
583 }
584 }
585
586
587 if (ph<0.0||ph==0) continue;
588 else
589 {
590
599
600
601 if(m_rootfile!= "no rootfile")
602 {
603 m_hitNo_wire->Fill(wid);
604 }
605
606
607 if ( ntpFlag ==2 )
608 {
609 m_charge1 = (*trk)->charge();
610 m_t01 = tes;
611 m_driftT = driftT;
612 m_tdc_raw = tdc_raw;
613 m_phraw = adc_raw;
614 m_exraw = ph_hit;
615 m_localwid = localwid;
616 m_wire = wid;
617 m_runNO1 = runNO;
618 m_nhit_hit = Nhits;
619 m_doca_in = dd;
620 m_doca_ex = dd;
621 m_driftdist = driftD;
622 m_eangle = eangle;
623 m_costheta1 = costheta;
624 m_pathL = pathlength;
625 m_layer = layid;
626 m_ptrk1 = m_P;
627
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;
632 }
633 if(layid>3)
634 {
635 phlist.push_back(ph);
636 phlist_hit.push_back(ph_hit);
637 }
638 }
639 dedxhitList->push_back( dedxhit );
640 dedxhitrefvec->push_back( dedxhit );
641 }
642 trk_ex.set_phlist( phlist );
643 trk_ex.set_phlist_hit( phlist_hit );
644 trk_ex.setVecDedxHits( *dedxhitrefvec );
645 ex_trks.push_back(trk_ex );
646 m_trkalgs.push_back(m_trkalg);
647
648 delete dedxhitrefvec;
649 phlist.clear();
650 phlist_hit.clear();
652 }
653 log << MSG::DEBUG << "size in processing: " << ex_trks.size() <<endreq;
654 }
655
656
657 else if(recalg ==1 )
658 {
659 m_trkalg=1;
660
661
662 SmartDataPtr<RecMdcKalTrackCol> newtrkCol(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
663 if (!newtrkCol)
664 {
665 log << MSG::WARNING << "Could not find RecMdcKalTrackCol" << endreq;
666 return StatusCode::SUCCESS;
667 }
669 ntrk = newtrkCol->size();
670 log << MSG::DEBUG << "track collection size: " << newtrkCol->size() <<endreq;
671
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;
677 int Nhits=0;
678 double ph=0,ph_hit=0,pathlength=0,rphi_path=0;
679
680
681 RecMdcKalTrackCol::iterator trk = newtrkCol->begin();
682 for( ; trk != newtrkCol->end(); trk++)
683 {
685
687 log << MSG::DEBUG <<" %%%%% trk id = "<<trk_ex.trk_id() <<endreq;
688 log << MSG::DEBUG <<" %%%%% initial id = "<<(*trk)->trackId() <<endreq;
689
690 HepVector a;
691 HepSymMatrix tkErrM;
692 if(ParticleFlag>-1&&ParticleFlag<5)
693 {
696 tkErrM = dstTrk->
getFError(ParticleFlag);
697 }
698 else
699 {
700 a = (*trk)->getFHelix();
701 tkErrM = (*trk)->getFError();
702 }
703
704 log << MSG::DEBUG <<"FHelix 5 parameters: "<<a[0]<<" "<<a[1] <<" "<<a[2]<<" "<<a[3]<<" "<<a[4]<<endreq;
705
706 m_d0E = tkErrM[0][0];
707 m_phi0E = tkErrM[1][1];
708 m_cpaE = tkErrM[2][2];
709 m_z0E = tkErrM[3][3];
710
711 phi0= a[1];
712 costheta =
cos(M_PI_2-atan(a[4]));
713
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]);
717
718 charge = ( a[2] > 0 )? 1 : -1;
719
721
722
724
725
726 Nhits = gothits.size();
727 log << MSG::DEBUG << "hits size = " <<gothits.size()<<endreq;
728 if(gothits.size()<2)
729 {
730 delete dedxhitrefvec;
731 continue;
732 }
733
734
736 HelixSegRefVec::iterator it_gothit = gothits.begin();
737 for( ; it_gothit != gothits.end(); it_gothit++)
738 {
739 HepVector a_hit_in = (*it_gothit)->getHelixIncl();
740
743
744 p_hit = 1.0/fabs(a_hit_in(3))*sqrt(1+a_hit_in(5)*a_hit_in(5));
745
746
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();
763
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;}
766
767
768
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;
773
774 ph=exsvc->
StandardHitCorrec(0,runFlag,ntpFlag,runNO,pathlength,wid,layid,adc_raw,dd_in,eangle,costheta);
776
777
778
779 if(runNO<=5911 && runNO>=5854 && layid ==14) continue;
780 if(runNO<0)
781 {
782 if (layid<8)
783 {
785 }
786 else if(layid >= 8)
787 {
789 }
790 }
791 else if(runNO>=0)
792 {
793 if(layid <8)
794 {
796 }
797 else if(layid >= 8)
798 {
800 }
801 }
802
803
804 if (ph<0.0||ph==0) continue;
805 else
806 {
807
816
817
818 if(m_rootfile!= "no rootfile")
819 {
820 m_hitNo_wire->Fill(wid);
821 }
822
823
824 if ( ntpFlag ==2 )
825 {
826 m_charge1 = (*trk)->charge();
827 m_t01 = tes;
828 m_driftT = driftT;
829 m_tdc_raw = tdc_raw;
830 m_phraw = adc_raw;
831 m_exraw = ph_hit;
832 m_localwid = localwid;
833 m_wire = wid;
834 m_runNO1 = runNO;
835 m_nhit_hit = Nhits;
836 m_doca_in = dd_in;
837 m_doca_ex = dd_ex;
838 m_driftdist = driftD;
839 m_eangle = eangle;
840 m_costheta1 = costheta;
841 m_pathL = pathlength;
842 m_layer = layid;
843 m_ptrk1 = m_P;
844 m_ptrk_hit = p_hit;
845
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;
850 }
851 if(layid>3)
852 {
853 phlist.push_back(ph);
854 phlist_hit.push_back(ph_hit);
855 }
856 }
857 dedxhitList->push_back( dedxhit );
858 dedxhitrefvec->push_back( dedxhit );
859 }
860 trk_ex.set_phlist( phlist );
861 trk_ex.set_phlist_hit( phlist_hit );
862 trk_ex.setVecDedxHits( *dedxhitrefvec );
863 ex_trks.push_back(trk_ex );
864 m_trkalgs.push_back(m_trkalg);
865
866 delete dedxhitrefvec;
867 phlist.clear();
868 phlist_hit.clear();
870 }
871 log << MSG::DEBUG << "size in processing: " << ex_trks.size() <<endreq;
872 }
873
874
875
876 if( ntrk != ex_trks.size())
877 log << MSG::DEBUG <<"ntrkCol size: "<<ntrk<<" dedxtrk size: "<<ex_trks.size()<< endreq;
878
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;
882 int usedhit = 0;
883 double phtm=0,median=0,geometric=0,geometric_trunc=0,harmonic=0,harmonic_trunc=0,transform=0,logtrunc=0;
884
886 float probpid_temp=-0.01,expect_temp=-0.01,sigma_temp=-0.01,chidedx_temp=-0.01;
887
888 double dEdx_meas_hit=0;
889 double dEdx_meas=0,dEdx_meas_esat=0,dEdx_meas_norun=0;
890 int trk_recalg=-1;
891
892 int idedxid = 0;
893 for(std::vector<MdcDedxTrk>::iterator it = ex_trks.begin(); it != ex_trks.end(); it++, idedxid++ )
894 {
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;
898
899 if(it->trk_ptr_kal()!=0)
900 {
901 poca_x = it->trk_ptr_kal()->x();
902 poca_y = it->trk_ptr_kal()->y();
903 poca_z = it->trk_ptr_kal()->z();
904 }
905 else if(it->trk_ptr()!=0)
906 {
907 poca_x = it->trk_ptr()->x();
908 poca_y = it->trk_ptr()->y();
909 poca_z = it->trk_ptr()->z();
910 }
911
912
913 sintheta =
sin(it->theta());
914 costheta =
cos(it->theta());
915 ptrk = it->P();
916 charge = it->charge();
917 Nhit = it->nsample();
918 Nphlisthit = it->get_phlist_hit().size();
919
920
921
922 phtm = it->cal_dedx( truncate );
923
924
925
926
927
928
929
930
931
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)
937 {
938 cout<<"***************bad extrk with no hits!!!!!******************"<<endl;
939 continue;
940 }
941
942 usedhit = (int)(Nphlisthit*truncate);
943
944
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;
951
952
953 trk_recalg = m_trkalgs[idedxid];
954
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);
958 probpid_temp=-0.01;
959 expect_temp=-0.01;
960 sigma_temp=-0.01;
961 chidedx_temp=-0.01;
962 for(int i=0;i<5;i++)
963 {
964 if(it->pprob()[i]>probpid_temp)
965 {
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];
971 }
972 }
973 log<< MSG::INFO<<"expect dE/dx: type: "<<parType_temp<<" probpid: "<<probpid_temp<<" expect: "<<expect_temp<<" sigma: "<<sigma_temp<<" chidedx: "<<chidedx_temp<<endreq;
974
975
976
988 resdedx->
setChi( it->pchi_dedx() );
989
992
993
995
998
1002
1003
1004 if(ntpFlag ==2)
1005 {
1006 m_phtm=phtm;
1007
1008
1009
1010
1011
1012
1013
1014 m_dEdx_meas = dEdx_meas;
1015
1016 m_poca_x = poca_x;
1017 m_poca_y = poca_y;
1018 m_poca_z = poca_z;
1019 m_ptrk=ptrk;
1020 m_sintheta=sintheta;
1021 m_costheta=costheta;
1022 m_charge=charge;
1023 m_runNO = runNO;
1024 m_evtNO = eventNO;
1025
1026 m_t0 = tes;
1027 m_trackId = it->trk_id();
1028 m_recalg = trk_recalg;
1029
1030 m_nhit=Nhit;
1031 m_nphlisthit=Nphlisthit;
1032 m_usedhit=usedhit;
1033 for(int i=0; i<Nphlisthit; i++) m_dEdx_hit[i] = it->get_phlist_hit()[i];
1034
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++)
1046 {
1047 m_probpid[i]= it->pprob()[i];
1048 m_expectid[i]= it->pexpect()[i];
1049 m_sigmaid[i]= it->pexp_sigma()[i];
1050 }
1051
1052 StatusCode status = m_nt1->write();
1053 if ( status.isFailure() )
1054 {
1055 log << MSG::ERROR << "Cannot fill Ntuple n103" << endreq;
1056 }
1057 }
1058
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;
1062
1063 dedxList->push_back( resdedx );
1064 }
1065 }
1066
1067
1068
1069 SmartDataPtr<RecMdcDedxCol> newexCol(eventSvc(),"/Event/Recon/RecMdcDedxCol");
1070 if (!newexCol)
1071 {
1072 log << MSG::FATAL << "Could not find RecMdcDedxCol" << endreq;
1073 return( StatusCode::SUCCESS);
1074 }
1075 log << MSG::DEBUG << "----------------Begin to check RecMdcDedxCol-----------------"<<endreq;
1076 RecMdcDedxCol::iterator it_dedx = newexCol->begin();
1077 for( ; it_dedx != newexCol->end(); it_dedx++)
1078 {
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;
1106 }
1107 return StatusCode::SUCCESS;
1108}
double abs(const EvtComplex &c)
#define Iner_DriftDistCut
double sin(const BesAngle a)
double cos(const BesAngle a)
ObjectVector< RecMdcDedxHit > RecMdcDedxHitCol
SmartRefVector< RecMdcDedxHit > DedxHitRefVec
ObjectVector< RecMdcDedx > RecMdcDedxCol
SmartRefVector< RecMdcKalHelixSeg > HelixSegRefVec
SmartRefVector< RecMdcHit > HitRefVec
void setTruncAlg(int trunc_alg)
void setStatus(int status)
void setNumGoodHits(int numGoodHits)
void setProbPH(double probPH)
void setNormPH(double normPH)
void setParticleId(int particleId)
void setTrackId(int trackId)
void setNumTotalHits(int numTotalHits)
const HepSymMatrix & getFError(const int pid) const
const HepVector & getFHelix(const int pid) const
virtual double StandardHitCorrec(int calib_rec_Flag, int runFlag, int ntpFlag, int runNO, double pathl, int wid, int layid, double adc, double dd, double eangle, double costheta) const =0
virtual double StandardTrackCorrec(int calib_rec_Flag, int typFlag, int ntpFlag, int runNO, double ex, double costheta, double t0) const =0
virtual double PathL(int ntpFlag, const Dedx_Helix &hel, int layer, int cellid, double z) const =0
virtual const int getSigmaSize()=0
virtual const int getCurveSize()=0
virtual const double getCurve(int i)=0
virtual const double getSigma(int i)=0
virtual const MdcGeoLayer *const Layer(unsigned id)=0
void switchtomdctrack(int trkid, Identifier mdcid, double tes, int RunNO, int runFlag, MsgStream log)
void kaltrackrec(RecMdcKalTrackCol::iterator trk, Identifier mdcid, double tes, int RunNO, int runFlag, MsgStream log)
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
static int wire(const Identifier &id)
void setMdcId(Identifier mdcid)
void setDedx(double dedx)
void setMdcKalHelixSeg(const RecMdcKalHelixSeg *mdcKalHelixSeg)
void setMdcHit(const RecMdcHit *mdcHit)
void setPathLength(double pathlength)
void setMdcTrack(RecMdcTrack *trk)
void setVecDedxHits(const DedxHitRefVec &vecdedxhit)
void setDedxNoRun(double dedx_norun)
void setMdcKalTrack(RecMdcKalTrack *trk)
void setDedxMoment(double dedx_momentum)
void setDedxExpect(double *dedx_exp)
void setSigmaDedx(double *sigma_dedx)
void setDedxEsat(double dedx_esat)
void setDedxHit(double dedx_hit)
void setPidProb(double *pid_prob)
_EXTERN_ std::string RecMdcDedxCol
_EXTERN_ std::string RecMdcDedxHitCol