8 #ifndef Pythia8_DireWeightContainer_H 9 #define Pythia8_DireWeightContainer_H 11 #define DIRE_WEIGHTCONTAINER_VERSION "2.002" 13 #include "Pythia8/PythiaStdlib.h" 14 #include "Pythia8/Settings.h" 15 #include "Pythia8/DireBasics.h" 16 #include "Pythia8/ExternalMEs.h" 30 : wt(1.0), type(0), iAtt(0), dAtt(0.0), sAtt(
"") {}
33 : wt(w), type(0), iAtt(0), dAtt(0.0), sAtt(
"") {}
35 DirePSWeight(
double w,
int typeIn,
int iAttIn=0,
double dAttIn=0.0,
36 string sAttIn=
"") : wt(w), type(typeIn), iAtt(iAttIn), dAtt(dAttIn),
40 iAtt(wgt.iAtt), dAtt(wgt.dAtt), sAtt(wgt.sAtt), auxwt(wgt.auxwt) {}
42 DirePSWeight(
double w,
int typeIn,
double full,
double over,
double aux,
43 int iAttIn=0,
double dAttIn=0.0,
string sAttIn=
"") : wt(w), type(typeIn),
44 iAtt(iAttIn), dAtt(dAttIn), sAtt(sAttIn) { auxwt.push_back(full);
45 auxwt.push_back(over); auxwt.push_back(aux); }
49 int iAttribute() {
return iAtt; }
50 double dAttribute() {
return dAtt; }
51 string sAttribute() {
return sAtt; }
55 inline DirePSWeight& operator*=(
double f) { wt *= f;
return *
this; }
88 beamA(nullptr), beamB(nullptr), infoPtr(nullptr), direInfoPtr(nullptr)
92 settingsPtr(settingsPtrIn), beamA(
nullptr), beamB(
nullptr),
93 infoPtr(
nullptr), direInfoPtr(
nullptr)
99 for ( unordered_map<string, double>::iterator itw = showerWeight.begin();
100 itw != showerWeight.end(); ++itw ) itw->second = 1.;
108 settingsPtr = settingsPtrIn;
110 direInfoPtr = direInfoPtrIn;
116 for ( unordered_map<
string, map<ulong, DirePSWeight> >::iterator
117 it = rejectWeight.begin(); it != rejectWeight.end(); ++it )
119 for ( unordered_map<
string, map<ulong, DirePSWeight> >::iterator
120 it = acceptWeight.begin(); it != acceptWeight.end(); ++it )
125 for ( unordered_map<string, double >::iterator it = showerWeight.begin();
126 it != showerWeight.end(); ++it ) it->second = 1.0;
130 void bookWeightVar(
string varKey,
bool checkSettings =
true);
134 ulong
key(
double a) {
return (ulong)(a*1e8+0.5); }
135 double dkey(ulong a) {
return (
double(a)/1e8); }
137 void setWeight(
string varKey,
double value);
138 void resetAcceptWeight(
double pT2key,
double value,
string varKey);
139 void resetRejectWeight(
double pT2key,
double value,
string varKey);
140 void eraseAcceptWeight(
double pT2key,
string varKey);
141 void eraseRejectWeight(
double pT2key,
string varKey);
142 double getAcceptWeight(
double pT2key,
string varKey);
143 double getRejectWeight(
double pT2key,
string varKey);
146 void insertWeights( map<double,double> aWeight,
147 multimap<double,double> rWeight,
string varKey );
150 void calcWeight(
double pT2,
bool includeAcceptAtPT2 =
true,
151 bool includeRejectAtPT2 =
false);
153 pair<double,double> getWeight(
double pT2,
string valKey =
"base");
158 unordered_map<string, double>::iterator it1 = showerWeight.find( valKey );
159 if ( it1 != showerWeight.end() )
return it1->second;
162 unordered_map<
string, vector<string> >::iterator it2
163 = weightCombineList.find(valKey);
164 if ( it2 != weightCombineList.end() ) {
167 for (
int iwgtname=0; iwgtname < int(it2->second.size()); ++iwgtname) {
168 unordered_map<string, double>::iterator it3
169 = showerWeight.find( it2->second[iwgtname] );
170 if ( it3 != showerWeight.end() ) wtNow *= it3->second;
178 unordered_map<string,double>* getShowerWeights() {
return &showerWeight; }
179 double sizeWeights()
const {
return showerWeight.size(); }
180 string weightName (
int i)
const {
return weightNames[i]; }
182 double sizeWeightgroups()
const {
return weightCombineList.size(); }
183 string weightgroupName (
int i)
const {
184 return weightCombineListNames[i];
188 double enhanceOverestimate(
string name );
189 double getTrialEnhancement(
double pT2key);
190 void clearTrialEnhancements() { trialEnhancements.clear(); }
191 void addTrialEnhancement(
double pT2key,
double value) {
192 trialEnhancements.insert(make_pair(key(pT2key), value));
197 ExternalMEsPtr matrixElements{};
200 bool hasME(vector <int> in_pdgs = vector<int>(),
201 vector<int> out_pdgs = vector<int>() );
202 bool hasME(
const Event& event);
203 double getME(
const Event& event);
207 static const double LARGEWT;
211 unordered_map<string, map<ulong, DirePSWeight> > acceptWeight;
212 unordered_map<string, map<ulong, DirePSWeight> > rejectWeight;
213 unordered_map<string, double> showerWeight;
214 vector<string> weightNames;
215 unordered_map<string, vector<string> > weightCombineList;
216 vector<string> weightCombineListNames;
219 unordered_map<string,double> enhanceFactors;
220 map<ulong, double> trialEnhancements;
double getShowerWeight(string valKey="base")
Function to return weight of the shower evolution.
Definition: DireWeightContainer.h:156
Container for a single weight with auxiliary information.
Definition: DireWeightContainer.h:24
The Event class holds all info on the generated event.
Definition: Event.h:453
Definition: BeamParticle.h:133
DirePSWeight()
Constructors.
Definition: DireWeightContainer.h:29
ulong key(double a)
Definition: DireWeightContainer.h:134
Definition: DireBasics.h:374
void init()
Initialize weights.
Definition: DireWeightContainer.h:97
void setWeight(double w)
Set functions.
Definition: DireWeightContainer.h:54
double weight()
Return functions.
Definition: DireWeightContainer.h:48
Container for all shower weights, including handling.
Definition: DireWeightContainer.h:82
void reset()
Reset current accept/reject probabilities.
Definition: DireWeightContainer.h:115
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
DireWeightContainer()
Constructor.
Definition: DireWeightContainer.h:87
string card
MG5 matrix element access.
Definition: DireWeightContainer.h:196
Definition: Settings.h:195