LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ActiveVolumeVertexSampler.h
Go to the documentation of this file.
1 
10 #ifndef LARSIM_ALGORITHMS_ACTIVEVOLUMEVERTEXSAMPLER_H
11 #define LARSIM_ALGORITHMS_ACTIVEVOLUMEVERTEXSAMPLER_H
12 
13 // standard library includes
14 #include <memory>
15 #include <random>
16 #include <string>
17 
18 // framework includes
19 #include "fhiclcpp/types/Atom.h"
20 #include "fhiclcpp/types/Comment.h"
21 #include "fhiclcpp/types/Name.h"
24 #include "fhiclcpp/types/Table.h"
25 namespace fhicl {
26  class ParameterSet;
27 }
28 
29 // art extensions
30 namespace rndm {
31  class NuRandomService;
32 }
33 
34 // LArSoft includes
35 namespace geo {
36  class Geometry;
37 }
38 
39 // ROOT includes
40 #include "TLorentzVector.h"
41 
42 namespace evgen {
43 
45 
46  public:
47  using Name = fhicl::Name;
49 
52  struct Config {
54  Name("type"),
55  Comment("Technique used to choose vertex locations"),
56  "sampled" // default value
57  };
58 
60  Comment("Seed used for sampling vertex locations"),
61  [this]() -> bool { return type_() != "fixed"; }};
62 
63  fhicl::Sequence<double, 3> position_{Name("position"),
64  Comment("Coordinates of the fixed vertex position"),
65  [this]() -> bool { return type_() == "fixed"; }};
66 
68  Name("min_position"),
69  Comment("The minimum allowed values for the x, y, and z coordinates"),
70  [this]() -> bool { return type_() == "box"; }};
71 
73  Name("max_position"),
74  Comment("The maximum allowed values for the x, y, and z coordinates"),
75  [this]() -> bool { return type_() == "box"; }};
76 
78  Name("check_active"),
79  Comment("Whether to enforce that the sampled vertices are within a TPC"
80  " active volume"),
81  [this]() -> bool { return type_() == "box"; }};
82 
83  }; // struct Config
84 
85  enum class vertex_type_t { kSampled, kFixed, kBox };
86 
87  // Configuration-checking constructors
89  rndm::NuRandomService& rand_service,
90  const geo::Geometry& geom,
91  const std::string& generator_name);
92 
94  rndm::NuRandomService& rand_service,
95  const geo::Geometry& geom,
96  const std::string& generator_name)
98  rand_service,
99  geom,
100  generator_name)
101  {}
102 
103  void reconfigure(const fhicl::Table<Config>& conf, const geo::Geometry& geom);
104 
105  // Function that selects a primary vertex location for each event.
106  // TODO: add time sampling
107  TLorentzVector sample_vertex_pos(const geo::Geometry& geom);
108 
109  protected:
110  // Currently sampled vertex position (doesn't change value if the vertex
111  // is fixed)
112  TLorentzVector fVertexPosition;
113 
115 
116  std::string fGeneratorName;
117 
118  // Discrete distribution object used to sample TPCs based on their active
119  // masses
120  std::unique_ptr<std::discrete_distribution<size_t>> fTPCDist;
121 
122  // RNG object used to sample TPCs
123  std::mt19937_64 fTPCEngine;
124 
125  // Helper variables used only for "box" sampling mode
126  double fXmin;
127  double fYmin;
128  double fZmin;
129 
130  double fXmax;
131  double fYmax;
132  double fZmax;
133 
135 
136  }; // class evgen::ActiveVolumeVertexSampler
137 
138 } // namespace evgen
139 
140 #endif
vertex position fixed manually - no fitting done
Definition: DataStructs.h:90
parameter set interface
The geometry of one entire detector, as served by art.
Definition: Geometry.h:181
std::unique_ptr< std::discrete_distribution< size_t > > fTPCDist
ActiveVolumeVertexSampler(const fhicl::ParameterSet &pset, rndm::NuRandomService &rand_service, const geo::Geometry &geom, const std::string &generator_name)
Namespace collecting geometry-related classes utilities.
An art service to assist in the distribution of guaranteed unique seeds to all engines within an art ...
Event Generation using GENIE, cosmics or single particles.
map< int, array< map< int, double >, 2 >> Table
Definition: plot.C:18