PYTHIA
8.303

#include <Merging.h>
Public Member Functions  
Merging ()  
Constructor.  
virtual  ~Merging () 
Destructor.  
void  initPtrs (MergingHooksPtr mergingHooksPtrIn, PartonLevel *trialPartonLevelPtrIn) 
Initialisation function for internal use inside Pythia source code.  
virtual void  init () 
Initialisation function for internal use inside Pythia source code. More...  
virtual void  statistics () 
Function to print statistics. More...  
virtual int  mergeProcess (Event &process) 
Function to steer different merging prescriptions. More...  
Public Member Functions inherited from PhysicsBase  
void  initInfoPtr (Info &infoPtrIn) 
This function is called from above for physics objects used in a run. More...  
virtual  ~PhysicsBase () 
Empty virtual destructor.  
bool  flag (string key) const 
Shorthand to read settings values.  
int  mode (string key) const 
double  parm (string key) const 
string  word (string key) const 
Protected Member Functions  
int  mergeProcessCKKWL (Event &process) 
Function to perform CKKWL merging on the event. More...  
int  mergeProcessUMEPS (Event &process) 
Function to perform UMEPS merging on the event. More...  
int  mergeProcessNL3 (Event &process) 
Function to perform NL3 NLO merging on the event. More...  
int  mergeProcessUNLOPS (Event &process) 
Function to perform UNLOPS merging on the event. More...  
bool  cutOnProcess (Event &process) 
Function to apply the merging scale cut on an input event. More...  
Protected Member Functions inherited from PhysicsBase  
PhysicsBase ()  
Default constructor.  
virtual void  onInitInfoPtr () 
virtual void  onBeginEvent () 
This function is called in the very beginning of each Pythia::next call.  
virtual void  onEndEvent (Status) 
virtual void  onStat () 
This function is called from the Pythia::stat() call.  
void  registerSubObject (PhysicsBase &pb) 
Register a sub object that should have its information in sync with this.  
Protected Attributes  
PartonLevel *  trialPartonLevelPtr 
Pointer to trial PartonLevel object.  
MergingHooksPtr  mergingHooksPtr 
Pointer to trial MergingHooks object.  
double  tmsNowMin 
Minimal value found for the merging scale in events. More...  
Protected Attributes inherited from PhysicsBase  
Info *  infoPtr = {} 
Settings *  settingsPtr = {} 
Pointer to the settings database.  
ParticleData *  particleDataPtr = {} 
Pointer to the particle data table.  
HadronWidths *  hadronWidthsPtr = {} 
Pointer to the hadron widths data table.  
Rndm *  rndmPtr = {} 
Pointer to the random number generator.  
CoupSM *  coupSMPtr = {} 
Pointers to SM and SUSY couplings.  
CoupSUSY *  coupSUSYPtr = {} 
BeamParticle *  beamAPtr = {} 
BeamParticle *  beamBPtr = {} 
BeamParticle *  beamPomAPtr = {} 
BeamParticle *  beamPomBPtr = {} 
BeamParticle *  beamGamAPtr = {} 
BeamParticle *  beamGamBPtr = {} 
BeamParticle *  beamVMDAPtr = {} 
BeamParticle *  beamVMDBPtr = {} 
PartonSystems *  partonSystemsPtr = {} 
Pointer to information on subcollision parton locations.  
SigmaTotal *  sigmaTotPtr = {} 
Pointer to the total/elastic/diffractive cross sections.  
set< PhysicsBase * >  subObjects 
UserHooksPtr  userHooksPtr 
Static Protected Attributes  
static const double  TMSMISMATCH = 1.5 
The Merging class. More...  
Friends  
class  Pythia 
The members. More...  
Additional Inherited Members  
Public Types inherited from PhysicsBase  
enum  Status { INCOMPLETE = 1, COMPLETE = 0, CONSTRUCTOR_FAILED, INIT_FAILED, LHEF_END, LOWENERGY_FAILED, PROCESSLEVEL_FAILED, PROCESSLEVEL_USERVETO, MERGING_FAILED, PARTONLEVEL_FAILED, PARTONLEVEL_USERVETO, HADRONLEVEL_FAILED, CHECK_FAILED, OTHER_UNPHYSICAL, HEAVYION_FAILED } 
Enumerate the different status codes the event generation can have.  

