Skip to content

Commit

Permalink
Evaluate effective couplings for all members of a multiplet
Browse files Browse the repository at this point in the history
but only save couplings for physical eigenstates to the
observables class
  • Loading branch information
Dylan Harries committed Jan 22, 2016
1 parent 6beb17a commit f7ad043
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 93 deletions.
123 changes: 80 additions & 43 deletions meta/EffectiveCouplings.m
Expand Up @@ -10,43 +10,26 @@
CreateEffectiveCouplingName[pIn_, pOut_] :=
"eff_Cp" <> CConversion`ToValidCSymbolString[pIn] <> CConversion`ToValidCSymbolString[pOut] <> CConversion`ToValidCSymbolString[pOut];

IsImplementedCoupling[obs_ /; obs === FlexibleSUSYObservable`CpHiggsPhotonPhoton] := True;
IsImplementedCoupling[obs_ /; obs === FlexibleSUSYObservable`CpHiggsGluonGluon] := True;
IsImplementedCoupling[obs_ /; obs === FlexibleSUSYObservable`CpPseudoScalarPhotonPhoton] := True;
IsImplementedCoupling[obs_ /; obs === FlexibleSUSYObservable`CpPseudoScalarGluonGluon] := True;
IsImplementedCoupling[_] := False;

FilterOutInvalidCouplings[couplings_List] :=
Module[{dim, valid},
valid = couplings;
If[MemberQ[couplings, FlexibleSUSYObservable`CpHiggsPhotonPhoton] ||
MemberQ[couplings, FlexibleSUSYObservable`CpHiggsGluonGluon],
dim = TreeMasses`GetDimensionWithoutGoldstones[SARAH`HiggsBoson]
If[FreeQ[TreeMasses`GetParticles[], SARAH`HiggsBoson] ||
TreeMasses`GetDimensionWithoutGoldstones[SARAH`HiggsBoson] == 0,
Print["Warning: no physical Higgs boson found."];
Print[" Effective couplings for Higgs boson will not"];
Print[" be calculated."];
valid = DeleteCases[valid, a_ /; (a === FlexibleSUSYObservable`CpHiggsPhotonPhoton ||
a === FlexibleSUSYObservable`CpHiggsGluonGluon)];
];
GetAllowedCouplings[] :=
Module[{dim,
valid = {FlexibleSUSYObservable`CpHiggsPhotonPhoton,
FlexibleSUSYObservable`CpHiggsGluonGluon,
FlexibleSUSYObservable`CpPseudoScalarPhotonPhoton,
FlexibleSUSYObservable`CpPseudoScalarGluonGluon}
},
If[FreeQ[TreeMasses`GetParticles[], SARAH`HiggsBoson],
valid = DeleteCases[valid, a_ /; (a === FlexibleSUSYObservable`CpHiggsPhotonPhoton ||
a === FlexibleSUSYObservable`CpHiggsGluonGluon)];
];
If[MemberQ[couplings, FlexibleSUSYObservable`CpPseudoScalarPhotonPhoton] ||
MemberQ[couplings, FlexibleSUSYObservable`CpPseudoScalarGluonGluon],
If[FreeQ[TreeMasses`GetParticles[], SARAH`PseudoScalar] ||
TreeMasses`GetDimensionWithoutGoldstones[SARAH`PseudoScalar] == 0,
Print["Warning: no physical pseudoscalar boson found."];
Print[" Effective couplings for pseudoscalar boson will not"];
Print[" be calculated."];
valid = DeleteCases[valid, a_ /; (a === FlexibleSUSYObservable`CpPseudoScalarPhotonPhoton ||
a === FlexibleSUSYObservable`CpPseudoScalarGluonGluon)];
];
If[FreeQ[TreeMasses`GetParticles[], SARAH`PseudoScalar],
valid = DeleteCases[valid, a_ /; (a === FlexibleSUSYObservable`CpPseudoScalarPhotonPhoton ||
a === FlexibleSUSYObservable`CpPseudoScalarGluonGluon)];
];
valid
];

CreateEffectiveCouplingPrototype[coupling_] :=
Module[{particle, vectorBoson, dim, type, name},
GetExternalStates[coupling_] :=
Module[{particle, vectorBoson},
Which[coupling === FlexibleSUSYObservable`CpHiggsPhotonPhoton,
particle = SARAH`HiggsBoson;
vectorBoson = SARAH`VectorP;,
Expand All @@ -59,12 +42,66 @@
coupling === FlexibleSUSYObservable`CpPseudoScalarGluonGluon,
particle = SARAH`PseudoScalar;
vectorBoson = SARAH`VectorG;,
True, Return[""]
True, particle = Null; vectorBoson = Null
];
dim = TreeMasses`GetDimensionWithoutGoldstones[particle];
type = CConversion`CreateCType[CConversion`ScalarType[CConversion`complexScalarCType]];
name = CreateEffectiveCouplingName[particle, vectorBoson];
type <> " " <> name <> If[dim == 1, "();\n", "(unsigned gO1);\n"]
{particle, vectorBoson}
];

CreateEffectiveCouplingPrototype[coupling_] :=
Module[{particle, vectorBoson, dim, type, name, result = ""},
{particle, vectorBoson} = GetExternalStates[coupling];
If[particle =!= Null && vectorBoson =!= Null,
dim = TreeMasses`GetDimension[particle];
type = CConversion`CreateCType[CConversion`ScalarType[CConversion`complexScalarCType]];
name = CreateEffectiveCouplingName[particle, vectorBoson];
result = type <> " " <> name <> If[dim == 1, "();\n", "(unsigned gO1);\n"];
];
result
];

RunToDecayingParticleScale[particle_] :=
Module[{savedMass, body, result},
savedMass = CConversion`RValueToCFormString[FlexibleSUSY`M[particle]];
If[TreeMasses`GetDimension[particle] != 1,
savedMass = savedMass <> "(gO1)";
];
body = "model.run_to(" <> savedMass <> ");\nmodel.calculate_DRbar_masses();\n";
"if (rg_improve && scale != " <> savedMass <> ") {\n"
<> TextFormatting`IndentText[body] <> "}\n"
];

ResetSavedParameters[] :=
Module[{body},
body = "model.set_scale(scale);\nmodel.set(saved_parameters);\n";
"if (model.get_scale() != scale) {\n" <> TextFormatting`IndentText[body] <> "}\n"
];

CreateEffectiveCouplingFunction[coupling_] :=
Module[{particle, vectorBoson, dim, type, name, savedMass, mass, body = "", result = ""},
{particle, vectorBoson} = GetExternalStates[coupling];
If[particle =!= Null && vectorBoson =!= Null,
dim = TreeMasses`GetDimension[particle];
type = CConversion`CreateCType[CConversion`ScalarType[CConversion`complexScalarCType]];
name = CreateEffectiveCouplingName[particle, vectorBoson];
result = type <> " " <> FlexibleSUSY`FSModelName <> "_effective_couplings::"
<> name;
mass = ToValidCSymbolString[FlexibleSUSY`M[particle]];
savedMass = "const auto " <> mass <> " = PHYSICAL(" <> mass <> ");\n";
If[dim == 1,
result = result <> "()\n";,
result = result <> "(unsigned gO1)\n{\n";
mass = mass <> "(gO1)";
];
body = "const double scale = model.get_scale();\n"
<> "const Eigen::ArrayXd saved_parameters(model.get());\n"
<> savedMass <> "\n"
<> RunToDecayingParticleScale[particle] <> "\n"
<> type <> " result;\n\n";
body = body <> ResetSavedParameters[] <> "\n";
body = body <> "return result;\n";
result = result <> TextFormatting`IndentText[body] <> "}\n";
];
result
];

CreateEffectiveCouplingsPrototypes[couplings_List] :=
Expand All @@ -75,13 +112,13 @@

CreateEffectiveCouplingsFunctions[couplings_List] :=
Module[{result = ""},
(result = result <> CreateEffectiveCouplingFunction[#] <> "\n")& /@ couplings;
result
];

CalculateEffectiveCouplings[observables_List] :=
CalculateEffectiveCouplings[] :=
Module[{couplings, prototypes = "", functions = ""},
couplings = DeleteDuplicates[Cases[observables, p_ /; IsImplementedCoupling[p], {0, Infinity}]];
couplings = FilterOutInvalidCouplings[observables];
couplings = GetAllowedCouplings[];
(* @todo find needed couplings *)
prototypes = prototypes <> CreateEffectiveCouplingsPrototypes[couplings];
functions = functions <> CreateEffectiveCouplingsFunctions[couplings];
Expand Down Expand Up @@ -132,11 +169,11 @@
selfEnergy = First[Cases[nPointFunctions, SelfEnergies`FSSelfEnergy[state, _]]];,
selfEnergy = First[Cases[nPointFunctions, SelfEnergies`FSSelfEnergy[state[__], _]]];
];
twoBodyDecays = DeleteDuplicates[Vertices`GetParticleList /@
twoBodyDecays = DeleteDuplicates[Vertices`GetParticleList /@
Join[Cases[selfEnergy, SARAH`Cp[p1_, p2_, p3_]
:> (SARAH`Cp @@ Vertices`ToRotatedField /@ {p1, p2, p3}), {0, Infinity}],
Cases[selfEnergy, SARAH`Cp[p1_, p2_, p3_][PL]
:> (SARAH`Cp @@ Vertices`ToRotatedField /@ {p1, p2, p3})[PL], {0, Infinity}],
:> (SARAH`Cp @@ Vertices`ToRotatedField /@ {p1, p2, p3})[PL], {0, Infinity}],
Cases[selfEnergy, SARAH`Cp[p1_, p2_, p3_][PR]
:> (SARAH`Cp @@ Vertices`ToRotatedField /@ {p1, p2, p3})[PR], {0,Infinity}]]
/. p_[{__}] -> p /. SARAH`Cp[p__][PL | PR] -> SARAH`Cp[p]];
Expand All @@ -149,7 +186,7 @@
chargedParticles, decayParticles, neededCouplings},
chargedParticles = GetParticlesCoupledToPhoton[particles];
decayParticles = GetTwoBodyDecays[state, nPointFunctions, eigenstates];
];
GetEffectiveCouplingToGluon[state_, eigenstates_:FlexibleSUSY`FSEigenstates] :=
Expand Down
29 changes: 19 additions & 10 deletions meta/FlexibleSUSY.m
Expand Up @@ -1086,8 +1086,17 @@ corresponding tadpole is real or imaginary (only in models with CP
} ];
];

WriteEffectiveCouplings[files_List] :=
Module[{loopCouplingsPrototypes, loopCouplingsFunctions},
{loopCouplingsPrototypes, loopCouplingsFunctions} = EffectiveCouplings`CalculateEffectiveCouplings[];
WriteOut`ReplaceInFiles[files,
{ "@loopCouplingsPrototypes@" -> IndentText[loopCouplingsPrototypes],
"@loopCouplingsFunctions@" -> loopCouplingsFunctions,
Sequence @@ GeneralReplacementRules[]
} ];
];

(* Write the observables files *)
(* @todo currently writing effective couplings function in here too, but should it be separated? *)
WriteObservables[extraSLHAOutputBlocks_, files_List] :=
Module[{requestedObservables, numberOfObservables, observablesDef,
observablesInit, getObservables, getObservablesNames,
Expand All @@ -1101,8 +1110,6 @@ corresponding tadpole is real or imaginary (only in models with CP
Observables`CreateSetAndDisplayObservablesFunctions[requestedObservables];
clearObservables = Observables`CreateClearObservablesFunction[requestedObservables];
calculateObservables = Observables`CalculateObservables[requestedObservables, "observables"];
{loopCouplingsPrototypes, loopCouplingsFunctions} =
EffectiveCouplings`CalculateEffectiveCouplings[requestedObservables];
WriteOut`ReplaceInFiles[files,
{ "@numberOfObservables@" -> ToString[numberOfObservables],
"@observablesDef@" -> IndentText[observablesDef],
Expand All @@ -1112,8 +1119,6 @@ corresponding tadpole is real or imaginary (only in models with CP
"@clearObservables@" -> IndentText[clearObservables],
"@setObservables@" -> IndentText[setObservables],
"@calculateObservables@" -> IndentText[calculateObservables],
"@loopCouplingsPrototypes@" -> IndentText[loopCouplingsPrototypes],
"@loopCouplingsFunctions@" -> loopCouplingsFunctions,
Sequence @@ GeneralReplacementRules[]
} ];
];
Expand Down Expand Up @@ -2163,15 +2168,19 @@ corresponding tadpole is real or imaginary (only in models with CP
diagonalizationPrecision];

Print["Creating observables"];
(* @note separating this out for now for simplicity *)
(* @todo maybe implement a flag (like for addons) to turn on/off? *)
WriteEffectiveCouplings[{{FileNameJoin[{$flexiblesusyTemplateDir, "effective_couplings.hpp.in"}],
FileNameJoin[{FSOutputDir, FlexibleSUSY`FSModelName <> "_effective_couplings.hpp"}]},
{FileNameJoin[{$flexiblesusyTemplateDir, "effective_couplings.cpp.in"}],
FileNameJoin[{FSOutputDir, FlexibleSUSY`FSModelName <> "_effective_couplings.cpp"}]}
}];

WriteObservables[extraSLHAOutputBlocks,
{{FileNameJoin[{$flexiblesusyTemplateDir, "observables.hpp.in"}],
FileNameJoin[{FSOutputDir, FlexibleSUSY`FSModelName <> "_observables.hpp"}]},
{FileNameJoin[{$flexiblesusyTemplateDir, "observables.cpp.in"}],
FileNameJoin[{FSOutputDir, FlexibleSUSY`FSModelName <> "_observables.cpp"}]},
{FileNameJoin[{$flexiblesusyTemplateDir, "effective_couplings.hpp.in"}],
FileNameJoin[{FSOutputDir, FlexibleSUSY`FSModelName <> "_effective_couplings.hpp"}]},
{FileNameJoin[{$flexiblesusyTemplateDir, "effective_couplings.cpp.in"}],
FileNameJoin[{FSOutputDir, FlexibleSUSY`FSModelName <> "_effective_couplings.cpp"}]}}];
FileNameJoin[{FSOutputDir, FlexibleSUSY`FSModelName <> "_observables.cpp"}]}}];

Print["Creating user example spectrum generator program ..."];
spectrumGeneratorInputFile = "high_scale_spectrum_generator.hpp.in";
Expand Down

0 comments on commit f7ad043

Please sign in to comment.