Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F10881284
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
152 KB
Subscribers
None
View Options
diff --git a/Rosetta/README b/Rosetta/README
index 3e528dc..ac17147 100644
--- a/Rosetta/README
+++ b/Rosetta/README
@@ -1,918 +1,974 @@
################################################################################
- ____ __ __
- / __ \____ ____ ___ / /_/ /_ ___ _
- / /_/ / __ \/ ___/ _ \/ __/ __/ __ `/
- / _, _/ /_/ (__ ) __/ /_/ /_/ /_/ /
- /_/ |_|\____/____/\___/\__/\__/\__,_/
-
- An operator basis translator for Standard Model effective field theory
-
-Version 2.0, October 2016
-################################################################################
- References
+
+ ######## ####### ###### ######## ########## ######### ###
+ ## ## ## ## ## ## ######## ########## ######### ## ##
+ ## ## ## ## ## ### ### ### ## ##
+ ######## ## ## ###### ###### ##### ### ## ##
+ ## ## ## ## ## ### ##### ### #########
+ ## ## ## ## ## ## ######## ### ### ## ##
+ ## ## ####### ###### ######## ### ### ## ##
+
+ An operator basis translator for Standard Model effective field theory
+
################################################################################
-"Rosetta: an operator basis translator for Standard Model effective field theory"
-Eur.Phys.J. C75 (2015) no.12, 583
-arXiv:1508.05895
-Adam Falkowski, Benjamin Fuks, Kentarou Mawatari, Ken Mimasu, Veronica Sanz,
-Francesco Riva
-"Basis-independent constraints on Standard Model Effective Field Theories with
- Rosetta"
-arXiv:1605.02684
-Contribution 18 in "Les Houches 2015: Physics at TeV colliders - new physics
-working group report" (p.158)
-Jeremy Bernon, Alexandra Carvalho, Adam Falkowski, Bemjamin Fuks,
-Florian Goertz, Kentarou Mawatari, Ken Mimasu and Tevong You
+Version 2.0, October 2016
################################################################################
0) Description
################################################################################
Rosetta is a modular and flexible package for effective field theory (EFT) basis
translation and communication with event generation tools. The primary
framework which Rosetta has been designed to translate into is the
phenomenological effective Lagrangian in the mass eigenbasis named 'BSM
Characterisation' or 'bsmc' for short. The motivation for this choice lies in
the availability of an implementation within the FeynRules framework to be
downloaded from
http://feynrules.irmp.ucl.ac.be/wiki/BSMCharacterisation
which ensures the link with event generators and high-energy physics programs.
The most basic functionality of Rosetta is to map a chosen set of input
parameters (the Wilson coefficients in a specific basis choice) onto the bsmc
coefficients such that the output can be employed within tools relying on
the BSM Characterisation Lagrangian description. As long as the input format
respects the SLHA
conventions sketched in Section 4, the user may define his/her own map to the
bsmc coefficients (or to any other basis implementation) and proceed with
event generation using the accompanying FeynRules implementation. Alternatively
the user may want to simply translate between two existing basis
implementations for other reasons such as the availability of a particular high
energy physics program taking the parameters of a given basis as input. The
eHDECAY interface of Rosetta is an example of this.
One of the key features of Rosetta is the possibility to easily define one’s
own input basis and directly use it in the context of many programs via the
translation functionality of Rosetta. The strength of this approach is that it
is much simpler than developing from scratch new modules for existing tools in
the context of a new basis.
The tool consists of a Python package containing implementations of various EFT
bases and a command line tool 'rosetta' from which once can call a number of
interfaces described below. The main interface, 'translate', performs the task
of mapping a given basis to a target output basis. The core of the package
is based on the contents of the LHC Higgs Cross Section Working Group (HXSWG)
note (LHCHXSWG-INT-2015-001).
+
+ References
+ ----------
+ "Rosetta: an operator basis translator for Standard Model effective field
+ theory"
+ Eur.Phys.J. C75 (2015) no.12, 583
+ arXiv:1508.05895
+ Adam Falkowski, Benjamin Fuks, Kentarou Mawatari, Ken Mimasu, Veronica Sanz,
+ Francesco Riva
+
+ "Basis-independent constraints on Standard Model Effective Field Theories with
+ Rosetta"
+ arXiv:1605.02684
+ Contribution 18 in "Les Houches 2015: Physics at TeV colliders - new physics
+ working group report" (p.158)
+ Jeremy Bernon, Alexandra Carvalho, Adam Falkowski, Bemjamin Fuks,
+ Florian Goertz, Kentarou Mawatari, Ken Mimasu and Tevong You
+
################################################################################
Contents
################################################################################
1) Contact
2) Prerequisites
3) Package contents
4) Usage & translate interface
5) Input cards
6) The SLHA package
7) The basis class
8) Implementing your own basis
9) Flavor option
-10) eHDECAY interface
-11) Higgs signal strengths
-12) Lilith interface
-13) EWPO interface
+10) Other Interfaces
+10.1) DefaultCard interface
+10.2) eHDECAY interface
+10.3) Higgs signal strengths
+10.4) Lilith interface
+10.5) EWPO interface
################################################################################
1) Contact
################################################################################
Feel free to contact the authors with requests for features, bugs
etc. through k.mimasu@sussex.ac.uk.
################################################################################
2) Prerequisites
################################################################################
Python 2.7 or above in the 2.X series (not python 3).
################################################################################
3) Package contents
################################################################################
# Main module
Rosetta/ # Top-level python package
|-> __init__.py
|
|-> bases/ # Package for basis implementations
| |
| |-> __init__.py
| |-> BSMCharacterisation.py
| |-> HiggsBasis.py
| |-> HISZ.py
| |-> SILHBasis.py
| |-> TemplateBasis.py
| |-> WarsawBasis.py
|
|-> bin/ # Folder for executables.
| |
| |-> rosetta # Command line executable
|
|-> Cards/ # Sample SLHA-style parameter cards to be
| # used as input.
|
|-> config.txt # File storing configuration variables
|
-|-> interfaces/ # Interfaces to third party EFT/Higgs
+|-> interfaces/ # Core Translate & DefaultCard interfaces
+| | # plus interfaces to third party EFT/Higgs
| | # software.
+| |-> DefaultCard/
| |-> eHDECAY/
+| |-> EWPO/
| |-> Lilith/
| |-> SignalStrengths/
-| |-> EWPO/
+| |-> Translate/
|
|-> internal/
| |
| |-> __init__.py
| |-> basis/ # Package containing base Basis class.
| |
| |-> constants.py # Stores a number of useful dictionaries
| | # mapping PDG particle IDs and SLHA input
| | # numbers to names, default values for SM
| | # inputs and particle masses, CKM matrix
| | # etc.
| |
| |-> errors.py # Rosetta Errors
| |
| |-> machinery.py # Finds basis implementations and
| | # constructs possible translation paths
| | # between them.
| |
| |-> matrices.py # Higher level matrix objects inheriting
| | # from structures in SLHA.py such as
| | # HermitianMatrix, AntiSymmetricMatrix, ...
| | # Contains a number of matrix operations
| | # such as multiplication and addition for
| | # use in translation functions.
| |
| |-> parsers.py # Command line subparser manager for
| | # Rosetta interfaces
| |-> session.py # Session manager module.
| |
| |-> settings.py # Settings manager module.
| |
| |-> SLHA.py # Machinery for reading, manipulating and
| # writing SLHA-style input cards. Partly
| # inspired by pySLHA (A. Buckley,
| # arXiv:1305.4194).
|
|-> LICENSE # Software license.
|-> README # You are here.
# Existing basis implementations
BSMCharacterisation.py # General modified interaction Lagrangian
# up to dimension 6
HiggsBasis.py # The Higgs Basis as defined in the HXSWG
# draft.
WarsawBasis.py # The Warsaw Basis as defined in
# arXiv:1008.4884 and the HXSWG draft.
SILHBasis.py # The SILH Basis as defined in, e.g.,
# arXiv:1303.3876 and the HXSWG draft.
HISZ.py # The Hagiwara-Ishihara-Szalapski-
# Zeppenfeld Basis for gauge-Higgs
# interactions defined in Phys.Rev. D48
# (1993) 2182-2203 and the HXSWG draft.
TemplateBasis.py # Template for a user-defined Basis class
# implemented in the Rosetta package.
* _diagonal and _universal versions of the cards are also included reflecting the
simplified input formats one can use when employing the --flavor option of
translate)
################################################################################
-3) Usage & translate interface
+4) Usage & translate interface
################################################################################
The rosetta command line executable manages the desired functionality of the
tool based on the implemented interfaces included in the "interfaces" directory.
Entering in the terminal:
>> bin/rosetta -h
will bring up the command line documentation:
>> usage: rosetta [-h] [-s] [-v] [--force] INTERFACE ...
>>
>> Main Rosetta command-line executable.
>>
>> Global options:
>> -h, --help show this help message and exit
>> -s, --silent Suppress all warnings and take default answers to all
>> questions
>> -v, --verbose Activate verbose setting for program output
>> --force Take default answers to all questions
>>
>> Arguments:
>> INTERFACE
>> translate Translate in SLHA input card from one basis to another
>> lilith Standalone Lilith interface
>> signalstrengths
>> Standalone SignalStrengths interface
>> ewpo EWPO interface
>> defaultcard Generate a parameter card for an implemented basis
>> ehdecay Standalone eHDECAY interface
The desired interface the user would like to call is supplied as an argument to
the rosetta tool which will then invoke the corresponding sub-parser for
options and arguments specific to that interface. Rosetta has a few global
options to control the level of standard output and forcing default answers to
user prompts.
The translate interface takes an SLHA-style param card (see sample
cards provided in Cards/ directory) in a particular basis and outputs a new
card in the specified basis (default is BSM Characterisation).
Command line documentation:
>> usage: rosetta translate [-h] [-o OUTPUT] [--ehdecay] [--dependent] [--target]
>> [--flavor] [-w]
>> PARAMCARD
>>
>> Read in an SLHA format parameter card in a particular basis and write a new
>> card in another implemented basis.
>>
>> positional arguments:
>> PARAMCARD Input parameter card.
>>
>> optional arguments:
>> -h, --help show this help message and exit
>> -o OUTPUT, --output OUTPUT
>> Output file name. Default: [PARAMCARD]_new
>> --ehdecay Interface with eHDECAY for Higgs branching fractions.
>> --dependent Also write out dependent parameters to output card
>> --target Basis into which to translate. Allowed values are:
>> higgs, bsmc, template, silh, hisz, warsaw (default =
>> bsmc)
>> --flavor Specify flavor structure. Allowed values are: general,
>> diagonal, universal (default = general).
>> -w, --overwrite Overwrite any pre-existing output file.
Rosetta will read the SLHA card, look for the 1st element of block "basis", and
see if any implemented basis classes have this unique identifier. If so, Rosetta
will fill an instance of this class with the values of the parameters specified
in the parameter card and perform certain consistency checks, making sure all
required parameters are defined etc.
Any dependent parameters are then calculated and the translation is performed
between the input basis and the target basis (bsmc by default), provided the
right translation path exists. An SLHA style parameter card will then written
out in the new basis.
Rosetta can optionally interface with eHDECAY provided a translation path
between the input basis and the SILH basis exists. The results of eHDECAY
are also written to the SLHA card in the form of a decay block for the Higgs.
See section 8 for more details.
Example basic usage:
To translate from the SILH basis to the BSMC Lagrangian, one could take
Cards/SILHBasis.dat as a template input card and run:
bin/rosetta translate -o my_out.dat my_input.dat
To translate to the Warsaw basis instead, one should use the -t option and
specify 'warsaw' as the target basis:
bin/rosetta translate -o my_out_warsaw.dat --target warsaw my_input.dat
Example usage with the flavor option (See also section 8):
The flavor option '--flavor' currently accepts the arguments 'general',
'diagonal' and 'universal'. It tells Rosetta to assume a particular flavor
structure in the input file. When a translation to a basis which is NOT the
bsmc is specified via the '--target' option, the output file block structure
also reflects this choice on the flavor structure.
- 'general' : The default setting corresponding to the full flavor structure.
- 'diagonal' : Keep only the diagonal terms in the flavor matrices i.e. the
(1,1), (2,2) & (3,3) entries.
- 'universal' : Coefficients are all flavor diagonal and universal.
As an example, taking Cards/WarsawBasis_diagonal.dat as a template input, the
command:
bin/rosetta translate my_input_diagonal.dat --flavor diagonal -o my_out_diag.dat
Will generate a BSMC param card with only the diagonal flavor
components non-zero. On the other hand,
bin/rosetta translate my_input_diagonal.dat --target silh -flavor diagonal -o my_out_diag_silh.dat
Will generate a SILH basis parameter card respecting the original flavor
structure, i.e. that of Cards/SILHBasis_diagonal.dat.
In general, one should ensure that the block structure of the input card
respects the flavor option specified, otherwise, Rosetta will crash.
Example usage with the eHDECAY option:
bin/rosetta translate my_input.dat --target silh --ehdecay -o my_out_ehdecay_silh.dat
This command will generate the same output as the basic usage example with the
addition of an SLHA decay block for the Higgs with the results of the eHDECAY
run. It will also save the eHDECAY input file fed to the program as 'ehdecay.in'.
################################################################################
-4) Input cards
+5) Input cards
################################################################################
Rosetta is designed to read input cards in a format similar to the SUSY Les
Houches Accord (SLHA) detailed in http://arxiv.org/abs/hep-ph/0311123.
Sample cards can be found in the Cards/ directory.
The SHLA reader looks for block structures in a case insensitive way i.e.
>> BLOCK MYBLOCK
Specifically it will search for blocks MASS, SMINPUTS and BASIS. The basis into
which the card is read is taken from the 0 entry in the BASIS block. This name
should match a basis declared in implemented.py (see next section).
Block elements should be named by placing a comment alongside each
entry. The parameter name will be taken as the first non-whitespace characters
following the '#' character.
The main difference between the input format of Rosetta and SLHA is that names
of parameters are required for new physics parameter blocks. Parameters can
then be referenced by name or number in the corresponding block or,
alternatively, by name only from the SHLA.Card instance stored in as self.card
in the basis instance.
>>BLOCK MYBLOCK
>> 0 3.14159E+00 # pi
>> 1 1.97327E-01 # hbarc_GeVfm
>> Block sminputs
>> 1 1.325070e+02 # aEWM1 (white space doesn't matter)
ETC.
The block structure of the new physics couplings is basis dependent and should
be declared in the `blocks` data member of the basis class. This should be a
python dictionary with block names as keys and lists of parameter names as
values. The ordering of the list determines the entry number of each parameter.
For example,
>> blocks = {'ONE':['A','B','C'], 'TWO':['D','E','F']}
will generate the following block structure:
>> block one
>> 0 0.0 # A
>> 1 0.0 # B
>> 2 0.0 # C
>>
>> block two
>> 0 0.0 # D
>> 1 0.0 # E
>> 2 0.0 # F
The reader reads all lines until the next occurrence of 'BLOCK' or 'DECAY',
ignoring leading and trailing white space and all lines beginning with a '#' as
well as lines that do not match the expected pattern detailed above. For blocks
BLOCKIN and SMINPUTS, the reader stores special SLHA.Block instances as
self.mass and self.inputs data member of the basis instace.
>> block mass
>> 5 4.700000e+00 # MB
>> 6 1.730000e+02 # MT
>> 15 1.730000e+02 # MTAU
>> 23 9.118800e+01 # MZ
>> 25 1.250000e+02 # MH
Block basis should have one element corresponding to the "name" attribute of an
existing basis implementation.
>> block BASIS
>> 0 MyBasis # name of basis
Rosetta will also accept BLOCK structures in matrix format with multiple
counters e.g.
>> block MAT
>> 1 1 1.0e-01 # MAT1x1
>> 1 2 1.0e-01 # MAT1x2
>> 2 1 1.0e-01 # MAT2x1
>> 2 2 1.0e-01 # MAT2x2
These will then be indexable also by name or by index [i,j,...]. The naming
convention for the individual elements adopted is to suffix the block name with
the indices separated by an 'x' character as shown above. Complex parameters
should also have a blocks containing their imaginary parts prefixed by 'IM'.
The naming convention then adopted there is to prefix the real parts with 'R'
and the imaginary parts with 'I'. The name of complex parameter as a whole will
be prefixed with 'C'. If our previous example matrix were complex, the two
following blocks would be defined
>> block MAT
>> 1 1 1.0e-01 # RMAT1x1
>> 1 2 1.0e-01 # RMAT1x2
>> 2 1 1.0e-01 # RMAT2x1
>> 2 2 1.0e-01 # RMAT2x2
>>
>> block IMMAT
>> 1 1 1.0e-01 # IMAT1x1
>> 1 2 1.0e-01 # IMAT1x2
>> 2 1 1.0e-01 # IMAT2x1
>> 2 2 1.0e-01 # IMAT2x2
################################################################################
-5) The SLHA package
+6) The SLHA package
################################################################################
Rosetta contains a basic SLHA card reader/writer that can parse and store the
contents of an SLHA formatted input card. Individual blocks and decays are
stored as SLHA.Block and SLHA.Decay instances that can be indexed and iterated
over in the same way as python dictionaries, in a case-insensitive way.
SLHA.Block is essentially a named OrderedDict storing index:value pairs
corresponding to the elements of an SLHA block. SLHA.Block has a "name"
attribute and forces keys to be of type `int` or to be castable via int().
SLHA.Matrix is essentially a named OrderedDict storing index:value pairs
corresponding to the elements of an SLHA block with multiple counters.
SLHA.Matrix has a "name" attribute and forces keys to be tuples .
SLHA.Decay is an OrderedDict with a "PID" attribute for the particle whose
decay information it contains as well as a "total" attribute to store the
total width of the particle. Each entry key is a tuple if PIDs corresponding
to the decay products and the associated value is the branching fraction of
that particular channel.
SLHA.NamedBlock is a subclass of SHLA.Block with the additional feature that
each block entry is associated to a name in accordance with the way Rosetta
can read the input card. Each value can then be accessed either by key or
by value.
SLHA.NamedMatrix, analogously to NamedBlock, adds the naming feature to
matrix objects.
SLHA.Card is the object storing the various SLHA blocks and decays. Indexing
such an object with an integer will look for a Decay object associated to
that PID, while indexing with a string will look for a parameter with that
name in one of its NamedBlock instances. SLHA.Card objects possess two
OrderedDicts, "blocks" and "decays" storing the individual
SLHA.(Named)Block and SLHA.Decay instances.
Each SLHA object can print itself out in the usual SLHA format, while the
SLHA.Card object has a write() function to write itself to a file. There also
exist complex versions of the Block, Matrix, NamedBlock, and NamedMatrix
objects named CBlock, CMatrix, CNamedBlock, and CNamedMatrix which can store
complex values and have two of their corresponding real containers storing
their real and imaginary parts in _re and _im attributes.
################################################################################
-6) The basis class
+7) The basis class
################################################################################
Each implemented basis in Rosetta is a python class inheriting from the `Basis`
class in Rosetta/internal/basis/basis.py. They are designed to be instantiated
either empty or with an SLHA format parameter card specified by the param_card
option. The contents of the card are stored as an SLHA.Card object and the
special blocks "mass" and "sminputs" are stored as SLHA.NamedBlock instances in
self.mass and self.input respectively. Some of the key data members are:
self.name - Unique basis identifier. This will be compared to the 0th element
of the block basis in the SLHA parameter card to ensure that
right basis class is being instantiated for a given input card.
self.card - SLHA.Card instance containing SLHA.NamedBlock and SLHA.Decay
instances corresponding to those specified in the parameter card.
Object names taken to be the first non-whitespace characters
after a "#" character in a block or parameter definition are also
stored.
self.mass - SLHA.NamedBlock instance for the "mass" block
self.inputs - SLHA.NamedBlock instance for the "sminputs" block
self.required_inputs
- A set of SLHA input IDs denoting those required to be defined in
the SLHA input card in order to perform implemented translations.
self.required_masses
- A set of PDG particle IDs denoting particles whose mass is
required to be defined in the SLHA input card in order to perform
implemented translations.
self.independent
- A list of coefficients deemed to be input parameters to the basis
implementation.
self.blocks (optional but strongly recommended)
- A dictionary of name:coefficients pairs where name is the SLHA
block name desired and coefficients is a list of coefficient
names associated to that block.
self.flavored
- A dictionary with keys corresponding to the names of data blocks
possessing flavor flavor structure. These will be assumed to be
3 by 3 matrices and will be acted upon by the -f or --flavor
option of the translate script. The values of the dictionaries
should, in turn also be dictionaries detailing the desired
properties of said matrix. The keys 'domain', 'kind' and 'cname'
are accepted.
The options of a matrix listed in the 'flavored' attribute can be as follows:
'domain': 'real' or 'complex'
'kind': 'symmetric', 'antisymmetric', 'hermitian', 'general'
'cname': the name given to each element of the matrix in between the prefix
and suffixes described by the convention in section 4. If not set,
this will default to the block name.
self.blocks, self.flavored, self.required_inputs and self.required_masses
should be defined in accordance with block structure of the input SLHA
parameter card, Blocks "sminput" and "mass" respectively (the Z and Higgs
masses are also stored in self.inputs). Specifically, the block (matrix) names
specified as keys in self.blocks (self.flavored) should match block names in
the SLHA card as well as the names and indices of their elements (taken to be
the order in which the appear in the list associated to the block in
self.blocks or the naming conventions described above for elements of
self.flavored). The blocks "mass" and "sminputs" of the SLHA card should
minimally contain the entries specified in required_masses and required_inputs
respectively. A number of checks related to these definitions are performed by
check_param_data(), check_mass() and check_sminputs() on the data read in from
the parameter card. These can be found in the basis/checkers.py module.
Basis and any of its subclasses are designed to work similarly to a
dictionary in that parameter values can be referenced by name (duplicate
names in different blocks are not handled properly so try to avoid them).
A value can be referenced in various ways, see below example where the
parameter named 'D' is stored as entry 3 in the block 'letters' written in
'mycard.dat':
>> instance = MyBasis(param_card='mycard.dat')
>> instance['A'] = 0.5 # set value according to name in SLHA card
>> instance.card['A'] = 0.5 # equivalent to the above
>> instance.card.blocks['letters']['A'] = 0.5 # from block by name
>> instance.card.blocks['letters'][3] = 0.5 # from block by entry
A number of other container methods are defined for easy of manipulation:
>> print len(instance) # number of EFT coefficients
>> for i in instance: # iterator methods also defined
>> print i
>> for k, v in instance.items(): # name, value pairs
>> print k, v
Matrix parameters can be indexed as follows (all methods are equivalent):
>> instance['mat'][1,2] = 0.5 # set (1,2) element of
>> instance.card['mat'][1,2] = 0.5 # equivalent to the above
>> instance.card.matrices['mat'][1,2] = 0.5 # equivalent
>> instance['mat1x2']= 0.5 # from instance by name
>> instance['mat']['mat1x2']= 0.5 # from matrix by name
>> instance.matrices['mat']['mat1x2']= 0.5 # equivalent
Complex matrix parameters have the additional functionality of setting
individual real or imaginary parts by name or accessing the
complex value by name.
>> instance['cmat'][1,2] = complex(0.5, 0.5) # set (1,2) element
>> instance['Ccmat1x2']= complex(0.5, 0.5) # complex value by name
>> instance['Rcmat1x2']= 0.5 # real part by name
>> instance['Icmat1x2']= 0.5 # imaginary part by name
basis/io.write_param_card() writes the contents of the self.newcard into a new
SLHA formatted file. Another useful method basis/io.write_template_card()
generates and empty parameter card according to the block definitions and
required inputs of a given basis class.
################################################################################
-7) Implementing your own basis
+8) Implementing your own basis
################################################################################
Implementing ones own basis involves creating a file inside the bases/ directory
of Rosetta, alongside HiggsBasis.py etc., containing a subclass of Basis. The
only required data member to be defined is self.name. However, users will
mostly likely want to define self.independent, self.required_inputs and
self.required_masses as well as structure their basis into blocks using
self.blocks (Rosetta will create one block named "newcoup" if self.blocks is
not defined) and self.flavored. An example is shown below where the required
-data members are defined outside the class construtor so as to instrinsically
+data members are defined outside the class constrcutor so as to intrinsically
belong to all instances of the class. This code would be saved in
Rosetta/MyBasis.py. It is essential that the file name match the class name.
>> from internal import Basis
>>
>> class MyBasis(Basis.Basis):
>> name = 'mybasis'
>> independent = {'A', 'B', 'C', 'one', 'two', 'MYxMAT'}
>> required_inputs = {1, 2, 4} # a_{EW}^{-1}, Gf and MZ required
>> required_masses = {24, 25, 6} # Z, Higgs and top masses required
>> blocks = {'letters':['A', 'B', 'C', 'D']
>> 'numbers':['one', 'two', 'three']} # Expected block structure
>> flavored = {'MYxMAT':{'kind':'hermitian',
>> 'domain':'complex',
>> 'cname':'mat'}} # Hermitian flavor matrix
>>
The list self.independent stores the basis parameters which should be read
in from the SLHA card. Any other parameters declared in self.blocks are assumed
to be set by the user in the calculate_dependent() method. The user can define
calculate_dependent() to set any dependent parameters (those listed in in
self.blocks but not in self.independent) and any number of additional
functions, usually to translate the coefficients into a given basis which sets
the SLHA.Card object, self.newcard. Alternatively, if it is more simple,
the dependent attribute can be defined to explicitly tag coefficients as not
independent.
The input card for this example containing the independent parameters would
look like:
block letters
1 0. # A
2 0. # B
3 0. # C
block numbers
1 0. # one
2 0. # two
block MYxMAT
1 1 0. # Rmat1x1
1 2 0. # Rmat1x2
1 3 0. # Rmat1x3
2 2 0. # Rmat2x2
2 3 0. # Rmat2x3
3 3 0. # Rmat3x3
block IMMYxMAT
1 1 0. # Imat1x1
1 2 0. # Imat1x2
1 3 0. # Imat1x3
2 2 0. # Imat2x2
2 3 0. # Imat2x3
3 3 0. # Imat3x3
Only the non-redundant elements of a matrix should be defined in the input card
e.g. the upper triangle for the hermitian matrix 'MYxMAT'.
-Rosetta differentiaties from general utility functions and translation
+Rosetta differentiates from general utility functions and translation
functions using the "translation" decorator. Any function designed to take you
-to another existing basis implemenation should be decorated with the
+to another existing basis implementation should be decorated with the
"translation" decorator with an argument corresponding to the name of the
target basis. This name should match the unique name of an existing basis
implementation also contained in the Rosetta root directory. Below would be
example of a translation function from our example to the Warsaw Basis.
>> @Basis.translation('warsaw') # identifies as translator to warsaw
>> def mytranslation(self, instance):
>> instance['cWW'] = 10.
>> instance['cpHl11'] = self['myparam']
>> return instance
The translating function must ONLY take an instance of the target class as its
second argument alongside the default "self" argument for a class method. In
this way, Rosetta can universally and automatically detect and use intended
translation functions.
Additional modifications to e.g. SM input parameters or particle masses should
be implemented in the modify_inputs() function.
>> def modify_inputs(self):
>> self.mass[24]= 100.
Any python module saved in the root directory of the Rosetta package is
assumed to be a basis implementation. Furthermore, the class name of the
basis implementation MUST be the same as the file name of the python
module. In our example above, the class `MyBasis` would have to be saved in
a file named MyBasis.py. This is to help Rosetta automatically identify the
possible translation paths between bases. Any such class can then be used
by the command line script "translate". For example, Rosetta should be able
to figure out all possible multi-step translations.
The user is referred to Rosetta/TemplateBasis.py for a toy working example of a
user defined basis.
################################################################################
-8) Flavor option
+9) Flavor option
################################################################################
The --flavor option of Rosetta's translate tool allows users to specify
special structure for parameters with flavor indices. These correspond to
those decared in the flavored attribute of a class implementation and have 3 by
3 flavor indices. Choosing a particular value for the flavor option amounts to
modifying the intended input and output blocks of a given translation. The
allowed options are 'general' 'diagonal' and 'universal'. 'general' is the
default setting while 'diagonal' only retains the diagonal elements of said
flavor matrices. 'universal' assumes no flavor structure whatsoever and set
all flavor matrices to be universal and diagonal.
In every reduced flavor case, the number of input and output parameters
decreases. The input card for the 'diagonal' option should only define the
(1,1) (2,2) and (3,3) elements of each block while that of the 'universal'
assumption should only define the (1,1) element. The output file will also
reflect this except in the case where the target is the BSMC Lagrangian since
it is important for this format to correctly interface with the FeynRules model
implementation where SLHA blocks with matrix structures should declare all
elements.
################################################################################
-9) eHDECAY interface
+10) Other interfaces
+################################################################################
+################################################################################
+10.1) DefaultCard interface
+################################################################################
+
+interfaces/DefaultCard/ # DefaultCard interface Package
+|-> __init__.py
+|-> interface.py # rosetta command line interface implementation
+|-> README # A copy of the contents of this section
+
+DefaultCard provides a simple utility to generate a default SLHA input card for
+an existing basis implementation in rosetta.
+
+Command line documentation:
+
+ >> usage: rosetta defaultcard [-h] [--value VALUE] [-o OUTPUT] [--flavor FLAVOR]
+ >> [-w]
+ >> BASIS
+ >>
+ >> Generate a parameter card for an implemented basis
+ >>
+ >> positional arguments:
+ >> BASIS Basis class for which to generate the parameter card.
+ >> Allowed values are: higgs, bsmc, template, silh, hisz,
+ >> warsaw (default = bsmc)
+ >>
+ >> optional arguments:
+ >> -h, --help show this help message and exit
+ >> --value VALUE Set value of all parameters to VALUE. The value
+ >> "random" will set random coefficients between -1. and
+ >> 1.
+ >> -o OUTPUT, --output OUTPUT
+ >> Output file name. Default:
+ >> [BASIS]_[FLAVOR]_default.dat
+ >> --flavor FLAVOR Specify flavor structure. Allowed values are: general,
+ >> diagonal, universal (default = general)
+ >> -w, --overwrite Overwrite any pre-existing output file
+
+################################################################################
+10.2) eHDECAY interface
################################################################################
interfaces/eHDECAY/ # eHDECAY interface Package
|-> __init__.py
-|-> eHDECAY.py # Interface implementation
+|-> eHDECAY.py # Main implementation
|-> errors.py # package specific errors
+|-> interface.py # rosetta command line interface implementation
+|-> README # A copy of the contents of this section
A useful program based on HDECAY (arXiv:hep-ph/9704448) for calculating the
Higgs total width was developed in 2014 and is described in arXiv:1403.3381.
The program takes as input a number of parameters in the SILH basis to calculate
the width and branching ratios to SM particles optionally including Electroweak
corrections.
In order to have this working correctly the user must modify
Rosetta/config.txt, putting the absolute path to the base directory of a local
eHDECAY installation. There must exist a possible translation path between the
input basis and the SILH basis. The internal/eHDECAY.py module then performs
this translation, rescales the relevant parameters of the Rosetta SILH basis
implementation to match the conventions of arXiv:1403.3381 and executes a run
of eHDECAY. The results are stored and a copy of the input file "ehdecay.in" is
saved locally. The results are then written to and SLHA decay block in the
output card. The relevant input parameters are:
SM inputs: # ALL masses must be nonzero for eHDECAY to give a finite result
'MC', 'MB', 'MT', 'MMU', 'MTAU, # SM fermion masses
'MH', 'MZ', 'MW', 'aEWM1' 'Gf', # EW input masses, (alpha_EW)^-1, G_Fermi
'aSMZ' # alpha_S(MZ)
SILH coefficients:
'CHbar' , 'CTbar' , 'Ctaubar', 'Cmubar', 'Ctbar',
'Cbbar' , 'Ccbar' , 'Csbar' , 'CWbar' , 'CBbar',
'CHWbar', 'CHBbar', 'Cgambar', 'Cgbar'
eHDECAY option:
'IELW' # Electroweak corrections switch (1:on, 0:off)
eHDECAY can potentially give negative branching fractions and even a negative
total Higgs width for unreasonable choices of EFT parameters. A negative total
width is currently not allowed while negative branching fractions are not
handled and will be omitted from the parameter card.
The interface has a standalone version that simply prints the SLHA decay block
for the Higgs or can be invoked as an option in the translate interface
Command line documentation:
>> usage: rosetta ehdecay [-h] [-o OUTPUT] [--dependent] [--EW] [--flavor] [-w]
>> PARAMCARD
>>
>> Run the eHDECAY interface to obtain the Higgs branching fractions
>>
>> positional arguments:
>> PARAMCARD Input parameter card
>>
>> optional arguments:
>> -h, --help show this help message and exit
>> -o OUTPUT, --output OUTPUT
>> Write out a new SLHA card containing the decay block
>> --dependent Also write out dependent parameters to output card
>> --EW switch on electroweak corrections in eHDECAY
>> --flavor Specify flavor structure. Allowed values are: general,
>> diagonal, universal (default = general)
>> -w, --overwrite Overwrite any pre-existing output file
################################################################################
-10) Higgs Signal Strengths
+10.3) Higgs Signal Strengths
################################################################################
interfaces/SignalStrengths/ # SignalStrengths interface Package
|-> __init__.py
|-> BR/ # Folder storing tabulated SM Higgs branching
| | # fractions and total widths provided by the
| | # LHCHXSWG.
| |-> ff.dat
| |-> VV.dat
|
-|-> production.py # Calculation of higgs production rescaling
-| # factors.
-|
+
|-> decay.py # Calculation of higgs decay partial width
| # rescaling factors, optionally using Rosetta's
| # eHDECAY interface.
|
|-> errors.py # Package-specific errors.
-|
+|-> interface.py # rosetta command line interface implementation
|-> loopfunctions.py # Fermion and gauge boson triangle loop functions.
-|-> README # A copy of the contents of this section
+|-> production.py # Calculation of higgs production rescaling
+| # factors.
+|
+|-> README # A copy of the contents of this section
Rosetta provides an interface through which to calculate the SM Higgs signal
strengths given an input of EFT parameters in a given basis. The 'mu' factors
are calculated for each production and decay channel by rescaling the
production cross sections partial widths, and total width of the Higgs. The
approach implemented is summarised in arXiv:1505.00046, where analytical or
numerical formulae each of the rescaling factors are provided.
A translation path to the BSM Characterisation basis must be present.
This package has a standalone version that prints out a list of signal
strengths and is also used internally by the Lilith interace.
Command line documentation:
>> usage: rosetta signalstrengths [-h] [--squares] [--sqrts] [--flavor] PARAMCARD
>>
>> Run the SignalStrengths interface to obtain the mu's for all of the Higgs
>> production and decay channels.
>>
>> positional arguments:
>> PARAMCARD Input parameter card.
>>
>> optional arguments:
>> -h, --help show this help message and exit
>> --squares Retain quadratic order in EFT coefficients (NOT IMPLEMENTED)
>> --sqrts Specify pp collider centre-of mass energy in TeV. Allowed values
>> are: 7, 8, 13 (default = 8).
>> --flavor Specify flavor structure. Allowed values are: general, diagonal,
universal (default = general).
################################################################################
-11) Lilith interface
+10.4) Lilith interface
################################################################################
interfaces/Lilith/ # Lilith interface Package
|-> __init__.py
-|-> Lilith.py # Interface implementation
|-> errors.py # package specific errors
+|-> interface.py # rosetta command line interface implementation
+|-> Lilith.py # Main implementation
|-> README # A copy of the contents of this section
A useful program for computing the combined likelihood using the latest Higgs
signal strength data is described in arXiv:1502.04138. Using the
SignalStrengths interface, Rosetta constructs the Higgs signal strengths and
feeds them to Lilith to obtain the chi-squared goodness of fit measure to the
Higgs data as calculated by a local installation of Lilith.
In order to have this working correctly the user must modify
Rosetta/config.txt, putting the absolute path to the base directory of a local
Lilith installation. The function calculate_likelihood(basis) performs the task
described above where basis is a Rosetta basis instance.
A translation path to the BSMCharacterisation "basis" must be present.
Command line documentation:
>> usage: rosetta lilith [-h] [--squares] [--flavor] PARAMCARD
>>
>> Run the Lilith interface to obtain the likelihood value with respect to the
>> latest Higgs signal strength data for a particular point in EFT parameter
>> space
>>
>> positional arguments:
>> PARAMCARD Input parameter card.
>>
>> optional arguments:
>> -h, --help show this help message and exit
>> --squares Retain quadratic order in EFT coefficients in the
>> SignalStrengths interface (NOT IMPLEMENTED)
>> --flavor Specify flavor structure. Allowed values are: general, diagonal,
>> universal (default = general)
################################################################################
-11) EWPO interface
+10.5) EWPO interface
################################################################################
interfaces/EWPO/ # EWPO interface Package
|-> __init__.py
-|-> chisq.py # delta chi-squared and p-value function s
+|-> chisq.py # delta chi-squared and p-value functions
|-> errors.py # package specific errors
|-> interface.py # rosetta command line interface implementation
|-> likelihood/ # Numerical data for likelihood
| |-> c0.dat
| |-> c0_MFV.dat
| |-> sigmainv2.dat
| |-> sigmainv2_MFV.dat
|-> README # A copy of the contents of this section
An implementation of a global likelihood using low energy and electroweak
precision observables. Using a numerical implementation of a pre-calculated
delta chi-squared distribution (described in the Les Houches proceedings
contribution) in a set of Higgs Basis parameters, the interface evaluates the
likelihood of a given point in EFT parameter space.
A translation path to the Higgs Basis must be available.
The option of flavor universality is available and reduces the number of
degrees of freedom from 36 to 23.
Command line documentation:
>> usage: rosetta ewpo [-h] [--flavor] PARAMCARD
>>
>> Run the EWPO interface to obtain the compatibility of a parameter point with a
>> fit to electroweak precision observables
>>
>> positional arguments:
>> PARAMCARD Input parameter card.
>>
>> optional arguments:
>> -h, --help show this help message and exit
>> --flavor Specify flavor structure. Allowed values are: general, diagonal,
>> universal (default = general).
################################################################################
Rosetta: an operator basis translator for Standard Model effective field theory
################################################################################
diff --git a/Rosetta/__init__.py b/Rosetta/__init__.py
index 61a0a42..ea3b421 100644
--- a/Rosetta/__init__.py
+++ b/Rosetta/__init__.py
@@ -1,8 +1,12 @@
+__author__ = ('Adam Falkowski, Benjamin Fuks, Kentarou Mawatari, Ken Mimasu, '
+ 'Francesco Riva & Veronica Sanz')
+__version__ = '2.0'
+__date__ = '19/10/2016'
+__url__ = 'http://rosetta.hepforge.org'
-__version__ = '1.1.alpha'
from internal.machinery import bases as implemented_bases
from internal import session, settings
from bases import *
diff --git a/Rosetta/bases/HiggsBasis.py b/Rosetta/bases/HiggsBasis.py
index 156602c..4a716e9 100644
--- a/Rosetta/bases/HiggsBasis.py
+++ b/Rosetta/bases/HiggsBasis.py
@@ -1,683 +1,683 @@
# import sys
import math
import re
from math import sqrt
#
from ..internal import basis
from ..internal import PID
from ..internal import matrix_mult, matrix_add, matrix_sub, matrix_eq
from . import BSMCharacterisation as BSMC
################################################################################
BSMCharacterisation = BSMC.BSMCharacterisation
################################################################################
class HiggsBasis(basis.Basis):
'''
Main basis class for Rosetta, based on the recommendation for the
parametrisation of Higgs Effective Field theory in the LHC Higgs cross
section working group note, LHCHXSWG-INT-2015-001
https://cds.cern.ch/record/2001958
Part of the three intrinsic basis implementations in Rosetta along with the
Warsaw and SILH bases. The implementation only includes the minimal set (3)
of four-fermion operators required to consistently map between the three
intrinsic bases as defined in the note. A number of structures involving
more than two Higgs fields (apart from the triple Higgs vertex) or
interactions between a single higgs field and 3 or more gauge bosons are
not currently included.
The Higgs Basis encodes relations between certain parameters to ensure
SU(2)xU(1) invariance such that it is consistent with a dimension six
operator basis for an effective field theory with linearly realised
electroweak symmetry breaking (in unitary gauge) and a general flavor
structure. These relations are implemented in calculate_dependent().
'''
name='higgs'
##########################
# declare coefficients
# kinetic terms [Eqn. (3.3)]
HBxMASS = ['dM']
# triple gauge couplings [Eqn. (3.6)]
HBxTGC = ['Lz', 'tLz', 'C3g', 'tC3g', 'dKa', 'tKa',
'dG1z', 'dKz', 'tKz', 'La', 'tLa']
# quartic gauge couplings [Eqn. (3.7)]
HBxQGC = ['dGw4','dGw2z2','dGw2za',
'Lw4', 'Lw2z2', 'Lw2a2', 'Lw2az', 'Lw2za', 'C4g',
'tLw4', 'tLw2z2', 'tLw2a2', 'tLw2az', 'tLw2za', 'tC4g']
# single Higgs couplings [Eqn. (3.8)]
HBxh = ['dCz',
'Cgg', 'Caa', 'Cza', 'Czz', 'Czbx', 'Cabx',
'tCgg', 'tCaa', 'tCza', 'tCzz',
'dCw', 'Cww', 'Cwbx', 'tCww' ]
# double Higgs couplings [Eqn. (3.13)]
HBxhh = ['dCw2', 'dCz2', 'Cww2', 'Cwbx2',
'Cgg2', 'Caa2', 'Cza2', 'Czz2', 'Czbx2', 'Cabx2',
'tCww2', 'tCgg2', 'tCaa2', 'tCza2', 'tCzz2']
# Higgs self couplings [Eqn. (3.12)]
HBxhself = ['dL3', 'dL4']
# 4-fermion operators. cll1221 defined as dependent
HBx4F = ['cll1111','cll1122','cll1221','cll1133','cll1331','cll2332',
'cle1111','cle1122','cle2211','cle1133','cle3311',
'cee1111','cee1122','cee1133',
'cpuu3333']
##########################
# block structure
blocks = {'HBxMASS':HBxMASS, 'HBxTGC':HBxTGC, 'HBxQGC':HBxQGC,
'HBxh':HBxh, 'HBxhh':HBxhh, 'HBxhself':HBxhself, 'HBx4F':HBx4F}
# same flavored block structure as BSMCharacterisation except dipole
# operators, which are general complex matrices instead of a pair of
# hermitian ones for the CP conserving and CP-violating interactions
flavored = {
# Z Vertex Corrections [Eqn (3.4)]
'HBxdGLze': {'kind':'hermitian', 'domain':'complex', 'cname':'dGLze'},
'HBxdGRze': {'kind':'hermitian', 'domain':'complex', 'cname':'dGRze'},
'HBxdGLzv': {'kind':'hermitian', 'domain':'complex', 'cname':'dGLzv'},
'HBxdGLzu': {'kind':'hermitian', 'domain':'complex', 'cname':'dGLzu'},
'HBxdGRzu': {'kind':'hermitian', 'domain':'complex', 'cname':'dGRzu'},
'HBxdGLzd': {'kind':'hermitian', 'domain':'complex', 'cname':'dGLzd'},
'HBxdGRzd': {'kind':'hermitian', 'domain':'complex', 'cname':'dGRzd'},
# W Vertex Corrections [Eqn (3.4)]
'HBxdGLwl': {'kind':'hermitian', 'domain':'complex', 'cname':'dGLwl'},
'HBxdGLwq': {'kind':'general', 'domain':'complex', 'cname':'dGLwq'},
'HBxdGRwq': {'kind':'general', 'domain':'complex', 'cname':'dGRwq'},
# Dipole interactions with single gauge bosons [Eqn. (3.5)]
'HBxdgu': {'kind':'general', 'domain':'complex', 'cname':'dgu'},
'HBxdgd': {'kind':'general', 'domain':'complex', 'cname':'dgd'},
'HBxdau': {'kind':'general', 'domain':'complex', 'cname':'dau'},
'HBxdad': {'kind':'general', 'domain':'complex', 'cname':'dad'},
'HBxdae': {'kind':'general', 'domain':'complex', 'cname':'dae'},
'HBxdzu': {'kind':'general', 'domain':'complex', 'cname':'dzu'},
'HBxdzd': {'kind':'general', 'domain':'complex', 'cname':'dzd'},
'HBxdze': {'kind':'general', 'domain':'complex', 'cname':'dze'},
'HBxdwu': {'kind':'general', 'domain':'complex', 'cname':'dwu'},
'HBxdwd': {'kind':'general', 'domain':'complex', 'cname':'dwd'},
'HBxdwl': {'kind':'general', 'domain':'complex', 'cname':'dwl'},
# single Higgs couplings to fermions [Eqn. (3.8)]
'HBxdYu': {'kind':'general', 'domain':'real', 'cname':'dYu'},
'HBxdYd': {'kind':'general', 'domain':'real', 'cname':'dYd'},
'HBxdYe': {'kind':'general', 'domain':'real', 'cname':'dYe'},
'HBxSu': {'kind':'general', 'domain':'real', 'cname':'Su' },
'HBxSd': {'kind':'general', 'domain':'real', 'cname':'Sd' },
'HBxSe': {'kind':'general', 'domain':'real', 'cname':'Se' },
# Higgs contact interactions HVff [Eqn. (3.10)]
'HBxdGLhze': {'kind':'hermitian', 'domain':'complex', 'cname':'dGLhze'},
'HBxdGRhze': {'kind':'hermitian', 'domain':'complex', 'cname':'dGRhze'},
'HBxdGLhzv': {'kind':'hermitian', 'domain':'complex', 'cname':'dGLhzv'},
'HBxdGLhzu': {'kind':'hermitian', 'domain':'complex', 'cname':'dGLhzu'},
'HBxdGRhzu': {'kind':'hermitian', 'domain':'complex', 'cname':'dGRhzu'},
'HBxdGLhzd': {'kind':'hermitian', 'domain':'complex', 'cname':'dGLhzd'},
'HBxdGRhzd': {'kind':'hermitian', 'domain':'complex', 'cname':'dGRhzd'},
'HBxdGLhwl': {'kind':'hermitian', 'domain':'complex', 'cname':'dGLhwl'},
'HBxdGLhwq': {'kind':'general', 'domain':'complex', 'cname':'dGLhwq'},
'HBxdGRhwq': {'kind':'general', 'domain':'complex', 'cname':'dGRhwq'},
# Dipole interactions with single higgs and gauge boson [Eqn. (3.11)]
'HBxdhgu': {'kind':'general', 'domain':'complex', 'cname':'dhgu'},
'HBxdhgd': {'kind':'general', 'domain':'complex', 'cname':'dhgd'},
'HBxdhau': {'kind':'general', 'domain':'complex', 'cname':'dhau'},
'HBxdhad': {'kind':'general', 'domain':'complex', 'cname':'dhad'},
'HBxdhae': {'kind':'general', 'domain':'complex', 'cname':'dhae'},
'HBxdhzu': {'kind':'general', 'domain':'complex', 'cname':'dhzu'},
'HBxdhzd': {'kind':'general', 'domain':'complex', 'cname':'dhzd'},
'HBxdhze': {'kind':'general', 'domain':'complex', 'cname':'dhze'},
'HBxdhwu': {'kind':'general', 'domain':'complex', 'cname':'dhwu'},
'HBxdhwd': {'kind':'general', 'domain':'complex', 'cname':'dhwd'},
'HBxdhwl': {'kind':'general', 'domain':'complex', 'cname':'dhwl'},
# couplings of two Higgs bosons to fermions [Sec. 3.8]
'HBxY2u': {'kind':'general', 'domain':'complex', 'cname':'Y2u'},
'HBxY2d': {'kind':'general', 'domain':'complex', 'cname':'Y2d'},
'HBxY2e': {'kind':'general', 'domain':'complex', 'cname':'Y2e'}
}
# independent coefficients
independent = [
# [Eqn. (5.1)]
'dM',
'HBxdGLze', 'HBxdGRze', 'HBxdGLwl', 'HBxdGLzu',
'HBxdGRzu', 'HBxdGLzd', 'HBxdGRzd', 'HBxdGRwq',
'HBxdgu', 'HBxdgd', 'HBxdau', 'HBxdad', 'HBxdae',
'HBxdzu', 'HBxdzd', 'HBxdze',
# [Eqn. (5.2)]
'Cgg', 'dCz', 'Caa', 'Cza', 'Czz', 'Czbx', 'tCgg', 'tCaa', 'tCza', 'tCzz',
'HBxdYu', 'HBxdYd', 'HBxdYe', 'HBxSu', 'HBxSd', 'HBxSe', 'dL3',
# [Eqn. (5.3)]
'Lz', 'tLz', 'C3g', 'tC3g',
'cll1111','cll1122','cll1133','cll1331','cll2332',
'cle1111','cle1122','cle2211','cle1133','cle3311',
'cee1111','cee1122','cee1133',
'cpuu3333'
]
# Required inputs/masses
# Higgs, W & fermion masses
required_masses = {25, 24, 1, 2, 3, 4, 5, 6, 11, 13, 15}
required_inputs = {1, 2, 3, 4} # aEWM1, Gf, aS, MZ
##########################
def calculate_inputs(self): # calculate a few required EW params from aEWM1, Gf, MZ
ee2 = 4.*math.pi/self.inputs['aEWM1'] # EM coupling squared
gs2 = 4.*math.pi*self.inputs['aS'] # strong coupling squared
Gf, MZ = self.inputs['Gf'], self.inputs['MZ']
s2w = (1.- sqrt(1. - ee2/(sqrt(2.)*Gf*MZ**2)))/2. # sin^2(theta_W)
c2w = (1.-s2w)
gw2 = ee2/s2w # SU(2) coupling squared
gp2 = gw2*s2w/c2w # Hypercharge coupling squared
vev = 2.*MZ*sqrt(c2w/gw2)
return s2w, c2w, ee2, gw2, gp2, MZ, vev, gs2
def calculate_dependent(self):
s2w, c2w, ee2, gw2, gp2, MZ, vev, gs2 = self.calculate_inputs()
A = self
MH = self.mass[25]
MW = self.mass[24]
def delta(i,j):
return 1. if i==j else 0.
# Higgs and EW gauge bosons [Sec 5.2] [eqn (5.5)]
A['dCw'] = A['dCz'] + A['dM']*4.
A['Cww'] = A['Czz'] + A['Cza']*2.*s2w + A['Caa'] *s2w**2
A['tCww'] = A['tCzz'] + A['tCza']*2.*s2w + A['tCaa']*s2w**2
A['Cwbx'] = (A['Czbx']*gw2 + A['Czz']*gp2 - A['Caa']*ee2*s2w
- A['Cza']*(gw2-gp2)*s2w )/(gw2-gp2)
A['Cabx'] = (A['Czbx']*2.*gw2 + A['Czz']*(gw2+gp2)
- A['Caa']*ee2 - A['Cza']*(gw2-gp2))/(gw2-gp2)
# Higgs self couplings [eqn (5.7)]
A['dL4'] = 3./2.*A['dL3'] - MH**2/vev**2/6.*A['dCz']
# dependent dgV coeffs [eqn (5.9)]
matrix_add(A['HBxdGLze'], A['HBxdGLwl'], A['HBxdGLzv'])
# dGLwq = dGLzu.VCKM - VCKM.dGLzd [eqn (5.9)]
matrix_sub(matrix_mult(A['HBxdGLzu'], A.ckm),
matrix_mult(A.ckm, A['HBxdGLzd']),
A['HBxdGLwq'])
# W dipole interaction
for f in ('u','d','e'):
eta = 1. if f=='u' else -1.
if f=='e':
wdip = 'HBxdwl'
else:
wdip = 'HBxdw'+f
adip, zdip = 'HBxda'+f, 'HBxdz'+f
for i,j in A[wdip].keys():
A[wdip][i,j] = eta*( A[zdip][i,j] + s2w*A[adip][i,j] )
# list of all z/w vertex correction blocks
vertex = ['HBxdGLze', 'HBxdGRze', 'HBxdGLzv', 'HBxdGLzu', 'HBxdGRzu',
'HBxdGLzd', 'HBxdGRzd', 'HBxdGLwl', 'HBxdGLwq', 'HBxdGRwq']
# list of all z/w/a dipole interaction blocks
dipole = ['HBxdgu', 'HBxdgd', 'HBxdau', 'HBxdad', 'HBxdae',
'HBxdzu', 'HBxdzd', 'HBxdze', 'HBxdwu', 'HBxdwd', 'HBxdwl',
# 'HBxtdgu', 'HBxtdgd', 'HBxtdau', 'HBxtdad', 'HBxtdae',
# 'HBxtdzu', 'HBxtdzd', 'HBxtdze'
]
# HVFF coeffs and dipole-like Higgs couplings [Eqns. (3.10) & (5.6)]
for dG in vertex + dipole:
dGh = dG[:-2]+'h'+dG[-2:]
matrix_eq(A[dG], A[dGh])
# Triple gauge couplings [Sec 3.7] [eqn (3.21)]
A['dG1z'] = (A['Caa']*ee2*gp2 + A['Cza']*(gw2-gp2)*gp2
- A['Czz']*(gw2+gp2)*gp2 - A['Czbx']*(gw2+gp2)*gw2
)/2./(gw2-gp2)
A['dKa'] = - (A['Caa']*ee2 + A['Cza']*(gw2-gp2)
- A['Czz']*(gw2+gp2) )*gw2/2./(gw2+gp2)
A['tKa'] = - ( A['tCaa']*ee2 + A['tCza']*(gw2-gp2)
- A['tCzz']*(gw2+gp2))*gw2/2./(gw2+gp2)
A['dKz'] = A['dG1z'] - gp2/gw2*A['dKa']
A['tKz'] = - A['tKa']*gp2/gw2
A['La'] = A['Lz']
A['tLa'] = A['tLz']
# Quartic gauge couplings [Sec 3.7] [eqn (3.23)]
A['dGw4'] = 2.*c2w*A['dG1z']
A['dGw2z2'] = 2.*A['dG1z']
A['dGw2za'] = A['dG1z']
# two derivative quartic gauge couplings [Sec 3.7] [eqn (3.24)]
A['Lw4'] = -gw2/2./MW**2*A['Lz']
A['tLw4'] = -gw2/2./MW**2*A['tLz']
A['Lw2z2'] = -gw2*c2w/MW**2*A['Lz']
A['tLw2z2'] = -gw2*c2w/MW**2*A['tLz']
A['Lw2za'] = -ee2/MW**2*A['Lz']
A['tLw2za'] = -ee2/MW**2*A['tLz']
A['Lw2a2'] = -sqrt(ee2*gw2*c2w)/MW**2*A['Lz']
A['tLw2a2'] = -sqrt(ee2*gw2*c2w)/MW**2*A['tLz']
A['Lw2az'] = -sqrt(ee2*gw2*c2w)/MW**2*A['Lz']
A['tLw2az'] = -sqrt(ee2*gw2*c2w)/MW**2*A['tLz']
A['C4g'] = 3.*sqrt(gs2)**3/vev**2*A['C3g']
A['tC4g'] = 3.*sqrt(gs2)**3/vev**2*A['tC3g']
# Couplings of two Higgs bosons [Sec 3.8] [eqn (3.27)]
# Gauge
A['Cgg2'], A['tCgg2'] = A['Cgg'], A['tCgg']
A['dCz2'] = A['dCz']
A['dCw2'] = A['dCw'] + 3.*A['dM']
hvv = ['Cww', 'Cwbx', 'Cgg', 'Caa', 'Cza', 'Czz', 'Czbx', 'Cabx',
'tCww', 'tCgg', 'tCaa', 'tCza', 'tCzz']
for cvv in hvv:
cvv2 = cvv + '2'
A[cvv2] = A[cvv]
# Yukawas
for f in ('u','d','e'):
yuk = 'HBxdY' + f
sin = 'HBxS' + f
yuk2 = 'HBxY2' + f
for i,j in A[yuk].keys():
Yij = A[yuk][i,j]
sinij = A[sin][i,j]
cosij = sqrt(1. - sinij**2)
re, im = (3.*Yij*cosij - A['dCz']*delta(i,j)), 3.*Yij*sinij
A[yuk2][i,j] = complex(re, im)
# 4-fermion operators [Sec. 3.9]
# [eqn (3.32)]
A['cll1221'] = ( A['HBxdGLwl'][1,1].real
+ A['HBxdGLwl'][2,2].real - 2.*A['dM'])*2.
@basis.translation('bsmc')
def to_bsmc(self, instance):
# trivial translation apart from dipole terms
H = self
B = instance
dipoles = ['Cdau','Cdzu']
for k, v in self.iteritems():
is_dipole = re.match(r'Cdh{0,1}[a,z,g][u,d,e]\dx\d', k)
if not is_dipole:
try:
B[k] = v
except KeyError:
- print k + ' not found in BSMC definition.'
+ print ' ' + k + ' not found in BSMC definition.'
# splitting dipole coefficients
ii = complex(0.,1.)
for f in ('u','d','e'):
glu, tglu = 'BCxdg'+f, 'BCxtdg'+f
pho, tpho = 'BCxda'+f, 'BCxtda'+f
zed, tzed = 'BCxdz'+f, 'BCxtdz'+f
for i,j in B[zed].keys():
if f in ('u','d'):
Gij, Gji = H['HBxdg'+f][i,j], H['HBxdg'+f][j,i]
B[glu][i,j] = -(Gij + Gji.conjugate())
B[tglu][i,j] = -ii*(Gij - Gji.conjugate())
Aij, Aji = H['HBxda'+f][i,j], H['HBxda'+f][j,i]
B[pho][i,j] = -(Aij + Aji.conjugate())
B[tpho][i,j] = -ii*(Aij - Aji.conjugate())
Zij, Zji = H['HBxdz'+f][i,j], H['HBxdz'+f][j,i]
B[zed][i,j] = -(Zij + Zji.conjugate())
B[tzed][i,j] = -ii*(Zij - Zji.conjugate())
return instance
@basis.translation('warsaw')
def to_warsaw(self, wbinstance):
def delta(i,j):
return 1. if i==j else 0.
H = self
W = wbinstance
s2w, c2w, ee2, gw2, gp2, MZ, vev, gs2 = self.calculate_inputs()
gw, gp, gs = sqrt(gw2), sqrt(gp2), sqrt(gs2)
MH = self.mass[25]
lam = MH**2/(2.*vev**2) # Higgs self-coupling
dM, dCz = H['dM'], H['dCz']
W['cH'] = ( 3.*lam*dCz + 8.*lam*dM - H['dL3']
+ ( H['Czbx']*gw2 + H['Czz']*gp2
- H['Cza']*gp2*(c2w-s2w) - H['Caa']*gw2*s2w**2
)*4.*gw2*lam/(gw2-gp2)
)
W['cHbx'] = ( dCz + 2.*dM
+ ( H['Czbx']*(3.*gw2-gp2) + 2.*H['Czz']*gp2
- 2.*H['Cza']*gp2*(c2w-s2w) - 2.*H['Caa']*gw2*s2w**2
)*gw2/(gw2-gp2)/2.
)
W['cHD'] = ( - ( H['Czbx'] + H['Czz'] - H['Cza']*(c2w-s2w)
- H['Caa']*s2w*c2w
)*2.*gw2*gp2/(gw2-gp2) - 4.*dM
)
W['cHG'] = H['Cgg']*gs2/4.
W['cHW'] = (H['Czz'] + H['Cza']*2.*s2w + H['Caa']*s2w**2)*gw2/4.
W['cHB'] = (H['Czz'] - H['Cza']*2.*c2w + H['Caa']*c2w**2)*gp2/4.
W['cHWB'] = (H['Czz'] - H['Cza']*(c2w-s2w) - H['Caa']*c2w*s2w)*gw*gp/2.
W['tcHG'] = H['tCgg']*gs2/4.
W['tcHW'] = (H['tCzz'] + H['tCza']*2.*s2w + H['tCaa']*s2w**2)*gw2/4.
W['tcHB'] = (H['tCzz'] - H['tCza']*2.*c2w + H['tCaa']*c2w**2)*gp2/4.
W['tcHWB'] = (H['tCzz'] - H['tCza']*(c2w-s2w) - H['tCaa']*c2w*s2w)*gw*gp/2.
W['cW'] = -H['Lz']*2./gw/3. # one or two powers?
W['cG'] = H['C3G']*gs**3
W['tcW'] = -H['tLz']*2./gw/3.
W['tcG'] = H['tC3G']*gs**3
C1 = ( H['Czbx']*gw2 + H['Czz']*gp2 - H['Cza']*gp2*(c2w-s2w)
- H['Caa']*gw2*s2w**2 )*gw2/(gw2-gp2)
C2 = ( H['Czbx'] + H['Czz'] - H['Cza']*(c2w-s2w) - H['Caa']*s2w*c2w
)*gw2*gp2/(gw2-gp2)
# Yukawa
for f in ('u','d','e'):
for i,j in H['HBxdY'+f].keys():
mi, mj = self.mass[PID[f][i]], self.mass[PID[f][j]]
diag = ( dCz + 2.*dM + C1 )*delta(i,j)
yuk = H['HBxdY'+f][i,j]
sin = H['HBxS'+f][i,j]
cos = sqrt(1.-sin**2)
re = -sqrt(2.*mi*mj)/vev*(yuk*cos - diag)
im = sqrt(2.*mi*mj)/vev*yuk*sin
W['WBx'+f+'H'][i,j] = complex(re, im)
RdGLzd = matrix_mult(matrix_mult(H.ckm, H['HBxdGLzd']),H.ckm.dag())
for i,j in H['HBxdGLzu'].keys():
facp = delta(i,j)*C1
fac = delta(i,j)*C2
W['WBxH3l'][i,j] = H['HBxdGLwl'][i,j] + facp/2.
W['WBxH3q'][i,j] = H['HBxdGLzu'][i,j] - RdGLzd[i,j] + facp/2.
W['WBxH1l'][i,j] = -2.*H['HBxdGLze'][i,j] - H['HBxdGLwl'][i,j] + fac/2.
W['WBxH1q'][i,j] = -H['HBxdGLzu'][i,j] - RdGLzd[i,j] - fac/6.
W['WBxHe'][i,j] = - 2.*H['HBxdGRze'][i,j] + fac
W['WBxHu'][i,j] = - 2.*H['HBxdGRzu'][i,j] - 2./3.*fac
W['WBxHd'][i,j] = - 2.*H['HBxdGRzd'][i,j] + 1./3.*fac
for k,v in H['HBxdGRwq'].iteritems():
W['WBxHud'][k] = -2.*v
# Dipole operators
for f in ('u','d','e'):
eta = 1 if f=='u' else -1
for i,j in W['WBx'+f+'W'].keys():
mi, mj = self.mass[PID[f][i]], self.mass[PID[f][j]]
MFVnorm = sqrt(mi*mj)/(2.*sqrt(2.)*vev)
# gluon
if f in ('u','d'):
W['WBx'+f+'G'][i,j] = - H['HBxdg'+f][i,j]*MFVnorm
# Weak
W['WBx'+f+'W'][i,j] = - eta*(H['HBxdz'+f][i,j]
+ s2w*H['HBxda'+f][i,j])*MFVnorm
# Hypercharge
W['WBx'+f+'B'][i,j] = (H['HBxdz'+f][i,j]
- c2w*H['HBxda'+f][i,j])*MFVnorm
# Some four fermion operators
W['cll1221'] = 2.*( H['HBxdGLwl'][1,1].real + H['HBxdGLwl'][2,2].real) - 4.*dM
trivial_4f = ['cll1111','cll1122','cll1133','cll1331','cll2332',
'cle1111','cle1122','cle2211','cle1133','cle3311',
'cee1111','cee1122','cee1133',
'cpuu3333']
for c in trivial_4f:
W[c] = H[c]
# W['cll1122'], W['cpuu3333'] = H['cll1122'], H['cpuu3333']
return W
@basis.translation('silh')
def to_silh(self, instance):
H = self
S = instance
s2w, c2w, ee2, gw2, gp2, MZ, vev, gs2 = self.calculate_inputs()
sw, cw = sqrt(s2w), sqrt(c2w)
MH = self.mass[25]
lam = MH**2/(2.*vev**2) # Higgs self-coupling
def delta(i,j):
return 1. if i==j else 0.
S['sg'] = gw2/16.*H['Cgg']
S['tsg'] = gw2/16.*H['tCgg']
S['sa'] = gw2/16.*H['Caa']
S['tsa'] = gw2/16.*H['tCaa']
S['sW'] = ( ( 2.*H['Czbx']*gw2 + H['Czz']*(gw2+gp2)
- H['Caa']*s2w*gp2 )*gw2/(gw2-gp2)/4.
- H['HBxdGLwl'][2,2].real + 2.*H['dM'] )
S['sB'] = ( (-2.*H['Czbx']*gw2 - H['Czz']*(gw2+gp2)
+ H['Caa']*s2w*gp2 )*gw2/(gw2-gp2)/4.
+ (-H['HBxdGLwl'][2,2].real + 2.*H['HBxdGLze'][1,1].real
+ 2.*H['dM'] - H['cll1122'])*gw2/gp2 )
S['sH'] = (-2.*H['dCz'] + 3.*H['HBxdGLwl'][1,1].real
- 3.*H['HBxdGLwl'][2,2].real )
S['sT'] = ( H['HBxdGLwl'][1,1].real - H['HBxdGLwl'][2,2].real
+ 4.*H['HBxdGLze'][1,1].real + 4.*H['dM'] - H['cll1122'] )
S['s6'] = ( H['dL3']/lam - 3.*H['dCz'] + 4.*H['HBxdGLwl'][1,1].real
- 4.*H['HBxdGLwl'][2,2].real )
S['sHW'] = (-H['Czz'] - 2.*H['Cza']*s2w - H['Caa']*s2w**2 )*gw2/4.
S['tsHW'] = (-H['tCzz'] - 2.*H['tCza']*s2w - H['tCaa']*s2w**2)*gw2/4.
S['sHB'] = (-H['Czz'] + 2.*H['Cza']*c2w + H['Caa']*s2w*(1.+c2w))*gw2/4.
S['tsHB'] = (-H['tCzz'] + 2.*H['tCza']*c2w + H['tCaa']*s2w*(1.+c2w))*gw2/4.
S['s2W'] = H['HBxdGLwl'][1,1].real/2. + H['HBxdGLwl'][2,2].real/2. - H['dM']
S['s2B'] = ( H['HBxdGLwl'][1,1].real + H['HBxdGLwl'][2,2].real
- 2.*H['dM'] + H['cll1122'] )*gw2/(2.*gp2)
S['s2G']= H['cpuu3333']*3./gs2
S['s3W'] = -H['Lz']/gw2/6.
S['ts3W'] = -H['tLz']/gw2/6.
S['s3G'] = H['C3G']*gw2/4.
S['ts3G'] = H['tC3G']*gw2/4.
# Yukawa interactions
for f in ('u','d','e'):
for i,j in H['HBxdY'+f].keys():
diag = delta(i,j)*( H['dCz'] - H['HBxdGLwl'][1,1].real
+ H['HBxdGLwl'][2,2].real )
yuk = H['HBxdY'+f][i,j]
sin = H['HBxS'+f][i,j]
cos = sqrt(1.-sin**2)
re = -yuk*cos + diag
im = yuk*sin
S['SBx'+f][i,j] = complex(re, im)
# Gauge boson
RdGLzd = matrix_mult(matrix_mult(H.ckm, H['HBxdGLzd']),H.ckm.dag())
for i, j in H['HBxdGLzu'].keys():
diagp = delta(i,j)*H['HBxdGLwl'][1,1]
S['SBxHpl'][i,j] = H['HBxdGLwl'][i,j] - diagp
S['SBxHpq'][i,j] = H['HBxdGLzu'][i,j] - RdGLzd[i,j] - diagp
diag = delta(i,j)*(H['HBxdGLwl'][1,1] + 2.*H['HBxdGLze'][1,1])
S['SBxHl'][i,j] = -H['HBxdGLwl'][i,j] - 2.*H['HBxdGLze'][i,j] + diag
S['SBxHq'][i,j] = -H['HBxdGLzu'][i,j] - RdGLzd[i,j] - diag/3.
S['SBxHe'][i,j] = - 2.*H['HBxdGRze'][i,j] + 2.*diag
S['SBxHu'][i,j] = - 2.*H['HBxdGRzu'][i,j] - 4./3.*diag
S['SBxHd'][i,j] = - 2.*H['HBxdGRzd'][i,j] + 2./3.*diag
for k, v in H['HBxdGRwq'].iteritems():
S['SBxHud'][k] = -2.*v
# Dipole interactions
ii = complex(0.,1.)
for f in ('u','d','e'):
eta = 1 if f=='u' else -1
for i,j in S['SBx'+f+'W'].keys():
# gluon
if f in ('u','d'):
S['SBx'+f+'G'][i,j] = - H['HBxdg'+f][i,j]*gw2/16.
# Weak
S['SBx'+f+'W'][i,j] = - eta*(H['HBxdz'+f][i,j]
+ s2w*H['HBxda'+f][i,j])*gw2/16.
# Hypercharge
S['SBx'+f+'B'][i,j] = (H['HBxdz'+f][i,j]
- c2w*H['HBxda'+f][i,j])*gw2/16.
# Some four fermion operators
trivial_4f = ['cll1111','cll1133','cll1331','cll2332',
'cle1111','cle1122','cle2211','cle1133','cle3311',
'cee1111','cee1122','cee1133']
for c in trivial_4f:
S['s'+c[1:]] = H[c]
return S
@basis.translation('hisz')
def to_hisz(self, instance):
s2w, c2w, ee2, gw2, gp2, MZ, vev, gs2 = self.calculate_inputs()
dg = gw2 - gp2
dg_inv = 1./dg
H = self
Z = instance
Z['Lam'] = vev
Z['fGG'] = -8.*math.pi**2*H['Cgg']
Z['fH2'] = -2.*H['dCz']
Z['fW'] = -4.*dg_inv*(gw2*H['Czbx'] + gp2*H['Czz']
- s2w*ee2*H['Caa'] - s2w*dg*H['Cza'])
Z['fB'] = 4.*dg_inv*(gw2*H['Czbx'] + gw2*H['Czz']
- c2w*ee2*H['Caa'] - c2w*dg*H['Cza'])
Z['fWW'] = -dg_inv*(2.*gw2*H['Czbx'] + (gw2 + gp2)*H['Czz']
- s2w*gp2*H['Caa'])
Z['fBB'] = dg_inv*(2.*gw2*H['Czbx'] + (gw2 + gp2)*H['Czz']
- c2w*gw2*H['Caa'])
Z['fWWW'] = 8./(3.*gw2**2)*H['Lz']
Z['tfGG'] = -8.*math.pi**2*H['tCgg']
Z['tfW'] = 4.*(H['tCzz']- (c2w-s2w)*H['tCza'] - s2w*c2w*H['tCaa'] )
Z['tfWW'] = (H['tCzz']- 2.*c2w*H['tCza'] - s2w*(c2w + 1.)*H['tCaa'])
Z['tfBB'] = -H['tCzz']+ 2.*c2w*H['tCza'] - c2w**2*H['tCaa']
Z['tfWWW'] = 8./(3.*gw2**2)*H['tLz']
def delta(i,j):
return 1. if i==j else 0.
# Yukawa interactions
for f in ('u','d','e'):
for i,j in H['HBxdY'+f].keys():
yuk = H['HBxdY'+f][i,j]
sin = H['HBxS'+f][i,j]
cos = sqrt(1.-sin**2)
re = ( delta(i,j)*H['dCz'] - yuk*cos )*sqrt(2.)
im = yuk*sin*sqrt(2.)
Z['HZx'+f][i,j] = complex(re, im)
# Provide the right W mass for input...
MW = MZ*sqrt(c2w)
Z.mass[24]= MW
try:
Z.inputs.new_entry(9, MW, name='MW')
except KeyError:
Z.inputs[9] = MW
return Z
################################################################################
def modify_inputs(self):
'''
W mass modification from dM.
'''
try:
self.mass[24] += self['dM']
except KeyError:
self.mass.new_entry(24, MW + self['dM'], name = 'MW')
################################################################################
\ No newline at end of file
diff --git a/Rosetta/interfaces/DefaultCard/README b/Rosetta/interfaces/DefaultCard/README
new file mode 100644
index 0000000..9e605ad
--- /dev/null
+++ b/Rosetta/interfaces/DefaultCard/README
@@ -0,0 +1,40 @@
+################################################################################
+Rosetta DefaultCard interface
+################################################################################
+
+interfaces/DefaultCard/ # DefaultCard interface Package
+|-> __init__.py
+|-> interface.py # rosetta command line interface implementation
+|-> README # A copy of the contents of this section
+
+DefaultCard provides a simple utility to generate a default SLHA input card for
+an existing basis implementation in rosetta.
+
+Command line documentation:
+
+ >> usage: rosetta defaultcard [-h] [--value VALUE] [-o OUTPUT] [--flavor FLAVOR]
+ >> [-w]
+ >> BASIS
+ >>
+ >> Generate a parameter card for an implemented basis
+ >>
+ >> positional arguments:
+ >> BASIS Basis class for which to generate the parameter card.
+ >> Allowed values are: higgs, bsmc, template, silh, hisz,
+ >> warsaw (default = bsmc)
+ >>
+ >> optional arguments:
+ >> -h, --help show this help message and exit
+ >> --value VALUE Set value of all parameters to VALUE. The value
+ >> "random" will set random coefficients between -1. and
+ >> 1.
+ >> -o OUTPUT, --output OUTPUT
+ >> Output file name. Default:
+ >> [BASIS]_[FLAVOR]_default.dat
+ >> --flavor FLAVOR Specify flavor structure. Allowed values are: general,
+ >> diagonal, universal (default = general)
+ >> -w, --overwrite Overwrite any pre-existing output file
+
+ ################################################################################
+ Rosetta: an operator basis translator for Standard Model effective field theory
+ ################################################################################
\ No newline at end of file
diff --git a/Rosetta/interfaces/DefaultCard/interface.py b/Rosetta/interfaces/DefaultCard/interface.py
index 6e3491d..72ec548 100644
--- a/Rosetta/interfaces/DefaultCard/interface.py
+++ b/Rosetta/interfaces/DefaultCard/interface.py
@@ -1,82 +1,82 @@
from ..interface import RosettaInterface, allowed_flav
from ...internal import SLHA
from ...internal.errors import RosettaError
from ... import session, settings, implemented_bases
import argparse
import os
# for defaultcard
from ...internal.basis.io import write_template_card
allowed_flav = ('general', 'diagonal', 'universal')
class DefaultCardInterface(RosettaInterface):
interface = 'defaultcard'
description = ("Generate a parameter card for an implemented basis")
helpstr = ("Generate a parameter card for an implemented basis")
parser_args = {
('basis',):{
'metavar':'BASIS', 'type':str, 'choices':implemented_bases.keys(),
'help':('Basis class for which to generate the parameter card. ' +
'Allowed values are: ' + ', '.join(implemented_bases.keys()) +
' (default = bsmc)')
},
('-o','--output'):{
'metavar':'OUTPUT', 'type':str,
'help':'Output file name. Default: [BASIS]_[FLAVOR]_default.dat'
},
('-w','--overwrite'):{
'action':'store_true',
'help':'Overwrite any pre-existing output file'
},
('--flavor',):{
'type':str, 'default':'general', 'choices':allowed_flav,
'metavar':'FLAVOR',
'help':('Specify flavor structure. Allowed values are: '+
', '.join(allowed_flav)+' (default = general)')
},
('--value',):{
'type':str, 'metavar':'VALUE', 'default': '0',
'help':('Set value of all parameters to VALUE. The value "random" '
'will set random coefficients between -1. and 1.')
}
# ('--dependent',):{
# 'action':'store_true',
# 'help':'Also write out dependent parameters to output card'
# },
# ('--ehdecay',):{
# 'action':'store_true',
# 'help':'Interface with eHDECAY for Higgs branching fractions.'
# }
}
def __call__(self, args):
instance = implemented_bases[args.basis.lower()](flavor = args.flavor)
if not args.output: # output file name
outputfile = '{}_{}_default.dat'.format(args.basis, args.flavor)
else:
outputfile = args.output
if os.path.exists(outputfile) and not args.overwrite:
session.log('{} already exists.'.format(outputfile))
carry_on = session.query('Overwrite?', default='no')
else:
carry_on=True
if args.value.lower()!='random':
val = float(args.value)
else:
val = args.value.lower()
if carry_on:
write_template_card(instance,
outputfile,
value = val)
- session.log('#############################')
+ session.drawline()
session.exit(0)
\ No newline at end of file
diff --git a/Rosetta/interfaces/EWPO/interface.py b/Rosetta/interfaces/EWPO/interface.py
index 86ac950..64f2c52 100644
--- a/Rosetta/interfaces/EWPO/interface.py
+++ b/Rosetta/interfaces/EWPO/interface.py
@@ -1,91 +1,91 @@
from itertools import product
from ...bases import HiggsBasis
from ...internal.basis import checkers as check
from ...internal.errors import TranslationError
from ...internal import session
from ..interface import RosettaInterface, allowed_flav
from chisq import chisq_and_pvalue
#
class EWPOInterface(RosettaInterface):
interface = 'ewpo'
description = ("Run the EWPO interface to obtain the compatibility of a "
"parameter point with a fit to electroweak precision "
"observables")
helpstr = "EWPO interface"
parser_args = {
('param_card',):{
'metavar':'PARAMCARD', 'type':str,
'help':'Input parameter card.'
},
('--flavor',):{
'type':str, 'default':'general', 'choices':allowed_flav, 'metavar':'',
'help':('Specify flavor structure. Allowed values are: '+
', '.join(allowed_flav)+' (default = general).')
}
}
def __call__(self, args):
basis_instance = self.from_param_card(args.param_card,
flavor=args.flavor)
HB_instance = basis_instance.translate(target='higgs')
# basis_instance.modify_inputs()
# check.modified_inputs(basis_instance)
if HB_instance.flavor == 'universal':
DOF = 23
else:
DOF = 36
inpt = create_input(HB_instance)
csq, pv = chisq_and_pvalue(inpt, flavor=HB_instance.flavor)
- session.stdout('####### EWPO results #######')
+ session.drawline(text='EWPO results', ignore_silent=True)
session.stdout('delta Chi^2 ({} d.o.f):'.format(DOF))
session.stdout('{:.2f}'.format(csq))
session.stdout('Corresponding p-value:')
session.stdout('{:.2e}'.format(pv))
- session.stdout('#############################')
+ session.drawline()
session.exit(0)
def create_input(H):
'''
Create input arrays for delta chi-squared function of EWPO interface from
HiggsBasis instance. Based on flavour structure of instance.
'''
if H.flavor=='universal':
return [H['HBxdGLwl'][1,1].real, H['HBxdGLze'][1,1].real,
H['HBxdGRze'][1,1].real, H['HBxdGLzu'][1,1].real,
H['HBxdGRzu'][1,1].real, H['HBxdGLzd'][1,1].real,
H['HBxdGRzd'][1,1].real,
H['dG1z'], H['dKa'], H['Lz'],
H['cll1111'], H['cle1111'], H['cee1111'],
H['cll1221'], H['cll1122'], H['cle1122'],
H['cle2211'], H['cee1122'], H['cll1331'],
H['cll1133'], (H['cle1133']+H['cle3311']),
H['cee1133'], H['cll2332']]
else:
return [H['HBxdGLwl'][1,1].real, H['HBxdGLwl'][2,2].real,
H['HBxdGLwl'][3,3].real, H['HBxdGLze'][1,1].real,
H['HBxdGLze'][2,2].real, H['HBxdGLze'][3,3].real,
H['HBxdGRze'][1,1].real, H['HBxdGRze'][2,2].real,
H['HBxdGRze'][3,3].real, H['HBxdGLzu'][1,1].real,
H['HBxdGLzu'][2,2].real, H['HBxdGLzu'][3,3].real,
H['HBxdGRzu'][1,1].real, H['HBxdGRzu'][2,2].real,
H['HBxdGLzd'][1,1].real, H['HBxdGLzd'][2,2].real,
H['HBxdGLzd'][3,3].real, H['HBxdGRzd'][1,1].real,
H['HBxdGRzd'][2,2].real, H['HBxdGRzd'][3,3].real,
H['dG1z'], H['dKa'], H['Lz'],
H['cll1111'], H['cle1111'], H['cee1111'],
H['cll1221'], H['cll1122'], H['cle1122'],
H['cle2211'], H['cee1122'], H['cll1331'],
H['cll1133'], (H['cle1133']+H['cle3311']) ,
H['cee1133'], H['cll2332']]
diff --git a/Rosetta/interfaces/Lilith/Lilith.py b/Rosetta/interfaces/Lilith/Lilith.py
index 74632e2..737382a 100644
--- a/Rosetta/interfaces/Lilith/Lilith.py
+++ b/Rosetta/interfaces/Lilith/Lilith.py
@@ -1,53 +1,53 @@
from math import sqrt
import os
import sys
from itertools import product
from . import lilith, LilithInterfaceError
from ..SignalStrengths.production import production
from ..SignalStrengths.decay import decay
from ...internal import session
################################################################################
-cite_msg = ('########## Lilith ##########\n'
- 'If you use this feature, please cite:\n'
- 'J. Bernon & B. Dumont, Eur. Phys. J. C75 (2015) 9, 440 \n')
+reference = 'J. Bernon & B. Dumont, Eur. Phys. J. C75 (2015) 9, 440'
################################################################################
channels = {'bb':(5,-5),'mumu':(13,-13), 'tautau':(15,-15),
'gammagamma':(22,22), 'ZZ':(23,23), 'WW':(24,-24),}
lilithcalc = lilith.Lilith(verbose=False,timer=False)
################################################################################
def compute_likelihood(basis, sqrts=8):
- session.once(cite_msg)
+ session.cite('Lilith', reference)
# ratios of decay partial widths and total width
+ session.verbose('Calculating Higgs decay branching fractions.')
decays = decay(basis, electroweak=True, SM_BRs=None, ratio=True)
# ratios of production cross sections
+ session.verbose('Calculating Higgs production cross sections')
prods = production(basis, sqrts=sqrts)
xml_input = generate_input(basis.mass[25], prods, decays)
lilithcalc.computelikelihood(userinput=xml_input)
return lilithcalc.l
def generate_input(MH, prod, decay):
mus = []
for kp, (kd, vd) in product(prod.keys(), channels.items()):
mu = prod[kp]*decay[vd]/decay['WTOT']
mustr = '<mu prod="{}" decay="{}">{}</mu>'.format(kp, kd, mu)
mus.append(mustr)
return \
'''<?xml version="1.0"?>
<lilithinput>
<signalstrengths part="h">
<mass>{}</mass>
{}
</signalstrengths>
</lilithinput>
'''.format(MH,'\n '.join(mus))
diff --git a/Rosetta/interfaces/Lilith/interface.py b/Rosetta/interfaces/Lilith/interface.py
index b755568..2534be9 100644
--- a/Rosetta/interfaces/Lilith/interface.py
+++ b/Rosetta/interfaces/Lilith/interface.py
@@ -1,60 +1,60 @@
from itertools import product
from ...internal.basis import checkers as check
from ...internal.errors import TranslationError
from ...internal import session
from ..interface import RosettaInterface, allowed_flav
from Lilith import compute_likelihood
#
channels = {'bb':(5,-5),'mumu':(13,-13), 'tautau':(15,-15),
'gammagamma':(22,22), 'ZZ':(23,23), 'WW':(24,-24)}
class LilithInterface(RosettaInterface):
interface = 'lilith'
description = ('Run the Lilith interface to obtain the likelihood value '
'with respect to the latest Higgs signal strength data for '
'a particular point in EFT parameter space')
helpstr = 'Standalone Lilith interface'
parser_args = {
('param_card',):{
'metavar':'PARAMCARD', 'type':str,
'help':'Input parameter card.'
},
# ('--sqrts',):{
# 'type':int, 'choices':(7,8,13), 'default':8,
# 'help':'Specify pp collider centre-of mass energy in TeV'
# },
('--flavor',):{
'type':str, 'default':'general', 'choices':allowed_flav, 'metavar':'',
'help':('Specify flavor structure. Allowed values are: '+
', '.join(allowed_flav)+' (default = general)')
},
('--squares',):{
'action':'store_true',
'help':('Retain quadratic order in EFT coefficients in the '
'SignalStrengths interface (NOT IMPLEMENTED)')
}
}
def __call__(self, args):
basis_instance = self.from_param_card(args.param_card)
basis_instance.modify_inputs()
check.modified_inputs(basis_instance)
# if not args.dependent:
# basis_instance.delete_dependent()
# run SignalStrengths
likelihood = compute_likelihood(basis_instance, sqrts=8)
- session.stdout('###### Lilith results #######\n')
- session.stdout('Likelihood = {:.3f}\n'.format(likelihood))
- session.stdout('#############################')
+ session.drawline(text='Lilith results', ignore_silent=True)
+ session.stdout('Likelihood = {:.3f}'.format(likelihood))
+ session.drawline()
session.exit(0)
diff --git a/Rosetta/interfaces/SignalStrengths/decay.py b/Rosetta/interfaces/SignalStrengths/decay.py
index 1ff421f..7298c0a 100644
--- a/Rosetta/interfaces/SignalStrengths/decay.py
+++ b/Rosetta/interfaces/SignalStrengths/decay.py
@@ -1,251 +1,252 @@
from math import pi
import os
from ...internal.basis import checkers as check
from loopfunctions import Af
from . import use_eHDECAY
if use_eHDECAY:
from . import SM_BR
################################################################################
# required info
masses = {25,4,5,6,15} # H, b, t masses
################################################################################
def decay(basis, electroweak=True, SM_BRs=None, ratio=False):
'''
Return the new Higgs BRs and Total widths based on the rescaling factors
computed in partial_width_ratios(). SM BRs can be provided through the
SM_BRs keyword argument, otherwise they will be calculated using eHDECAY or
read in from the tabulated data provided by the LHCHXSWG using get_BR().
Arguments:
basis - Rosetta.internal.Basis instance
Options:
SM_BRs - Provide dict for SM Higgs branching fractions and total
width
electroweak - if SM_BRs is None and SignalStrengths.use_eHDECAY is True
the options is fed into the eHDECAY interface
ratio - return the ratios of each BR and total width to the SM
prediction
'''
# get partial width rescaling factors
rscl = partial_width_ratios(basis)
# calculate SM Higgs Branching ratios
if SM_BRs is None:
if use_eHDECAY:
BRs = SM_BR(basis=basis, electroweak=electroweak)
else:
BRs = get_BR(basis.mass[25])
else:
BRs = SM_BRs
# SM total width
SMwid = BRs['WTOT']
# Compute total width rescaling factor
rscl['WTOT'] = 0.
for k, v in rscl.iteritems():
+ if k == 'WTOT': continue
rscl['WTOT'] += v*BRs[k]
if not ratio:
# Compute new width, branching fractions & return
BRs['WTOT'] *= rscl['WTOT']
for k,fact in rscl.iteritems():
PW = BRs[k]*SMwid*fact
BRs[k] = PW/BRs['WTOT']
return BRs
# Return rescaling factors as they are
else:
return rscl
def partial_width_ratios(basis):
'''
Calculate ratios of all Higgs partial widths w.r.t the SM prediction and
returns a dictionary of rescaling factors.
Arguments:
basis - Rosetta.internal.basis.Basis instance
'''
bsmc = basis.translate(target='bsmc')
check.masses(bsmc, masses, message='Signal strength calculation')
# Store relevant coefficients
MH, MT, MB = bsmc.mass[25], bsmc.mass[6], bsmc.mass[5]
dCz, Czbx, Czz = bsmc['dCz'], bsmc['Czbx'], bsmc['Czz']
dCw, Cwbx, Cww = bsmc['dCw'], bsmc['Cwbx'], bsmc['Cww']
Cgg, Cza, Caa, Cabx = bsmc['Cgg'], bsmc['Cza'], bsmc['Caa'], bsmc['Cabx']
if basis.flavor == 'universal':
dYt, dYb = bsmc['BCxdYu'][1,1], bsmc['BCxdYd'][1,1]
dYc, dYs = dYt, dYb
dYta = bsmc['BCxdYe'][1,1]
dYmu = dYta
else:
dYt, dYb = bsmc['BCxdYu'][3,3], bsmc['BCxdYd'][3,3]
dYc, dYs = bsmc['BCxdYu'][2,2], bsmc['BCxdYd'][2,2]
dYta, dYmu = bsmc['BCxdYe'][3,3], bsmc['BCxdYe'][2,2]
ratios = {
(3,-3):Hff(dYs),
(4,-4):Hff(dYc),
(5,-5):Hff(dYb),
(6,-6):Hff(dYt),
(15,-15):Hff(dYta),
(13,-13):Hff(dYmu),
(21,21):Hgg(MH, MT, MB, Cgg, dYt, dYb),
(22,22):Haa(Caa),
(23,22):Hza(Cza),
(24,-24):H2l2v(dCw, Cwbx, Cww),
(23,23):H4l(dCz, Czbx, Czz, Cza, Caa, Cabx)
}
return ratios
################################################################################
def Hgg(MH, MT, MB, Cgg, dYu, dYd):
'''
Return the approximate ratio of gluon-gluon partial width of the Higgs to
the SM prediction as a function of the EFT parameters in the Higgs/BSMC
Basis. Also used in SignalStrengths.production module to compute the
gluon-gluon fusion production cross section ratio w.r.t the SM.
'''
At, Ab = 3.*Af(MH**2/4./MT**2), 3.*Af(MH**2/4./MB**2)
chat = Cgg + 1./(12.*pi**2)*( At*dYu + Ab*dYd )
cSM = 1./(12.*pi**2)*( At + Ab )
lin = 1. + 2.*(chat/cSM).real
quad = abs( (1. + chat/cSM) )**2
return lin
def Haa(Caa):
'''
Return the approximate ratio of gamma-gamma partial width of the Higgs to
the SM prediction as a function of the EFT parameters in the Higgs/BSMC
Basis.
'''
cSM = -8.3e-2
lin = 1. + 2.*Caa/cSM
quad = (1. + Caa/cSM)**2
return lin
def Hza(Cza):
'''
Return the approximate ratio of Z-gamma partial width of the Higgs to
the SM prediction as a function of the EFT parameters in the Higgs/BSMC
Basis.
'''
cSM = -5.9e-2
lin = 1. + 2.*Cza/cSM
quad = (1. + Cza/cSM)**2
return lin
def Hff(dYf):
'''
Return the approximate ratio of fermion-antifermion partial width of the
Higgs to the SM prediction as a function of the EFT parameters in the
Higgs/BSMC Basis.
'''
lin = 1. + 2.*dYf
quad = 1. + 2.*dYf * dYf**2
return lin
def H2l2v(dCw, Cwbx, Cww):
'''
Return the approximate ratio of 2 lepton - 2 neutrino (WW) partial width of
the Higgs to the SM prediction as a function of the EFT parameters in the
Higgs/BSMC Basis.
'''
# return 1 + 2.*dCz + 0.67*Czbx + 0.05*Czz - 0.17*Cza - 0.05*Caa
lin = 1 + 2.*dCw + 0.46074*Cwbx - 0.153652*Cww
return lin
def H2e2mu(dCz, Czbx, Czz, Cza, Caa, Cabx):
'''
Return the approximate ratio of 2 electron - 2 muon (ZZ) partial width of
the Higgs to the SM prediction as a function of the EFT parameters in the
Higgs/BSMC Basis.
'''
# return 1 + 2.*dCz + 0.35*Czbx + 0.19*Czz - 0.09*Cza - 0.01*Caa
lin = (1 + 2.*dCz + 0.40640*Czbx - 0.14865*Czz - 0.06883*Cza - 0.000366*Caa
- 0.02108*Cabx)
return lin
def H4l(dCz, Czbx, Czz, Cza, Caa, Cabx):
'''
Return the approximate ratio of 4 lepton (ZZ) partial width of the
Higgs to the SM prediction as a function of the EFT parameters in the
Higgs/BSMC Basis.
'''
lin = (1 + 2.*dCz + 0.398148*Czbx - 0.144664*Czz + 0.060691*Cza
- 0.0226033*Cabx - 0.012563*Caa)
return lin
# return 1 + 2.*dCz + 0.32*Czbx + 0.19*Czz - 0.08*Cza - 0.02*Caa
################################################################################
def get_datum(MH, file):
'''
Read line from a tabulated data file, "file", from the LHCHXSWG
corresponding to a Higgs mass of MH. Information is linearly interpolated
between the two closest available mass points.
'''
last_data = [1e10]
# Go through file to find closest masses
for line in open(file, 'r'):
try:
data = [float(x) for x in line.split()]
MHi = data[0]
except ValueError:
continue
if MHi == MH:
break
if MHi > MH:
# linear interpolation
dMH0 = abs(MHi-last_data[0])
dMH= abs(MHi-MH)
data = [x + (y-x)*dMH/dMH0 for x,y in zip(last_data, data)]
break
last_data = data
# get every third datum (ignore errors column)
BRs = [d for i,d in enumerate(data[1:]) if i%3==0 ]
return BRs
def get_BR(MH):
'''
Get SM Higgs branching fractions and total width for a given Higgs mass, MH.
Data taken from tabulated values provided by the LHCHXSWG at:
https://twiki.cern.ch/twiki/bin/view/LHCPhysics/CERNYellowReportPageBR2014
'''
basedir = os.path.dirname(__file__)
BRff = get_datum(MH, '{}/BR/ff.dat'.format(basedir))
BB, TATA, MUMU, CC, SS, TT = BRff
BRVV = get_datum(MH, '{}/BR/VV.dat'.format(basedir))
GG, AA, ZA, WW, ZZ, WTOT = BRVV
return {
(5,-5):BB, (15,-15):TATA, (13,-13):MUMU,
(3,-3):SS, (4,-4):CC, (6,-6):TT , (21,21):GG,
(22,22):AA, (23,22):ZA, (24,-24):WW, (23,23):ZZ,
'WTOT':WTOT
}
diff --git a/Rosetta/interfaces/SignalStrengths/interface.py b/Rosetta/interfaces/SignalStrengths/interface.py
index 4e70fd8..83b6b9f 100644
--- a/Rosetta/interfaces/SignalStrengths/interface.py
+++ b/Rosetta/interfaces/SignalStrengths/interface.py
@@ -1,70 +1,71 @@
from itertools import product
from ...internal.basis import checkers as check
from ...internal.errors import TranslationError
from ...internal import session
from ..interface import RosettaInterface, allowed_flav
from production import production
from decay import decay
#
channels = {'bb':(5,-5),'mumu':(13,-13), 'tautau':(15,-15),
'gammagamma':(22,22), 'ZZ':(23,23), 'WW':(24,-24)}
class SignalStrengthsInterface(RosettaInterface):
interface = 'signalstrengths'
description = ("Run the SignalStrengths interface to obtain "
"the mu's for all of the Higgs "
"production and decay channels.")
helpstr = "Standalone SignalStrengths interface"
parser_args = {
('param_card',):{
'metavar':'PARAMCARD', 'type':str,
'help':'Input parameter card.'
},
('--sqrts',):{
'type':int, 'choices':(7,8,13), 'default':8, 'metavar':'',
'help':('Specify pp collider centre-of mass energy in TeV. ' +
'Allowed values are: '+', '.join(('7','8','13'))+' (default = 8).')
},
('--flavor',):{
'type':str, 'default':'general', 'choices':allowed_flav, 'metavar':'',
'help':('Specify flavor structure. Allowed values are: '+
', '.join(allowed_flav)+' (default = general).')
},
('--squares',):{
'action':'store_true',
'help':'Retain quadratic order in EFT coefficients (NOT IMPLEMENTED)'
}
}
def __call__(self, args):
basis_instance = self.from_param_card(args.param_card)
basis_instance.modify_inputs()
check.modified_inputs(basis_instance)
# if not args.dependent:
# basis_instance.delete_dependent()
# run SignalStrengths
# ratios of decay partial widths and total width
decays = decay(basis_instance,
electroweak=True, SM_BRs=None, ratio=True)
# ratios of production cross sections
prods = production(basis_instance, sqrts=args.sqrts)
- session.stdout('###### SignalStrengths results ######')
- session.stdout('# production decay mu ')
+ session.drawline(text='SignalStrengths results', ignore_silent=True)
+ session.stdout(' production decay mu ')
+ session.stdout(' ---------------------------------')
for kp, (kd, vd) in product(prods.keys(), channels.items()):
mu = prods[kp]*decays[vd]/decays['WTOT']
mustr = ' {:<8} {:<10} {:.3f}'.format(kp, kd, mu)
session.stdout(mustr)
- session.stdout('#############################')
+ session.drawline()
session.exit(0)
diff --git a/Rosetta/interfaces/Translate/interface.py b/Rosetta/interfaces/Translate/interface.py
index 12c3df6..0cb5194 100644
--- a/Rosetta/interfaces/Translate/interface.py
+++ b/Rosetta/interfaces/Translate/interface.py
@@ -1,120 +1,120 @@
# from ..internal import SLHA
# from ..internal.errors import RosettaError
from ..interface import RosettaInterface, allowed_flav
from ... import session, settings, implemented_bases
import os
# for translate
from ...internal.basis import checkers as check
from ...internal.basis import write_param_card
from ...interfaces.eHDECAY.eHDECAY import create_SLHA_block
from ...internal.errors import TranslationError
allowed_flav = ('general', 'diagonal', 'universal')
class TranslateInterface(RosettaInterface):
interface = 'translate'
description = ("Read in an SLHA format parameter card in a particular "
"basis and write a new card in another implemented basis.")
helpstr = ("Translate in SLHA input card from one basis to another")
parser_args = {
('param_card',):{
'metavar':'PARAMCARD', 'type':str,
'help':'Input parameter card.'
},
('-o','--output'):{
'metavar':'OUTPUT', 'type':str,
'help':'Output file name. Default: [PARAMCARD]_new'
},
('-w','--overwrite'):{
'action':'store_true',
'help':'Overwrite any pre-existing output file.'
},
('--target',):{
'type':str, 'default':'bsmc', 'choices':implemented_bases.keys(),
'metavar':'',
'help':('Basis into which to translate. Allowed values are: '+
', '.join(implemented_bases.keys()) + ' (default = bsmc)')
},
('--flavor',):{
'type':str, 'default':'general', 'choices':allowed_flav, 'metavar':'',
'help':('Specify flavor structure. Allowed values are: '+
', '.join(allowed_flav)+' (default = general).')
},
('--dependent',):{
'action':'store_true',
'help':'Also write out dependent parameters to output card'
},
('--ehdecay',):{
'action':'store_true',
'help':'Interface with eHDECAY for Higgs branching fractions.'
}
}
def __call__(self, args):
# Initialise starting basis instance from card
basis_instance = self.from_param_card(args.param_card, flavor=args.flavor)
# Translate to target basis instance
newbasis = basis_instance.translate(target=args.target)
# Call modify_inputs() to apply any changes in e.g. mW & check
# Only ever do this for the FINAL output basis instance to avoid
# multiple modifications of parameters
newbasis.modify_inputs()
check.modified_inputs(newbasis)
# delete imaginary parts of diagonal elements in hermitian matrices
if args.target != 'bsmc':
newbasis.reduce_hermitian_matrices()
# Remove occurrences of parameters defined as dependent for output
# unless --dependent option specified OR output basis is e.g. tied to a
# MC implementation that would like to see all parameters
if not args.dependent and args.target.lower()!='bsmc':
newbasis.delete_dependent()
# Preamble for decay blocks
preamble = ('###################################\n'
+ '## DECAY INFORMATION\n'
+ '###################################')
for decay in newbasis.card.decays.values():
decay.preamble = preamble
break
# run eHDECAY for Higgs branching fractions
try:
if args.ehdecay:
decayblock = create_SLHA_block(basis_instance)
# Creat Higgs decay block if not present
if 25 not in newbasis.card.decays:
newbasis.card.add_decay(decayblock)
else:
newbasis.card.decays[25] = decayblock
- session.log('#############################\n')
+ session.drawline()
except TranslationError as e:
# Catch translation error in map to SILH
- print e
- print 'Translation to SILH Basis required, skipping eHDECAY.'
+ session.log('Translation to SILH Basis required, skipping eHDECAY.')
+ session.log('TranslationError: ' + e)
# write param card
if not args.output: # output file name
inputfile = os.path.basename(args.param_card)
if '.' in args.param_card:
new_name = inputfile.split('.')
new_name.insert(-1,'_new.')
new_param_card = ''.join(new_name)
else:
new_param_card = args.param_card+'_new'
else:
new_param_card = args.output
if write_param_card(newbasis.card, new_param_card,
overwrite=args.overwrite):
- session.log('#############################')
+ session.drawline()
session.exit(0)
else:
- session.log('#############################')
+ session.drawline()
session.exit(0)
\ No newline at end of file
diff --git a/Rosetta/interfaces/eHDECAY/eHDECAY.py b/Rosetta/interfaces/eHDECAY/eHDECAY.py
index 8bc1266..49a601d 100644
--- a/Rosetta/interfaces/eHDECAY/eHDECAY.py
+++ b/Rosetta/interfaces/eHDECAY/eHDECAY.py
@@ -1,520 +1,518 @@
################################################################################
from math import sqrt,pi
import os
from tempfile import mkdtemp
import subprocess as sub
from collections import namedtuple
from ...internal.constants import (particle_names, default_masses,
default_ckm, default_inputs,
GammaZ, GammaW)
from ...internal.basis import checkers as check
from ...internal import session, SLHA
from . import executable, eHDECAYInterfaceError, eHDECAYImportError
################################################################################
# required info
masses = {25,3,4,5,6,15,13,24,23} # H, c, b, t, tau, mu, Z, W masses
inputs = {1,2,3} # aEWM1, Gf, aS@MZ
################################################################################
__doc__='''
Interface with eHDECAY program (arXiv:1403.3381) to calculate new Higgs width
and branching ratio to SM particles. Relies on the existence of a translation of
ones basis to the SILH basis. The minimal set of SILH coefficients that should
be translated to are:
'sH','sT','sW','sB','sHW','sHB','sa','g',
'RsHe3x3','RsHe2x2','RsHu3x3','RsHu2x2','RsHd3x3','RsHd2x2'
Required SM inputs are:
'MH','aSMZ','MC','MB','MT','MTAU','MMU','aEWM1','Gf','MZ', 'MW'.
The widths of the W and Z are also looked for in the Decay blocks of the silh
instance and are set to default PDG values if not found.
The absolute path to the local eHDECAY directory containing the executable
should be specified in config.txt as:
eHDECAY_dir /FULL/PATH/TO/eHDECAY
'''
-cite_msg = ('########## eHDECAY ##########\n'
- 'If you use this feature, please cite:\n'
- 'R. Contino et al., Comput.Phys.Commun. 185 (2014) 3412\n'
- 'A. Djouadi, J. Kalinowski, M. Spira et al., '
- 'Comput.Phys.Commun. 108 (1998) 56 \n')
+reference = ('R. Contino et al., Comput.Phys.Commun. 185 (2014) 3412\n'
+ 'A. Djouadi, J. Kalinowski, M. Spira et al., '
+ 'Comput.Phys.Commun. 108 (1998) 56 \n')
################################################################################
def create_SLHA_block(basis, electroweak=True):
'''
Interface Rosetta with eHDECAY to calculate Higgs widths and branching
fractions and return an SLHA decay block for the Higgs.
'''
try:
BRs = run(basis, electroweak=True)
# BR2 = run(basis, interpolate=True)
except eHDECAYInterfaceError:
print e
return
sum_BRs = sum([v for k,v in BRs.items() if k is not 'WTOT'])
# sometimes eHDECAY gives a sum of BRs slightly greater than 1.
# for now a hacky global rescaling is implemented to deal with this.
if sum_BRs > 1:
if abs(sum_BRs - 1.) > 1e-2: # complain if its too wrong
raise RuntimeError('Sum of branching fractions > 1 by more than 1%')
else:
for channel, BR in BRs.iteritems():
if channel!='WTOT':
BRs[channel] = BR/sum_BRs
totalwidth = BRs.pop('WTOT')
if totalwidth < 0.:
session.log('eHDECAY: Negative total Higgs width. Check your EFT inputs.')
return
hdecays = {}
# sometimes eHDECAY gives negative branching fractions.
for channel, BR in BRs.iteritems():
# n1, n2 = particle_names[channel[0]], particle_names[channel[1]]
# comment = 'H -> {}{}'.format(n1,n2)
# if BR < 0.:
# print ('eHDECAY: Negative branching fraction encountered ' +
# 'for {}. Rosetta will ignore it.'.format(comment))
# totalwidth -= BR # adjust total width
# continue
# elif BR == 0.:
# continue
if BR==0.:
continue
else:
hdecays[channel] = BR
# credit
preamble = ('# Higgs widths and branching fractions '
'calculated by eHDECAY.\n')
return SLHA.Decay(25, totalwidth, data=hdecays, preamble=preamble)
def run(basis, electroweak=True, interpolate=False, SM_BRs=None):
'''
Translate basis instance to SILH and convert to eHDECAY input.
return the dictionary returned by execute().
Keyword arguments:
electroweak - switch for electroweak corrections, IELW
interpolate - use the numerical formulae given in the eHDECAY paper
SM_BRs - if interpolate==True provide the SM Higgs branching fractions
to rescale as a dict formatted as {(PID1, PID2):BR,...}.
'''
- session.once(cite_msg)
+ session.cite('eHDECAY', reference)
# ensure required masses & inputs
check.masses(basis, masses, message='eHDECAY interface')
check.sminputs(basis, inputs, message='eHDECAY interface')
# translate to silh instance
thesilh = basis.translate(target='silh')
# generalise flavour matrices
thesilh.set_flavor(thesilh.flavor, 'general')
# convert silh to eHDECAY inputs
inpt = from_silh(thesilh, ew = electroweak)
if interpolate:
return interpolated(inpt, electroweak=electroweak, SM_BRs=SM_BRs)
else:
return execute(inpt)
def execute(inpt):
'''
Run local installation of eHDECAY and return the resulting Higgs width
and branching fraction information. Takes a dictionary as input containing
the following keys:
'MH','aSMZ','MC','MB','MT','MTAU','MMU','aEWM1','Gf','MZ', 'MW'.
Keyword arguments:
electroweak - switch for electroweak corrections, IELW
'''
if not os.path.exists(executable):
err = ('Rosetta: could not find eHDECAY ' +
'executable in {}'.format(eHDECAY_dir))
raise eHDECAYInterfaceError(err)
- session.once(cite_msg)
+ session.cite('eHDECAY', reference)
tmpdir = mkdtemp(prefix='eHDECAY_',dir = os.getcwd())
# write out eHDECAY input file
with open('{}/ehdecay.in'.format(tmpdir),'w') as infile:
infile.write( create_input(inpt) )
process = sub.Popen(executable, stdout = sub.PIPE,
stderr = sub.PIPE, cwd = tmpdir)
out, err = process.communicate()
if err: raise eHDECAYInterfaceError(err)
session.verbose('eHDECAY output:\n{}'.format(out))
-
+ session.drawline()
# read BRs and total width
result = read_output(tmpdir)
# clean up temp directory
sub.call(['cp', '{}/ehdecay.in'.format(tmpdir), '.'])
sub.call(['rm', '-r', tmpdir])
return result
def SM_BR(basis=None, inputs={}, electroweak=True):
'''
Calculate the Higgs width and BRs in the SM using the input parameters
specified in a basis instance or the defaults.
'''
- session.once(cite_msg)
+ session.cite('eHDECAY', reference)
wid ={}
if basis is not None:
# ensure required masses & inputs
check.masses(basis, masses, message='eHDECAY interface')
mass = {k:nonzero_mass(basis,k) for k in basis.mass}
check.sminputs(basis, inputs, message='eHDECAY interface')
sminputs = basis.inputs
# get W,Z widths if present
if basis.card.has_decay(23):
wid['GAMZ'] = basis.card.decays[23].total
if basis.card.has_decay(24):
wid['GAMW'] = basis.card.decays[24].total
else:
mass = default_masses
sminputs = default_inputs
idicts = {1:(sminputs, 'aEWM1'), 2:(sminputs, 'Gf'),
3:(sminputs, 'aSMZ'), 23:(mass, 'MZ'),
24:(mass, 'MW'), 25:(mass, 'MH')}
for k, (idict, name) in idicts.iteritems():
try:
idict[k]=inputs[name]
except KeyError:
pass
try:
mass[24]=inputs['MW']
except KeyError:
s2w = (1.- sqrt(1. - (4.*pi*sminputs[3])/
(sqrt(2.)*sminputs[2]*masses[23]**2)))/2. # sin^2(theta_W)
masses[24] = masses[23]*(1. - s2w)
# create SM input for eHDECAY
coeffs = ['CHbar','CTbar','CWbar','CBbar','CHWbar','CHBbar','Cgambar',
'Cgbar','Ctaubar','Cmubar','Ctbar','Ccbar','Cbbar','Csbar']
einpts = {c:0. for c in coeffs}
# EW option
einpts['IELW'] = 1 if electroweak else 0
# SM inputs & masses
einpts['MH'] = mass[25]
einpts['aSMZ'] = sminputs[3]
einpts['MC'] = mass[4]
einpts['MB'] = mass[5]
einpts['MT'] = mass[6]
einpts['MTAU'] = mass[15]
einpts['MMU'] = mass[13]
einpts['aEWM1'] = sminputs[1]
einpts['Gf'] = sminputs[2]
einpts['MZ'] = mass[23]
einpts['MW'] = mass[24]
# W & Z widths
einpts['GAMZ'] = wid.get('GAMZ', GammaZ)
einpts['GAMW'] = wid.get('GAMW', GammaW)
return execute(einpts)
def read_output(workdir):
'''
Read eHDECAY output files br.eff1 and br.eff2
'''
with open('{}/br.eff1'.format(workdir),'r') as br1, open('{}/br.eff2'.format(workdir),'r') as br2:
br1_dat, br2_dat = br1.readlines()[3], br2.readlines()[3]
MH, BB, TATA, MUMU, SS, CC, TT = tuple(map(float, br1_dat.split()))
__, GG, AA, ZA, WW, ZZ, WTOT = tuple(map(float, br2_dat.split()))
BR = { (5,-5):BB, (15,-15):TATA, (13,-13):MUMU,
(3,-3):SS, (4,-4):CC, (6,-6):TT , (21,21):GG,
(22,22):AA, (23,22):ZA, (24,-24):WW, (23,23):ZZ,
'WTOT':WTOT}
return BR
def from_silh(silh_instance, ew=True):
'''
Set up eHDECAY inputs from SILH basis instance.
'''
si = silh_instance
SILH = {}
mass = {k:nonzero_mass(si,k) for k in masses}
# EW option
SILH['IELW'] = 1 if ew else 0
# SM inputs & masses
SILH['MH'] = mass[25]
SILH['aSMZ'] = si.inputs[3]
SILH['MC'] = mass[4]
SILH['MB'] = mass[5]
SILH['MT'] = mass[6]
SILH['MTAU'] = mass[15]
SILH['MMU'] = mass[13]
SILH['aEWM1'] = si.inputs[1]
SILH['Gf'] = si.inputs[2]
SILH['MZ'] = mass[23]
SILH['MW'] = mass[24]
# W & Z widths
if si.card.has_decay(23):
SILH['GAMZ'] = si.card.decays[23].total
else:
SILH['GAMZ'] = GammaZ # default
if si.card.has_decay(24):
SILH['GAMW'] = si.card.decays[24].total
else:
SILH['GAMW'] = GammaW # default
# gauge & Higgs coefficients
SILH['CHbar'] = si['sH']
SILH['CTbar'] = si['sT']
SILH['CWbar'] = si['sW']
SILH['CBbar'] = si['sB']
SILH['CHWbar'] = si['sHW']
SILH['CHBbar'] = si['sHB']
SILH['Cgambar'] = si['sa']
SILH['Cgbar'] = si['sg']
# Flavor diagonal Yukawa operators for 2nd & 3rd generations
SILH['Ctaubar'] = si['SBxHe'][3,3].real
SILH['Cmubar'] = si['SBxHe'][2,2].real
SILH['Ctbar'] = si['SBxHu'][3,3].real
SILH['Ccbar'] = si['SBxHu'][2,2].real
SILH['Cbbar'] = si['SBxHd'][3,3].real
SILH['Csbar'] = si['SBxHd'][2,2].real
return SILH
def nonzero_mass(basis, PID):
'''
Force non-zero values for all relevant masses. eHDECAY gives nan otherwise.
'''
themass = basis.mass[PID]
if themass == 0.:
name = particle_names[PID]
default = default_masses[PID]
session.log('eHDECAY requires nonzero mass for {}. '.format(name) +
'Default value of {} GeV used.'.format(default))
return default
else:
return themass
def create_input(inp):
'''
Write out input file for eHDECAY.
'''
return \
'''SLHAIN = 0
SLHAOUT = 0
COUPVAR = 1
HIGGS = 0
SM4 = 0
FERMPHOB = 0
MODEL = 1
TGBET = 1.D0
MABEG = {MH}
MAEND = 1000.D0
NMA = 1
ALS(MZ) = {aSMZ}
MSBAR(2) = 0.100D0
MC = {MC}
MB = {MB}
MT = {MT}
MTAU = {MTAU}
MMUON = {MMU}
1/ALPHA = {aEWM1}
GF = {Gf}
GAMW = {GAMW}
GAMZ = {GAMZ}
MZ = {MZ}
MW = {MW}
VUS = 0.2253D0
VCB = 0.0410D0
VUB/VCB = 0.0846D0
********************* 4TH GENERATION *************************************
SCENARIO FOR ELW. CORRECTIONS TO H -> GG (EVERYTHING IN GEV):
GG_ELW = 1: MTP = 500 MBP = 450 MNUP = 375 MEP = 450
GG_ELW = 2: MBP = MNUP = MEP = 600 MTP = MBP+50*(1+LOG(M_H/115)/5)
GG_ELW = 1
MTP = 500.D0
MBP = 450.D0
MNUP = 375.D0
MEP = 450.D0
**************************************************************************
SUSYSCALE= 1000.D0
MU = 1000.D0
M2 = 1000.D0
MGLUINO = 1000.D0
MSL1 = 1000.D0
MER1 = 1000.D0
MQL1 = 1000.D0
MUR1 = 1000.D0
MDR1 = 1000.D0
MSL = 1000.D0
MER = 1000.D0
MSQ = 1000.D0
MUR = 1000.D0
MDR = 1000.D0
AL = 1000.D0
AU = 1000.D0
AD = 1000.D0
NNLO (M) = 0
ON-SHELL = 0
ON-SH-WZ = 0
IPOLE = 0
OFF-SUSY = 0
INDIDEC = 0
NF-GG = 5
IGOLD = 0
MPLANCK = 2.4D18
MGOLD = 1.D-13
************** LAGRANGIAN 0 - chiral 1 - SILH 2 - MCHM4/5 **************
LAGPARAM = 1
**** Turn off (0) or on (1) the elw corrections for LAGPARAM = 1 or 2 ****
IELW = {IELW}
******************* VARIATION OF HIGGS COUPLINGS *************************
CW = 0D0
CZ = 0D0
Ctau = 0D0
Cmu = 0D0
Ct = 0D0
Cb = 0D0
Cc = 0D0
Cs = 0D0
Cgaga = 0D0
Cgg = 0D0
CZga = 0D0
CWW = 0D0
CZZ = 0D0
CWdW = 0D0
CZdZ = 0D0
**************************** SILH Lagrangian *****************************
CHbar = {CHbar}
CTbar = {CTbar}
Ctaubar = {Ctaubar}
Cmubar = {Cmubar}
Ctbar = {Ctbar}
Cbbar = {Cbbar}
Ccbar = {Ccbar}
Csbar = {Csbar}
CWbar = {CWbar}
CBbar = {CBbar}
CHWbar = {CHWbar}
CHBbar = {CHBbar}
Cgambar = {Cgambar}
Cgbar = {Cgbar}
******** MCHM4 (fermrepr=1), MCHM5 (fermrepr=2) parametrisation ********
fermrepr = 2
xi = 0.D0
'''.format(**inp)
def ratios(inpt):
'''
Calculates ratio of the Higgs partial widths to the SM predictions
according to the numerical formulae given in A. Djouadi, J. Kalinowski,
M. Spira et al. accurate to linear order in the Wilson coefficients.
'''
# Determine rescaling factors from numerical formulae
# Derive alpha2, s2w, c2w, aem
aEM, Gf, MZ = 1./inpt['aEWM1'], inpt['Gf'], inpt['MZ'] # EW inputs
s2w = (1.- sqrt(1. - (4.*pi*aEM)/(sqrt(2.)*Gf*MZ**2)))/2. # sin^2(theta_W)
a2 = aEM/s2w # SU(2) coupling squared
t2w = s2w/(1.-s2w)
cH, cT, cW = inpt['CHbar'], inpt['CTbar'], inpt['CWbar']
cB, cHW, cHB = inpt['CBbar'], inpt['CHWbar'], inpt['CHBbar']
cc, cs, cb, ct = inpt['Csbar'], inpt['Ccbar'], inpt['Cbbar'], inpt['Ctbar']
cmu, ctau = inpt['Cmubar'], inpt['Ctaubar']
cg, cgam = inpt['Cgbar'], inpt['Cgambar']
rscl={}
rscl[(5,-5)] = 1.- cH - 1.992*cb - 0.0085*ct
rscl[(15,-15)] = 1.- cH - 2.*cmu
rscl[(13,-13)] = 1.- cH - 2.*ctau
rscl[(3,-3)] = 1.- cH - 1.971*cs - 0.029*ct
rscl[(4,-4)] = 1.- cH - 1.985*cc - 0.015*ct
rscl[(6,-6)] = 1.- cH - 2.*ct
rscl[(21,21)] = (1.- cH - 2.12*ct + 0.024*cc + 0.1*cb
+ 22.2*cg*4.*pi/sqrt(aEM*a2))
rscl[(22,22)] = (1.- cH + 0.54*ct - 0.003*cc - 0.007*cb - 0.007*ctau
+ 5.04*cW - 0.54*cgam*4.*pi/aEM)
rscl[(23,22)] = (1.- cH + 0.12*ct - 5e-4*cc - 0.003*cb - 9e-5*ctau + 4.2*cW
+ 0.19*(cHW - cHB + 8.*cgam*s2w)*4.*pi/sqrt(a2*aEM) )
rscl[(24,-24)] = 1.- cH + 2.2*cW + 3.7*cHW
rscl[(23,23)] = (1.- cH + 2.*cT+ 2.*(cW + t2w*cB) + 3.*(cHW + t2w*cHB)
- 0.26*cgam)
return rscl
def interpolated(inpt, electroweak=True, SM_BRs=None):
'''
Return the new Higgs BRs and Total widths based on the rescaling factors
computed in ratio(). SM BRs can be provided through the SM_BRs keyword
argument, otherwise they will be calculated using eHDECAY.
'''
# calculate SM Higgs Branching ratios
if SM_BRs is None:
BRs = SM_BR(inputs = inpt, electroweak=electroweak)
else:
BRs = SM_BRs
# get partial width rescaling factors
rscl = ratios(inpt)
# rescale SM BRs
SMwid, BRs['WTOT'] = BRs['WTOT'], 0.
for k,fact in rscl.iteritems():
PW = BRs[k]*SMwid*fact
BRs[k] = PW
BRs['WTOT'] += PW
for k,fact in rscl.iteritems():
BRs[k] /= BRs['WTOT']
return BRs
\ No newline at end of file
diff --git a/Rosetta/interfaces/eHDECAY/interface.py b/Rosetta/interfaces/eHDECAY/interface.py
index 848afe7..3948012 100644
--- a/Rosetta/interfaces/eHDECAY/interface.py
+++ b/Rosetta/interfaces/eHDECAY/interface.py
@@ -1,87 +1,87 @@
from ..interface import RosettaInterface, allowed_flav
from ...internal.basis import checkers as check
from ...internal.errors import TranslationError
from eHDECAY import create_SLHA_block
from ...internal import session
#
class eHDECAYInterface(RosettaInterface):
interface = 'ehdecay'
description = ("Run the eHDECAY interface to obtain "
"the Higgs branching fractions")
helpstr = "Standalone eHDECAY interface"
parser_args = {
('param_card',):{
'metavar':'PARAMCARD', 'type':str,
'help':'Input parameter card'
},
('-o','--output'):{
'metavar':'OUTPUT', 'type':str,
'help':'Write out a new SLHA card containing the decay block'
},
('-w','--overwrite'):{
'action':'store_true',
'help':'Overwrite any pre-existing output file'
},
('--flavor',):{
'type':str, 'default':'general', 'choices':allowed_flav, 'metavar':'',
'help':('Specify flavor structure. Allowed values are: '+
', '.join(allowed_flav)+' (default = general)')
},
('--dependent',):{
'action':'store_true',
'help':'Also write out dependent parameters to output card'
},
('--EW',):{
'action':'store_true',
'help':'switch on electroweak corrections in eHDECAY'
}
}
def __call__(self, args):
basis_instance = self.from_param_card(args.param_card)
basis_instance.modify_inputs()
check.modified_inputs(basis_instance)
# run eHDECAY
try:
decayblock = create_SLHA_block(basis_instance, electroweak=args.EW)
except TranslationError as e:
print e
print ('Translation to modified-SILH Basis '
'required for eHDECAY interface.')
session.exit(1)
if not args.output:
- session.stdout('###### eHDECAY results ######')
+ session.drawline(text='eHDECAY results', ignore_silent=True)
session.stdout(str(decayblock))
- session.stdout('#############################')
+ session.drawline(ignore_silent=True)
session.exit(0)
else:
if not args.dependent:
basis_instance.delete_dependent()
preamble = ('###################################\n'
+ '## DECAY INFORMATION\n'
+ '###################################')
for decay in basis_instance.card.decays.values():
decay.preamble = preamble
break
if 25 not in basis_instance.card.decays:
basis_instance.card.add_decay(decayblock)
else:
basis_instance.card.decays[25] = decayblock
- session.log('#############################\n')
+ session.drawline()
if write_param_card(basis_instance.card, args.output,
overwrite=args.overwrite):
- session.log('#############################')
+ session.drawline()
session.exit(0)
else:
- session.log('#############################')
+ session.drawline()
session.exit(0)
\ No newline at end of file
diff --git a/Rosetta/interfaces/interface.py b/Rosetta/interfaces/interface.py
index 1a573a9..9362ac8 100644
--- a/Rosetta/interfaces/interface.py
+++ b/Rosetta/interfaces/interface.py
@@ -1,54 +1,54 @@
from ..internal import SLHA
from ..internal.errors import RosettaError
from .. import session, settings, implemented_bases
import argparse
import os
allowed_flav = ('general', 'diagonal', 'universal')
class RosettaInterface(object):
description = ''
def __init__(self, parsed_args):
self(parsed_args)
def __call__(self):
pass
def from_param_card(self, param_card, flavor='general'):
# Read basis class from parameter card, must be defined in
# Rosetta.implemented_bases i.e. a valid basis class implementation
# exists in the Rosetta/bases directory.
- session.log('Reading "{}"\n'.format(param_card))
+ session.log('Reading "{}"'.format(param_card))
thecard = SLHA.read(param_card, set_cplx = False)
if 'basis' not in thecard.blocks:
raise ReadParamCardError('\n Parameter card ' +
'{} '.format(param_card) +
'does not have a block "BASIS".')
else:
try:
basis = thecard.blocks['basis'][1]
except KeyError:
raise ReadParamCardError('\n Formatting error for block basis. '
'Check input card, {}.'.format(param_card))
try:
mybasis = implemented_bases[basis.lower()]
except KeyError:
err = ('\n Element 1 of block "BASIS", "{}", '.format(basis) +
'not recognised. Rosetta accepts one of: ' +
'{}.'.format(', '.join(implemented_bases.keys())))
raise ReadParamCardError(err)
- session.log('Basis class used to read in param card:\n'+
+ session.log('\nBasis class used to read in param card:\n'+
' {}\n'.format(mybasis))
# create instance of mybasis, automatically translating to target basis
return mybasis(param_card=param_card, flavor=flavor)
class ReadParamCardError(RosettaError):
'''Exception raised inside RosettaInterface.read_param_card()'''
pass
\ No newline at end of file
diff --git a/Rosetta/internal/basis/io.py b/Rosetta/internal/basis/io.py
index d174ea7..de940a2 100644
--- a/Rosetta/internal/basis/io.py
+++ b/Rosetta/internal/basis/io.py
@@ -1,194 +1,194 @@
import datetime
import os
from .. import SLHA
from .. import session
from errors import BasisNameError, ParamCardReadError
def read_param_card(basis, SLHAcard = None):
'''
Call SLHA.read() and set up the Basis instance accordingly.
'''
if SLHAcard is not None:
basis.card = SLHAcard
else:
basis.card = SLHA.read(basis.param_card, set_cplx=False)
try:
card_name = basis.card.blocks.get('basis',[''])[1]
if basis.name.lower()!=card_name.lower():
err = ('Rosetta was expecting to read an instance of '
+ '{}, named "{}", '.format(basis.__class__.name, basis.name)
+ 'but read the name '
+ '"{}" in block "basis" of {}.'.format(card_name,
basis.param_card))
raise BasisNameError(err)
except KeyError:
raise ReadParamCardError('Formatting error for block basis. '
'Check input card, {}.'.format(basis.param_card))
if not basis.blocks:
# if basis.blocks not defined, default behaviour is to automatically
# create basis.blocks structure for independent parameters
for par in basis.independent:
block = basis.card._parent_block(par)
name = block.name
if name not in basis.blocks:
basis.blocks[name] = [par]
else:
basis.blocks[name].append(par)
to_add = []
for bname, blk in basis.card.matrices.iteritems():
is_cplx = basis.flavored.get(bname,{}).get('domain','')=='complex'
if is_cplx:
if bname.lower().startswith('im'):
other_part = bname[2:]
else:
other_part ='IM' + bname
if other_part not in basis.card.matrices:
to_add.append((bname,other_part))
for part, other_part in to_add:
blk = basis.card.matrices[part]
for k, v in blk.iteritems():
if other_part.lower().startswith('im'):
imname = 'R' + blk.get_name(k)[1:]
else:
imname = 'I' + blk.get_name(k)[1:]
basis.card.add_entry(other_part, k, 0., name=imname)
basis.inputs = basis.card.blocks.get('sminputs', None)
basis.mass = basis.card.blocks.get('mass', None)
basis.card.set_complex()
basis.fix_matrices()
def write_param_card(card, filename, overwrite=False):
'''Write contents of card to filename'''
dec_preamble = ('\n###################################\n'
+ '## DECAY INFORMATION\n'
+ '###################################\n')
for decay in card.decays.values():
decay.preamble = dec_preamble
break
mass_preamble = ('\n###################################\n'
+ '## INFORMATION FOR MASS\n'
+ '###################################\n')
if 'mass' in card.blocks:
card.blocks['mass'].preamble = mass_preamble
sm_preamble = ('\n###################################\n'
+ '## INFORMATION FOR SMINPUTS\n'
+ '###################################\n')
if 'sminputs' in card.blocks:
card.blocks['sminputs'].preamble = sm_preamble
ckm_preamble = ('\n###################################\n'
+ '## CKM INFORMATION\n'
+ '###################################\n')
if 'vckm' in card.matrices:
card.matrices['vckm'].preamble = ckm_preamble
card_preamble = ('#'*80 +'\n'
+'############# COEFFICIENTS TRANSLATED BY ROSETTA'
+' MODULE #############\n'
+'#### See Eur.Phys.J. C75 (2015) 12, 583 (arXiv:1508.05895) '\
'for more details ####\n'
+'########### {} BASIS PARAM CARD GENERATED {} ##########'\
'#\n'.format(card.blocks['basis'][1].upper(),
datetime.datetime.now().ctime().upper())
+'#'*80 +'\n\n')
if os.path.exists(filename) and not overwrite:
- session.log('{} already exists.'.format(filename))
+ session.log('\n{} already exists.'.format(filename))
carry_on = session.query('Overwrite?', default='no')
else:
carry_on=True
if carry_on:
special_blocks = ['loop','mass','sminputs','yukawa','vckm','basis']
coefforder = SLHA.sortblocks(card, ignore = special_blocks)
card.write(filename, blockorder=special_blocks + coefforder,
preamble=card_preamble)
session.log('Wrote "{}".'.format(filename))
session.log('')
return True
else:
return False
def write_template_card(basis, filename, value=0.):
from ..machinery import bases
from ..constants import default_masses, particle_names, default_inputs, input_names
try:
val = float(value)
rand = False
except ValueError:
if value.lower() == 'random':
import random
rand = True
else:
session.log('In write_template_card: "value" keyword argument '
'must either be a number or the string, "random".')
sys.exit()
# newinstance = bases[basis.name](flavor=basis.flavor, dependent=False)
newinstance = basis.__class__(flavor=basis.flavor, dependent=False)
for k in newinstance.keys():
try:
if rand:
newinstance[k] = complex(random.uniform(-1.,1.),
random.uniform(-1.,1.))
else:
newinstance[k] = complex(val, val)
except TypeError as e:
if rand:
newinstance[k] = random.uniform(-1.,1.)
else:
newinstance[k] = val
newinstance.reduce_hermitian_matrices()
SLHA_card = newinstance.card
mass_preamble = ('\n###################################\n'
+ '## INFORMATION FOR MASS\n'
+ '###################################\n')
massblock = SLHA.NamedBlock(name='mass', preamble=mass_preamble)
for m in basis.required_masses:
massblock.new_entry(m, default_masses[m],
name='M%s' % particle_names[m])
SLHA_card.add_block(massblock)
sm_preamble = ('\n###################################\n'
+ '## INFORMATION FOR SMINPUTS\n'
+ '###################################\n')
inputblock = SLHA.NamedBlock(name='sminputs', preamble=sm_preamble)
for m in basis.required_inputs:
inputblock.new_entry(m, default_inputs[m],
name='%s' % input_names[m])
SLHA_card.add_block(inputblock)
title = ' ROSETTA: {} BASIS INPUT CARD '.format(basis.name.upper())
time = ' GENERATED {} '.format(datetime.datetime.now().ctime().upper())
nleft = int((80-len(title))/2.)
nright = 80-len(title)-nleft
preamble = ( '#'*80 + '\n'
+'#'*nleft + title + '#'*nright +'\n'
+'#### See Eur.Phys.J. C75 (2015) 12, 583 (arXiv:1508.05895) '\
'for more details ####\n'
+'#'*22 + time + '#'*22 + '\n'
+'#'*80 +'\n')
special_blocks = ['mass','sminputs','vckm','basis']
theorder = SLHA.sortblocks(SLHA_card, ignore = special_blocks)
SLHA_card.write(filename, blockorder=special_blocks + theorder,
preamble = preamble, postamble = ('\n'+'#'*80)*2)
session.log('wrote {}'.format(filename))
session.log('')
\ No newline at end of file
diff --git a/Rosetta/internal/basis/translator.py b/Rosetta/internal/basis/translator.py
index 23d5a4a..95c792b 100644
--- a/Rosetta/internal/basis/translator.py
+++ b/Rosetta/internal/basis/translator.py
@@ -1,203 +1,203 @@
from .. import session
import checkers as check
from ..errors import TranslationPathError
def translate(basis, target=None, cache=True, avoid_cache = False,
minimal=False):
'''
Translation function. Makes use of existing translations and attempts to
find a path between the basis instance and the target basis. If a path
exists, successive translations are performed to get from A to B. The
resulting basis instance of every translation performed is stored as a
value in the basis.translations dictionary with the basis name as a key. If
an instance of the target basis is cached, the function returns this
instance and prints a message.
Keyword arguments:
target - Target basis, must be implemented in Rosetta.bases.
cache - Store the result of the translation in the 'translated'
attribute of the basis instance to avoid repeating the same
translations.
avoid_cache - Do not use the cached version of translation.
minimal - Forego set checks and calculate_dependent() for the target
basis instance. Useful if you want things to be a bit
faster and don't need to propagate the SM input parameters
etc. to the new basis instance
'''
from ..machinery import get_path, bases
# default target
target = target if target is not None else basis.output_basis
if target == basis.name: return basis
if target in basis.translations and not avoid_cache:
msg = 'translation ({} -> {}) already performed.\n'.format
session.once(msg(basis.name, target))
return basis.translations[target]
# find the chain of bases and translation functions
# to get from basis.name to target
chain = get_path(basis.name.lower(), target)
if not chain: # no translation possible
inputbasis = basis.__class__.__name__
outputbasis = bases[target].__name__
err = ('Sorry, Rosetta cannot translate from ' +
'{} to {}'.format(inputbasis, outputbasis))
raise TranslationPathError(err)
names = [basis.name.lower()]+[x[0] for x in chain]
session.log('Rosetta will be performing the translation:\n'+
' ' + ' -> '.join([bases[x].__name__
- for x in names])+'\n')
+ for x in names]))
# perform succesive translations, checking for
# required SM inputs/masses along the way
current = basis
# required_inputs = current.required_inputs
# required_masses = current.required_masses
# ensure required inputs are present
check.sminputs(current, current.required_inputs)
check.masses(current, current.required_masses)
for trgt, translate_function in chain:
# Check if this particular translation path has been saved previously
if trgt in basis.translations and not avoid_cache:
new = basis.translations[trgt]
msg = 'translation ({} -> {}) already performed.\n'.format
session.once(msg(current.name, trgt))
required_inputs = set(new.required_inputs)
required_masses = set(new.required_masses)
current = new
continue
instance = bases[trgt](dependent=True, flavor='general')
# update new basis instance with non-EFT blocks, decays
all_coeffs = (current.blocks.keys() + current.flavored.keys())
get_other_blocks(instance, current.card, all_coeffs)
message = 'translation ({} -> {})'.format(current.name,
instance.name)
session.verbose(message)
new = translate_function(current, instance)
if (minimal and new.name == target):
current = new
break
message = '{}'.format(instance.__class__)
# checks & calculates dependent parameters
session.verbose(' Checking required SM inputs '
'for "{}"'.format(new.name))
# new.check_sminputs(new.required_inputs, message=message)
check.sminputs(new, new.required_inputs, message=message)
session.verbose(' Checking for required masses '
'for "{}"'.format(new.name))
check.masses(new, new.required_masses, message=message)
session.verbose(' Checking EFT coefficients '
'for "{}"'.format(new.name))
# NOTE switch off check for presence of dependent coefficients as
# there is no difference between the coefficient existing and it
# having been assigned a value.
check.param_data(basis, do_dependent=False)
session.verbose(' Calling ' +
'{}.calculate_dependent()\n'.format(new.__class__))
new.calculate_dependent()
if cache: basis.translations[trgt] = new
# prepare for next step
required_inputs = set(new.required_inputs)
required_masses = set(new.required_masses)
current = new
if current.name =='bsmc' and not minimal:
# expand matrix blocks in the case of bsmc output to respect SLHA
# convention
expand_matrices(current)
else:
# reduce flavor structure back to user set option
current.flavor = basis.flavor
current.set_flavor('general', basis.flavor)
session.verbose('\nTranslation successful.\n')
return current
def get_other_blocks(basis, card, ignore):
ignore = [x.lower() for x in ignore]
other_blocks, other_matrices = {}, {}
for k, v in card.blocks.iteritems():
if k.lower() != 'basis' and k.lower() not in ignore:
other_blocks[k]=v
for k, v in card.matrices.iteritems():
if k.lower() != 'basis' and k.lower() not in ignore:
other_matrices[k]=v
for block in other_blocks:
theblock = card.blocks[block]
basis.card.add_block(theblock)
for matrix in other_matrices:
theblock = card.matrices[matrix]
basis.card.add_block(theblock)
for decay in card.decays.values():
basis.card.add_decay(decay, preamble = decay.preamble)
if card.has_block('mass'):
basis.mass=basis.card.blocks['mass']
if card.has_block('sminputs'):
basis.inputs=basis.card.blocks['sminputs']
basis.ckm = card.matrices['vckm']
def expand_matrices(basis):
'''
Special function to populate redundant elements of matrix blocks when
translating to the bsmc Lagrangian so that values for all 9 entries are
explicitly stored before writing out the parameter card. This is to
stay in accordance with the SLHA format.
The function directly modifies the _data and _names attributes of the
matrices since matrices with special properties i.e. Hermitian,
Symmetric etc. do not grant direct access to the redundant keys such as
the lower triangle of a Hermitian matrix.
'''
all_keys = [(1,1), (1,2), (1,3),
(2,1), (2,2), (2,3),
(3,1), (3,2), (3,3)]
for matrix in basis.card.matrices.values():
# list of missing elements in _data member of matrix instance
missing_keys = [k for k in all_keys if k not in matrix._data]
if missing_keys:
# randomly select parameter name since they all should have
# the same structure: (R|I)NAMEixj
elename = matrix._names.values()[0]
cname = elename[1:-3] # matrix name
pref = elename[0]
for k in missing_keys:
tail = cname + '{}x{}'.format(*k)
matrix._data[k] = matrix[k]
matrix._names[k] = pref + tail
matrix._numbers[pref+tail] = k
try:
matrix._re._data[k] = matrix._re[k]
matrix._re._names[k] = 'R' + tail
matrix._re._numbers['R'+tail] = k
except AttributeError:
pass
try:
matrix._im._data[k] = matrix._im[k]
matrix._im._names[k] = 'I' + tail
matrix._im._numbers['I'+tail] = k
except AttributeError:
pass
\ No newline at end of file
diff --git a/Rosetta/internal/session.py b/Rosetta/internal/session.py
index 526b865..a645980 100644
--- a/Rosetta/internal/session.py
+++ b/Rosetta/internal/session.py
@@ -1,147 +1,195 @@
import sys
import settings
from StringIO import StringIO
import textwrap
import re
+from ..import __version__, __author__, __url__, __date__
__once = set()
output = StringIO()
suppressed = StringIO()
def split(s, wid, lead=''):
right = lead+(s.strip())
res = []
while len(right) > wid:
isplit = wid
for char in right[:wid][::-1]:
if char == ' ': break
isplit -= 1
if isplit < float(wid)/2:
isplit=wid
left, right = right[:isplit], lead+right[isplit:]
res.append(left)
res.append(right)
return res
def fmt(istr, lim):
substrs = []
for s in istr.split('\n'):
if len(s) > lim:
lead = re.match(r'(\s*).*',s).group(1)
substrs += split(s, lim, lead=lead)
else:
substrs.append(s)
return '\n'.join(substrs)
def stdout(msg, log=False, width=80):
'''Display a message.'''
wrapped = fmt(msg, width)
print >> output, wrapped
print wrapped
def log(msg, width=80):
'''Display a message if settings.silent == False.'''
if not settings.silent:
stdout(msg, width=width)
else:
print >> suppressed, msg
+def drawline(text='', ignore_silent=False):
+ '''
+ Print a line of 80 hash characters to stdout via log(), optionally
+ with some text in the middle.
+ '''
+ if text: text = ' '+ text +' '
+ printer = log if not ignore_silent else stdout
+ printer('')
+ printer(text.center(80,'#'))
+ printer('')
+
def once(msg, width=80):
'''
Display a message that should be shown only once during runtime.
Once printed, msg is stored in module state variable '__once'.
'''
if msg not in __once:
log(msg, width=width)
__once.add(msg)
+def cite(prog, ref):
+ body = """
+{0}
+If you use this feature, please cite:
+
+{1}
+{2}
+ """.format((' '+prog+' ').center(80,'#'),
+ ref,
+ '#'*80)
+
+ once(body)
+
+
def verbose(msg, width=80):
'''
Display a message that should only be shown if settings.verbose == True
and settings.silent == False.
'''
if settings.verbose:
log(msg, width=width)
else:
print >> suppressed, msg
def query(question, default="yes"):
"""
Ask a yes/no question via raw_input() and return their answer.
"question" is a string that is presented to the user.
"default" is the presumed answer if the user just hits <Enter>.
It must be "yes" (the default), "no" or None (meaning
an answer is required of the user).
The "answer" return value is one of "yes" or "no".
Recipe borrowed from http://code.activestate.com/recipes/577058/
"""
valid = {"yes":True, "y":True, "ye":True,
"no":False, "n":False}
if settings.silent:
print >> suppressed, question+' [{}]\n'.format(default)
return valid[default]
elif settings.force:
stdout(question+' [{}]\n'.format(default))
return valid[default]
if default == None:
prompt = " [y/n] "
elif default == "yes":
prompt = " [Y/n] "
elif default == "no":
prompt = " [y/N] "
else:
raise ValueError("invalid default answer: '%s'" % default)
while True:
log(question + prompt)
choice = raw_input().lower()
if default is not None and choice == '':
return valid[default]
elif choice in valid:
return valid[choice]
else:
log("Please respond with 'yes' or 'no' (or 'y' or 'n').\n")
def exit(code=0):
'''
- Exit rosetta session by raisin sys.exit(code). The contents of
+ Exit rosetta session by raising sys.exit(code). The contents of
settings.output and settings.suppressed are written to 'rosetta.log' and
'rosetta.suppressed.log' respectively.
'''
with open('rosetta.log', 'w') as logfile:
logfile.write(output.getvalue())
with open('rosetta.suppressed.log', 'w') as logfile:
logfile.write(suppressed.getvalue())
log('Exit.')
log('Output and suppressed output written to rosetta.log and '
'rosetta.suppressed.log respectively.')
- log('#############################')
- log('')
+ drawline()
sys.exit(code)
-log('')
-once('''########## Rosetta ##########
-Adam Falkowski, Benjamin Fuks,
-Kentarou Mawatari, Ken Mimasu,
-Francesco Riva & Veronica Sanz.
-Eur.Phys.J. C75 (2015) 12, 583
-#############################''')
-log('')
+_vstring = 'Version {}, {}'.format(__version__, __date__)
+header="""
+################################################################################
+
+ ######## ####### ###### ######## ########## ######### ###
+ ## ## ## ## ## ## ######## ########## ######### ## ##
+ ## ## ## ## ## ### ### ### ## ##
+ ######## ## ## ###### ###### ##### ### ## ##
+ ## ## ## ## ## ### ##### ### #########
+ ## ## ## ## ## ## ######## ### ### ## ##
+ ## ## ####### ###### ######## ### ### ## ##
+
+
+ An operator basis translator for Standard Model effective field theory
+
+{}
+
+{}
+
+################################################################################
+
+{}
+Eur.Phys.J. C75 (2015) 12, 583
+
+################################################################################
+""".format( __url__.center(80),
+ _vstring.center(80),
+ __author__)
+
+# Print header the first time session is imported
+once(header)
\ No newline at end of file
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, May 3, 6:06 AM (1 d, 7 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4982933
Default Alt Text
(152 KB)
Attached To
rROSETTAGIT rosettagit
Event Timeline
Log In to Comment