78 for (
unsigned int k = 0;
k < 2; ++
k)
91 for (
unsigned int k = 0;
k < 2; ++
k)
151 bool block_changed =
false;
156 block_changed =
true;
187 if (block_changed ==
true)
198 block_changed =
true;
235 virtual void append_list(std::vector<TrivialTrack*>& track_list,
float PX_LO,
float PX_HI,
float PY_LO,
float PY_HI,
float PZ_LO,
float PZ_HI)
241 for (
unsigned int k = 0;
k < 2; ++
k)
253 j[
k]->append_list(track_list, PX_LO, PX_HI, PY_LO, PY_HI, PZ_LO, PZ_HI);
295 void append_list(std::vector<TrivialTrack*>& track_list,
float PX_LO,
float PX_HI,
float PY_LO,
float PY_HI,
float PZ_LO,
float PZ_HI)
override
297 for (
auto& track :
tracks)
299 if ((track.px < PX_LO) || (track.px > PX_HI) || (track.py < PY_LO) || (track.py > PY_HI) || (track.pz < PZ_LO) || (track.pz > PZ_HI))
303 track_list.push_back(&track);
334 if (
containers[x_ind][y_ind][z_ind] ==
nullptr)
337 float px_hi_new = px_lo_new + 0.5 * (
px_hi -
px_lo);
340 float py_hi_new = py_lo_new + 0.5 * (
py_hi -
py_lo);
343 float pz_hi_new = pz_lo_new + 0.5 * (
pz_hi -
pz_lo);
360 , pt_search_scale(pt_s)
361 , pz_search_scale(pz_s)
364 , n_inner_layers(n_i)
365 , n_required_layers(n_r)
366 , inner_z_length(i_z)
367 , outer_z_length(o_z)
393 ntp_true =
new TNtuple(
"ntp_true",
"true simulated tracks",
"event:px:py:pz:dcax:dcay:dcaz:r_px:r_py:r_pz:r_dcax:r_dcay:r_dcaz:quality");
394 ntp_reco =
new TNtuple(
"ntp_reco",
"reconstructed tracks",
"event:px:py:pz:dcax:dcay:dcaz:t_px:t_py:t_pz:t_dcax:t_dcay:t_dcaz:quality");
404 PHG4HitContainer* g4hits = findNode::getClass<PHG4HitContainer>(topNode,
"G4HIT_SVTX");
405 if (g4hits ==
nullptr)
407 std::cout <<
"can't find PHG4HitContainer" << std::endl;
413 std::map<int, std::pair<unsigned int, unsigned int> > trkids;
425 if (std::fabs(hit->
get_z(0)) > length)
431 if (trkids.find(trk_id) == trkids.end())
433 trkids[trk_id].first = 0;
434 trkids[trk_id].second = 0;
438 trkids[trk_id].first = (trkids[trk_id].first | (1 << (hit->
get_layer())));
442 trkids[trk_id].second = (trkids[trk_id].second | (1 << (hit->
get_layer() - 32)));
446 std::cout <<
PHWHERE <<
"hit layer out of bounds (0-63) " << hit->
get_layer() << std::endl;
457 SvtxTrackMap* trackmap = findNode::getClass<SvtxTrackMap>(topNode,
"SvtxTrackMap");
460 float gvx = gvertex->
get_x();
461 float gvy = gvertex->get_y();
462 float gvz = gvertex->get_z();
468 for (
auto& iter : primarymap)
478 if (((track.px * track.px) + (track.py * track.py)) < (0.1 * 0.1))
483 if (trkids.find(particle->
get_track_id()) == trkids.end())
495 true_sorted.
insert(track);
499 for (
auto& iter : *trackmap)
504 reco_sorted.
insert(ttrack);
508 std::vector<TrivialTrack*> pointer_list;
509 while (t_track !=
nullptr)
511 pointer_list.clear();
513 float pt = std::sqrt((t_track->
px * t_track->
px) + (t_track->
py * t_track->
py));
515 float px_lo = t_track->
px - pt_diff;
516 float px_hi = t_track->
px + pt_diff;
517 float py_lo = t_track->
py - pt_diff;
518 float py_hi = t_track->
py + pt_diff;
520 float pz_lo = t_track->
pz - pz_diff;
521 float pz_hi = t_track->
pz + pz_diff;
523 reco_sorted.
append_list(pointer_list, px_lo, px_hi, py_lo, py_hi, pz_lo, pz_hi);
525 if (pointer_list.size() > 0)
527 float mom_true = std::sqrt(pt * pt + (t_track->
pz) * (t_track->
pz));
529 float mom_reco = std::sqrt((pointer_list[0]->px) * (pointer_list[0]->px) + (pointer_list[0]->py) * (pointer_list[0]->py) + (pointer_list[0]->pz) * (pointer_list[0]->pz));
530 float best_mom = mom_reco;
531 for (
unsigned int i = 1;
i < pointer_list.size(); ++
i)
533 mom_reco = std::sqrt((pointer_list[
i]->px) * (pointer_list[
i]->px) + (pointer_list[
i]->py) * (pointer_list[
i]->py) + (pointer_list[
i]->pz) * (pointer_list[
i]->pz));
534 if (std::fabs(mom_true - mom_reco) < std::fabs(mom_true - best_mom))
541 float ntp_data[14] = {(float)
event_counter, t_track->
px, t_track->
py, t_track->
pz, t_track->
dcax, t_track->
dcay, t_track->
dcaz, pointer_list[best_ind]->px, pointer_list[best_ind]->py, pointer_list[best_ind]->pz, pointer_list[best_ind]->dcax, pointer_list[best_ind]->dcay, pointer_list[best_ind]->dcaz, pointer_list[best_ind]->quality};
546 float ntp_data[14] = {(float)
event_counter, t_track->
px, t_track->
py, t_track->
pz, t_track->
dcax, t_track->
dcay, t_track->
dcaz, -9999., -9999., -9999., -9999., -9999., -9999., -9999.};
550 t_track = true_sorted.
next();
554 while (r_track !=
nullptr)
556 pointer_list.clear();
558 float pt = std::sqrt((r_track->
px * r_track->
px) + (r_track->
py * r_track->
py));
560 float px_lo = r_track->
px - pt_diff;
561 float px_hi = r_track->
px + pt_diff;
562 float py_lo = r_track->
py - pt_diff;
563 float py_hi = r_track->
py + pt_diff;
565 float pz_lo = r_track->
pz - pz_diff;
566 float pz_hi = r_track->
pz + pz_diff;
568 true_sorted.
append_list(pointer_list, px_lo, px_hi, py_lo, py_hi, pz_lo, pz_hi);
570 if (pointer_list.size() > 0)
572 float mom_reco = std::sqrt(pt * pt + (r_track->
pz) * (r_track->
pz));
574 float mom_true = std::sqrt((pointer_list[0]->px) * (pointer_list[0]->px) + (pointer_list[0]->py) * (pointer_list[0]->py) + (pointer_list[0]->pz) * (pointer_list[0]->pz));
575 float best_mom = mom_true;
576 for (
unsigned int i = 1;
i < pointer_list.size(); ++
i)
578 mom_true = std::sqrt((pointer_list[
i]->px) * (pointer_list[
i]->px) + (pointer_list[
i]->py) * (pointer_list[
i]->py) + (pointer_list[
i]->pz) * (pointer_list[
i]->pz));
579 if (std::fabs(mom_reco - mom_true) < std::fabs(mom_reco - best_mom))
586 float ntp_data[14] = {(float)
event_counter, r_track->
px, r_track->
py, r_track->
pz, r_track->
dcax, r_track->
dcay, r_track->
dcaz, pointer_list[best_ind]->px, pointer_list[best_ind]->py, pointer_list[best_ind]->pz, pointer_list[best_ind]->dcax, pointer_list[best_ind]->dcay, pointer_list[best_ind]->dcaz, r_track->
quality};
591 float ntp_data[14] = {(float)
event_counter, r_track->
px, r_track->
py, r_track->
pz, r_track->
dcax, r_track->
dcay, r_track->
dcaz, -9999., -9999., -9999., -9999., -9999., -9999., r_track->
quality};
595 r_track = reco_sorted.
next();