protected 
Function to apply the merging scale cut on an input event.
Save number of looping steps
For now, prefer construction of ordered histories.
For pp > h, allow cut on state, so that underlying processes can be clustered to gg > h
Reset any incoming spins for W+.
Prepare process record for merging. If Pythia has already decayed resonances used to define the hard process, remove resonance decay products.
Store candidates for the splitting V > qqbar'
Check if event passes the merging scale cut.
Get merging scale in current event.
Calculate number of clustering steps
Too few steps can be possible if a chain of resonance decays has been removed. In this case, reject this event, since it will be handled in lowermultiplicity samples.
Reset the minimal tms value, if necessary.
Potentially recluster real emission jets for powheg input containing "too many" jets, i.e. realemission kinematics.
Get random number to choose a path.
Set dummy process scale.
Generate all histories
Project histories onto desired branches, e.g. only ordered paths.
Remove real emission events without underlying Born configuration from the loop sample, since such states will be taken care of by treelevel samples.
Cut if no history passes the cut on the lowestmultiplicity state.
Do not apply cut if the configuration could not be projected onto an underlying born configuration.
Now enfore merging scale cut if the event did not pass the merging scale criterion.
Check if more steps should be taken.
Done if no realemission jets are present.
Now cut on events that contain an additional realemission jet. Perform one reclustering for real emission kinematics, then apply merging scale cut on underlying Born kinematics.
Initialise temporary output of reclustering.
Recluster once.
Veto if underlying Born kinematics do not pass merging scale cut.
Done if only interested in cross section estimate after cuts.

virtual 
Initialisation function for internal use inside Pythia source code.
Initialise Merging class.
Reset minimal tms value.
Reimplemented in DireMerging.

virtual 
Function to steer different merging prescriptions.
Reinitialise hard process.
Ensure that merging weight is not counted twice.
Possibility to apply merging scale to an input event.
Done if only a cut should be applied.
Possibility to perform CKKWL merging on this event.
Possibility to perform UMEPS merging on this event.
Possibility to perform NL3 NLO merging on this event.
Possibility to perform UNLOPS merging on this event.
Reimplemented in DireMerging.

protected 
Function to perform CKKWL merging on the event.
Function to perform CKKWL merging on this event.
Ensure that merging hooks to not veto events in the trial showers.
For pp > h, allow cut on state, so that underlying processes can be clustered to gg > h
For now, prefer construction of ordered histories.
Ensure that merging weight is not counted twice.
Reset weight of the event.
Prepare process record for merging. If Pythia has already decayed resonances used to define the hard process, remove resonance decay products.
Reset any incoming spins for W+.
Store candidates for the splitting V > qqbar'.
Check if event passes the merging scale cut.
Get merging scale in current event.
Calculate number of clustering steps.
Check if hard event cut should be applied later.
Too few steps can be possible if a chain of resonance decays has been removed. In this case, reject this event, since it will be handled in lowermultiplicity samples.
Store hard event cut information, reset veto information.
Reset the minimal tms value, if necessary.
Get random number to choose a path.
Set dummy process scale.
Generate all histories.
Project histories onto desired branches, e.g. only ordered paths.
Setup the selected path. Needed for
Do not apply cut if the configuration could not be projected onto an underlying born configuration.
Enfore merging scale cut if the event did not pass the merging scale criterion.
return 1;
Check if more steps should be taken.
Calculate CKKWL weight: Perform reweighting with Sudakov factors, save alpha_s ratios and PDF ratio weights.
Event with production scales set for further (trial) showering and starting conditions for the shower.
If necessary, reattach resonance decay products.
Allow to dampen histories in which the lowest multiplicity reclustered state does not pass the lowest multiplicity cut of the matrix element.
Save the weight of the event for histogramming. Only change the event weight after trial shower on the matrix element multiplicity event (= in doVetoStep).
Save the weight of the event for histogramming.
Update the event weight.
In this case, central merging weight goes into nominal weight, all variations are saved relative to central merging weight
Allow merging hooks to veto events from now on.
If noemission probability is zero.
Done

