HEPfit: a code for the combination of indirect and direct constraints on high energy physics models

HEPfit is a flexible open-source tool which, given the Standard Model or any of its extensions, allows to (i) fit the model parameters to a given set of experimental observables; (ii) obtain predictions for observables. HEPfit can be used either in Monte Carlo mode, to perform a Bayesian Markov Chain Monte Carlo analysis of a given model, or as a library, to obtain predictions of observables for a given point in the parameter space of the model, allowing HEPfit to be used in any statistical framework. In the present version, around a thousand observables have been implemented in the Standard Model and in several new physics scenarios. In this paper, we describe the general structure of the code as well as models and observables implemented in the current release.


Introduction
Searching for New Physics (NP) beyond the Standard Model (SM) in the era of the Large Hadron Collider (LHC) requires combining experimental and theoretical information from many sources to optimize the NP sensitivity.NP searches, even in the absence of a positive signal, provide useful information which puts constraints on the viable parameter space of any NP model.Should a NP signal emerge at future LHC runs or elsewhere, the combination of all available information remains a crucial step to pin down the actual NP model.NP searches at the LHC require extensive detector simulations and are usually restricted to a subset of simplified NP models.Given the high computational demand of direct searches, it is crucial to explore only regions of the parameter space compatible with other constraints.In this respect, indirect searches can be helpful and make the study of more general models viable.
HEPfit aims at providing a tool which allows to combine all available information to select allowed regions in the parameter space of any NP model.To this end, it can compute many observables with state-of-the-art theoretical expressions in a set of models which can be extended by the user.It also offers the possibility of sampling the parameter space using a Markov Chain Monte Carlo (MCMC) implemented using the BAT library [1][2][3].Alternatively, HEPfit can be used as a library to obtain predictions of the observables in any implemented model.This allows to use HEPfit in any statistical framework.
HEPfit is written in C++ and parallelized with MPI.This is the first public release with a limited set of observables and models, which we plan to enlarge.The code is released under the GNU General Public License, so that contributions from users are possible and welcome.In particular, the present version provides Electroweak Precision Observables (EWPO), Higgs signal strengths, and several flavour observables in the SM, in Two-Higgs-Doublet Models (THDM), and in several parameterizations of NP contributions.Furthermore, it also calculates various Lepton Flavour Violating (LFV) observables in the Minimal Supersymmetric Standard Model (MSSM).In the near future, we plan to add many more flavour observables and to enlarge the spectrum of NP models.
The paper is organized as follows.In Section 2 we give a brief description of HEPfit including the statistical framework used, the MPI parallelization and some other details.In Section 3 we discuss the models implemented in HEPfit.In Section 4 we go on discussing some of the observables implemented in HEPfit.In Section 5 we present some physics results obtained using HEPfit in previous publications.Indeed several physics analyses  have been completed using HEPfit and serves as a validation of the code and its use as an open-source computational framework.A detailed description of the installation procedure can be found in Section 6 followed by examples of how to use HEPfit in Section 7. Updated information and detailed online documentation can be found on the HEPfit website [30].

The HEPfit code
HEPfit is a computational tool for the combination of indirect and direct constraints on High Energy Physics models.The code is built in a modular structure so that one can pick and choose which observables to use and what model to analyze.It also provides an interface that can be used to build customized models along with customized observables.This flexible framework allows defining a model of choice and observables that depend on the parameters of this model, thus opening up the possibility of using HEPfit to perform phenomenological analyses in such a model.
The tool comes with a built-in statistical framework based on a Bayesian MCMC analysis.However, any statistical framework can be used along with this tool since a library is made available.HEPfit also allows for the incorporation of parametric and experimental correlations and can read likelihood distributions directly from ROOT histograms.This removes the necessity for setting experimental constraints through parameterized distributions which might require making approximations.
Since the statistical core of HEPfit is based on a MCMC, speed of computation is of utmost importance.HEPfit is already massively parallelized to run over large number of CPUs using OpenMPI and scales well to hundreds of processing units.The framework further brings forth the flexibility of defining a model of choice and observables that depend on the parameters of this model, thus opening up the possibility of performing various analyses using HEPfit.
The package comes with several examples of how HEPfit can be used and detailed documentation of the code and the physics can be found online on the HEPfit web site.Throughout its development, emphasis has been placed on speed and streamlining error handling.HEPfit has been tested through several analyses on various hardware architecture and displays reliable scaling to large systems.

Statistical framework
HEPfit can be used both as a library to compute the values of chosen observables and also as a MCMC based Bayesian analysis framework.While the former approach allows for choosing the statistical framework one wants to use, the latter uses a robust Bayesian MCMC framework implemented in the public code BAT [1][2][3].In this section we give a brief overview of the Bayesian statistical framework implemented in HEPfit using BAT.

Bayesian framework
Once the model parameters, x, and the data, D, are defined one can define the posterior distribution according to Bayes theorem as: where P 0 ( x) is the prior distribution of the parameters which represents the prior knowledge of the parameters which can come from experiments or theory computations or can be uninformative.The denominator is called the normalization or the evidence, the computation of which can allow for model comparison through the Bayes factor.The likelihood is denoted as P (D| x).Once the (unnormalized) posterior distribution1 is mapped out using sampling methods (in our case a MCMC routine), one can obtain the marginalized posterior distributions of the individual parameters from which the credibility regions can be computed.The 1D marginalized distribution is given by where all the variables but the one for which the marginalized posterior distribution is being computed are integrated over, and similarly for marginalized 2D distributions.

Markov Chain Monte Carlo
In general, the posterior distribution specified in Eq. (2.1) cannot be computed easily, especially when there is a proliferation of model parameters.Using a naive Monte Carlo sampling algorithm can lead to unacceptable execution times because of their inherent inefficiency in sampling the parameter space.However, MCMC procedures overcome this hurdle and make the application of Bayes theorem quite tractable.
The implementation of MCMC in BAT uses a Metropolis-Hastings algorithm to sample the parameter space from the posterior.The steps of a Metropolis-Hastings algorithm for sampling from a (unnormalized) probability density f ( x) are as follows: 1. Start at a random point in the parameter space x.
2. Generate a proposal point y according to a symmetric probability distribution g( x, y).

3.
Compare the value of the function f at proposal point y with the value at the current point x.The proposal point is accepted if: • otherwise, generate a random number r from a uniform distribution in the range [0, 1] and accept the proposal if f ( y)/f ( x) > r.
If neither conditions are satisfied the proposal is rejected.
In our case, the function f ( y) is the unnormalized posterior, namely the numerator of Eq. (2.1).
The MCMC implementation consists of two parts.The first part is called the pre-run or the burn-in phase where the chains start from arbitrary random points in the parameter space and reach a stationary state after a certain number of iterations, through the tuning of the proposal function.The stationary state is reached once the targeted efficiency of the proposal and R-values close to one are obtained.The R-value for a parameter is essentially the distance of its mean values in the various chains in units of the standard deviation of the parameter in each chain [31,32].Samples of the parameter space are not collected during the pre-run.Once the pre-run is over, the samples of the parameter space are collected in the main run to get the marginalized distributions of all the parameters and the corresponding posterior distributions of the observables and of any other derived quantity that may have been defined.The details of the implementation of the MCMC framework can be found in Refs.[1][2][3].

