@@ -67,13 +67,13 @@ 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] child1Energy The energy of the first child particle
71+ // / @param [in] child1Direction The direction of the first child particle
7272 // /
7373 // / @return Array containing the produced leptons
7474 std::array<Particle, 2 > generateChildren (
75- const Particle& photon, double childEnergy ,
76- const Acts::Vector3& childDirection ) const ;
75+ const Particle& photon, double child1Energy ,
76+ const Acts::Vector3& child1Direction ) const ;
7777
7878 // / Generate the energy fraction of the first child particle.
7979 // /
@@ -225,50 +225,47 @@ 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 (
259- const Particle& photon, double childEnergy ,
260- const Acts::Vector3& childDirection ) const {
255+ const Particle& photon, double child1Energy ,
256+ const Acts::Vector3& child1Direction ) const {
261257 using namespace Acts ::UnitLiterals;
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 (child1Energy , massChild);
266262
267263 // Use energy-momentum conservation for the other child
268- const Acts::Vector3 vtmp =
264+ const Acts::Vector3 momentum2 =
269265 photon.fourMomentum ().template segment <3 >(Acts::eMom0) -
270- momentum1 * childDirection;
271- const double momentum2 = vtmp.norm ();
266+ absoluteMomentum1 * child1Direction;
267+ const Acts::Vector3 child2Direction = momentum2.normalized ();
268+ const double absoluteMomentum2 = momentum2.norm ();
272269
273270 // The daughter particles are created with the explicit electron mass used in
274271 // the calculations for consistency. Using the full Particle constructor with
@@ -278,15 +275,15 @@ inline std::array<Particle, 2> PhotonConversion::generateChildren(
278275 Particle (photon.particleId ().makeDescendant (0 ), Acts::eElectron, -1_e,
279276 electronMass ())
280277 .setPosition4 (photon.fourPosition ())
281- .setDirection (childDirection )
282- .setAbsoluteMomentum (momentum1 )
278+ .setDirection (child1Direction )
279+ .setAbsoluteMomentum (absoluteMomentum1 )
283280 .setProcess (ProcessType::ePhotonConversion)
284281 .setReferenceSurface (photon.referenceSurface ()),
285282 Particle (photon.particleId ().makeDescendant (1 ), Acts::ePositron, 1_e,
286283 electronMass ())
287284 .setPosition4 (photon.fourPosition ())
288- .setDirection (childDirection )
289- .setAbsoluteMomentum (momentum2 )
285+ .setDirection (child2Direction )
286+ .setAbsoluteMomentum (absoluteMomentum2 )
290287 .setProcess (ProcessType::ePhotonConversion)
291288 .setReferenceSurface (photon.referenceSurface ()),
292289 };
@@ -308,14 +305,15 @@ bool PhotonConversion::run(generator_t& generator, Particle& particle,
308305 }
309306
310307 // Get one child energy
311- const double childEnergy = p * generateFirstChildEnergyFraction (generator, p);
308+ const double child1Energy =
309+ p * generateFirstChildEnergyFraction (generator, p);
312310
313311 // Now get the deflection
314- const Acts::Vector3 childDir = generateChildDirection (generator, particle);
312+ const Acts::Vector3 child1Dir = generateChildDirection (generator, particle);
315313
316314 // Produce the final state
317315 const std::array<Particle, 2 > finalState =
318- generateChildren (particle, childEnergy, childDir );
316+ generateChildren (particle, child1Energy, child1Dir );
319317 generated.insert (generated.end (), finalState.begin (), finalState.end ());
320318
321319 return true ;
0 commit comments