Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:02

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Definitions/Units.hpp"
0013 #include "Acts/Seeding/SeedConfirmationRangeConfig.hpp"
0014 #include "Acts/Utilities/Delegate.hpp"
0015 
0016 #include <memory>
0017 #include <numbers>
0018 
0019 namespace Acts {
0020 // forward declaration to avoid cyclic dependence
0021 template <typename T>
0022 class SeedFilter;
0023 
0024 /// @brief Structure that holds configuration parameters for the orthogonal seed finder algorithm
0025 template <typename SpacePoint>
0026 struct SeedFinderOrthogonalConfig {
0027   std::shared_ptr<Acts::SeedFilter<SpacePoint>> seedFilter;
0028 
0029   /// Seeding parameters for geometry settings and detector ROI
0030 
0031   // Limiting location of all measurements
0032   float phiMin = -std::numbers::pi_v<float>;
0033   float phiMax = std::numbers::pi_v<float>;
0034   /// limiting location of measurements
0035   float zMin = -2800 * Acts::UnitConstants::mm;
0036   float zMax = 2800 * Acts::UnitConstants::mm;
0037   float rMax = 600 * Acts::UnitConstants::mm;
0038   /// @warning If rMin is smaller than impactMax, the bin size will be 2*pi,
0039   /// which will make seeding very slow!
0040   float rMin = 33 * Acts::UnitConstants::mm;
0041 
0042   /// Seeding parameters used to define the region of interest for middle
0043   /// space-point
0044 
0045   /// Radial range for middle space-point
0046   /// The range can be defined manually with (rMinMiddle, rMaxMiddle). If
0047   /// useVariableMiddleSPRange is set to false and the vector rRangeMiddleSP is
0048   /// empty, we use (rMinMiddle, rMaxMiddle) to cut the middle space-points
0049   float rMinMiddle = 60.f * Acts::UnitConstants::mm;
0050   float rMaxMiddle = 120.f * Acts::UnitConstants::mm;
0051   /// If useVariableMiddleSPRange is set to false, the vector rRangeMiddleSP can
0052   /// be used to define a fixed r range for each z bin: {{rMin, rMax}, ...}
0053   bool useVariableMiddleSPRange = true;
0054   /// Range defined in vector for each z bin
0055   std::vector<std::vector<float>> rRangeMiddleSP;
0056   /// If useVariableMiddleSPRange is true, the radial range will be calculated
0057   /// based on the maximum and minimum r values of the space-points in the event
0058   /// and a deltaR (deltaRMiddleMinSPRange, deltaRMiddleMaxSPRange)
0059   float deltaRMiddleMinSPRange = 10. * Acts::UnitConstants::mm;
0060   float deltaRMiddleMaxSPRange = 10. * Acts::UnitConstants::mm;
0061 
0062   /// Vector containing minimum and maximum z boundaries for cutting middle
0063   /// space-points
0064   std::pair<float, float> zOutermostLayers{-2700 * Acts::UnitConstants::mm,
0065                                            2700 * Acts::UnitConstants::mm};
0066 
0067   /// Seeding parameters used to define the cuts on space-point doublets
0068 
0069   /// Minimum radial distance between middle-outer doublet components
0070   float deltaRMinTopSP = std::numeric_limits<float>::quiet_NaN();
0071   /// Maximum radial distance between middle-outer doublet components
0072   float deltaRMaxTopSP = std::numeric_limits<float>::quiet_NaN();
0073   /// Minimum radial distance between inner-middle doublet components
0074   float deltaRMinBottomSP = std::numeric_limits<float>::quiet_NaN();
0075   /// Maximum radial distance between inner-middle doublet components
0076   float deltaRMaxBottomSP = std::numeric_limits<float>::quiet_NaN();
0077 
0078   /// Shrink the phi range of middle space-point (analogous to phi bin size in
0079   /// grid from default seeding + number of phi bins used in search)
0080   float deltaPhiMax = 0.085;
0081 
0082   /// Maximum value of z-distance between space-points in doublet
0083   float deltaZMax =
0084       std::numeric_limits<float>::infinity() * Acts::UnitConstants::mm;
0085 
0086   /// Maximum allowed cotTheta between two space-points in doublet, used to
0087   /// check if forward angle is within bounds
0088   float cotThetaMax = 7.40627;  // equivalent to 2.7 eta (pseudorapidity)
0089 
0090   /// Limiting location of collision region in z-axis used to check if doublet
0091   /// origin is within reasonable bounds
0092   float collisionRegionMin = -150 * Acts::UnitConstants::mm;
0093   float collisionRegionMax = +150 * Acts::UnitConstants::mm;
0094 
0095   /// Enable cut on the compatibility between interaction point and doublet,
0096   /// this is an useful approximation to speed up the seeding
0097   bool interactionPointCut = false;
0098 
0099   /// Seeding parameters used to define the cuts on space-point triplets
0100 
0101   /// Minimum transverse momentum (pT) used to check the r-z slope compatibility
0102   /// of triplets with maximum multiple scattering effect (produced by the
0103   /// minimum allowed pT particle) + a certain uncertainty term. Check the
0104   /// documentation for more information
0105   /// https://acts.readthedocs.io/en/latest/core/reconstruction/pattern_recognition/seeding.html
0106   float minPt = 400. * Acts::UnitConstants::MeV;
0107   /// Number of sigmas of scattering angle to be considered in the minimum pT
0108   /// scattering term
0109   float sigmaScattering = 5;
0110   /// Term that accounts for the thickness of scattering medium in radiation
0111   /// lengths in the Lynch & Dahl correction to the Highland equation default is
0112   /// 5%
0113   /// TODO: necessary to make amount of material dependent on detector region?
0114   float radLengthPerSeed = 0.05;
0115   /// Maximum transverse momentum for scattering calculation
0116   float maxPtScattering = 10 * Acts::UnitConstants::GeV;
0117   /// Maximum value of impact parameter estimation of the seed candidates
0118   float impactMax = 20. * Acts::UnitConstants::mm;
0119   /// Parameter which can loosen the tolerance of the track seed to form a
0120   /// helix. This is useful for e.g. misaligned seeding.
0121   float helixCutTolerance = 1.;
0122 
0123   /// Seeding parameters used for quality seed confirmation
0124 
0125   /// Enable quality seed confirmation, this is different than default seeding
0126   /// confirmation because it can also be defined for different (r, z) regions
0127   /// of the detector (e.g. forward or central region) by SeedConfirmationRange.
0128   /// Seeds are classified as "high-quality" seeds and normal quality seeds.
0129   /// Normal quality seeds are only selected if no other "high-quality" seeds
0130   /// has been found for that inner-middle doublet.
0131   bool seedConfirmation = false;
0132   /// Contains parameters for central seed confirmation
0133   SeedConfirmationRangeConfig centralSeedConfirmationRange;
0134   /// Contains parameters for forward seed confirmation
0135   SeedConfirmationRangeConfig forwardSeedConfirmationRange;
0136   /// Maximum number (minus one) of accepted seeds per middle space-point
0137   unsigned int maxSeedsPerSpM = 5;
0138 
0139   /// Other parameters
0140 
0141   /// derived values, set on SeedFinder construction
0142   float highland = 0;
0143   float maxScatteringAngle2 = 0;
0144 
0145   // Delegate to apply experiment specific cuts
0146   Delegate<bool(float /*bottomRadius*/, float /*cotTheta*/)> experimentCuts{
0147       DelegateFuncTag<&noopExperimentCuts>{}};
0148 
0149   bool isInInternalUnits = false;
0150 
0151   SeedFinderOrthogonalConfig calculateDerivedQuantities() const {
0152     if (!isInInternalUnits) {
0153       throw std::runtime_error(
0154           "SeedFinderOrthogonalConfig not in ACTS internal units in "
0155           "calculateDerivedQuantities");
0156     }
0157     SeedFinderOrthogonalConfig config = *this;
0158     /// calculation of scattering using the highland formula
0159     /// convert pT to p once theta angle is known
0160     config.highland = 13.6 * std::sqrt(radLengthPerSeed) *
0161                       (1 + 0.038 * std::log(radLengthPerSeed));
0162     config.maxScatteringAngle2 = std::pow(config.highland / config.minPt, 2);
0163     return config;
0164   }
0165 
0166   SeedFinderOrthogonalConfig toInternalUnits() const {
0167     if (isInInternalUnits) {
0168       throw std::runtime_error(
0169           "SeedFinderOrthogonalConfig already in ACTS internal units in "
0170           "toInternalUnits");
0171     }
0172     using namespace Acts::UnitLiterals;
0173     SeedFinderOrthogonalConfig config = *this;
0174     config.isInInternalUnits = true;
0175     config.minPt /= 1_MeV;
0176     config.deltaRMinTopSP /= 1_mm;
0177     config.deltaRMaxTopSP /= 1_mm;
0178     config.deltaRMinBottomSP /= 1_mm;
0179     config.deltaRMaxBottomSP /= 1_mm;
0180     config.impactMax /= 1_mm;
0181     config.maxPtScattering /= 1_MeV;
0182     config.collisionRegionMin /= 1_mm;
0183     config.collisionRegionMax /= 1_mm;
0184     config.zMin /= 1_mm;
0185     config.zMax /= 1_mm;
0186     config.rMax /= 1_mm;
0187     config.rMin /= 1_mm;
0188 
0189     return config;
0190   }
0191 };
0192 
0193 }  // namespace Acts