PYTHIA
8.303

#include <DireHistory.h>
Public Member Functions  
DireHistory (int depthIn, double scalein, Event statein, DireClustering c, MergingHooksPtr mergingHooksPtrIn, BeamParticle beamAIn, BeamParticle beamBIn, ParticleData *particleDataPtrIn, Info *infoPtrIn, PartonLevel *showersIn, shared_ptr< DireTimes > fsrIn, shared_ptr< DireSpace > isrIn, DireWeightContainer *psweightsIn, CoupSM *coupSMPtrIn, bool isOrdered, bool isAllowed, double clusterProbIn, double clusterCouplIn, double prodOfProbsIn, double prodOfProbsFullIn, DireHistory *mothin)  
~DireHistory ()  
The destructor deletes each child.  
bool  projectOntoDesiredHistories () 
Function to project paths onto desired paths. More...  
double  weightTREE (PartonLevel *trial, AlphaStrong *asFSR, AlphaStrong *asISR, AlphaEM *aemFSR, AlphaEM *aemISR, double RN) 
double  weightMOPS (PartonLevel *trial, AlphaStrong *as, AlphaEM *aem, double RN) 
vector< double >  weightMEM (PartonLevel *trial, AlphaStrong *as, AlphaEM *aem, double RN) 
double  weightMEC () 
double  weightLOOP (PartonLevel *trial, double RN) 
double  weightFIRST (PartonLevel *trial, AlphaStrong *asFSR, AlphaStrong *asISR, AlphaEM *aemFSR, AlphaEM *aemISR, double RN, Rndm *rndmPtr) 
Return O()term of CKKWLweight for NL3 merging. More...  
double  weight_UMEPS_TREE (PartonLevel *trial, AlphaStrong *asFSR, AlphaStrong *asISR, AlphaEM *aemFSR, AlphaEM *aemISR, double RN) 
For UMEPS: More...  
double  weight_UMEPS_SUBT (PartonLevel *trial, AlphaStrong *asFSR, AlphaStrong *asISR, AlphaEM *aemFSR, AlphaEM *aemISR, double RN) 
Function to return weight of virtual correction events for NLO merging. More...  
double  weight_UNLOPS_TREE (PartonLevel *trial, AlphaStrong *asFSR, AlphaStrong *asISR, AlphaEM *aemFSR, AlphaEM *aemISR, double RN, int depthIn=1) 
For unitary NL3: More...  
double  weight_UNLOPS_SUBT (PartonLevel *trial, AlphaStrong *asFSR, AlphaStrong *asISR, AlphaEM *aemFSR, AlphaEM *aemISR, double RN, int depthIn=1) 
double  weight_UNLOPS_LOOP (PartonLevel *trial, AlphaStrong *asFSR, AlphaStrong *asISR, AlphaEM *aemFSR, AlphaEM *aemISR, double RN, int depthIn=1) 
double  weight_UNLOPS_SUBTNLO (PartonLevel *trial, AlphaStrong *asFSR, AlphaStrong *asISR, AlphaEM *aemFSR, AlphaEM *aemISR, double RN, int depthIn=1) 
double  weight_UNLOPS_CORRECTION (int order, PartonLevel *trial, AlphaStrong *asFSR, AlphaStrong *asISR, AlphaEM *aemFSR, AlphaEM *aemISR, double RN, Rndm *rndmPtr) 
Function to calculate O()term of CKKWLweight for NLO merging. More...  
bool  foundAllowedHistories () 
Function to check if any allowed histories were found.  
bool  foundOrderedHistories () 
Function to check if any ordered histories were found.  
bool  foundCompleteHistories () 
Function to check if any ordered histories were found.  
void  getStartingConditions (const double RN, Event &outState) 
Function to set the state with complete scales for evolution. More...  
bool  getClusteredEvent (const double RN, int nSteps, Event &outState) 
Function to get the state with complete scales for evolution. More...  
bool  getFirstClusteredEventAboveTMS (const double RN, int nDesired, Event &process, int &nPerformed, bool updateProcess=true) 
Function to get the first reclustered state above the merging scale. More...  
int  nClusterings () 
Event  lowestMultProc (const double RN) 
Function to get the lowest multiplicity reclustered event. More...  
double  getPDFratio (int side, bool forSudakov, bool useHardPDF, int flavNum, double xNum, double muNum, int flavDen, double xDen, double muDen) 
Calculate and return pdf ratio. More...  
void  printHistory (const double RN) 
Function to print the history that would be chosen from the number RN. More...  
void  printStates () 
Function to print the states in a history, starting from the hard process. More...  
Public Attributes  
Event  state 
int  generation 
Index for generation.  
map< double, DireHistory * >  goodBranches 
map< double, DireHistory * >  badBranches 
Friends  
class  Pythia 
Make Pythia class friend.  
class  DireMerging 
Make Merging class friend.  
class  DireTimes 
class  DireSpace 
Declaration of MyHistory class
A MyHistory object represents an event in a given step in the CKKWL clustering procedure. It defines a treelike recursive structure, where the root node represents the state with n jets as given by the matrix element generator, and is characterized by the member variable mother being null. The leaves on the tree corresponds to a fully clustered paths where the original njets has been clustered down to the Bornlevel state. Also states which cannot be clustered down to the Bornlevel are possible  these will be called incomplete. The leaves are characterized by the vector of children being empty.
DireHistory  (  int  depthIn, 
double  scalein,  
Event  statein,  
DireClustering  c,  
MergingHooksPtr  mergingHooksPtrIn,  
BeamParticle  beamAIn,  
BeamParticle  beamBIn,  
ParticleData *  particleDataPtrIn,  
Info *  infoPtrIn,  
PartonLevel *  showersIn,  
shared_ptr< DireTimes >  fsrIn,  
shared_ptr< DireSpace >  isrIn,  
DireWeightContainer *  psweightsIn,  
CoupSM *  coupSMPtrIn,  
bool  isOrdered = true , 

bool  isAllowed = true , 

double  clusterProbIn = 1.0 , 

double  clusterCouplIn = 1.0 , 

double  prodOfProbsIn = 1.0 , 

double  prodOfProbsFullIn = 1.0 , 

DireHistory *  mothin = 0 

) 
The only constructor. Default arguments are used when creating the initial history node. The depth is the maximum number of clusterings requested. scalein is the scale at which the statein was clustered (should be set to the merging scale for the initial history node. beamAIn and beamBIn are needed to calcutate PDF ratios, particleDataIn to have access to the correct masses of particles. If isOrdered is true, the previous clusterings has been ordered. is the PDF ratio for this clustering (=1 for FSR clusterings). probin is the accumulated probabilities for the previous clusterings, and \ mothin is the previous history node (null for the initial node).
Declaration of DireHistory class The only constructor. Default arguments are used when creating the initial history node. The depth is the maximum number of clusterings requested. scalein is the scale at which the statein was clustered (should be set to the merging scale for the initial history node. beamAIn and beamBIn are needed to calcutate PDF ratios, particleDataIn to have access to the correct masses of particles. If isOrdered is true, the previous clusterings has been ordered. is the PDF ratio for this clustering (=1 for FSR clusterings). probin is the accumulated probabilities for the previous clusterings, and \ mothin is the previous history node (null for the initial node).
Initialize.
Remember how many steps in total were supposed to be taken.
Initialise beam particles
Update probability with PDF ratio
Remember reclustered radiator in lower multiplicity state
Check if more steps should be taken.
Update generation index.
If this is not the fully clustered state, try to find possible QCD clusterings.
Check if fixedorder ME calculation for this state exists.
Calculate ME
Check if more steps should be taken.
If no clusterings were found, the recursion is done and we register this node.
Multiply with hard process matrix element.
Divide out all couplings in hard process matrix element.
If the coupling exactly vanishes, force weight to zero.
Additional ordering requirement between shower starting scale and scale of first emission.
Now we sort the possible clusterings so that we try the smallest scale first.
Check if reclustering follows ordered sequence.
If this path is not ordered in pT and we already have found an ordered path, then we don't need to continue along this path, unless we have not yet found an allowed path.
Check if reclustered state should be disallowed.
Skip clustering with vanishing probability.
Skip if this branch is already strongly suppressed.
Perform the clustering and recurse and construct the next history node.
Register as valid history if no children allowed.
Multiply with hard process matrix element.
Divide out all couplings in hard process matrix element.
If the coupling exactly vanishes, force weight to zero.
bool getClusteredEvent  (  const double  RN, 
int  nSteps,  
Event &  outState  
) 
Function to get the state with complete scales for evolution.
Function to set the state with complete scales for evolution.
Select history
Set scales in the states to the scales pythia would have set (Only needed if not done before in calculation of weights or setting of starting conditions)
If the history does not allow for nSteps clusterings (e.g. because the history is incomplete), return false
Return event with nSteps1 additional partons (i.e. recluster the last splitting) and copy the output state
Done.
bool getFirstClusteredEventAboveTMS  (  const double  RN, 
int  nDesired,  
Event &  process,  
int &  nPerformed,  
bool  updateProcess = true 

) 
Function to get the first reclustered state above the merging scale.
Do reclustering (looping) steps. Remember process scale.
Get number of clustering steps.
Set scales in the states to the scales pythia would have set.
Recluster until reclustered event is above the merging scale.
Initialise temporary output of reclustering.
Recluster once more.
If reclustered event does not exist, exit.
Continue loop if reclustered event has unresolved partons.
Update the hard process.
Failed to produce output state.
Update to the actual number of steps.
Save MPI starting scale
Done
double getPDFratio  (  int  side, 
bool  forSudakov,  
bool  useHardPDF,  
int  flavNum,  
double  xNum,  
double  muNum,  
int  flavDen,  
double  xDen,  
double  muDen  
) 
Calculate and return pdf ratio.
Do nothing for e+e beams
Now calculate PDF ratio if necessary
Get mother and daughter pdfs
Use hard process PDFs (i.e. PDFs NOT used in ISR, FSR or MPI).
Use rescaled PDFs in the presence of multiparton interactions
Cut out charm threshold.
Return ratio of pdfs
Done
void getStartingConditions  (  const double  RN, 
Event &  outState  
) 
Function to set the state with complete scales for evolution.
Select the history
Set scales in the states to the scales pythia would have set
Get number of clustering steps.
Update the lowest order process.
Save information on last splitting, to allow the next emission in the shower to have smaller rapidity with respect to the last ME splitting.
Copy the output state.
Save MPI starting scale.

inline 
Function to get the lowest multiplicity reclustered event.
Return lowest multiplicity state
int nClusterings  (  ) 
Function to return the depth of the history (i.e. the number of reclustered splittings)
Function to return the depth of the history (i.e. the number of reclustered splittings) NO INPUT OUTPUT int : Depth of history
void printHistory  (  const double  RN  ) 
Function to print the history that would be chosen from the number RN.
Function to print the history that would be chosen from the random number RN. Mainly for debugging.
Done
void printStates  (  ) 
Function to print the states in a history, starting from the hard process.
Function to print the states in a history, starting from the hard process. Mainly for debugging.
Print.
Recurse
Done
bool projectOntoDesiredHistories  (  ) 
Function to project paths onto desired paths.
Function to project all possible paths onto only the desired paths.
In MOPS, discard states that yield clusterings below the shower cutoff.
Loop through good branches and set the set of "good" children in mother nodes.
Set good sisters.
Multiply couplings and ME corrections to probability.
Loop through the good branches and set their correct probabilities, if necessary.
paths.begin()>second>mother>setProbabilities(); Set probabilities from nexttolowest multi –> highest multi. If lowest multi == highest multi, no need to set probabilities.
Set probabilities from nexttolowest multi –> highest multi. If lowest multi == highest multi, no need to set probabilities.
Multiply couplings and ME corrections to probability.
Trim to desirable histories.
return foundGood;
double weight_UMEPS_SUBT  (  PartonLevel *  trial, 
AlphaStrong *  asFSR,  
AlphaStrong *  asISR,  
AlphaEM *  aemFSR,  
AlphaEM *  aemISR,  
double  RN  
) 
Function to return weight of virtual correction events for NLO merging.
Read alpha_S in ME calculation and maximal scale (eCM)
Select a path of clusterings
Set scales in the states to the scales pythia would have set
Get weight.
Do trial shower, calculation of alpha_S ratios, PDF ratios
MPI noemission probability.
Set hard process renormalisation scale to default Pythia value.
For pure QCD dijet events, evaluate the coupling of the hard process at a more reasonable pT, rather than evaluation at a fixed arbitrary scale.
Reset to a running coupling. Here we choose FSR for simplicity.
For prompt photon events, evaluate the coupling of the hard process at a more reasonable pT, rather than evaluation at a fixed arbitrary scale.
Reset to a running coupling. In prompt photon always ISR.
Done
double weight_UMEPS_TREE  (  PartonLevel *  trial, 
AlphaStrong *  asFSR,  
AlphaStrong *  asISR,  
AlphaEM *  aemFSR,  
AlphaEM *  aemISR,  
double  RN  
) 
For UMEPS:
No difference to CKKWL. Recycle CKKWL function.
double weight_UNLOPS_CORRECTION  (  int  order, 
PartonLevel *  trial,  
AlphaStrong *  asFSR,  
AlphaStrong *  asISR,  
AlphaEM *  aemFSR,  
AlphaEM *  aemISR,  
double  RN,  
Rndm *  rndmPtr  
) 
Function to calculate O()term of CKKWLweight for NLO merging.
Dummy statement to avoid compiler warnings.
Already done if no correction should be calculated
Read alpha_S in ME calculation and maximal scale (eCM)
double aemME = infoPtr>alphaEM();
Pick path of clusterings
Set scales in the states to the scales pythia would have set
Get the lowest order kfactor and add first two terms in expansion
If using Bbar, which includes a treelevel part, subtract an additional one, i.e. the O(^0) contribution as well
If only O(^0)term is to be calculated, done already.
Start by adding the O(^1)term of the kfactor.
Calculate sum of O(^1)terms of the ckkwl weight WITHOUT the O(^1)term of the last noemission probability. Get first term in expansion of alpha_s ratios.
Add logarithm from expansion to weight.
Generate true average, not only onepoint.
Get average number of emissions.
Add average number of emissions off reconstructed states to weight.
Get first term in expansion of PDF ratios.
Add integral of DGLAP shifted PDF ratios from expansion to wt.
If O(^1)term + O(^1)term is to be calculated, done.
So far, no calculation of O(^2)term
double weight_UNLOPS_LOOP  (  PartonLevel *  trial, 
AlphaStrong *  asFSR,  
AlphaStrong *  asISR,  
AlphaEM *  aemFSR,  
AlphaEM *  aemISR,  
double  RN,  
int  depthIn = 1 

) 
No difference to default NL3
double weight_UNLOPS_SUBT  (  PartonLevel *  trial, 
AlphaStrong *  asFSR,  
AlphaStrong *  asISR,  
AlphaEM *  aemFSR,  
AlphaEM *  aemISR,  
double  RN,  
int  depthIn = 1 

) 
Select a path of clusterings
Set scales in the states to the scales pythia would have set
So far, no reweighting
Read alpha_S in ME calculation and maximal scale (eCM)
Only allow two clusterings if all intermediate states above the merging scale.
Get weights: alpha_S ratios and PDF ratios
Do trial shower, calculation of alpha_S ratios, PDF ratios
MPI noemission probability.
Set weight
Done
double weight_UNLOPS_SUBTNLO  (  PartonLevel *  trial, 
AlphaStrong *  asFSR,  
AlphaStrong *  asISR,  
AlphaEM *  aemFSR,  
AlphaEM *  aemISR,  
double  RN,  
int  depthIn = 1 

) 
Select a path of clusterings
Set scales in the states to the scales pythia would have set
So far, no reweighting
Only reweighting with MPI noemission probability
Done
double weight_UNLOPS_TREE  (  PartonLevel *  trial, 
AlphaStrong *  asFSR,  
AlphaStrong *  asISR,  
AlphaEM *  aemFSR,  
AlphaEM *  aemISR,  
double  RN,  
int  depthIn = 1 

) 
For unitary NL3:
Read alpha_S in ME calculation and maximal scale (eCM)
Select a path of clusterings
Set scales in the states to the scales pythia would have set
Get weight.
Do trial shower, calculation of alpha_S ratios, PDF ratios
MPI noemission probability.
Set hard process renormalisation scale to default Pythia value.
For pure QCD dijet events, evaluate the coupling of the hard process at a more reasonable pT, rather than evaluation at a fixed arbitrary scale.
Reset to a running coupling. Here we choose FSR for simplicity.
For prompt photon events, evaluate the coupling of the hard process at a more reasonable pT, rather than evaluation at a fixed arbitrary scale.
Reset to a running coupling. In prompt photon always ISR.
Done
double weightFIRST  (  PartonLevel *  trial, 
AlphaStrong *  asFSR,  
AlphaStrong *  asISR,  
AlphaEM *  aemFSR,  
AlphaEM *  aemISR,  
double  RN,  
Rndm *  rndmPtr  
) 
Return O()term of CKKWLweight for NL3 merging.
Function to calculate O()term of CKKWLweight for NLO merging.
Dummy statement to avoid compiler warnings.
Read alpha_S in ME calculation and maximal scale (eCM)
Pick path of clusterings
Set scales in the states to the scales pythia would have set
Get the lowest order kfactor and add first two terms in expansion
If using Bbar, which includes a treelevel part, subtract an additional one, i.e. the O(^0) contribution as well
Calculate sum of O(alpha) terms
Get starting scale for trial showers.
Count emissions: New variant Generate true average, not only onepoint
Get number of emissions
Done
double weightLOOP  (  PartonLevel *  trial, 
double  RN  
) 
For default NL3: Return weight of virtual correction and subtractive for NL3 merging
Function to return weight of virtual correction and subtractive events for NL3 merging
Select a path of clusterings
Set scales in the states to the scales pythia would have set
So far, no reweighting
Only reweighting with MPI noemission probability
Done
vector< double > weightMEM  (  PartonLevel *  trial, 
AlphaStrong *  as,  
AlphaEM *  aem,  
double  RN  
) 
Read alpha_S in ME calculation and maximal scale (eCM)
Select a path of clusterings
Set scales in the states to the scales pythia would have set
Calculate noemission probability with trial shower.
Calculate PDF ratios.
Calculate coupling ratios.
double weightMOPS  (  PartonLevel *  trial, 
AlphaStrong *  as,  
AlphaEM *  aem,  
double  RN  
) 
In the initial history node, select one of the paths according to the probabilities. This function should be called for the initial history node. IN trialShower* : Previously initialised trialShower object, to perform trial showering and as repository of pointers to initialise alphaS PartonSystems* : PartonSystems object needed to initialise shower objects OUT double : (Sukadov) , (alpha_S ratios) , (PDF ratios)
Read alpha_S in ME calculation and maximal scale (eCM)
Select a path of clusterings
Set scales in the states to the scales pythia would have set
Keep only unordered paths, since all ordered paths have been corrected with matrix element corrections.
Calculate noemission probability with trial shower.
Calculate PDF ratios.
Calculate coupling ratios.
MPI noemission probability
Done
double weightTREE  (  PartonLevel *  trial, 
AlphaStrong *  asFSR,  
AlphaStrong *  asISR,  
AlphaEM *  aemFSR,  
AlphaEM *  aemISR,  
double  RN  
) 
For CKKWL, NL3 and UMEPS: In the initial history node, select one of the paths according to the probabilities. This function should be called for the initial history node. IN trialShower* : Previously initialised trialShower object, to perform trial showering and as repository of pointers to initialise alphaS PartonSystems* : PartonSystems object needed to initialise shower objects OUT double : (Sukadov) , (alpha_S ratios) , (PDF ratios)
In the initial history node, select one of the paths according to the probabilities. This function should be called for the initial history node. IN trialShower* : Previously initialised trialShower object, to perform trial showering and as repository of pointers to initialise alphaS PartonSystems* : PartonSystems object needed to initialise shower objects OUT double : (Sukadov) , (alpha_S ratios) , (PDF ratios)
Read alpha_S in ME calculation and maximal scale (eCM)
Select a path of clusterings
Set scales in the states to the scales pythia would have set
Get weight.
Do trial shower, calculation of alpha_S ratios, PDF ratios
MPI noemission probability
double mpiwt = selected>weightEmissions( trial, 1, 0, njetsMaxMPI, maxScale );
Set hard process renormalisation scale to default Pythia value.
For pure QCD dijet events, evaluate the coupling of the hard process at a more reasonable pT, rather than evaluation at a fixed arbitrary scale.
Reset to a running coupling. Here we choose FSR for simplicity.
Reset to a running coupling. Here we choose FSR for simplicity.
For W clustering, correct the .
Reset to a running coupling. Here we choose FSR for simplicity.
For prompt photon events, evaluate the coupling of the hard process at a more reasonable pT, rather than evaluation at a fixed arbitrary scale.
Reset to a running coupling. In prompt photon always ISR.
For DIS, set the hard process scale to Q2.
Done
map<double,DireHistory *> goodBranches 
The different allowed paths after projection, indexed with the (incremental) corresponding probability. This map is empty unless this is the initial step (mother == 0).
Event state 
The state of the event correponding to this step in the reconstruction.