@@ -67,8 +67,8 @@ class PhotonConversion {
6767 // / This method constructs and returns the child particles.
6868 // /
6969 // / @param [in] photon The interacting photon
70- // / @param [in] childEnergy The energy of one child particle
71- // / @param [in] childDirection The direction of the child particle
70+ // / @param [in] childEnergy The energy of the first child particle
71+ // / @param [in] childDirection The direction of the first child particle
7272 // /
7373 // / @return Array containing the produced leptons
7474 std::array<Particle, 2 > generateChildren (
@@ -225,34 +225,30 @@ double PhotonConversion::generateFirstChildEnergyFraction(
225225template <typename generator_t >
226226Acts::Vector3 PhotonConversion::generateChildDirection (
227227 generator_t & generator, const Particle& particle) const {
228- // / This method is based upon the Athena class PhotonConversionTool
229-
230- // Following the Geant4 approximation from L. Urban
231- // the azimutal angle
232- double theta = electronMass () / particle.energy ();
228+ // This method is based upon the Athena class PhotonConversionTool
233229
230+ // Following the Geant4 approximation from L. Urban the azimutal angle
234231 std::uniform_real_distribution<double > uniformDistribution{0 ., 1 .};
235232 const double u = -std::log (uniformDistribution (generator) *
236233 uniformDistribution (generator)) *
237234 1.6 ;
238-
239- theta *= (uniformDistribution (generator) < 0.25 )
240- ? u
241- : u * 1 . / 3 .; // 9./(9.+27) = 0.25
235+ const double theta = ( electronMass () / particle. energy ()) *
236+ ( (uniformDistribution (generator) < 0.25 )
237+ ? u
238+ : u * 1 . / 3 .) ; // 9./(9.+27) = 0.25
242239
243240 // draw the random orientation angle
244241 const auto psi = std::uniform_real_distribution<double >(
245242 -std::numbers::pi, std::numbers::pi)(generator);
246243
247- Acts::Vector3 direction = particle.direction ();
248244 // construct the combined rotation to the scattered direction
249- Acts::RotationMatrix3 rotation (
245+ const Acts::RotationMatrix3 rotation (
250246 // rotation of the scattering deflector axis relative to the reference
251- Acts::AngleAxis3 (psi, direction) *
247+ Acts::AngleAxis3 (psi, particle. direction () ) *
252248 // rotation by the scattering angle around the deflector axis
253- Acts::AngleAxis3 (theta, Acts::createCurvilinearUnitU (direction)));
254- direction. applyOnTheLeft (rotation );
255- return direction;
249+ Acts::AngleAxis3 (theta,
250+ Acts::createCurvilinearUnitU (particle. direction ())) );
251+ return rotation * particle. direction () ;
256252}
257253
258254inline std::array<Particle, 2 > PhotonConversion::generateChildren (
@@ -262,13 +258,13 @@ inline std::array<Particle, 2> PhotonConversion::generateChildren(
262258
263259 // Calculate the child momentum
264260 const double massChild = electronMass ();
265- const double momentum1 = Acts::fastCathetus (childEnergy, massChild);
261+ const double absoluteMomentum1 = Acts::fastCathetus (childEnergy, massChild);
266262
267263 // Use energy-momentum conservation for the other child
268264 const Acts::Vector3 vtmp =
269265 photon.fourMomentum ().template segment <3 >(Acts::eMom0) -
270- momentum1 * childDirection;
271- const double momentum2 = vtmp.norm ();
266+ absoluteMomentum1 * childDirection;
267+ const double absoluteMomentum2 = vtmp.norm ();
272268
273269 // The daughter particles are created with the explicit electron mass used in
274270 // the calculations for consistency. Using the full Particle constructor with
@@ -279,14 +275,14 @@ inline std::array<Particle, 2> PhotonConversion::generateChildren(
279275 electronMass ())
280276 .setPosition4 (photon.fourPosition ())
281277 .setDirection (childDirection)
282- .setAbsoluteMomentum (momentum1 )
278+ .setAbsoluteMomentum (absoluteMomentum1 )
283279 .setProcess (ProcessType::ePhotonConversion)
284280 .setReferenceSurface (photon.referenceSurface ()),
285281 Particle (photon.particleId ().makeDescendant (1 ), Acts::ePositron, 1_e,
286282 electronMass ())
287283 .setPosition4 (photon.fourPosition ())
288284 .setDirection (childDirection)
289- .setAbsoluteMomentum (momentum2 )
285+ .setAbsoluteMomentum (absoluteMomentum2 )
290286 .setProcess (ProcessType::ePhotonConversion)
291287 .setReferenceSurface (photon.referenceSurface ()),
292288 };
@@ -311,11 +307,11 @@ bool PhotonConversion::run(generator_t& generator, Particle& particle,
311307 const double childEnergy = p * generateFirstChildEnergyFraction (generator, p);
312308
313309 // Now get the deflection
314- const Acts::Vector3 childDir = generateChildDirection (generator, particle);
310+ const Acts::Vector3 child1Dir = generateChildDirection (generator, particle);
315311
316312 // Produce the final state
317313 const std::array<Particle, 2 > finalState =
318- generateChildren (particle, childEnergy, childDir );
314+ generateChildren (particle, childEnergy, child1Dir );
319315 generated.insert (generated.end (), finalState.begin (), finalState.end ());
320316
321317 return true ;
0 commit comments