Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DigitizationAlgorithm.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DigitizationAlgorithm.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2021 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 
32 
33 #include <cstddef>
34 #include <memory>
35 #include <string>
36 #include <tuple>
37 #include <utility>
38 #include <variant>
39 #include <vector>
40 
41 namespace ActsFatras {
42 class Barcode;
43 } // namespace ActsFatras
44 
45 namespace Acts {
46 class Surface;
47 class TrackingGeometry;
48 } // namespace Acts
49 
50 namespace ActsExamples {
51 struct AlgorithmContext;
52 
54 class DigitizationAlgorithm final : public IAlgorithm {
55  public:
61 
66  ProcessCode execute(const AlgorithmContext& ctx) const override;
67 
69  const DigitizationConfig& config() const { return m_cfg; }
70 
71  private:
81  std::vector<ActsFatras::Channelizer::ChannelSegment> channelizing(
82  const GeometricConfig& geoCfg, const SimHit& hit,
84  RandomEngine& rng) const;
85 
95  const GeometricConfig& geoCfg,
96  const std::vector<ActsFatras::Channelizer::ChannelSegment>& channels,
97  RandomEngine& rng) const;
98 
101  template <size_t kSmearDIM>
105  };
106 
107  // Support max 4 digitization dimensions - either digital or smeared
108  using Digitizer = std::variant<CombinedDigitizer<0>, CombinedDigitizer<1>,
111 
120 
122  "SimHitContainer"};
123 
125  this, "SourceLinks"};
127  this, "Measurements"};
130  m_measurementParticlesMapWriteHandle{this, "MeasurementParticlesMap"};
132  this, "MeasurementSimHitsMap"};
133 
141  template <size_t kSmearDIM>
144  // Copy the geometric configuration
145  impl.geometric = cfg.geometricDigiConfig;
146  // Prepare the smearing configuration
147  for (int i = 0; i < static_cast<int>(kSmearDIM); ++i) {
148  impl.smearing.indices[i] = cfg.smearingDigiConfig.at(i).index;
149  impl.smearing.smearFunctions[i] =
150  cfg.smearingDigiConfig.at(i).smearFunction;
151  }
152  return impl;
153  }
154 };
155 
156 } // namespace ActsExamples