442 MsgStream log(
msgSvc(), name());
448 ISvcLocator* svcLocator = Gaudi::svcLocator();
449 StatusCode sc=svcLocator->service(
"EventDataSvc", m_evtSvc);
451 cout<<
"Could not accesss EventDataSvc!"<<endl;
454 SmartDataPtr<CgemDigiCol> aDigiCol(m_evtSvc,
"/Event/Digi/CgemDigiCol");
456 cout<<
"Could not retrieve CGEM digi collection"<<endl;
457 nhit = aDigiCol->size();
463 CgemDigiCol::iterator iDigiCol;
464 for(iDigiCol=aDigiCol->begin(); iDigiCol!=aDigiCol->end(); iDigiCol++)
466 const Identifier ident = (*iDigiCol)->identify();
472 if(is_xstrip ==
true) view = 0;
473 double charge = (*iDigiCol)->getCharge_fc();
474 double time = (*iDigiCol)->getTime_ns();
476 hit_strip[ihit] = strip;
477 hit_layer[ihit] = layer;
478 hit_sheet[ihit] = sheet;
479 hit_view[ihit] = view;
481 hit_q[ihit] = charge;
485 else hit_length[ihit] = anode->
getLength();
487 int channel = lutreader->
GetChannel(layer, sheet, view, strip);
488 int roc = lutreader->
GetROC(layer, sheet, view, strip);
489 int feb = lutreader->
GetFEB(layer, sheet, view, strip);
490 int tiger = lutreader->
GetTIGER(layer, sheet, view, strip);
491 int chip = lutreader->
GetChip(layer, sheet, view, strip);
492 int quality = lutreader->
GetQuality(layer, sheet, view, strip);
494 hit_channel[ihit] = channel;
497 hit_tiger[ihit] = tiger;
498 hit_chip[ihit] = chip;
499 hit_quality[ihit] = quality;
501 if(selDigi(iDigiCol, m_selGoodDigi)==
true) {
502 hit_selgooddigi[ihit] = 1;
506 std::map<int, std::vector < int > > *map_strip_to_hit = GetStripToHitMap(layer, sheet, view);
507 std::map<int, std::vector < int > >::iterator it1 = map_strip_to_hit->find(strip);
508 if (it1 != map_strip_to_hit->end()) {
509 it1->second.push_back(ihit);
512 std::vector< int > hitlist;
513 hitlist.push_back(ihit);
514 std::pair<int, std::vector < int> > pair(strip, hitlist);
515 map_strip_to_hit->insert(pair);
526 SmartDataPtr<RecCgemClusterCol> aClusterCol(m_evtSvc,
"/Event/Recon/RecCgemClusterCol");
528 cout<<
"Could not retrieve CGEM cluster collection"<<endl;
529 int nclu = aClusterCol->size();
532 std::cout <<
"nclu " << nclu << std::endl;
540 int tmp_cluster_L1_S1 = -1;
541 int tmp_cluster_L2_S1 = -1;
542 int tmp_cluster_L2_S2 = -1;
543 double tmp_charge_L1_S1 = 0.;
544 double tmp_charge_L2_S1 = 0.;
545 double tmp_charge_L2_S2 = 0.;
549 RecCgemClusterCol::iterator iClusterCol;
550 for(iClusterCol=aClusterCol->begin(); iClusterCol!=aClusterCol->end(); iClusterCol++)
555 int flag = (*iClusterCol)->getflag();
556 int clusterid = (*iClusterCol)->getclusterid();
557 int trkid = (*iClusterCol)->getTrkId();
558 int layerid = (*iClusterCol)->getlayerid();
559 int sheetid = (*iClusterCol)->getsheetid();
560 double edep = (*iClusterCol)->getenergydeposit();
561 double phi = (*iClusterCol)->getrecphi();
562 double v = (*iClusterCol)->getrecv();
563 double z = (*iClusterCol)->getRecZ();
564 double phi_cc = (*iClusterCol)->getrecphi_CC();
565 double v_cc = (*iClusterCol)->getrecv_CC();
566 double z_cc = (*iClusterCol)->getRecZ_CC();
567 double phi_tpc = (*iClusterCol)->getrecphi_mTPC();
568 double v_tpc = (*iClusterCol)->getrecv_mTPC();
569 double z_tpc = (*iClusterCol)->getRecZ_mTPC();
585 int flagB = (*iClusterCol)->getclusterflagb();
586 int flagE = (*iClusterCol)->getclusterflage();
589 if(flag==0 || flag == 1) {
590 cluster_1d_ID[ncluster] = clusterid;
592 cluster_1d_t[ncluster] = 0;
593 cluster_1d_q[ncluster] = edep;
595 cluster_1d_layerid[ncluster] = layerid;
596 cluster_1d_sheetid[ncluster] = sheetid;
597 cluster_1d_view[ncluster] = flag;
598 cluster_1d_r[ncluster] = anode_mid_gap;
599 cluster_1d_phi[ncluster] = phi;
600 cluster_1d_phi_cc[ncluster] = phi_cc;
601 cluster_1d_phi_tpc[ncluster] = phi_tpc;
602 cluster_1d_v[ncluster] =
v;
603 cluster_1d_v_cc[ncluster] = v_cc;
604 cluster_1d_v_tpc[ncluster] = v_tpc;
605 cluster_1d_a_tpc[ncluster] = a_tpc;
606 cluster_1d_b_tpc[ncluster] = b_tpc;
608 cluster_1d_strip1[ncluster] = flagB;
609 cluster_1d_strip2[ncluster] = flagE;
610 int size = flagE - flagB + 1;
611 cluster_1d_size[ncluster] = size;
614 std::map<int, std::vector < int > > *read_map_strip_to_hit = GetStripToHitMap(layerid, sheetid, flag);
615 std::map<int, std::vector < int > >::iterator it2;
624 for(
int istrip = 0; istrip < size; istrip++) {
625 int stripid = flagB + istrip;
626 it2 = read_map_strip_to_hit->find(stripid);
627 std::vector< int > hitlist = it2->second;
628 int size_hitlist = hitlist.size();
629 cluster_1d_hitindex[ncluster][istrip] = hitlist[size_hitlist-1];
635 else if(flag==2 || flag==3) {
636 cluster_2d_ID[ncluster] = clusterid;
638 cluster_2d_t[ncluster] = 0;
639 cluster_2d_q[ncluster] = edep;
641 cluster_2d_layerid[ncluster] = layerid;
642 cluster_2d_sheetid[ncluster] = sheetid;
643 if(layerid==0 && phi>0) cluster_2d_sheetid[ncluster] = 1;
644 cluster_2d_view[ncluster] = flag;
645 cluster_2d_r[ncluster] = anode_mid_gap;
646 cluster_2d_z[ncluster] = z;
647 cluster_2d_z_cc[ncluster] = z_cc;
648 cluster_2d_z_tpc[ncluster] = z_tpc;
649 cluster_2d_phi[ncluster] = phi;
650 cluster_2d_phi_cc[ncluster] = phi_cc;
651 cluster_2d_phi_tpc[ncluster] = phi_tpc;
653 cluster_2d_idx[ncluster] = flagB;
654 cluster_2d_idv[ncluster] = flagE;
665 if(edep > tmp_charge_L1_S1) {
666 tmp_charge_L1_S1 = edep; tmp_cluster_L1_S1 = ncluster;
669 else if(layerid==1 && sheetid==0) {
670 if(edep > tmp_charge_L2_S1){
671 tmp_charge_L2_S1 = edep; tmp_cluster_L2_S1 = ncluster;
674 else if(layerid==1 && sheetid==1) {
675 if(edep > tmp_charge_L2_S2){
676 tmp_charge_L2_S2 = edep; tmp_cluster_L2_S2 = ncluster;
687 if(layerid == 0) ncluster_1d_L1_S1_x++;
688 else if(layerid == 1) {
689 if(sheetid == 0) ncluster_1d_L2_S1_x++;
690 else ncluster_1d_L2_S2_x++;
695 if(layerid == 0) ncluster_1d_L1_S1_v++;
696 else if(layerid == 1) {
697 if(sheetid == 0) ncluster_1d_L2_S1_v++;
698 else ncluster_1d_L2_S2_v++;
703 if(layerid == 0) ncluster_2d_L1_S1++;
704 else if(layerid == 1) {
705 if(sheetid == 0) ncluster_2d_L2_S1++;
706 else ncluster_2d_L2_S2++;
716 if(tmp_cluster_L1_S1!=-1) cluster_2d_highest[tmp_cluster_L1_S1]=1;
717 if(tmp_cluster_L2_S1!=-1) cluster_2d_highest[tmp_cluster_L2_S1]=1;
718 if(tmp_cluster_L2_S2!=-1) cluster_2d_highest[tmp_cluster_L2_S2]=1;
722 SmartDataPtr<RecMdcTrackCol> aTrackCol(m_evtSvc,
"/Event/Recon/RecMdcTrackCol");
729 RecMdcTrackCol::iterator iTrackCol;
730 for(iTrackCol=aTrackCol->begin(); iTrackCol!=aTrackCol->end(); iTrackCol++)
742 if(track->
trackId() != 0)
continue;
744 track_chi2 = track->
chi2();
746 track_dr = track->
helix(0);
747 track_phi0 = track->
helix(1);
748 track_dz = track->
helix(3);
749 track_tanL = track->
helix(4);
752 track_nfitpoint = vecclusters.size();
755 bool istestplane[2][2];
756 for(
int ilay=0; ilay<
MAXNOFLAYER; ilay++)
for(
int ishe=0; ishe<
MAXNOFSHEET; ishe++) istestplane[ilay][ishe] =
true;
758 for(
int iclus=0; iclus < track_nfitpoint; iclus++) {
761 double z = tcluster->
getRecZ();
764 track_layerid[iclus] = tcluster->
getlayerid();
765 track_sheetid[iclus] = tcluster->
getsheetid();
766 if(phi > 0) track_sheetid[iclus] = 1;
771 istestplane[track_layerid[iclus]][track_sheetid[iclus]] =
false;
779 if(istestplane[ilay][ishe] ==
true) {
780 track_test_layerid = ilay;
781 track_test_sheetid = ishe;
789 double xP;
double yP;
double zP;
790 ComputePOCA(xP, yP, zP);
793 double xP1;
double yP1;
double zP1;
double phiP1;
double vP1;
794 double xP2;
double yP2;
double zP2;
double phiP2;
double vP2;
796 double angCR_xy_L1, angCR_yz_L1;
798 bool gotit1 = ComputeIntersection(0, xP1, yP1, zP1, phiP1, vP1, xP2, yP2, zP2, phiP2, vP2, angCR_xy_L1, angCR_yz_L1);
800 ang_xy_L1 = angCR_xy_L1;
801 ang_yz_L1 = angCR_yz_L1;
804 double xP3;
double yP3;
double zP3;
double phiP3;
double vP3;
805 double xP4;
double yP4;
double zP4;
double phiP4;
double vP4;
807 double angCR_xy_L2, angCR_yz_L2;
809 bool gotit2 = ComputeIntersection(1, xP3, yP3, zP3, phiP3, vP3, xP4, yP4, zP4, phiP4, vP4, angCR_xy_L2, angCR_yz_L2);
811 ang_xy_L2 = angCR_xy_L2;
812 ang_yz_L2 = angCR_yz_L2;
814 if(gotit1==
false || gotit2==
false) cout <<
"TestTrack: error in intersection calculation. Intersection on L1 " << gotit1 <<
", on L2 " << gotit2 << endl;
818 track_xpoca_glo = xP; track_ypoca_glo = yP; track_zpoca_glo = zP;
821 track_x1top_glo = xP1; track_y1top_glo = yP1; track_z1top_glo = zP1; track_phi1top_loc = phiP1; track_v1top_loc = vP1;
822 track_x1bot_glo = xP2; track_y1bot_glo = yP2; track_z1bot_glo = zP2; track_phi1bot_loc = phiP2; track_v1bot_loc = vP2;
824 track_x2top_glo = xP3; track_y2top_glo = yP3; track_z2top_glo = zP3; track_phi2top_loc = phiP3; track_v2top_loc = vP3;
825 track_x2bot_glo = xP4; track_y2bot_glo = yP4; track_z2bot_glo = zP4; track_phi2bot_loc = phiP4; track_v2bot_loc = vP4;
834 return StatusCode::SUCCESS;