Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PropagationOptions.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PropagationOptions.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
14 
15 #include <iostream>
16 
17 #include <boost/program_options.hpp>
18 
19 #include "PropagationAlgorithm.hpp"
20 
21 namespace ActsExamples {
22 
23 namespace Options {
24 
29  boost::program_options::options_description& opt) {
30  namespace po = boost::program_options;
31  using namespace Acts::UnitLiterals;
32  opt.add_options()(
33  "prop-debug", po::value<bool>()->default_value(false),
34  "Run in debug mode, will create propagation screen output.")(
35  "prop-step-collection",
36  po::value<std::string>()->default_value("propagation-steps"),
37  "Propgation step collection.")(
38  "prop-stepper", po::value<int>()->default_value(1),
39  "Propgation type: 0 (StraightLine), 1 (Eigen), 2 (Atlas).")(
40  "prop-mode", po::value<int>()->default_value(0),
41  "Propgation modes: 0 (inside-out), 1 (surface to surface).")(
42  "prop-cov", po::value<bool>()->default_value(false),
43  "Propagate (random) test covariances.")(
44  "prop-energyloss", po::value<bool>()->default_value(true),
45  "Apply energy loss correction - in extrapolation mode only.")(
46  "prop-scattering", po::value<bool>()->default_value(true),
47  "Apply scattering correction - in extrapolation mode only.")(
48  "prop-record-material", po::value<bool>()->default_value(true),
49  "Record the material interaction and - in extrapolation mode only.")(
50  "prop-material-collection",
51  po::value<std::string>()->default_value("propagation-material"),
52  "Propagation material collection.")(
53  "prop-ntests", po::value<size_t>()->default_value(1000),
54  "Number of tests performed.")("prop-resolve-material",
55  po::value<bool>()->default_value(true),
56  "Resolve all smaterial surfaces.")(
57  "prop-resolve-passive", po::value<bool>()->default_value(false),
58  "Resolve all passive surfaces.")("prop-resolve-sensitive",
59  po::value<bool>()->default_value(true),
60  "Resolve all sensitive surfaces.")(
61  "prop-d0-sigma", po::value<double>()->default_value(15_um),
62  "Sigma of the transverse impact parameter [in mm].")(
63  "prop-z0-sigma", po::value<double>()->default_value(55_mm),
64  "Sigma of the longitudinal impact parameter [in mm].")(
65  "prop-phi-sigma", po::value<double>()->default_value(0.001),
66  "Sigma of the azimuthal angle [in rad].")(
67  "prop-theta-sigma", po::value<double>()->default_value(0.001),
68  "Sigma of the polar angle [in rad].")(
69  "prop-qp-sigma", po::value<double>()->default_value(0.0001 / 1_GeV),
70  "Sigma of the signed inverse momentum [in GeV^{-1}].")(
71  "prop-t-sigma", po::value<double>()->default_value(1_ns),
72  "Sigma of the time parameter [in ns].")(
73  "prop-corr-offd", po::value<Reals<15>>(),
74  "The 15 off-diagonal correlation rho(d0,z0), rho(d0,phi), [...], "
75  "rho(z0,phi), rho(z0, theta), [...], rho(qop,t). Row-wise.")(
76  "prop-phi-range", po::value<Reals<2>>()->default_value({{-M_PI, M_PI}}),
77  "Azimutal angle phi range for proprapolated tracks.")(
78  "prop-eta-range", po::value<Reals<2>>()->default_value({{-4., 4.}}),
79  "Pseudorapidity range for proprapolated tracks.")(
80  "prop-pt-range",
81  po::value<Reals<2>>()->default_value({{100_MeV, 100_GeV}}),
82  "Transverse momentum range for proprapolated tracks [in GeV].")(
83  "prop-max-stepsize", po::value<double>()->default_value(3_m),
84  "Maximum step size for the propagation [in mm].")(
85  "prop-pt-loopers", po::value<double>()->default_value(500_MeV),
86  "Transverse momentum below which loops are being detected [in GeV].");
87 }
88 
96  const boost::program_options::variables_map& vm) {
97  using namespace Acts::UnitLiterals;
99 
100  auto iphir = vm["prop-phi-range"].template as<Reals<2>>();
101  auto ietar = vm["prop-eta-range"].template as<Reals<2>>();
102  auto iptr = vm["prop-pt-range"].template as<Reals<2>>();
103 
105  pAlgConfig.energyLoss = vm["prop-energyloss"].template as<bool>();
106  pAlgConfig.multipleScattering = vm["prop-scattering"].template as<bool>();
107  pAlgConfig.recordMaterialInteractions =
108  vm["prop-record-material"].template as<bool>();
109 
111  pAlgConfig.debugOutput = vm["prop-debug"].template as<bool>();
112  pAlgConfig.ntests = vm["prop-ntests"].template as<size_t>();
113  pAlgConfig.mode = vm["prop-mode"].template as<int>();
114  pAlgConfig.d0Sigma = vm["prop-d0-sigma"].template as<double>() * 1_mm;
115  pAlgConfig.z0Sigma = vm["prop-z0-sigma"].template as<double>() * 1_mm;
116  pAlgConfig.phiSigma = vm["prop-phi-sigma"].template as<double>();
117  pAlgConfig.thetaSigma = vm["prop-theta-sigma"].template as<double>();
118  pAlgConfig.qpSigma = vm["prop-qp-sigma"].template as<double>() / 1_GeV;
119  pAlgConfig.tSigma = vm["prop-t-sigma"].template as<double>() * 1_ns;
120 
121  pAlgConfig.phiRange = {iphir[0], iphir[1]};
122  pAlgConfig.etaRange = {ietar[0], ietar[1]};
123  pAlgConfig.ptRange = {iptr[0] * 1_GeV, iptr[1] * 1_GeV};
124  pAlgConfig.ptLoopers = vm["prop-pt-loopers"].template as<double>() * 1_GeV;
125  pAlgConfig.maxStepSize = vm["prop-max-stepsize"].template as<double>() * 1_mm;
126 
127  pAlgConfig.propagationStepCollection =
128  vm["prop-step-collection"].template as<std::string>();
129  pAlgConfig.propagationMaterialCollection =
130  vm["prop-material-collection"].template as<std::string>();
131 
133  if (vm["prop-cov"].template as<bool>()) {
135  pAlgConfig.covarianceTransport = true;
137  pAlgConfig.covariances(Acts::BoundIndices::eBoundLoc0) =
138  pAlgConfig.d0Sigma * pAlgConfig.d0Sigma;
139  pAlgConfig.covariances(Acts::BoundIndices::eBoundLoc1) =
140  pAlgConfig.z0Sigma * pAlgConfig.z0Sigma;
141  pAlgConfig.covariances(Acts::BoundIndices::eBoundPhi) =
142  pAlgConfig.phiSigma * pAlgConfig.phiSigma;
143  pAlgConfig.covariances(Acts::BoundIndices::eBoundTheta) =
144  pAlgConfig.thetaSigma * pAlgConfig.thetaSigma;
145  pAlgConfig.covariances(Acts::BoundIndices::eBoundQOverP) =
146  pAlgConfig.qpSigma * pAlgConfig.qpSigma;
147  pAlgConfig.covariances(Acts::BoundIndices::eBoundTime) =
148  pAlgConfig.tSigma * pAlgConfig.tSigma;
149 
150  // Only if they are properly defined, assign off-diagonals
151  if (vm.count("prop-corr-offd") != 0u) {
152  auto readOffd = vm["prop-corr-offd"].template as<Reals<15>>();
153  pAlgConfig.correlations(Acts::BoundIndices::eBoundLoc0,
154  Acts::BoundIndices::eBoundLoc1) = readOffd[0];
155  pAlgConfig.correlations(Acts::BoundIndices::eBoundLoc0,
156  Acts::BoundIndices::eBoundPhi) = readOffd[1];
157  pAlgConfig.correlations(Acts::BoundIndices::eBoundLoc0,
158  Acts::BoundIndices::eBoundTheta) = readOffd[2];
159  pAlgConfig.correlations(Acts::BoundIndices::eBoundLoc0,
160  Acts::BoundIndices::eBoundQOverP) = readOffd[3];
161  pAlgConfig.correlations(Acts::BoundIndices::eBoundLoc0,
162  Acts::BoundIndices::eBoundTime) = readOffd[4];
163  pAlgConfig.correlations(Acts::BoundIndices::eBoundLoc1,
164  Acts::BoundIndices::eBoundPhi) = readOffd[5];
165  pAlgConfig.correlations(Acts::BoundIndices::eBoundLoc1,
166  Acts::BoundIndices::eBoundTheta) = readOffd[6];
167  pAlgConfig.correlations(Acts::BoundIndices::eBoundLoc1,
168  Acts::BoundIndices::eBoundQOverP) = readOffd[7];
169  pAlgConfig.correlations(Acts::BoundIndices::eBoundLoc1,
170  Acts::BoundIndices::eBoundTime) = readOffd[8];
171  pAlgConfig.correlations(Acts::BoundIndices::eBoundPhi,
172  Acts::BoundIndices::eBoundTheta) = readOffd[9];
173  pAlgConfig.correlations(Acts::BoundIndices::eBoundPhi,
174  Acts::BoundIndices::eBoundQOverP) = readOffd[10];
175  pAlgConfig.correlations(Acts::BoundIndices::eBoundPhi,
176  Acts::BoundIndices::eBoundTime) = readOffd[11];
177  pAlgConfig.correlations(Acts::BoundIndices::eBoundTheta,
178  Acts::BoundIndices::eBoundQOverP) = readOffd[12];
179  pAlgConfig.correlations(Acts::BoundIndices::eBoundTheta,
180  Acts::BoundIndices::eBoundTime) = readOffd[13];
181  pAlgConfig.correlations(Acts::BoundIndices::eBoundQOverP,
182  Acts::BoundIndices::eBoundTime) = readOffd[14];
183  } else {
185  pAlgConfig.correlations(Acts::BoundIndices::eBoundLoc0,
187  pAlgConfig.correlations(Acts::BoundIndices::eBoundLoc0,
189  pAlgConfig.correlations(Acts::BoundIndices::eBoundLoc1,
191  pAlgConfig.correlations(Acts::BoundIndices::eBoundPhi,
193  }
194  }
195 
196  return pAlgConfig;
197 }
198 
199 } // namespace Options
200 } // namespace ActsExamples