Skip to content

Commit

Permalink
Remove extraneous code in MEParamWeightGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
kdlong committed Dec 16, 2022
1 parent 61d39f0 commit c29cb3a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef SimDataFormats_GeneratorProducts_MEParamWeightGroupInfo_h
#define SimDataFormats_GeneratorProducts_MEParamWeightGroupInfo_h

#include <unordered_map>

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

namespace gen {
Expand All @@ -17,18 +15,6 @@ namespace gen {
MEParamWeightGroupInfo(const MEParamWeightGroupInfo& other) : WeightGroupInfo(other) { copy(other); }
void copy(const MEParamWeightGroupInfo& other);
MEParamWeightGroupInfo* clone() const override;
int getCentralIndex() { return centralIdx; }
int getVariationIndex(int sig) { return massValue.at(numSigma + sig).second; }
double getVariationValue(int sig) { return massValue.at(numSigma + sig).first; }
void updateWeight(int globalIndex, std::string id, double weight);
void updateWeight(int globalIndex, std::string id, std::vector<std::string>& content);

private:
std::unordered_map<size_t, std::vector<std::string>> splitContent;
std::vector<std::pair<double, int>> massValue;
double central;
int centralIdx;
int numSigma;
};
} // namespace gen

Expand Down
22 changes: 1 addition & 21 deletions SimDataFormats/GeneratorProducts/src/MEParamWeightGroupInfo.cc
Original file line number Diff line number Diff line change
@@ -1,28 +1,8 @@
#include "SimDataFormats/GeneratorProducts/interface/MEParamWeightGroupInfo.h"

#include <iostream>

// To be expanded with more specific behaviours in the future
namespace gen {
void MEParamWeightGroupInfo::copy(const MEParamWeightGroupInfo& other) { WeightGroupInfo::copy(other); }

MEParamWeightGroupInfo* MEParamWeightGroupInfo::clone() const { return new MEParamWeightGroupInfo(*this); }

void MEParamWeightGroupInfo::updateWeight(int globalIndex, std::string id, double weight) {
size_t localIndex = weightMetaInfoByGlobalIndex(id, globalIndex).localIndex;
auto lower =
std::lower_bound(massValue.begin(), massValue.end(), std::make_pair(weight, std::numeric_limits<int>::min()));
massValue.insert(lower, std::make_pair(weight, localIndex));
isWellFormed_ = massValue.size() % 2 == 1;
if (isWellFormed_) {
numSigma = massValue.size() / 2;
central = massValue.at(centralIdx).first;
centralIdx = massValue.at(centralIdx).second;
}
}

void MEParamWeightGroupInfo::updateWeight(int globalIndex, std::string id, std::vector<std::string>& content) {
size_t localIndex = weightMetaInfoByGlobalIndex(id, globalIndex).localIndex;
splitContent[localIndex] = content;
}

} // namespace gen

0 comments on commit c29cb3a

Please sign in to comment.