Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:22:00

0001 /** TRACCC library, part of the ACTS project (R&D line)
0002  *
0003  * (c) 2021-2022 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 
0008 #pragma once
0009 
0010 // Project include(s).
0011 #include "traccc/definitions/common.hpp"
0012 #include "traccc/definitions/primitives.hpp"
0013 #include "traccc/definitions/qualifiers.hpp"
0014 
0015 namespace traccc {
0016 
0017 struct seedfinder_config {
0018   seedfinder_config() { setup(); }
0019 
0020   // limiting location of measurements
0021   float zMin = -2000.f * unit<float>::mm;
0022   float zMax = 2000.f * unit<float>::mm;
0023   float rMax = 200.f * unit<float>::mm;
0024   // WARNING: if rMin is smaller than impactMax, the bin size will be 2*pi,
0025   // which will make seeding very slow!
0026   float rMin = 33.f * unit<float>::mm;
0027 
0028   // Geometry Settings
0029   // Detector ROI
0030   // limiting location of collision region in z
0031   float collisionRegionMin = -250 * unit<float>::mm;
0032   float collisionRegionMax = +250 * unit<float>::mm;
0033   float phiMin = static_cast<float>(-M_PI);
0034   float phiMax = static_cast<float>(M_PI);
0035 
0036   // Seed Cuts
0037   // lower cutoff for seeds in MeV
0038   float minPt = 500.f * unit<float>::MeV;
0039   // cot of maximum theta angle
0040   // equivalent to 4 eta (pseudorapidity)
0041   float cotThetaMax = 27.2845f;
0042   // minimum distance in mm in r between two measurements within one seed
0043   float deltaRMin = 20 * unit<float>::mm;
0044   // maximum distance in mm in r between two measurements within one seed
0045   float deltaRMax = 80 * unit<float>::mm;
0046 
0047   // maximum distance in mm in z between measurements in one seed
0048   float deltaZMax = 450 * unit<float>::mm;
0049 
0050   // FIXME: this is not used yet
0051   //        float upperPtResolutionPerSeed = 20* Acts::GeV;
0052 
0053   // the delta for inverse helix radius up to which compared seeds
0054   // are considered to have a compatible radius. delta of inverse radius
0055   // leads to this value being the cutoff. unit is 1/mm. default value
0056   // of 0.00003 leads to all helices with radius>33m to be considered
0057   // compatible
0058 
0059   // impact parameter in mm
0060   float impactMax = 10.f * unit<float>::mm;
0061   // how many sigmas of scattering angle should be considered?
0062   float sigmaScattering = 3.0f;
0063   // Upper pt limit for scattering calculation
0064   float maxPtScattering = 10.f * unit<float>::GeV;
0065 
0066   // for how many seeds can one SpacePoint be the middle SpacePoint?
0067   unsigned int maxSeedsPerSpM = 5;
0068 
0069   float bFieldInZ = 1.99724f * unit<float>::T;
0070   // location of beam in x,y plane.
0071   // used as offset for Space Points
0072   vector2 beamPos{-.0f * unit<float>::mm, -.0f * unit<float>::mm};
0073 
0074   // average radiation lengths of material on the length of a seed. used for
0075   // scattering.
0076   // default is 5%
0077   // TODO: necessary to make amount of material dependent on detector region?
0078   float radLengthPerSeed = 0.05f;
0079   // alignment uncertainties, used for uncertainties in the
0080   // non-measurement-plane of the modules
0081   // which otherwise would be 0
0082   // will be added to spacepoint measurement uncertainties (and therefore also
0083   // multiplied by sigmaError)
0084   // FIXME: call align1 and align2
0085   float zAlign = 0 * unit<float>::mm;
0086   float rAlign = 0 * unit<float>::mm;
0087   // used for measurement (+alignment) uncertainties.
0088   // find seeds within 5sigma error ellipse
0089   float sigmaError = 5;
0090 
0091   // derived values, set on Seedfinder construction
0092   float highland = 0;
0093   float maxScatteringAngle2 = 0;
0094   float pTPerHelixRadius = 0;
0095   float minHelixDiameter2 = 0;
0096   float minHelixRadius = 0;
0097   float pT2perRadius = 0;
0098 
0099   // Multiplicator for the number of phi-bins. The minimum number of phi-bins
0100   // depends on min_pt, magnetic field: 2*M_PI/(minPT particle
0101   // phi-deflection). phiBinDeflectionCoverage is a multiplier for this
0102   // number. If numPhiNeighbors (in the configuration of the BinFinders) is
0103   // configured to return 1 neighbor on either side of the current phi-bin
0104   // (and you want to cover the full phi-range of minPT), leave this at 1.
0105   int phiBinDeflectionCoverage = 1;
0106 
0107   std::array<unsigned int, 2> neighbor_scope{1, 1};
0108 
0109   TRACCC_HOST_DEVICE
0110   size_t get_num_rbins() const {
0111     return static_cast<size_t>(rMax + vector::norm(beamPos));
0112   }
0113 
0114   TRACCC_HOST_DEVICE
0115   unsigned int get_max_neighbor_bins() const {
0116     unsigned int t = neighbor_scope[0] + neighbor_scope[1] + 1;
0117     return t * t;
0118   }
0119 
0120   // Configure unset parameters
0121   TRACCC_HOST_DEVICE
0122   void setup() {
0123     highland = 13.6f * traccc::unit<float>::MeV * std::sqrt(radLengthPerSeed) *
0124                (1.f + 0.038f * std::log(radLengthPerSeed));
0125 
0126     float maxScatteringAngle = highland / minPt;
0127     maxScatteringAngle2 = maxScatteringAngle * maxScatteringAngle;
0128 
0129     pTPerHelixRadius = bFieldInZ;
0130     minHelixDiameter2 = std::pow(minPt * 2.f / pTPerHelixRadius, 2.f);
0131     minHelixRadius = std::sqrt(minHelixDiameter2) / 2.f;
0132 
0133     // @TODO: This is definitely a bug because highland / pTPerHelixRadius
0134     // is in length unit
0135     pT2perRadius = std::pow(highland / pTPerHelixRadius, 2.f);
0136   }
0137 };
0138 
0139 // spacepoint grid configuration
0140 struct spacepoint_grid_config {
0141   spacepoint_grid_config() = delete;
0142   spacepoint_grid_config(const seedfinder_config& finder_config)
0143       : bFieldInZ(finder_config.bFieldInZ),
0144         minPt(finder_config.minPt),
0145         rMax(finder_config.rMax),
0146         zMax(finder_config.zMax),
0147         zMin(finder_config.zMin),
0148         deltaRMax(finder_config.deltaRMax),
0149         cotThetaMax(finder_config.cotThetaMax),
0150         impactMax(finder_config.impactMax),
0151         phiMin(finder_config.phiMin),
0152         phiMax(finder_config.phiMax),
0153         phiBinDeflectionCoverage(finder_config.phiBinDeflectionCoverage) {}
0154 
0155   // magnetic field in kTesla
0156   float bFieldInZ;
0157   // minimum pT to be found by seedfinder in MeV
0158   float minPt;
0159   // maximum extension of sensitive detector layer relevant for seeding as
0160   // distance from x=y=0 (i.e. in r) in mm
0161   float rMax;
0162   // maximum extension of sensitive detector layer relevant for seeding in
0163   // positive direction in z in mm
0164   float zMax;
0165   // maximum extension of sensitive detector layer relevant for seeding in
0166   // negative direction in z in mm
0167   float zMin;
0168   // maximum distance in r from middle space point to bottom or top spacepoint
0169   // in mm
0170   float deltaRMax;
0171   // maximum forward direction expressed as cot(theta)
0172   float cotThetaMax;
0173   // impact parameter in mm
0174   float impactMax;
0175   // minimum phi value for phiAxis construction
0176   float phiMin = static_cast<float>(-M_PI);
0177   // maximum phi value for phiAxis construction
0178   float phiMax = static_cast<float>(M_PI);
0179   // Multiplicator for the number of phi-bins. The minimum number of phi-bins
0180   // depends on min_pt, magnetic field: 2*M_PI/(minPT particle
0181   // phi-deflection). phiBinDeflectionCoverage is a multiplier for this
0182   // number. If numPhiNeighbors (in the configuration of the BinFinders) is
0183   // configured to return 1 neighbor on either side of the current phi-bin
0184   // (and you want to cover the full phi-range of minPT), leave this at 1.
0185   int phiBinDeflectionCoverage = 1;
0186 };
0187 
0188 struct seedfilter_config {
0189   // the allowed delta between two inverted seed radii for them to be
0190   // considered compatible.
0191   float deltaInvHelixDiameter = 0.00003f / unit<float>::mm;
0192   // the impact parameters (d0) is multiplied by this factor and subtracted
0193   // from weight
0194   float impactWeightFactor = 1.f;
0195   // seed weight increased by this value if a compatible seed has been found.
0196   float compatSeedWeight = 200.f;
0197   // minimum distance between compatible seeds to be considered for weight
0198   // boost
0199   float deltaRMin = 5.f * unit<float>::mm;
0200   // how often do you want to increase the weight of a seed for finding a
0201   // compatible seed?
0202   size_t compatSeedLimit = 2;
0203 
0204   // seed weight increase
0205   float good_spB_min_radius = 150.f * unit<float>::mm;
0206   float good_spB_weight_increase = 400.f;
0207   float good_spT_max_radius = 150.f * unit<float>::mm;
0208   float good_spT_weight_increase = 200.f;
0209 
0210   // bottom sp cut
0211   float good_spB_min_weight = 380.f;
0212 
0213   // seed cut
0214   float seed_min_weight = 200.f;
0215   float spB_min_radius = 43.f * unit<float>::mm;
0216 };
0217 
0218 }  // namespace traccc