LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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/ParameterSet.h"
22 #include "fhiclcpp/types/Table.h"
23 #include "cetlib_except/exception.h"
25 
26 // art extensions
28 
29 // LArSoft includes
31 
32 // ROOT includes
33 #include "TLorentzVector.h"
34 
35 namespace evgen {
36 
38 
39  public:
40 
41  using Name = fhicl::Name;
43 
46  struct Config {
48  Name("type"),
49  Comment("Technique used to choose vertex locations"),
50  "sampled" // default value
51  };
52 
54  Name("seed"),
55  Comment("Seed used for sampling vertex locations"),
56  [this]() -> bool { return type_() == "sampled"; }
57  };
58 
60  Name("position"),
61  Comment("Coordinates of the fixed vertex position"),
62  [this]() -> bool { return type_() == "fixed"; }
63  };
64 
65  }; // struct Config
66 
67  enum class vertex_type_t { kSampled, kFixed };
68 
69  // Configuration-checking constructors
71  rndm::NuRandomService& rand_service, const geo::Geometry& geom,
72  const std::string& generator_name);
73 
75  rndm::NuRandomService& rand_service, const geo::Geometry& geom,
76  const std::string& generator_name)
77  : ActiveVolumeVertexSampler(fhicl::Table<Config>(pset, {}),
78  rand_service, geom, generator_name) {}
79 
80  void reconfigure(const fhicl::Table<Config>& conf,
81  const geo::Geometry& geom);
82 
83  // Function that selects a primary vertex location for each event.
84  // TODO: add time sampling
85  TLorentzVector sample_vertex_pos(const geo::Geometry& geom);
86 
87  protected:
88 
89  // Currently sampled vertex position (doesn't change value if the vertex
90  // is fixed)
91  TLorentzVector fVertexPosition;
92 
94 
95  std::string fGeneratorName;
96 
97  // Discrete distribution object used to sample TPCs based on their active
98  // masses
99  std::unique_ptr<std::discrete_distribution<size_t> > fTPCDist;
100 
101  // RNG object used to sample TPCs
102  std::mt19937_64 fTPCEngine;
103 
104  }; // class evgen::ActiveVolumeVertexSampler
105 
106 } // namespace evgen
107 
108 #endif
TLorentzVector sample_vertex_pos(const geo::Geometry &geom)
ActiveVolumeVertexSampler(const fhicl::Table< Config > &conf, rndm::NuRandomService &rand_service, const geo::Geometry &geom, const std::string &generator_name)
parameter set interface
The geometry of one entire detector, as served by art.
Definition: Geometry.h:110
An art service to assist in the distribution of guaranteed unique seeds to all engines within an art ...
fhicl::OptionalAtom< std::string > seed_
void reconfigure(const fhicl::Table< Config > &conf, const geo::Geometry &geom)
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)
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.
art framework interface to geometry description