24 int iret = AddVtxCommon(newvtx);
40 int iret = AddVtxCommon(newvtx);
47 std::pair< std::map<int, PHG4VtxPoint *>::const_iterator, std::map<int, PHG4VtxPoint *>::const_iterator > vtxbegin_end = GetVertices();
48 for (map<int, PHG4VtxPoint *>::const_iterator viter = vtxbegin_end.first; viter != vtxbegin_end.second; ++viter)
53 const auto distepsilon = 0.0001;
54 const auto timeepsilon = 0.0001;
60 bool xcomp =
std::abs(newvtx->
get_x() - viter->second->get_x())
61 <= distepsilon * (*std::max_element(xlist.begin(), xlist.end()));
62 bool ycomp =
std::abs(newvtx->
get_y() - viter->second->get_y())
63 <= distepsilon * (*std::max_element(ylist.begin(), ylist.end()));
64 bool zcomp =
std::abs(newvtx->
get_z() - viter->second->get_z())
65 <= distepsilon * (*std::max_element(zlist.begin(), zlist.end()));
66 bool tcomp =
std::abs(newvtx->
get_t() - viter->second->get_t())
67 <= timeepsilon * (*std::max_element(tlist.begin(), tlist.end()));
69 if (*newvtx == *(viter->second) or
70 (xcomp and ycomp and zcomp and tcomp) )
84 if (vtxlist.find(vtxid) == vtxlist.end())
86 cout <<
"cannot add particle to non existing vertex, id: " << vtxid << endl;
102 particlelist.insert(pair<int,PHG4Particle *>(vtxid, particle) );
109 embedded_particlelist.clear();
110 while(vtxlist.begin() != vtxlist.end())
112 delete vtxlist.begin()->second;
113 vtxlist.erase(vtxlist.begin());
115 while(particlelist.begin() != particlelist.end())
117 delete particlelist.begin()->second;
118 particlelist.erase(particlelist.begin());
123 pair< map<int, PHG4VtxPoint *>::const_iterator, map<int, PHG4VtxPoint *>::const_iterator >
126 pair< map<int, PHG4VtxPoint *>::const_iterator, map<int, PHG4VtxPoint *>::const_iterator > retpair(vtxlist.begin(), vtxlist.end());
131 pair< multimap<int,PHG4Particle *>::const_iterator, multimap<int,PHG4Particle *>::const_iterator >
134 pair<multimap<int,PHG4Particle *>::const_iterator, multimap<int,PHG4Particle *>::const_iterator > retpair(particlelist.lower_bound(vtxid),particlelist.upper_bound(vtxid));
138 pair< multimap<int,PHG4Particle *>::const_iterator, multimap<int,PHG4Particle *>::const_iterator >
141 pair<multimap<int,PHG4Particle *>::const_iterator, multimap<int,PHG4Particle *>::const_iterator > retpair(particlelist.begin(),particlelist.end());
145 pair< multimap<int,PHG4Particle *>::iterator, multimap<int,PHG4Particle *>::iterator >
148 pair<multimap<int,PHG4Particle *>::iterator, multimap<int,PHG4Particle *>::iterator > retpair(particlelist.begin(),particlelist.end());
155 os <<
"vtx: " << endl;
156 multimap<int,PHG4Particle *>::const_iterator particle_iter;
157 for(map<int,PHG4VtxPoint *>::const_iterator iter = vtxlist.begin(); iter != vtxlist.end(); ++iter)
159 os <<
"vtx " << iter->first <<
" , ";
160 iter->second->identify(os);
161 pair<multimap<int, PHG4Particle *>::const_iterator, multimap<int, PHG4Particle *>::const_iterator > particlebegin_end = GetParticles(iter->first);
162 for(particle_iter = particlebegin_end.first; particle_iter != particlebegin_end.second; ++particle_iter)
164 os <<
"vtx " << particle_iter->first <<
", ";
165 particle_iter->second->identify(os);
168 if (!embedded_particlelist.empty())
170 os <<
"embedded particles:" << endl;
171 for (map<PHG4Particle *,int>::const_iterator iter = embedded_particlelist.begin(); iter != embedded_particlelist.end(); ++iter)
173 (iter->first)->identify(os);
178 os <<
"no embedded particles" << endl;
186 std::map<PHG4Particle*,int>::const_iterator iter = embedded_particlelist.find(p);
187 if (iter == embedded_particlelist.end()) {
198 particlelist.erase(iter);