68 const auto& tpc = geom.
TPC(tpc_index);
69 double minX = tpc.
MinX();
70 double maxX = tpc.MaxX();
71 double minY = tpc.MinY();
72 double maxY = tpc.MaxY();
73 double minZ = tpc.MinZ();
74 double maxZ = tpc.MaxZ();
75 std::uniform_real_distribution<double>::param_type x_range(minX, maxX);
76 std::uniform_real_distribution<double>::param_type y_range(minY, maxY);
77 std::uniform_real_distribution<double>::param_type z_range(minZ, maxZ);
80 std::uniform_real_distribution<double> uniform_dist;
85 <<
"Sampled primary vertex in TPC #" << tpc_index <<
", x = " << x
86 <<
", y = " << y <<
", z = " <<
z;
93 int num_iterations = 0;
97 std::uniform_real_distribution<double>::param_type x_range(
fXmin,
fXmax);
98 std::uniform_real_distribution<double>::param_type y_range(
fYmin,
fYmax);
99 std::uniform_real_distribution<double>::param_type z_range(
fZmin,
fZmax);
102 std::uniform_real_distribution<double> uniform_dist;
107 while ( !ok && num_iterations < MAX_BOX_ITERATIONS ) {
116 size_t num_tpcs = geom.
NTPC();
117 for (
size_t iTPC = 0; iTPC < num_tpcs; ++iTPC) {
118 const auto& tpc = geom.
TPC(iTPC);
119 double minX = tpc.
MinX();
120 double maxX = tpc.MaxX();
121 double minY = tpc.MinY();
122 double maxY = tpc.MaxY();
123 double minZ = tpc.MinZ();
124 double maxZ = tpc.MaxZ();
125 if ( x >= minX && x <= maxX && y >= minY && y <= maxY && z >= minZ && z <= maxZ ) {
135 <<
"Failed to sample a vertex within a TPC active volume after " << MAX_BOX_ITERATIONS
139 <<
"Sampled primary vertex at x = " << x <<
", y = " << y
vertex_type_t fVertexType
TLorentzVector fVertexPosition
double MinX() const
Returns the world x coordinate of the start of the box.
#define MF_LOG_INFO(category)
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
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
cet::coded_exception< error, detail::translate > exception
std::mt19937_64 fTPCEngine