Commit f2f59d8f authored by Paul Schuetze's avatar Paul Schuetze
Browse files

In the Multiplet constructor, clone the tracklets. In the destructor, delete these copies

parent 01a9ea7a
......@@ -20,8 +20,20 @@ Multiplet::Multiplet() : Track() {}
Multiplet::Multiplet(const Multiplet& multiplet) : Track(multiplet) {}
Multiplet::Multiplet(Track* upstream, Track* downstream) : Track() {
m_upstream = upstream;
m_downstream = downstream;
m_upstream = upstream->clone();
m_downstream = downstream->clone();
for(auto& cluster : m_upstream->clusters()) {
this->addCluster(cluster);
}
for(auto& cluster : m_downstream->clusters()) {
this->addCluster(cluster);
}
}
Multiplet::~Multiplet() {
delete m_upstream;
delete m_downstream;
}
void Multiplet::calculateChi2() {
......
......@@ -39,6 +39,8 @@ namespace corryvreckan {
Multiplet(Track* upstream, Track* downstream);
virtual ~Multiplet();
virtual Multiplet* clone() const override { return new Multiplet(*this); }
void print(std::ostream& out) const override;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment