1 // UserHooks.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2008 Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL version 2, see COPYING for details.
4 // Please respect the MCnet Guidelines, see GUIDELINES for details.
6 // Header file to allow user access to program at different stages.
7 // UserHooks: almost empty base class, with user to write the rela code.
8 // MyUserHooks: derived class, only intended as an example.
10 #ifndef Pythia8_UserHooks_H
11 #define Pythia8_UserHooks_H
14 #include "PhaseSpace.h"
15 #include "PythiaStdlib.h"
16 #include "SigmaProcess.h"
20 //**************************************************************************
22 // Forward reference to the PhaseSpace class.
25 //**************************************************************************
27 // UserHooks is base class for user access to program execution.
34 virtual ~UserHooks() {}
36 // Possibility to modify cross section of process.
37 virtual bool canModifySigma() {return false;}
39 // Multiplicative factor modifying the cross section of a hard process.
40 virtual double multiplySigmaBy(const SigmaProcess* sigmaProcessPtr,
41 const PhaseSpace* phaseSpacePtr, bool inEvent);
43 // Possibility to veto event after process-level selection.
44 virtual bool canVetoProcessLevel() {return false;}
46 // Decide whether to veto current process or not, based on process record.
47 // Usage: doVetoProcessLevel( process).
48 virtual bool doVetoProcessLevel( const Event& ) {return false;}
50 // Possibility to veto MI + ISR + FSR evolution and kill event,
51 // making decision at a fixed pT scale. Useful for MLM-style matching.
52 virtual bool canVetoPT() {return false;}
54 // Transverse-momentum scale for veto test.
55 virtual double scaleVetoPT() {return 0.;}
57 // Decide whether to veto current event or not, based on event record.
58 // Usage: doVetoPT( iPos, event), where iPos = 0: no emissions so far;
59 // iPos = 1/2/3 joint evolution, latest step was MI/ISR/FSR;
60 // iPos = 4: FSR only afterwards; iPos = 5: FSR in resonance decay.
61 virtual bool doVetoPT( int , const Event& ) {return false;}
63 // Possibility to veto MI + ISR + FSR evolution and kill event,
64 // making decision after fixed number of ISR or FSR steps.
65 virtual bool canVetoStep() {return false;}
67 // Up to how many steps should be checked.
68 virtual int numberVetoStep() {return 1;}
70 // Decide whether to veto current event or not, based on event record.
71 // Usage: doVetoStep( iPos, nISR, nFSR, event), where iPos as above,
72 // nISR and nFSR number of emissions so far for hard interaction only.
73 virtual bool doVetoStep( int , int , int , const Event& ) {return false;}
75 // Possibility to veto event after parton-level selection.
76 virtual bool canVetoPartonLevel() {return false;}
78 // Decide whether to veto current partons or not, based on event record.
79 // Usage: doVetoPartonLevel( event).
80 virtual bool doVetoPartonLevel( const Event& ) {return false;}
87 // subEvent extracts currently resolved partons in the hard process.
88 void subEvent(const Event& event, bool isHardest = true);
90 // Have one event object around as work area.
95 //**************************************************************************
97 // SuppressSmallPT is a derived class for user access to program execution.
98 // It is a simple example, illustrating how to suppress the cross section
99 // of 2 -> 2 processes by a factor pT^4 / (pT0^2 + pT^2)^2, with pT0 input,
100 // and also modify alpha_strong scale similarly.
102 class SuppressSmallPT : public UserHooks {
107 SuppressSmallPT( double pT0timesMIIn = 1., int numberAlphaSIn = 0,
108 bool useSameAlphaSasMIIn = true) {isInit = false;
109 pT0timesMI = pT0timesMIIn; numberAlphaS = numberAlphaSIn;
110 useSameAlphaSasMI = useSameAlphaSasMIIn;}
112 // Possibility to modify cross section of process.
113 virtual bool canModifySigma() {return true;}
115 // Multiplicative factor modifying the cross section of a hard process.
116 // Usage: inEvent is true for event generation, false for initialization.
117 virtual double multiplySigmaBy(const SigmaProcess* sigmaProcessPtr,
118 const PhaseSpace* phaseSpacePtr, bool );
122 // Save input properties and the squared pT0 scale.
123 bool isInit, useSameAlphaSasMI;
125 double pT0timesMI, pT20;
127 // Alpha_strong calculation.
132 //**************************************************************************
134 // VetoEvolution is a derived class for user access to program execution.
135 // It is a simple example, to kill events with > nMax partons at scale
136 // pTcheck in the combined evolution, but only counting partons in the
137 // hardest interaction and its associated ISR + FSR activity.
139 class VetoEvolution : public UserHooks {
144 VetoEvolution( int nMaxIn, double pTcheckIn) : nMax(nMaxIn),
145 pTcheck (pTcheckIn){}
147 // Possibility to veto combined MI + ISR + FSR evolution and
148 // kill event, e.g. for MLM-style matching of matrix elements.
149 virtual bool canVetoEvolution() {return true;}
151 // Transverse-momentum scale for veto test.
152 virtual double scaleVetoEvolution() {return pTcheck;}
154 // Decide whether to veto current event or not.
155 virtual bool doVetoEvolution(const Event& event) {
156 subEvent( event); return (workEvent.size() > nMax);}
160 // Saved values from constructor.
166 //**************************************************************************
168 } // end namespace Pythia8
170 #endif // Pythia8_UserHooks_H