44 #include "../particleDataTable.h"
45 #include "../particle.h"
46 #include "decayGraph.hpp"
57 using namespace boost;
60 typedef decayGraph<interactionVertex, particle>
graphType;
64 main(
int argc,
char** argv)
84 mom = TVector3(1, 2, 3);
86 beam->setMomentum(mom);
89 printInfo <<
"created particles: " << endl
94 printInfo <<
"created vertex: " << endl
97 printInfo <<
"copied vertex: " << endl
100 mom = TVector3(3, 4, 5);
102 daughter1->setMomentum(mom);
103 mom = TVector3(4, 5, 6);
105 daughter2->setMomentum(mom);
107 printInfo <<
"created vertex: " << endl
110 printInfo <<
"copied vertex: " << endl
139 g.name() =
"test graph";
146 for (graphType::nodeIterator
i = g.nodes().first;
i != g.nodes().second; ++
i) {
148 g.
name(v) = v->parent()->name();
150 for (graphType::edgeIterator
i = g.edges().first;
i != g.edges().second; ++
i) {
153 n <<
"edge [" << g.index(*
i) <<
"] " << p->name();
154 g.name(*
i) = n.str();
156 g.print(cout, g.nodeNameMap(), g.edgeNameMap());
158 ofstream graphVizFile(
"decay.dot");
159 g.writeGraphViz(graphVizFile, g.nodeNameMap(), g.edgeNameMap());
160 gSystem->Exec(
"dot -Tps -o decay.ps decay.dot");
164 g2.name() =
"graph copy";
165 for (graphType::adjIterator
i = g2.adjacentVertices(vert1).first;
166 i != g2.adjacentVertices(vert1).second; ++
i) {
167 g2.name (*
i) +=
" !bar!";
168 g2.color(*
i) = white_color;
169 printInfo <<
"vert1 adjacent vertex[" << *
i <<
"]: " << *g2[*
i] << endl;
171 printInfo <<
"nmbInParticles(vert1): " << g2.nmbInEdges(vert1) << endl;
172 for (graphType::inEdgeIterator
i = g2.incomingEdges(vert1).first;
173 i != g2.incomingEdges(vert1).second; ++
i) {
174 g2.name (*
i) +=
" !blah!";
175 g2.color(*
i) = gray_color;
176 printInfo <<
"vert1 in edge[" << *
i <<
"]: " << *g2[*
i] << endl;
178 printInfo <<
"nmbOutParticles(vert1): " << g2.nmbOutEdges(vert1) << endl;
179 for (graphType::outEdgeIterator
i = g2.outgoingEdges(vert1).first;
180 i != g2.outgoingEdges(vert1).second; ++
i) {
181 g2.name (*
i) +=
" !blah2!";
182 g2.color(*
i) = black_color;
183 printInfo <<
"vert1 out edge[" << *
i <<
"]: " << *g2[*
i] << endl;
186 printInfo <<
"isNode(vert0) = " << g2.isNode(vert0) <<
", "
187 <<
"isNode(dummyVert) = " << g2.isNode(dummyVert) << endl;
189 printInfo <<
"isEdge(f1) = " << g2.isEdge(f1) <<
", "
190 <<
"isEdge(dummyPart) = " << g2.isEdge(dummyPart) << endl;
191 cout <<
"fromVertex(f1): " << *g2.fromVertex(f1) << endl;
192 cout <<
"toVertex(f1): " << *g2.toVertex (f1) << endl;
193 cout <<
"particleExists(vert0, vert1) = " << g2.particleExists(vert0, vert1) <<
", "
194 <<
"particleExists(vert1, vert0) = " << g2.particleExists(vert1, vert0) << endl;
195 cout <<
"particleConnects(f1, vert0, vert1) = " << g2.particleConnects(f1, vert0, vert1) << endl;
196 cout <<
"particleConnects(a1, vert0, vert1) = " << g2.particleConnects(a1, vert0, vert1) << endl;
198 for (graphType::nodeIterator
i = g2.nodes().first;
i != g2.nodes().second; ++
i)
199 cout <<
"node " << *
i <<
": name = '" << g2.name(*
i) <<
"', "
200 <<
"index = " << g2.index(*
i) <<
", "
201 <<
"color = " << g2.color(*
i) <<
", "
203 for (graphType::edgeIterator
i = g2.edges().first;
i != g2.edges().second; ++
i)
204 cout <<
"edge " << *
i <<
": name = '" << g2.name(*
i) <<
"', "
205 <<
"index = " << g2.index(*
i) <<
", "
206 <<
"color = " << g2.color(*
i) <<
", "
208 g2.print(cout, g2.nodeNameMap());
210 printInfo <<
"after clear:" << endl << g2;
213 g3.name() =
"test graph 3";
218 g3.addVertex(prodVert);
226 topo.name() =
"topo graph copy";
229 vector<isobarDecayVertexPtr> decayVertices;
230 decayVertices.push_back(vert3);
231 decayVertices.push_back(vert1);
232 decayVertices.push_back(vert2);
233 decayVertices.push_back(vert0);
234 vector<particlePtr> fsParticles;
235 fsParticles.push_back(pi0);
236 fsParticles.push_back(pi1);
237 fsParticles.push_back(pi2);
238 fsParticles.push_back(pi3);
239 fsParticles.push_back(pi4);
241 topo2.name() =
"topo";
244 printInfo <<
"topology okay = " << topologyOkay << endl;
245 printInfo <<
"performing consistency checks on isobar decay topology" << endl;
246 const bool decayConsistent = topo2.checkConsistency();
247 printInfo <<
"decay consistent = " << decayConsistent << endl;
248 topo2.calcIsobarLzVec();
251 cout <<
"-------------------------------------------------------------------------------"
253 printInfo <<
"testing cloning" << endl;
266 decayTopologyGraphType::nodeIterator iNode, iNodeEnd;
267 cout <<
"!!! topo2 vertex pointers: ";
268 for (tie(iNode, iNodeEnd) = topo2.nodes(); iNode != iNodeEnd; ++iNode)
269 cout << topo2.vertex(*iNode) <<
" ";
271 cout <<
"!!! topo3 vertex pointers: ";
272 for (tie(iNode, iNodeEnd) = topo3->nodes(); iNode != iNodeEnd; ++iNode)
273 cout << topo3->vertex(*iNode) <<
" ";
275 cout <<
"!!! topo3 interaction vertex pointers: ";
276 for (
unsigned int i = 0;
i < topo3->nmbDecayVertices(); ++
i)
277 cout << topo3->decayVertices()[
i] <<
" ";
279 cout <<
"!!! topo3 isobar decay vertex pointers: ";
280 for (
unsigned int i = 0;
i < topo3->nmbDecayVertices(); ++
i)
281 cout << topo3->isobarDecayVertices()[
i] <<
" ";
283 decayTopologyGraphType::edgeIterator iEdge, iEdgeEnd;
284 cout <<
"!!! topo2 particle pointers: ";
285 for (tie(iEdge, iEdgeEnd) = topo2.edges(); iEdge != iEdgeEnd; ++iEdge)
286 cout << topo2.particle(*iEdge) <<
" ";
288 cout <<
"!!! topo3 particle pointers: ";
289 for (tie(iEdge, iEdgeEnd) = topo3->edges(); iEdge != iEdgeEnd; ++iEdge)
290 cout << topo3->particle(*iEdge) <<
" ";
292 cout <<
"!!! topo3 FS particle pointers: ";
293 for (
unsigned int i = 0;
i < topo3->nmbFsParticles(); ++
i)
294 cout << topo3->fsParticles()[
i] <<
" ";
299 cout <<
"-------------------------------------------------------------------------------"
301 printInfo <<
"testing subdecays and merge" << endl;
303 subDecay1.decayTopologyGraphType::printPointers(cout);
304 subDecay1.decayTopology::print(cout);
306 cout <<
"subdecay from node[2]: " << subDecay1;
308 cout <<
"subdecay from node[1]: " << subDecay2;
310 cout <<
"subdecay from node[9]: " << subDecay3;
312 cout <<
"subdecay from node[2] + subdecay from node[9]: " << subDecay1;
317 decay.addVertex(vertX);
319 cout <<
"subdecay from node[2] + subdecay from node[9] + vert0: " << subDecay1;
321 isobarDecayTopology newDecay = isobarDecayTopology::joinDaughterDecays(vertX, subDecayX, subDecay3);
324 cout <<
"joined graph: " << newDecay;
326 newDecay.checkConsistency();
331 const string keyFileName =
"testFindIsobarBoseSymVertices.key";
336 printErr <<
"problems constructing amplitude. exiting." << endl;
342 topo->findIsobarBoseSymVertices();