54 std::cout << __PRETTY_FUNCTION__ <<
" Fatal Error : missing " <<
m_trackMapName << std::endl;
61 std::cout << __PRETTY_FUNCTION__ <<
" Fatal Error : missing " <<
m_vertexMapName << std::endl;
65 m_truthInfo = findNode::getClass<PHG4TruthInfoContainer>(topNode,
"G4TruthInfo");
68 std::cout << __PRETTY_FUNCTION__ <<
" Fatal Error : missing G4TruthInfo" << std::endl;
83 "Normalization;Items;Count", 10, .5, 10.5);
85 h->GetXaxis()->SetBinLabel(i++,
"Event");
86 h->GetXaxis()->SetBinLabel(i++,
"Vertex");
87 h->GetXaxis()->SetBinLabel(i++,
"MVTXTrackOnVertex");
88 h->GetXaxis()->LabelsOption(
"v");
93 "Vertex Resolution at gvz (x);gvz [cm];<vx> - <gvx> [cm]", 100, -10., 10., 500, -0.005, 0.005);
97 "Vertex Resolution at gvz (y);gvz [cm];<vy> - <gvy> [cm]", 100, -10., 10., 500, -0.005, 0.005);
101 "Vertex Resolution at gvz (z);gvz [cm];<vz> - <gvz> [cm]", 100, -10., 10., 500, -0.005, 0.005);
107 "ntracks Distribution;Number of Tracks;Count", 200, 0.5, 200.5);
112 "ntracks Distribution (#geq 2 MVTX);Number of Tracks;Count", 200, 0.5, 200.5);
117 "gntracks Distribution;Number of gTracks;Count", 200, 0.5, 200.5);
122 "gntracksmaps Distribution;Number of gTracksMaps;Count", 200, 0.5, 200.5);
127 "gvz Distribution;gvz Position [cm]", 300, -15., 15.);
132 "SvtxVertex Count per Event;Number of SvtxVertex", 50, -0.5, 49.5);
146 std::cout <<
"QAG4SimulationVertex::process_event() entered" << std::endl;
155 TH1D *h_norm =
dynamic_cast<TH1D *
>(hm->
getHisto(
158 h_norm->Fill(
"Event", 1);
186 assert(h_ntracks_cuts);
194 assert(h_gntracksmaps);
202 assert(h_recoSvtxVertex);
204 int n_recoSvtxVertex = 0;
208 std::map<int, unsigned int> embedvtxid_particle_count;
209 std::map<int, unsigned int> embedvtxid_maps_particle_count;
210 std::map<int, unsigned int> vertex_particle_count;
211 for (
auto iter = prange.first; iter != prange.second; ++iter)
213 const int point_id = iter->second->get_vtx_id();
215 ++vertex_particle_count[point_id];
216 ++embedvtxid_particle_count[gembed];
219 if (
false && gembed <= 0)
continue;
221 std::set<TrkrDefs::cluskey> g4clusters = clustereval->
all_clusters_from(g4particle);
223 unsigned int nglmaps = 0;
252 float gpx = g4particle->
get_px();
253 float gpy = g4particle->
get_py();
254 float gpz = g4particle->
get_pz();
258 if (gpx != 0 && gpy != 0)
260 TVector3 gv(gpx, gpy, gpz);
265 if (nglmaps == 3 && fabs(geta) < 1.0 && gpt > 0.5)
266 ++embedvtxid_maps_particle_count[gembed];
270 std::map<int, bool> embedvtxid_found;
271 std::map<int, int> embedvtxid_vertex_id;
272 std::map<int, PHG4VtxPoint *> embedvtxid_vertex;
273 for (
auto iter = vrange.first; iter != vrange.second; ++iter)
275 const int point_id = iter->first;
277 if (gembed <= 0)
continue;
279 auto search = embedvtxid_found.find(gembed);
280 if (search != embedvtxid_found.end())
282 embedvtxid_vertex_id[gembed] = point_id;
283 embedvtxid_vertex[gembed] = iter->second;
287 if (vertex_particle_count[embedvtxid_vertex_id[gembed]] < vertex_particle_count[point_id])
289 embedvtxid_vertex_id[gembed] = point_id;
290 embedvtxid_vertex[gembed] = iter->second;
293 embedvtxid_found[gembed] =
false;
296 unsigned int ngembed = 0;
297 for (std::map<int, bool>::iterator iter = embedvtxid_found.begin();
298 iter != embedvtxid_found.end();
301 if (iter->first >= 0 || iter->first != iter->first)
continue;
313 float vx = vertex->
get_x();
314 float vy = vertex->
get_y();
315 float vz = vertex->
get_z();
323 float gntracksmaps = NAN;
325 h_ntracks->Fill(ntracks);
327 int ntracks_with_cuts = 0;
348 const auto &cluster_key = *cluster_iter;
360 std::cout <<
"QAG4SimulationTracking::process_event - unkown tracker ID = " << trackerID <<
" from cluster " << cluster_key << std::endl;
368 h_ntracks_cuts->Fill(ntracks_with_cuts);
372 const int point_id = point->
get_id();
373 gvx = point->
get_x();
374 gvy = point->
get_y();
375 gvz = point->
get_z();
376 gvt = point->
get_t();
381 gntracks = embedvtxid_particle_count[(
int) gembed];
383 h_gntracks->Fill(gntracks);
385 if (embedvtxid_maps_particle_count[(
int) gembed] > 0 && fabs(gvt) < 2000. && fabs(gvz) < 13.0)
386 gntracksmaps = embedvtxid_maps_particle_count[(
int) gembed];
388 h_gntracksmaps->Fill(gntracksmaps);
389 h_norm->Fill(
"MVTXTrackOnVertex", gntracksmaps);
391 float vx_res = vx - gvx;
392 float vy_res = vy - gvy;
393 float vz_res = vz - gvz;
395 h_vxRes_gvz->Fill(gvz, vx_res);
396 h_vyRes_gvz->Fill(gvz, vy_res);
397 h_vzRes_gvz->Fill(gvz, vz_res);
399 h_recoSvtxVertex->Fill(n_recoSvtxVertex);
400 h_norm->Fill(
"Vertex", n_recoSvtxVertex);
407 m_truthContainer = findNode::getClass<PHG4TruthInfoContainer>(topNode,
"G4TruthInfo");
410 std::cout <<
"QAG4SimulationTracking::load_nodes - Fatal Error - "
411 <<
"unable to find DST node "
412 <<
"G4TruthInfo" << std::endl;