Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:05

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 #include <boost/test/unit_test.hpp>
0010 
0011 #include "ActsFatras/EventData/Barcode.hpp"
0012 
0013 using ActsFatras::Barcode;
0014 
0015 BOOST_AUTO_TEST_SUITE(FatrasBarcode)
0016 
0017 BOOST_AUTO_TEST_CASE(MakeDescendant) {
0018   // initial barcode with primary particle
0019   auto p3 = Barcode().setVertexPrimary(1).setVertexSecondary(2).setParticle(3);
0020   BOOST_CHECK_EQUAL(p3.vertexPrimary(), 1u);
0021   BOOST_CHECK_EQUAL(p3.vertexSecondary(), 2u);
0022   BOOST_CHECK_EQUAL(p3.particle(), 3u);
0023   BOOST_CHECK_EQUAL(p3.generation(), 0u);
0024   BOOST_CHECK_EQUAL(p3.subParticle(), 0u);
0025 
0026   // generate two first-generation descendants
0027   auto p30 = p3.makeDescendant(0);
0028   auto p31 = p3.makeDescendant(1);
0029   BOOST_CHECK_EQUAL(p30.vertexPrimary(), 1u);
0030   BOOST_CHECK_EQUAL(p30.vertexSecondary(), 2u);
0031   BOOST_CHECK_EQUAL(p30.particle(), 3u);
0032   BOOST_CHECK_EQUAL(p30.generation(), 1u);
0033   BOOST_CHECK_EQUAL(p30.subParticle(), 0u);
0034   BOOST_CHECK_EQUAL(p31.vertexPrimary(), 1u);
0035   BOOST_CHECK_EQUAL(p31.vertexSecondary(), 2u);
0036   BOOST_CHECK_EQUAL(p31.particle(), 3u);
0037   BOOST_CHECK_EQUAL(p31.generation(), 1u);
0038   BOOST_CHECK_EQUAL(p31.subParticle(), 1u);
0039 
0040   // generate two (overlapping) second-generation descendants.
0041   auto p300 = p30.makeDescendant(0);
0042   auto p310 = p31.makeDescendant(0);
0043   BOOST_CHECK_EQUAL(p300.vertexPrimary(), 1u);
0044   BOOST_CHECK_EQUAL(p300.vertexSecondary(), 2u);
0045   BOOST_CHECK_EQUAL(p300.particle(), 3u);
0046   BOOST_CHECK_EQUAL(p300.generation(), 2u);
0047   BOOST_CHECK_EQUAL(p300.subParticle(), 0u);
0048   BOOST_CHECK_EQUAL(p310.vertexPrimary(), 1u);
0049   BOOST_CHECK_EQUAL(p310.vertexSecondary(), 2u);
0050   BOOST_CHECK_EQUAL(p310.particle(), 3u);
0051   BOOST_CHECK_EQUAL(p310.generation(), 2u);
0052   BOOST_CHECK_EQUAL(p310.subParticle(), 0u);
0053 }
0054 
0055 BOOST_AUTO_TEST_SUITE_END()