19 #include <boost/program_options.hpp>
21 #if ((BOOST_VERSION / 100) % 1000) <= 71
23 #include <boost/progress.hpp>
27 #include <boost/timer/progress_display.hpp>
38 namespace po = boost::program_options;
45 size_t events,
size_t theta_steps,
double theta_0,
46 double theta_step,
size_t phi_steps,
double phi_0,
47 double phi_step,
size_t access_steps,
double access_step) {
48 std::cout <<
"[>>>] Start: step-wise access pattern ... " << std::endl;
50 auto bCache = bField.makeCache(bFieldContext);
52 size_t totalSteps = events * theta_steps * phi_steps * access_steps;
56 for (
size_t ievt = 0; ievt <
events; ++ievt) {
57 for (
size_t itheta = 0; itheta < theta_steps; ++itheta) {
58 double theta = theta_0 + itheta * theta_step;
59 for (
size_t iphi = 0; iphi < phi_steps; ++iphi) {
60 double phi = phi_0 + iphi * phi_step;
62 Acts::Vector3 dir(cos(phi) * sin(theta), sin(phi) * sin(theta),
65 double currentStep = 0.;
67 for (
size_t istep = 0; istep < access_steps; ++istep) {
70 auto field_from_cache = bField.getField(position,
bCache);
71 (void)field_from_cache;
73 currentStep += access_step;
79 std::cout <<
"[<<<] End result: total steps:" << totalSteps << std::endl;
85 size_t totalSteps,
double radius) {
86 std::cout <<
"[>>>] Start: random access pattern ... " << std::endl;
93 auto bCache = bField.makeCache(bFieldContext);
98 for (
size_t istep = 0; istep < totalSteps; ++istep) {
101 auto field_from_cache = bField.getField(position,
bCache);
102 (void)field_from_cache;
106 std::cout <<
"[<<<] End result: total steps: " << totalSteps << std::endl;
113 int main(
int argc,
char* argv[]) {
120 po::value<ActsExamples::Options::Reals<2>>()->default_value(
122 "range in which the phi parameter is generated.")(
124 po::value<ActsExamples::Options::Reals<2>>()->default_value({{0., M_PI}}),
125 "range in which the eta parameter is generated.")(
126 "bf-phisteps", po::value<size_t>()->default_value(1000),
127 "number of steps for the phi parameter.")(
128 "bf-thetasteps", po::value<size_t>()->default_value(100),
129 "number of steps for the eta parameter.")(
130 "bf-accesssteps", po::value<size_t>()->default_value(100),
131 "number of steps for magnetic field access.")(
132 "bf-tracklength", po::value<double>()->default_value(100.),
133 "track length in [mm] magnetic field access.");
153 size_t phi_steps = vm[
"bf-phisteps"].as<
size_t>();
154 size_t theta_steps = vm[
"bf-thetasteps"].as<
size_t>();
156 size_t access_steps = vm[
"bf-accesssteps"].as<
size_t>();
157 double track_length =
162 double phi_span = std::abs(phir[1] - phir[0]);
163 double phi_step = phi_span / phi_steps;
164 double theta_span = std::abs(thetar[1] - thetar[0]);
165 double theta_step = theta_span / theta_steps;
166 double access_step = track_length / access_steps;
169 theta_step, phi_steps, phir[0], phi_step, access_steps,
173 nEvents * theta_steps * phi_steps * access_steps, track_length);