Integration of BAT with HEPfit
The MCMC framework implemented in BAT is integrated in HEPfit using the library that is provided by BAT on compilation.The MonteCarloEngine class in HEPfit inherits from the BCModel class in BAT and overloads the LogLikelihood function.This method generates the numerical likelihood for one point in the parameter space with the values of the observables computed by HEPfit and the experimental and theoretical constraints provided to HEPfit.their distributions are passed by HEPfit to BAT through the MonteCarloEngine class.HEPfit takes care of correlated parameter priors by rotating them to the eigenvector basis in order to increase the efficiency of sampling.
The output of a run, as detailed in Section 7.1, is produced by both BAT and HEPfit.All 1D and 2D marginalized distributions and posterior distributions are produced using the BCH1D and the BCH2D classes of BAT and stored in a ROOT file.One can choose to store the chains in the ROOT file as well using HEPfit.While this is useful for post-processing, since it makes the full sample available point by point, it entails a dramatic increase in size of the output ROOT file.
It should be noted that BAT is necessary only when running in the MCMC mode.If one chooses to run HEPfit as an event generator or to only compute values of observables for custom statistical analyses, the interface with BAT is not used at all.

Parallelization with MPI
One of the most important advantages of HEPfit over several other similar publicly available codes is that it is completely parallelized using OpenMPI, allowing it to be run on both single CPUs with multiple cores and on several nodes on large clusters.The MCMC algorithm is very apt for this kind of parallelization since an integer number of chains can be run on each core.Ideally allocating one core per chain minimizes the run time.
The official version of BAT is parallelized using OpenMP.However, OpenMP relies on shared memory and cannot be distributed over several nodes in a cluster.To overcome this limitation we used OpenMPI to parallelize both BAT and HEPfit.The parallelization is at the level of the computation of likelihood and observables.This means that the MCMC at both the pre-run and main run stages can take advantage of this parallelization.Once the likelihood computation (which requires the computation of the observables) is done, the flow is returned to the master, which performs the generation of the next set of proposal points.The computation of efficiencies and convergence, as well as the optimization of the proposal function, are currently not distributed since they require full information on the chain states.This is the only bottleneck in the parallelization, since the time the master takes to process these steps might be comparable to the time required to compute all the observables by each chain, if the number of chains is very large.However, this begins to be a matter of concern only when the number of chains is in the range of several hundreds, a situation that a normal user is unlikely to encounter.
To demonstrate the advantages that one can get from the parallelization built into HEPfit and to give an estimate of the scaling of the run-times with the number of cores, we give some examples of analyses that can be done both on personal computers and on large clusters in Table 1.These should not be taken as benchmarks since we do not go into the details of the hardware, compiler optimization, etc. Rather, these should be taken as an indication of how MPI parallelization greatly enhances the performance of the HEPfit code.

Custom models and observables
Another unique feature that HEPfit offers is the possibility of creating custom models and custom observables.All the features of HEPfit are made available along with all the observables and parameters predefined in HEPfit.An example of such a use of HEPfit can be found in Ref. [23].Detailed instructions for implementation are given in Section 7.4.
The user can define a custom model using a template provided with the package, by adding a set of parameters to any model defined in HEPfit.Generally, in addition to defining the new parameters, the user should also specify model-specific additional contributions to any observables predefined in HEPfit that he wants to use.Furthermore, new observables can be defined in terms of these new parameters.
New observables can also be defined in the context of the predefined HEPfit models.In this case, the user just needs to specify the observable in terms of the model parameters, without the need to create a custom model.The parameters already used in HEPfit can also be accessed.For example, one does not need to redefine the Cabibbo-Kobayashi-Maskawa (CKM) mixing matrix, V CKM , if one needs to use it in the computation of a custom observable.One can simply call the SM object available to all observables and then use the implementation of V CKM already provided either in terms of the Wolfenstein parameters or in terms of the elements of the matrix.It should be noted that one does not need to define a custom model to define custom observables.A custom model should be defined only if the user requires parameters not already present in HEPfit.More details can be found in Section 7.4.

Models defined in HEPfit
The basic building blocks of HEPfit are the classes Model and Observable.Actual models extend the base class Model sequentially (e.g.QCD ← StandardModel ← THDM ← . . .).Inheritance allows a given model to use all the methods of the parent ones and to redefine those which have to include additional contributions specific to the extended model.For example, the method computing the strong coupling constant (α s ) includes strong corrections in QCD, adds electromagnetic corrections in StandardModel, and any additional contributions in classes extending the StandardModel.Models contain model parameters (both fundamental model parameters and auxiliary ones) and model flags which control specific options.
An instance of the Observable class contains the experimental information relative to a given physical observable as well as an instance of the class ThObservable, responsible for the computation of that observable in the given model.This is the class where both the experimental or theoretical constraints and the theory computation in the model are accessible, allowing for the likelihood calculation.We now briefly review the models implemented in the current release of HEPfit.

The Standard Model
In HEPfit, the minimal model to be defined in order to compute any observable is the StandardModel, which for convenience extends a class QCD, which in turn, extends the abstract class Model.
The model implemented in the QCD class defines the following model parameters: the value of α s (M ) at a provided scale M , the MS quark masses mq (except for the top quark mass where for convenience the pole mass is taken as input parameter and then converted to MS).With this information, the class initializes instances of the Particle class for each quark.In addition, objects of type Meson, containing information on masses, lifetimes, decay constants and other hadronic parameters (these are taken as model parameters although in principle they are derived quantities), are instantiated for several mesons.Furthermore, bag parameters for meson mixings and decays are instantiated.This class also defines methods to implement the running of α s and quark masses.
The StandardModel class extends QCD by adding the remaining SM parameters, namely the Fermi constant G F , the fine-structure constant α, the Z boson mass M Z , the Higgs boson mass m h and the CKM mixing matrix (instantiating the corresponding object CKM). 2 The Pontecorvo-Maki-Nakagawa-Sakata (PMNS) mixing matrix is defined but currently not activated.It also fixes the QCD parameter M introduced above to M Z and the QCD parameter α s (M ) to α s (M Z ).Furthermore, it contains Particle objects for leptons.Several additional model parameters describe the hadronic vacuum polarization contribution to the running of α, and the theoretical uncertainties in the W mass and other EWPO, for which is convenient to use available numerical estimates.Moreover, the running of α s is extended to include electromagnetic corrections.
The StandardModel class also provides matching conditions for weak effective Hamiltonians through the class StandardModelMatching.Low-energy weak effective Hamiltonians, both ∆F = 1 and ∆F = 2, are provided on demand by the class Flavour instantiated by StandardModel.
Although extending Model and QCD, StandardModel is the actual base class for any further definition of NP models (e.g.THDM, SUSY, etc.).Details on the implementation of StandardModel and QCD can be found in the online documentation.

