Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added move constructor and operator= for GenEventInfoProduct #25630

Merged
merged 1 commit into from Jan 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -17,9 +17,11 @@ class GenEventInfoProduct {
GenEventInfoProduct();
GenEventInfoProduct(const HepMC::GenEvent *evt);
GenEventInfoProduct(const GenEventInfoProduct &other);
GenEventInfoProduct(GenEventInfoProduct&& other);
virtual ~GenEventInfoProduct();

GenEventInfoProduct &operator = (const GenEventInfoProduct &other);
GenEventInfoProduct &operator = (GenEventInfoProduct &&other);

typedef gen::PdfInfo PDF;

Expand Down
32 changes: 32 additions & 0 deletions SimDataFormats/GeneratorProducts/src/GenEventInfoProduct.cc
Expand Up @@ -53,6 +53,21 @@ GenEventInfoProduct::GenEventInfoProduct(GenEventInfoProduct const &other) :
setPDF(other.pdf());
}

GenEventInfoProduct::GenEventInfoProduct(GenEventInfoProduct&& other) :
weights_(std::move(other.weights_)),
signalProcessID_(other.signalProcessID_),
qScale_(other.qScale_),
alphaQCD_(other.alphaQCD_),
alphaQED_(other.alphaQED_),
pdf_(other.pdf_.release()),
binningValues_(std::move(other.binningValues_)),
DJRValues_(std::move(other.DJRValues_)),
nMEPartons_(other.nMEPartons_), nMEPartonsFiltered_(other.nMEPartons_)
{
}



GenEventInfoProduct::~GenEventInfoProduct()
{
}
Expand All @@ -74,6 +89,23 @@ GenEventInfoProduct &GenEventInfoProduct::operator = (GenEventInfoProduct const
return *this;
}

GenEventInfoProduct &GenEventInfoProduct::operator = (GenEventInfoProduct&& other)
{
weights_ = std::move(other.weights_);
signalProcessID_ = other.signalProcessID_;
qScale_ = other.qScale_;
alphaQCD_ = other.alphaQCD_;
alphaQED_ = other.alphaQED_;
binningValues_ = std::move(other.binningValues_);
DJRValues_ = std::move(other.DJRValues_);
nMEPartons_=other.nMEPartons_;
nMEPartonsFiltered_=other.nMEPartonsFiltered_;
pdf_.reset(other.pdf_.release());

return *this;
}


double GenEventInfoProduct::weightProduct() const
{
return std::accumulate(weights_.begin(), weights_.end(),
Expand Down