use crate::{
EM, ElectroweakField, ElectroweakOps, ElectroweakParams, PhysicsError, SIN2_THETA_W, W_MASS,
Z_MASS,
};
use deep_causality_metric::{LorentzianMetric, WestCoastMetric};
use deep_causality_num::RealField;
use deep_causality_tensor::CausalTensor;
use deep_causality_topology::{
BaseTopology, GaugeField, GaugeFieldWitness, SimplicialManifold, U1,
};
impl<S> ElectroweakOps<S> for ElectroweakField<S>
where
S: RealField + Clone + From<f64> + Into<f64> + Default,
{
fn new_field(
base: SimplicialManifold<S, S>,
connection: CausalTensor<S>,
) -> Result<Self, PhysicsError> {
let metric = WestCoastMetric::minkowski_4d().into_metric();
let num_points = base.len();
let dim = 4;
let lie_dim = 4; let field_strength = CausalTensor::zeros(&[num_points, dim, dim, lie_dim]);
GaugeField::new(base, metric, connection, field_strength)
.map_err(|e| PhysicsError::TopologyError(e.to_string()))
}
fn standard_model_params() -> ElectroweakParams<S> {
ElectroweakParams::standard_model()
}
fn extract_photon(&self) -> Result<EM<S>, PhysicsError> {
let params = Self::standard_model_params();
let cos_theta = params.cos_theta_w();
let sin_theta = params.sin_theta_w();
let (new_conn, new_strength) = GaugeFieldWitness::<S>::gauge_rotation(
self.connection(),
self.field_strength(),
2, 3, cos_theta,
sin_theta,
);
GaugeField::new(self.base().clone(), self.metric(), new_conn, new_strength)
.map_err(|e| PhysicsError::TopologyError(e.to_string()))
}
fn extract_z(&self) -> Result<GaugeField<U1, S, S>, PhysicsError> {
let params = Self::standard_model_params();
let cos_theta = params.cos_theta_w();
let sin_theta = params.sin_theta_w();
let neg_sin_theta = S::zero() - sin_theta;
let (new_conn, new_strength) = GaugeFieldWitness::<S>::gauge_rotation(
self.connection(),
self.field_strength(),
2, 3, neg_sin_theta,
cos_theta,
);
GaugeField::new(self.base().clone(), self.metric(), new_conn, new_strength)
.map_err(|e| PhysicsError::TopologyError(e.to_string()))
}
fn sin2_theta_w(&self) -> S {
<S as From<f64>>::from(SIN2_THETA_W)
}
fn w_mass(&self) -> S {
<S as From<f64>>::from(W_MASS)
}
fn z_mass(&self) -> S {
<S as From<f64>>::from(Z_MASS)
}
}