Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:11:27

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2023 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 #pragma once
0010 
0011 #include "Acts/Seeding/IExperimentCuts.hpp"
0012 
0013 #include <algorithm>
0014 
0015 namespace Acts {
0016 template <typename SpacePoint>
0017 class ATLASCuts : public IExperimentCuts<SpacePoint> {
0018  public:
0019   /// Returns seed weight bonus/malus depending on detector considerations.
0020   /// @param bottom bottom space point of the current seed
0021   /// @param middle middle space point of the current seed
0022   /// @param top top space point of the current seed
0023   /// @return seed weight to be added to the seed's weight
0024   float seedWeight(const InternalSpacePoint<SpacePoint>& bottom,
0025                    const InternalSpacePoint<SpacePoint>& middle,
0026                    const InternalSpacePoint<SpacePoint>& top) const override;
0027   /// @param weight the current seed weight
0028   /// @param bottom bottom space point of the current seed
0029   /// @param middle middle space point of the current seed
0030   /// @param top top space point of the current seed
0031   /// @return true if the seed should be kept, false if the seed should be
0032   /// discarded
0033   bool singleSeedCut(
0034       float weight, const InternalSpacePoint<SpacePoint>& bottom,
0035       const InternalSpacePoint<SpacePoint>& /*middle*/,
0036       const InternalSpacePoint<SpacePoint>& /*top*/) const override;
0037 
0038   /// @param seedCandidates contains collection of seed candidates created for one middle
0039   /// space point in a std::tuple format
0040   /// @return vector of seeds that pass the cut
0041   std::vector<typename CandidatesForMiddleSp<
0042       const InternalSpacePoint<SpacePoint>>::value_type>
0043   cutPerMiddleSP(std::vector<typename CandidatesForMiddleSp<
0044                      const InternalSpacePoint<SpacePoint>>::value_type>
0045                      seedCandidates) const override;
0046 };
0047 
0048 template <typename SpacePoint>
0049 float ATLASCuts<SpacePoint>::seedWeight(
0050     const InternalSpacePoint<SpacePoint>& bottom,
0051     const InternalSpacePoint<SpacePoint>& /*middle*/,
0052     const InternalSpacePoint<SpacePoint>& top) const {
0053   float weight = 0;
0054   if (bottom.radius() > 150) {
0055     weight = 400;
0056   }
0057   if (top.radius() < 150) {
0058     weight = 200;
0059   }
0060   return weight;
0061 }
0062 
0063 template <typename SpacePoint>
0064 bool ATLASCuts<SpacePoint>::singleSeedCut(
0065     float weight, const InternalSpacePoint<SpacePoint>& b,
0066     const InternalSpacePoint<SpacePoint>& /*m*/,
0067     const InternalSpacePoint<SpacePoint>& /*t*/) const {
0068   return !(b.radius() > 150. && weight < 380.);
0069 }
0070 
0071 template <typename SpacePoint>
0072 std::vector<typename CandidatesForMiddleSp<
0073     const InternalSpacePoint<SpacePoint>>::value_type>
0074 ATLASCuts<SpacePoint>::cutPerMiddleSP(
0075     std::vector<typename CandidatesForMiddleSp<
0076         const InternalSpacePoint<SpacePoint>>::value_type>
0077         seedCandidates) const {
0078   std::vector<typename CandidatesForMiddleSp<
0079       const InternalSpacePoint<SpacePoint>>::value_type>
0080       newSeedsVector;
0081   if (seedCandidates.size() <= 1) {
0082     return seedCandidates;
0083   }
0084 
0085   newSeedsVector.push_back(std::move(seedCandidates[0]));
0086   std::size_t itLength = std::min(seedCandidates.size(), std::size_t(5));
0087   // don't cut first element
0088   for (std::size_t i(1); i < itLength; i++) {
0089     float weight = seedCandidates[i].weight;
0090     const auto& bottom = seedCandidates[i].bottom;
0091     if (weight > 200. || bottom->radius() > 43.) {
0092       newSeedsVector.push_back(std::move(seedCandidates[i]));
0093     }
0094   }
0095   return newSeedsVector;
0096 }
0097 }  // namespace Acts