Two-Higgs-Doublet models
One of the most straightforward extensions of the SM is the Two-Higgs-Doublet model (THDM) [33][34][35].No fundamental theorem forbids to add a second scalar doublet to the SM particle content.The THDM can offer a solution to problems as the stability of the scalar potential up to very large scales (see e.g.ref. [36]) or electroweak baryogenesis (see e.g.refs.[37][38][39]), which cannot be solved in the SM.Furthermore, it could emerge as an effective description of more complicated models like SUSY models, which necessarily contain two Higgs doublets.
There are several THDM variants with different phenomenological implications.At the moment HEPfit contains the versions which exclude flavour-changing neutral currents at tree-level as well as CP violation in the Higgs sector.In order to fulfil the first demand, an additional softly broken Z 2 symmetry is assumed, which can be chosen in four different ways; thus these versions Type I Type II Type X ("lepton specific") Type Y ("flipped") are called type I, type II, type X and type Y. 3 The four types only differ in the Yukawa couplings of the Higgs fields.The corresponding assignments can be found in Table 2, where Y f j denotes the coupling of one of the two Higgs doublets Φ j (j = 1, 2) to the fermion field f .By definition, Y u 1 ≡ 0 for all four types.In the configuration file THDM.conf, one has to choose the THDM type by setting the flag modelTypeflag to type1, type2, typeX or typeY.
We write the Higgs potential for Φ 1 and Φ 2 as and the Yukawa part of the Lagrangian as where one of the choices from Table 2 has to be applied.The THDM contains five physical Higgs bosons, two of which are neutral and even under CP transformations, one is neutral and CP-odd, and the remaining two carry the electric charge ±1 and are degenerate in mass.We assume that the 125 GeV resonance measured at the LHC is the lighter CP-even Higgs h, while the other particles are labelled H, A and H ± , respectively.The eight parameters from the Higgs potential (3.1) can be transformed into physical parameters: • the vacuum expectation value v, • the lighter CP-even Higgs-boson mass m h , • the heavier CP-even Higgs-boson mass m H , • the CP-odd Higgs-boson mass m A , • the charged Higgs-boson mass m H + , • the mixing angle α, • the mixing angle β and The Fermi constant G F and m h are defined in the SM configuration file.For practical reasons, the HEPfit implementation uses β − α and log 10 tan β, instead of α and β, and squared H, A and H + masses.
Table 3. Model parameters in the NPEpsilons pureNP class.

The Georgi-Machacek model
In the Georgi-Machacek model [40,41], the SM is extended by two SU (2) triplets.This construction can simultaneously explain the smallness of neutrino masses (via the seesaw mechanism) and the electroweak ρ parameter.In HEPfit, we implemented the custodial Georgi-Machacek model, in which the additional heavy scalars can be combined into a quintet, a triplet and a singlet under the custodial SU (2) with masses m 5 , m 3 , and m 1 , respectively.Further model parameters in HEPfit are the triplet vev v ∆ , the singlet mixing angle α and the two trilinear couplings µ 1 and µ 2 .For details of the HEPfit implementation of this model we refer to reference [18].

Oblique corrections in electroweak precision observables
Assuming the physics modifying the on-shell properties of the W and Z bosons is universal, such effects can be encoded in three quantities: the relative normalization of neutral and charged currents, and the two relative differences between the three possible definitions of the weak mixing angle.These effects are captured by the so-called i parameters introduced in [42][43][44].The model class NPEpsilons pureNP describes the NP contributions to these quantities.It also allows contributions in the additional, non-universal, b parameter, also introduced in [44] to describe modifications of the Zb b interactions.The model parameters in this class are defined in Table 3.The δ i , i = 1, 2, 3 can be readily mapped into the oblique parameters describing NP modifying the propagator of the electroweak gauge bosons: where θ w is the weak mixing angle, the S, T, U parameters were originally introduced in Ref.
[45] and V, W, X, Y in Ref. [46].All these parameterize the different coefficients in the expansion of the gauge boson self-energies for q 2 Λ 2 with Λ the typical scale of the NP.Traditionally, the literature of electroweak precision tests has focused on the first three parameters (which also match the number of different universal effects that can appear in the EWPO).Because of that, we include the model class NPSTU, which describes this type of NP.The relevant parameters are collected in Table 4.It is important to note, however, that the U parameter is typically expected to be suppressed with respect to S, T by M 2 W /Λ 2 .Indeed, at the leading order in M 2 W /Λ 2 the four parameters describing universal NP effects in electroweak observables are S, T, W and Y [46].
Model parameters in the NPSTU class.

The dimension-six Standard Model Effective Field Theory
When the typical mass scale of NP is significantly larger than the energies tested by the experimental observables, the new effects can be described in a general way by means of an effective Lagrangian In Eq. (3.5) L SM is the SM Lagrangian, Λ is the cut-off scale where the effective theory ceases to be valid, and contains only (Lorentz and) gauge-invariant local operators, O i , of mass dimension d.In the so-called SM effective field theory (SMEFT), these operators are built using exclusively the SM symmetries and fields, assuming the Higgs belongs to an SU (2) L doublet.The Wilson coefficients, C i , encode the dependence on the details of the NP model.They can be obtained by matching with a particular ultraviolet (UV) completion of the SM [47][48][49][50][51][52][53][54][55][56][57][58][59], allowing to project the EFT results into constraints on definite scenarios.
At any order in the effective Lagrangian expansion a complete basis of physically independent operators contains only a finite number of higher-dimensional interactions.In particular, for NP in the multi-TeV region, the precision of current EW measurements only allows to be sensitive to the leading terms in the 1/Λ expansion in Eq. (3.5), i.e., the dimension-six effective Lagrangian (at dimension five there is only the Weinberg operator giving Majorana masses to the SM neutrinos, which plays a negligible role in EW processes).The first complete basis of independent dimensionsix operators was introduced by Grzadkowski, Iskrzynski, Misiak, and Rosiek and contains a total of 59 independent operators, barring flavour indices and Hermitian conjugates [60].This is what is commonly known in the literature as the Warsaw basis.
The main implementation of the dimension-six Standard Model effective Lagrangian in HEPfit is based in the Warsaw basis, though other operators outside this basis are also available for some calculations.Currently, all the dimension-six interactions entering in the EWPO as well as Higgs signal strengths have been included in the NPSMEFTd6 model class.Two options are available, depending on whether lepton and quark flavour universality is assumed (NPSMEFTd6 LFU QFU) or not (NPSMEFTd6).These implementations assume that we use the {M Z , α, G F } scheme for the SM EW input parameters.The complete list of operators as well the corresponding names for the HEPfit model parameters can be found in the online documentation along with a complete description of the model flags. 4ame Parameter Name Parameter Name Parameter Name Parameter Table 5. Model parameters in the HiggsKigen class."Name" refers to the name of the parameter in HEPfit that can be used in the configuration files.
By default, the theoretical predictions for the experimental observables including the NP contributions coming from the effective Lagrangian are computed consistently with the assumption of only dimension-six effects.In other words, for a given observable, O, only effects of order 1/Λ 2 are considered, and all NP contributions are linear in the NP parameters: Note that these linear contributions always come from the interference with the SM amplitudes.
The default behaviour described above can be altered by using some of the model flags.The flag QuadraticTerms will allow to test the quadratic effects of the dimension-six interactions, to be implemented in future releases of the code.

