28 ISvcLocator* pSvcLocator)
35 if (m_thistSvc.retrieve().isFailure()) {
37 return StatusCode::FAILURE;
40 std::string
prefix =
"/" + m_histStream +
"/";
42 std::string
treeName = m_treeName.value();
44 m_tree =
new TTree(
treeName.c_str(),
"Magnetic field in the solenoid");
45 m_tree->Branch(
"pos", &m_xyzt,
"x/D:y/D:z/D");
46 m_tree->Branch(
"fieldFull", &m_field,
"Bx/D:By/D:Bz/D");
47 m_tree->Branch(
"deriv", &m_deriv,
48 "dBxdx/D:dBxdy/D:dBxdz/D:dBydx/D:dBydy/D:dBydz/"
49 "D:dBzdx/D:dBzdy/D:dBzdz/D");
50 m_tree->Branch(
"fieldFast", &m_fieldZR,
"Bx2/D:By2/D:Bz2/D");
51 m_tree->Branch(
"derivZR", &m_derivZR,
52 "dBxdx2/D:dBxdy2/D:dBxdz2/D:dBydx2/D:dBydy2/D:dBydz2/"
53 "D:dBzdx2/D:dBzdy2/D:dBzdz2/D");
57 return StatusCode::FAILURE;
60 return StatusCode::SUCCESS;
65 Gaudi::Hive::currentContext()};
67 if (fieldCondObj ==
nullptr) {
68 ATH_MSG_ERROR(
"Failed to retrieve AtlasFieldCacheCondObj with key "
69 << m_fieldCacheKey.key());
70 return StatusCode::FAILURE;
74 fieldCondObj->getInitializedCache(fieldCache);
76 if (m_eventsSeen == m_event) {
78 double deltaZ = (m_maxZ - m_minZ) / (m_stepsZ - 1);
79 double deltaR = (m_maxR - m_minR) / m_stepsR - 1;
82 for (
int k = 0;
k < m_stepsPhi;
k++) {
84 for (
int j = 0; j < m_stepsZ; j++) {
85 m_xyzt[2] = m_minZ +
deltaZ * j;
86 for (
int i = 0;
i < m_stepsR;
i++) {
88 m_xyzt[0] =
r *
cos(phi);
89 m_xyzt[1] =
r *
sin(phi);
91 fieldCache.
getField(m_xyzt, m_field, m_deriv);
92 fieldCache.
getFieldZR(m_xyzt, m_fieldZR,
nullptr);
94 <<
" with xyz: " << m_xyzt[0] <<
", "
95 << m_xyzt[1] <<
", " << m_xyzt[2]
96 <<
" with value " << m_field[0] <<
", "
97 << m_field[1] <<
", " << m_field[2]);
105 return StatusCode::SUCCESS;