CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
Rhopi Class Reference

#include <Rhopi.h>

+ Inheritance diagram for Rhopi:

Public Member Functions

 Rhopi (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 

Detailed Description

Definition at line 10 of file Rhopi.h.

Constructor & Destructor Documentation

◆ Rhopi()

Rhopi::Rhopi ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 58 of file Rhopi.cxx.

58 :
59 Algorithm(name, pSvcLocator) {
60
61 //Declare the properties
62 declareProperty("Vr0cut", m_vr0cut=1.0);
63 declareProperty("Vz0cut", m_vz0cut=5.0);
64 declareProperty("EnergyThreshold", m_energyThreshold=0.04);
65 declareProperty("GammaPhiCut", m_gammaPhiCut=20.0);
66 declareProperty("GammaThetaCut", m_gammaThetaCut=20.0);
67 declareProperty("GammaAngleCut", m_gammaAngleCut=20.0);
68 declareProperty("Test4C", m_test4C = 1);
69 declareProperty("Test5C", m_test5C = 1);
70 declareProperty("CheckDedx", m_checkDedx = 1);
71 declareProperty("CheckTof", m_checkTof = 1);
72}

Member Function Documentation

◆ execute()

StatusCode Rhopi::execute ( )

Definition at line 308 of file Rhopi.cxx.

308 {
309
310 std::cout << "execute()" << std::endl;
311
312 MsgStream log(msgSvc(), name());
313 log << MSG::INFO << "in execute()" << endreq;
314
315 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
316 int runNo=eventHeader->runNumber();
317 int event=eventHeader->eventNumber();
318 log << MSG::DEBUG <<"run, evtnum = "
319 << runNo << " , "
320 << event <<endreq;
321 cout<<"event "<<event<<endl;
322 Ncut0++;
323
324 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
325 // log << MSG::INFO << "get event tag OK" << endreq;
326 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
327 << evtRecEvent->totalCharged() << " , "
328 << evtRecEvent->totalNeutral() << " , "
329 << evtRecEvent->totalTracks() <<endreq;
330
331 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
332 //
333 // check x0, y0, z0, r0
334 // suggest cut: |z0|<5 && r0<1
335 //
336 Vint iGood, ipip, ipim;
337 iGood.clear();
338 ipip.clear();
339 ipim.clear();
340 Vp4 ppip, ppim;
341 ppip.clear();
342 ppim.clear();
343
344 int nCharge = 0;
345
346 Hep3Vector xorigin(0,0,0);
347
348 //if (m_reader.isRunNumberValid(runNo)) {
349 IVertexDbSvc* vtxsvc;
350 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
351 if(vtxsvc->isVertexValid()){
352 double* dbv = vtxsvc->PrimaryVertex();
353 double* vv = vtxsvc->SigmaPrimaryVertex();
354// HepVector dbv = m_reader.PrimaryVertex(runNo);
355// HepVector vv = m_reader.SigmaPrimaryVertex(runNo);
356 xorigin.setX(dbv[0]);
357 xorigin.setY(dbv[1]);
358 xorigin.setZ(dbv[2]);
359 }
360
361 for(int i = 0; i < evtRecEvent->totalCharged(); i++){
362 EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i;
363 if(!(*itTrk)->isMdcTrackValid()) continue;
364 RecMdcTrack *mdcTrk = (*itTrk)->mdcTrack();
365 double pch=mdcTrk->p();
366 double x0=mdcTrk->x();
367 double y0=mdcTrk->y();
368 double z0=mdcTrk->z();
369 double phi0=mdcTrk->helix(1);
370 double xv=xorigin.x();
371 double yv=xorigin.y();
372 double Rxy=(x0-xv)*cos(phi0)+(y0-yv)*sin(phi0);
373 m_vx0 = x0;
374 m_vy0 = y0;
375 m_vz0 = z0;
376 m_vr0 = Rxy;
377
378 HepVector a = mdcTrk->helix();
379 HepSymMatrix Ea = mdcTrk->err();
380 HepPoint3D point0(0.,0.,0.); // the initial point for MDC recosntruction
381 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
382 VFHelix helixip(point0,a,Ea);
383 helixip.pivot(IP);
384 HepVector vecipa = helixip.a();
385 double Rvxy0=fabs(vecipa[0]); //the nearest distance to IP in xy plane
386 double Rvz0=vecipa[3]; //the nearest distance to IP in z direction
387 double Rvphi0=vecipa[1];
388 m_rvxy0=Rvxy0;
389 m_rvz0=Rvz0;
390 m_rvphi0=Rvphi0;
391
392 m_tuple1->write();
393// if(fabs(z0) >= m_vz0cut) continue;
394// if(fabs(Rxy) >= m_vr0cut) continue;
395
396 if(fabs(Rvz0) >= 10.0) continue;
397 if(fabs(Rvxy0) >= 1.0) continue;
398
399 iGood.push_back(i);
400 nCharge += mdcTrk->charge();
401 }
402
403 //
404 // Finish Good Charged Track Selection
405 //
406 int nGood = iGood.size();
407 log << MSG::DEBUG << "ngood, totcharge = " << nGood << " , " << nCharge << endreq;
408 if((nGood != 2)||(nCharge!=0)){
409 return StatusCode::SUCCESS;
410 }
411 Ncut1++;
412
413 Vint iGam;
414 iGam.clear();
415 for(int i = evtRecEvent->totalCharged(); i< evtRecEvent->totalTracks(); i++) {
416 EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i;
417 if(!(*itTrk)->isEmcShowerValid()) continue;
418 RecEmcShower *emcTrk = (*itTrk)->emcShower();
419 Hep3Vector emcpos(emcTrk->x(), emcTrk->y(), emcTrk->z());
420 // find the nearest charged track
421 double dthe = 200.;
422 double dphi = 200.;
423 double dang = 200.;
424 for(int j = 0; j < evtRecEvent->totalCharged(); j++) {
425 EvtRecTrackIterator jtTrk = evtRecTrkCol->begin() + j;
426 if(!(*jtTrk)->isExtTrackValid()) continue;
427 RecExtTrack *extTrk = (*jtTrk)->extTrack();
428 if(extTrk->emcVolumeNumber() == -1) continue;
429 Hep3Vector extpos = extTrk->emcPosition();
430 // double ctht = extpos.cosTheta(emcpos);
431 double angd = extpos.angle(emcpos);
432 double thed = extpos.theta() - emcpos.theta();
433 double phid = extpos.deltaPhi(emcpos);
434 thed = fmod(thed+CLHEP::twopi+CLHEP::twopi+pi, CLHEP::twopi) - CLHEP::pi;
435 phid = fmod(phid+CLHEP::twopi+CLHEP::twopi+pi, CLHEP::twopi) - CLHEP::pi;
436 if(angd < dang){
437 dang = angd;
438 dthe = thed;
439 dphi = phid;
440 }
441 }
442 if(dang>=200) continue;
443 double eraw = emcTrk->energy();
444 dthe = dthe * 180 / (CLHEP::pi);
445 dphi = dphi * 180 / (CLHEP::pi);
446 dang = dang * 180 / (CLHEP::pi);
447 m_dthe = dthe;
448 m_dphi = dphi;
449 m_dang = dang;
450 m_eraw = eraw;
451 m_tuple2->write();
452 if(eraw < m_energyThreshold) continue;
453// if((fabs(dthe) < m_gammaThetaCut) && (fabs(dphi)<m_gammaPhiCut) ) continue;
454 if(fabs(dang) < m_gammaAngleCut) continue;
455 //
456 // good photon cut will be set here
457 //
458 iGam.push_back(i);
459 }
460
461 //
462 // Finish Good Photon Selection
463 //
464 int nGam = iGam.size();
465
466 log << MSG::DEBUG << "num Good Photon " << nGam << " , " <<evtRecEvent->totalNeutral()<<endreq;
467 if(nGam<2){
468 return StatusCode::SUCCESS;
469 }
470 Ncut2++;
471
472
473
474 //
475 //
476 // check dedx infomation
477 //
478 //
479
480 if(m_checkDedx == 1) {
481 for(int i = 0; i < nGood; i++) {
482 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + iGood[i];
483 if(!(*itTrk)->isMdcTrackValid()) continue;
484 if(!(*itTrk)->isMdcDedxValid())continue;
485 RecMdcTrack* mdcTrk = (*itTrk)->mdcTrack();
486 RecMdcDedx* dedxTrk = (*itTrk)->mdcDedx();
487 m_ptrk = mdcTrk->p();
488
489 m_chie = dedxTrk->chiE();
490 m_chimu = dedxTrk->chiMu();
491 m_chipi = dedxTrk->chiPi();
492 m_chik = dedxTrk->chiK();
493 m_chip = dedxTrk->chiP();
494 m_ghit = dedxTrk->numGoodHits();
495 m_thit = dedxTrk->numTotalHits();
496 m_probPH = dedxTrk->probPH();
497 m_normPH = dedxTrk->normPH();
498 m_tuple7->write();
499 }
500 }
501
502 //
503 // check TOF infomation
504 //
505
506
507 if(m_checkTof == 1) {
508 for(int i = 0; i < nGood; i++) {
509 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + iGood[i];
510 if(!(*itTrk)->isMdcTrackValid()) continue;
511 if(!(*itTrk)->isTofTrackValid()) continue;
512
513 RecMdcTrack * mdcTrk = (*itTrk)->mdcTrack();
514 SmartRefVector<RecTofTrack> tofTrkCol = (*itTrk)->tofTrack();
515
516 double ptrk = mdcTrk->p();
517
518 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
519 for(;iter_tof != tofTrkCol.end(); iter_tof++ ) {
520 TofHitStatus *status = new TofHitStatus;
521 status->setStatus((*iter_tof)->status());
522 if(!(status->is_barrel())){//endcap
523 if( !(status->is_counter()) ) continue; // ?
524 if( status->layer()!=0 ) continue;//layer1
525 double path=(*iter_tof)->path(); // ?
526 double tof = (*iter_tof)->tof();
527 double ph = (*iter_tof)->ph();
528 double rhit = (*iter_tof)->zrhit();
529 double qual = 0.0 + (*iter_tof)->quality();
530 double cntr = 0.0 + (*iter_tof)->tofID();
531 double texp[5];
532 for(int j = 0; j < 5; j++) {
533 double gb = ptrk/xmass[j];
534 double beta = gb/sqrt(1+gb*gb);
535 texp[j] = 10 * path /beta/velc;
536 }
537 m_cntr_etof = cntr;
538 m_ptot_etof = ptrk;
539 m_ph_etof = ph;
540 m_rhit_etof = rhit;
541 m_qual_etof = qual;
542 m_te_etof = tof - texp[0];
543 m_tmu_etof = tof - texp[1];
544 m_tpi_etof = tof - texp[2];
545 m_tk_etof = tof - texp[3];
546 m_tp_etof = tof - texp[4];
547 m_tuple8->write();
548 }
549 else {//barrel
550 if( !(status->is_counter()) ) continue; // ?
551 if(status->layer()==1){ //layer1
552 double path=(*iter_tof)->path(); // ?
553 double tof = (*iter_tof)->tof();
554 double ph = (*iter_tof)->ph();
555 double rhit = (*iter_tof)->zrhit();
556 double qual = 0.0 + (*iter_tof)->quality();
557 double cntr = 0.0 + (*iter_tof)->tofID();
558 double texp[5];
559 for(int j = 0; j < 5; j++) {
560 double gb = ptrk/xmass[j];
561 double beta = gb/sqrt(1+gb*gb);
562 texp[j] = 10 * path /beta/velc;
563 }
564
565 m_cntr_btof1 = cntr;
566 m_ptot_btof1 = ptrk;
567 m_ph_btof1 = ph;
568 m_zhit_btof1 = rhit;
569 m_qual_btof1 = qual;
570 m_te_btof1 = tof - texp[0];
571 m_tmu_btof1 = tof - texp[1];
572 m_tpi_btof1 = tof - texp[2];
573 m_tk_btof1 = tof - texp[3];
574 m_tp_btof1 = tof - texp[4];
575 m_tuple9->write();
576 }
577
578 if(status->layer()==2){//layer2
579 double path=(*iter_tof)->path(); // ?
580 double tof = (*iter_tof)->tof();
581 double ph = (*iter_tof)->ph();
582 double rhit = (*iter_tof)->zrhit();
583 double qual = 0.0 + (*iter_tof)->quality();
584 double cntr = 0.0 + (*iter_tof)->tofID();
585 double texp[5];
586 for(int j = 0; j < 5; j++) {
587 double gb = ptrk/xmass[j];
588 double beta = gb/sqrt(1+gb*gb);
589 texp[j] = 10 * path /beta/velc;
590 }
591
592 m_cntr_btof2 = cntr;
593 m_ptot_btof2 = ptrk;
594 m_ph_btof2 = ph;
595 m_zhit_btof2 = rhit;
596 m_qual_btof2 = qual;
597 m_te_btof2 = tof - texp[0];
598 m_tmu_btof2 = tof - texp[1];
599 m_tpi_btof2 = tof - texp[2];
600 m_tk_btof2 = tof - texp[3];
601 m_tp_btof2 = tof - texp[4];
602 m_tuple10->write();
603 }
604 }
605
606 delete status;
607 }
608 } // loop all charged track
609 } // check tof
610
611
612 //
613 // Assign 4-momentum to each photon
614 //
615
616 Vp4 pGam;
617 pGam.clear();
618 for(int i = 0; i < nGam; i++) {
619 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + iGam[i];
620 RecEmcShower* emcTrk = (*itTrk)->emcShower();
621 double eraw = emcTrk->energy();
622 double phi = emcTrk->phi();
623 double the = emcTrk->theta();
624 HepLorentzVector ptrk;
625 ptrk.setPx(eraw*sin(the)*cos(phi));
626 ptrk.setPy(eraw*sin(the)*sin(phi));
627 ptrk.setPz(eraw*cos(the));
628 ptrk.setE(eraw);
629
630// ptrk = ptrk.boost(-0.011,0,0);// boost to cms
631
632 pGam.push_back(ptrk);
633 }
634 cout<<"before pid"<<endl;
635 //
636 // Assign 4-momentum to each charged track
637 //
639 for(int i = 0; i < nGood; i++) {
640 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + iGood[i];
641 // if(pid) delete pid;
642 pid->init();
643 pid->setMethod(pid->methodProbability());
644// pid->setMethod(pid->methodLikelihood()); //for Likelihood Method
645
646 pid->setChiMinCut(4);
647 pid->setRecTrack(*itTrk);
648 pid->usePidSys(pid->useDedx() | pid->useTof1() | pid->useTof2() | pid->useTofE()); // use PID sub-system
649 pid->identify(pid->onlyPion() | pid->onlyKaon()); // seperater Pion/Kaon
650 // pid->identify(pid->onlyPion());
651 // pid->identify(pid->onlyKaon());
652 pid->calculate();
653 if(!(pid->IsPidInfoValid())) continue;
654 RecMdcTrack* mdcTrk = (*itTrk)->mdcTrack();
655 m_ptrk_pid = mdcTrk->p();
656 m_cost_pid = cos(mdcTrk->theta());
657 m_dedx_pid = pid->chiDedx(2);
658 m_tof1_pid = pid->chiTof1(2);
659 m_tof2_pid = pid->chiTof2(2);
660 m_prob_pid = pid->probPion();
661 m_tuple11->write();
662
663// if(pid->probPion() < 0.001 || (pid->probPion() < pid->probKaon())) continue;
664 if(pid->probPion() < 0.001) continue;
665// if(pid->pdf(2)<pid->pdf(3)) continue; // for Likelihood Method(0=electron 1=muon 2=pion 3=kaon 4=proton)
666
667 RecMdcKalTrack* mdcKalTrk = (*itTrk)->mdcKalTrack();//After ParticleID, use RecMdcKalTrack substitute RecMdcTrack
668 RecMdcKalTrack::setPidType (RecMdcKalTrack::pion);//PID can set to electron, muon, pion, kaon and proton;The default setting is pion
669
670 if(mdcKalTrk->charge() >0) {
671 ipip.push_back(iGood[i]);
672 HepLorentzVector ptrk;
673 ptrk.setPx(mdcKalTrk->px());
674 ptrk.setPy(mdcKalTrk->py());
675 ptrk.setPz(mdcKalTrk->pz());
676 double p3 = ptrk.mag();
677 ptrk.setE(sqrt(p3*p3+mpi*mpi));
678
679// ptrk = ptrk.boost(-0.011,0,0);//boost to cms
680
681 ppip.push_back(ptrk);
682 } else {
683 ipim.push_back(iGood[i]);
684 HepLorentzVector ptrk;
685 ptrk.setPx(mdcKalTrk->px());
686 ptrk.setPy(mdcKalTrk->py());
687 ptrk.setPz(mdcKalTrk->pz());
688 double p3 = ptrk.mag();
689 ptrk.setE(sqrt(p3*p3+mpi*mpi));
690
691// ptrk = ptrk.boost(-0.011,0,0);//boost to cms
692
693 ppim.push_back(ptrk);
694 }
695 }
696
697/*
698 for(int i = 0; i < nGood; i++) {//for rhopi without PID
699 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + iGood[i];
700 RecMdcTrack* mdcTrk = (*itTrk)->mdcTrack();
701 if(mdcTrk->charge() >0) {
702 ipip.push_back(iGood[i]);
703 HepLorentzVector ptrk;
704 ptrk.setPx(mdcTrk->px());
705 ptrk.setPy(mdcTrk->py());
706 ptrk.setPz(mdcTrk->pz());
707 double p3 = ptrk.mag();
708 ptrk.setE(sqrt(p3*p3+mpi*mpi));
709 ppip.push_back(ptrk);
710 } else {
711 ipim.push_back(iGood[i]);
712 HepLorentzVector ptrk;
713 ptrk.setPx(mdcTrk->px());
714 ptrk.setPy(mdcTrk->py());
715 ptrk.setPz(mdcTrk->pz());
716 double p3 = ptrk.mag();
717 ptrk.setE(sqrt(p3*p3+mpi*mpi));
718 ppim.push_back(ptrk);
719 }
720 }// without PID
721*/
722
723 int npip = ipip.size();
724 int npim = ipim.size();
725 if(npip*npim != 1) return SUCCESS;
726
727 Ncut3++;
728
729
730 //
731 // Loop each gamma pair, check ppi0 and pTot
732 //
733
734 HepLorentzVector pTot;
735 for(int i = 0; i < nGam - 1; i++){
736 for(int j = i+1; j < nGam; j++) {
737 HepLorentzVector p2g = pGam[i] + pGam[j];
738 pTot = ppip[0] + ppim[0];
739 pTot += p2g;
740 m_m2gg = p2g.m();
741 m_etot = pTot.e();
742 m_tuple3 -> write();
743
744 }
745 }
746
747
748 RecMdcKalTrack *pipTrk = (*(evtRecTrkCol->begin()+ipip[0]))->mdcKalTrack();
749 RecMdcKalTrack *pimTrk = (*(evtRecTrkCol->begin()+ipim[0]))->mdcKalTrack();
750
751 WTrackParameter wvpipTrk, wvpimTrk;
752 wvpipTrk = WTrackParameter(mpi, pipTrk->getZHelix(), pipTrk->getZError());
753 wvpimTrk = WTrackParameter(mpi, pimTrk->getZHelix(), pimTrk->getZError());
754
755/* Default is pion, for other particles:
756 wvppTrk = WTrackParameter(mp, pipTrk->getZHelixP(), pipTrk->getZErrorP());//proton
757 wvmupTrk = WTrackParameter(mmu, pipTrk->getZHelixMu(), pipTrk->getZErrorMu());//muon
758 wvepTrk = WTrackParameter(me, pipTrk->getZHelixE(), pipTrk->getZErrorE());//electron
759 wvkpTrk = WTrackParameter(mk, pipTrk->getZHelixK(), pipTrk->getZErrorK());//kaon
760*/
761 //
762 // Test vertex fit
763 //
764
765 HepPoint3D vx(0., 0., 0.);
766 HepSymMatrix Evx(3, 0);
767 double bx = 1E+6;
768 double by = 1E+6;
769 double bz = 1E+6;
770 Evx[0][0] = bx*bx;
771 Evx[1][1] = by*by;
772 Evx[2][2] = bz*bz;
773
774 VertexParameter vxpar;
775 vxpar.setVx(vx);
776 vxpar.setEvx(Evx);
777
778 VertexFit* vtxfit = VertexFit::instance();
779 vtxfit->init();
780 vtxfit->AddTrack(0, wvpipTrk);
781 vtxfit->AddTrack(1, wvpimTrk);
782 vtxfit->AddVertex(0, vxpar,0, 1);
783 if(!vtxfit->Fit(0)) return SUCCESS;
784 vtxfit->Swim(0);
785
786 WTrackParameter wpip = vtxfit->wtrk(0);
787 WTrackParameter wpim = vtxfit->wtrk(1);
788
789 //KinematicFit * kmfit = KinematicFit::instance();
791
792 //
793 // Apply Kinematic 4C fit
794 //
795 cout<<"before 4c"<<endl;
796 if(m_test4C==1) {
797// double ecms = 3.097;
798 HepLorentzVector ecms(0.034,0,0,3.097);
799
800 double chisq = 9999.;
801 int ig1 = -1;
802 int ig2 = -1;
803 for(int i = 0; i < nGam-1; i++) {
804 RecEmcShower *g1Trk = (*(evtRecTrkCol->begin()+iGam[i]))->emcShower();
805 for(int j = i+1; j < nGam; j++) {
806 RecEmcShower *g2Trk = (*(evtRecTrkCol->begin()+iGam[j]))->emcShower();
807 kmfit->init();
808 kmfit->AddTrack(0, wpip);
809 kmfit->AddTrack(1, wpim);
810 kmfit->AddTrack(2, 0.0, g1Trk);
811 kmfit->AddTrack(3, 0.0, g2Trk);
812 kmfit->AddFourMomentum(0, ecms);
813 bool oksq = kmfit->Fit();
814 if(oksq) {
815 double chi2 = kmfit->chisq();
816 if(chi2 < chisq) {
817 chisq = chi2;
818 ig1 = iGam[i];
819 ig2 = iGam[j];
820 }
821 }
822 }
823 }
824
825 if(chisq < 200) {
826
827 RecEmcShower *g1Trk = (*(evtRecTrkCol->begin()+ig1))->emcShower();
828 RecEmcShower *g2Trk = (*(evtRecTrkCol->begin()+ig2))->emcShower();
829 kmfit->init();
830 kmfit->AddTrack(0, wpip);
831 kmfit->AddTrack(1, wpim);
832 kmfit->AddTrack(2, 0.0, g1Trk);
833 kmfit->AddTrack(3, 0.0, g2Trk);
834 kmfit->AddFourMomentum(0, ecms);
835 bool oksq = kmfit->Fit();
836 if(oksq) {
837 HepLorentzVector ppi0 = kmfit->pfit(2) + kmfit->pfit(3);
838 m_mpi0 = ppi0.m();
839 m_chi1 = kmfit->chisq();
840 m_tuple4->write();
841 Ncut4++;
842 }
843 }
844 }
845
846 //
847 // Apply Kinematic 5C Fit
848 //
849
850 // find the best combination over all possible pi+ pi- gamma gamma pair
851 if(m_test5C==1) {
852// double ecms = 3.097;
853 HepLorentzVector ecms(0.034,0,0,3.097);
854 double chisq = 9999.;
855 int ig1 = -1;
856 int ig2 = -1;
857 for(int i = 0; i < nGam-1; i++) {
858 RecEmcShower *g1Trk = (*(evtRecTrkCol->begin()+iGam[i]))->emcShower();
859 for(int j = i+1; j < nGam; j++) {
860 RecEmcShower *g2Trk = (*(evtRecTrkCol->begin()+iGam[j]))->emcShower();
861 kmfit->init();
862 kmfit->AddTrack(0, wpip);
863 kmfit->AddTrack(1, wpim);
864 kmfit->AddTrack(2, 0.0, g1Trk);
865 kmfit->AddTrack(3, 0.0, g2Trk);
866 kmfit->AddResonance(0, 0.135, 2, 3);
867 kmfit->AddFourMomentum(1, ecms);
868 if(!kmfit->Fit(0)) continue;
869 if(!kmfit->Fit(1)) continue;
870 bool oksq = kmfit->Fit();
871 if(oksq) {
872 double chi2 = kmfit->chisq();
873 if(chi2 < chisq) {
874 chisq = chi2;
875 ig1 = iGam[i];
876 ig2 = iGam[j];
877 }
878 }
879 }
880 }
881
882
883 log << MSG::INFO << " chisq = " << chisq <<endreq;
884
885 if(chisq < 200) {
886 RecEmcShower* g1Trk = (*(evtRecTrkCol->begin()+ig1))->emcShower();
887 RecEmcShower* g2Trk = (*(evtRecTrkCol->begin()+ig2))->emcShower();
888
889 kmfit->init();
890 kmfit->AddTrack(0, wpip);
891 kmfit->AddTrack(1, wpim);
892 kmfit->AddTrack(2, 0.0, g1Trk);
893 kmfit->AddTrack(3, 0.0, g2Trk);
894 kmfit->AddResonance(0, 0.135, 2, 3);
895 kmfit->AddFourMomentum(1, ecms);
896 bool oksq = kmfit->Fit();
897 if(oksq){
898 HepLorentzVector ppi0 = kmfit->pfit(2) + kmfit->pfit(3);
899 HepLorentzVector prho0 = kmfit->pfit(0) + kmfit->pfit(1);
900 HepLorentzVector prhop = ppi0 + kmfit->pfit(0);
901 HepLorentzVector prhom = ppi0 + kmfit->pfit(1);
902
903 m_chi2 = kmfit->chisq();
904 m_mrh0 = prho0.m();
905 m_mrhp = prhop.m();
906 m_mrhm = prhom.m();
907 double eg1 = (kmfit->pfit(2)).e();
908 double eg2 = (kmfit->pfit(3)).e();
909 double fcos = abs(eg1-eg2)/ppi0.rho();
910 m_tuple5->write();
911 Ncut5++;
912 //
913 // Measure the photon detection efficiences via
914 // J/psi -> rho0 pi0
915 //
916 if(fabs(prho0.m()-0.770)<0.150) {
917 if(fabs(fcos)<0.99) {
918 m_fcos = (eg1-eg2)/ppi0.rho();
919 m_elow = (eg1 < eg2) ? eg1 : eg2;
920 m_tuple6->write();
921 Ncut6++;
922 }
923 } // rho0 cut
924 } //oksq
925 }
926 }
927 return StatusCode::SUCCESS;
928}
double sin(const BesAngle a)
Definition BesAngle.h:210
double cos(const BesAngle a)
Definition BesAngle.h:213
int runNo
double abs(const EvtComplex &c)
EvtRecTrackCol::iterator EvtRecTrackIterator
std::vector< HepLorentzVector > Vp4
Definition Gam4pikp.cxx:53
const double xmass[5]
Definition Gam4pikp.cxx:50
const double velc
Definition Gam4pikp.cxx:51
const double mpi
Definition Gam4pikp.cxx:47
std::vector< int > Vint
Definition Gam4pikp.cxx:52
int Ncut2
Definition Ppjrhopi.cxx:53
int Ncut1
Definition Ppjrhopi.cxx:53
int Ncut0
Definition Ppjrhopi.cxx:53
int Ncut5
Definition Ppjrhopi.cxx:53
int Ncut3
Definition Ppjrhopi.cxx:53
int Ncut6
Definition Ppjrhopi.cxx:53
int Ncut4
Definition Ppjrhopi.cxx:53
IMessageSvc * msgSvc()
double theta() const
double phi() const
double x() const
double z() const
double energy() const
double y() const
const Hep3Vector emcPosition() const
const int emcVolumeNumber() const
double probPH() const
Definition DstMdcDedx.h:66
double chiE() const
Definition DstMdcDedx.h:59
int numTotalHits() const
Definition DstMdcDedx.h:65
int numGoodHits() const
Definition DstMdcDedx.h:64
double normPH() const
Definition DstMdcDedx.h:67
double chiPi() const
Definition DstMdcDedx.h:61
double chiK() const
Definition DstMdcDedx.h:62
double chiMu() const
Definition DstMdcDedx.h:60
double chiP() const
Definition DstMdcDedx.h:63
const double px() const
static void setPidType(PidType pidType)
const double pz() const
const double py() const
const int charge() const
const double theta() const
Definition DstMdcTrack.h:59
const HepSymMatrix err() const
const int charge() const
Definition DstMdcTrack.h:53
const HepVector helix() const
......
const double z() const
Definition DstMdcTrack.h:63
const double p() const
Definition DstMdcTrack.h:58
const double y() const
Definition DstMdcTrack.h:62
const double x() const
Definition DstMdcTrack.h:61
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
void AddFourMomentum(int number, HepLorentzVector p4)
HepLorentzVector pfit(int n) const
void AddResonance(int number, double mres, std::vector< int > tlis)
static KalmanKinematicFit * instance()
int useTof2() const
int useTofE() const
int methodProbability() const
int useDedx() const
int onlyKaon() const
int onlyPion() const
int useTof1() const
void setChiMinCut(const double chi=4)
void setRecTrack(EvtRecTrack *trk)
void setMethod(const int method)
Definition ParticleID.h:101
double chiTof2(int n) const
void identify(const int pidcase)
Definition ParticleID.h:110
void usePidSys(const int pidsys)
Definition ParticleID.h:104
static ParticleID * instance()
bool IsPidInfoValid() const
double probPion() const
Definition ParticleID.h:130
double chiTof1(int n) const
void calculate()
void init()
double chiDedx(int n) const
const HepVector & getZHelix() const
const HepSymMatrix & getZError() const
bool is_barrel() const
unsigned int layer() const
void setStatus(unsigned int status)
bool is_counter() const
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
Definition TrackPool.cxx:22
WTrackParameter wtrk(int n) const
Definition VertexFit.h:78
void init()
Definition VertexFit.cxx:29
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
Definition VertexFit.cxx:89
static VertexFit * instance()
Definition VertexFit.cxx:15
void Swim(int n)
Definition VertexFit.h:58
bool Fit()
void setEvx(const HepSymMatrix &eVx)
void setVx(const HepPoint3D &vx)
const double ecms
Definition inclkstar.cxx:42
_EXTERN_ std::string EvtRecEvent
Definition EventModel.h:134
_EXTERN_ std::string EvtRecTrackCol
Definition EventModel.h:135
const float pi
Definition vector3.h:133

◆ finalize()

StatusCode Rhopi::finalize ( )

Definition at line 932 of file Rhopi.cxx.

932 {
933 cout<<"total number: "<<Ncut0<<endl;
934 cout<<"nGood==2, nCharge==0: "<<Ncut1<<endl;
935 cout<<"nGam>=2: "<<Ncut2<<endl;
936 cout<<"Pass Pid: "<<Ncut3<<endl;
937 cout<<"Pass 4C: "<<Ncut4<<endl;
938 cout<<"Pass 5C: "<<Ncut5<<endl;
939 cout<<"J/psi->rho0 pi0: "<<Ncut6<<endl;
940 MsgStream log(msgSvc(), name());
941 log << MSG::INFO << "in finalize()" << endmsg;
942 return StatusCode::SUCCESS;
943}

◆ initialize()

StatusCode Rhopi::initialize ( )

Definition at line 75 of file Rhopi.cxx.

75 {
76 MsgStream log(msgSvc(), name());
77
78 log << MSG::INFO << "in initialize()" << endmsg;
79
80 StatusCode status;
81 NTuplePtr nt1(ntupleSvc(), "FILE1/vxyz");
82 if ( nt1 ) m_tuple1 = nt1;
83 else {
84 m_tuple1 = ntupleSvc()->book ("FILE1/vxyz", CLID_ColumnWiseTuple, "ks N-Tuple example");
85 if ( m_tuple1 ) {
86 status = m_tuple1->addItem ("vx0", m_vx0);
87 status = m_tuple1->addItem ("vy0", m_vy0);
88 status = m_tuple1->addItem ("vz0", m_vz0);
89 status = m_tuple1->addItem ("vr0", m_vr0);
90 status = m_tuple1->addItem ("rvxy0", m_rvxy0);
91 status = m_tuple1->addItem ("rvz0", m_rvz0);
92 status = m_tuple1->addItem ("rvphi0", m_rvphi0);
93 }
94 else {
95 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple1) << endmsg;
96 return StatusCode::FAILURE;
97 }
98 }
99
100 NTuplePtr nt2(ntupleSvc(), "FILE1/photon");
101 if ( nt2 ) m_tuple2 = nt2;
102 else {
103 m_tuple2 = ntupleSvc()->book ("FILE1/photon", CLID_ColumnWiseTuple, "ks N-Tuple example");
104 if ( m_tuple2 ) {
105 status = m_tuple2->addItem ("dthe", m_dthe);
106 status = m_tuple2->addItem ("dphi", m_dphi);
107 status = m_tuple2->addItem ("dang", m_dang);
108 status = m_tuple2->addItem ("eraw", m_eraw);
109 }
110 else {
111 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple2) << endmsg;
112 return StatusCode::FAILURE;
113 }
114 }
115
116
117 NTuplePtr nt3(ntupleSvc(), "FILE1/etot");
118 if ( nt3 ) m_tuple3 = nt3;
119 else {
120 m_tuple3 = ntupleSvc()->book ("FILE1/etot", CLID_ColumnWiseTuple, "ks N-Tuple example");
121 if ( m_tuple3 ) {
122 status = m_tuple3->addItem ("m2gg", m_m2gg);
123 status = m_tuple3->addItem ("etot", m_etot);
124 }
125 else {
126 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple3) << endmsg;
127 return StatusCode::FAILURE;
128 }
129 }
130 if(m_test4C==1) {
131 NTuplePtr nt4(ntupleSvc(), "FILE1/fit4c");
132 if ( nt4 ) m_tuple4 = nt4;
133 else {
134 m_tuple4 = ntupleSvc()->book ("FILE1/fit4c", CLID_ColumnWiseTuple, "ks N-Tuple example");
135 if ( m_tuple4 ) {
136 status = m_tuple4->addItem ("chi2", m_chi1);
137 status = m_tuple4->addItem ("mpi0", m_mpi0);
138 }
139 else {
140 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple4) << endmsg;
141 return StatusCode::FAILURE;
142 }
143 }
144 } // test 4C
145
146
147 if(m_test5C==1) {
148 NTuplePtr nt5(ntupleSvc(), "FILE1/fit5c");
149 if ( nt5 ) m_tuple5 = nt5;
150 else {
151 m_tuple5 = ntupleSvc()->book ("FILE1/fit5c", CLID_ColumnWiseTuple, "ks N-Tuple example");
152 if ( m_tuple5 ) {
153 status = m_tuple5->addItem ("chi2", m_chi2);
154 status = m_tuple5->addItem ("mrh0", m_mrh0);
155 status = m_tuple5->addItem ("mrhp", m_mrhp);
156 status = m_tuple5->addItem ("mrhm", m_mrhm);
157 }
158 else {
159 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple5) << endmsg;
160 return StatusCode::FAILURE;
161 }
162 }
163
164 NTuplePtr nt6(ntupleSvc(), "FILE1/geff");
165 if ( nt6 ) m_tuple6 = nt6;
166 else {
167 m_tuple6 = ntupleSvc()->book ("FILE1/geff", CLID_ColumnWiseTuple, "ks N-Tuple example");
168 if ( m_tuple6 ) {
169 status = m_tuple6->addItem ("fcos", m_fcos);
170 status = m_tuple6->addItem ("elow", m_elow);
171 }
172 else {
173 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple6) << endmsg;
174 return StatusCode::FAILURE;
175 }
176 }
177 } // test 5c
178
179 if(m_checkDedx == 1) {
180 NTuplePtr nt7(ntupleSvc(), "FILE1/dedx");
181 if ( nt7 ) m_tuple7 = nt7;
182 else {
183 m_tuple7 = ntupleSvc()->book ("FILE1/dedx", CLID_ColumnWiseTuple, "ks N-Tuple example");
184 if ( m_tuple7 ) {
185 status = m_tuple7->addItem ("ptrk", m_ptrk);
186 status = m_tuple7->addItem ("chie", m_chie);
187 status = m_tuple7->addItem ("chimu", m_chimu);
188 status = m_tuple7->addItem ("chipi", m_chipi);
189 status = m_tuple7->addItem ("chik", m_chik);
190 status = m_tuple7->addItem ("chip", m_chip);
191 status = m_tuple7->addItem ("probPH", m_probPH);
192 status = m_tuple7->addItem ("normPH", m_normPH);
193 status = m_tuple7->addItem ("ghit", m_ghit);
194 status = m_tuple7->addItem ("thit", m_thit);
195 }
196 else {
197 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple7) << endmsg;
198 return StatusCode::FAILURE;
199 }
200 }
201 } // check dE/dx
202
203 if(m_checkTof == 1) {
204 NTuplePtr nt8(ntupleSvc(), "FILE1/tofe");
205 if ( nt8 ) m_tuple8 = nt8;
206 else {
207 m_tuple8 = ntupleSvc()->book ("FILE1/tofe",CLID_ColumnWiseTuple, "ks N-Tuple example");
208 if ( m_tuple8 ) {
209 status = m_tuple8->addItem ("ptrk", m_ptot_etof);
210 status = m_tuple8->addItem ("cntr", m_cntr_etof);
211 status = m_tuple8->addItem ("ph", m_ph_etof);
212 status = m_tuple8->addItem ("rhit", m_rhit_etof);
213 status = m_tuple8->addItem ("qual", m_qual_etof);
214 status = m_tuple8->addItem ("te", m_te_etof);
215 status = m_tuple8->addItem ("tmu", m_tmu_etof);
216 status = m_tuple8->addItem ("tpi", m_tpi_etof);
217 status = m_tuple8->addItem ("tk", m_tk_etof);
218 status = m_tuple8->addItem ("tp", m_tp_etof);
219 }
220 else {
221 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple8) << endmsg;
222 return StatusCode::FAILURE;
223 }
224 }
225 } // check Tof:endcap
226
227
228
229 if(m_checkTof == 1) {
230 NTuplePtr nt9(ntupleSvc(), "FILE1/tof1");
231 if ( nt9 ) m_tuple9 = nt9;
232 else {
233 m_tuple9 = ntupleSvc()->book ("FILE1/tof1", CLID_ColumnWiseTuple, "ks N-Tuple example");
234 if ( m_tuple9 ) {
235 status = m_tuple9->addItem ("ptrk", m_ptot_btof1);
236 status = m_tuple9->addItem ("cntr", m_cntr_btof1);
237 status = m_tuple9->addItem ("ph", m_ph_btof1);
238 status = m_tuple9->addItem ("zhit", m_zhit_btof1);
239 status = m_tuple9->addItem ("qual", m_qual_btof1);
240 status = m_tuple9->addItem ("te", m_te_btof1);
241 status = m_tuple9->addItem ("tmu", m_tmu_btof1);
242 status = m_tuple9->addItem ("tpi", m_tpi_btof1);
243 status = m_tuple9->addItem ("tk", m_tk_btof1);
244 status = m_tuple9->addItem ("tp", m_tp_btof1);
245 }
246 else {
247 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple9) << endmsg;
248 return StatusCode::FAILURE;
249 }
250 }
251 } // check Tof:barrel inner Tof
252
253
254 if(m_checkTof == 1) {
255 NTuplePtr nt10(ntupleSvc(), "FILE1/tof2");
256 if ( nt10 ) m_tuple10 = nt10;
257 else {
258 m_tuple10 = ntupleSvc()->book ("FILE1/tof2", CLID_ColumnWiseTuple, "ks N-Tuple example");
259 if ( m_tuple10 ) {
260 status = m_tuple10->addItem ("ptrk", m_ptot_btof2);
261 status = m_tuple10->addItem ("cntr", m_cntr_btof2);
262 status = m_tuple10->addItem ("ph", m_ph_btof2);
263 status = m_tuple10->addItem ("zhit", m_zhit_btof2);
264 status = m_tuple10->addItem ("qual", m_qual_btof2);
265 status = m_tuple10->addItem ("te", m_te_btof2);
266 status = m_tuple10->addItem ("tmu", m_tmu_btof2);
267 status = m_tuple10->addItem ("tpi", m_tpi_btof2);
268 status = m_tuple10->addItem ("tk", m_tk_btof2);
269 status = m_tuple10->addItem ("tp", m_tp_btof2);
270 }
271 else {
272 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple10) << endmsg;
273 return StatusCode::FAILURE;
274 }
275 }
276 } // check Tof:barrel outter Tof
277
278
279 NTuplePtr nt11(ntupleSvc(), "FILE1/pid");
280 if ( nt11 ) m_tuple11 = nt11;
281 else {
282 m_tuple11 = ntupleSvc()->book ("FILE1/pid", CLID_ColumnWiseTuple, "ks N-Tuple example");
283 if ( m_tuple11 ) {
284 status = m_tuple11->addItem ("ptrk", m_ptrk_pid);
285 status = m_tuple11->addItem ("cost", m_cost_pid);
286 status = m_tuple11->addItem ("dedx", m_dedx_pid);
287 status = m_tuple11->addItem ("tof1", m_tof1_pid);
288 status = m_tuple11->addItem ("tof2", m_tof2_pid);
289 status = m_tuple11->addItem ("prob", m_prob_pid);
290 }
291 else {
292 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple11) << endmsg;
293 return StatusCode::FAILURE;
294 }
295 }
296
297
298 //
299 //--------end of book--------
300 //
301
302 log << MSG::INFO << "successfully return from initialize()" <<endmsg;
303 return StatusCode::SUCCESS;
304
305}
INTupleSvc * ntupleSvc()

The documentation for this class was generated from the following files: