1 #ifndef SimGeneral_MixingModule_DecayGraph_h 2 #define SimGeneral_MixingModule_DecayGraph_h 10 #pragma GCC diagnostic push 11 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" 15 #include <boost/graph/adjacency_list.hpp> 16 #include <boost/graph/breadth_first_search.hpp> 17 #include <boost/graph/depth_first_search.hpp> 18 #include <boost/graph/graphviz.hpp> 20 using boost::add_edge;
21 using boost::adjacency_list;
22 using boost::directedS;
24 using boost::edge_weight;
25 using boost::edge_weight_t;
27 using boost::property;
30 using boost::vertex_name;
31 using boost::vertex_name_t;
77 using DecayChain = adjacency_list<listS, vecS, directedS, VertexMotherParticleProperty, EdgeParticleClustersProperty>;
82 template <
typename Edge,
typename Graph,
typename Visitor>
83 void accumulateSimHits_edge(Edge &
e,
const Graph &
g, Visitor *
v) {
84 auto const edge_property =
get(edge_weight,
g,
e);
85 v->total_simHits += edge_property.simHits;
87 <<
" Examining edges " <<
e <<
" --> particle " << edge_property.simTrack->type() <<
"(" 88 << edge_property.simTrack->trackId() <<
")" 89 <<
" with SimClusters: " << edge_property.simHits <<
" Accumulated SimClusters: " <<
v->total_simHits
92 template <
typename Vertex,
typename Graph>
94 auto const vertex_property =
get(vertex_name,
g, u);
97 if (vertex_property.simTrack)
98 IfLogDebug(
DEBUG, messageCategoryGraph_) <<
" [" << vertex_property.simTrack->type() <<
"]" 99 <<
"(" << vertex_property.simTrack->trackId() <<
")";
106 std::ostringstream oss;
107 oss <<
"{id: " << (
v.simTrack ?
v.simTrack->trackId() : 0) <<
",\\ntype: " << (
v.simTrack ?
v.simTrack->type() : 0)
108 <<
",\\nchits: " <<
v.cumulative_simHits <<
"}";
113 std::ostringstream oss;
114 oss <<
"[" << (
e.simTrack ?
e.simTrack->trackId() : 0) <<
"," << (
e.simTrack ?
e.simTrack->type() : 0) <<
"," 115 <<
e.simHits <<
"," <<
e.cumulative_simHits <<
"]";
120 class SimHitsAccumulator_dfs_visitor :
public boost::default_dfs_visitor {
122 int total_simHits = 0;
123 template <
typename Edge,
typename Graph>
124 void examine_edge(Edge
e,
const Graph &
g) {
125 accumulateSimHits_edge(
e,
g,
this);
127 template <
typename Edge,
typename Graph>
128 void finish_edge(Edge
e,
const Graph &
g) {
129 auto const edge_property =
get(edge_weight,
g,
e);
132 auto cumulative = edge_property.simHits +
get(vertex_name,
g, trg).cumulative_simHits +
133 (
get(vertex_name,
g,
src).simTrack ?
get(vertex_name,
g,
src).cumulative_simHits
136 auto const src_vertex_property =
get(vertex_name,
g,
src);
138 put(
get(edge_weight, const_cast<Graph &>(
g)),
142 <<
" Finished edge: " <<
e <<
" Track id: " <<
get(edge_weight,
g,
e).
simTrack->trackId()
143 <<
" has accumulated " <<
cumulative <<
" hits" << std::endl;
145 <<
"\t" <<
get(vertex_name,
g,
src).cumulative_simHits << std::endl;
147 <<
"\t" <<
get(vertex_name,
g, trg).cumulative_simHits << std::endl;
151 using Selector = std::function<bool(EdgeProperty &)>;
property< vertex_name_t, VertexProperty > VertexMotherParticleProperty
EdgeProperty(const SimTrack *t, int h, int c)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
const SimTrack * simTrack
void put(edm::Event &evt, double value, const char *instanceName)
const SimTrack * simTrack
#define IfLogDebug(cond, cat)
adjacency_list< listS, vecS, directedS, VertexMotherParticleProperty, EdgeParticleClustersProperty > DecayChain
Functor that operates on <T>
VertexProperty(const VertexProperty &other)
VertexProperty(const SimTrack *t, int c)
property< edge_weight_t, EdgeProperty > EdgeParticleClustersProperty
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
static std::string const source