Modified Higgs couplings in the κ-framework
In many scenarios of NP one of the main predictions are deviations in the Higgs boson couplings with respect to the SM ones.Such a scenario can be described in general by considering the following effective Lagrangian for a light Higgs-like scalar field h [61,62]: This Lagrangian assumes an approximate custodial symmetry and the absence of other light degrees of freedom below the given cut-off scale.In the previous Lagrangian the longitudinal components of the W and Z gauge bosons, χ a (x), are described by the 2 × 2 matrix Σ(x) = exp (iσ a χ a (x)/v), with σ a the Pauli matrices, and V (h) is the scalar potential of the Higgs field, whose details are not relevant for the discussion here.The SM is recovered for κ Deviations in such a class of scenarios (and beyond) are conveniently encoded in the socalled κ framework [63].In this parameterization, deviations from the SM in the Higgs properties are described by coupling modifier, κ i , defined from the different Higgs production cross sections and decay widths.Schematically, -11 -where the total Higgs width, allowing the possibility of non-SM invisible or exotic decays, parameterized by BR inv and BR exo , can be written as The model class HiggsKigen contains a general implementation of the parameterization described in the κ framework, offering also several flags to adjust some of the different types of assumptions that are commonly used in the literature.The most general set of coupling modifiers allowed in this class is described in Table 5, including also the possibility for non-SM contributions to invisible or exotic (non-invisible) Higgs decays. 5Note that, even though the coupling modifiers are defined for all SM fermions, the current implementation of the code neglects modifications of the Higgs couplings to strange, up and down quarks, and to the electron.Furthermore, the parameters associated to κ g,γ,Zγ , which are typically used in an attempt to interpret data allowing non-SM particles in the SM loops, are only meaningful if the model flag KiLoop is active.Finally, in scenarios like the one in Eq. (3.8), while both κ V and κ f can modify the different Higgs production cross sections and decay widths, the leading corrections to EWPO come only from κ V .These are given by the following 1-loop contributions to the oblique S and T parameters: where Λ is the cutoff of the effective Lagrangian in Eq. (3.8).We set Λ = 4πv/ |1 − κ 2 V |, as given by the scale of violation of perturbative unitarity in W W scattering.
The above contributions from κ V to EWPO are also implemented in the HiggsKigen class, where κ V is taken from the model parameter associated to the W coupling, κ W .Note however that, for κ W = κ Z power divergences appear in the contributions to oblique corrections, and the detailed information of the UV theory is necessary for calculating the contributions to EWPO.Therefore, in HiggsKigen the use and interpretation of EWPO is subject to the use of the flag Custodial, which enables κ W = κ Z .
Other flags in the model allow to use a global scaling for all fermion couplings (flag UniversalKf), a global scaling for all SM couplings (flag UniversalK), and to trade the exotic branching ratio parameter by a scaling of the total Higgs width, according to Eq. (3.10) (flag UseKH).

Some important observables implemented in HEPfit
A large selection of observables has been implemented in HEPfit.Broadly speaking, these observables can be classified into those pertaining to electroweak physics, Higgs physics, and flavour physics.Observables should not necessarily be identified with experimentally accessible quantities, but can also be used to impose theoretical constraints, such as unitarity bounds, that can constrain the parameter space of theoretical models, particularly beyond the SM.In what follows we give a brief overview of the main observables that are available in HEPfit along with some details about their implementation when necessary.

Higgs physics
In the Higgs sector, most of the observables currently included in HEPfit are the Higgs-boson production cross sections or branching ratios, always normalized to the corresponding SM prediction.Modifications with respect to the SM are implemented for several models, e.g.NPSMEFTd6 or HiggsKigen.This set of observables allows to construct the different signal strengths for each production×decay measured at the LHC experiments and to test different NP hypotheses.
Apart from the observables needed for LHC studies, the corresponding observables for the production at future lepton colliders are also implemented in HEPfit.These are available for different values of centre-of-mass energies and/or polarization fractions, covering most of the options present in current proposals for such future facilities.Observables for studies at ep colliders or at 100 TeV pp colliders are also available in some cases.

Flavour physics
The list of observables already implemented in HEPfit includes several leptonic and semileptonic weak decays of flavoured mesons, meson-antimeson oscillations, and lepton flavour and universality violations.All these observables have been also implemented in models beyond the SM.
HEPfit also includes observables that require lepton flavour violation.In Table 6 we list some of the processes that have either been fully implemented ( ) or are currently under development (•).We also list out the models in which they have been implemented.H eff refers here both to NP in the weak effective Hamiltonian as well as to NP in the SMEFT.HEPfit is continuously under development and the list of available observables keeps increasing.The complete list can be found in the online documentation.

Model-specific observables
Explicit NP models usually enlarge the particle spectrum, leading to model-specific observables connected to (limits on) properties of new particles (masses, production cross sections, etc.).Furthermore, theoretical constraints such as vacuum stability, perturbativity, etc. might be applicable to NP models.Both kinds of observables have been implemented for several models extending the SM Higgs sector.

Processes SM THDM MSSM H
Table 6.Some processes that have been implemented ( ) or are under development (•) in HEPfit for flavour physics.
For example, in the THDM with a softly broken Z 2 symmetry we implemented the conditions that the Higgs potential is bounded from below at LO [115] and that the unitarity of two-to-two scalar scattering processes is perturbative at NLO [8,116,117].These requirements can also be imposed at higher scales; the renormalization group running is performed at NLO [36].Also the possibility that the Higgs potential features a second minimum deeper than the electroweak vacuum [118] can be checked in HEPfit.Similar constraints can be imposed on the Georgi-Machacek model.In this case, both boundedness from below [119] and unitarity [120] are available at LO.

Selected results using HEPfit
HEPfit has so far been used to perform several analyses of electroweak, Higgs and flavour physics in the SM and beyond.In this section we highlight some of the results that have been obtained, accompanied by a brief summary.The details of these analyses can be found in the original publications.

