3 #include "Pythia8/UserHooks.h" 18 for (Pythia8::UserHooks *hook :
hooks_) {
19 hook->initPtr(infoPtr, settingsPtr,
20 particleDataPtr, rndmPtr,
22 beamPomAPtr, beamPomBPtr,
23 coupSMPtr, partonSystemsPtr,
25 test &= hook->initAfterBeams();
32 int nCanVetoMPIStep = 0;
33 int nCanSetResonanceScale = 0;
35 for (Pythia8::UserHooks *hook : hooks_) {
36 if (hook->canVetoPT()) ++nCanVetoPT;
37 if (hook->canVetoStep()) ++nCanVetoStep;
38 if (hook->canVetoMPIStep()) ++nCanVetoMPIStep;
39 if (hook->canSetResonanceScale()) ++nCanSetResonanceScale;
40 if (hook->canEnhanceEmission() || hook->canEnhanceTrial()) ++nCanEnhance;
44 infoPtr->errorMsg(
"Error in MultiUserHook::initAfterBeams " 45 "multiple UserHooks with canVetoPT() not allowed");
49 infoPtr->errorMsg(
"Error in MultiUserHook::initAfterBeams " 50 "multiple UserHooks with canVetoStep() not allowed");
53 if (nCanVetoMPIStep>1) {
54 infoPtr->errorMsg(
"Error in MultiUserHook::initAfterBeams " 55 "multiple UserHooks with canVetoMPIStep() not allowed");
58 if (nCanSetResonanceScale>1) {
59 infoPtr->errorMsg(
"Error in MultiUserHook::initAfterBeams " 60 "multiple UserHooks with canSetResonanceScale() not allowed");
64 infoPtr->errorMsg(
"Error in MultiUserHook::initAfterBeams " 65 "multiple UserHooks with canEnhanceEmission() or canEnhanceTrial() not allowed");
75 for (Pythia8::UserHooks *hook :
hooks_) {
76 test |= hook->canModifySigma();
83 const Pythia8::PhaseSpace* phaseSpacePtr,
bool inEvent)
override {
85 for (Pythia8::UserHooks *hook :
hooks_) {
86 if (hook->canModifySigma()) factor *= hook->multiplySigmaBy(sigmaProcessPtr,phaseSpacePtr,inEvent);
94 for (Pythia8::UserHooks *hook :
hooks_) {
95 test |= hook->canBiasSelection();
102 const Pythia8::PhaseSpace* phaseSpacePtr,
bool inEvent)
override {
104 for (Pythia8::UserHooks *hook :
hooks_) {
105 if (hook->canBiasSelection()) factor *= hook->biasSelectionBy(sigmaProcessPtr,phaseSpacePtr,inEvent);
113 for (Pythia8::UserHooks *hook :
hooks_) {
114 if (hook->canBiasSelection()) factor *= hook->biasedSelectionWeight();
122 for (Pythia8::UserHooks *hook :
hooks_) {
123 test |= hook->canVetoProcessLevel();
132 for (Pythia8::UserHooks *hook :
hooks_) {
133 if (hook->canVetoProcessLevel()) test |= hook->doVetoProcessLevel(event);
141 for (Pythia8::UserHooks *hook :
hooks_) {
142 test |= hook->canVetoResonanceDecays();
151 for (Pythia8::UserHooks *hook :
hooks_) {
152 if (hook->canVetoResonanceDecays()) test |= hook->doVetoResonanceDecays(event);
161 for (Pythia8::UserHooks *hook :
hooks_) {
162 test |= hook->canVetoPT();
169 for (Pythia8::UserHooks *hook :
hooks_) {
170 if (hook->canVetoPT())
return hook->scaleVetoPT();
180 for (Pythia8::UserHooks *hook :
hooks_) {
181 if (hook->canVetoPT())
return hook->doVetoPT(iPos,event);
190 for (Pythia8::UserHooks *hook :
hooks_) {
191 test |= hook->canVetoStep();
198 for (Pythia8::UserHooks *hook :
hooks_) {
199 if (hook->canVetoStep())
return hook->numberVetoStep();
207 bool doVetoStep(
int iPos,
int nISR,
int nFSR,
const Pythia8::Event&
event)
override {
208 for (Pythia8::UserHooks *hook :
hooks_) {
209 if (hook->canVetoStep())
return hook->doVetoStep(iPos,nISR,nFSR,event);
218 for (Pythia8::UserHooks *hook :
hooks_) {
219 test |= hook->canVetoMPIStep();
226 for (Pythia8::UserHooks *hook :
hooks_) {
227 if (hook->canVetoMPIStep())
return hook->numberVetoMPIStep();
235 for (Pythia8::UserHooks *hook :
hooks_) {
236 if (hook->canVetoMPIStep())
return hook->doVetoMPIStep(nMPI,event);
245 for (Pythia8::UserHooks *hook :
hooks_) {
246 test |= hook->canVetoPartonLevelEarly();
255 for (Pythia8::UserHooks *hook :
hooks_) {
256 if (hook->canVetoPartonLevelEarly()) test |= hook->doVetoPartonLevelEarly(event);
266 for (Pythia8::UserHooks *hook :
hooks_) {
267 test |= hook->retryPartonLevel();
275 for (Pythia8::UserHooks *hook :
hooks_) {
276 test |= hook->canVetoPartonLevel();
285 for (Pythia8::UserHooks *hook :
hooks_) {
286 if (hook->canVetoPartonLevel()) test |= hook->doVetoPartonLevel(event);
294 for (Pythia8::UserHooks *hook :
hooks_) {
295 test |= hook->canSetResonanceScale();
305 for (Pythia8::UserHooks *hook :
hooks_) {
306 if (hook->canSetResonanceScale())
return hook->scaleResonance(iRes,event);
314 for (Pythia8::UserHooks *hook :
hooks_) {
315 test |= hook->canVetoISREmission();
326 for (Pythia8::UserHooks *hook :
hooks_) {
327 if (hook->canVetoISREmission()) test |= hook->doVetoISREmission(sizeOld,event,iSys);
335 for (Pythia8::UserHooks *hook :
hooks_) {
336 test |= hook->canVetoFSREmission();
349 for (Pythia8::UserHooks *hook :
hooks_) {
350 if (hook->canVetoFSREmission()) test |= hook->doVetoFSREmission(sizeOld,event,iSys,inResonance);
358 for (Pythia8::UserHooks *hook :
hooks_) {
359 test |= hook->canVetoMPIEmission();
369 for (Pythia8::UserHooks *hook :
hooks_) {
370 if (hook->canVetoMPIEmission()) test |= hook->doVetoMPIEmission(sizeOld,event);
378 for (Pythia8::UserHooks *hook :
hooks_) {
379 test |= hook->canReconnectResonanceSystems();
391 for (Pythia8::UserHooks *hook :
hooks_) {
392 if (hook->canReconnectResonanceSystems()) test &= hook->doReconnectResonanceSystems(oldSizeEvt,event);
400 for (Pythia8::UserHooks *hook :
hooks_) {
401 test |= hook->canEnhanceEmission();
410 for (Pythia8::UserHooks *hook :
hooks_) {
411 test |= hook->canEnhanceTrial();
417 for (Pythia8::UserHooks *hook :
hooks_) {
418 if (hook->canEnhanceEmission() || hook->canEnhanceTrial())
return hook->enhanceFactor(str);
424 for (Pythia8::UserHooks *hook :
hooks_) {
425 if (hook->canEnhanceEmission() || hook->canEnhanceTrial())
return hook->vetoProbability(str);
433 for (Pythia8::UserHooks *hook :
hooks_) {
434 test |= hook->canChangeFragPar();
441 bool doChangeFragPar( Pythia8::StringFlav* flavPtr, Pythia8::StringZ* zPtr, Pythia8::StringPT* pTPtr,
int idEnd,
442 double m2Had, std::vector<int> iParton)
override {
444 for (Pythia8::UserHooks *hook :
hooks_) {
445 if (hook->canChangeFragPar()) test &= hook->doChangeFragPar(flavPtr, zPtr, pTPtr, idEnd, m2Had, iParton);
453 for (Pythia8::UserHooks *hook :
hooks_) {
454 if (hook->canChangeFragPar()) test |= hook->doVetoFragmentation(part);
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 doVetoFragmentation(Pythia8::Particle part) 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 canVetoPartonLevelEarly() override
bool canVetoProcessLevel() override
bool doChangeFragPar(Pythia8::StringFlav *flavPtr, Pythia8::StringZ *zPtr, Pythia8::StringPT *pTPtr, int idEnd, double m2Had, std::vector< int > iParton) 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
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