305 MsgStream log(
msgSvc(), name());
306 if(event%1000==0) cout <<
"->TestClusterWithHit::execute " <<
event << endl;
309 ISvcLocator* svcLocator = Gaudi::svcLocator();
310 StatusCode sc=svcLocator->service(
"EventDataSvc", m_evtSvc);
312 cout<<
"Could not accesss EventDataSvc!"<<endl;
319 SmartDataPtr<CgemDigiCol> aDigiCol(m_evtSvc,
"/Event/Digi/CgemDigiCol");
321 cout<<
"Could not retrieve CGEM digi collection"<<endl;
322 nhit = aDigiCol->size();
327 CgemDigiCol::iterator iDigiCol;
328 for(iDigiCol=aDigiCol->begin(); iDigiCol!=aDigiCol->end(); iDigiCol++)
330 const Identifier ident = (*iDigiCol)->identify();
336 if(is_xstrip ==
true) view = 0;
337 double charge = (*iDigiCol)->getCharge_fc();
338 double time = (*iDigiCol)->getTime_ns();
340 hit_strip[ihit] = strip;
341 hit_layer[ihit] = layer;
342 hit_sheet[ihit] = sheet;
343 hit_view[ihit] = view;
345 if(selDigi(iDigiCol, m_selGoodDigi)==
true) {
349 std::map<int, std::vector < int > > *map_strip_to_hit = GetStripToHitMap(layer, sheet, view);
350 std::map<int, std::vector < int > >::iterator it1 = map_strip_to_hit->find(strip);
351 if (it1 != map_strip_to_hit->end()) {
352 it1->second.push_back(ihit);
355 std::vector< int > hitlist;
356 hitlist.push_back(ihit);
357 std::pair<int, std::vector < int> > pair(strip, hitlist);
358 map_strip_to_hit->insert(pair);
378 SmartDataPtr<RecCgemClusterCol> aClusterCol(m_evtSvc,
"/Event/Recon/RecCgemClusterCol");
380 cout<<
"Could not retrieve CGEM cluster collection"<<endl;
382 int nclu = aClusterCol->size();
384 std::cout <<
"nclu " << nclu << std::endl;
393 anode_radius_L1_x = anode->
getRX();
394 anode_radius_L1_v = anode->
getRV();
397 anode_radius_L2_x = anode->
getRX();
398 anode_radius_L2_v = anode->
getRV();
401 int tmp_cluster_L1_S1 = -1;
402 int tmp_cluster_L2_S1 = -1;
403 int tmp_cluster_L2_S2 = -1;
404 double tmp_charge_L1_S1 = 0.;
405 double tmp_charge_L2_S1 = 0.;
406 double tmp_charge_L2_S2 = 0.;
409 RecCgemClusterCol::iterator iClusterCol;
410 for(iClusterCol=aClusterCol->begin(); iClusterCol!=aClusterCol->end(); iClusterCol++)
415 int flag = (*iClusterCol)->getflag();
416 int clusterid = (*iClusterCol)->getclusterid();
417 int trkid = (*iClusterCol)->getTrkId();
418 int layerid = (*iClusterCol)->getlayerid();
419 int sheetid = (*iClusterCol)->getsheetid();
420 double edep = (*iClusterCol)->getenergydeposit();
421 double phi = (*iClusterCol)->getrecphi();
422 double v = (*iClusterCol)->getrecv();
423 double z = (*iClusterCol)->getRecZ();
424 double phi_cc = (*iClusterCol)->getrecphi_CC();
425 double v_cc = (*iClusterCol)->getrecv_CC();
426 double z_cc = (*iClusterCol)->getRecZ_CC();
427 double phi_tpc = (*iClusterCol)->getrecphi_mTPC();
428 double v_tpc = (*iClusterCol)->getrecv_mTPC();
429 double z_tpc = (*iClusterCol)->getRecZ_mTPC();
445 int flagB = (*iClusterCol)->getclusterflagb();
446 int flagE = (*iClusterCol)->getclusterflage();
450 if(flag==0 || flag == 1) {
451 cluster_1d_ID[ncluster] = clusterid;
453 cluster_1d_t[ncluster] = 0;
454 cluster_1d_q[ncluster] = edep;
456 cluster_1d_layerid[ncluster] = layerid;
457 cluster_1d_sheetid[ncluster] = sheetid;
458 cluster_1d_view[ncluster] = flag;
459 cluster_1d_r[ncluster] = anode_mid_gap;
460 cluster_1d_phi[ncluster] = phi;
461 cluster_1d_phi_cc[ncluster] = phi_cc;
462 cluster_1d_phi_tpc[ncluster] = phi_tpc;
463 cluster_1d_v[ncluster] =
v;
464 cluster_1d_v_cc[ncluster] = v_cc;
465 cluster_1d_v_tpc[ncluster] = v_tpc;
466 cluster_1d_a_tpc[ncluster] = a_tpc;
467 cluster_1d_b_tpc[ncluster] = b_tpc;
469 cluster_1d_strip1[ncluster] = flagB;
470 cluster_1d_strip2[ncluster] = flagE;
471 int size = flagE - flagB + 1;
472 cluster_1d_size[ncluster] = size;
476 std::map<int, std::vector < int > > *read_map_strip_to_hit = GetStripToHitMap(layerid, sheetid, flag);
477 std::map<int, std::vector < int > >::iterator it2;
487 for(
int istrip = 0; istrip < size; istrip++) {
488 int stripid = flagB + istrip;
489 it2 = read_map_strip_to_hit->find(stripid);
490 std::vector< int > hitlist = it2->second;
491 int size_hitlist = hitlist.size();
493 cluster_1d_hitindex[ncluster][istrip] = hitlist[size_hitlist-1];
500 else if(flag==2 || flag==3) {
501 cluster_2d_ID[ncluster] = clusterid;
503 cluster_2d_t[ncluster] = 0;
504 cluster_2d_q[ncluster] = edep;
506 cluster_2d_layerid[ncluster] = layerid;
507 cluster_2d_sheetid[ncluster] = sheetid;
508 cluster_2d_view[ncluster] = flag;
509 cluster_2d_r[ncluster] = anode_mid_gap;
510 cluster_2d_z[ncluster] = z;
511 cluster_2d_z_cc[ncluster] = z_cc;
512 cluster_2d_z_tpc[ncluster] = z_tpc;
513 cluster_2d_phi[ncluster] = phi;
514 cluster_2d_phi_cc[ncluster] = phi_cc;
515 cluster_2d_phi_tpc[ncluster] = phi_tpc;
517 cluster_2d_idx[ncluster] = flagB;
518 cluster_2d_idv[ncluster] = flagE;
529 if(edep > tmp_charge_L1_S1) {
530 tmp_charge_L1_S1 = edep; tmp_cluster_L1_S1 = ncluster;
533 else if(layerid==1 && sheetid==0) {
534 if(edep > tmp_charge_L2_S1){
535 tmp_charge_L2_S1 = edep; tmp_cluster_L2_S1 = ncluster;
538 else if(layerid==1 && sheetid==1) {
539 if(edep > tmp_charge_L2_S2){
540 tmp_charge_L2_S2 = edep; tmp_cluster_L2_S2 = ncluster;
552 if(layerid == 0) ncluster_1d_L1_S1_x++;
553 else if(layerid == 1) {
554 if(sheetid == 0) ncluster_1d_L2_S1_x++;
555 else ncluster_1d_L2_S2_x++;
560 if(layerid == 0) ncluster_1d_L1_S1_v++;
561 else if(layerid == 1) {
562 if(sheetid == 0) ncluster_1d_L2_S1_v++;
563 else ncluster_1d_L2_S2_v++;
568 if(layerid == 0) ncluster_2d_L1_S1++;
569 else if(layerid == 1) {
570 if(sheetid == 0) ncluster_2d_L2_S1++;
571 else ncluster_2d_L2_S2++;
581 if(tmp_cluster_L1_S1!=-1) cluster_2d_highest[tmp_cluster_L1_S1]=1;
582 if(tmp_cluster_L2_S1!=-1) cluster_2d_highest[tmp_cluster_L2_S1]=1;
583 if(tmp_cluster_L2_S2!=-1) cluster_2d_highest[tmp_cluster_L2_S2]=1;
599 return StatusCode::SUCCESS;