HEP and Geant¶
The HEP libraries turn detector measurements and simulated tracks into reconstruction inputs and images. Their normal link order is:
The classes are in uLib. Geant integration classes are in
uLib::Geant and require the Geant4-enabled
mutomGeant target.
Detectors: measurements and scatter events¶
DetectorChamber is a placeable ContainerBox that
models a tracking chamber. It defines its measuring plane, finite/infinite
footprint, position and angular resolutions, and efficiency. It produces the
measurements from which a MuonEvent and then a
MuonScatter are reconstructed.
#include <Core/ObjectsContext.h>
#include <HEP/Detectors/DetectorChamber.h>
uLib::ObjectsContext context;
auto *upper = context.CreateObject<uLib::DetectorChamber>("upper");
auto *lower = context.CreateObject<uLib::DetectorChamber>("lower");
upper->Position.Set({0.0f, 500.0f, 0.0f});
lower->Position.Set({0.0f, -500.0f, 0.0f});
upper->PositionResolution.Set(1.0);
lower->PositionResolution.Set(1.0);
The detector data families are:
| Family | Public types | Role |
|---|---|---|
| Hits | HitData, HitRawCode_CMSDrift, HitMCData, HitMC |
Raw and Monte Carlo detector hits. |
| Event values | ChamberHitEventData, ChamberHitEvent, MuonEventData, MuonEvent, ExperimentFitEventData, LinearFitData, LinearFit, MuonErrorData, MuonError |
Measurements, fitted tracks, and uncertainties. |
| Scattering | MuonScatter, MuonScatterEvent, MuonScatterCollection |
Reconstructed incoming/outgoing track pair and collections of events. |
| Streaming adapter | IMuonScatterSink, MuonScatterSource |
Sink and bounded, waitable producer for live scatter events. |
MuonScatterSource is especially useful for long simulations. It
implements a bounded stream: a producer calls
BeginMuonStream, AcceptMuonScatter, and
EndMuonStream; a reconstruction reads it as a Core stream. Its
Capacity, BatchSize, NotifyEvery, and
WaitTimeout properties state the back-pressure and notification
policy. See live muon
reconstruction.
Muon tomography¶
MuonTomographyAlgorithm owns the common reconstruction loop. It
can read a precomputed MuonScatterCollection through
SetEvents or an IStreamProducer through
SetStream, and writes an Abstract::VoxImage attached
with SetImage. Its subclasses supply the reconstruction rule:
| Class | Reconstruction |
|---|---|
PocaImageAlgorithm |
Point-of-closest-approach image. |
RayLengthImageAlgorithm |
Voxelized path/ray-length image. |
#include <HEP/MuonTomography/MuonTomographyImaging.h>
#include <HEP/Detectors/MuonScatterCollection.h>
#include <Math/VoxImage.h>
uLib::MuonScatterCollection events;
uLib::VoxImage<uLib::Voxel> image{uLib::Vector3i{80, 80, 80}};
uLib::PocaImageAlgorithm reconstruction;
reconstruction.SetEvents(&events);
reconstruction.SetImage(&image);
reconstruction.Run();
For live batches, use SetStream, turn
ResetImage off after the first batch, and choose whether
DriveStream should request work or merely drain an already
notified buffer. This distinction prevents a consumer that is running in
response to a notification from recursively starting another producer.
Geant¶
mutomGeant bridges the editable uLib scene to Geant4. A
Geant::Scene holds the simulation setup; Geant::Physics
and Geant::PhysicsList configure processes; particle sources
generate primaries; volumes and solids define geometry; and actions, scoring,
and sensitive detectors collect results.
Build a scene declaratively¶
Construct the uLib objects, arrange them in an ObjectsContext,
then configure/run the Geant scene through its public API. The exact Geant4
run-manager setup belongs to Geant::Scene; avoid holding raw
Geant4 geometry pointers in application code, because the scene owns and
rebuilds the Geant objects when its uLib objects change.
#include <Core/ObjectsContext.h>
#include <HEP/Geant/Scene.h>
#include <HEP/Geant/Solid.h>
uLib::ObjectsContext context;
auto *scene = context.CreateObject<uLib::Geant::Scene>("simulation");
scene->ConstructWorldBox(
uLib::Vector3f{2000.0f, 2000.0f, 2000.0f}, "G4_AIR");
Geant class groups¶
| Group | Main exported classes |
|---|---|
| Scene and run | Scene, SimulationContext, DetectorPlane, GeantEvent, GeantEventCollection, GeantFailure, ExceptionScope |
| Geometry | Solid, LogicalVolume, PhysicalVolume, BoxSolid, CylinderSolid, SphereSolid, ConeSolid, TessellatedSolid, Boolean solids, AssemblyVolume, replica/division/parameterised volumes, Region |
| Materials and fields | Isotope, Element, MaterialComponent, Material, Field, MagneticField, ElectricField, UserLimits |
| Primary sources | ParticleGun, IsotropicSource, EmitterPrimary, SkyPlaneEmitterPrimary, CylinderEmitterPrimary, QuadMeshEmitterPrimary, EMLog, EMRandom, EMMaximization, EMMultiGen, EcoMug |
| Actions and output | ActionInitialization, DetectorActionInitialization, DetectorConstruction, SteppingAction, DetectorSteppingAction, TrackRecorder, TrackRecord, RunSummary |
| Scoring | SensitiveDetector, Hit, ScoringDetector, Scorer, ScoringMesh, ScoringFilter, ParticleFilter, ChargeFilter, EnergyFilter |
| Other Geant domains | Digitizer, Digi, OpticalProperty, OpticalSurface, BorderSurface, ParallelWorld, ReflectedVolume, VoxelPhantom, PlaneProbe, ProbeStep, ProbeStepRecord, TrackFilter, TrackFacts |
The complete class catalog lists each installed header and type. For a full end-to-end producer/consumer setup, continue with the C++ streaming guide.