Skip to content

Commit

Permalink
Working skeleton of LHEWeightInfoProduct
Browse files Browse the repository at this point in the history
  • Loading branch information
kdlong committed May 29, 2019
1 parent 0a8810e commit 7cfc2fe
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ ExternalLHEProducer::ExternalLHEProducer(const edm::ParameterSet& iConfig) :
produces<LHEEventProduct>();
produces<LHERunInfoProduct, edm::Transition::BeginRun>();
produces<LHERunInfoProduct, edm::Transition::EndRun>();
produces<LHEWeightInfoProduct>();
produces<LHEWeightInfoProduct, edm::Transition::BeginRun>();
}


Expand Down Expand Up @@ -328,7 +328,6 @@ ExternalLHEProducer::beginRunProduce(edm::Run& run, edm::EventSetup const& es)
unsigned int skip = 0;
reader_ = std::make_unique<lhef::LHEReader>(infiles, skip);

std::cout << "Adding the Weight product!";
std::unique_ptr<LHEWeightInfoProduct> weightInfoProduct(new LHEWeightInfoProduct);
gen::WeightGroupInfo scaleInfo(
"<weightgroup name=\"Central scale variation\" combine=\"envelope\">"
Expand Down
20 changes: 8 additions & 12 deletions SimDataFormats/GeneratorProducts/interface/LHEWeightInfoProduct.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,15 @@
class LHEWeightInfoProduct {
public:
LHEWeightInfoProduct() {}
LHEWeightInfoProduct(const LHEWeightInfoProduct& other) {weightGroupsInfo_ = other.weightGroupsInfo_;}
LHEWeightInfoProduct(LHEWeightInfoProduct&& other) {weightGroupsInfo_ = std::move(other.weightGroupsInfo_);}
LHEWeightInfoProduct(std::vector<gen::WeightGroupInfo>& weightGroups);
LHEWeightInfoProduct(const LHEWeightInfoProduct& other);
LHEWeightInfoProduct(LHEWeightInfoProduct&& other);
~LHEWeightInfoProduct() {}
LHEWeightInfoProduct(std::vector<gen::WeightGroupInfo>& weightGroups) {
weightGroupsInfo_ = weightGroups;
}
LHEWeightInfoProduct &operator = (const LHEWeightInfoProduct &other) {weightGroupsInfo_ = other.weightGroupsInfo_; return * this; }
LHEWeightInfoProduct &operator = (LHEWeightInfoProduct &&other) {weightGroupsInfo_ = std::move(other.weightGroupsInfo_); return *this;}

std::vector<gen::WeightGroupInfo> getWeightGroupsInfo() { return weightGroupsInfo_; }
void addWeightGroupInfo(gen::WeightGroupInfo info) {
weightGroupsInfo_.push_back(info);
}
LHEWeightInfoProduct& operator=(const LHEWeightInfoProduct &other);
LHEWeightInfoProduct& operator=(LHEWeightInfoProduct &&other);

std::vector<gen::WeightGroupInfo> getWeightGroupsInfo();
void addWeightGroupInfo(gen::WeightGroupInfo info);

private:
std::vector<gen::WeightGroupInfo> weightGroupsInfo_;
Expand Down
26 changes: 26 additions & 0 deletions SimDataFormats/GeneratorProducts/src/LHEWeightInfoProduct.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <vector>
#include <string>

#include "SimDataFormats/GeneratorProducts/interface/LHEWeightInfoProduct.h"

LHEWeightInfoProduct::LHEWeightInfoProduct(std::vector<gen::WeightGroupInfo>& weightGroups) {
weightGroupsInfo_ = weightGroups;
}

LHEWeightInfoProduct& LHEWeightInfoProduct::operator=(const LHEWeightInfoProduct &other) {
weightGroupsInfo_ = other.weightGroupsInfo_;
return * this;
}

LHEWeightInfoProduct& LHEWeightInfoProduct::operator=(LHEWeightInfoProduct &&other) {
weightGroupsInfo_ = std::move(other.weightGroupsInfo_);
return *this;
}

std::vector<gen::WeightGroupInfo> LHEWeightInfoProduct::getWeightGroupsInfo() {
return weightGroupsInfo_;
}

void LHEWeightInfoProduct::addWeightGroupInfo(gen::WeightGroupInfo info) {
weightGroupsInfo_.push_back(info);
}

0 comments on commit 7cfc2fe

Please sign in to comment.