![]() |
|
|||
File indexing completed on 2025-02-22 10:31:21
0001 //----------------------------------*-C++-*----------------------------------// 0002 // Copyright 2022-2024 UT-Battelle, LLC, and other Celeritas developers. 0003 // See the top-level COPYRIGHT file for details. 0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT) 0005 //---------------------------------------------------------------------------// 0006 //! \file celeritas/ext/RootExporter.hh 0007 //---------------------------------------------------------------------------// 0008 #pragma once 0009 0010 #include "corecel/Config.hh" 0011 0012 #include "corecel/Assert.hh" 0013 0014 #include "RootUniquePtr.hh" 0015 0016 // Forward declare ROOT 0017 class TFile; 0018 0019 namespace celeritas 0020 { 0021 struct ImportData; 0022 0023 //---------------------------------------------------------------------------// 0024 /*! 0025 * Write an \c ImportData object to a ROOT file. 0026 * 0027 * \code 0028 * RootExporter export("/path/to/root_file.root"); 0029 * export(my_import_data); 0030 * \endcode 0031 */ 0032 class RootExporter 0033 { 0034 public: 0035 // Construct with ROOT file name 0036 explicit RootExporter(char const* filename); 0037 0038 // Save data to the ROOT file 0039 void operator()(ImportData const& data); 0040 0041 private: 0042 UPRootFileWritable root_output_; 0043 0044 private: 0045 // ROOT TTree name 0046 static char const* tree_name(); 0047 // ROOT TBranch name 0048 static char const* branch_name(); 0049 }; 0050 0051 //---------------------------------------------------------------------------// 0052 #if !CELERITAS_USE_ROOT 0053 inline RootExporter::RootExporter(char const*) 0054 { 0055 CELER_NOT_CONFIGURED("ROOT"); 0056 } 0057 0058 inline void RootExporter::operator()(ImportData const&) 0059 { 0060 CELER_ASSERT_UNREACHABLE(); 0061 } 0062 #endif 0063 0064 //---------------------------------------------------------------------------// 0065 } // namespace celeritas
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |