Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-28 09:20:44

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2026 Dmitry Romanov
0003 
0004 #pragma once
0005 
0006 #include <algorithms/algorithm.h>
0007 #include <edm4eic/ReconstructedParticleCollection.h>
0008 #include <string>      // for basic_string
0009 #include <string_view> // for string_view
0010 
0011 #include "algorithms/interfaces/WithPodConfig.h"
0012 #include "algorithms/reco/ChargedLambdaReconstructionConfig.h"
0013 #include "services/particle/ParticleSvc.h"
0014 
0015 namespace eicrecon {
0016 
0017 using ChargedLambdaReconstructionAlgorithm =
0018     algorithms::Algorithm<algorithms::Input<const edm4eic::ReconstructedParticleCollection,
0019                                             const edm4eic::ReconstructedParticleCollection,
0020                                             const edm4eic::ReconstructedParticleCollection>,
0021                           algorithms::Output<edm4eic::ReconstructedParticleCollection>>;
0022 
0023 /**
0024  * Reconstruct Lambda candidates in the charged decay channel Lambda -> p pi-.
0025  *
0026  * Lambdas produced in ep collisions are strongly forward boosted and typically decay
0027  * meters downstream of the interaction point, so the daughters land in the far-forward
0028  * detectors: the proton in the Roman Pots, the off-momentum tracker or the B0 tracker,
0029  * the pi- in the B0 tracker (occasionally in the central detector). The algorithm
0030  * therefore combines three input collections:
0031  *
0032  * 1. charged particles from tracking (central + B0): positive candidates enter the
0033  *    proton pool, negative candidates enter the pion pool;
0034  * 2. Roman-Pot candidates: all enter the proton pool (transfer-matrix reconstruction
0035  *    under the proton hypothesis);
0036  * 3. off-momentum candidates: all enter the proton pool, same reasoning.
0037  *
0038  * Every (p, pi-) pairing is evaluated with a classic V0 cut chain computed from
0039  * momenta and reference points only:
0040  *   - opening angle between the daughters and polar angle of the summed momentum;
0041  *   - distance of closest approach between the two straight track lines, and the z of
0042  *     the closest-approach midpoint (a decay-vertex proxy);
0043  *   - pointing of the summed momentum along the origin-to-vertex-proxy direction
0044  *     (disabled by default, see ChargedLambdaReconstructionConfig::pointingMax);
0045  *   - momentum asymmetry (the proton carries most of the Lambda momentum);
0046  *   - invariant mass window under the (m_p, m_pi) hypothesis.
0047  *
0048  * All pairings that pass are stored as Lambda candidates with the daughters attached
0049  * via the particles relation; no best-candidate choice is made here, so analyses keep
0050  * the full candidate set and the mass sidebands within the configured window.
0051  *
0052  * Approximations and domain of applicability
0053  * ------------------------------------------
0054  * The topology cuts (DCA, decay-z proxy, pointing) treat each daughter as a straight line
0055  * through its reference point along its momentum, with no field transport and no
0056  * covariance. How well this approximation holds for real trajectories depends on the
0057  * input:
0058  *   - tracking candidates (central, B0): the line starts at the Acts perigee (closest
0059  *     approach to the z axis) and follows the momentum there. The approximation holds to
0060  *     the extent that the field between the decay point and the perigee can be neglected.
0061  *   - Roman-Pot and off-momentum candidates: the momentum is the transfer-matrix estimate
0062  *     at the IP, which assumes the proton came from the IP, and the reference point is the
0063  *     hit in the first station (z ~ 32.5 m and ~ 25.5 m). This line does not follow the
0064  *     proton through the beamline magnets, so for these legs the DCA and the decay-z proxy
0065  *     carry little information on the decay position. The decay-z window is wide and the
0066  *     pointing cut is disabled to keep such pairings. The registered factories take these
0067  *     candidates in the lab frame (ForwardRomanPotRecLabFrameParticles,
0068  *     ForwardOffMRecLabFrameParticles), the frame of the tracking candidates.
0069  *
0070  * Initial implementation tested on 2000 Sullivan events at 9x130 using truth-seeded
0071  * tracking with the truth-seed vertex acceptance opened to the far-forward decay region.
0072  * There both daughters are mostly B0 tracks; the decay-z proxy follows the true decay z
0073  * from the IP out to the B0 reach (~6 m) with a resolution of ~0.7 m (68% half-width), and
0074  * the mass peak has sigma = 8.6 MeV. The cut defaults were tuned in a standalone study
0075  * over 5x41 and 9x275 that includes Roman-Pot proton legs. Not validated in these tests:
0076  * pairings with Roman-Pot or off-momentum protons, other beam energies, and the
0077  * real-seeded chain.
0078  *
0079  * NOTE no guarantees are made for algorithm performance outside the above
0080  * conditions.
0081  *
0082  * FIXME This treatment is a stopgap. It should be revisited when far-forward candidates carry
0083  * a trajectory representation and the common vertexing tools can be applied to them.
0084  */
0085 class ChargedLambdaReconstruction : public ChargedLambdaReconstructionAlgorithm,
0086                                     public WithPodConfig<ChargedLambdaReconstructionConfig> {
0087 public:
0088   ChargedLambdaReconstruction(std::string_view name)
0089       : ChargedLambdaReconstructionAlgorithm{
0090             name,
0091             {"inputChargedParticles", "inputRomanPotParticles", "inputOffMomentumParticles"},
0092             {"outputLambdas"},
0093             "Reconstructs Lambda -> p pi- candidates from charged and far-forward "
0094             "particles with V0 topology and kinematics cuts"} {}
0095 
0096   void init() final;
0097   void process(const Input&, const Output&) const final;
0098 
0099 private:
0100   const algorithms::ParticleSvc& m_particleSvc = algorithms::ParticleSvc::instance();
0101   const double m_proton_mass{m_particleSvc.particle(2212).mass};
0102   const double m_pion_mass{m_particleSvc.particle(211).mass};
0103   const double m_lambda_mass{m_particleSvc.particle(3122).mass};
0104   /** squared invariant-mass window bounds, computed from the config in init() */
0105   double m_mass2_min{0};
0106   double m_mass2_max{0};
0107 };
0108 
0109 } // namespace eicrecon