Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SeedFinderConfig.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SeedFinderConfig.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2018-2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
15 
16 #include <memory>
17 
18 namespace Acts {
19 
20 // forward declaration to avoid cyclic dependence
21 template <typename T>
22 class SeedFilter;
23 
24 template <typename SpacePoint>
26  std::shared_ptr<Acts::SeedFilter<SpacePoint>> seedFilter;
27 
28  // Seed Cuts
29  // lower cutoff for seeds
31  // cot of maximum theta angle
32  // equivalent to 3 eta (pseudorapidity)
33  float cotThetaMax = 10.01788;
34  // minimum distance in r between two measurements within one seed
36  // maximum distance in r between two measurements within one seed
38  // minimum distance in r between middle and top SP
39  float deltaRMinTopSP = std::numeric_limits<float>::quiet_NaN();
40  // maximum distance in r between middle and top SP
41  float deltaRMaxTopSP = std::numeric_limits<float>::quiet_NaN();
42  // minimum distance in r between middle and bottom SP
43  float deltaRMinBottomSP = std::numeric_limits<float>::quiet_NaN();
44  // maximum distance in r between middle and bottom SP
45  float deltaRMaxBottomSP = std::numeric_limits<float>::quiet_NaN();
46  // radial bin size for filling space point grid
48 
49  // radial range for middle SP
50  // variable range based on SP radius
54  // range defined in vector for each z region
55  std::vector<std::vector<float>> rRangeMiddleSP;
56  // range defined by rMinMiddle and rMaxMiddle
59 
60  // z of last layers to avoid iterations
61  std::pair<float, float> zOutermostLayers{-2700 * Acts::UnitConstants::mm,
63 
64  // cut to the maximum value of delta z between SPs
65  float deltaZMax =
66  std::numeric_limits<float>::infinity() * Acts::UnitConstants::mm;
67 
68  // enable cut on the compatibility between interaction point and SPs
69  bool interactionPointCut = false;
70 
71  // non equidistant binning in z
72  std::vector<float> zBinEdges;
73 
74  // seed confirmation
75  bool seedConfirmation = false;
76  // parameters for central seed confirmation
78  // parameters for forward seed confirmation
80 
81  // FIXME: this is not used yet
82  // float upperPtResolutionPerSeed = 20* Acts::GeV;
83 
84  // the delta for inverse helix radius up to which compared seeds
85  // are considered to have a compatible radius. delta of inverse radius
86  // leads to this value being the cutoff. unit is 1/mm. default value
87  // of 0.00003 leads to all helices with radius>33m to be considered compatible
88 
89  // impact parameter
91 
92  // how many sigmas of scattering angle should be considered?
93  float sigmaScattering = 5;
94  // Upper pt limit for scattering calculation
96 
97  // for how many seeds can one SpacePoint be the middle SpacePoint?
98  unsigned int maxSeedsPerSpM = 5;
99 
100  // tolerance parameter used to check the compatibility of SPs coordinates in
101  // xyz
103 
104  // Parameter which can loosen the tolerance of the track seed to form to a
105  // helix, useful for (e.g.) misaligned seeding
106  float helixCut = 1.;
107 
108  // Geometry Settings
109  // Detector ROI
110  // limiting location of collision region in z
113  float phiMin = -M_PI;
114  float phiMax = M_PI;
115  // limiting location of measurements
116  float zMin = -2800 * Acts::UnitConstants::mm;
119  // WARNING: if rMin is smaller than impactMax, the bin size will be 2*pi,
120  // which will make seeding very slow!
122 
123  // Order of z bins to loop over when searching for SPs
124  std::vector<size_t> zBinsCustomLooping = {};
125  // Number of Z bins to skip the search for middle SPs
126  std::size_t skipZMiddleBinSearch = 0;
127 
128  // average radiation lengths of material on the length of a seed. used for
129  // scattering.
130  // default is 5%
131  // TODO: necessary to make amount of material dependent on detector region?
132  float radLengthPerSeed = 0.05;
133  // alignment uncertainties, used for uncertainties in the
134  // non-measurement-plane of the modules
135  // which otherwise would be 0
136  // will be added to spacepoint measurement uncertainties (and therefore also
137  // multiplied by sigmaError)
138  // FIXME: call align1 and align2
141  // used for measurement (+alignment) uncertainties.
142  // find seeds within 5sigma error ellipse
143  float sigmaError = 5;
144 
145  // derived values, set on SeedFinder construction
146  float highland = 0;
148 
149  // only for Cuda plugin
150  int maxBlockSize = 1024;
151  int nTrplPerSpBLimit = 100;
153 
154  // sPHENIX quantities for alignment bypassing cuts
155  float helixcut = 1.;
156 
157  // Delegates for accessors to detailed information on double measurement that
158  // produced the space point.
159  // This is mainly referring to space points produced when combining
160  // measurement from strips on back-to-back modules.
161  // Enables setting of the following delegates.
163  // Returns half of the length of the top strip.
165  // Returns half of the length of the bottom strip.
167  // Returns direction of the top strip.
169  // Returns direction of the bottom strip.
171  // Returns distance between the centers of the two strips.
173  // Returns position of the center of the top strip.
175 
176  bool isInInternalUnits = false;
177 
179  if (isInInternalUnits) {
180  throw std::runtime_error(
181  "Repeated conversion to internal units for SeedFinderConfig");
182  }
183  // Make sure the shared ptr to the seed filter is not a nullptr
184  // And make sure the seed filter config is in internal units as well
185  if (not seedFilter) {
186  throw std::runtime_error(
187  "Invalid values for the seed filter inside the seed filter config: "
188  "nullptr");
189  }
190  if (not seedFilter->getSeedFilterConfig().isInInternalUnits) {
191  throw std::runtime_error(
192  "The internal Seed Filter configuration, contained in the seed "
193  "finder config, is not in internal units.");
194  }
195 
196  using namespace Acts::UnitLiterals;
197  SeedFinderConfig config = *this;
198  config.isInInternalUnits = true;
199  config.minPt /= 1_MeV;
200  config.deltaRMin /= 1_mm;
201  config.deltaRMax /= 1_mm;
202  config.binSizeR /= 1_mm;
203  config.deltaRMinTopSP /= 1_mm;
204  config.deltaRMaxTopSP /= 1_mm;
205  config.deltaRMinBottomSP /= 1_mm;
206  config.deltaRMaxBottomSP /= 1_mm;
207  config.deltaRMiddleMinSPRange /= 1_mm;
208  config.deltaRMiddleMaxSPRange /= 1_mm;
209  config.impactMax /= 1_mm;
210  config.maxPtScattering /= 1_MeV; // correct?
211  config.collisionRegionMin /= 1_mm;
212  config.collisionRegionMax /= 1_mm;
213  config.zMin /= 1_mm;
214  config.zMax /= 1_mm;
215  config.rMax /= 1_mm;
216  config.rMin /= 1_mm;
217  config.deltaZMax /= 1_mm;
218 
219  config.zAlign /= 1_mm;
220  config.rAlign /= 1_mm;
221 
222  config.toleranceParam /= 1_mm;
223 
224  return config;
225  }
227  SeedFinderConfig config = *this;
228  // calculation of scattering using the highland formula
229  // convert pT to p once theta angle is known
230  config.highland = 13.6 * std::sqrt(radLengthPerSeed) *
231  (1 + 0.038 * std::log(radLengthPerSeed));
232  const float maxScatteringAngle = config.highland / minPt;
233  config.maxScatteringAngle2 = maxScatteringAngle * maxScatteringAngle;
234  return config;
235  }
236 };
237 
239  // location of beam in x,y plane.
240  // used as offset for Space Points
243  // field induction
244  float bFieldInZ = 2.08 * Acts::UnitConstants::T;
245 
246  // derived quantities
247  float pTPerHelixRadius = std::numeric_limits<float>::quiet_NaN();
248  float minHelixDiameter2 = std::numeric_limits<float>::quiet_NaN();
249  float pT2perRadius = std::numeric_limits<float>::quiet_NaN();
250  float sigmapT2perRadius = std::numeric_limits<float>::quiet_NaN();
251  float multipleScattering2 = std::numeric_limits<float>::quiet_NaN();
252 
253  bool isInInternalUnits = false;
254 
256  if (isInInternalUnits) {
257  throw std::runtime_error(
258  "Repeated conversion to internal units for SeedFinderOptions");
259  }
260  using namespace Acts::UnitLiterals;
261  SeedFinderOptions options = *this;
262  options.isInInternalUnits = true;
263  options.beamPos[0] /= 1_mm;
264  options.beamPos[1] /= 1_mm;
265 
266  options.bFieldInZ /= 1000. * 1_T;
267  return options;
268  }
269 
270  template <typename Config>
272  using namespace Acts::UnitLiterals;
273 
274  if (!isInInternalUnits) {
275  throw std::runtime_error(
276  "Derived quantities in SeedFinderOptions can only be calculated from "
277  "Acts internal units");
278  }
279  SeedFinderOptions options = *this;
280  // helix radius in homogeneous magnetic field. Units are Kilotesla, MeV and
281  // millimeter
282  // TODO: change using ACTS units
283  options.pTPerHelixRadius = 1_T * 1e6 * options.bFieldInZ;
284  options.minHelixDiameter2 =
285  std::pow(config.minPt * 2 / options.pTPerHelixRadius, 2);
286  options.pT2perRadius =
287  std::pow(config.highland / options.pTPerHelixRadius, 2);
288  options.sigmapT2perRadius =
289  options.pT2perRadius * std::pow(2 * config.sigmaScattering, 2);
290  options.multipleScattering2 =
291  config.maxScatteringAngle2 * std::pow(config.sigmaScattering, 2);
292  return options;
293  }
294 };
295 
296 } // namespace Acts