protected 
Function to perform NL3 NLO merging on the event.
Function to perform NL3 NLO merging on this event.
Initialise which part of NL3 merging is applied.
Ensure that hooks (NL3 part) to not remove emissions.
Ensure that hooks (CKKWL part) to not veto events in trial showers.
For pp > h, allow cut on state, so that underlying processes can be clustered to gg > h
For now, prefer construction of ordered histories.
Reset weight of the event
Reset the O(alphaS)term of the CKKWL weight.
Prepare process record for merging. If Pythia has already decayed resonances used to define the hard process, remove resonance decay products.
Store candidates for the splitting V > qqbar'
Check if event passes the merging scale cut.
Get merging scale in current event.
Calculate number of clustering steps
Too few steps can be possible if a chain of resonance decays has been removed. In this case, reject this event, since it will be handled in lowermultiplicity samples.
Reset the minimal tms value, if necessary.
Enfore merging scale cut if the event did not pass the merging scale criterion.
Get random number to choose a path.
Set dummy process scale.
Generate all histories
Project histories onto desired branches, e.g. only ordered paths.
Discard states that cannot be projected unto a state with one less jet.
Potentially recluster real emission jets for powheg input containing "too many" jets, i.e. realemission kinematics.
Perform one reclustering for real emission kinematics, then apply merging scale cut on underlying Born kinematics.
Initialise temporary output of reclustering.
Recluster once.
Veto if underlying Born kinematics do not pass merging scale cut.
Remember number of jets, to include correct MPI noemission probabilities.
Calculate weight Do LO or first part of NLO treelevel reweighting
Perform reweighting with Sudakov factors, save as ratios and PDF ratio weights
No reweighting, just set event scales properly and incorporate MPI noemission probabilities.
Event with production scales set for further (trial) showering and starting conditions for the shower
For sutraction of nStepsadditional resolved partons from the nSteps1 parton phase space, recluster the last parton in nStepsparton events, and sutract later
Function to return the reclustered event
Allow to dampen histories in which the lowest multiplicity reclustered state does not pass the lowest multiplicity cut of the matrix element
Save the weight of the event for histogramming. Only change the event weight after trial shower on the matrix element multiplicity event (= in doVetoStep)
For tree level samples in NL3, rescale with kFactor
Find kfactor
For NLO merging, rescale CKKWL weight with kfactor
Save the weight of the event for histogramming
Check if we need to subtract the O()term. If the number of additional partons is larger than the number of jets for which loop matrix elements are available, do standard CKKWL
Now begin NLO part for treelevel events
Calculate the O()term of the CKKWL weight
If necessary, also dampen the O()term
Set the subtractive weight to the value calculated so far
Subtract the O()term from the CKKWL weight If PDF contributions have not been included, subtract these later
Set qcd 2>2 starting scale different from arbirtrary scale in LHEF! –> Set to pT of partons
For pure QCD dijet events (only!), set the process scale to the transverse momentum of the outgoing partons.
Reset hard process candidates (changed after clustering a parton).
If necessary, reattach resonance decay products.
Allow merging hooks (NL3 part) to remove emissions from now on.
Allow merging hooks (CKKWL part) to veto events from now on.
Done

protected 
Function to perform UMEPS merging on the event.
Function to perform UMEPS merging on this event.
Initialise which part of UMEPS merging is applied.
Save number of looping steps
Ensure that merging hooks does not remove emissions.
For pp > h, allow cut on state, so that underlying processes can be clustered to gg > h
For now, prefer construction of ordered histories.
Ensure that merging weight is not counted twice.
Reset any incoming spins for W+.
Reset weights of the event.
Prepare process record for merging. If Pythia has already decayed resonances used to define the hard process, remove resonance decay products.
Store candidates for the splitting V > qqbar'.
Check if event passes the merging scale cut.
Get merging scale in current event.
Calculate number of clustering steps.
Check if hard event cut should be applied later.
Too few steps can be possible if a chain of resonance decays has been removed. In this case, reject this event, since it will be handled in lowermultiplicity samples.
Reset the minimal tms value, if necessary.
Get random number to choose a path.
Set dummy process scale.
Generate all histories.
Project histories onto desired branches, e.g. only ordered paths.
Do not apply cut if the configuration could not be projected onto an underlying born configuration.
Enfore merging scale cut if the event did not pass the merging scale criterion.
Check reclustering steps to correctly apply MPI.
Discard if the state could not be reclustered to a state above TMS.
Calculate CKKWL weight: Perform reweighting with Sudakov factors, save alpha_s ratios and PDF ratio weights.
Event with production scales set for further (trial) showering and starting conditions for the shower.
Do reclustering (looping) steps.
Allow to dampen histories in which the lowest multiplicity reclustered state does not pass the lowest multiplicity cut of the matrix element
Save the weight of the event for histogramming. Only change the event weight after trial shower on the matrix element multiplicity event (= in doVetoStep)
Save the weight of the event for histogramming.
Update the event weight.
In this case, central merging weight goes into nominal weight, all variations are saved relative to central merging weight
Set QCD 2>2 starting scale different from arbitrary scale in LHEF! –> Set to minimal mT of partons.
For pure QCD dijet events (only!), set the process scale to the transverse momentum of the outgoing partons. Calculate number of clustering steps.
Reset hard process candidates (changed after clustering a parton).
If necessary, reattach resonance decay products.
Allow merging hooks to remove emissions from now on.
If noemission probability is zero.
Done

