[[PageOutline(1,Page Contents,inline)]] = Method 1: Pure Python (UFO/ALOHA) = == Compatible model. == All UFO model are not ready to use form-factor (all recent one should be). In order to see if your model is compatible, look in the file __init__.py if you see the following lines: {{{ try: import form_factors except ImportError: pass else: all_form_factor = form_factors.all_form_factors }}} == Defining your form factor: == create/edit the file form_factors.py and add the following lines: {{{ from object_library import all_form_factors, FormFactor from function_library import complexconjugate, re, im, csc, sec, acsc, asec, HeavTheta AAA = FormFactor(name = 'AAA', type = 'real', value = '(-2*MH if MH - P(-1,1)*P(-1,3) > 0 else MH)' }}} 1. Any parameter of the model can be used inside the 'value' expression 2. You can use any type of object define in the ALOHA syntax (see the [ALOHA paper http://arxiv.org/abs/arXiv:1108.2041] for the convention). This includes the momenta P(x,y). This first index is the lorentz index which should be contracted, while the second index refers to the particle ordering of the vertex. 3. If you need to add an additional parameter in your model, you can do it in the parameters.py file. == Add the vertex dependencies in your form factor: == Go in the file vertices.py and identify the interactions that you want to modify: Let assume that you want to modify the following interactions: {{{ V_2 = Vertex(name = 'V_2', particles = [ P.W__minus__, P.W__plus__, P.H ], color = [ '1' ], lorentz = [ L.VVS1, L.VVS2 ], couplings = {(0,0):C.GC_1,(0,1):C.GC_3}) }}} Then youhave to modify the lorentz structure associate to it: {{{ V_2 = Vertex(name = 'V_2', particles = [ P.W__minus__, P.W__plus__, P.H ], color = [ '1' ], lorentz = [ L.FF1, L.FF2 ], couplings = {(0,0):C.GC_1,(0,1):C.GC_3}) }}} Then you have to define those lorentz structure in the file lorentz.py if they were define as: {{{ VVS1 = Lorentz(name = 'VVS1', spins = [ 3, 3, 1 ], structure = 'Metric(1,2)') VVS2 = Lorentz(name = 'VVS2', spins = [ 3, 3, 1 ], structure = 'P(-1,1)*P(-1,2)*Metric(1,2)') }}} then you need to add the following lines: {{{ FF1 = Lorentz(name = 'FF1', spins = [ 3, 3, 1 ], structure = 'AAA*Metric(1,2)', formfactors=[ForFac.AAA]) VVS2 = Lorentz(name = 'VVS2', spins = [ 3, 3, 1 ], structure = 'AAA*P(-1,1)*P(-1,2)*Metric(1,2)', formfactors=[ForFac.AAA]) }}} 1. You need to be sure to have the line "import formfactors as ForFac" at the beginning of the lorentz.py file 2. You can include more than one formfactor for a single lorentz structure. 3. You are not force to define a new Lorentz structure if the old one will not be use anymore. = Method 2: Fortran Way = This method is intended for More complex formfactor (Those who cann't be written in one line). If the formfactor is a very complex function with a lot of "if" statement (like those obtained if when you add a form-factor to have the vertex associated to a full loop). The above procedure is not the most clear one. They are therefore the possibility to code your form-factor directly in Fortran. By providing a unique file containing the definition of the functions. Even if this method is usually easier to implement, this is not compatible with the C++/Python output, and you can not validate your implementation with the "check" command and/or produce any type of code related to the C++/Python output provided by MG5_aMC@NLO. In that case you need to create a directory Fortran insice the UFO directory and create a file functions.f You are free to define whatever you want in that file (if this doesn't create conflict with another functions of mg5. I advice to start all your routine/function by "mymdl_" to avoid any problem). Assuming that this Fortran file define the function AAA. Then you can modify the lorentz.py structure to the following: {{{ VVS2 = Lorentz(name = 'VVS2', spins = [ 3, 3, 1 ], structure = 'FormFactor(P(-1,1)*P(-1,3), P(-1,1)*P(-1,2) ) * P(-1,1)*P(-1,2)*Metric(1,2)') }}} 1. All functions defined liked that need to return a complex number 2. All argument of such function need to be a complex number, or an expression returning a complex number. It is therefore not possible to provide to the function the set of momenta as argument (since this is a vector). 3. You can include as many argument as you want for the function. Examples of functions.f {{{ double complex function FormFactor(S1, S2) double complex S1, S2 include input.inc ! include all model parameter FormFactor = LOG( (S1**2 + S2**2)/MW**2) return end }}} = Method 3: Expert Mode = You can fully bypass ALOHA by setting the lorentz structure to external {{{ VVS2 = Lorentz(name = 'VVS2', spins = [ 3, 3, 1 ], structure = 'external') }}} You are then '''responsible''' to provide the functions yourself. Each routines (VVS2_0.f, VVS2_1.f, ..., VVS2_0.py, ...) need to be set in the directory UFO_DIR/Fortran, UFO_DIR/Python, UFO_DIR/CPP A typical way to use this mode is first to ask MG5 to create those files (via the mg5 command output aloha VVS2_0 --format=Fortran). Then set the structure on external and modify manually the file created by ALOHA. = V4 MODEL (OLD model format)= The easiest way to implement momentum dependent form factors, without changing all the details in the {{{ matrix.f }}} files in a process is by adding them in the model files. In particular the {{{ couplings.f }}} can contain momentum dependent form factors. The following steps explain most of the details. * The first thing you have to do is download the full MG_ME package and untar it. Then, if your model contains new particles and interactions add them to the SM using the UserModel, giving some generic values to the coupling constants. (If your model does not contain new particles and you only want to modify existing interactions, it is enough to make a copy of the {{{ sm }}} directory to a new directory. ) * Generate the process you would like to study. * Go to the =./Source/MODEL/= directory and open the {{{ couplings.f }}} file. * Add (in the setpara subroutine) ''before'' the line {{{ c Start calculating the couplings for HELAS }}} the following lines to the file: {{{ c Momenta of particles in event include '../genps.inc' double precision pp(0:3,max_particles) common/momenta_pp/pp }}} This makes sure that the information of the momenta is available in the {{{ common/momenta_pp/pp }}} This makes sure that the information of the momenta is available in the {{{ couplings.f }}} file. These momenta can be used to calculate the anomalous (momentum dependent) couplings. The syntax is as follows. All the momenta are saved in an array called pp. The first element is running from 0 to 3, these are the energy, and the x, y and z components of the momentum of a particle (the beam direction is in the z direction) in the center of momentum frame of the event. The second element of the array labels the particles. Only momenta of '''external particles''' are in the array. The labeling is as follows. The first two are the incoming particles, and the others the outgoing numbered according to how the process is written down in the {{{ proc_card.dat }}} . For example, if you are studying {{{ e+e->Zh>bb~mu+mu- }}} then the first particle will be the positron, the second the electron. The final state particles: b quark, b anti-quark, muon+ and muon- , are 3, 4, 5 and 6 respectively. Hence momentum pp(2,4) is the y-component of the momentum of the b anti-quark in the center of momentum frame of the event. Using these components most anomalous couplings can be implemented by changing the SM values of the couplings in the {{{ couplings.f }}} file. These momenta can be used to calculate the anomalous (momentum dependent) couplings. The syntax is as follows. All the momenta are saved in an array called pp. The first element is running from 0 to 3, these are the energy, and the x, y and z components of the momentum of a particle (the beam direction is in the z direction) in the center of momentum frame of the event. The second element of the array labels the particles. Only momenta of '''external particles''' are in the array. The labeling is as follows. The first two are the incoming particles, and the others the outgoing numbered according to how the process is written down in the {{{ proc_card.dat }}} . For example, if you are studying {{{ e+e->Zh>bb~mu+mu- }}} then the first particle will be the positron, the second the electron. The final state particles: b quark, b anti-quark, muon+ and muon- , are 3, 4, 5 and 6 respectively. Hence momentum pp(2,4) is the y-component of the momentum of the b anti-quark in the center of momentum frame of the event. Using these components most anomalous couplings can be implemented by changing the SM values of the couplings in the {{{ couplings.f }}} file. * As a final step you have to make sure that the {{{ setpara }}} subroutine is called on an event-by-event basis, by adding to the {{{ run_card.dat }}} the line {{{ T = fixed_couplings ! if .false. calc. coupl. for every event }}} just after the line where you can set the scale factor. For an example {{{ run_card.dat }}} look [attachment:run_card.dat here]. Note that it might be interesting to make a new model for every process you want to study. In that case, instead of modifying the {{{ couplings.f }}} file in the =./Source/MODEL/= directory, you could change the one in the =./Models/newmodel/= directory. Doing it this way has the clear advantage of being able to regenerate your process, without having to change the {{{ couplings.f }}} file every time, which makes it less error prone. (Make sure that you also save a copy of the {{{ proc_card.dat }}} in the model directory so that you won't forget for which process you created this model.)