Falaise  4.0.1
SuperNEMO Software Toolkit
utils.h
Go to the documentation of this file.
1 /// \file falaise/snemo/geometry/utils.h
2 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2010-02-20
4  * Last modified: 2014-01-29
5  *
6  * License:
7  *
8  * Copyright 2007-2014 F. Mauger
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or (at
13  * your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
23  * Boston, MA 02110-1301, USA.
24  *
25  * Description:
26  * Utilities.
27  *
28  * History:
29  *
30  */
31 
32 #ifndef FALAISE_SNEMO_GEOMETRY_UTILS_H
33 #define FALAISE_SNEMO_GEOMETRY_UTILS_H 1
34 
35 // Third party:
36 // - Bayeux/geomtools:
37 #include <geomtools/visibility.h>
38 
39 namespace snemo {
40 
41 namespace geometry {
42 
43 /// \brief Some geometry utility
44 class utils {
45  public:
46  static const unsigned int NSIDES = 2;
47  static const unsigned int NSUBMODULES = NSIDES;
48 
49  /// \brief Direction identifier constants in the SuperNEMO reference frame
51  DIRECTION_INVALID = -1, //!< Invalid/undefined direction
52  DIRECTION_BACK = 0, //!< Back direction (X-)
53  DIRECTION_FRONT = 1, //!< Front direction (X+)
54  DIRECTION_LEFT = 2, //!< Left direction (Y-)
55  DIRECTION_RIGHT = 3, //!< Right direction (Y+)
56  DIRECTION_BOTTOM = 4, //!< Bottom direction (Z-)
57  DIRECTION_TOP = 5 //!< Top direction (Z+)
58  };
59 
60  /// \brief Side identifier constants (X axis in the SuperNEMO reference frame)
61  enum side_index {
62  SIDE_INVALID = -1, //!< Invalid/undefined side
63  SIDE_BACK = DIRECTION_BACK, //!< Back side (X-)
64  SIDE_FRONT = DIRECTION_FRONT //!< Front side (X+)
65  };
66 
67  /// Return a label representing the "back" side
68  static const std::string& side_back_label();
69 
70  /// Return a label representing the "front" side
71  static const std::string& side_front_label();
72 
73  /// Check if a label represents a valid side
74  static bool is_side_label_valid(const std::string& label_);
75 
76  /// Get the side code from a label
77  static int get_side_from_label(const std::string& label_);
78 
79  /** \brief Neighbourg flag on a 2D-grid
80  * [s][s][s][s][s]
81  * [s][D][S][D][s]
82  * [s][S][x][S][s]
83  * [s][D][S][D][s]
84  * [s][s][s][s][s]
85  *
86  */
88  NEIGHBOUR_NONE = 0x0, ///
89  NEIGHBOUR_SIDE = 0x1, /// S : nearest neighbours (side)
90  NEIGHBOUR_DIAG = 0x2, /// D : nearest diagonal
92  NEIGHBOUR_SECOND = 0x4 /// s : second ranked neighbours
93  };
94 };
95 
96 } // end of namespace geometry
97 
98 } // end of namespace snemo
99 
100 #endif // FALAISE_SNEMO_GEOMETRY_UTILS_H
101 
102 // Local Variables: --
103 // mode: c++ --
104 // c-file-style: "gnu" --
105 // tab-width: 2 --
106 // End: --
Left direction (Y-)
Definition: utils.h:54
S : nearest neighbours (side)
Definition: utils.h:90
Top direction (Z+)
Definition: utils.h:57
static int get_side_from_label(const std::string &label_)
Get the side code from a label.
Invalid/undefined direction.
Definition: utils.h:51
S or D.
Definition: utils.h:92
static const unsigned int NSUBMODULES
Definition: utils.h:47
Back direction (X-)
Definition: utils.h:52
static bool is_side_label_valid(const std::string &label_)
Check if a label represents a valid side.
direction_index
Direction identifier constants in the SuperNEMO reference frame.
Definition: utils.h:50
Some geometry utility.
Definition: utils.h:44
D : nearest diagonal.
Definition: utils.h:91
Definition: calo_tapered_scin_box_model.h:54
Invalid/undefined side.
Definition: utils.h:62
side_index
Side identifier constants (X axis in the SuperNEMO reference frame)
Definition: utils.h:61
static const unsigned int NSIDES
Definition: utils.h:46
Back side (X-)
Definition: utils.h:63
Bottom direction (Z-)
Definition: utils.h:56
Front direction (X+)
Definition: utils.h:53
static const std::string & side_back_label()
Return a label representing the "back" side.
static const std::string & side_front_label()
Return a label representing the "front" side.
Front side (X+)
Definition: utils.h:64
grid_neighbour_mask_type
Neighbourg flag on a 2D-grid [s][s][s][s][s] [s][D][S][D][s] [s][S][x][S][s] [s][D][S][D][s] [s][s][s...
Definition: utils.h:87
Right direction (Y+)
Definition: utils.h:55