Celeritas 0.7.0-dev.79+develop.b3dc2e108
Loading...
Searching...
No Matches
Classes | Functions
GeantGdmlLoader.hh File Reference
#include <map>
#include <string>
#include "corecel/Config.hh"
#include "corecel/Assert.hh"
This graph shows which files directly or indirectly include this file:

Classes

class  celeritas::GeantGdmlLoader
 Load a GDML file into memory. More...
 
struct  celeritas::GeantGdmlLoader::Options
 
struct  celeritas::GeantGdmlLoader::Result
 

Functions

G4VPhysicalVolumeceleritas::load_gdml (std::string const &filename)
 Load a Geant4 geometry, excising pointers.
 
void celeritas::save_gdml (G4VPhysicalVolume const *world, std::string const &out_filename)
 Write a GDML file to the given filename.
 
template<class F >
void celeritas::foreach_detector (GeantGdmlLoader::MapDetectors const &dets, F &&apply_to_range)
 Apply a function to each sensitive detector name with a range of volumes.
 

Function Documentation

◆ foreach_detector()

template<class F >
void celeritas::foreach_detector ( GeantGdmlLoader::MapDetectors const dets,
F &&  apply_to_range 
)
inline

Apply a function to each sensitive detector name with a range of volumes.

The input function should have a signature

void(*)(MDCIter start, MDCIter stop)

where

using MDCIter = MapDetectors::const_iterator

.

In C++23 this is equivalent to:

#include <ranges>
namespace rv = std::views;
template<class F>
void foreach_detector(MapDetectors const& dets, F&& f)
{
for (auto chunk : dets | rv::chunk_by(
[](auto const& a, auto const& b){ return a.first == b.first; }))
{
f(chunk.begin(), chunk.end());
}
}

◆ load_gdml()

G4VPhysicalVolume * celeritas::load_gdml ( std::string const filename)
inline

Load a Geant4 geometry, excising pointers.

This provides a good default for using GDML in Celeritas.

Returns
Geant4-owned world volume