Skip to content

Commit

Permalink
Fixing little bit of readerhelper to change things to non-ptrs
Browse files Browse the repository at this point in the history
  • Loading branch information
dteague committed Aug 16, 2019
1 parent 6bfea57 commit 28f0ba2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class LHEWeightGroupReaderHelper {
void parseLHEFile(std::string filename);


gen::WeightGroupInfo* getScaleInfo() {return scaleInfo;}
gen::WeightGroupInfo getScaleInfo() {return scaleInfo;}
edm::OwnVector<gen::WeightGroupInfo> getPdfVector() {return pdfVector;}

private:
Expand All @@ -30,7 +30,7 @@ class LHEWeightGroupReaderHelper {

// Variables
gen::WeightType curWeight;
gen::WeightGroupInfo* scaleInfo;
gen::WeightGroupInfo scaleInfo;
edm::OwnVector<gen::WeightGroupInfo> pdfVector;
std::regex weightStart = std::regex(".*<weightgroup.+>.*");
std::regex weightEnd = std::regex(".*</weightgroup>.*");
Expand Down Expand Up @@ -72,21 +72,17 @@ LHEWeightGroupReaderHelper::parseLHEFile(std::string filename) {
std::regex_search(line, m, weightContent);
std::string content = m[1].str();

gen::WeightGroupInfo* tmpWeight = nullptr;
gen::WeightGroupInfo tmpWeight;
if(curWeight == gen::kScaleWeights) {
tmpWeight = new gen::ScaleWeightGroupInfo(groupLine);
tmpWeight = gen::ScaleWeightGroupInfo(groupLine);
scaleInfo = tmpWeight;
}
else if(curWeight == gen::kPdfWeights) {
tmpWeight = new gen::PdfWeightGroupInfo(groupLine);
// pdfVector.push_back(tmpWeight);
pdfVector.push_back(new gen::PdfWeightGroupInfo(groupLine));
tmpWeight = pdfVector.back();
}
tmpWeight->addContainedId(index, tmp["id"], line);

if(curWeight == gen::kPdfWeights) //hate hate hate
pdfVector.push_back(tmpWeight);
tmpWeight.addContainedId(index, tmp["id"], line);
index++;

}
curWeight = gen::kUnknownWeights;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ ExternalLHEProducer::beginRunProduce(edm::Run& run, edm::EventSetup const& es)
std::string LHEfilename ="cmsgrid_final.lhe";
LHEWeightGroupReaderHelper reader;
reader.parseLHEFile(LHEfilename);
scaleInfo = *reader.getScaleInfo();
scaleInfo = reader.getScaleInfo();
pdfSets = reader.getPdfVector();

weightInfoProduct->addWeightGroupInfo(scaleInfo);
Expand Down

0 comments on commit 28f0ba2

Please sign in to comment.