Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:09:44

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2020-2021 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 #include "ActsExamples/Digitization/DigitizationConfig.hpp"
0010 
0011 #include "Acts/Definitions/TrackParametrization.hpp"
0012 #include "Acts/Geometry/GeometryIdentifier.hpp"
0013 #include "ActsExamples/Digitization/SmearingConfig.hpp"
0014 
0015 namespace {
0016 
0017 enum SmearingTypes : int {
0018   eGauss = 0,
0019   eGaussTruncated = 1,
0020   eGaussClipped = 2,
0021   eUniform = 3,
0022   eDigital = 4,
0023 };
0024 
0025 }  // namespace
0026 
0027 ActsExamples::DigitizationConfig::DigitizationConfig(
0028     bool merge, double sigma, bool commonCorner,
0029     Acts::GeometryHierarchyMap<DigiComponentsConfig>&& digiCfgs)
0030     : doMerge(merge), mergeNsigma(sigma), mergeCommonCorner(commonCorner) {
0031   digitizationConfigs = std::move(digiCfgs);
0032 }
0033 
0034 ActsExamples::DigitizationConfig::DigitizationConfig(
0035     Acts::GeometryHierarchyMap<DigiComponentsConfig>&& digiCfgs)
0036     : doMerge(false), mergeNsigma(1.0), mergeCommonCorner(false) {
0037   digitizationConfigs = std::move(digiCfgs);
0038 }
0039 
0040 std::vector<
0041     std::pair<Acts::GeometryIdentifier, std::vector<Acts::BoundIndices>>>
0042 ActsExamples::DigitizationConfig::getBoundIndices() const {
0043   std::vector<
0044       std::pair<Acts::GeometryIdentifier, std::vector<Acts::BoundIndices>>>
0045       bIndexInput;
0046 
0047   for (std::size_t ibi = 0; ibi < digitizationConfigs.size(); ++ibi) {
0048     Acts::GeometryIdentifier geoID = digitizationConfigs.idAt(ibi);
0049     const auto dCfg = digitizationConfigs.valueAt(ibi);
0050     std::vector<Acts::BoundIndices> boundIndices;
0051     boundIndices.insert(boundIndices.end(),
0052                         dCfg.geometricDigiConfig.indices.begin(),
0053                         dCfg.geometricDigiConfig.indices.end());
0054     // we assume nobody will add multiple smearers to a single bound index
0055     for (const auto& c : dCfg.smearingDigiConfig) {
0056       boundIndices.push_back(c.index);
0057     }
0058     bIndexInput.push_back({geoID, boundIndices});
0059   }
0060   return bIndexInput;
0061 }