### Initialize Histograms for Jet Analysis (Fortran) Source: https://context7.com/powheg-box/v2/llms.txt Initializes histogram bookings for jet analysis. Requires ANALYSIS=default and FastJet installation. Histograms are booked for various jet properties and kinematic cuts. ```fortran ! File: pwhg_analysis.f ! Requires: ANALYSIS=default in Makefile; FastJet installed and in PATH. ! ! Jet algorithm parameters (hardcoded): ! palg = -1 (anti-kT) ! R = 0.5 (first clustering pass, variable ptmin) ! R = 0.4 (second pass, ptmin=60 GeV, |y|<2.8) ! ! Histograms booked for each of 6 pT_min thresholds (0,20,40,60,80,100 GeV): ! sigtot, Njet ! j1..j4: rapidity (y), pseudorapidity (eta), pT, invariant mass ! j1j2..j3j4: dijet y, eta, pT, mass, Δy, Δeta, Δφ, ΔR ! ! Fixed-cut distributions (leading 3 jets, pT1>80 GeV, |y|<2.8): ! 'J pt 1st/2nd/3rd', 'y 1st/2nd/3rd', 'eta 1st/2nd/3rd' subroutine init_hist ! Books all histograms via bookupeqbins / bookup end subroutine analysis(dsig0) implicit none real * 8 dsig0 ! event weight (or negative weight) ! 1. Loop over HEPEVT stable particles → ptrack array ! 2. Call fastjetppgenkt(ptrack, ntracks, R, palg, ptmin, ! pj, numjets, jetvec) ! 3. Apply pT / rapidity cuts per threshold level ! 4. Fill all histograms via filld(name, value, dsig) end ``` -------------------------------- ### POWHEG BOX Dijet Run Configuration (`powheg.input`) Source: https://context7.com/powheg-box/v2/llms.txt Configure collider setup, generation cuts, PDF sets, scale factors, integration grids, and optional flags for event generation. ```fortran ! ── Collider setup ─────────────────────────────────────────────── numevts 50000 ! number of POWHEG events to generate ih1 1 ! beam 1: 1=proton, -1=antiproton ih2 1 ! beam 2: 1=proton, -1=antiproton ebeam1 3500d0 ! beam 1 energy [GeV] (7 TeV LHC: 3500 each) ebeam2 3500d0 ! beam 2 energy [GeV] ! ── Generation cut (REQUIRED for IR-safe dijets) ───────────────── bornktmin 10d0 ! min pT of underlying Born 2→2 config [GeV] ! Observables must be insensitive below this cut. ! Recommended: bornktmin < (leading jet pT cut)/2 ! ── PDF sets ───────────────────────────────────────────────────── ! Using built-in MLM PDFs (CTEQ6m = set 131): ndns1 131 ndns2 131 ! Using LHAPDF (CTEQ6m LHA = 10050) — requires PDF=lhapdf in Makefile: ! lhans1 10050 ! lhans2 10050 ! ── Scale factors ──────────────────────────────────────────────── #renscfact 1d0 ! renormalization scale = muref * renscfact #facscfact 1d0 ! factorization scale = muref * facscfact ! muref = pT of underlying Born by default ! ── Integration grid ───────────────────────────────────────────── use-old-grid 1 ! reuse pwggrids.dat if present use-old-ubound 1 ! reuse pwgubound.dat if present ncall1 20000 ! calls for importance-sampling grid construction itmx1 5 ! grid iterations (total: 100k calls, ~70 s) ncall2 20000 ! calls for upper-bounding envelope itmx2 5 ! upper-bound iterations ! ── Phase-space folding (reduces negative-weight fraction) ─────── foldcsi 5 ! folds in xi (collinear) variable foldy 5 ! folds in rapidity foldphi 2 ! folds in azimuth ! total calls = ncall2*itmx2*foldcsi*foldy*foldphi = 5M nubound 500000 ! calls for radiation upper-bound setup (Born only, fast) ! ── Optional flags ─────────────────────────────────────────────── withnegweights 1 ! allow negative-weight events (recommended) doublefsr 1 ! suppress FSR emissions harder than emitter ! strongly reduces spikes in showered output #bornonly 1 ! LO-only underlying Born (no NLO corrections) #testplots 1 ! produce NLO topdrawer histograms on-the-fly ! (requires ANALYSIS=default) #iseed 5421 ! fixed random seed #manyseeds 1 ! parallel multi-seed runs; reads pwgseeds.dat ``` -------------------------------- ### Configure HERWIG Shower Parameters (Fortran) Source: https://context7.com/powheg-box/v2/llms.txt Configures HERWIG shower parameters before hadron-level event generation from an LHEF file. Requires building with 'make main-HERWIG-lhef' and running the executable. ```fortran ! ── HERWIG interface (setup-HERWIG-lhef.f) ─────────────────────── ! Build: make main-HERWIG-lhef ! Run (from the directory containing foo-powheg.input and bar.lhe): ! ../main-HERWIG-lhef ! Enter prefix: foo ! Enter LHE file: bar.lhe ! Output: foo-POWHEG+HERWIG-output.top (topdrawer histograms) subroutine setup_HERWIG_parameters include 'HERWIG65.INC' ptrms = 2.5d0 ! intrinsic pT spread [GeV] maxpr = 2 ! max events printed PRSOF = 0d0 ! disable soft underlying event SOFTME = .FALSE. ! disable soft matrix-element correction end ``` -------------------------------- ### Configure PYTHIA Shower Parameters (Fortran) Source: https://context7.com/powheg-box/v2/llms.txt Configures PYTHIA shower parameters, including tune selection and optional disabling of showering components for debugging. Build and run identically to the HERWIG interface. ```fortran ! ── PYTHIA interface (setup-PYTHIA-lhef.f) ─────────────────────── ! Build: make main-PYTHIA-lhef ! Run identically to HERWIG above. ! Output: foo-POWHEG+PYTHIA-output.top subroutine setup_PYTHIA_tune call PYTUNE(320) ! Perugia 0 tune (Feb 2009) end subroutine setup_PYTHIA_parameters ! mstp(86) = 1: limit MPI pT to be less than primary interaction pT ! (recommended for jet production; see arXiv:1012.3380) ! To disable showering components for speed (debugging): ! mstp(61)=0 ! no initial-state shower ! mstp(71)=0 ! no final-state shower ! mstp(81)=0 ! no multiple interactions ! mstp(111)=0 ! no hadronization end ``` -------------------------------- ### QCD Coupling and Quark Mass Initialisation Source: https://context7.com/powheg-box/v2/llms.txt Initializes quark pole masses for the Les Houches interface and prints the strong coupling constant alpha_S at M_Z for verification. Default quark masses follow PYTHIA conventions. ```fortran subroutine init_couplings implicit none include 'pwhg_st.h' include 'pwhg_physpar.h' end ``` -------------------------------- ### Building POWHEG BOX Dijet Executables Source: https://context7.com/powheg-box/v2/llms.txt Compile the main event generator and associated analysis or shower interface programs using 'make'. ```bash # Build the main event generator cd POWHEG-BOX/Dijet make # Build the offline LHE analysis program make lhef_analysis # Build the HERWIG shower interface make main-HERWIG-lhef # Build the PYTHIA shower interface make main-PYTHIA-lhef ``` -------------------------------- ### Subprocess Flavour List Initialisation Source: https://context7.com/powheg-box/v2/llms.txt Enumerates contributing 2->2 QCD subprocesses for dijet production and initializes POWHEG BOX flavour list arrays. Sets Born-level kinematic suppression exponents. ```fortran subroutine init_processes implicit none include 'nlegborn.h' integer nflav parameter (nflav=5) ! Sanity check: nlegborn must equal 4 for 2→2 dijet process ! Error if nlegborn.ne.4 → STOP end ``` -------------------------------- ### NLO Fixed-Order Analysis (No Event Generation) Source: https://context7.com/powheg-box/v2/llms.txt Generate fixed-order NLO distributions without producing event files. This is achieved by setting `testplots = 1` and `numevts = 0` in the `powheg.input` file and running `pwhg_main`. ```bash # ─── Step 4: NLO fixed-order analysis (no event generation) ───── # In powheg.input, uncomment: # testplots 1 # numevts 0 ../pwhg_main # Produces topdrawer output of fixed-order NLO distributions only. ``` -------------------------------- ### Generate Born Phase-Space Kinematics (`born_phsp`) Source: https://context7.com/powheg-box/v2/llms.txt Generates underlying 2→2 Born kinematics (τ, y_cm, cos θ) using importance-sampled Monte Carlo. Sets momenta in `kn_cmpborn` and `kn_pborn` common blocks and computes the phase-space Jacobian `kn_jacborn`. Inputs are on a unit hypercube. ```Fortran ! File: Born_phsp.f ! Called by: POWHEG BOX integration driver (sigborn.f in POWHEG-BOX/) ! ! Inputs (unit hypercube): ! xborn(1) → tau (parton momentum fraction squared) ! xborn(2) → y_cm (partonic centre-of-mass rapidity) ! xborn(3) → cos(theta1) (scattering angle) ! ! Outputs (via common blocks): ! kn_jacborn – phase-space Jacobian ! kn_sborn – partonic centre-of-mass energy squared ! kn_xb1/xb2 – Bjorken-x values ! kn_cmpborn – 4-momenta in the partonic CM frame ! kn_pborn – 4-momenta boosted to the lab frame subroutine born_phsp(xborn) implicit none include 'nlegborn.h' include 'pwhg_kn.h' real * 8 xborn(ndiminteg-3) ! Phase-space boundaries: ! 4*kn_ktmin^2/S < tau < 1 ! log(tau)/2 < y < -log(tau)/2 ! -sqrt(1 - 4*kn_ktmin^2/(S*tau)) < cos(theta) < +sqrt(...) ! Sampling mode (psgen=3, hardcoded): flat in log(tau) and ! log((1-cos)/(1+cos)) — optimal for QCD t-channel poles. ! After the call: ! kn_born_pt2 = (1 - cos^2(theta)) * kn_sborn / 4 ! kn_cmpborn(0:3, 1:4) set (initial state: legs 1,2; final: 3,4) ! kn_pborn(0:3, 1:4) boosted to lab frame via mboost() end ``` -------------------------------- ### Makefile Configuration for POWHEG BOX Dijet Source: https://context7.com/powheg-box/v2/llms.txt Configure compiler, PDF library, and analysis module by editing the top of the Makefile before running 'make'. ```makefile # Makefile key switches (edit top of Makefile before running make) # Choose compiler: gfortran or ifort COMPILER=gfortran # Choose PDF library: native (built-in MLM) or lhapdf PDF=lhapdf # Choose analysis module: none (stub) or default (FastJet-dependent) ANALYSIS=default ``` -------------------------------- ### Born Colour Assignment for Les Houches Output Source: https://context7.com/powheg-box/v2/llms.txt Assigns a probabilistic colour-flow configuration to the generated Born event for Les Houches output. It samples planar colour topologies weighted by colour amplitudes. ```fortran subroutine borncolour_lh implicit none include 'LesHouches.h' include 'nlegborn.h' ! icolup(1:2, 1:4) filled on return end ``` -------------------------------- ### Build POWHEG-BOX for Dijet Generation Source: https://context7.com/powheg-box/v2/llms.txt Compile the POWHEG-BOX code for dijet processes. Ensure the Makefile is configured with the desired compiler (e.g., gfortran) and PDF library (e.g., lhapdf). This step produces the main executable. ```bash # ─── Step 1: Build ─────────────────────────────────────────────── cd POWHEG-BOX/Dijet # Edit Makefile: COMPILER=gfortran, PDF=lhapdf, ANALYSIS=default make # produces pwhg_main ``` -------------------------------- ### Parallel Multi-Seed Runs for Clusters Source: https://context7.com/powheg-box/v2/llms.txt Configure POWHEG-BOX for parallel execution using multiple seeds, suitable for cluster environments. Enable `manyseeds = 1` in `powheg.input` and provide a list of seeds in `pwgseeds.dat`. Run `pwhg_main` multiple times, each with a different seed, and then merge the resulting LHE files for analysis. ```bash # ─── Step 5: Parallel multi-seed runs (cluster) ────────────────── # In powheg.input, uncomment: # manyseeds 1 # Create pwgseeds.dat with one integer seed per line. # Run pwhg_main N times (one per seed); each writes pwgevents-N.lhe. # Merge and analyse with lhef_analysis across all event files. ``` -------------------------------- ### Compute Born Matrix Elements and Colour Correlators (`setborn`) Source: https://context7.com/powheg-box/v2/llms.txt Computes the Born cross section and the full colour-correlated matrix element matrix for a given 4-momentum configuration and flavour structure using the Kunszt–Soper classification. Outputs include spin-correlated tensors for gluon legs. ```Fortran ! File: Born.f ! Inputs: ! p(0:3, nlegborn) – 4-momenta of all legs ! bflav(nlegborn) – PDG flavour codes (0=gluon, ±1..5=quarks) ! Outputs: ! born – spin/colour-averaged |M|^2 at Born level ! bornjk(j,k) – colour-correlated Born: ! bmunu(0:3,0:3,i) – spin-correlated tensor for gluon legs ! Process class mapping (Kunszt-Soper Phys.Rev.D46:192): ! A: q Q → q Q (different quark flavours, and crossings) ! B: q q → q q (identical quarks) ! C: q q̄ → g g (quark-antiquark annihilation to gluons) ! D: g g → g g (pure gluon scattering) ! Example: gluon-gluon scattering (D-type) ! bflav = [0, 0, 0, 0] ! → spin_col_avg = 4*(N_c^2-1)^2 ! → bornjk uses HDsFn, HDtFn, HDuFn for s/t/u channels ! Helicity amplitudes (from Kunszt-Soper eq. A8/A11): ! HAtFn(p1,p2,p3,p4) = 2*(s^2 + u^2)/t^2 [A-type, t-channel] ! HAuFn = HAtFn with p3↔p4 [A-type, u-channel] ! HBFn = 2*s^2/(t*u) [B-type] ! HCtFn = 2*(t^2+u^2)/s^2 * t/u [C-type, t-channel] ! HCsFn = 2*(t^2+u^2)/(t*u) [C-type, s-channel] ! HDsFn = 2*(t^2+u^2)*(s^4+t^4+u^4)/(stu)^2 [D-type, s-channel] subroutine setborn(p, bflav, born, bornjk, bmunu) implicit none include 'nlegborn.h' real * 8 p(0:3, nlegborn) integer bflav(nlegborn) real * 8 born real * 8 bornjk(nlegborn, nlegborn) ! colour correlator matrix real * 8 bmunu(0:3, 0:3, nlegborn) ! spin correlator (gluons only) ! ... see Born.f for full implementation end ``` -------------------------------- ### Shower Events with PYTHIA Source: https://context7.com/powheg-box/v2/llms.txt Apply parton showering to the generated POWHEG events using PYTHIA. This step requires compiling the PYTHIA integration tool and running it with the LHEF event file as input. ```bash # ─── Step 3b: Shower with PYTHIA ──────────────────────────────── cd POWHEG-BOX/Dijet make main-PYTHIA-lhef cd testrun-lhc ../main-PYTHIA-lhef # Prompts: prefix and LHE filename # Output: testrun-lhc-POWHEG+PYTHIA-output.top ``` -------------------------------- ### Tevatron Configuration for POWHEG.input Source: https://context7.com/powheg-box/v2/llms.txt This configuration is for the Tevatron collider (√s = 1.96 TeV) using antiprotons. It specifies the number of events, beam types, energies, and PDF sets. ```fortran ! Key differences from the LHC configuration: numevts 50000 ih1 1 ! proton ih2 -1 ! antiproton ← difference from LHC ebeam1 980d0 ! √s = 1.96 TeV Tevatron ← difference ebeam2 980d0 bornktmin 10d0 ndns1 131 ! CTEQ6m (MLM) ndns2 131 ! withnegweights commented out → positive weights only (default) ``` -------------------------------- ### Generate POWHEG Events for LHC Dijet Source: https://context7.com/powheg-box/v2/llms.txt Run the compiled POWHEG executable to generate dijet events at the LHC. Configure key parameters in `powheg.input`, such as the number of events, beam energies, and generation cuts. This process produces LHEF event files and analysis histograms. ```bash # ─── Step 2: Generate POWHEG events at the LHC ────────────────── cd testrun-lhc # powheg.input (key parameters): # numevts 50000 # ih1/ih2 1 1 (pp collisions) # ebeam1/2 3500d0 (√s = 7 TeV) # bornktmin 10d0 (generation cut) # withnegweights 1 # doublefsr 1 ../pwhg_main # Output files: # pwgevents.lhe – 50000 POWHEG events in Les Houches format # pwgpwhgalone-output.top – topdrawer histograms (if ANALYSIS=default) # pwggrids.dat – importance-sampling grid (cached) # pwgubound.dat – upper-bound normalisations (cached) # Performance: ~1 hour initialisation + ~5 events/second ``` -------------------------------- ### Fortran Momentum-Space Kinematic Helpers Source: https://context7.com/powheg-box/v2/llms.txt These Fortran subroutines calculate common kinematic observables for particle momenta, such as transverse momentum, invariant mass, rapidity, pseudorapidity, and angular separations. They are used in the analysis and Born modules of POWHEG-BOX. ```fortran subroutine pwhg_getpt(p, pt) real * 8 p(4), pt pt = sqrt(p(1)**2 + p(2)**2) end ``` ```fortran subroutine pwhg_getinvmass(p, m) real * 8 p(4), m real * 8 arg arg = p(4)**2 - p(1)**2 - p(2)**2 - p(3)**2 m = sign(1.d0, arg) * sqrt(abs(arg)) end ``` ```fortran subroutine pwhg_getrapidity(p, y) real * 8 p(4), y ! y = 0.5 * log((E + pz)/(E - pz)) ! Returns ±1e8 if E ≤ 0 or |pz/E| ≥ 1 (collinear protection) end ``` ```fortran subroutine pwhg_getpseudorapidity(p, eta) real * 8 p(4), eta ! eta = 0.5 * log((1 + cos θ)/(1 - cos θ)) = -ln(tan(θ/2)) end ``` ```fortran subroutine pwhg_getdelta_azi(p1, p2, delphi) real * 8 p1(4), p2(4), delphi ! delphi = |phi1 - phi2|, folded into [0, pi] end ``` ```fortran subroutine pwhg_getR_phieta(p1, p2, R) real * 8 p1(4), p2(4), R ! R = sqrt((eta1-eta2)^2 + delphi^2) [anti-kT cone metric] end ``` ```fortran subroutine pwhg_getR_phiy(p1, p2, R) real * 8 p1(4), p2(4), R ! R = sqrt((y1-y2)^2 + delphi^2) [rapidity-based cone metric] end ``` ```fortran function pwhg_ptrel(pin, pjet) real * 8 pwhg_ptrel, pin(0:3), pjet(0:3) ! ptrel = |pin| * sin(angle between pin and pjet) end ``` ```fortran subroutine getyetaptmass(p, y, eta, pt, mass) real * 8 p(4), y, eta, pt, mass ! Single call returning all four common jet observables end ``` ```fortran subroutine getdydetadphidr(p1, p2, dy, deta, dphi, dr) real * 8 p1(*), p2(*), dy, deta, dphi, dr ! Returns: Δy, Δη, Δφ ∈ [0,π], ΔR = sqrt(Δη^2 + Δφ^2) end ``` -------------------------------- ### Shower Events with HERWIG Source: https://context7.com/powheg-box/v2/llms.txt Apply parton showering to the generated POWHEG events using HERWIG. Similar to PYTHIA, this involves compiling the HERWIG integration tool and running it with the LHEF event file. ```bash # ─── Step 3c: Shower with HERWIG ──────────────────────────────── cd POWHEG-BOX/Dijet make main-HERWIG-lhef cd testrun-lhc ../main-HERWIG-lhef # Output: testrun-lhc-POWHEG+HERWIG-output.top ``` -------------------------------- ### Set Factorization and Renormalization Scales (`set_fac_ren_scales`) Source: https://context7.com/powheg-box/v2/llms.txt Sets the factorization scale `muf` and renormalization scale `mur` for NLO calculations and the POWHEG Sudakov form factor. The default is the transverse momentum of the underlying Born configuration. Scale variation for uncertainty bands is supported via `powheg.input`. ```Fortran ! File: Born_phsp.f ! Called every time a Born configuration is generated. ! ! Default: mur = muf = muref = pT(underlying Born) ! = sqrt(kn_cmpborn(1,3)^2 + kn_cmpborn(2,3)^2) ! ! Fixed scale override via powheg.input: ! fixedscale → mur = muf = GeV (constant) ! ! Scale variation (NLO uncertainty bands) via powheg.input: ! renscfact 0.5d0 → mur = muref * 0.5 (half scale) ! facscfact 2d0 → muf = muref * 2.0 (double scale) subroutine set_fac_ren_scales(muf, mur) implicit none include 'nlegborn.h' include 'pwhg_kn.h' real * 8 muf, mur ! muref = pT of outgoing parton leg 3 in partonic CM frame ! (kn_cmpborn(1,3) = px, kn_cmpborn(2,3) = py) end ``` -------------------------------- ### Born Suppression Factor Calculation Source: https://context7.com/powheg-box/v2/llms.txt Applies a smooth suppression factor to Born configurations at low pT. Controlled by `bornsuppfact` in `powheg.input`. A negative value disables suppression. ```fortran subroutine born_suppression(fact) implicit none real * 8 fact ! output: suppression weight in [0, 1] ! fact = (pt2 / (pt2 + pt2supp))^3 ! where pt2 = kn_cmpborn(1,3)^2 + kn_cmpborn(2,3)^2 end ``` -------------------------------- ### Offline LHE Event Analysis Source: https://context7.com/powheg-box/v2/llms.txt Perform an offline analysis of the generated LHEF events using the `lhef_analysis` tool. This tool generates topdrawer histograms from the LHE file, providing a direct comparison to the online analysis output. ```bash # ─── Step 3a: Offline LHE analysis ────────────────────────────── cd POWHEG-BOX/Dijet make lhef_analysis cd testrun-lhc ../lhef_analysis # Prompts: enter prefix "testrun-lhc" and event file "pwgevents.lhe" # Output: LHEF_analysis.top (identical to pwgpwhgalone-output.top) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.