3 #include "Pythia8/UserHooks.h" 4 #include "Pythia8/StringFragmentation.h" 19 for (Pythia8::UserHooks *hook :
hooks_) {
20 hook->initPtr(infoPtr, settingsPtr,
21 particleDataPtr, rndmPtr,
23 beamPomAPtr, beamPomBPtr,
24 coupSMPtr, partonSystemsPtr,
26 test &= hook->initAfterBeams();
33 int nCanVetoMPIStep = 0;
34 int nCanSetResonanceScale = 0;
36 for (Pythia8::UserHooks *hook : hooks_) {
37 if (hook->canVetoPT()) ++nCanVetoPT;
38 if (hook->canVetoStep()) ++nCanVetoStep;
39 if (hook->canVetoMPIStep()) ++nCanVetoMPIStep;
40 if (hook->canSetResonanceScale()) ++nCanSetResonanceScale;
41 if (hook->canEnhanceEmission() || hook->canEnhanceTrial()) ++nCanEnhance;
45 infoPtr->errorMsg(
"Error in MultiUserHook::initAfterBeams " 46 "multiple UserHooks with canVetoPT() not allowed");
50 infoPtr->errorMsg(
"Error in MultiUserHook::initAfterBeams " 51 "multiple UserHooks with canVetoStep() not allowed");
54 if (nCanVetoMPIStep>1) {
55 infoPtr->errorMsg(
"Error in MultiUserHook::initAfterBeams " 56 "multiple UserHooks with canVetoMPIStep() not allowed");
59 if (nCanSetResonanceScale>1) {
60 infoPtr->errorMsg(
"Error in MultiUserHook::initAfterBeams " 61 "multiple UserHooks with canSetResonanceScale() not allowed");
65 infoPtr->errorMsg(
"Error in MultiUserHook::initAfterBeams " 66 "multiple UserHooks with canEnhanceEmission() or canEnhanceTrial() not allowed");
76 for (Pythia8::UserHooks *hook :
hooks_) {
77 test |= hook->canModifySigma();
84 const Pythia8::PhaseSpace* phaseSpacePtr,
bool inEvent)
override {
86 for (Pythia8::UserHooks *hook :
hooks_) {
87 if (hook->canModifySigma()) factor *= hook->multiplySigmaBy(sigmaProcessPtr,phaseSpacePtr,inEvent);
95 for (Pythia8::UserHooks *hook :
hooks_) {
96 test |= hook->canBiasSelection();
103 const Pythia8::PhaseSpace* phaseSpacePtr,
bool inEvent)
override {
105 for (Pythia8::UserHooks *hook :
hooks_) {
106 if (hook->canBiasSelection()) factor *= hook->biasSelectionBy(sigmaProcessPtr,phaseSpacePtr,inEvent);
114 for (Pythia8::UserHooks *hook :
hooks_) {
115 if (hook->canBiasSelection()) factor *= hook->biasedSelectionWeight();
123 for (Pythia8::UserHooks *hook :
hooks_) {
124 test |= hook->canVetoProcessLevel();
133 for (Pythia8::UserHooks *hook :
hooks_) {
134 if (hook->canVetoProcessLevel()) test |= hook->doVetoProcessLevel(event);
142 for (Pythia8::UserHooks *hook :
hooks_) {
143 test |= hook->canVetoResonanceDecays();
152 for (Pythia8::UserHooks *hook :
hooks_) {
153 if (hook->canVetoResonanceDecays()) test |= hook->doVetoResonanceDecays(event);
162 for (Pythia8::UserHooks *hook :
hooks_) {
163 test |= hook->canVetoPT();
170 for (Pythia8::UserHooks *hook :
hooks_) {
171 if (hook->canVetoPT())
return hook->scaleVetoPT();
181 for (Pythia8::UserHooks *hook :
hooks_) {
182 if (hook->canVetoPT())
return hook->doVetoPT(iPos,event);
191 for (Pythia8::UserHooks *hook :
hooks_) {
192 test |= hook->canVetoStep();
199 for (Pythia8::UserHooks *hook :
hooks_) {
200 if (hook->canVetoStep())
return hook->numberVetoStep();
208 bool doVetoStep(
int iPos,
int nISR,
int nFSR,
const Pythia8::Event&
event)
override {
209 for (Pythia8::UserHooks *hook :
hooks_) {
210 if (hook->canVetoStep())
return hook->doVetoStep(iPos,nISR,nFSR,event);
219 for (Pythia8::UserHooks *hook :
hooks_) {
220 test |= hook->canVetoMPIStep();
227 for (Pythia8::UserHooks *hook :
hooks_) {
228 if (hook->canVetoMPIStep())
return hook->numberVetoMPIStep();
236 for (Pythia8::UserHooks *hook :
hooks_) {
237 if (hook->canVetoMPIStep())
return hook->doVetoMPIStep(nMPI,event);
246 for (Pythia8::UserHooks *hook :
hooks_) {
247 test |= hook->canVetoPartonLevelEarly();
256 for (Pythia8::UserHooks *hook :
hooks_) {
257 if (hook->canVetoPartonLevelEarly()) test |= hook->doVetoPartonLevelEarly(event);
267 for (Pythia8::UserHooks *hook :
hooks_) {
268 test |= hook->retryPartonLevel();
276 for (Pythia8::UserHooks *hook :
hooks_) {
277 test |= hook->canVetoPartonLevel();
286 for (Pythia8::UserHooks *hook :
hooks_) {
287 if (hook->canVetoPartonLevel()) test |= hook->doVetoPartonLevel(event);
295 for (Pythia8::UserHooks *hook :
hooks_) {
296 test |= hook->canSetResonanceScale();
306 for (Pythia8::UserHooks *hook :
hooks_) {
307 if (hook->canSetResonanceScale())
return hook->scaleResonance(iRes,event);
315 for (Pythia8::UserHooks *hook :
hooks_) {
316 test |= hook->canVetoISREmission();
327 for (Pythia8::UserHooks *hook :
hooks_) {
328 if (hook->canVetoISREmission()) test |= hook->doVetoISREmission(sizeOld,event,iSys);
336 for (Pythia8::UserHooks *hook :
hooks_) {
337 test |= hook->canVetoFSREmission();
350 for (Pythia8::UserHooks *hook :
hooks_) {
351 if (hook->canVetoFSREmission()) test |= hook->doVetoFSREmission(sizeOld,event,iSys,inResonance);
359 for (Pythia8::UserHooks *hook :
hooks_) {
360 test |= hook->canVetoMPIEmission();
370 for (Pythia8::UserHooks *hook :
hooks_) {
371 if (hook->canVetoMPIEmission()) test |= hook->doVetoMPIEmission(sizeOld,event);
379 for (Pythia8::UserHooks *hook :
hooks_) {
380 test |= hook->canReconnectResonanceSystems();
392 for (Pythia8::UserHooks *hook :
hooks_) {
393 if (hook->canReconnectResonanceSystems()) test &= hook->doReconnectResonanceSystems(oldSizeEvt,event);
401 for (Pythia8::UserHooks *hook :
hooks_) {
402 test |= hook->canEnhanceEmission();
411 for (Pythia8::UserHooks *hook :
hooks_) {
412 test |= hook->canEnhanceTrial();
418 for (Pythia8::UserHooks *hook :
hooks_) {
419 if (hook->canEnhanceEmission() || hook->canEnhanceTrial())
return hook->enhanceFactor(str);
425 for (Pythia8::UserHooks *hook :
hooks_) {
426 if (hook->canEnhanceEmission() || hook->canEnhanceTrial())
return hook->vetoProbability(str);
434 for (Pythia8::UserHooks *hook :
hooks_) {
435 test |= hook->canChangeFragPar();
442 bool doChangeFragPar( Pythia8::StringFlav* flavPtr, Pythia8::StringZ* zPtr, Pythia8::StringPT* pTPtr,
int idEnd,
443 double m2Had, std::vector<int> iParton,
const Pythia8::StringEnd* SE)
override {
445 for (Pythia8::UserHooks *hook :
hooks_) {
446 if (hook->canChangeFragPar()) test &= hook->doChangeFragPar(flavPtr, zPtr, pTPtr, idEnd, m2Had, iParton, SE);
454 for (Pythia8::UserHooks *hook :
hooks_) {
455 if (hook->canChangeFragPar()) test |= hook->doVetoFragmentation(part, SE);
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
std::vector< Pythia8::UserHooks * > hooks_
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
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