StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DireMergingHooks.h
1 // DireMergingHooks.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2020 Stefan Prestel, Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
4 // Please respect the MCnet Guidelines, see GUIDELINES for details.
5 
6 // Header file for Dire merging hooks.
7 
8 #ifndef Pythia8_DireMergingHooks_H
9 #define Pythia8_DireMergingHooks_H
10 
11 #define DIRE_MERGINGHOOKS_VERSION "2.002"
12 
13 #include "Pythia8/Basics.h"
14 #include "Pythia8/BeamParticle.h"
15 #include "Pythia8/Event.h"
16 #include "Pythia8/Info.h"
17 #include "Pythia8/ParticleData.h"
18 #include "Pythia8/PartonSystems.h"
19 #include "Pythia8/PythiaStdlib.h"
20 #include "Pythia8/Settings.h"
21 
22 #include "Pythia8/DireBasics.h"
23 
24 namespace Pythia8 {
25 
26 class PartonLevel;
27 
28 //==========================================================================
29 
30 // Declaration of hard process class
31 // This class holds information on the desired hard 2->2 process
32 // for the merging.
33 // This class is a container class for History class use.
34 
35 class DireHardProcess : public HardProcess {
36 
37 public:
38 
39 
40  // Constructor with core process input
41  void initOnProcess( string process, ParticleData* particleData);
42 
43  // Function to translate the process string (in MG/ME notation)
44  void translateProcessString( string process);
45 
46  // Function to check whether the sets of candidates Pos1, Pos2, together
47  // with the proposed candidate iPos give an allowed hard process state
48  bool allowCandidates(int iPos, vector<int> Pos1, vector<int> Pos2,
49  const Event& event);
50  // Function to identify the hard subprocess in the current event
51  void storeCandidates( const Event& event, string process);
52  // Function to check if the particle event[iPos] matches any of
53  // the stored outgoing particles of the hard subprocess
54  bool matchesAnyOutgoing(int iPos, const Event& event);
55  // Function to check if instead of the particle event[iCandidate], another
56  // particle could serve as part of the hard process. Assumes that iCandidate
57  // is already stored as part of the hard process.
58  bool findOtherCandidates(int iPos, const Event& event, bool doReplace);
59  // Function to exchange a stored hard process candidate with another choice.
60  bool exchangeCandidates( vector<int> candidates1, vector<int> candidates2,
61  unordered_map<int,int> further1, unordered_map<int,int> further2);
62 
63 };
64 
65 //==========================================================================
66 
67 // DireMergingHooks is base class for user input to the merging procedure.
68 
70 
71 public:
72 
73  // Function to return the number of clustering steps for the current event
74  virtual int getNumberOfClusteringSteps(const Event& event,
75  bool resetNjetMax = false);
76 
77  // Functions used as default merging scales.
78 
79  // Function to check if the input particle is a light jet, i.e. should be
80  // checked against the merging scale defintion.
81  bool checkAgainstCut( const Particle& particle);
82  // Function to return the value of the merging scale function in the
83  // current event.
84  double tmsNow( const Event& event );
85  // Find the minimal Lund pT between coloured partons in the event
86  //double scalems( const Event& event, bool withColour);
87  double scalems( const Event& event);
88 
89  // Functions to steer shower evolution (public to allow for PS plugin).
90 
91  // Flag to indicate trial shower usage.
92  void doIgnoreEmissions( bool doIgnoreIn ) {
93  doIgnoreEmissionsSave = doIgnoreIn;
94  }
95  // Function to allow not counting a trial emission.
96  bool canVetoEmission() { return !doIgnoreEmissionsSave; }
97  // Function to check if emission should be rejected.
98  bool doVetoEmission( const Event& );
99 
100  void init();
101 
102 protected:
103 
104  // Functions to steer merging code.
105 
106  // Flag to indicate if events should be vetoed.
107  void doIgnoreStep( bool doIgnoreIn ) { doIgnoreStepSave = doIgnoreIn; }
108  // Function to allow event veto.
109  bool canVetoStep() { return !doIgnoreStepSave; }
110 
111 public:
112 
113  // Function to check event veto.
114  virtual bool doVetoStep( const Event& process, const Event& event,
115  bool doResonance = false );
116 
117  // Set starting scales
118  virtual bool setShowerStartingScales( bool isTrial, bool doMergeFirstEmm,
119  double& pTscaleIn, const Event& event,
120  double& pTmaxFSRIn, bool& limitPTmaxFSRin,
121  double& pTmaxISRIn, bool& limitPTmaxISRin,
122  double& pTmaxMPIIn, bool& limitPTmaxMPIin );
123 
124  bool doMOPSSave;
125  bool doMOPS() { return doMOPSSave; }
126 
127  bool doMEMSave;
128  bool doMEM() { return doMEMSave; }
129 
130  vector<double> stoppingScales() { return stoppingScalesSave; }
131 
132 protected:
133 
134  // Functions for internal merging scale definions.
135 
136  // Function to compute "pythia pT separation" from Particle input
137  double rhoPythia(const Event& event, int rad, int emt, int rec,
138  int ShowerType);
139 
140  // Function to find a colour (anticolour) index in the input event,
141  // used to find colour-connected recoilers
142  int findColour(int col, int iExclude1, int iExclude2,
143  const Event& event, int type, bool isHardIn);
144 
145  bool isInit, isStored;
146  void store();
147  void restore();
148 
149  // Member variables to store and restore to.
150  int nReclusterStore, nRequestedStore, nJetMaxStore, nJetMaxNLOStore,
151  nMinMPIStore, nJetMaxLocalStore, nJetMaxNLOLocalStore, nHardNowStore,
152  nJetNowStore;
153  double pT0ISRStore, pTcutStore, muMIStore, tmsValueStore, tmsValueNowStore,
154  DparameterStore, muFStore, muRStore, muFinMEStore, muRinMEStore,
155  pTstore, tmsHardNowStore, tmsNowStore;
156  bool doOrderHistoriesStore, doIgnoreEmissionsStore, doIgnoreStepStore,
157  hasJetMaxLocalStore;
158  Event inputEventStore;
159  vector< pair<int,int> > resonancesStore;
160  HardProcess hardProcessStore;
161 
162  vector<double> stoppingScalesSave;
163 
164 };
165 
166 //==========================================================================
167 
168 } // end namespace Pythia8
169 
170 #endif // end Pythia8_DireMergingHooks_H