42 #define LogDebug(exp) std::cout << "DEBUG: " << __FILE__ << ": " << __LINE__ << ": " << exp << std::endl
43 #define LogError(exp) std::cout << "ERROR: " << __FILE__ << ": " << __LINE__ << ": " << exp << std::endl
44 #define LogWarning(exp) std::cout << "WARNING: " << __FILE__ << ": " << __LINE__ << ": " << exp << std::endl
61 std::cout <<
"Enter PHSiliconTruthTrackSeeding:: Setup" << std::endl;
64 std::string track_map_node_name = {
"SvtxSiliconTrackMap"};
87 typedef std::map<int, std::set<TrkrCluster*> > TrkClustersMap;
88 TrkClustersMap m_trackID_clusters;
92 for (
auto hitsetitr = hitsetrange.first;
93 hitsetitr != hitsetrange.second;
96 for(
auto clusIter = range.first; clusIter != range.second; ++clusIter ){
105 std::cout <<
PHWHERE <<
" Warning: layer is screwed up - layer = " << layer << std::endl;
109 cout <<
PHWHERE <<
" process cluster ";
114 std::pair<std::multimap<TrkrDefs::cluskey, TrkrDefs::hitkey>::const_iterator, std::multimap<TrkrDefs::cluskey, TrkrDefs::hitkey>::const_iterator>
117 for (std::multimap<TrkrDefs::cluskey, TrkrDefs::hitkey>::const_iterator
118 clushititer = hitrange.first; clushititer != hitrange.second; ++clushititer)
126 cout <<
PHWHERE <<
" --- process hit with hitkey " << hitkey <<
" hitsetkey " << hitsetkey << std::endl;
130 std::multimap<TrkrDefs::hitsetkey, std::pair<TrkrDefs::hitkey, PHG4HitDefs::keytype> > temp_map;
132 for (std::multimap<
TrkrDefs::hitsetkey, std::pair<TrkrDefs::hitkey, PHG4HitDefs::keytype> >::iterator htiter = temp_map.begin(); htiter != temp_map.end(); ++htiter)
139 cout <<
PHWHERE <<
" --- process g4hit with key " << g4hitkey << std::endl;
156 std::cout<<
PHWHERE<<
" unable to find g4hit from key " << g4hitkey << std::endl;
168 cout <<
PHWHERE <<
" - validity check failed: missing truth particle with ID of "<<particle_id<<
". Exiting..."<<endl;
171 const double monentum2 =
181 cout <<
PHWHERE <<
" --- check momentum for g4particle "<<particle_id<<
" -> cluster "<<cluskey
182 <<
" = "<<sqrt(monentum2)<<endl;;
190 cout <<
PHWHERE <<
" ignore low momentum g4particle "<<particle_id<<
" -> cluster "<<cluskey<<endl;;
198 TrkClustersMap::iterator
it = m_trackID_clusters.find(particle_id);
200 if (it != m_trackID_clusters.end())
203 it->second.insert(cluster);
206 cout <<
PHWHERE <<
" --- appended to g4particle"<<particle_id<<
" new cluster "<<cluskey<<endl;;
212 std::set<TrkrCluster*> clusters;
213 clusters.insert(cluster);
214 m_trackID_clusters.insert(std::pair<
int, std::set<TrkrCluster*> >(particle_id, clusters));
219 cout <<
PHWHERE <<
" --- added new g4particle "<<particle_id<<
" and inserted cluster "<<cluskey<<endl;;
233 cout <<__PRETTY_FUNCTION__
240 for (TrkClustersMap::const_iterator trk_clusters_itr = m_trackID_clusters.begin();
241 trk_clusters_itr != m_trackID_clusters.end(); ++trk_clusters_itr)
248 for (
TrkrCluster* cluster : trk_clusters_itr->second)
252 layers.insert(layer);
256 cout <<__PRETTY_FUNCTION__<<
" particle "<<trk_clusters_itr->first<<
" -> "
257 <<trk_clusters_itr->second.size()<<
" clusters covering "<<layers.size()<<
" layers."
265 auto svtx_track = std::make_unique<SvtxTrack_FastSim_v2>();
267 svtx_track->set_truth_track_id(trk_clusters_itr->first);
277 for (
auto iter = vrange.first; iter != vrange.second; ++iter)
279 const int point_id = iter->first;
281 if(vert_embed == track_embed)
282 vertexId = point_id - 1;
284 std::cout <<
" track_embed " << track_embed <<
" vert_embed " << vert_embed <<
" G4 point id " << point_id <<
" SvtxMap vertexId " << vertexId << std::endl;
290 svtx_track->set_vertex_id(vertexId);
293 std::cout <<
" truth track G4 point id " << particle->
get_vtx_id() <<
" becomes SvtxMap id " << vertexId
294 <<
" gembed is " <<
_g4truth_container->
isEmbeded(trk_clusters_itr->first) <<
" for truth particle " << trk_clusters_itr->first << std::endl;
300 std::cout <<
PHWHERE <<
"Failed to get vertex with ID " << vertexId <<
" from _vertex_map, cannot proceed - skipping this silicon track" << std::endl;
303 svtx_track->set_x(svtxVertex->
get_x());
304 svtx_track->set_y(svtxVertex->
get_y());
305 svtx_track->set_z(svtxVertex->
get_z());
309 std::cout <<
" truth track SvtxMap vertexid is " << vertexId <<
" for truth particle " << trk_clusters_itr->first << std::endl;
310 std::cout <<
" track position x,y,z = " << svtxVertex->
get_x() <<
", " << svtxVertex->
get_y() <<
", " << svtxVertex->
get_z() << std::endl;
314 svtx_track->set_px(particle->
get_px());
315 svtx_track->set_py(particle->
get_py());
316 svtx_track->set_pz(particle->
get_pz());
319 std::cout <<
PHWHERE <<
"Truth track ID is " << svtx_track->get_truth_track_id() <<
" particle ID is " << particle->
get_pid() << std::endl;
322 for (
TrkrCluster* cluster : trk_clusters_itr->second)
324 svtx_track->insert_cluster_key(cluster->
getClusKey());
332 cout <<__PRETTY_FUNCTION__<<
" particle "<<trk_clusters_itr->first<<
" -> "
333 <<trk_clusters_itr->second.size()<<
" clusters"
342 cout <<
"Loop over SvtxSiliconTrackMap entries " << endl;
351 cout <<
"Track ID: " << svtx_track->
get_id() <<
", Track pT: "
352 << svtx_track->
get_pt() <<
", Truth Track/Particle ID: "
355 cout <<
" (px, py, pz) = " <<
"("<< svtx_track->
get_px() <<
", " << svtx_track->
get_py() <<
", " << svtx_track->
get_pz() <<
")" << endl;
356 cout <<
" (x, y, z) = " <<
"("<< svtx_track->
get_x() <<
", " << svtx_track->
get_y() <<
", " << svtx_track->
get_z() <<
")" << endl;
367 cout <<
" cluster ID: "
368 << cluster->
getClusKey() <<
", cluster radius: " << radius
393 _g4truth_container = findNode::getClass<PHG4TruthInfoContainer>(topNode,
"G4TruthInfo");
396 cerr <<
PHWHERE <<
" ERROR: Can't find node G4TruthInfo" << endl;
400 clusterhitassoc = findNode::getClass<TrkrClusterHitAssoc>(topNode,
"TRKR_CLUSTERHITASSOC");
403 cout <<
PHWHERE <<
"Failed to find TRKR_CLUSTERHITASSOC node, quit!" << endl;
407 hittruthassoc = findNode::getClass<TrkrHitTruthAssoc>(topNode,
"TRKR_HITTRUTHASSOC");
410 cout <<
PHWHERE <<
"Failed to find TRKR_HITTRUTHASSOC node, quit!" << endl;
414 using nodePair = std::pair<std::string, PHG4HitContainer*&>;
415 std::initializer_list<nodePair> nodes =
423 for(
auto&& node: nodes )
425 if( !( node.second = findNode::getClass<PHG4HitContainer>( topNode, node.first ) ) )
426 { std::cerr <<
PHWHERE <<
" PHG4HitContainer " << node.first <<
" not found" << std::endl; }