6#ifndef TRUTHUTILS_LOOPS_H
7#define TRUTHUTILS_LOOPS_H
13template <
class Evt,
class Prt,
class Vtx>
51 if (evt ==
m_evt && !force)
return 0;
61 std::map<Prt, int> incycle;
64 for (
const auto & p: *
m_evt){
65 if (!p->end_vertex()||!p->production_vertex()){
73 size_t minincycle =
m_evt->particles_size();
77 for (
const auto & p: *
m_evt) {
80 if (incycle[p] != 0)
continue;
85 auto ev = p->end_vertex();
90 for (
auto& po: *
ev) goodo = goodo && (incycle[po] == -1);
91 if (goodo) incycle[p] = -1;
95 auto pv = p->production_vertex();
100 for (
auto&
pi:
ev->particles_in()) goodi = goodi && (incycle[
pi] == -1);
101 if (goodi) incycle[p] = -1;
105 if (minincycle == unknown)
break;
107 minincycle = std::min(minincycle, unknown);
112 for (
const auto & p: *
m_evt){
113 if (incycle[p] == 0) incycle[p] = 1;
118 for (
auto & v:
m_evt->vertices()) {
122 for (
auto& pin: v->particles_in()){
123 if (incycle[pin] == 1) {
132 for (
const auto& pou: *v) {
133 if (incycle[pou] == 1) {
bool isLoop(const Prt &p) const
Is this particle in a loop?
const Evt * m_evt
Local pointer to the event passed in the constructor or most recent call to findLoops.
Loops(const Evt *evt)
Constructor passing the event; immediately index the event that is passed.
Loops()
Default constructor.
bool isLoop(const Vtx &v) const
Is this vertex in a loop?
const std::vector< Vtx > & loop_vertices() const
Accessor: return the full list of vertices in loops.
std::vector< Vtx > m_loop_vertices
List of all vertices in m_evt that are in loops.
int findLoops(const Evt *evt, bool force)
Function that does the work to identify loops Pass the event of interest.
const std::vector< Prt > & loop_particles() const
Accessor: return the full list of particles in loops.
std::vector< Prt > m_loop_particles
List of all particles in m_evt that are in loops.
A namespace for all vertexing packages and related stuff.