Electroweak and Higgs physics
The first paper published using the nascent HEPfit code featured a full-fledged analysis of EWPO in the SM and beyond [4], later generalized to include more NP models and Higgs signal strengths [7,17,28].In the top left plot of Figure 1, taken from ref. [4], we show the two-dimensional probability distribution for the NP parameters ε 1 and ε 3 [42,43], obtained assuming The impact of different constraints is also shown in the plot.The top right plot, from ref. [7], presents the results for modified Higgs couplings, multiplying SM Higgs couplings to vector bosons by a universal scaling factor κ V and similarly for fermions by a universal factor κ f .The figure shows the interplay between Higgs observables and EWPO in constraining the modified couplings.The bottom plot, taken from ref. [28], gives a pictorial representation of constraints on several effective couplings, including correlations, for different future lepton colliders.The HEPfit code was also used to obtain most of the results presented in the future collider comparison study in Ref. [27].These are summarized in the Electroweak Physics chapter of the Physics Briefing Book [121], prepared as input for the Update of the European Strategy for Particle Physics 2020. 6  -15 - Results of a fit for the LHCb results on the angular variable P 5 in two different theoretical scenarios: assuming the validity of an extrapolation of the QCD sum rules calculation of ref. [126] at maximum hadronic recoil to the full kinematic range (left), or allowing for sizable long-distance contributions to be present for q 2 closer to 4m 2 c (right).For more details see ref. [21] 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0  , where the green-filled p.d.f.shows the posterior obtained in the PMD approach after the inclusion of the updated measurement for R K , while the red-filled p.d.f. is the analogous posterior within the PDD approach (the dashed posteriors are the ones obtained employing the 2014 R K measurement); the following panels report the combined 2D p.d.f. of the corresponding results for R K and R K ⇤ , where the colour scheme follows the one employed in the first panel.The horizontal band corresponds to the 1 experimental region for R K ⇤ from [42], while the two vertical bands corresponds to the previous and the current 1 experimental regions for R K .Second row: analogous to the first row, but relative to the WC C LQ 2223 .Third row: analogous to the first row, but relative to the WC C NP 10,e .
of the IC in tables 1 -2 for the NP scenario ii).In this case, the description of LFUV ratios R K and R K ⇤ turned out to be optimal before the advent of the present R K update.From the IC value in table 2 and the comparison with the one given in table 1 for the scenario i), we can conclude that in the PMD approach the operator O LQ 2223 is not so well supported by b !s`+` data.In particular, the new R K value is not addressed within the 1 experimental uncertainty.This fact adds to the global information arising from the rest of the observables in the fit: as a consequence, in the PMD framework NP effects in O LQ 2223 are now disfavoured with respect to contributions present in Q 9V,µ .Interestingly, in the PDD approach the f.shows the posterior obtained in the optimistic approach to hadronic contributions after the inclusion of the updated measurement for R K , while the red-filled p.d.f. is the analogous posterior obtained allowing for sizable hadronic contributions (the dashed posteriors are the ones obtained employing the 2014 R K measurement); the following panels report the combined 2D p.d.f. of the corresponding results for R K and R K * , where the colour scheme follows the one employed in the first panel.The horizontal band corresponds to the 1σ experimental region for R K * from [127], while the two vertical bands corresponds to the previous and the current 1σ experimental regions for R K .Second row: analogous to the first row, but relative to the SMEFT Wilson coefficient C LQ 2223 .Third row: analogous to the first row, but relative to the NP contribution to the Wilson coefficient C NP 10,e .More details can be found in [24].
-16 - The correlations between P /T and the CP asymmetries (given in %).HFLAV world average of A CP has been used for the fit and these CP asymmetries correspond to the negative solution for the phases.The orange, red and green regions are the 68%, 95% and 99% probability regions respectively.The bottom right-most panel shows the fit to (P + 3 )/T = P /T 1.The green, red and orange regions are the 68%, 95% and 99% probability regions respectively.
Finally, we make some predictions from our fit.The branching fraction of the decay mode D + s !K + K L is yet unmeasured.However, the sum of the branching fractions for D + s !K + K S and D + s !K + K L has been measured by Belle yielding [114]: while the branching fraction BR(D + s !K + K S ) = (15.0±0.5)⇥10 3 .Several predictions have been made in the past for the rate asymmetry between D + s !K + K L and D + s !K + K S which is tantamount to predicting the branching fraction of the former since the branching fraction of the latter mode is measured to a very good precision.In [81,120] the branching fraction of D + s !K + K L is predicted to be smaller than the branching fraction of In contrast, we predict: which is almost equal to the branching fraction of D + s !K + K S with the central value of the former being greater than the latter.The discrepancy is discussed in the next section where we also discuss the rate asymmetry and compare with results in the literature.If we do not use the result in eq. ( 22) we get We also predict the relative strong phase between the amplitudes of the modes D 0 !K + ⇡ and D 0 !K ⇡ + .The world average of the measured value of this phase is (9.3 +8. 3  9. 2 ) [97][121] when one assumes that there is no CP violation in the DCS decays.From our fit we get [122]: which is compatible with the measured value.Various other estimates of K⇡ can be found in [79,[123][124][125][126].
In the exact SU(3) F limit K⇡ should be 0 [127][128][129], the deviation from which, as indicated by the fit result, underscores the significance of SU(3) F breaking through strong phases in the framework that we use.

B. Rate asymmetries
One can also define rate asymmetries involving interference of CA and DCS decays of the neutral D 0 meson to the neutral K⇡ final state.A method for measuring this was first proposed in [130].The rate asymmetry for the neutral D 0 initial state is defined as For the charged D + in the initial state, the rate asymmetry is defined as R(D + , ⇡ + ) with the substitutions D 0 !D + and ⇡ 0 !⇡ + .For D + s the rate asymmetry is defined as R(D + s , K + ) with the substitution D 0 !D + s and ⇡ 0 !K + in the above relation.The rate asymmetry in eq. ( 26) leads us to another U-spin breaking parameter ✏ 0 0 , the real part of which is can be shown to be given by Figure 4.The correlations between the ratio of the penguin and tree contributions, P /T , and the CP asymmetries (given in %).HFLAV world average of ∆A CP has been used for the fit and these CP asymmetries correspond to the negative solution for the phases.The orange, red and green regions are the 68%, 95% and 99% probability regions respectively.The bottom right-most panel shows the fit to (P + ∆ 3 )/T = P /T − 1.
The orange, red and green regions are the 68%, 95% and 99% probability regions respectively for the 2D histograms and the contrary for the 1D histogram.More details can be found in Ref. [23].

Flavour physics
Analyses in flavour physics using HEPfit has produced several results following the claimed anomalies in B physics.We started off by reexamining the SM theoretical uncertainties and the possibility of explaining the anomalies claimed in the angular distribution of B → K * + − decays through these uncertainties [6,9,12,21,22].We showed that the anomalies in the angular coefficients P 5 could be explained by allowing for a conservative estimate of the theoretical uncertainties, see Figure 2.
Having shown that the claimed deviations in the angular observables from the SM predictions could be explained by making a more conservative assumption about the non-perturbative contributions, we addressed the cases for the deviations from unity of the measured values of the lepton non-universal observables R K ( * ) , fitting simultaneously for the NP Wilson coefficients and the non-perturbative hadronic contributions [11,24].As before, we studied the impact of hadronic contributions on the global fit.The conclusions from our study were quite clear: on one hand the flavour universal effects could be explained by enlarged hadronic effects, reducing the significance of flavour universal NP effects.On the other hand, flavour non-universal effects could only be explained by the presence of NP contributions.In Figure 3 we present some of our results.More details can be found in Ref. [24].
Besides B physics, HEPfit has also been used for the analysis of final state interactions (FSI) and CP asymmetries in D → P P (P = K, π) decays.These have recently come to the forefront of measurements with the pioneering 5σ observation of ∆A Left panel: λ i vs λ j planes.The blue shaded regions are 99.7% probability areas taking into account theoretical constraints described in Section 4.4.Orange, pink and light blue lines mark the 95.4% boundaries of fits using only the oblique parameters (STU), all Higgs observables (strengths and direct searches) and flavour observables, respectively.The grey contours are compatible with all theoretical and experimental bounds at a probability of 95.4%.The solid lines are understood as the type II contours, the coloured dashed lines represent the corresponding type I fits.Right panel: Allowed regions in the heavy Higgs boson masses and their mass differences planes in the THDM of type I (dashed lines) and type II (solid lines).The unitarity bounds to the green, red and blue regions are meant at a probability of 99.7%, and the orange and grey lines mark the 95.4% boundaries.More details can be found in [8].
π + π − ) made by the LHCb collaboration [128][129][130].This work takes advantage of the high precision reached by the measurements of the branching ratios in two particle final states consisting of kaons and/or pions of the pseudoscalar charmed particles to deduce the predictions of the SM for the CP violating asymmetries in their decays.The amplitudes are constructed in agreement with the measured branching ratios, where the SU (3) F violations come mainly from the FSI and from the non-conservation of the strangeness changing vector currents.A fit is performed of the parameters to the branching fractions and ∆A CP using HEPfit and predict several CP asymmetries using our parameterization.In Figure 4 the fit to the penguin amplitude and the predictions for the CP asymmetries are shown.More details can be found in Ref. [23].

