Falaise  4.0.1
SuperNEMO Software Toolkit
mapped_magnetic_field.h
Go to the documentation of this file.
1 /// \file falaise/snemo/geometry/mapped_magnetic_field.h
2 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date : 2016-03-11
4  * Last modified : 2016-03-11
5  *
6  * Copyright (C) 2016 Francois Mauger <mauger@lpccaen.in2p3.fr>
7  * Steve Snow <S.W.Snow@warwick.ac.uk>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or (at
12  * your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  * Boston, MA 02110-1301, USA.
23  *
24  * Description:
25  *
26  * Mapped magnetic field for the SuperNEMO demonstrator module
27  *
28  * History:
29  *
30  */
31 
32 #ifndef FALAISE_SNEMO_GEOMETRY_MAPPED_MAGNETIC_FIELD_H
33 #define FALAISE_SNEMO_GEOMETRY_MAPPED_MAGNETIC_FIELD_H
34 
35 // Standard library:
36 #include <string>
37 
38 // Third party:
39 // - Bayeux/emfield:
41 
42 namespace snemo {
43 
44 namespace geometry {
45 
46 /// \brief Class representing a contant mapped magnetic field
48  public:
49  /// \brief Mapping mode
51  MM_INVALID = -1, ///< Invalid mapping mode
52  MM_IMPORT_CSV_MAP_0 = 0 ///< Build from imported CSV file
53  };
54 
55  /// Default constructor
56  mapped_magnetic_field(uint32_t = 0);
57 
58  /// Destructor
59  virtual ~mapped_magnetic_field();
60 
61  /// Initialization
62  virtual void initialize(const ::datatools::properties &, ::datatools::service_manager &,
64 
65  /// Reset
66  virtual void reset();
67 
68  /// Compute electric field
69  virtual int compute_electric_field(const ::geomtools::vector_3d &position_, double time_,
70  ::geomtools::vector_3d &electric_field_) const;
71 
72  /// Compute magnetic field
73  virtual int compute_magnetic_field(const ::geomtools::vector_3d &position_, double time_,
74  geomtools::vector_3d &magnetic_field_) const;
75 
76  /// Smart print
77  virtual void tree_dump(std::ostream &out_ = std::clog, const std::string &title_ = "",
78  const std::string &indent_ = "", bool inherit_ = false) const;
79 
80  /// Set the map source filename
81  void set_map_filename(const std::string &);
82 
83  /// Set the mapping mode
85 
86  /// Set the flag to force a zero B-field outside the mapped domain
87  void set_zero_field_outside_map(bool);
88 
89  /// Return the flag to force a zero B-field outside the mapped domain
90  bool is_zero_field_outside_map() const;
91 
92  /// Set the Z component inversion flag
93  void set_z_inverted(bool);
94 
95  /// Return the Z component inversion flag
96  bool is_z_inverted() const;
97 
98  protected:
99  /// Set default attributes values
100  void _set_defaults();
101 
102  private:
103  mapping_mode_type _mapping_mode_; //!< Mapping mode
104  std::string _map_filename_; //!< Map filename
105  bool _zero_field_outside_map_; //!< Force zero field outside the interpolated map
106  bool _z_inverted_; //!< Invert the Z component of the field
107 
108  struct _work_type;
109  boost::scoped_ptr<_work_type> _work_; //!< PIMPL-ized working data
110 
111  // Macro to automate the registration of the EM field :
113 };
114 
115 } // end of namespace geometry
116 
117 } // end of namespace snemo
118 
119 #endif // FALAISE_SNEMO_GEOMETRY_MAPPED_MAGNETIC_FIELD_H
120 
121 // Local Variables: --
122 // mode: c++ --
123 // c-file-style: "gnu" --
124 // tab-width: 2 --
125 // End: --
bool is_zero_field_outside_map() const
Return the flag to force a zero B-field outside the mapped domain.
#define EMFIELD_REGISTRATION_INTERFACE(EMFIELD_CLASS_NAME)
mapped_magnetic_field(uint32_t=0)
Default constructor.
void set_mapping_mode(mapping_mode_type)
Set the mapping mode.
virtual void initialize(const ::datatools::properties &, ::datatools::service_manager &, ::emfield::base_electromagnetic_field::field_dict_type &)
Initialization.
void _set_defaults()
Set default attributes values.
mapping_mode_type
Mapping mode.
Definition: mapped_magnetic_field.h:50
Invalid mapping mode.
Definition: mapped_magnetic_field.h:51
std::map< std::string, handle_type > field_dict_type
virtual int compute_electric_field(const ::geomtools::vector_3d &position_, double time_, ::geomtools::vector_3d &electric_field_) const
Compute electric field.
Class representing a contant mapped magnetic field.
Definition: mapped_magnetic_field.h:47
virtual ~mapped_magnetic_field()
Destructor.
void set_z_inverted(bool)
Set the Z component inversion flag.
Definition: calo_tapered_scin_box_model.h:54
Build from imported CSV file.
Definition: mapped_magnetic_field.h:52
CLHEP::Hep3Vector vector_3d
void set_map_filename(const std::string &)
Set the map source filename.
bool is_z_inverted() const
Return the Z component inversion flag.
virtual int compute_magnetic_field(const ::geomtools::vector_3d &position_, double time_, geomtools::vector_3d &magnetic_field_) const
Compute magnetic field.
void set_zero_field_outside_map(bool)
Set the flag to force a zero B-field outside the mapped domain.
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.