Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:27:50

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