|
|
|||
File indexing completed on 2025-12-15 10:10:54
0001 //------------------------------- -*- C++ -*- -------------------------------// 0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details 0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT) 0004 //---------------------------------------------------------------------------// 0005 //! \file celeritas/ext/RootExporter.hh 0006 //---------------------------------------------------------------------------// 0007 #pragma once 0008 0009 #include "corecel/Config.hh" 0010 0011 #include "corecel/Assert.hh" 0012 0013 #include "RootUniquePtr.hh" 0014 0015 // Forward declare ROOT 0016 class TFile; 0017 0018 namespace celeritas 0019 { 0020 struct ImportData; 0021 0022 //---------------------------------------------------------------------------// 0023 /*! 0024 * Write an \c ImportData object to a ROOT file. 0025 * 0026 * \code 0027 * RootExporter export("/path/to/root_file.root"); 0028 * export(my_import_data); 0029 * \endcode 0030 */ 0031 class RootExporter 0032 { 0033 public: 0034 // Construct with ROOT file name 0035 explicit RootExporter(char const* filename); 0036 0037 // Save data to the ROOT file 0038 void operator()(ImportData const& data); 0039 0040 private: 0041 UPRootFileWritable root_output_; 0042 0043 private: 0044 // ROOT TTree name 0045 static char const* tree_name(); 0046 // ROOT TBranch name 0047 static char const* branch_name(); 0048 }; 0049 0050 //---------------------------------------------------------------------------// 0051 #if !CELERITAS_USE_ROOT 0052 inline RootExporter::RootExporter(char const*) 0053 { 0054 CELER_NOT_CONFIGURED("ROOT"); 0055 } 0056 0057 inline void RootExporter::operator()(ImportData const&) 0058 { 0059 CELER_ASSERT_UNREACHABLE(); 0060 } 0061 #endif 0062 0063 //---------------------------------------------------------------------------// 0064 } // 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 |
|