Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 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 <boost/test/data/test_case.hpp>
0012 
0013 #include "Acts/Definitions/PdgParticle.hpp"
0014 #include "Acts/Definitions/Units.hpp"
0015 #include "Acts/Material/MaterialSlab.hpp"
0016 #include "Acts/Tests/CommonHelpers/PredefinedMaterials.hpp"
0017 #include "ActsFatras/EventData/Particle.hpp"
0018 
0019 #include <cstdint>
0020 
0021 namespace Dataset {
0022 
0023 namespace data = boost::unit_test::data;
0024 using namespace Acts::UnitLiterals;
0025 
0026 // particle identity
0027 const auto particlePdg = data::make(std::vector<Acts::PdgParticle>{
0028     Acts::PdgParticle::eElectron,
0029     Acts::PdgParticle::ePositron,
0030     Acts::PdgParticle::eMuon,
0031     Acts::PdgParticle::eAntiMuon,
0032 });
0033 
0034 // kinematic particle parameters
0035 const auto momentumPhi = data::xrange(0_degree, 360_degree, 60_degree);
0036 const auto momentumLambda = data::xrange(-45_degree, 45_degree, 15_degree);
0037 const auto momentumAbs = data::xrange(500_MeV, 10_GeV, 500_MeV);
0038 
0039 // seeds for the random number generator
0040 const auto rngSeed =
0041     data::xrange<uint32_t>((data::begin = 2u, data::step = 3u));
0042 
0043 // combined parameter set
0044 const auto parameters =
0045     particlePdg * momentumPhi * momentumLambda * momentumAbs ^ rngSeed;
0046 
0047 const auto parametersPhotonConversion = momentumPhi * momentumLambda ^ rngSeed;
0048 
0049 // utility function to build a particle from the dataset parameters
0050 inline ActsFatras::Particle makeParticle(Acts::PdgParticle pdg, double phi,
0051                                          double lambda, double p) {
0052   const auto id = ActsFatras::Barcode().setVertexPrimary(1).setParticle(1);
0053   return ActsFatras::Particle(id, pdg)
0054       .setPosition4(0, 0, 0, 0)
0055       .setDirection(std::cos(lambda) * std::cos(phi),
0056                     std::cos(lambda) * std::sin(phi), std::sin(lambda))
0057       .setAbsoluteMomentum(p);
0058 }
0059 
0060 }  // namespace Dataset