Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 09:54:43

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2023-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 accel/SetupOptionsMessenger.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 #include <memory>
0010 #include <vector>
0011 #include <G4UIcommand.hh>
0012 #include <G4UIdirectory.hh>
0013 #include <G4UImessenger.hh>
0014 
0015 namespace celeritas
0016 {
0017 struct SetupOptions;
0018 
0019 //---------------------------------------------------------------------------//
0020 /*!
0021  * Expose setup options through the Geant4 "macro" UI interface.
0022  *
0023  * The following options are exposed in the \c /celer/ command "directory":
0024  *
0025   Command              | Description
0026   -------------------- | -----------------------------------------------------
0027   geometryFile         | Override detector geometry with a custom GDML
0028   outputFile           | Filename for JSON diagnostic output
0029   physicsOutputFile    | Filename for ROOT dump of physics data
0030   offloadOutputFile    | Filename for HepMC3 copy of offloaded tracks as events
0031   maxNumTracks         | Number of tracks to be transported simultaneously
0032   maxNumEvents         | Maximum number of events in use
0033   maxNumSteps          | Limit on number of step iterations before aborting
0034   maxInitializers      | Maximum number of track initializers
0035   secondaryStackFactor | At least the average number of secondaries per track
0036   autoFlush            | Number of tracks to buffer before offloading
0037   maxFieldSubsteps     | Limit on substeps in field propagator
0038 
0039  * The following option is exposed in the \c /celer/detector/ command
0040  * "directory":
0041  *
0042   Command | Description
0043   ------- | -----------------------------------------
0044   enabled | Call back to Geant4 sensitive detectors
0045 
0046  * If a CUDA/HIP device is available, additional options are available under \c
0047  * /celer/cuda/ :
0048  *
0049   Command        | Description
0050   -------------- | ------------------------------------------------
0051   stackSize      | Set the CUDA per-thread stack size for VecGeom
0052   heapSize       | Set the CUDA per-thread heap size for VecGeom
0053   actionTimes    | Add timers around every action (may reduce performance)
0054   defaultStream  | Launch all kernels on the default stream
0055  *
0056  * \warning The given SetupOptions should be global *or* otherwise must exceed
0057  * the scope of this UI messenger.
0058  */
0059 class SetupOptionsMessenger : public G4UImessenger
0060 {
0061   public:
0062     // Construct with a reference to a setup options instance
0063     explicit SetupOptionsMessenger(SetupOptions* options);
0064 
0065     // Default destructor
0066     ~SetupOptionsMessenger();
0067 
0068   protected:
0069     void SetNewValue(G4UIcommand* command, G4String newValue) override;
0070     G4String GetCurrentValue(G4UIcommand* command) override;
0071 
0072   private:
0073     std::vector<std::unique_ptr<G4UIdirectory>> directories_;
0074     std::vector<std::unique_ptr<G4UIcommand>> commands_;
0075 };
0076 
0077 //---------------------------------------------------------------------------//
0078 }  // namespace celeritas