1
// SampleAnalyzer headers
2
#include "SampleAnalyzer/Commons/DataFormat/MCEventFormat.h"
9
std::vector<const MCParticleFormat*> in;
10
std::vector<const MCParticleFormat*> out;
13
MAbool CompareMothers(const std::vector<const MCParticleFormat*>& a, const std::vector<const MCParticleFormat*>& b)
15
std::set<const MCParticleFormat*> aa;
16
std::set<const MCParticleFormat*> bb;
17
for (unsigned int i=0;i<a.size();i++) aa.insert(a[i]);
18
for (unsigned int i=0;i<b.size();i++) bb.insert(b[i]);
19
if (aa==bb) return true; else return false;
22
MAbool CompareMothers(const std::vector<const MCParticleFormat*>& a, const std::vector<MCParticleFormat*>& b)
24
std::set<const MCParticleFormat*> aa;
25
std::set<const MCParticleFormat*> bb;
26
for (unsigned int i=0;i<a.size();i++) aa.insert(a[i]);
27
for (unsigned int i=0;i<b.size();i++) bb.insert(b[i]);
28
if (aa==bb) return true; else return false;
31
void MCEventFormat::PrintVertices() const
33
std::vector<VertexInfo> vertices;
34
for (MAuint32 i=0;i<particles_.size();i++)
36
const MCParticleFormat* part = &(particles_[i]);
37
if (part->mothers().empty()) continue;
40
for (MAuint32 j=0;j<part->mothers().size();j++)
42
myVertex.in.push_back(part->mothers()[j]);
44
for (MAuint32 j=0;j<particles_.size();j++)
46
if (CompareMothers(myVertex.in,particles_[j].mothers()))
48
myVertex.out.push_back(&(particles_[j]));
52
for (MAuint32 j=0;j<vertices.size();j++)
54
if (CompareMothers(myVertex.in,vertices[j].in) && CompareMothers(myVertex.out,vertices[j].out))
59
if (ok) vertices.push_back(myVertex);
61
std::cout << "# vertices = " << vertices.size() << std::endl;
62
for (unsigned int i=0;i<vertices.size();i++)
65
for (unsigned int j=0;j<vertices[i].in.size();j++)
67
if (j!=0) std::cout << " ++ ";
68
std::cout << vertices[i].in[j]->pdgid();
70
std::cout << " ) --> ( ";
71
for (unsigned int j=0;j<vertices[i].out.size();j++)
73
if (j!=0) std::cout << " ++ ";
74
std::cout << vertices[i].out[j]->pdgid();
76
std::cout << " )" << std::endl;
80
/// Displaying mothers
81
void MCEventFormat::PrintMothers() const
83
std::cout << "**********************************************" << std::endl;
84
for (MAuint32 i=0;i<particles_.size();i++)
87
std::cout << std::setw(6) << particles_[i].pdgid() << "] <- ";
88
for (MAuint32 j=0;j<particles_[i].mothers().size();j++)
90
std::cout << std::setw(6) << particles_[i].mothers()[j]->pdgid() << " ";
92
std::cout << std::endl;
94
std::cout << "**********************************************" << std::endl;
98
/// Displaying daughters
99
void MCEventFormat::PrintDaughters() const
101
std::cout << "**********************************************" << std::endl;
102
for (MAuint32 i=0;i<particles_.size();i++)
105
std::cout << std::setw(6) << particles_[i].pdgid() << "] <- ";
106
for (MAuint32 j=0;j<particles_[i].daughters().size();j++)
108
std::cout << std::setw(6) << particles_[i].daughters()[j]->pdgid() << " ";
110
std::cout << std::endl;
112
std::cout << "**********************************************" << std::endl;