7 #include <boost/tuple/tuple.hpp>
17 , particle_embed_flags()
18 , vertex_embed_flags()
52 os <<
"---particlemap--------------------------" << endl;
55 os <<
"particle id " << iter->first << endl;
59 os <<
"---vtxmap-------------------------------" << endl;
62 os <<
"vtx id: " << vter->first << endl;
66 os <<
"---showermap-------------------------------" << endl;
69 os <<
"shower id: " << ster->first << endl;
73 os <<
"---list of embeded track flags-------------------" << endl;
78 os <<
"embeded track id: " << eter->first
79 <<
" flag: " << eter->second << endl;
82 os <<
"---list of embeded vtx flags-------------------" << endl;
87 os <<
"embeded vertex id: " << eter->first
88 <<
" flag: " << eter->second << endl;
91 os <<
"---primary vertex-------------------" << endl;
103 boost::tie(it, added) =
particlemap.insert(std::make_pair(key, newparticle));
104 if (added)
return it;
106 cerr <<
"PHG4TruthInfoContainer::AddParticle"
107 <<
" - Attempt to add particle with existing trackid "
108 << trackid <<
": " << newparticle->
get_name() <<
" id "
110 <<
", p = [" << newparticle->
get_px()
111 <<
", " << newparticle->
get_py()
112 <<
", " << newparticle->
get_pz() <<
"], "
128 if (trackid <= 0)
return nullptr;
138 if (it !=
vtxmap.end())
return it->second;
144 if (vtxid <= 0)
return nullptr;
146 if (it !=
vtxmap.end())
return it->second;
154 if (it !=
showermap.end())
return it->second;
160 if (showerid <= 0)
return nullptr;
162 if (it !=
showermap.end())
return it->second;
175 cout <<
"trying to add existing vtx " <<
id
176 <<
" vtx pos: " << endl;
181 boost::tie(it, added) =
vtxmap.insert(std::make_pair(key, newvtx));
188 cerr <<
"PHG4TruthInfoContainer::AddVertex"
189 <<
" - Attempt to add vertex with existing id " <<
id << std::endl;
202 cout <<
"trying to add existing shower " <<
id
203 <<
" shower pos: " << endl;
208 boost::tie(it, added) =
showermap.insert(std::make_pair(key, newshower));
215 cerr <<
"PHG4TruthInfoContainer::AddShower"
216 <<
" - Attempt to add shower with existing id " <<
id << std::endl;
224 if (key < 0) key = 0;
232 if (key > 0) key = 0;
240 if (key < 0) key = 0;
248 if (key > 0) key = 0;
256 if (key < 0) key = 0;
264 if (key > 0) key = 0;
270 delete piter->second;
284 delete viter->second;
298 delete siter->second;
340 int vtx_id_for_highest_embedding_ID = 0;
341 for (
auto iter = vrange.first; iter != vrange.second; ++iter)
347 if (embedding_ID >= highest_embedding_ID)
349 highest_embedding_ID = embedding_ID;
350 vtx_id_for_highest_embedding_ID = iter->first;
356 cout <<
"PHG4TruthInfoContainer::GetPrimaryVertexIndex - "
357 <<
"WARNING: no valid primary vertex. Return an invalid ID of 0"
362 return vtx_id_for_highest_embedding_ID;
365 bool operator==(
const PHG4TruthInfoContainer::Map::value_type& lhs,
const PHG4TruthInfoContainer::Map::value_type& rhs)
367 return *lhs.second == *rhs.second;
370 bool operator==(
const PHG4TruthInfoContainer::VtxMap::value_type& lhs,
const PHG4TruthInfoContainer::VtxMap::value_type& rhs)
372 return *lhs.second == *rhs.second;
375 bool operator==(
const PHG4TruthInfoContainer::ShowerMap::value_type& lhs,
const PHG4TruthInfoContainer::ShowerMap::value_type& rhs)
377 return *lhs.second == *rhs.second;