Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SeedingOrthogonalAlgorithm.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SeedingOrthogonalAlgorithm.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2022 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 
10 
14 
15 #include <cmath>
16 #include <functional>
17 #include <ostream>
18 #include <stdexcept>
19 #include <type_traits>
20 #include <utility>
21 
22 namespace ActsExamples {
23 struct AlgorithmContext;
24 } // namespace ActsExamples
25 
29  : ActsExamples::IAlgorithm("SeedingAlgorithm", lvl), m_cfg(std::move(cfg)) {
36 
37  printOptions();
38  printConfig<SimSpacePoint>();
39 
40  if (m_cfg.inputSpacePoints.empty()) {
41  throw std::invalid_argument("Missing space point input collections");
42  }
43 
44  for (const auto &spName : m_cfg.inputSpacePoints) {
45  if (spName.empty()) {
46  throw std::invalid_argument("Invalid space point input collection");
47  }
48 
49  auto &handle = m_inputSpacePoints.emplace_back(
51  this,
52  "InputSpacePoints#" + std::to_string(m_inputSpacePoints.size())));
53  handle->initialize(spName);
54  }
55 
56  if (m_cfg.outputSeeds.empty()) {
57  throw std::invalid_argument("Missing seeds output collection");
58  }
59 
61 
64  throw std::invalid_argument("Inconsistent config maxSeedsPerSpM");
65  }
66 
67  // construct seed filter
69  std::make_unique<Acts::SeedFilter<SimSpacePoint>>(
71 
73 }
74 
76  const AlgorithmContext &ctx) const {
77  std::vector<const SimSpacePoint *> spacePoints;
78 
79  for (const auto &isp : m_inputSpacePoints) {
80  for (const auto &spacePoint : (*isp)(ctx)) {
81  spacePoints.push_back(&spacePoint);
82  }
83  }
84 
85  Acts::SeedFinderOrthogonal<SimSpacePoint> finder(m_cfg.seedFinderConfig);
86 
87  std::function<std::pair<Acts::Vector3, Acts::Vector2>(
88  const SimSpacePoint *sp)>
89  create_coordinates = [](const SimSpacePoint *sp) {
90  Acts::Vector3 position(sp->x(), sp->y(), sp->z());
91  Acts::Vector2 variance(sp->varianceR(), sp->varianceZ());
92  return std::make_pair(position, variance);
93  };
94 
95  SimSeedContainer seeds = finder.createSeeds(m_cfg.seedFinderOptions,
96  spacePoints, create_coordinates);
97 
98  ACTS_DEBUG("Created " << seeds.size() << " track seeds from "
99  << spacePoints.size() << " space points");
100 
101  m_outputSeeds(ctx, std::move(seeds));
102 
104 }
105 
107  ACTS_DEBUG("SeedFinderOptions")
108  ACTS_DEBUG("beamPos " << m_cfg.seedFinderOptions.beamPos);
109  // field induction
110  ACTS_DEBUG("bFieldInZ " << m_cfg.seedFinderOptions.bFieldInZ);
111  // derived quantities
112  ACTS_DEBUG("pTPerHelixRadius " << m_cfg.seedFinderOptions.pTPerHelixRadius);
113  ACTS_DEBUG("minHelixDiameter2 " << m_cfg.seedFinderOptions.minHelixDiameter2);
114  ACTS_DEBUG("pT2perRadius " << m_cfg.seedFinderOptions.pT2perRadius);
115  ACTS_DEBUG("sigmapT2perRadius " << m_cfg.seedFinderOptions.sigmapT2perRadius);
116  ACTS_DEBUG("...\n")
117 }
118 
119 template <typename sp>
121  ACTS_DEBUG("SeedFinderOrthogonalConfig")
122  ACTS_DEBUG("minPt " << m_cfg.seedFinderConfig.minPt);
123  ACTS_DEBUG("deltaRMinTopSP " << m_cfg.seedFinderConfig.deltaRMinTopSP);
124  ACTS_DEBUG("deltaRMaxTopSP " << m_cfg.seedFinderConfig.deltaRMaxTopSP);
125  ACTS_DEBUG("deltaRMinBottomSP "
126  << m_cfg.seedFinderConfig.deltaRMinBottomSP);
127  ACTS_DEBUG("deltaRMaxBottomSP "
128  << m_cfg.seedFinderConfig.deltaRMaxBottomSP);
129  ACTS_DEBUG("impactMax " << m_cfg.seedFinderConfig.impactMax);
130  ACTS_DEBUG("maxPtScattering "
131  << m_cfg.seedFinderConfig.maxPtScattering);
132  ACTS_DEBUG("collisionRegionMin "
133  << m_cfg.seedFinderConfig.collisionRegionMin);
134  ACTS_DEBUG("collisionRegionMax "
135  << m_cfg.seedFinderConfig.collisionRegionMax);
136  ACTS_DEBUG("zMin " << m_cfg.seedFinderConfig.zMin);
137  ACTS_DEBUG("zMax " << m_cfg.seedFinderConfig.zMax);
138  ACTS_DEBUG("rMax " << m_cfg.seedFinderConfig.rMax);
139  ACTS_DEBUG("rMin " << m_cfg.seedFinderConfig.rMin);
140  ACTS_DEBUG("highland " << m_cfg.seedFinderConfig.highland);
141  ACTS_DEBUG("maxScatteringAngle2 "
142  << m_cfg.seedFinderConfig.maxScatteringAngle2);
143  ACTS_DEBUG("...\n")
144 }