32 bool _fill_clusters,
bool _fill_SvUnMatched,
float _cluster_nzwidths,
float _cluster_nphiwidths,
const std::string& _outfile_name)
33 : m_cluster_comp{_cluster_nphiwidths, _cluster_nzwidths}
38 m_cluscntr.set_comparer(&m_cluster_comp);
41 h2_G4_nPixelsPhi =
new TH2D(
"G4_nPixelsPhi",
"PHG4 Emb Tracks; cluster pixel width Phi; layer",
42 100, -0.5, 99.5, 56, -0.5, 55.5);
43 h2_G4_nPixelsZ =
new TH2D(
"G4_nPixelsZ",
"PHG4 Emb Tracks; cluster pixel width Z; layer",
44 100, -0.5, 99.5, 56, -0.5, 55.5);
45 h2_Sv_nPixelsPhi =
new TH2D(
"Sv_nPixelsPhi",
"Svtx Reco Tracks; cluster pixel width Phi; layer",
46 100, -0.5, 99.5, 56, -0.5, 55.5);
47 h2_Sv_nPixelsZ =
new TH2D(
"Sv_nPixelsZ",
"Svtx Reco Tracks; cluster pixel width Z; layer",
48 100, -0.5, 99.5, 56, -0.5, 55.5);
50 m_ttree =
new TTree(
"T",
"Tracks (and sometimes clusters)");
52 m_ttree->Branch(
"event", &nevent);
53 m_ttree->Branch(
"nphg4_part", &nphg4_part);
54 m_ttree->Branch(
"centrality", ¢rality);
55 m_ttree->Branch(
"ntrackmatches", &ntrackmatches);
56 m_ttree->Branch(
"nphg4", &nphg4);
57 m_ttree->Branch(
"nsvtx", &nsvtx);
60 m_ttree->Branch(
"is_G4track", &b_is_g4track);
61 m_ttree->Branch(
"is_Svtrack", &b_is_Svtrack);
62 m_ttree->Branch(
"is_matched", &b_is_matched);
64 m_ttree->Branch(
"trkpt", &b_trkpt);
65 m_ttree->Branch(
"trketa", &b_trketa);
66 m_ttree->Branch(
"trkphi", &b_trkphi);
68 m_ttree->Branch(
"nclus", &b_nclus);
69 m_ttree->Branch(
"nclustpc", &b_nclustpc);
70 m_ttree->Branch(
"nclusmvtx", &b_nclusmvtx);
71 m_ttree->Branch(
"nclusintt", &b_nclusintt);
72 m_ttree->Branch(
"matchrat", &b_matchrat);
73 m_ttree->Branch(
"matchrat_intt", &b_matchrat_intt);
74 m_ttree->Branch(
"matchrat_mvtx", &b_matchrat_mvtx);
75 m_ttree->Branch(
"matchrat_tpc", &b_matchrat_tpc);
79 m_ttree->Branch(
"clus_match", &b_clusmatch);
80 m_ttree->Branch(
"clus_x", &b_clus_x);
81 m_ttree->Branch(
"clus_y", &b_clus_y);
82 m_ttree->Branch(
"clus_z", &b_clus_z);
83 m_ttree->Branch(
"clus_r", &b_clus_r);
84 m_ttree->Branch(
"clus_layer", &b_clus_layer);
85 m_ttree->Branch(
"nphibins", &b_clus_nphibins);
86 m_ttree->Branch(
"nzbins", &b_clus_ntbins);
98 std::cout <<
" Beginning FillTruthRecoMatchTree " << std::endl;
130 std::cout <<
PHWHERE <<
" DST node is missing, quitting" << std::endl;
131 std::cerr <<
PHWHERE <<
" DST node is missing, quitting" << std::endl;
132 throw std::runtime_error(
"Failed to find DST node in FillTruthRecoMatchTree::createNodes");
138 std::cout <<
PHWHERE <<
" Cannot find node TRKR_EMBRECOMATCHCONTAINER on node tree; quitting " << std::endl;
139 std::cerr <<
PHWHERE <<
" Cannot find node TRKR_EMBRECOMATCHCONTAINER on node tree; quitting " << std::endl;
140 throw std::runtime_error(
" Cannot find node TRKR_EMBRECOMATCHCONTAINER on node tree; quitting");
153 std::cout <<
"Could not locate G4TruthInfo node when running "
154 <<
"\"TruthRecoTrackMatching\" module." << std::endl;
158 m_SvtxTrackMap = findNode::getClass<SvtxTrackMap>(topNode,
"SvtxTrackMap");
161 std::cout <<
"Could not locate SvtxTrackMap node when running "
162 <<
"\"TruthRecoTrackMatching\" module." << std::endl;
184 "TRKR_TRUTHTRACKCONTAINER");
187 std::cout <<
"Could not locate TRKR_TRUTHTRACKCONTAINER node when running "
188 <<
"\"TruthRecoTrackMatching\" module." << std::endl;
199 cout <<
" FillTruthRecoMatchTree::process_event() " << endl;
214 for (
auto iter = range.first; iter != range.second; ++iter)
216 auto& cluster = iter->second;
226 for (
auto iter = range.first; iter != range.second; ++iter)
228 auto& cluster = iter->second;
237 iter != range.second; ++iter)
257 unsigned int g4_trkid = match->idTruthTrack();
258 int sv_trkid = match->idRecoTrack();
274 b_trketa = g4trk->getPseudoRapidity();
297 auto x = std::get<1>(
loc)[0];
298 auto y = std::get<1>(
loc)[1];
308 for (
auto&
loc : clusters)
312 auto x = std::get<1>(
loc)[0];
313 auto y = std::get<1>(
loc)[1];
353 auto x = std::get<1>(
loc)[0];
354 auto y = std::get<1>(
loc)[1];
366 for (
auto&
loc : clusters)
370 auto x = std::get<1>(
loc)[0];
371 auto y = std::get<1>(
loc)[1];
396 b_trketa = g4trk->getPseudoRapidity();
412 auto x = std::get<1>(
loc)[0];
413 auto y = std::get<1>(
loc)[1];
459 auto x = std::get<1>(
loc)[0];
460 auto y = std::get<1>(
loc)[1];
483 std::cout <<
"To do: "
484 <<
" (1) number of truth tracks and total number of mvtx and ratio " << std::endl
485 <<
" (2) ditto for reco tracks " << std::endl;
489 double n_in_PHG4_tracks{0.};
496 double n_in_PHG4_clusters{0.};
504 for (
auto r = range.first;
r != range.second; ++
r)
506 n_in_PHG4_clusters += 1.;
513 double n_in_SVTX_tracks{0.};
520 double n_in_SVTX_clusters{0.};
528 for (
auto r = range.first;
r != range.second; ++
r)
530 n_in_SVTX_clusters += 1.;
536 "\nPHG4: Tracks(%.0f) Clusters In tracks(%.0f) Total (%.0f)"
537 "\n ave. per track: %6.3f ratio in all tracks: %6.2f",
538 n_PHG4_tracks, n_in_PHG4_tracks, n_in_PHG4_clusters, (n_in_PHG4_tracks / n_PHG4_tracks), (n_in_PHG4_tracks / n_in_PHG4_clusters))
541 "\nSVTX: Tracks(%.0f) Clusters In tracks(%.0f) Total (%.0f)"
542 "\n ave. per track: %6.3f ratio in all tracks: %6.2f",
543 n_SVTX_tracks, n_in_SVTX_tracks, n_in_SVTX_clusters, (n_in_SVTX_tracks / n_SVTX_tracks), (n_in_SVTX_tracks / n_in_SVTX_clusters))
551 std::cout <<
PHWHERE <<
": ending FillTruthRecoMatchTree" << std::endl;
570 <<
" pear printing " << tag <<
" x(" <<
b_clus_x.size() <<
") ";