Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:42

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 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 https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Utilities/Logger.hpp"
0012 #include "ActsExamples/EventData/Index.hpp"
0013 #include "ActsExamples/EventData/SimParticle.hpp"
0014 #include "ActsExamples/Framework/DataHandle.hpp"
0015 #include "ActsExamples/Framework/IAlgorithm.hpp"
0016 #include "ActsExamples/Framework/ProcessCode.hpp"
0017 
0018 #include <limits>
0019 #include <string>
0020 
0021 namespace ActsExamples {
0022 struct AlgorithmContext;
0023 
0024 /// Select particles by applying some selection cuts.
0025 class ParticleSelector final : public IAlgorithm {
0026  public:
0027   struct Config {
0028     /// The input particles collection.
0029     std::string inputParticles;
0030     /// (Optionally) The input particle measurements map. Only required for
0031     /// measurement-based cuts.
0032     std::string inputParticleMeasurementsMap;
0033     /// The output particles collection.
0034     std::string outputParticles;
0035 
0036     // Minimum/maximum distance from the origin in the transverse plane.
0037     double rhoMin = 0;
0038     double rhoMax = std::numeric_limits<double>::infinity();
0039     // Minimum/maximum absolute distance from the origin along z.
0040     double absZMin = 0;
0041     double absZMax = std::numeric_limits<double>::infinity();
0042     // Minimum/maximum particle time.
0043     double timeMin = -std::numeric_limits<double>::infinity();
0044     double timeMax = std::numeric_limits<double>::infinity();
0045     // Direction cuts.
0046     double phiMin = -std::numeric_limits<double>::infinity();
0047     double phiMax = std::numeric_limits<double>::infinity();
0048     double etaMin = -std::numeric_limits<double>::infinity();
0049     double etaMax = std::numeric_limits<double>::infinity();
0050     double absEtaMin = 0;
0051     double absEtaMax = std::numeric_limits<double>::infinity();
0052     // Momentum cuts.
0053     double ptMin = 0;
0054     double ptMax = std::numeric_limits<double>::infinity();
0055     // Rest mass cuts
0056     double mMin = 0;
0057     double mMax = std::numeric_limits<double>::infinity();
0058     // Hit count cuts
0059     std::size_t hitsMin = 0;
0060     std::size_t hitsMax = std::numeric_limits<std::size_t>::max();
0061     // Measurement number cuts
0062     std::size_t measurementsMin = 0;
0063     std::size_t measurementsMax = std::numeric_limits<std::size_t>::max();
0064     /// Remove charged particles.
0065     bool removeCharged = false;
0066     /// Remove neutral particles.
0067     bool removeNeutral = false;
0068     /// Remove secondaries.
0069     bool removeSecondaries = false;
0070     /// Exclude particles depending on absolute pdg value
0071     std::vector<int> excludeAbsPdgs;
0072 
0073     /// Min primary vertex ID cut
0074     std::uint64_t minPrimaryVertexId = 0;
0075     /// Max primary vertex ID cut
0076     std::uint64_t maxPrimaryVertexId =
0077         std::numeric_limits<std::uint64_t>::max();
0078   };
0079 
0080   ParticleSelector(const Config& config, Acts::Logging::Level level);
0081 
0082   ProcessCode execute(const AlgorithmContext& ctx) const final;
0083 
0084   /// Get readonly access to the config parameters
0085   const Config& config() const { return m_cfg; }
0086 
0087  private:
0088   Config m_cfg;
0089 
0090   ReadDataHandle<SimParticleContainer> m_inputParticles{this, "InputParticles"};
0091   ReadDataHandle<InverseMultimap<SimBarcode>> m_inputParticleMeasurementsMap{
0092       this, "InputParticleMeasurementsMap"};
0093 
0094   WriteDataHandle<SimParticleContainer> m_outputParticles{this,
0095                                                           "OutputParticles"};
0096 };
0097 
0098 }  // namespace ActsExamples