Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2019-2020 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/Geometry/GeometryIdentifier.hpp"
0012 #include "Acts/Utilities/Logger.hpp"
0013 #include "ActsExamples/EventData/Index.hpp"
0014 #include "ActsExamples/EventData/Measurement.hpp"
0015 #include "ActsExamples/EventData/SimParticle.hpp"
0016 #include "ActsExamples/Framework/DataHandle.hpp"
0017 #include "ActsExamples/Framework/IAlgorithm.hpp"
0018 #include "ActsExamples/Framework/ProcessCode.hpp"
0019 
0020 #include <limits>
0021 #include <string>
0022 
0023 namespace ActsExamples {
0024 struct AlgorithmContext;
0025 
0026 /// Select particles by applying some selection cuts.
0027 class ParticleSelector final : public IAlgorithm {
0028  public:
0029   struct Config {
0030     /// The input particles collection.
0031     std::string inputParticles;
0032     /// Input measurement particles map (Optional)
0033     std::string inputMeasurementParticlesMap;
0034     /// The output particles collection.
0035     std::string outputParticles;
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     /// Measurement number cuts
0059     std::size_t measurementsMin = 0;
0060     std::size_t measurementsMax = std::numeric_limits<std::size_t>::max();
0061     /// Remove charged particles.
0062     bool removeCharged = false;
0063     /// Remove neutral particles.
0064     bool removeNeutral = false;
0065 
0066     /// Remove secondaries.
0067     bool removeSecondaries = false;
0068   };
0069 
0070   ParticleSelector(const Config& config, Acts::Logging::Level level);
0071 
0072   ProcessCode execute(const AlgorithmContext& ctx) const final;
0073 
0074   /// Get readonly access to the config parameters
0075   const Config& config() const { return m_cfg; }
0076 
0077  private:
0078   Config m_cfg;
0079 
0080   ReadDataHandle<SimParticleContainer> m_inputParticles{this, "InputParticles"};
0081   ReadDataHandle<IndexMultimap<ActsFatras::Barcode>> m_inputMap{
0082       this, "InputMeasurementParticlesMap"};
0083 
0084   WriteDataHandle<SimParticleContainer> m_outputParticles{this,
0085                                                           "OutputParticles"};
0086 };
0087 
0088 }  // namespace ActsExamples