ATLAS Offline Software
Loading...
Searching...
No Matches
MagFieldCondReader.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7MagField::CondReader::CondReader(const std::string& name, ISvcLocator* pSvcLocator) :
8 AthReentrantAlgorithm(name, pSvcLocator)
9{}
10
12{
13 ATH_CHECK(m_fieldCacheKey.initialize());
14
15 return StatusCode::SUCCESS;
16}
17
18StatusCode MagField::CondReader::execute(const EventContext& ctx) const
19{
21 const AtlasFieldCacheCondObj* fieldCondObj{*rh};
22 if (fieldCondObj == nullptr) {
23 ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheKey.key());
24 return StatusCode::FAILURE;
25 }
26
28 fieldCondObj->getInitializedCache(fieldCache);
29
30 ATH_MSG_INFO("Field status: solenoid=" << fieldCache.solenoidOn() << ", toroids=" << fieldCache.toroidOn());
31
32 // get field at 0,0,0
33 double xyz[3] = { 100, 100, 100 };
34 double bxyz[3];
35 fieldCache. getField(xyz, bxyz);
36
37 ATH_MSG_INFO("Field xyz: " << xyz[0] << ", " << xyz[1] << ", " << xyz[2] << ", " << bxyz[0] << ", " << bxyz[1] << ", " << bxyz[2]);
38
39
40
41
42 return StatusCode::SUCCESS;
43}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define xyz
An algorithm that can be simultaneously executed in multiple threads.
void getInitializedCache(MagField::AtlasFieldCache &cache) const
get B field cache for evaluation as a function of 2-d or 3-d position.
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
bool solenoidOn() const
status of the magnets
CondReader(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode execute(const EventContext &ctx) const override
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheKey
StatusCode initialize() override