Skip to main content

gondola_core/events/
mc_track.rs

1// The following file is part of gaps-online-software and published 
2// under the GPLv3 license
3
4
5use crate::prelude::*;
6
7#[derive(Debug, Clone, PartialEq)]
8#[cfg_attr(feature="pybindings", pyclass)] 
9pub struct McTrack {
10  pub hits  : Vec<McHit>,
11  pub track : Tracklet
12}
13
14impl McTrack {
15  pub fn new() -> Self {
16    Self {
17      hits  : Vec::<McHit>::new(),
18      track : Tracklet::new()
19    }
20  }
21}
22
23impl fmt::Display for McTrack {
24  fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
25    let mut repr = String::from("<McTrcak");
26    repr += &(format!("\n  {}", self.track));
27    for h in &self.hits { 
28      repr += &(format!("\n  --   {}", h));
29    }
30    write!(f,"{}>", repr)
31  } 
32}
33
34#[cfg(feature="pybindings")]
35pythonize!(McTrack);
36
37#[cfg(feature="pybindings")]
38#[pymethods]
39impl McTrack {
40  
41  #[getter] 
42  fn get_hits(&self) -> Vec<McHit> {
43    self.hits.clone()
44  }
45}
46
47
48