protected 
Function to perform UNLOPS merging on the event.
Function to perform UNLOPS merging on this event.
Initialise which part of UNLOPS merging is applied.
Save number of looping steps
Ensure that merging hooks to not remove emissions
For now, prefer construction of ordered histories.
For pp > h, allow cut on state, so that underlying processes can be clustered to gg > h
Reset weight of the event.
Reset the O(alphaS)term of the UMEPS weight.
Vectors for UNLOPSP and UNLOPSPC weights
Check if scheme variations activated, and if so, reset
Prepare process record for merging. If Pythia has already decayed resonances used to define the hard process, remove resonance decay products.
Store candidates for the splitting V > qqbar'
Check if event passes the merging scale cut.
Get merging scale in current event.
Calculate number of clustering steps
Check if hard event cut should be applied later.
Too few steps can be possible if a chain of resonance decays has been removed. In this case, reject this event, since it will be handled in lowermultiplicity samples.
Reset the minimal tms value, if necessary.
Get random number to choose a path.
Set dummy process scale.
Generate all histories
Project histories onto desired branches, e.g. only ordered paths.
Do not apply cut if the configuration could not be projected onto an underlying born configuration.
Enfore merging scale cut if the event did not pass the merging scale criterion.
Potentially recluster real emission jets for powheg input containing "too many" jets, i.e. realemission kinematics.
Remove real emission events without underlying Born configuration from the loop sample, since such states will be taken care of by treelevel samples.
Discard if the state could not be reclustered to any state above TMS.
Check reclustering steps to correctly apply MPI.
Perform one reclustering for real emission kinematics, then apply merging scale cut on underlying Born kinematics.
Initialise temporary output of reclustering.
Recluster once.
Veto if underlying Born kinematics do not pass merging scale cut.
New UNLOPS strategy based on UN2LOPS.
Calculate weights. Do LO or first part of NLO treelevel reweighting
Perform reweighting with Sudakov factors, save as ratios and PDF ratio weights
Set event scales properly, reweight for new UNLOPS
Set event scales properly, reweight for new UNLOPS
Perform reweighting with Sudakov factors, save as ratios and PDF ratio weights
Set weights for UNLOPSP and UNLOPSPC
Event with production scales set for further (trial) showering and starting conditions for the shower.
Do reclustering (looping) steps.
Allow to dampen histories in which the lowest multiplicity reclustered state does not pass the lowest multiplicity cut of the matrix element
Save the weight of the event for histogramming. Only change the event weight after trial shower on the matrix element multiplicity event (= in doVetoStep)
For treelevel or subtractive samples, rescale with kFactor
Find kfactor
For NLO merging, rescale CKKWL weight with kfactor
Save the weight of the event for histogramming
Check if we need to subtract the O()term. If the number of additional partons is larger than the number of jets for which loop matrix elements are available, do standard UMEPS.
Now begin NLO part for treelevel events
Decide on which order to expand to.
Exclusive inputs: Subtract only the O(^{n+0})term from the treelevel subtraction, if we're at the highest NLO multiplicity (nMaxNLO).
Exclusive inputs: Do not remove the O(as)term if the number of reclusterings exceeds the number of NLO jets, or if more clusterings have been performed.
Calculate terms in expansion of the CKKWL weight.
Exclusive inputs: Subtract the O(^{n+1})term from the treelevel subtraction, not the O(^{n+0})terms.
If necessary, also dampen the O()term
Set the subtractive weight to the value calculated so far
Subtract the O()term from the CKKWL weight If PDF contributions have not been included, subtract these later New UNLOPS based on UN2LOPS. if (doUNLOPS2 && order > 1) wgt = wgt*(wgtFIRST1.); else if (order > 1) wgt = wgt  wgtFIRST;
If no first order weight needs to be subtracted, set it anyway
Set QCD 2>2 starting scale different from arbitrary scale in LHEF! –> Set to minimal mT of partons.
For pure QCD dijet events (only!), set the process scale to the transverse momentum of the outgoing partons.
Reset hard process candidates (changed after clustering a parton).
Check if resonance structure has been changed (e.g. because of clustering W/Z/gluino)
Compare old and new resonances
If necessary, reattach resonance decay products.
Allow merging hooks to remove emissions from now on.
If noemission probability is zero.
If the resonance structure of the process has changed due to reclustering, redo the resonance decays in Pythia::next()
Done

virtual 
Function to print statistics.
Function to print information.
Recall switch to enfore merging scale cut.
Recall merging scale value.
Reset minimal tms value.
Header.
Print warning if the minimal tms value of any event was significantly above the desired merging scale value.
Listing finished.
Reimplemented in DireMerging.

staticprotected 
The Merging class.
Factor by which the maximal value of the merging scale can deviate before a warning is printed.

protected 
Minimal value found for the merging scale in events.
Pointer to standard model couplings. CoupSM* coupSMPtr;