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;
75 using DecayChain = adjacency_list<listS, vecS, directedS, VertexMotherParticleProperty, EdgeParticleClustersProperty>;
80 template <
typename Edge,
typename Graph,
typename Visitor>
81 void accumulateSimHits_edge(Edge &
e,
const Graph &
g, Visitor *
v) {
82 auto const edge_property =
get(edge_weight,
g,
e);
83 v->total_simHits += edge_property.simHits;
85 <<
" Examining edges " <<
e <<
" --> particle " << edge_property.simTrack->type() <<
"(" 86 << edge_property.simTrack->trackId() <<
")" 87 <<
" with SimClusters: " << edge_property.simHits <<
" Accumulated SimClusters: " <<
v->total_simHits
90 template <
typename Vertex,
typename Graph>
92 auto const vertex_property =
get(vertex_name,
g, u);
95 if (vertex_property.simTrack)
96 IfLogDebug(
DEBUG, messageCategoryGraph_) <<
" [" << vertex_property.simTrack->type() <<
"]" 97 <<
"(" << vertex_property.simTrack->trackId() <<
")";
104 std::ostringstream oss;
105 oss <<
"{id: " << (
v.simTrack ?
v.simTrack->trackId() : 0) <<
",\\ntype: " << (
v.simTrack ?
v.simTrack->type() : 0)
106 <<
",\\nchits: " <<
v.cumulative_simHits <<
"}";
111 std::ostringstream oss;
112 oss <<
"[" << (
e.simTrack ?
e.simTrack->trackId() : 0) <<
"," << (
e.simTrack ?
e.simTrack->type() : 0) <<
"," 113 <<
e.simHits <<
"," <<
e.cumulative_simHits <<
"]";
118 class SimHitsAccumulator_dfs_visitor :
public boost::default_dfs_visitor {
120 int total_simHits = 0;
121 template <
typename Edge,
typename Graph>
122 void examine_edge(Edge
e,
const Graph &
g) {
123 accumulateSimHits_edge(
e,
g,
this);
125 template <
typename Edge,
typename Graph>
126 void finish_edge(Edge
e,
const Graph &
g) {
127 auto const edge_property =
get(edge_weight,
g,
e);
130 auto cumulative = edge_property.simHits +
get(vertex_name,
g, trg).cumulative_simHits +
131 (
get(vertex_name,
g,
src).simTrack ?
get(vertex_name,
g,
src).cumulative_simHits
134 auto const src_vertex_property =
get(vertex_name,
g,
src);
136 put(
get(edge_weight, const_cast<Graph &>(
g)),
140 <<
" Finished edge: " <<
e <<
" Track id: " <<
get(edge_weight,
g,
e).
simTrack->trackId()
141 <<
" has accumulated " <<
cumulative <<
" hits" << std::endl;
143 <<
"\t" <<
get(vertex_name,
g,
src).cumulative_simHits << std::endl;
145 <<
"\t" <<
get(vertex_name,
g, trg).cumulative_simHits << std::endl;
149 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 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