@@ -35,20 +35,94 @@ Return the element type of the `EEjet` struct.
3535"""
3636Base. eltype (:: Type{EEjet{T}} ) where T = T
3737
38+
39+ """
40+ EEjet(px::T, py::T, pz::T, E::T, _cluster_hist_index::Integer) where {T <: Real}
41+
42+ Constructs an `EEjet` object with the given momentum components `px`, `py`,
43+ `pz`, energy `E`, and cluster histogram index `_cluster_hist_index`.
44+
45+ The constructed EEjet object will be parametrised by the type `T`.
46+
47+ # Arguments
48+ - `px::T`: The x-component of the momentum.
49+ - `py::T`: The y-component of the momentum.
50+ - `pz::T`: The z-component of the momentum.
51+ - `E::T`: The energy of the jet.
52+ - `_cluster_hist_index::Integer`: The index of the cluster histogram.
53+
54+ # Returns
55+ - The initialised `EEjet` object.
56+
57+ # Note
58+ - `T` must be a subtype of `Real`.
59+ - The `@muladd` macro is used to perform fused multiply-add operations for
60+ computing `p2`.
61+ - The `@fastmath` macro is used to allow the compiler to perform optimizations
62+ for computing `inv_p`.
63+ """
3864function EEjet (px:: T , py:: T , pz:: T , E:: T , _cluster_hist_index:: Integer ) where {T <: Real }
3965 @muladd p2 = px * px + py * py + pz * pz
4066 inv_p = @fastmath 1.0 / sqrt (p2)
4167 EEjet {T} (px, py, pz, E, p2, inv_p, _cluster_hist_index)
4268end
4369
44- # Constructor with type T passes through without history index
70+ """
71+ EEjet(px::T, py::T, pz::T, E::T) where {T <: Real}
72+
73+ Constructs an `EEjet` object with the given momentum components `px`, `py`,
74+ `pz`, energy `E`, and the cluster histogram index set to zero.
75+
76+ The constructed EEjet object will be parametrised by the type `T`.
77+
78+ # Arguments
79+ - `px::T`: The x-component of the momentum.
80+ - `py::T`: The y-component of the momentum.
81+ - `pz::T`: The z-component of the momentum.
82+ - `E::T`: The energy of the jet.
83+
84+ # Returns
85+ - The initialised `EEjet` object.
86+ """
4587EEjet (px:: T , py:: T , pz:: T , E:: T ) where {T <: Real } = EEjet (px, py, pz, E, 0 )
4688
47- # Constructor with type U does type conversion before initialising
89+ """
90+ EEjet{U}(px::T, py::T, pz::T, E::T) where {T <: Real, U <: Real}
91+
92+ Constructs an `EEjet` object with conversion of the given momentum components
93+ (`px`, `py`, `pz`) and energy (`E`) from type `T` to type `U`.
94+
95+ # Arguments
96+ - `px::T`: The x-component of the momentum.
97+ - `py::T`: The y-component of the momentum.
98+ - `pz::T`: The z-component of the momentum.
99+ - `E::T`: The energy.
100+
101+ # Type Parameters
102+ - `T <: Real`: The type of the input momentum components and energy.
103+ - `U <: Real`: The type to which the input values will be converted
104+
105+ # Returns
106+ An `EEjet` object with the momentum components and energy parametrised to type
107+ `U`.
108+ """
48109EEjet {U} (px:: T , py:: T , pz:: T , E:: T ) where {T <: Real , U <: Real } = EEjet (U (px), U (py), U (pz), U (E), 0 )
49110
111+
112+ """
113+ EEjet(pj::PseudoJet) -> EEjet
114+
115+ Constructs an `EEjet` object from a given `PseudoJet` object `pj`.
116+
117+ # Arguments
118+ - `pj::PseudoJet`: A `PseudoJet` object used to create the `EEjet`.
119+
120+ # Returns
121+ - An `EEjet` object initialized with the same properties of the given `PseudoJet`.
122+ """
50123EEjet (pj:: PseudoJet ) = EEjet (px (pj), py (pj), pz (pj), energy (pj), cluster_hist_index (pj))
51124
125+
52126p2 (eej:: EEjet ) = eej. _p2
53127pt2 (eej:: EEjet ) = eej. px^ 2 + eej. py^ 2
54128const kt2 = pt2
0 commit comments