Constraints on specific new physics models: the case of extended scalar sectors
Several scalar extensions of the SM have been analysed using HEPfit.The THDM with a softly broken Z 2 symmetry has been widely studied taking into account most of the relevant constraints available at the moment.Theoretical constraints described in Section 4.4 are very useful to restrict the NP parameter space.In this case approximate expressions for the NLO perturbative unitarity conditions were obtained following the method described in [131].These expressions are valid in the large center-of-mass limit and therefore they are only considered above a certain energy scale, default value of which is set to 750 GeV.As shown in the left panel of Figure 5, constraints on the λ i − λ j (see Eq. (3.1)) planes can be obtained.These can be translated into constraints on physical observables such as the mass splitting of the scalar particles, m H − m A , m H − m H ± and m A − m H ± , as shown in the right panel of Figure 5. Theoretical constraints are independent of the specific model (type I, II, X, Y), which makes them especially useful.
Constraints on the mass planes coming from theoretical observables are complementary to the oblique STU parameters described in Section 4.1 (see left panel of Figure 5).Results coming from the Higgs observables (Section 4.2) are of special interest since they can provide us with direct bounds on the alignment angle β − α.Lastly, flavour observables described in Section 4.3 provide bounds on the Yukawa couplings (see Table 2), which depend on the quantity tan β when written in the physical basis.

Installation
The installation of HEPfit requires the availability of CMake in the system.A description of CMake and the details of how to install it can be found in the CMake website.Most package managers for Linux distributions should have a CMake package available for installation.For Mac users, it can be either installed from source or from a Unix port like Darwin Ports or Fink, or the installation package can be downloaded from the CMake website.We list below the dependencies that need to be satisfied to successfully install HEPfit: • GSL: The GNU Scientific Library (GSL) is a C library for numerical computations.It can be found on the GSL website.Most Linux package managers will have a stable version as will any ports for Mac.HEPfit is compatible with GSL v1.16 or greater.ROOT builds by default the MathMore library, which depends on GSL.Hence it is recommended to install GSL before installing ROOT.
• BOOST: BOOST is a C++ library which can be obtained from the BOOST website or from Linux package managers or Mac ports.HEPfit only requires the BOOST headers, not the full libraries, so a header-only installation is sufficient.HEPfit has been tested to work with BOOST v1.53 and greater.
• MPI: Optionally, HEPfit can be compiled with MPI for usage in parallelized clusters and processors supporting multi-threading.In this case, the HEPfit installer will patch and compile BAT with MPI support as described below.To this purpose one needs OpenMPI which is also available through package managers in Linux and ports on Mac.
• BAT v1.0 (not required for the Library mode): The BAT website offers the source code for BAT but it should not be used with HEPfit since a patch is required to integrate BAT with HEPfit.With the compilation option -DBAT INSTALL=ON explained below, the HEPfit installation package will download, patch and install BAT.The parallelized version of BAT compatible with the parallelized version of HEPfit can be installed with the additional option -DMPIBAT=ON for which MPI must be installed (see "MPI Support" below).

Detailed Installation Instructions
Unpack the tarball containing the HEPfit version x.y source which you can obtain from the HEPfit website.A directory called HEPfit-x.ywill be created containing the source code.To generate Makefiles, enter the source directory and run CMake: $ cd HEPfit -x .y $ cmake .< options > (RECOMMENDED:) Alternatively, a directory separate from the source directory can be made for building HEPfit (recommended as it allows for easy deletion of the build): $ mkdir HEPfit -x .y / build $ cd HEPfit -x .y / build $ cmake .. < options > where the available options are: • -DLOCAL INSTALL ALL=ON: to install BAT and HEPfit in the current directory (default: OFF).This is equivalent to setting the combination of the options: -D C M A K E _INST ALL_ PREFI X =./ HEPfit -DBAT_INSTALL_DIR =./ BAT -DBAT_INSTALL = ON These variables cannot be modified individually when -DLOCAL INSTALL ALL=ON is set.
• -DDEBUG MODE=ON: to enable the debug mode (default: OFF).HEPfit and is with or without MPI support as needed.(default: ON).
• -DMPIBAT=ON: to enable support for MPI for both BAT and HEPfit (requires an implementation of MPI, default: OFF).
• -DMPI CXX COMPILER=<path to mpi>/mpicxx: You can specify the MPI compiler with this option.
• -DBOOST INCLUDE DIR=<boost custom include path>/boost/: if BOOST is not installed in the search path then you can specify where it is with this option.The path must end with the boost/ directory which contains the headers.
• -DGSL CONFIG DIR=<path to gsl-config>: HEPfit used gsl-config to get the GSL parameters.If this is not in the search path, you can specify it with this option.
• -DROOT CONFIG DIR=<path to root-config>: HEPfit used root-config to get the ROOT parameters.If this is not in the search path, you can specify it with this option.
• -DINTEL FORTRAN=ON: If you are compiling with INTEL compilers then this flag turns on support for the compilers (default: OFF).
Setting the option -DBAT INSTALL=ON, the HEPfit installer will download, compile and install the BAT libraries.

NOTE:
If BAT libraries and headers are present in target directory for BAT they will be overwritten unless -DBAT INSTALL=OFF is set.This is done so that the correct patched version of BAT compatible with HEPfit gets installed.No MCMC mode: The generated Makefiles are used for building a HEPfit library.If you do not perform a Bayesian statistical analysis with the MCMC, you can use the option -DNOMCMC=ON.In this case, BAT is not required.
MPI Support: If you want to perform an MCMC run with MPI support, you can specify the option -DMPIBAT=ON.This option must not be accompanied with -DBAT INSTALL=OFF in order to enable the HEPfit installer to download, patch and compile BAT and build HEPfit with MPI support: $ cmake .-DMPIBAT = ON < other options > ROOT: CMake checks for ROOT availability in the system and fails if ROOT is not installed.You can specify the path to root-config using the option -DROOT CONFIG DIR=<path to root-config>.
BOOST: CMake also checks for BOOST headers availability in the system and fails if BOOST headers are not installed.You can specify the path to the BOOST include files with -DBOOST INCLUDE DIR=<boost custom include path>/boost/.
The recommended installation flags for a locally installed HEPfit with full MPI and MCMC support is: This will enable easy portability of all codes and easy upgrading to future version as nothing will be installed system wide.Also, this is useful if you do not have root access and cannot install software in system folders.After successful CMake run, execute the build commands: $ make $ make install to compile and install HEPfit, where the command make VERBOSE=1 enables verbose output and make -j allows for parallel compilation.Note that depending on the setting of installation prefix you might need root privileges to be able to install HEPfit with sudo make install instead of just make install.

