3 #include "Pythia8/UserHooks.h" 4 #include "Pythia8/StringFragmentation.h" 17 for (Pythia8::UserHooks *hook :
hooks_) {
18 hook->initPtr(infoPtr,
29 test &= hook->initAfterBeams();
36 int nCanVetoMPIStep = 0;
37 int nCanSetResonanceScale = 0;
39 for (Pythia8::UserHooks *hook : hooks_) {
40 if (hook->canVetoPT())
42 if (hook->canVetoStep())
44 if (hook->canVetoMPIStep())
46 if (hook->canSetResonanceScale())
47 ++nCanSetResonanceScale;
48 if (hook->canEnhanceEmission() || hook->canEnhanceTrial())
54 "Error in MultiUserHook::initAfterBeams " 55 "multiple UserHooks with canVetoPT() not allowed");
58 if (nCanVetoStep > 1) {
60 "Error in MultiUserHook::initAfterBeams " 61 "multiple UserHooks with canVetoStep() not allowed");
64 if (nCanVetoMPIStep > 1) {
66 "Error in MultiUserHook::initAfterBeams " 67 "multiple UserHooks with canVetoMPIStep() not allowed");
70 if (nCanSetResonanceScale > 1) {
72 "Error in MultiUserHook::initAfterBeams " 73 "multiple UserHooks with canSetResonanceScale() not allowed");
76 if (nCanEnhance > 1) {
78 "Error in MultiUserHook::initAfterBeams " 79 "multiple UserHooks with canEnhanceEmission() or canEnhanceTrial() not allowed");
89 for (Pythia8::UserHooks *hook :
hooks_) {
90 test |= hook->canModifySigma();
97 const Pythia8::PhaseSpace *phaseSpacePtr,
98 bool inEvent)
override {
100 for (Pythia8::UserHooks *hook :
hooks_) {
101 if (hook->canModifySigma())
102 factor *= hook->multiplySigmaBy(sigmaProcessPtr, phaseSpacePtr, inEvent);
110 for (Pythia8::UserHooks *hook :
hooks_) {
111 test |= hook->canBiasSelection();
118 const Pythia8::PhaseSpace *phaseSpacePtr,
119 bool inEvent)
override {
121 for (Pythia8::UserHooks *hook :
hooks_) {
122 if (hook->canBiasSelection())
123 factor *= hook->biasSelectionBy(sigmaProcessPtr, phaseSpacePtr, inEvent);
131 for (Pythia8::UserHooks *hook :
hooks_) {
132 if (hook->canBiasSelection())
133 factor *= hook->biasedSelectionWeight();
141 for (Pythia8::UserHooks *hook :
hooks_) {
142 test |= hook->canVetoProcessLevel();
151 for (Pythia8::UserHooks *hook :
hooks_) {
152 if (hook->canVetoProcessLevel())
153 test |= hook->doVetoProcessLevel(event);
161 for (Pythia8::UserHooks *hook :
hooks_) {
162 test |= hook->canVetoResonanceDecays();
171 for (Pythia8::UserHooks *hook :
hooks_) {
172 if (hook->canVetoResonanceDecays())
173 test |= hook->doVetoResonanceDecays(event);
182 for (Pythia8::UserHooks *hook :
hooks_) {
183 test |= hook->canVetoPT();
190 for (Pythia8::UserHooks *hook :
hooks_) {
191 if (hook->canVetoPT())
192 return hook->scaleVetoPT();
202 for (Pythia8::UserHooks *hook :
hooks_) {
203 if (hook->canVetoPT())
204 return hook->doVetoPT(iPos, event);
213 for (Pythia8::UserHooks *hook :
hooks_) {
214 test |= hook->canVetoStep();
221 for (Pythia8::UserHooks *hook :
hooks_) {
222 if (hook->canVetoStep())
223 return hook->numberVetoStep();
232 for (Pythia8::UserHooks *hook :
hooks_) {
233 if (hook->canVetoStep())
234 return hook->doVetoStep(iPos, nISR, nFSR, event);
243 for (Pythia8::UserHooks *hook :
hooks_) {
244 test |= hook->canVetoMPIStep();
251 for (Pythia8::UserHooks *hook :
hooks_) {
252 if (hook->canVetoMPIStep())
253 return hook->numberVetoMPIStep();
261 for (Pythia8::UserHooks *hook :
hooks_) {
262 if (hook->canVetoMPIStep())
263 return hook->doVetoMPIStep(nMPI, event);
272 for (Pythia8::UserHooks *hook :
hooks_) {
273 test |= hook->canVetoPartonLevelEarly();
282 for (Pythia8::UserHooks *hook :
hooks_) {
283 if (hook->canVetoPartonLevelEarly())
284 test |= hook->doVetoPartonLevelEarly(event);
294 for (Pythia8::UserHooks *hook :
hooks_) {
295 test |= hook->retryPartonLevel();
303 for (Pythia8::UserHooks *hook :
hooks_) {
304 test |= hook->canVetoPartonLevel();
313 for (Pythia8::UserHooks *hook :
hooks_) {
314 if (hook->canVetoPartonLevel())
315 test |= hook->doVetoPartonLevel(event);
323 for (Pythia8::UserHooks *hook :
hooks_) {
324 test |= hook->canSetResonanceScale();
334 for (Pythia8::UserHooks *hook :
hooks_) {
335 if (hook->canSetResonanceScale())
336 return hook->scaleResonance(iRes, event);
344 for (Pythia8::UserHooks *hook :
hooks_) {
345 test |= hook->canVetoISREmission();
356 for (Pythia8::UserHooks *hook :
hooks_) {
357 if (hook->canVetoISREmission())
358 test |= hook->doVetoISREmission(sizeOld, event, iSys);
366 for (Pythia8::UserHooks *hook :
hooks_) {
367 test |= hook->canVetoFSREmission();
380 for (Pythia8::UserHooks *hook :
hooks_) {
381 if (hook->canVetoFSREmission())
382 test |= hook->doVetoFSREmission(sizeOld, event, iSys, inResonance);
390 for (Pythia8::UserHooks *hook :
hooks_) {
391 test |= hook->canVetoMPIEmission();
401 for (Pythia8::UserHooks *hook :
hooks_) {
402 if (hook->canVetoMPIEmission())
403 test |= hook->doVetoMPIEmission(sizeOld, event);
411 for (Pythia8::UserHooks *hook :
hooks_) {
412 test |= hook->canReconnectResonanceSystems();
424 for (Pythia8::UserHooks *hook :
hooks_) {
425 if (hook->canReconnectResonanceSystems())
426 test &= hook->doReconnectResonanceSystems(oldSizeEvt, event);
434 for (Pythia8::UserHooks *hook :
hooks_) {
435 test |= hook->canEnhanceEmission();
444 for (Pythia8::UserHooks *hook :
hooks_) {
445 test |= hook->canEnhanceTrial();
451 for (Pythia8::UserHooks *hook :
hooks_) {
452 if (hook->canEnhanceEmission() || hook->canEnhanceTrial())
453 return hook->enhanceFactor(str);
459 for (Pythia8::UserHooks *hook :
hooks_) {
460 if (hook->canEnhanceEmission() || hook->canEnhanceTrial())
461 return hook->vetoProbability(str);
469 for (Pythia8::UserHooks *hook :
hooks_) {
470 test |= hook->canChangeFragPar();
478 Pythia8::StringZ *zPtr,
479 Pythia8::StringPT *pTPtr,
482 std::vector<int> iParton,
483 const Pythia8::StringEnd *SE)
override {
485 for (Pythia8::UserHooks *hook :
hooks_) {
486 if (hook->canChangeFragPar())
487 test &= hook->doChangeFragPar(flavPtr, zPtr, pTPtr, idEnd, m2Had, iParton, SE);
495 for (Pythia8::UserHooks *hook :
hooks_) {
496 if (hook->canChangeFragPar())
497 test |= hook->doVetoFragmentation(part, SE);
505 std::vector<Pythia8::UserHooks *>
hooks_;
double vetoProbability(std::string str) override
bool doVetoPartonLevel(const Pythia8::Event &event) override
bool doVetoFSREmission(int sizeOld, const Pythia8::Event &event, int iSys, bool inResonance=false) override
double scaleResonance(int iRes, const Pythia8::Event &event) override
double biasedSelectionWeight() override
bool canVetoMPIStep() override
void addHook(Pythia8::UserHooks *hook)
bool initAfterBeams() override
bool doVetoStep(int iPos, int nISR, int nFSR, const Pythia8::Event &event) override
bool canVetoISREmission() override
bool canVetoPT() override
bool canEnhanceTrial() override
bool canSetResonanceScale() override
bool canVetoFSREmission() override
bool doVetoPT(int iPos, const Pythia8::Event &event) override
bool canVetoPartonLevel() override
bool doVetoFragmentation(Pythia8::Particle part, const Pythia8::StringEnd *SE) override
bool canVetoPartonLevelEarly() override
bool canVetoProcessLevel() override
bool canModifySigma() override
bool canVetoResonanceDecays() override
bool doVetoProcessLevel(Pythia8::Event &event) override
bool doVetoMPIStep(int nMPI, const Pythia8::Event &event) override
bool doVetoISREmission(int sizeOld, const Pythia8::Event &event, int iSys) override
bool canChangeFragPar() override
bool doChangeFragPar(Pythia8::StringFlav *flavPtr, Pythia8::StringZ *zPtr, Pythia8::StringPT *pTPtr, int idEnd, double m2Had, std::vector< int > iParton, const Pythia8::StringEnd *SE) override
double enhanceFactor(std::string str) override
double scaleVetoPT() override
int numberVetoMPIStep() override
double biasSelectionBy(const Pythia8::SigmaProcess *sigmaProcessPtr, const Pythia8::PhaseSpace *phaseSpacePtr, bool inEvent) override
bool canVetoStep() override
std::vector< Pythia8::UserHooks * > hooks_
bool doReconnectResonanceSystems(int oldSizeEvt, Pythia8::Event &event) override
bool canReconnectResonanceSystems() override
bool doVetoMPIEmission(int sizeOld, const Pythia8::Event &event) override
bool doVetoResonanceDecays(Pythia8::Event &event) override
int numberVetoStep() override
bool canVetoMPIEmission() override
unsigned int nHooks() const
bool retryPartonLevel() override
bool canBiasSelection() override
bool canEnhanceEmission() override
double multiplySigmaBy(const Pythia8::SigmaProcess *sigmaProcessPtr, const Pythia8::PhaseSpace *phaseSpacePtr, bool inEvent) override
bool doVetoPartonLevelEarly(const Pythia8::Event &event) override