pub struct Geometry {
pub materials: Vec<Material>,
pub solids: Vec<Solid>,
pub volumes: Vec<Volume>,
pub world: VolumeId,
pub placements_by_copynumber: HashMap<i64, WorldPlacement>,
/* private fields */
}Fields§
§materials: Vec<Material>§solids: Vec<Solid>§volumes: Vec<Volume>§world: VolumeIdthe world volume (index in volumes)
placements_by_copynumber: HashMap<i64, WorldPlacement>All placements (except the world) by their Geant4 copy number. It is not stored in the cache, but rebuilt when the geometry is created.
Implementations§
Source§impl Geometry
impl Geometry
Sourcepub fn new(
materials: Vec<Material>,
solids: Vec<Solid>,
volumes: Vec<Volume>,
world: VolumeId,
) -> Result<Self, GeometryError>
pub fn new( materials: Vec<Material>, solids: Vec<Solid>, volumes: Vec<Volume>, world: VolumeId, ) -> Result<Self, GeometryError>
Create the geometry and index its placements by their Geant4 copy number, which have to be unique
Sourcepub fn load(gdml: &Path, cache: Option<&Path>) -> Result<Self, GeometryError>
pub fn load(gdml: &Path, cache: Option<&Path>) -> Result<Self, GeometryError>
Load the geometry, either from a GDML file or from a binary cache. If cache is given, it will be used if it is newer than the GDML file, otherwise the GDML file is parsed and the cache (re)written.
pub fn write_cache(&self, path: &Path) -> Result<(), GeometryError>
pub fn read_cache(path: &Path) -> Result<Self, GeometryError>
pub fn world_volume(&self) -> &Volume
Sourcepub fn placement(&self, copynumber: i64) -> Option<&WorldPlacement>
pub fn placement(&self, copynumber: i64) -> Option<&WorldPlacement>
The placement with the given Geant4 copy number
Sourcepub fn world_placements(&self) -> Vec<WorldPlacement>
pub fn world_placements(&self) -> Vec<WorldPlacement>
All placed volumes (including the world volume itself) with their transformation into the world frame
Source§impl Geometry
impl Geometry
Sourcepub fn raycaster(&self) -> &Raycaster
pub fn raycaster(&self) -> &Raycaster
The raycaster for this geometry, it is built the first time it is needed (this takes about half a second for the GAPS geometry)
Sourcepub fn trace(&self, a: DVec3, b: DVec3) -> TrackPath
pub fn trace(&self, a: DVec3, b: DVec3) -> TrackPath
The volumes along the straight track a -> b (in mm)
Sourcepub fn column_density(&self, a: DVec3, b: DVec3) -> f64
pub fn column_density(&self, a: DVec3, b: DVec3) -> f64
Column density along the straight track a -> b (in mm) in g/cm2, including the air of the world volume
Sourcepub fn depths(&self, points: &[DVec3]) -> Vec<f64>
pub fn depths(&self, points: &[DVec3]) -> Vec<f64>
Cumulative column density in g/cm2 at each point of a track made of straight segments between the points. The first value is always 0.
Sourcepub fn tracklet_endpoints(
&self,
tracklet: &Tracklet,
) -> Result<(DVec3, DVec3), GeometryError>
pub fn tracklet_endpoints( &self, tracklet: &Tracklet, ) -> Result<(DVec3, DVec3), GeometryError>
The start and stop point of a tracklet (in mm). For an infinite tracklet, the track goes from the start along the vertex momentum until it leaves the world volume.
Sourcepub fn trace_tracklet(
&self,
tracklet: &Tracklet,
) -> Result<TrackPath, GeometryError>
pub fn trace_tracklet( &self, tracklet: &Tracklet, ) -> Result<TrackPath, GeometryError>
The volumes along a tracklet, see tracklet_endpoints
Sourcepub fn tracklet_column_density(
&self,
tracklet: &Tracklet,
) -> Result<f64, GeometryError>
pub fn tracklet_column_density( &self, tracklet: &Tracklet, ) -> Result<f64, GeometryError>
Column density along a tracklet in g/cm2, see tracklet_endpoints
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Geometry
impl<'de> Deserialize<'de> for Geometry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Geometry
Auto Trait Implementations§
impl !Freeze for Geometry
impl RefUnwindSafe for Geometry
impl Send for Geometry
impl Sync for Geometry
impl Unpin for Geometry
impl UnsafeUnpin for Geometry
impl UnwindSafe for Geometry
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
impl<T> SendAlias for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.