Post installation
After the completion fo the installation with make install the following three files can be found in the installation location.The file libHEPfit.h is a combined header file corresponding to the library libHEPfit.a.Using hepfit-config: A hepfit-config script can be found in the <CMAKE INSTALL PREFIX>/bin/ directory, which can be invoked with the following options: • --cflags to obtain the include path needed for compilation against the HEPfit library.
• --libs to obtain the flags needed for linking against the HEPfit library.

Examples:
The example programs can be found in the HEPfit build directory: The first two demonstrate the usage of the HEPfit library, while the third one can be used for testing a Monte Carlo run with the HEPfit executable.The fourth example can be used to generate values of observables with a sample of parameters drawn from the parameter space.The fifth one is an example implementation of a custom model and custom observables.To make an executable to run these examples: $ cd examples / MonteCarloMode / $ make This will produce an executable called analysis in the current directory that can be used to run HEPfit.The details are elaborated on in the next section.

Usage and examples
After the HEPfit installer generates the library libHEPFit.aalong with header files included in a combined header file, HEPfit.h, the given example implementation can be used to perform a MCMC based Bayesian statistical analysis.Alternatively, the library can be used to obtain predictions of observables for a given point in the parameter space of a model, allowing HEPfit to be called from the user's own program.We explain both methods below.In addition HEPfit provides the ability to the user to define custom models and observables as explained in 2.3.We give a brief description on how to get started with custom models and observables.

Monte Carlo mode
The Monte Carlo analysis is performed with the BAT library.First, a text configuration file (or a set of files) containing a list of model parameters, model flags and observables to be analyzed has to be prepared.Another configuration file for the Monte Carlo run has to be prepared, too.
Step 1: Model configuration file The configuration files are the primary way to control the behaviour of the code and to detail its input and output.While a lot of checks have been implemented in HEPfit to make sure the configuration files are of the right format, it is not possible to make it error-proof.Hence, care should be taken in preparing these files.A configuration file for model parameters, model flags, and observables is written as follows: where the lines beginning with the '#' are commented out.Each line has to be written as follows: 1.The first line must be the name of the model to be analyzed, where the available models are listed in the HEPfit online documentation.
2. Model flags, if necessary, should be specified right after the model because some of them can control the way the input parameters are read.

3.
A model parameter is given in the format: where all the parameters in a given model (see the online documentation) have to be listed in the configuration file.

A set of correlated model parameters is specified with
C o r r e l a t e d G a u s s i a n P a r a m e t e r s name Npar which initializes a set of Npar correlated parameters.It must be followed by exactly Npar ModelParameter lines and then by Npar rows of Npar numbers for the correlation matrix.See the above example.
5. An Observable to be computed is specified in one of the following formats: • <name> is a user given name for different observables which must be unique for each observable.
• <obs label> is the theory label of the observable (see the online documentation).
• <histolabel> is used for the label of the output ROOT histogram, while <min> and <max> represent the range of the histogram (if <min> ≥ <max> the range of the histogram is set automatically).
• (no)MCMC is the flag specifying whether the observable should be included in likelihood used for the MCMC sampling.
• (no)weight specifies if the observable weight will be computed or not.If weight is specified with noMCMC then a chain containing the weights for the observable will be stored in the MCout*.rootfile.
• noMCMC noweight is the combination to be used to get a prediction for an observable.
• When the weight option is specified, at least one of the <Gaussian error> or the <flat error> must be nonvanishing, and the <central value> must of course be specified.
• When using the file option, a histogram in a ROOT file must be specified by the name of the ROOT file (filename) and then the name of the histogram (histoname) in the file (including, if needed, the directory).
• The writeChain option allows one to write all the values of the observable generated during the main run of the MCMC into the ROOT file.

6.
A BinnedObservable is similar in construction to an Observable but with two extra arguments specifying the upper and lower limit of the bin: -25 - Any construction for Observable mentioned in item 5 of this list above can be used in a CorrelatedGaussianObservables set.Also, BinnedObservables or FunctionObservables can be used instead of and alongside Observable.If noweight is specified for any Observable then that particular Observable along with the corresponding row and column of the correlation matrix is excluded from the set of CorrelatedGaussianObservables.
Step 2: Monte Carlo configuration file: The parameters and options of the Monte Carlo run are specified in a configuration file, separate from the one(s) for the model.Each line in the file has a pair of a label and its value, separated by space(s) or tab(s).The available parameters and options are: NChains: The number of chains in the Monte Carlo run.A minimum of 5 is suggested (default).If the theory space is complicated and/or the number of parameters is large then more chains are necessary.The amount of statistics collected in the main run is proportional to the number of chains.
PrerunMaxIter : The maximum number of iterations that the prerun will go through (Default: 1000000).The prerun ends automatically when the chains converge (by default R<1.1, see below) and all efficiencies are adjusted.While it is not necessary for the prerun to converge for a run to be completed, one should exercise caution if convergence is not attained.

NIterationsUpdateMax:
The maximum number of iterations after which the proposal functions are updated in the pre-run and convergence is checked.(Default: 1000) Seed: The seed can be fixed for deterministic runs.(Default: 0, corresponding to a random seed initialization) Iterations: The number of iterations in the main run.This run is for the purpose of collecting statistics and is at the users discretion.(Default: 100000) ber of events collected before setting automatically the histogram range.(Default: 100000) For example, a Monte Carlo configuration file is written as: where a '#' can be placed at the beginning of each line to comment it out.
Step 3: Run Library mode with MCMC: An example can be found in examples/MonteCarloMode $ cd examples / MonteCarloMode $ make After creating the configuration files, run with the command: $ ./analysis < model conf > < Monte Carlo conf > Alternative: Run with MPI HEPfit allows for parallel processing of the MCMC run and the observable computations.To allow for this HEPfit, and BAT have to be compiled with MPI support as explained in Section 6.The command $ mpiexec -n N ./analysis < model conf > < Monte Carlo conf > will launch analysis on N thread/cores/processors depending on the smallest processing unit of the hardware used.Our MPI implementation allows for runs on multi-threaded single processors as well as clusters with MPI support.NOTE: Our MPI implementation of HEPfit cannot be used with BAT compiled with the --enable-parallel option.It is mandatory to use the MPI patched version of BAT as explained in the online documentation.
Output Files: • log.txt: the log file containing information on the prerun and on the run.
• MCout.root: the ROOT file containing all the information of the run and the histograms (and possibly the corresponding chains).
• MonteCarlo results.txt: a text file containing some information on the fitted parameters.
• MonteCarlo plots.pdf: a file containing the histograms for the parameters.
• Observables: a directory containing the histograms for all the observables specified in the config file, as well as some text files.
• Observables/HistoLog.txt: a file containing the information on over-run and under-run during the filling of histograms.
• Observables/Statistics.txt: a file containing a compilation of the statistics extracted from the histograms.
Other files might be generated depending on the options specified in the Monte Carlo configuration file.

