]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PYTHIA8/pythia8140/include/UserHooks.h
adding TRU/L0 plots for shifter and logbook image - code from Francesco B.
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8140 / include / UserHooks.h
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.
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 "PartonSystems.h"
15 #include "PhaseSpace.h"
16 #include "PythiaStdlib.h"
17 #include "SigmaProcess.h"
18
19 namespace Pythia8 {
20
21 //==========================================================================
22
23 // Forward reference to the PhaseSpace class.
24 class PhaseSpace;
25
26 //==========================================================================
27
28 // UserHooks is base class for user access to program execution.
29
30 class UserHooks {
31
32 public:
33
34   // Destructor.
35   virtual ~UserHooks() {}
36
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);}
50
51   // Possibility to modify cross section of process.
52   virtual bool canModifySigma() {return false;}
53
54   // Multiplicative factor modifying the cross section of a hard process.
55   virtual double multiplySigmaBy(const SigmaProcess* sigmaProcessPtr,
56     const PhaseSpace* phaseSpacePtr, bool inEvent);
57
58   // Possibility to veto event after process-level selection.
59   virtual bool canVetoProcessLevel() {return false;}
60
61   // Decide whether to veto current process or not, based on process record.
62   // Usage: doVetoProcessLevel( process).
63   virtual bool doVetoProcessLevel(Event& ) {return false;}
64
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;}  
68
69   // Transverse-momentum scale for veto test. 
70   virtual double scaleVetoPT() {return 0.;} 
71
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;} 
77
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;}
81
82   // Up to how many ISR + FSR steps of hardest interaction should be checked.
83   virtual int numberVetoStep() {return 1;}
84
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;} 
89
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;}
93
94   // Up to how many MI steps should be checked.
95   virtual int numberVetoMIStep() {return 1;}
96
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;} 
100    
101   // Possibility to veto event after parton-level selection.
102   virtual bool canVetoPartonLevel() {return false;}
103
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;} 
107
108   // Possibility to set initial scale in TimeShower for resonance decay.
109   virtual bool canSetResonanceScale() {return false;}
110
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.;} 
115
116   // Possibility to veto an emission in the ISR machinery.
117   virtual bool canVetoISREmission() {return false;}
118
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;} 
123
124   // Possibility to veto an emission in the FSR machinery.
125   virtual bool canVetoFSREmission() {return false;}
126
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;} 
131
132 protected:
133
134   // Constructor.
135   UserHooks() {}
136
137   // Pointer to various information on the generation.
138   Info*          infoPtr;
139
140   // Pointer to the settings database.
141   Settings*      settingsPtr;
142
143   // Pointer to the particle data table.
144   ParticleData*  particleDataPtr;
145
146  // Pointer to the random number generator.
147   Rndm*          rndmPtr;
148
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;
154
155   // Pointers to Standard Model couplings.
156   CoupSM*        coupSMPtr;
157
158   // Pointer to information on subcollision parton locations.
159   PartonSystems* partonSystemsPtr;
160
161   // Pointer to the total/elastic/diffractive cross sections.
162   SigmaTotal*    sigmaTotPtr;
163
164   // omitResonanceDecays omits resonance decay chains from process record.
165   void omitResonanceDecays(const Event& process); 
166
167   // subEvent extracts currently resolved partons in the hard process.
168   void subEvent(const Event& event, bool isHardest = true); 
169
170   // Have one event object around as work area.
171   Event workEvent;
172
173 };
174
175 //==========================================================================
176
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.
181
182 class SuppressSmallPT : public UserHooks {
183  
184 public:
185
186   // Constructor.
187   SuppressSmallPT( double pT0timesMIIn = 1., int numberAlphaSIn = 0, 
188     bool useSameAlphaSasMIIn = true) {isInit = false; 
189     pT0timesMI = pT0timesMIIn; numberAlphaS = numberAlphaSIn; 
190     useSameAlphaSasMI = useSameAlphaSasMIIn;}
191
192   // Possibility to modify cross section of process.
193   virtual bool canModifySigma() {return true;}
194
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 );
199
200 private:
201
202   // Save input properties and the squared pT0 scale.
203   bool   isInit, useSameAlphaSasMI;
204   int    numberAlphaS;
205   double pT0timesMI, pT20;
206
207   // Alpha_strong calculation.
208   AlphaStrong alphaS;
209
210 };
211
212 //==========================================================================
213
214 } // end namespace Pythia8
215
216 #endif // Pythia8_UserHooks_H