@@ -49,18 +49,35 @@ generation::generation() : interface("Particle Generation Options") {
49
49
" gen-eta" ,
50
50
po::value (&eta_range)->value_name (" MIN:MAX" )->default_value (eta_range),
51
51
" Range of eta" );
52
+ m_desc.add_options ()(" gen-theta" ,
53
+ po::value (&theta_range)
54
+ ->value_name (" MIN:MAX" )
55
+ ->default_value (theta_range),
56
+ " Range of theta in degree" );
52
57
m_desc.add_options ()(" particle-type" ,
53
58
po::value<int >(&pdg_number)->default_value (pdg_number),
54
59
" PDG number for the particle type" );
55
60
}
56
61
57
- void generation::read (const po::variables_map&) {
62
+ void generation::read (const po::variables_map& vm ) {
58
63
59
64
vertex *= detray::unit<float >::mm;
60
65
vertex_stddev *= detray::unit<float >::mm;
61
66
mom_range *= detray::unit<float >::GeV;
62
67
phi_range *= detray::unit<float >::degree;
63
- theta_range = eta_to_theta_range (eta_range);
68
+
69
+ // The eta and theta range can not be specified at the same time
70
+ if (vm.count (" gen-eta" ) && !vm[" gen-eta" ].defaulted () &&
71
+ vm.count (" gen-theta" ) && !vm[" gen-theta" ].defaulted ()) {
72
+ throw std::logic_error (
73
+ std::string (" Conflicting options 'gen-eta' and 'gen-theta'" ));
74
+ } else if (vm.count (" gen-eta" ) && !vm[" gen-eta" ].defaulted ()) {
75
+ theta_range = eta_to_theta_range (eta_range);
76
+ } else if (vm.count (" gen-theta" ) && !vm[" gen-theta" ].defaulted ()) {
77
+ theta_range *= detray::unit<float >::degree;
78
+ eta_range = theta_to_eta_range (theta_range);
79
+ }
80
+
64
81
ptc_type = detail::particle_from_pdg_number<traccc::scalar>(pdg_number);
65
82
}
66
83
0 commit comments