]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PYTHIA8/pythia8130/include/UserHooks.h
pythia8130 distributed with AliRoot
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8130 / include / UserHooks.h
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.
5
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.
9
10 #ifndef Pythia8_UserHooks_H
11 #define Pythia8_UserHooks_H
12
13 #include "Event.h"
14 #include "PhaseSpace.h"
15 #include "PythiaStdlib.h"
16 #include "SigmaProcess.h"
17
18 namespace Pythia8 {
19
20 //**************************************************************************
21
22 // Forward reference to the PhaseSpace class.
23 class PhaseSpace;
24
25 //**************************************************************************
26
27 // UserHooks is base class for user access to program execution.
28
29 class UserHooks {
30
31 public:
32
33   // Destructor.
34   virtual ~UserHooks() {}
35
36   // Possibility to modify cross section of process.
37   virtual bool canModifySigma() {return false;}
38
39   // Multiplicative factor modifying the cross section of a hard process.
40   virtual double multiplySigmaBy(const SigmaProcess* sigmaProcessPtr,
41     const PhaseSpace* phaseSpacePtr, bool inEvent);
42
43   // Possibility to veto event after process-level selection.
44   virtual bool canVetoProcessLevel() {return false;}
45
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;}
49
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;}  
53
54   // Transverse-momentum scale for veto test. 
55   virtual double scaleVetoPT() {return 0.;} 
56
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;} 
62
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;}
66
67   // Up to how many steps should be checked.
68   virtual int numberVetoStep() {return 1;}
69
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;} 
74    
75   // Possibility to veto event after parton-level selection.
76   virtual bool canVetoPartonLevel() {return false;}
77
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;} 
81
82 protected:
83
84   // Constructor.
85   UserHooks() {}
86
87   // subEvent extracts currently resolved partons in the hard process.
88   void subEvent(const Event& event, bool isHardest = true); 
89
90   // Have one event object around as work area.
91   Event workEvent;
92
93 };
94
95 //**************************************************************************
96
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.
101
102 class SuppressSmallPT : public UserHooks {
103  
104 public:
105
106   // Constructor.
107   SuppressSmallPT( double pT0timesMIIn = 1., int numberAlphaSIn = 0, 
108     bool useSameAlphaSasMIIn = true) {isInit = false; 
109     pT0timesMI = pT0timesMIIn; numberAlphaS = numberAlphaSIn; 
110     useSameAlphaSasMI = useSameAlphaSasMIIn;}
111
112   // Possibility to modify cross section of process.
113   virtual bool canModifySigma() {return true;}
114
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 );
119
120 private:
121
122   // Save input properties and the squared pT0 scale.
123   bool   isInit, useSameAlphaSasMI;
124   int    numberAlphaS;
125   double pT0timesMI, pT20;
126
127   // Alpha_strong calculation.
128   AlphaStrong alphaS;
129
130 };
131
132 //**************************************************************************
133
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.
138
139 class VetoEvolution : public UserHooks {
140
141 public:
142
143   // Constructor.
144   VetoEvolution( int nMaxIn, double pTcheckIn) : nMax(nMaxIn), 
145     pTcheck (pTcheckIn){}
146
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;}  
150
151   // Transverse-momentum scale for veto test. 
152   virtual double scaleVetoEvolution() {return pTcheck;} 
153
154   // Decide whether to veto current event or not.
155   virtual bool doVetoEvolution(const Event& event) {
156     subEvent( event); return (workEvent.size() > nMax);}  
157
158 private:
159
160   // Saved values from constructor.
161   int    nMax;
162   double pTcheck;
163
164 };
165
166 //**************************************************************************
167
168 } // end namespace Pythia8
169
170 #endif // Pythia8_UserHooks_H