Event generation mode
Using the model configuration file used in the Monte Carlo mode, one can obtain predictions of observables.An example can be found in examples/EventGeneration folder: $ cd examples / EventGeneration $ make After making the configuration files, run with the command: $ ./analysis < model conf > < number of iterations > [ output folder ] The <number of iterations> defines the number of random points in the parameter space that will be evaluated.Setting this to 0 gives the value of the observables at the central value of all the parameters.If the [output folder] is not specified everything is printed on the screen and no data is saved.Alternately, one can specify the output folder and the run will be saved if <number of iterations> > 0. The output folder can be found in ./GeneratedEvents.The structure of the output folder is as follows.Output folder structure: • CGO: Contains any correlated Gaussian observables that might have been listed in the model configuration files.
• Observables: Contains any observables that might have been listed in the model configuration files.
• Parameters: Contains all the parameters that were varied in the model configuration files.
• Summary.txt:Contains a list of the model used, the parameters varied, the observables computed and the number of events generated.This can be used, for example, to access all the files from a third party program.
The parameters and the observables are stored in the respective directories in files that are named after the same.For example, the parameter lambda will be saved in the file lambda.txt in the Parameters folder.

Library mode without MCMC
The library mode allows for access to all the observables implemented in HEPfit without a Monte Carlo run.The users can specify a Model and vary ModelParameters according to their own algorithm and get the corresponding predictions for the observables.This is made possible through: • a combined library: libHEPfit.a(installed in HEPFIT INSTALL DIR/lib).

Custom Observables
The definition of custom observables does not depend on having defined a custom model or not.A custom observable can be any observable that has not been defined in HEPfit.It can be a function of parameters already defined in a HEPfit model or in a custom model or a combination of the two.However, a custom observable has to be explicitly added to the ThObsFactory in the main function as is done in examples/myModel/myModel MCMC.cpp.

Summary
HEPfit is a multipurpose and flexible analysis framework that can be used for fitting models to experimental and theoretical constraints.It comes with the ability to use the Bayesian MCMC framework implemented in BAT, which is highly efficient and allows for both factorized and nonfactorized priors and is integrated with ROOT.The key features of the HEPfit framework are: • It allows for Bayesian analyses using an efficiently parallelized MCMC and for any other custom statistical analysis that the user might want to implement.This is made possible by allowing for the computation of the observables using the HEPfit library.
• The Bayesian analysis framework in HEPfit using BAT is parallelized with MPI and can be run on a large number of processors without a substantial increase in the overhead.This makes the use of HEPfit extremely scalable from desktop computers to large clusters.
• Over and above the models and observables defined in HEPfit, it also allows for users to define their own models and observables.This gives users the flexibility to use HEPfit for any model and set of observables of their choice.User-defined models can add new parameters and the observables can be functions of these parameters and/or of the parameters already defined in HEPfit.

Figure 1 .
Figure 1.Selected results from the papers presented in Section 5.1.Top left (from ref. [4]): two-dimensional probability distribution for ε 1 and ε 3 in the fit, assuming ε 2 = ε SM 2 and ε b = ε SM b , showing the impact of different constraints.The SM prediction at 95% is denoted by a point with an error bar.Top right (from ref.[7]): two-dimensional 68% (dark) and 95% (light) probability contours for κ V and κ f (from darker to lighter), obtained from the fit to the Higgs-boson signal strengths and the EWPO.Bottom (from ref.[28]): a scheme-ball illustration of the correlations between Higgs and EW sector couplings.The Z-pole runs are included for FCC-ee and CEPC.Projections from HL-LHC and measurements from LEP and SLD are included in all scenarios.The outer bars give the 1σ precision on the individual coupling.

q 2 [q 2 [− 1 Figure 2 .
Figure2.Results of a fit for the LHCb results on the angular variable P 5 in two different theoretical scenarios: assuming the validity of an extrapolation of the QCD sum rules calculation of ref.[126] at maximum hadronic recoil to the full kinematic range (left), or allowing for sizable long-distance contributions to be present for q 2 closer to 4m 2 c (right).For more details see ref.[21]

Figure 2 :
Figure 2: First row: probability density function (p.d.f.) for the WC C NP 9,µ, where the green-filled p.d.f.shows the posterior obtained in the PMD approach after the inclusion of the updated measurement for R K , while the red-filled p.d.f. is the analogous posterior within the PDD approach (the dashed posteriors are the ones obtained employing the 2014

Figure 3 .
Figure 3. First row: probability density function (p.d.f.) for the NP contribution to the Wilson coefficient C NP 9,µ .The green-filled p.d.f.shows the posterior obtained in the optimistic approach to hadronic contributions after the inclusion of the updated measurement for R K , while the red-filled p.d.f. is the analogous posterior obtained allowing for sizable hadronic contributions (the dashed posteriors are the ones obtained employing the 2014 R K measurement); the following panels report the combined 2D p.d.f. of the corresponding results for R K and R K * , where the colour scheme follows the one employed in the first panel.The horizontal band corresponds to the 1σ experimental region for R K * from[127], while the two vertical bands corresponds to the previous and the current 1σ experimental regions for R K .Second row: analogous to the first row, but relative to the SMEFT Wilson coefficient C LQ 2223 .Third row: analogous to the first row, but relative to the NP contribution to the Wilson coefficient C NP 10,e .More details can be found in[24].
FIG. 1:The correlations between P /T and the CP asymmetries (given in %).HFLAV world average of A CP has
n t A l l M a rginalized true P r i n t C o r r e l at ion Ma tr ix true P r i n t K n o w l e d ge U p d a t e P l o t s false Pr in tP ar am eterPlot false M u l t i v a r i a teProposal true The parameters and

Table 1 .
Some representative runs with HEPfit to show the advantages of the MPI implementation.Times are given in DD:HH:MM.The number of iterations refer to the sum total of pre-run and main-run iterations.The number of chains are equal to the number of CPUs by choice.† The b → s analysis is done with factorized priors, hence the number of iterations should be multiplied by the number of parameters (∼50) to get a comparative estimate with the other cases.All runs performed in the BIRD or Maxwell clusters at DESY, Hamburg.

Table 2 .
Yukawa couplings in the four possible Z 2 symmetric THDM types.
In a nutshell, if all dependencies are satisfied, for a fully MPI compatible MCMC capable HEPfit version x.y installation from the tarball downloaded from the HEPfit website: This is all you need for running a MCMC simulation on 5 cores with the model, parameters and observables specified in the configuration files in examples/config directory with HEPfit.For variations please read what follows.
• -DBAT INSTALL DIR=<BAT installation directory>: (default: /usr/local).This option is overridden by -DLOCAL INSTALL ALL=ON .• -DBAT INSTALL=ON to download and install BAT.This is relevant only if -DNOMCMC=ON is not set.Use -DBAT INSTALL=OFF only if you know your BAT installation is already patched by Because of the order of parsing the <central value> <Gaussian error> <flat error> cannot be dropped out even in the noMCMC noweight case for a BinnedObservable.7.A FunctionObservable is the same as a BinnedObservable but with only one extra argument that points to the value at which the function is computed: 8.An asymmetric Gaussian constraint can be set using AsyGausObservable:AsyG ausObservable < name > < obs label > < histolabel > <min > <max > ( no ) MCMC ( no ) weight < central value > < left_error > < right_error >9.Correlations among observables can be taken into account with the lineCorrelatedGaussianObservables name Nobs, which initializes a set of Nobs correlated observables.It must be followed by exactly Nobs Observable lines and then by Nobs rows of Nobs numbers for the correlation matrix (see the above example).One can use the keywords noMCMC and noweight, instead of MCMC and weight.