StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MergingHooks.h
1 // MergingHooks.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2018 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 // This file is written by Stefan Prestel.
7 // Header file to allow user access to program at different stages.
8 // HardProcess: Container class for the hard process to be merged. Holds the
9 // bookkeeping of particles not be be reclustered
10 // MergingHooks: Steering class for matrix element merging. Some functions can
11 // be redefined in a derived class to have access to the merging
12 
13 #ifndef Pythia8_MergingHooks_H
14 #define Pythia8_MergingHooks_H
15 
16 #include "Pythia8/Basics.h"
17 #include "Pythia8/BeamParticle.h"
18 #include "Pythia8/Event.h"
19 #include "Pythia8/Info.h"
20 #include "Pythia8/ParticleData.h"
21 #include "Pythia8/PartonSystems.h"
22 #include "Pythia8/PythiaStdlib.h"
23 #include "Pythia8/Settings.h"
24 
25 
26 namespace Pythia8 {
27 
28 class PartonLevel;
29 
30 //==========================================================================
31 
32 // Declaration of hard process class
33 // This class holds information on the desired hard 2->2 process
34 // for the merging.
35 // This class is a container class for History class use.
36 
37 class HardProcess {
38 
39 public:
40 
41  // Flavour of the first incoming particle
42  int hardIncoming1;
43  // Flavour of the second incoming particle
44  int hardIncoming2;
45  // Flavours of the outgoing particles
46  vector<int> hardOutgoing1;
47  vector<int> hardOutgoing2;
48  // Flavour of intermediate bosons in the hard 2->2
49  vector<int> hardIntermediate;
50 
51  // Current reference event
52  Event state;
53  // Potential positions of outgoing particles in reference event
54  vector<int> PosOutgoing1;
55  vector<int> PosOutgoing2;
56  // Potential positions of intermediate bosons in reference event
57  vector<int> PosIntermediate;
58 
59  // Information on merging scale read from LHE file
60  double tms;
61 
62  // Default constructor
63  HardProcess(){}
64  // Default destructor
65  virtual ~HardProcess(){}
66 
67  // Copy constructor
68  HardProcess( const HardProcess& hardProcessIn )
69  : state(hardProcessIn.state),
70  tms(hardProcessIn.tms) {
71  hardIncoming1 = hardProcessIn.hardIncoming1;
72  hardIncoming2 = hardProcessIn.hardIncoming2;
73  for(int i =0; i < int(hardProcessIn.hardOutgoing1.size());++i)
74  hardOutgoing1.push_back( hardProcessIn.hardOutgoing1[i]);
75  for(int i =0; i < int(hardProcessIn.hardOutgoing2.size());++i)
76  hardOutgoing2.push_back( hardProcessIn.hardOutgoing2[i]);
77  for(int i =0; i < int(hardProcessIn.hardIntermediate.size());++i)
78  hardIntermediate.push_back( hardProcessIn.hardIntermediate[i]);
79  for(int i =0; i < int(hardProcessIn.PosOutgoing1.size());++i)
80  PosOutgoing1.push_back( hardProcessIn.PosOutgoing1[i]);
81  for(int i =0; i < int(hardProcessIn.PosOutgoing2.size());++i)
82  PosOutgoing2.push_back( hardProcessIn.PosOutgoing2[i]);
83  for(int i =0; i < int(hardProcessIn.PosIntermediate.size());++i)
84  PosIntermediate.push_back( hardProcessIn.PosIntermediate[i]);
85  }
86 
87  // Constructor with path to LHE file
88  HardProcess( string LHEfile, ParticleData* particleData) {
89  state = Event();
90  state.init("(hard process)", particleData);
91  translateLHEFString(LHEfile);
92  }
93 
94  // Constructor with core process input
95  virtual void initOnProcess( string process, ParticleData* particleData);
96 
97  // Constructor with path to LHE file input
98  void initOnLHEF( string LHEfile, ParticleData* particleData);
99 
100  // Function to access the LHE file and read relevant information
101  void translateLHEFString( string LHEpath);
102 
103  // Function to translate the process string (in MG/ME notation)
104  virtual void translateProcessString( string process);
105 
106  // Function to clear hard process information
107  void clear();
108 
109  // Function to check whether the sets of candidates Pos1, Pos2, together
110  // with the proposed candidate iPos give an allowed hard process state
111  virtual bool allowCandidates(int iPos, vector<int> Pos1, vector<int> Pos2,
112  const Event& event);
113  // Function to identify the hard subprocess in the current event
114  virtual void storeCandidates( const Event& event, string process);
115  // Function to check if the particle event[iPos] matches any of
116  // the stored outgoing particles of the hard subprocess
117  virtual bool matchesAnyOutgoing(int iPos, const Event& event);
118  // Function to check if instead of the particle event[iCandidate], another
119  // particle could serve as part of the hard process. Assumes that iCandidate
120  // is already stored as part of the hard process.
121  virtual bool findOtherCandidates(int iPos, const Event& event,
122  bool doReplace);
123  // Function to exchange a stored hard process candidate with another choice.
124  virtual bool exchangeCandidates( vector<int> candidates1,
125  vector<int> candidates2, map<int,int> further1, map<int,int> further2);
126 
127  // Function to get the number of coloured final state partons in the
128  // hard process
129  int nQuarksOut();
130  // Function to get the number of uncoloured final state particles in the
131  // hard process
132  int nLeptonOut();
133  // Function to get the number of electroweak final state bosons in the
134  // hard process
135  int nBosonsOut();
136 
137  // Function to get the number of coloured initial state partons in the
138  // hard process
139  int nQuarksIn();
140  // Function to get the number of uncoloured initial state particles in the
141  // hard process
142  int nLeptonIn();
143  // Function to report if a resonace decay was found in the 2->2 sub-process
144  // of the current state
145  int hasResInCurrent();
146  // Function to report the number of resonace decays in the 2->2 sub-process
147  // of the current state
148  int nResInCurrent();
149  // Function to report if a resonace decay was found in the 2->2 hard process
150  bool hasResInProc();
151  // Function to print the hard process (for debug)
152  void list() const;
153  // Function to print the hard process candidates in the
154  // Matrix element state (for debug)
155  void listCandidates() const;
156 
157 };
158 
159 //==========================================================================
160 
161 // MergingHooks is base class for user input to the merging procedure.
162 
163 class MergingHooks {
164 
165 public:
166 
167  // Constructor.
168  MergingHooks() :
169  doUserMergingSave(false),
170  doMGMergingSave(false),
171  doKTMergingSave(false),
172  doPTLundMergingSave(false),
173  doCutBasedMergingSave(false),
174  doNL3TreeSave(false),
175  doNL3LoopSave(false),
176  doNL3SubtSave(false),
177  doUNLOPSTreeSave(false),
178  doUNLOPSLoopSave(false),
179  doUNLOPSSubtSave(false),
180  doUNLOPSSubtNLOSave(false),
181  doUMEPSTreeSave(false),
182  doUMEPSSubtSave(false),
183  doEstimateXSection(false),
184  doRemoveDecayProducts(false),
185  doOrderHistoriesSave(true),
186  doCutOnRecStateSave(false),
187  doWeakClusteringSave(false),
188  doSQCDClusteringSave(false),
189  doIgnoreEmissionsSave(true),
190  doIgnoreStepSave(true),
191  hasJetMaxLocal(false),
192  includeWGTinXSECSave(false) {
193  inputEvent = Event(); resonances.resize(0); infoPtr = 0; settingsPtr = 0;
194  particleDataPtr = 0; partonSystemsPtr = 0; useOwnHardProcess = false;
195  hardProcess = 0; stopScaleSave= 0.0; }
196 
197  // Make History class friend to allow access to advanced switches
198  friend class History;
199  // Make Pythia class friend
200  friend class Pythia;
201  // Make PartonLevel class friend
202  friend class PartonLevel;
203  // Make SpaceShower class friend
204  friend class SpaceShower;
205  // Make TimeShower class friend
206  friend class TimeShower;
207  // Make Merging class friend
208  friend class Merging;
209 
210  //----------------------------------------------------------------------//
211  // Functions that allow user interference
212  //----------------------------------------------------------------------//
213 
214  // Destructor.
215  virtual ~MergingHooks();
216  // Function encoding the functional definition of the merging scale
217  virtual double tmsDefinition( const Event& event){ return event[0].e();}
218  // Function to dampen weights calculated from histories with lowest
219  // multiplicity reclustered events that do not pass the ME cuts
220  virtual double dampenIfFailCuts( const Event& inEvent ) {
221  // Dummy statement to avoid compiler warnings
222  if(false) cout << inEvent[0].e();
223  return 1.;
224  }
225  // Hooks to disallow states in the construction of all histories, e.g.
226  // because jets are below the merging scale or fail the matrix element cuts
227  // Function to allow interference in the construction of histories
228  virtual bool canCutOnRecState() { return doCutOnRecStateSave; }
229  // Function to check reclustered state while generating all possible
230  // histories
231  // Function implementing check of reclustered events while constructing
232  // all possible histories
233  virtual bool doCutOnRecState( const Event& event ) {
234  // Dummy statement to avoid compiler warnings.
235  if(false) cout << event[0].e();
236  // Count number of final state partons.
237  int nPartons = 0;
238  for( int i=0; i < int(event.size()); ++i)
239  if( event[i].isFinal()
240  && (event[i].isGluon() || event[i].isQuark()) )
241  nPartons++;
242  // For gg -> h, allow only histories with gluons in initial state
243  if( hasEffectiveG2EW() && nPartons < 2){
244  if(event[3].id() != 21 && event[4].id() != 21)
245  return true;
246  }
247  return false;
248  }
249  // Function to allow not counting a trial emission.
250  virtual bool canVetoTrialEmission() { return false;}
251  // Function to check if trial emission should be rejected.
252  virtual bool doVetoTrialEmission( const Event&, const Event& ) {
253  return false; }
254 
255  // Function to calculate the hard process matrix element.
256  virtual double hardProcessME( const Event& inEvent ) {
257  // Dummy statement to avoid compiler warnings.
258  if ( false ) cout << inEvent[0].e();
259  return 1.; }
260 
261  // Functions for internal use inside Pythia source code
262  // Initialize.
263  virtual void init();
264  // Functions for internal use inside Pythia source code
265  // Initialize.
266  void initPtr( Settings* settingsPtrIn, Info* infoPtrIn,
267  ParticleData* particleDataPtrIn, PartonSystems* partonSystemsPtrIn)
268  { settingsPtr = settingsPtrIn; infoPtr = infoPtrIn;
269  particleDataPtr = particleDataPtrIn;
270  partonSystemsPtr = partonSystemsPtrIn;}
271 
272  //----------------------------------------------------------------------//
273  // Simple output functions
274  //----------------------------------------------------------------------//
275 
276  // Function returning the value of the merging scale.
277  double tms() {
278  if(doCutBasedMergingSave) return 0.;
279  //else return tmsValueSave;
280  else return tmsValueNow;
281  }
282  double tmsCut() {
283  if(doCutBasedMergingSave) return 0.;
284  else return tmsValueSave;
285  }
286  void tms( double tmsIn ) { tmsValueNow = tmsIn; }
287 
288  // Function returning the value of the Delta R_{ij} cut for
289  // cut based merging scale definition.
290  double dRijMS() {
291  return ((tmsListSave.size() == 3) ? tmsListSave[0] : 0.);
292  }
293  // Function returning the value of the pT_{i} cut for
294  // cut based merging scale definition.
295  double pTiMS() {
296  return ((tmsListSave.size() == 3) ? tmsListSave[1] : 0.);
297  }
298  // Function returning the value of the pT_{i} cut for
299  // cut based merging scale definition.
300  double QijMS() {
301  return ((tmsListSave.size() == 3) ? tmsListSave[2] : 0.);
302  }
303  // Function returning the value of the maximal number of merged jets.
304  int nMaxJets() { return (hasJetMaxLocal) ? nJetMaxLocal : nJetMaxSave;}
305  // Function returning the value of the maximal number of merged jets,
306  // for which NLO corrections are available.
307  int nMaxJetsNLO()
308  { return (hasJetMaxLocal) ? nJetMaxNLOLocal : nJetMaxNLOSave;}
309  // Function to return hard process string.
310  string getProcessString() { return processSave;}
311  // Function to return the number of outgoing partons in the core process
312  int nHardOutPartons(){ return hardProcess->nQuarksOut();}
313  // Function to return the number of outgoing leptons in the core process
314  int nHardOutLeptons(){ return hardProcess->nLeptonOut();}
315  // Function to return the number of outgoing electroweak bosons in the core
316  // process.
317  int nHardOutBosons(){ return hardProcess->nBosonsOut();}
318  // Function to return the number of incoming partons (hadrons) in the core
319  // process.
320  int nHardInPartons(){ return hardProcess->nQuarksIn();}
321  // Function to return the number of incoming leptons in the core process.
322  int nHardInLeptons(){ return hardProcess->nLeptonIn();}
323  // Function to report the number of resonace decays in the 2->2 sub-process
324  // of the current state.
325  int nResInCurrent(){ return hardProcess->nResInCurrent();}
326  // Function to determine if user defined merging should be applied.
327  bool doUserMerging(){ return doUserMergingSave;}
328  // Function to determine if automated MG/ME merging should be applied.
329  bool doMGMerging() { return doMGMergingSave;}
330  // Function to determine if KT merging should be applied.
331  bool doKTMerging() { return doKTMergingSave;}
332  // Function to determine if PTLund merging should be applied.
333  bool doPTLundMerging() { return doPTLundMergingSave;}
334  // Function to determine if cut based merging should be applied.
335  bool doCutBasedMerging() { return doCutBasedMergingSave;}
336  bool doCKKWLMerging() { return (doUserMergingSave || doMGMergingSave
337  || doKTMergingSave || doPTLundMergingSave || doCutBasedMergingSave); }
338  // Functions to determine if and which part of UMEPS merging
339  // should be applied
340  bool doUMEPSTree() { return doUMEPSTreeSave;}
341  bool doUMEPSSubt() { return doUMEPSSubtSave;}
342  bool doUMEPSMerging() { return (doUMEPSTreeSave || doUMEPSSubtSave);}
343  // Functions to determine if and which part of NL3 merging
344  // should be applied
345  bool doNL3Tree() { return doNL3TreeSave;}
346  bool doNL3Loop() { return doNL3LoopSave;}
347  bool doNL3Subt() { return doNL3SubtSave;}
348  bool doNL3Merging() { return (doNL3TreeSave || doNL3LoopSave
349  || doNL3SubtSave); }
350  // Functions to determine if and which part of UNLOPS merging
351  // should be applied
352  bool doUNLOPSTree() { return doUNLOPSTreeSave;}
353  bool doUNLOPSLoop() { return doUNLOPSLoopSave;}
354  bool doUNLOPSSubt() { return doUNLOPSSubtSave;}
355  bool doUNLOPSSubtNLO() { return doUNLOPSSubtNLOSave;}
356  bool doUNLOPSMerging() { return (doUNLOPSTreeSave || doUNLOPSLoopSave
357  || doUNLOPSSubtSave || doUNLOPSSubtNLOSave); }
358  // Return the number clustering steps that have actually been done.
359  int nRecluster() { return nReclusterSave;}
360 
361  // Return number of requested additional jets on top of the Born process.
362  int nRequested() { return nRequestedSave;}
363 
364  //----------------------------------------------------------------------//
365  // Output functions to analyse/prepare event for merging
366  //----------------------------------------------------------------------//
367 
368  // Function to check if event contains an emission not present in the hard
369  // process.
370  bool isFirstEmission(const Event& event);
371 
372  // Function to allow effective gg -> EW boson couplings.
373  bool hasEffectiveG2EW() {
374  if ( getProcessString().compare("pp>h") == 0 ) return true;
375  return false; }
376 
377  // Function to allow effective gg -> EW boson couplings.
378  bool allowEffectiveVertex( vector<int> in, vector<int> out) {
379  if ( getProcessString().compare("ta+ta->jj") == 0
380  || getProcessString().compare("ta-ta+>jj") == 0 ) {
381  int nInFermions(0), nOutFermions(0), nOutBosons(0);
382  for (int i=0; i < int(in.size()); ++i)
383  if (abs(in[i])<20) nInFermions++;
384  for (int i=0; i < int(out.size()); ++i) {
385  if (abs(out[i])<20) nOutFermions++;
386  if (abs(out[i])>20) nOutBosons++;
387  }
388  return (nInFermions%2==0 && nOutFermions%2==0);
389  }
390  return false;
391  }
392 
393  // Return event stripped from decay products.
394  Event bareEvent( const Event& inputEventIn, bool storeInputEvent );
395  // Write event with decay products attached to argument.
396  bool reattachResonanceDecays( Event& process );
397 
398  // Check if particle at position iPos is part of the hard sub-system
399  bool isInHard( int iPos, const Event& event);
400 
401  // Function to return the number of clustering steps for the current event
402  virtual int getNumberOfClusteringSteps(const Event& event,
403  bool resetNjetMax = false);
404 
405  //----------------------------------------------------------------------//
406  // Functions to steer contruction of histories
407  //----------------------------------------------------------------------//
408 
409  // Function to force preferred picking of ordered histories. By default,
410  // unordered histories will only be considered if no ordered histories
411  // were found.
412  void orderHistories( bool doOrderHistoriesIn) {
413  doOrderHistoriesSave = doOrderHistoriesIn; }
414  // Function to force cut on reconstructed states internally, as needed
415  // for gg -> Higgs to ensure that e.g. uu~ -> Higgs is not constructed.
416  void allowCutOnRecState( bool doCutOnRecStateIn) {
417  doCutOnRecStateSave = doCutOnRecStateIn; }
418 
419  // Function to allow final state clusterings of weak bosons
420  void doWeakClustering( bool doWeakClusteringIn ) {
421  doWeakClusteringSave = doWeakClusteringIn; }
422 
423  //----------------------------------------------------------------------//
424  // Functions used as default merging scales
425  //----------------------------------------------------------------------//
426 
427  // Function to check if the input particle is a light jet, i.e. should be
428  // checked against the merging scale defintion.
429  bool checkAgainstCut( const Particle& particle);
430  // Function to return the value of the merging scale function in the
431  // current event.
432  virtual double tmsNow( const Event& event );
433  // Find the minimal Lund pT between coloured partons in the event
434  double rhoms( const Event& event, bool withColour);
435  // Function to calculate the minimal kT in the event
436  double kTms(const Event & event);
437  // Find the if the event passes the Delta R_{ij}, pT_{i} and Q_{ij} cuts on
438  // the matrix element, as needed for cut-based merging scale definition
439  double cutbasedms( const Event& event );
440 
441  //----------------------------------------------------------------------//
442  // Functions to steer shower evolution (public to allow for PS plugin)
443  //----------------------------------------------------------------------//
444 
445  // Flag to indicate trial shower usage.
446  void doIgnoreEmissions( bool doIgnoreIn ) {
447  doIgnoreEmissionsSave = doIgnoreIn;
448  }
449  // Function to allow not counting a trial emission.
450  virtual bool canVetoEmission() { return !doIgnoreEmissionsSave; }
451  // Function to check if emission should be rejected.
452  virtual bool doVetoEmission( const Event& );
453 
454  //----------------------------------------------------------------------//
455  // Functions used as clusterings / probabilities
456  //----------------------------------------------------------------------//
457 
458  bool useShowerPluginSave;
459  virtual bool useShowerPlugin() { return useShowerPluginSave; }
460 
461  //----------------------------------------------------------------------//
462  // Functions to retrieve if merging weight should countin the internal
463  // cross section and the event weight.
464  //----------------------------------------------------------------------//
465 
466  bool includeWGTinXSEC() { return includeWGTinXSECSave;}
467 
468  //----------------------------------------------------------------------//
469  // Functions to retrieve event veto information
470  //----------------------------------------------------------------------//
471 
472  int nHardNow() { return nHardNowSave; }
473  double tmsHardNow() { return tmsHardNowSave; }
474  int nJetsNow() { return nJetNowSave; }
475  double tmsNow() { return tmsNowSave;}
476 
477  void setHardProcessPtr(HardProcess* hardProcIn) { hardProcess = hardProcIn; }
478 
479  //----------------------------------------------------------------------//
480  // The members, switches etc.
481  //----------------------------------------------------------------------//
482 
483  // Helper class doing all the core process book-keeping
484  bool useOwnHardProcess;
485  HardProcess* hardProcess;
486 
487  // Pointer to various information on the generation.
488  Info* infoPtr;
489 
490  Settings* settingsPtr;
491 
492  // Pointer to the particle data table.
493  ParticleData* particleDataPtr;
494 
495  // Pointer to the particle systems.
496  PartonSystems* partonSystemsPtr;
497 
498  PartonLevel* showers;
499  void setShowerPointer(PartonLevel* psIn ) {showers = psIn;}
500 
501  // AlphaS objects for alphaS reweighting use
502  AlphaStrong AlphaS_FSRSave;
503  AlphaStrong AlphaS_ISRSave;
504  AlphaEM AlphaEM_FSRSave;
505  AlphaEM AlphaEM_ISRSave;
506 
507  // Saved path to LHE file for more automated merging
508  string lheInputFile;
509 
510  // Flags for merging procedure definition.
511  bool doUserMergingSave, doMGMergingSave, doKTMergingSave,
512  doPTLundMergingSave, doCutBasedMergingSave,
513  includeMassiveSave, enforceStrongOrderingSave, orderInRapiditySave,
514  pickByFullPSave, pickByPoPT2Save, includeRedundantSave,
515  pickBySumPTSave, allowColourShufflingSave, resetHardQRenSave,
516  resetHardQFacSave;
517  int unorderedScalePrescipSave, unorderedASscalePrescipSave,
518  unorderedPDFscalePrescipSave, incompleteScalePrescipSave,
519  ktTypeSave, nReclusterSave, nQuarksMergeSave, nRequestedSave;
520 
521  double scaleSeparationFactorSave, nonJoinedNormSave,
522  fsrInRecNormSave, herwigAcollFSRSave, herwigAcollISRSave,
523  pT0ISRSave, pTcutSave;
524  bool doNL3TreeSave, doNL3LoopSave, doNL3SubtSave;
525  bool doUNLOPSTreeSave, doUNLOPSLoopSave, doUNLOPSSubtSave,
526  doUNLOPSSubtNLOSave;
527  bool doUMEPSTreeSave, doUMEPSSubtSave;
528 
529  // Flag to only do phase space cut, rejecting events below the tms cut.
530  bool doEstimateXSection;
531 
532  bool applyVeto;
533 
534  // Save input event in case decay products need to be detached.
535  Event inputEvent;
536  vector< pair<int,int> > resonances;
537  bool doRemoveDecayProducts;
538 
539  // Starting scale for attaching MPI.
540  double muMISave;
541 
542  // Precalculated K-factors.
543  double kFactor0jSave;
544  double kFactor1jSave;
545  double kFactor2jSave;
546 
547  // Saved members.
548  double tmsValueSave, tmsValueNow, DparameterSave;
549  int nJetMaxSave;
550  int nJetMaxNLOSave;
551 
552  string processSave;
553 
554  // List of cut values to used to define a merging scale. Ordering:
555  // 0: DeltaR_{jet_i,jet_j,min}
556  // 1: p_{T,jet_i,min}
557  // 2: Q_{jet_i,jet_j,min}
558  vector<double> tmsListSave;
559 
560  // INTERNAL Hooks to allow construction of all histories,
561  // including un-ordered ones
562  bool doOrderHistoriesSave;
563 
564  // INTERNAL Hooks to disallow states in the construction of all histories,
565  // e.g. because jets are below the merging scale, of to avoid the
566  // construction of uu~ -> Higgs histories.
567  bool doCutOnRecStateSave;
568 
569  // INTERNAL Hooks to allow clustering W bosons.
570  bool doWeakClusteringSave, doSQCDClusteringSave;
571 
572  // Store / get first scale in PDF's that Pythia should have used
573  double muFSave;
574  double muRSave;
575 
576  // Store / get factorisation scale used in matrix element calculation.
577  double muFinMESave;
578  double muRinMESave;
579 
580  // Flag to indicate trial shower usage.
581  bool doIgnoreEmissionsSave;
582  // Flag to indicate if events should be vetoed.
583  bool doIgnoreStepSave;
584  // Stored weights in case veot needs to be revoked
585  double pTsave;
586  double weightCKKWL1Save, weightCKKWL2Save;
587  int nMinMPISave;
588  // Save CKKW-L weight / O(\alpha_s) weight.
589  double weightCKKWLSave, weightFIRSTSave;
590 
591  // Local copies of nJetMax inputs, if recalculation is necessary.
592  int nJetMaxLocal;
593  int nJetMaxNLOLocal;
594  bool hasJetMaxLocal;
595 
596  // Event veto and hard process information, if veto should not applied be
597  // directly, but is up to the user.
598  bool includeWGTinXSECSave;
599  int nHardNowSave, nJetNowSave;
600  double tmsHardNowSave, tmsNowSave;
601 
602  //----------------------------------------------------------------------//
603  // Generic setup functions
604  //----------------------------------------------------------------------//
605 
606  // Function storing candidates for the hard process in the current event
607  // Needed in order not to cluster members of the core process
608  void storeHardProcessCandidates(const Event& event){
609  hardProcess->storeCandidates(event,getProcessString());
610  }
611 
612  // Function to set the path to the LHE file, so that more automated merging
613  // can be used.
614  // Remove "_1.lhe" suffix from LHE file name.
615  // This is done so that the HarsProcess class can access both the +0 and +1
616  // LHE files to find both the merging scale and the core process string
617  // Store.
618  void setLHEInputFile( string lheFile) {
619  lheInputFile = lheFile.substr(0,lheFile.size()-6); }
620 
621  //----------------------------------------------------------------------//
622  // Functions for output of class members.
623  //----------------------------------------------------------------------//
624 
625  // Return AlphaStrong objects
626  AlphaStrong* AlphaS_FSR() { return &AlphaS_FSRSave;}
627  AlphaStrong* AlphaS_ISR() { return &AlphaS_ISRSave;}
628  AlphaEM* AlphaEM_FSR() { return &AlphaEM_FSRSave;}
629  AlphaEM* AlphaEM_ISR() { return &AlphaEM_ISRSave;}
630 
631  // Functions to return advanced merging switches
632  // Include masses in definition of evolution pT and splitting kernels
633  bool includeMassive() { return includeMassiveSave;}
634  // Prefer strongly ordered histories
635  bool enforceStrongOrdering() { return enforceStrongOrderingSave;}
636  // Prefer histories ordered in rapidity and evolution pT
637  bool orderInRapidity() { return orderInRapiditySave;}
638  // Pick history probabilistically by full (correct) splitting probabilities
639  bool pickByFull() { return pickByFullPSave;}
640  // Pick history probabilistically, with easier form of probabilities
641  bool pickByPoPT2() { return pickByPoPT2Save;}
642  // Include redundant terms (e.g. PDF ratios) in the splitting probabilities
643  bool includeRedundant(){ return includeRedundantSave;}
644  // Pick by winner-takes-it-all, with minimum sum of scalar evolution pT
645  bool pickBySumPT(){ return pickBySumPTSave;}
646 
647  // Prescription for combined scale of unordered emissions
648  // 0 : use larger scale
649  // 1 : use smaller scale
650  int unorderedScalePrescip() { return unorderedScalePrescipSave;}
651  // Prescription for combined scale used in alpha_s for unordered emissions
652  // 0 : use combined emission scale in alpha_s weight for both (!) splittings
653  // 1 : use original reclustered scales of each emission in alpha_s weight
654  int unorderedASscalePrescip() { return unorderedASscalePrescipSave;}
655  // Prescription for combined scale used in PDF ratios for unordered
656  // emissions
657  // 0 : use combined emission scale in PDFs for both (!) splittings
658  // 1 : use original reclustered scales of each emission in PDF ratiost
659  int unorderedPDFscalePrescip() { return unorderedPDFscalePrescipSave;}
660  // Prescription for starting scale of incomplete histories
661  // 0: use factorization scale
662  // 1: use sHat
663  // 2: use s
664  int incompleteScalePrescip() { return incompleteScalePrescipSave;}
665 
666  // Allow swapping one colour index while reclustering
667  bool allowColourShuffling() { return allowColourShufflingSave;}
668 
669  // Allow use of dynamical renormalisation scale of the core 2-> 2 process.
670  bool resetHardQRen() { return resetHardQRenSave; }
671  // Allow use of dynamical factorisation scale of the core 2-> 2 process.
672  bool resetHardQFac() { return resetHardQFacSave; }
673 
674  // Factor by which two scales should differ to be classified strongly
675  // ordered.
676  double scaleSeparationFactor() { return scaleSeparationFactorSave;}
677  // Absolute normalization of splitting probability for non-joined
678  // evolution.
679  double nonJoinedNorm() { return nonJoinedNormSave;}
680  // Absolute normalization of splitting probability for final state
681  // splittings with initial state recoiler
682  double fsrInRecNorm() { return fsrInRecNormSave;}
683  // Factor multiplying scalar evolution pT for FSR splitting, when picking
684  // history by minimum scalar pT (see Jonathan Tully's thesis)
685  double herwigAcollFSR() { return herwigAcollFSRSave;}
686  // Factor multiplying scalar evolution pT for ISR splitting, when picking
687  // history by minimum scalar pT (see Jonathan Tully's thesis)
688  double herwigAcollISR() { return herwigAcollISRSave;}
689  // ISR regularisation scale
690  double pT0ISR() { return pT0ISRSave;}
691  // Shower cut-off scale
692  double pTcut() { return pTcutSave;}
693 
694  // MI starting scale.
695  void muMI( double mu) { muMISave = mu; }
696  double muMI() { return muMISave;}
697 
698  // Full k-Factor for current event
699  double kFactor(int njet = 0) {
700  return (njet == 0) ? kFactor0jSave
701  :(njet == 1) ? kFactor1jSave
702  : kFactor2jSave;
703  }
704  // O(\alhpa_s)-term of the k-Factor for current event
705  double k1Factor( int njet = 0) {
706  return (kFactor(njet) - 1)/infoPtr->alphaS();
707  }
708 
709  // Function to return if construction of histories is biased towards ordered
710  // histories.
711  bool orderHistories() { return doOrderHistoriesSave;}
712 
713  // INTERNAL Hooks to disallow states in the construction of all histories,
714  // e.g. because jets are below the merging scale, of to avoid the
715  // construction of uu~ -> Higgs histories.
716  bool allowCutOnRecState() { return doCutOnRecStateSave;}
717 
718  // INTERNAL Hooks to allow clustering W bosons.
719  bool doWeakClustering() { return doWeakClusteringSave;}
720  // INTERNAL Hooks to allow clustering clustering of gluons to squarks.
721  bool doSQCDClustering() { return doSQCDClusteringSave;}
722 
723  // Store / get first scale in PDF's that Pythia should have used
724  double muF() { return (muFSave > 0.) ? muFSave : infoPtr->QFac();}
725  double muR() { return (muRSave > 0.) ? muRSave : infoPtr->QRen();}
726  // Store / get factorisation scale used in matrix element calculation.
727  double muFinME() {
728  // Start with checking the event attribute called "muf".
729  string mus = infoPtr->getEventAttribute("muf2",true);
730  double mu = (mus.empty()) ? 0. : atof((char*)mus.c_str());
731  mu = sqrt(mu);
732  // Check the scales tag of the event.
733  if (infoPtr->scales) mu = infoPtr->getScalesAttribute("muf");
734  return (mu > 0.) ? mu : (muFinMESave > 0.) ? muFinMESave : infoPtr->QFac();
735  }
736  double muRinME() {
737  // Start with checking the event attribute called "mur2".
738  string mus = infoPtr->getEventAttribute("mur2",true);
739  double mu = (mus.empty()) ? 0. : atof((char*)mus.c_str());
740  mu = sqrt(mu);
741  // Check the scales tag of the event.
742  if (infoPtr->scales) mu = infoPtr->getScalesAttribute("mur");
743  return (mu > 0.) ? mu : (muRinMESave > 0.) ? muRinMESave : infoPtr->QRen();
744  }
745 
746 
747  //----------------------------------------------------------------------//
748  // Functions to steer merging code
749  //----------------------------------------------------------------------//
750 
751  // Flag to indicate if events should be vetoed.
752  void doIgnoreStep( bool doIgnoreIn ) { doIgnoreStepSave = doIgnoreIn; }
753  // Function to allow event veto.
754  virtual bool canVetoStep() { return !doIgnoreStepSave; }
755 
756  // Stored weights in case veto needs to be revoked
757  void storeWeights( double weight ){ weightCKKWL1Save = weightCKKWL2Save
758  = weight; }
759 
760  // Function to check event veto.
761  virtual bool doVetoStep( const Event& process, const Event& event,
762  bool doResonance = false );
763 
764  // Set starting scales
765  virtual bool setShowerStartingScales( bool isTrial, bool doMergeFirstEmm,
766  double& pTscaleIn, const Event& event,
767  double& pTmaxFSRIn, bool& limitPTmaxFSRin,
768  double& pTmaxISRIn, bool& limitPTmaxISRin,
769  double& pTmaxMPIIn, bool& limitPTmaxMPIin );
770 
771  // Set shower stopping scale. Necessary to e.g. avoid accumulation of
772  // incorrect (low-pT) shower weights through trial showering.
773  double stopScaleSave;
774  void setShowerStoppingScale( double scale = 0.) { stopScaleSave = scale;}
775  double getShowerStoppingScale() { return stopScaleSave;}
776 
777  void nMinMPI( int nMinMPIIn ) { nMinMPISave = nMinMPIIn; }
778  int nMinMPI() { return nMinMPISave;}
779 
780  //----------------------------------------------------------------------//
781  // Functions for internal merging scale definions
782  //----------------------------------------------------------------------//
783 
784  // Function to calculate the kT separation between two particles
785  double kTdurham(const Particle& RadAfterBranch,
786  const Particle& EmtAfterBranch, int Type, double D );
787  // Function to compute "pythia pT separation" from Particle input
788  double rhoPythia(const Event& event, int rad, int emt, int rec,
789  int ShowerType);
790 
791  // Function to find a colour (anticolour) index in the input event,
792  // used to find colour-connected recoilers
793  int findColour(int col, int iExclude1, int iExclude2,
794  const Event& event, int type, bool isHardIn);
795  // Function to compute Delta R separation from 4-vector input
796  double deltaRij(Vec4 jet1, Vec4 jet2);
797 
798  //----------------------------------------------------------------------//
799  // Functions for weight management
800  //----------------------------------------------------------------------//
801 
802  // Function to get the CKKW-L weight for the current event
803  double getWeightNLO() { return (weightCKKWLSave - weightFIRSTSave);}
804  // Return CKKW-L weight.
805  double getWeightCKKWL() { return weightCKKWLSave; }
806  // Return O(\alpha_s) weight.
807  double getWeightFIRST() { return weightFIRSTSave; }
808  // Set CKKW-L weight.
809  void setWeightCKKWL( double weightIn){
810  weightCKKWLSave = weightIn;
811  if ( !includeWGTinXSEC() ) infoPtr->setWeightCKKWL(weightIn); }
812  // Set O(\alpha_s) weight.
813  void setWeightFIRST( double weightIn){
814  weightFIRSTSave = weightIn;
815  infoPtr->setWeightFIRST(weightIn); }
816 
817 
818  //----------------------------------------------------------------------//
819  // Functions and members to store the event veto information
820  //----------------------------------------------------------------------//
821 
822  // Set CKKWL veto information.
823  void setEventVetoInfo(int nJetNowIn, double tmsNowIn) {
824  nJetNowSave = nJetNowIn; tmsNowSave = tmsNowIn; }
825 
826  // Set the hard process information.
827  void setHardProcessInfo(int nHardNowIn, double tmsHardNowIn) {
828  nHardNowSave = nHardNowIn; tmsHardNowSave = tmsHardNowIn; }
829 
830 };
831 
832 //==========================================================================
833 
834 } // end namespace Pythia8
835 
836 #endif // Pythia8_MergingHooks_H
Definition: AgUStep.h:26