1 // UserHooks.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2010 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 "PartonSystems.h"
15 #include "PhaseSpace.h"
16 #include "PythiaStdlib.h"
17 #include "SigmaProcess.h"
21 //==========================================================================
23 // Forward reference to the PhaseSpace class.
26 //==========================================================================
28 // UserHooks is base class for user access to program execution.
35 virtual ~UserHooks() {}
37 // Initialize pointers and workEvent. Note: not virtual.
38 void initPtr( Info* infoPtrIn, Settings* settingsPtrIn,
39 ParticleData* particleDataPtrIn, Rndm* rndmPtrIn,
40 BeamParticle* beamAPtrIn, BeamParticle* beamBPtrIn,
41 BeamParticle* beamPomAPtrIn, BeamParticle* beamPomBPtrIn,
42 CoupSM* coupSMPtrIn, PartonSystems* partonSystemsPtrIn,
43 SigmaTotal* sigmaTotPtrIn) { infoPtr = infoPtrIn;
44 settingsPtr = settingsPtrIn; particleDataPtr = particleDataPtrIn;
45 rndmPtr = rndmPtrIn; beamAPtr = beamAPtrIn; beamBPtr = beamBPtrIn;
46 beamPomAPtr = beamPomAPtrIn; beamPomBPtr = beamPomBPtrIn;
47 coupSMPtr = coupSMPtrIn; partonSystemsPtr = partonSystemsPtrIn;
48 sigmaTotPtr = sigmaTotPtrIn;
49 workEvent.init("(work event)", particleDataPtr);}
51 // Possibility to modify cross section of process.
52 virtual bool canModifySigma() {return false;}
54 // Multiplicative factor modifying the cross section of a hard process.
55 virtual double multiplySigmaBy(const SigmaProcess* sigmaProcessPtr,
56 const PhaseSpace* phaseSpacePtr, bool inEvent);
58 // Possibility to veto event after process-level selection.
59 virtual bool canVetoProcessLevel() {return false;}
61 // Decide whether to veto current process or not, based on process record.
62 // Usage: doVetoProcessLevel( process).
63 virtual bool doVetoProcessLevel(Event& ) {return false;}
65 // Possibility to veto MI + ISR + FSR evolution and kill event,
66 // making decision at a fixed pT scale. Useful for MLM-style matching.
67 virtual bool canVetoPT() {return false;}
69 // Transverse-momentum scale for veto test.
70 virtual double scaleVetoPT() {return 0.;}
72 // Decide whether to veto current event or not, based on event record.
73 // Usage: doVetoPT( iPos, event), where iPos = 0: no emissions so far;
74 // iPos = 1/2/3 joint evolution, latest step was MI/ISR/FSR;
75 // iPos = 4: FSR only afterwards; iPos = 5: FSR in resonance decay.
76 virtual bool doVetoPT( int , const Event& ) {return false;}
78 // Possibility to veto MI + ISR + FSR evolution and kill event,
79 // making decision after fixed number of ISR or FSR steps.
80 virtual bool canVetoStep() {return false;}
82 // Up to how many ISR + FSR steps of hardest interaction should be checked.
83 virtual int numberVetoStep() {return 1;}
85 // Decide whether to veto current event or not, based on event record.
86 // Usage: doVetoStep( iPos, nISR, nFSR, event), where iPos as above,
87 // nISR and nFSR number of emissions so far for hard interaction only.
88 virtual bool doVetoStep( int , int , int , const Event& ) {return false;}
90 // Possibility to veto MI + ISR + FSR evolution and kill event,
91 // making decision after fixed number of MI steps.
92 virtual bool canVetoMIStep() {return false;}
94 // Up to how many MI steps should be checked.
95 virtual int numberVetoMIStep() {return 1;}
97 // Decide whether to veto current event or not, based on event record.
98 // Usage: doVetoMIStep( nMI, event), where nMI is number of MI's so far.
99 virtual bool doVetoMIStep( int , const Event& ) {return false;}
101 // Possibility to veto event after parton-level selection.
102 virtual bool canVetoPartonLevel() {return false;}
104 // Decide whether to veto current partons or not, based on event record.
105 // Usage: doVetoPartonLevel( event).
106 virtual bool doVetoPartonLevel( const Event& ) {return false;}
108 // Possibility to set initial scale in TimeShower for resonance decay.
109 virtual bool canSetResonanceScale() {return false;}
111 // Initial scale for TimeShower evolution.
112 // Usage: scaleResonance( iRes, event), where iRes is location
113 // of decaying resonance in the event record.
114 virtual double scaleResonance( const int, const Event& ) {return 0.;}
116 // Possibility to veto an emission in the ISR machinery.
117 virtual bool canVetoISREmission() {return false;}
119 // Decide whether to veto current emission or not, based on event record.
120 // Usage: doVetoISREmission( sizeOld, event) where sizeOld is size
121 // of event record before current emission-to-be-scrutinized was added.
122 virtual bool doVetoISREmission( const int, const Event& ) {return false;}
124 // Possibility to veto an emission in the FSR machinery.
125 virtual bool canVetoFSREmission() {return false;}
127 // Decide whether to veto current emission or not, based on event record.
128 // Usage: doVetoFSREmission( sizeOld, event) where sizeOld is size
129 // of event record before current emission-to-be-scrutinized was added.
130 virtual bool doVetoFSREmission( const int, const Event& ) {return false;}
137 // Pointer to various information on the generation.
140 // Pointer to the settings database.
141 Settings* settingsPtr;
143 // Pointer to the particle data table.
144 ParticleData* particleDataPtr;
146 // Pointer to the random number generator.
149 // Pointers to the two incoming beams and to Pomeron beam-inside-beam.
150 BeamParticle* beamAPtr;
151 BeamParticle* beamBPtr;
152 BeamParticle* beamPomAPtr;
153 BeamParticle* beamPomBPtr;
155 // Pointers to Standard Model couplings.
158 // Pointer to information on subcollision parton locations.
159 PartonSystems* partonSystemsPtr;
161 // Pointer to the total/elastic/diffractive cross sections.
162 SigmaTotal* sigmaTotPtr;
164 // omitResonanceDecays omits resonance decay chains from process record.
165 void omitResonanceDecays(const Event& process);
167 // subEvent extracts currently resolved partons in the hard process.
168 void subEvent(const Event& event, bool isHardest = true);
170 // Have one event object around as work area.
175 //==========================================================================
177 // SuppressSmallPT is a derived class for user access to program execution.
178 // It is a simple example, illustrating how to suppress the cross section
179 // of 2 -> 2 processes by a factor pT^4 / (pT0^2 + pT^2)^2, with pT0 input,
180 // and also modify alpha_strong scale similarly.
182 class SuppressSmallPT : public UserHooks {
187 SuppressSmallPT( double pT0timesMIIn = 1., int numberAlphaSIn = 0,
188 bool useSameAlphaSasMIIn = true) {isInit = false;
189 pT0timesMI = pT0timesMIIn; numberAlphaS = numberAlphaSIn;
190 useSameAlphaSasMI = useSameAlphaSasMIIn;}
192 // Possibility to modify cross section of process.
193 virtual bool canModifySigma() {return true;}
195 // Multiplicative factor modifying the cross section of a hard process.
196 // Usage: inEvent is true for event generation, false for initialization.
197 virtual double multiplySigmaBy(const SigmaProcess* sigmaProcessPtr,
198 const PhaseSpace* phaseSpacePtr, bool );
202 // Save input properties and the squared pT0 scale.
203 bool isInit, useSameAlphaSasMI;
205 double pT0timesMI, pT20;
207 // Alpha_strong calculation.
212 //==========================================================================
214 } // end namespace Pythia8
216 #endif // Pythia8_UserHooks_H