Falaise  4.0.1
SuperNEMO Software Toolkit
particle_track.h
Go to the documentation of this file.
1 /// \file falaise/snemo/datamodels/particle_track.h
2 /* Author (s) : Mathieu Bongrand <bongrand@lal.in2p3.fr>
3  * Xavier Garrido <garrido@lal.in2p3.fr>
4  * Creation date: 2012-04-17
5  * Last modified: 2014-06-03
6  *
7  * Description: A particle track represents the physical interpretation of a
8  * trajectory fitted from a cluster of tracker hits or from a gamma tracking
9  * algorithm
10  */
11 
12 #ifndef FALAISE_SNEMO_DATAMODELS_PARTICLE_TRACK_H
13 #define FALAISE_SNEMO_DATAMODELS_PARTICLE_TRACK_H 1
14 
15 // Standard library:
16 #include <vector>
17 
18 // Third party:
19 // - Boost:
20 #include <boost/cstdint.hpp>
21 // - Bayeux/geomtools:
22 #include <geomtools/base_hit.h>
23 #include <geomtools/blur_spot.h>
24 
25 // This project:
28 
29 namespace snemo {
30 
31 namespace datamodel {
32 
33 /// \brief SuperNEMO particle track
35  public:
36  /// Electric charge enumeration
37  enum charge_type {
38  INVALID = 0x0,
40  UNDEFINED = datatools::bit_mask::bit00, /// Particle with undefined charge
42  NEUTRAL = datatools::bit_mask::bit01, /// Neutral particle
44  POSITIVE = datatools::bit_mask::bit02, /// Positively charged particle
46  NEGATIVE = datatools::bit_mask::bit03, /// Negatively charged particle
48  };
49 
50  /// Check a particle charge type
51  static bool particle_has(const particle_track &, charge_type);
52 
53  /// Check a particle is electron
54  static bool particle_has_negative_charge(const particle_track &);
55 
56  /// Check a particle is positron
57  static bool particle_has_positive_charge(const particle_track &);
58 
59  /// Check a particle is alpha
60  static bool particle_has_undefined_charge(const particle_track &);
61 
62  /// Check a particle is gamma
63  static bool particle_has_neutral_charge(const particle_track &);
64 
65  /// Vertex flags
66  enum vertex_type {
67  VERTEX_NONE = 0x0,
73  };
74 
75  /// Key for the vertex type property
76  static const std::string &vertex_type_key();
77 
78  /// Return the label from the vertex type
79  static const std::string &vertex_type_to_label(vertex_type);
80 
81  /// Return the vertex type from the label
82  static vertex_type label_to_vertex_type(const std::string &);
83 
84  /// Associated 'VERTEX_NONE' flag for auxiliary property
85  static const std::string &vertex_none_label();
86 
87  /// Associated 'VERTEX_ON_SOURCE_FOIL' flag for auxiliary property
88  static const std::string &vertex_on_source_foil_label();
89 
90  /// Associated 'VERTEX_ON_MAIN_CALORIMETER' flag for auxiliary property
91  static const std::string &vertex_on_main_calorimeter_label();
92 
93  /// Associated 'VERTEX_ON_X_CALORIMETER' flag for auxiliary property
94  static const std::string &vertex_on_x_calorimeter_label();
95 
96  /// Associated 'VERTEX_ON_GAMMA_CALORIMETER' flag for auxiliary property
97  static const std::string &vertex_on_gamma_veto_label();
98 
99  /// Associated 'VERTEX_ON_WIRE' flag for auxiliary property
100  static const std::string &vertex_on_wire_label();
101 
102  /// Check a vertex type
103  static bool vertex_is(const geomtools::blur_spot &, vertex_type);
104 
105  /// Check a vertex on source foil
106  static bool vertex_is_on_source_foil(const geomtools::blur_spot &);
107 
108  /// Check a vertex on main calorimeter
110 
111  /// Check a vertex on X calorimeter
113 
114  /// Check a vertex on gamma veto
115  static bool vertex_is_on_gamma_veto(const geomtools::blur_spot &);
116 
117  /// Check a vertex on wire
118  static bool vertex_is_on_wire(const geomtools::blur_spot &);
119 
120  /// Handle on vertex spot
122 
123  /// Collection of vertex spots
124  typedef std::vector<handle_spot> vertex_collection_type;
125 
126  /// Handle on particle track
128 
129  /// Default constructor
130  particle_track();
131 
132  /// Destructor
133  virtual ~particle_track();
134 
135  /// Check if there is a valid track ID
136  bool has_track_id() const;
137 
138  /// Get the track ID
139  int get_track_id() const;
140 
141  /// Set the track ID
142  void set_track_id(int32_t track_id_);
143 
144  /// Invalidate the track ID
145  void invalidate_track_id();
146 
147  //// Set particle charge
148  void set_charge(charge_type charge_);
149 
150  /// Get particle charge
151  charge_type get_charge() const;
152 
153  /// Check if the trajectory is present
154  bool has_trajectory() const;
155 
156  /// Detach the trajectory
157  void detach_trajectory();
158 
159  /// Attach a trajectory by handle
160  void set_trajectory_handle(const tracker_trajectory::handle_type &trajectory_handle_);
161 
162  /// Return a mutable reference on the trajectory handle
164 
165  /// Return a non mutable reference on the trajectory handle
167 
168  /// Return a mutable reference on the trajectory
170 
171  /// Return a non mutable reference on the trajectory
172  const tracker_trajectory &get_trajectory() const;
173 
174  /// Check if there are some vertices along the fitted trajectory
175  bool has_vertices() const;
176 
177  /// Reset the collection of vertices
178  void reset_vertices();
179 
180  /// Return a mutable reference on the collection of vertices (handles)
182 
183  /// Return a non mutable reference on the collection of vertices (handles)
184  const vertex_collection_type &get_vertices() const;
185 
186  /// Function to return the number of vertices found given a 'vertex' flag
187  /// bits. The list of vertices can be retrieved, the 'clear' option
188  /// meaning that the list will be cleaned before pushing new vertex spot.
189  size_t fetch_vertices(vertex_collection_type &vertices_, const uint32_t flags_,
190  const bool clear_ = false) const;
191 
192  /// Check if there are some associated calorimeter hits
193  bool has_associated_calorimeter_hits() const;
194 
195  /// Reset the collection of associated calorimeter hits
197 
198  /// Return a mutable reference on the collection of associated calorimeter hits (handles)
200 
201  /// Return a non mutable reference on the collection of associated calorimeter hits (handles)
203 
204  /// Empty the contents of the particle track
205  void clear();
206 
207  /// Reset the particle track (see clear)
208  void reset();
209 
210  /// Smart print
211  virtual void tree_dump(std::ostream &out = std::clog, const std::string &title_ = "",
212  const std::string &indent_ = "", bool inherit_ = false) const;
213 
214  private:
215  charge_type _charge_from_source_; //!< Particle charge
216  tracker_trajectory::handle_type _trajectory_; //!< Handle to the fitted trajectory
217  vertex_collection_type _vertices_; //!< Collection of vertices
219  _associated_calorimeter_hits_; //!< Collection of associated calorimeter hits
220 
222 };
223 
224 } // end of namespace datamodel
225 
226 } // end of namespace snemo
227 
228 #endif // FALAISE_SNEMO_DATAMODELS_PARTICLE_TRACK_H
229 
230 /*
231 ** Local Variables: --
232 ** mode: c++ --
233 ** c-file-style: "gnu" --
234 ** tab-width: 2 --
235 ** End: --
236 */
vertex_type
Vertex flags.
Definition: particle_track.h:66
static bool vertex_is_on_gamma_veto(const geomtools::blur_spot &)
Check a vertex on gamma veto.
std::vector< handle_spot > vertex_collection_type
Collection of vertex spots.
Definition: particle_track.h:124
particle_track()
Default constructor.
datatools::handle< particle_track > handle_type
Handle on particle track.
Definition: particle_track.h:127
static bool vertex_is(const geomtools::blur_spot &, vertex_type)
Check a vertex type.
calibrated_calorimeter_hit::collection_type & grab_associated_calorimeter_hits()
Return a mutable reference on the collection of associated calorimeter hits (handles)
Positively charged particle.
Definition: particle_track.h:45
static const std::string & vertex_on_source_foil_label()
Associated 'VERTEX_ON_SOURCE_FOIL' flag for auxiliary property.
static bool particle_has_neutral_charge(const particle_track &)
Check a particle is gamma.
static const std::string & vertex_on_x_calorimeter_label()
Associated 'VERTEX_ON_X_CALORIMETER' flag for auxiliary property.
bool has_trajectory() const
Check if the trajectory is present.
static const uint32_t bit01
bool has_vertices() const
Check if there are some vertices along the fitted trajectory.
static const uint32_t bit03
charge_type get_charge() const
Get particle charge.
static bool particle_has_positive_charge(const particle_track &)
Check a particle is positron.
charge_type
Electric charge enumeration.
Definition: particle_track.h:37
void set_charge(charge_type charge_)
static const std::string & vertex_on_wire_label()
Associated 'VERTEX_ON_WIRE' flag for auxiliary property.
static const uint32_t bit04
void reset()
Reset the particle track (see clear)
Negatively charged particle.
Definition: particle_track.h:47
#define DATATOOLS_SERIALIZATION_DECLARATION()
Definition: particle_track.h:38
static vertex_type label_to_vertex_type(const std::string &)
Return the vertex type from the label.
int get_track_id() const
Get the track ID.
void invalidate_track_id()
Invalidate the track ID.
void detach_trajectory()
Detach the trajectory.
static bool vertex_is_on_x_calorimeter(const geomtools::blur_spot &)
Check a vertex on X calorimeter.
A trajectory of Geiger calibrated hits referenced by handles.
Definition: tracker_trajectory.h:29
Definition: particle_track.h:44
Definition: particle_track.h:39
Particle with undefined charge.
Definition: particle_track.h:41
static bool particle_has_negative_charge(const particle_track &)
Check a particle is electron.
bool has_track_id() const
Check if there is a valid track ID.
static bool particle_has_undefined_charge(const particle_track &)
Check a particle is alpha.
static const std::string & vertex_type_key()
Key for the vertex type property.
tracker_trajectory::handle_type & grab_trajectory_handle()
Return a mutable reference on the trajectory handle.
Definition: particle_track.h:46
static const uint32_t bit02
Definition: calo_tapered_scin_box_model.h:54
virtual ~particle_track()
Destructor.
vertex_collection_type & grab_vertices()
Return a mutable reference on the collection of vertices (handles)
Definition: particle_track.h:42
static bool vertex_is_on_source_foil(const geomtools::blur_spot &)
Check a vertex on source foil.
Definition: particle_track.h:40
size_t fetch_vertices(vertex_collection_type &vertices_, const uint32_t flags_, const bool clear_=false) const
const vertex_collection_type & get_vertices() const
Return a non mutable reference on the collection of vertices (handles)
datatools::handle< geomtools::blur_spot > handle_spot
Handle on vertex spot.
Definition: particle_track.h:121
void clear()
Empty the contents of the particle track.
Definition: particle_track.h:67
void reset_associated_calorimeter_hits()
Reset the collection of associated calorimeter hits.
static const std::string & vertex_none_label()
Associated 'VERTEX_NONE' flag for auxiliary property.
static bool vertex_is_on_wire(const geomtools::blur_spot &)
Check a vertex on wire.
static const std::string & vertex_on_gamma_veto_label()
Associated 'VERTEX_ON_GAMMA_CALORIMETER' flag for auxiliary property.
static bool vertex_is_on_main_calorimeter(const geomtools::blur_spot &)
Check a vertex on main calorimeter.
const calibrated_calorimeter_hit::collection_type & get_associated_calorimeter_hits() const
Return a non mutable reference on the collection of associated calorimeter hits (handles)
Neutral particle.
Definition: particle_track.h:43
bool has_associated_calorimeter_hits() const
Check if there are some associated calorimeter hits.
const tracker_trajectory & get_trajectory() const
Return a non mutable reference on the trajectory.
SuperNEMO particle track.
Definition: particle_track.h:34
std::vector< handle_type > collection_type
Collection of handles of calibrated calorimeter hit.
Definition: calibrated_calorimeter_hit.h:51
static const std::string & vertex_type_to_label(vertex_type)
Return the label from the vertex type.
virtual void tree_dump(std::ostream &out=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
void reset_vertices()
Reset the collection of vertices.
static const uint32_t bit00
static bool particle_has(const particle_track &, charge_type)
Check a particle charge type.
tracker_trajectory & grab_trajectory()
Return a mutable reference on the trajectory.
const tracker_trajectory::handle_type & get_trajectory_handle() const
Return a non mutable reference on the trajectory handle.
static const std::string & vertex_on_main_calorimeter_label()
Associated 'VERTEX_ON_MAIN_CALORIMETER' flag for auxiliary property.
void set_track_id(int32_t track_id_)
Set the track ID.
void set_trajectory_handle(const tracker_trajectory::handle_type &trajectory_handle_)
Attach a trajectory by handle.