8 #ifndef Pythia8_Weights_H
9 #define Pythia8_Weights_H
11 #include "Pythia8/Basics.h"
12 #include "Pythia8/LHEF3.h"
13 #include "Pythia8/PythiaStdlib.h"
14 #include "Pythia8/SharedPointers.h"
36 virtual void clear() {
return; };
39 virtual void bookVectors(vector<double> ,
40 vector<string> ) {
return; }
44 virtual void collectWeightValues(vector<double>& outputWeights,
48 virtual void collectWeightNames(vector<string>& outputNames);
55 vector<double> weightValues;
56 vector<string> weightNames;
57 string getWeightsName(
int iPos)
const {
58 if (iPos >= 0 && iPos < (
int)weightNames.size())
59 return weightNames[iPos];
61 virtual double getWeightsValue(
int iPos)
const {
return weightValues[iPos]; }
62 int getWeightsSize()
const {
return weightValues.size(); }
65 void bookWeight(
string name,
double defaultValue = 1.) {
66 weightNames.push_back(name);
67 weightValues.push_back(defaultValue);
71 void setValueByIndex(
int iPos,
double val) {
72 weightValues[iPos] = val;
74 void setValueByName(
string name,
double val) {
76 int iPos = findIndexOfName(name);
77 setValueByIndex(iPos, val);
82 int findIndexOfName(
string name) {
83 vector<string>::iterator it
84 = find(weightNames.begin(), weightNames.end(), name);
85 unsigned long int index = distance(weightNames.begin(), it);
86 if (index == weightNames.size())
return -1;
87 return distance(weightNames.begin(), it);
93 void setPtrs(
Info* infoPtrIn) { infoPtr = infoPtrIn; };
108 void init(
bool doMerging);
114 void bookVectors(vector<double> weights, vector<string> names);
117 void reweightValueByIndex(
int iPos,
double val);
118 void reweightValueByName(
string name,
double val);
120 void replaceWhitespace( vector<string>& namesIn);
123 map<int,double> varPDFplus, varPDFminus, varPDFmember;
126 string getGroupName(
int iGN)
const;
129 double getGroupWeight(
int iGW)
const;
131 int nVariationGroups()
const {
return externalVariations.size(); }
134 void initAutomatedVariationGroups(
bool =
false);
137 vector<string> getUniqueShowerVars();
139 string getInitialName(
int iG)
const {
return initialNameSave[iG]; }
142 vector<string> externalVariations;
143 vector<vector<string> > externalVarNames;
144 vector<string> externalGroupNames;
145 vector<string> initialNameSave;
146 vector<vector<int> > externalMap;
147 int externalVariationsSize{};
150 vector<vector<string>> mergingVarNames;
151 vector<double> getMuRWeightVector();
153 void collectWeightNames(vector<string>& outputNames);
154 void collectWeightValues(vector<double>& outputWeights,
177 void bookWeight(
string name,
double value,
double valueFirst);
180 void bookVectors(vector<double> weights, vector<string> names);
181 void bookVectors(vector<double> weights,vector<double> weightsFirst,
182 vector<string> names);
184 double getWeightsValue(
int iPos)
const {
185 return weightValues[iPos] - weightValuesFirst[iPos]; }
187 double getWeightsValueP(
int iPos)
const {
188 return weightValuesP[iPos] - weightValuesFirstP[iPos]; }
189 double getWeightsValuePC(
int iPos)
const {
190 return weightValuesPC[iPos] - weightValuesFirstPC[iPos]; }
193 void reweightValueByIndex(
int iPos,
double val);
194 void reweightValueByName(
string name,
double val);
197 vector<double> weightValuesFirst;
200 vector<double> weightValuesP, weightValuesPC,
201 weightValuesFirstP, weightValuesFirstPC;
204 void setValueFirstByIndex(
int iPos,
double val);
205 void setValueFirstByName(
string name,
double val);
208 void setValueVector(vector<double> ValueVector);
209 void setValueFirstVector(vector<double> ValueFirstVector);
212 vector<double> getMuRVarFactors();
215 void setLHEFvariationMapping();
217 map<int,int> muRVarLHEFindex;
220 void collectWeightNames(vector<string>& outputNames);
223 void collectWeightValues(vector<double>& outputWeights,
241 double centralWeight;
247 void bookVectors(vector<double> weights_detailed_vecIn,
248 vector<string> weights_detailed_name_vecIn);
252 void collectWeightValues(vector<double>& outputWeights,
254 void collectWeightNames(vector<string>& outputNames);
258 vector<string> weightnames_lhef2hepmc(
259 vector<string> weights_detailed_name_vecIn);
261 void identifyVariationsFromLHAinit( map<string,LHAweight> *init_weightsIn );
263 map<int,double> muRvars;
282 double weightNominal;
283 void setWeightNominal(
double weightNow );
284 double collectWeightNominal();
298 int numberOfWeights();
299 double weightValueByIndex(
int key=0);
300 string weightNameByIndex(
int key=0);
306 vector<double> weightValueVector();
310 vector<string> weightNameVector();
322 void init(
bool doMerging);
325 void initPtrs(
Info* infoPtrIn);
328 bool doSuppressAUXweights;
330 vector<double> sigmaTotal, sigmaSample, errorTotal, errorSample;
335 vector<double> getSampleXsec();
336 vector<double> getTotalXsec();
337 vector<double> getSampleXsecErr();
338 vector<double> getTotalXsecErr();
341 void accumulateXsec(
double norm = 1.);
349 #endif // Pythia8_Weights_H