AtomicNumber.h
Go to the documentation of this file.
1 /**
2  * @file AtomicNumber.h
3  * @brief Provider returning atomic number of the active material in the TPC
4  * @author Gianluca Petrillo (petrillo@fnal.gov)
5  * @date April 13, 2016
6  * @see AtomicNumber.cxx AtomicNumberService.h
7  * @ingroup AtomicNumber
8  *
9  */
10 
11 #ifndef LAREXAMPLES_SERVICES_ATOMICNUMBER_PROVIDER_ATOMICNUMBER_H
12 #define LAREXAMPLES_SERVICES_ATOMICNUMBER_PROVIDER_ATOMICNUMBER_H
13 
14 
15 // support libraries
16 #include "fhiclcpp/fwd.h"
17 #include "fhiclcpp/types/Table.h"
18 #include "fhiclcpp/types/Atom.h"
19 
20 
21 namespace lar {
22  namespace example {
23 
24  /** **********************************************************************
25  * @brief Provides information about the active material in the TPC.
26  * @see @ref AtomicNumber "AtomicNumber example overview"
27  * @ingroup AtomicNumber
28  *
29  * Configuration parameters
30  * =========================
31  *
32  * See `AtomicNumber` service provider class.
33  *
34  * - *AtomicNumber* (integer, default: 18): atomic number of the active
35  * material
36  *
37  */
38  class AtomicNumber {
39  public:
40  //---------------------------------------------------------------------
41  /// Collection of configuration parameters for the service
42  struct Config {
43  using Name = fhicl::Name;
45 
47  Name("AtomicNumber"),
48  Comment("atomic number of the active material in the TPC"),
49  18U // default value
50  };
51 
52  }; // struct Config
53 
54  /// Type describing all the parameters
56 
57 
58  //---------------------------------------------------------------------
59  /// Constructor from the complete configuration object
61  : Z_(config.AtomicNumber())
62  {}
63 
64  //---------------------------------------------------------------------
65  /// Constructor from a parameter set
67  : AtomicNumber(parameters_type(pset, { "service_type" })())
68  {}
69 
70 
71  //---------------------------------------------------------------------
72  // copy and moving of service providers is "forbidden":
73  AtomicNumber(AtomicNumber const& pset) = delete;
74  AtomicNumber(AtomicNumber&& pset) = delete;
75  AtomicNumber& operator= (AtomicNumber const& pset) = delete;
76  AtomicNumber& operator= (AtomicNumber&& pset) = delete;
77 
78 
79  //---------------------------------------------------------------------
80  /// @name Accessors
81  /// @{
82 
83  /// Returns the atomic number
84  unsigned int Z() const { return Z_; }
85 
86  /// @}
87 
88 
89  //---------------------------------------------------------------------
90  private:
91  unsigned int Z_; ///< atomic number
92 
93  }; // AtomicNumber
94 
95  } // namespace example
96 } // namespace lar
97 
98 
99 #endif // LAREXAMPLES_SERVICES_ATOMICNUMBER_PROVIDER_ATOMICNUMBER_H
ChannelGroupService::Name Name
Collection of configuration parameters for the service.
Definition: AtomicNumber.h:42
unsigned int Z() const
Returns the atomic number.
Definition: AtomicNumber.h:84
AtomicNumber(fhicl::ParameterSet const &pset)
Constructor from a parameter set.
Definition: AtomicNumber.h:66
static Config * config
Definition: config.cpp:1054
Provides information about the active material in the TPC.
Definition: AtomicNumber.h:38
#define Comment
LArSoft-specific namespace.
unsigned int Z_
atomic number
Definition: AtomicNumber.h:91
fhicl::Atom< unsigned int > AtomicNumber
Definition: AtomicNumber.h:46
AtomicNumber(Config const &config)
Constructor from the complete configuration object.
Definition: AtomicNumber.h:60
AtomicNumber & operator=(AtomicNumber const &pset)=delete