Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 07:47:54

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 "ActsPlugins/Mille/ActsToMille.hpp"
0012 
0013 #include <memory>
0014 
0015 #include "Mille/MilleFactory.h"
0016 
0017 using namespace ActsPlugins::ActsToMille;
0018 
0019 BOOST_AUTO_TEST_SUITE(ActsMilleBasicCallTests)
0020 
0021 BOOST_AUTO_TEST_CASE(OpenMilleRecord) {
0022   const std::string fname = "MyMilleRecord.root";
0023   std::unique_ptr<Mille::MilleRecord> theRecord =
0024       Mille::spawnMilleRecord(fname);
0025   BOOST_CHECK_NE(theRecord.get(), nullptr);
0026   // for now, will write one entry of dummy information.
0027   ActsAlignment::detail::TrackAlignmentState dummyState;
0028   dumpToMille(dummyState, theRecord.get());
0029   theRecord->writeRecord();
0030   theRecord->flushOutputFile();
0031   theRecord.reset(nullptr);
0032 
0033   // read back in
0034   auto theReader = Mille::spawnMilleReader(fname);
0035   BOOST_CHECK(theReader->open(fname));
0036   BOOST_CHECK_NE(theReader.get(), nullptr);
0037   Mille::MilleBuffer buffer;
0038   buffer.resize(100, true);
0039   const auto& [nRead, stat] = theReader->readToBuffer(buffer);
0040   BOOST_CHECK_EQUAL(stat,
0041                     4);  // status 4 = successful read with float derivatives
0042   BOOST_CHECK_EQUAL(
0043       nRead, 5);  // 5 entries: header + 1 measurement + 1 error + 2 derivatives
0044   const auto& [nReadSecondCall, statSecondCall] =
0045       theReader->readToBuffer(buffer);
0046   BOOST_CHECK_EQUAL(statSecondCall,
0047                     0);  // status 0 = end of file (should only have one record)
0048   BOOST_CHECK_EQUAL(nReadSecondCall, 0);  // expect 0 entries read at EOF
0049 }
0050 
0051 BOOST_AUTO_TEST_SUITE_END()