2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4 inline MagField::AtlasFieldCache::AtlasFieldCache(double solFieldScale,
6 const AtlasFieldMap* fieldMap)
7 : m_solScale(solFieldScale)
8 , m_torScale(torFieldScale)
13 m_meshZR = m_fieldMap->getBFieldMesh();
14 // Get solenoid zone id from field service
15 m_solZoneId = fieldMap->solenoidZoneId();
20 MagField::AtlasFieldCache::fillFieldCache(double z, double r, double phi)
22 // We have gone outside of a cache volume. For the solenoid, it is 'safe' to
23 // just check\n if we are inside the solenoid zone, and then we can find the
24 // next cache volume. For toroid, it is best to not check if we are inside
25 // the zone, and just find the zone for the current point.
26 // So we need to look up a fieldZone:
27 // 1) If we do NOT have one
28 // 2) Everytime we are in a Zone that does NOT have a solenoid ID
29 // 3) If it has solenoid ID and we are NOT inside
30 if (!m_zone3d || m_zone3d->id() != m_solZoneId ||
31 !m_zone3d->inside(z, r, phi)) {
32 m_zone3d = m_fieldMap ? m_fieldMap->findBFieldZone(z, r, phi) : nullptr;
36 // we failed to find a zone
40 m_scaleToUse = (m_zone3d->id() == m_solZoneId) ? m_solScale : m_torScale;
41 // fill the cache, pass in current scale factor
42 m_zone3d->getCache(z, r, phi, m_cache3d, m_scaleToUse);
43 // save pointer to the conductors in the zone
44 m_cond = m_zone3d->condVector();
50 MagField::AtlasFieldCache::fillFieldCacheZR(double z, double r)
56 // Not inside the solenoid zone?
57 if (!m_meshZR->inside(z, r)) {
60 // fill the cache, pass in current scale factor
61 m_meshZR->getCache(z, r, m_cacheZR, m_solScale);
66 MagField::AtlasFieldCache::solenoidOn() const
68 return m_fieldMap ? m_fieldMap->solenoidOn() && m_solScale > 0.0 : false;
72 MagField::AtlasFieldCache::toroidOn() const
74 return m_fieldMap ? m_fieldMap->toroidOn() && m_torScale > 0.0 : false;