16 const std::string& generator_name)
17 : fVertexType(
vertex_type_t::kSampled), fGeneratorName(generator_name),
30 auto seed =
static_cast<uint_fast64_t
>(lar_seed);
35 std::seed_seq seed_sequence{
seed};
43 uint_fast64_t tpc_cast_seed =
static_cast<uint_fast64_t
>(tpc_seed);
44 std::seed_seq tpc_seed_sequence{tpc_cast_seed};
59 const auto& tpc = geom.
TPC(tpc_index);
60 double minX = tpc.
MinX();
61 double maxX = tpc.MaxX();
62 double minY = tpc.MinY();
63 double maxY = tpc.MaxY();
64 double minZ = tpc.MinZ();
65 double maxZ = tpc.MaxZ();
66 std::uniform_real_distribution<double>::param_type x_range(minX, maxX);
67 std::uniform_real_distribution<double>::param_type y_range(minY, maxY);
68 std::uniform_real_distribution<double>::param_type z_range(minZ, maxZ);
71 static std::uniform_real_distribution<double> uniform_dist;
76 <<
"Sampled primary vertex in TPC #" << tpc_index <<
", x = " << x
77 <<
", y = " << y <<
", z = " <<
z;
93 auto type = conf().type_();
94 if (type ==
"sampled") {
100 std::vector<double> tpc_masses;
101 size_t num_tpcs = geom.
NTPC();
102 for (
size_t iTPC = 0; iTPC < num_tpcs; ++iTPC) {
110 fTPCDist.reset(
new std::discrete_distribution<size_t>(tpc_masses.begin(),
113 else if (type ==
"fixed") {
117 auto vertex_pos = conf().position_();
118 double Vx = vertex_pos.at(0);
119 double Vy = vertex_pos.at(0);
120 double Vz = vertex_pos.at(0);
125 <<
"Invalid vertex type '" << type <<
"' requested. Allowed values are" 126 <<
" 'sampled' and 'fixed'";
vertex_type_t fVertexType
#define LOG_INFO(category)
TLorentzVector fVertexPosition
double MinX() const
Returns the world x coordinate of the start of the box.
ParameterSet const & get_PSet() const
TLorentzVector sample_vertex_pos(const geo::Geometry &geom)
double ActiveMass() const
Half width (associated with x coordinate) of active TPC volume [cm].
art::RandomNumberGenerator::seed_t seed_t
ActiveVolumeVertexSampler(const fhicl::Table< Config > &conf, rndm::NuRandomService &rand_service, const geo::Geometry &geom, const std::string &generator_name)
Algorithm that samples vertex locations uniformly within the active volume of a detector. It is fully experiment-agnostic and multi-TPC aware.
Identifier for a engine, made of module name and optional instance name.
The geometry of one entire detector, as served by art.
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
void reconfigure(const fhicl::Table< Config > &conf, const geo::Geometry &geom)
std::unique_ptr< std::discrete_distribution< size_t > > fTPCDist
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
std::string fGeneratorName
An art service to assist in the distribution of guaranteed unique seeds to all engines within an art ...
seed_t registerEngine(SeedMaster_t::Seeder_t seeder, std::string instance="")
Registers an existing engine with NuRandomService.
cet::coded_exception< error, detail::translate > exception
std::mt19937_64 fTPCEngine