-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding first outlines of weight products
- Loading branch information
Showing
5 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
SimDataFormats/GeneratorProducts/interface/LHEWeightInfoProduct.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef SimDataFormats_GeneratorProducts_LHEWeightInfoProduct_h | ||
#define SimDataFormats_GeneratorProducts_LHEWeightInfoProduct_h | ||
|
||
#include <iterator> | ||
#include <memory> | ||
#include <vector> | ||
#include <string> | ||
|
||
//#include <hepml.hpp> | ||
|
||
#include "SimDataFormats/GeneratorProducts/interface/LesHouches.h" | ||
#include "SimDataFormats/GeneratorProducts/interface/WeightGroupInfo.h" | ||
|
||
class LHEWeightInfoProduct { | ||
public: | ||
LHEWeightInfoProduct() { | ||
gen::WeightGroupInfo scaleInfo( | ||
"<weightgroup name=\"Central scale variation\" combine=\"envelope\">" | ||
); | ||
//scaleInfo.isPDF = false; | ||
//scaleInfo.pdfLabel = ""; | ||
//scaleInfo.pdfLHAID = ""; | ||
|
||
gen::WeightGroupInfo cenPdfInfo( | ||
"<weightgroup name=\"NNPDF31_nnlo_hessian_pdfas\" combine=\"hessian\">" | ||
); | ||
|
||
//cenPdfInfo.isPDF = true; | ||
//cenPdfInfo.pdfLabel = "NNPDF31_nnlo_hessian_pdfas"; | ||
//cenPdfInfo.pdfLHAID = "3061000"; | ||
|
||
weightGroupsInfo_.push_back(scaleInfo); | ||
weightGroupsInfo_.push_back(cenPdfInfo); | ||
}; | ||
std::vector<gen::WeightGroupInfo> getWeightGroupsInfo() { return weightGroupsInfo_; } | ||
void addWeightGroupInfo(gen::WeightGroupInfo info) { | ||
weightGroupsInfo_.push_back(info); | ||
} | ||
|
||
private: | ||
std::vector<gen::WeightGroupInfo> weightGroupsInfo_; | ||
|
||
|
||
}; | ||
|
||
#endif // GeneratorWeightInfo_LHEInterface_LHEWeightInfoProduct_h | ||
|
36 changes: 36 additions & 0 deletions
36
SimDataFormats/GeneratorProducts/interface/LHEWeightProduct.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef SimDataFormats_GeneratorProducts_LHEWeightProduct_h | ||
#define SimDataFormats_GeneratorProducts_LHEWeightProduct_h | ||
|
||
#include <memory> | ||
#include <vector> | ||
#include <string> | ||
|
||
#include "SimDataFormats/GeneratorProducts/interface/LesHouches.h" | ||
#include "SimDataFormats/GeneratorProducts/interface/WeightsInfo.h" | ||
|
||
class LHEWeightProduct { | ||
public: | ||
typedef weightsContainer std::vector<std::vector<double>>; | ||
|
||
LHEWeightProduct() {} | ||
LHEWeightProduct& operator=(LHEWeightProduct&& other) { | ||
weights_ = std::move(other.weights_); | ||
originalXWGTUP_ = std::move(other.originalXWGTUP_); | ||
return *this; | ||
} | ||
~LHEWeightProduct() {} | ||
|
||
void addWeight(double weight, size_t setEntry, size_t weightNum) { | ||
weights_.at(setEntry).insert(weight, weightNum); | ||
} | ||
double originalXWGTUP() const { return originalXWGTUP_; } | ||
const std::vector<WGT>& weights() const { return weights_; } | ||
|
||
private: | ||
weightsContainer weights_; | ||
std::map<std::string, double> weightsMap_; | ||
double originalXWGTUP_; | ||
}; | ||
|
||
#endif // GeneratorEvent_LHEInterface_LHEWeightProduct_h | ||
|
58 changes: 58 additions & 0 deletions
58
SimDataFormats/GeneratorProducts/interface/WeightGroupInfo.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#ifndef SimDataFormats_GeneratorProducts_WeightGroupInfo_h | ||
#define SimDataFormats_GeneratorProducts_WeightGroupInfo_h | ||
|
||
/** \class PdfInfo | ||
* | ||
*/ | ||
#include <string> | ||
|
||
namespace gen { | ||
typedef std::pair<size_t, std::string> weightId; | ||
|
||
enum WeightType { | ||
pdfWeights, | ||
scaleWeights, | ||
matrixElementWeights, | ||
unknownWeights, | ||
}; | ||
|
||
class WeightGroupInfo { | ||
public: | ||
WeightGroupInfo(std::string header): | ||
headerEntry_(header), name_(header), firstId_(0), lastId_(0) {} | ||
int getWeightVectorEntry(const std::string& wgtId, size_t weightEntry) { | ||
int orderedEntry = weightEntry - firstId_; | ||
int entry = -1; | ||
if (orderedEntry >= 0 && static_cast<size_t>(orderedEntry) < idsContained_.size()) | ||
if (idsContained_.at(orderedEntry).second == wgtId) | ||
return orderedEntry; | ||
//auto it = std::find( | ||
return entry; | ||
} | ||
void addContainedID(std::string id, size_t weightEntry) { | ||
if (!indexInRange(weightEntry)) | ||
throw std::domain_error("This entry is out of the expected range"); | ||
size_t orderedEntry = weightEntry - firstId_; | ||
idsContained_.insert(idsContained_.begin()+weightEntry, std::make_pair(orderedEntry, id)); | ||
} | ||
void setWeightType(WeightType type) { weightType_ = type; } | ||
|
||
void setFirstEntry(size_t entryNum) { firstId_ = entryNum;} | ||
void setLastEntry(size_t entryNum) { lastId_ = entryNum;} | ||
|
||
bool indexInRange(size_t index) { | ||
return (index <= lastId_ && index >= firstId_); | ||
} | ||
|
||
private: | ||
std::string headerEntry_; | ||
std::string name_; | ||
WeightType weightType_; | ||
std::vector<weightId> idsContained_; | ||
size_t firstId_; | ||
size_t lastId_; | ||
}; | ||
} | ||
|
||
#endif // SimDataFormats_GeneratorProducts_WeightGroupInfo_h | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters