ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MagneticField
MagFieldUtils
src
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
5
#include "
MagFieldCondReader.h
"
6
7
MagField::CondReader::CondReader
(
const
std::string& name, ISvcLocator* pSvcLocator) :
8
AthReentrantAlgorithm
(name, pSvcLocator)
9
{}
10
11
StatusCode
MagField::CondReader::initialize
()
12
{
13
ATH_CHECK
(
m_fieldCacheKey
.initialize());
14
15
return
StatusCode::SUCCESS;
16
}
17
18
StatusCode
MagField::CondReader::execute
(
const
EventContext& ctx)
const
19
{
20
SG::ReadCondHandle<AtlasFieldCacheCondObj>
rh{
m_fieldCacheKey
, ctx};
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
27
MagField::AtlasFieldCache
fieldCache;
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
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
MagFieldCondReader.h
xyz
#define xyz
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
AtlasFieldCacheCondObj
Definition
AtlasFieldCacheCondObj.h:19
AtlasFieldCacheCondObj::getInitializedCache
void getInitializedCache(MagField::AtlasFieldCache &cache) const
get B field cache for evaluation as a function of 2-d or 3-d position.
Definition
AtlasFieldCacheCondObj.h:32
MagField::AtlasFieldCache
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h).
Definition
AtlasFieldCache.h:43
MagField::AtlasFieldCache::solenoidOn
bool solenoidOn() const
status of the magnets
MagField::AtlasFieldCache::toroidOn
bool toroidOn() const
MagField::CondReader::CondReader
CondReader(const std::string &name, ISvcLocator *pSvcLocator)
Definition
MagFieldCondReader.cxx:7
MagField::CondReader::execute
StatusCode execute(const EventContext &ctx) const override
Definition
MagFieldCondReader.cxx:18
MagField::CondReader::m_fieldCacheKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheKey
Definition
MagFieldCondReader.h:25
MagField::CondReader::initialize
StatusCode initialize() override
Definition
MagFieldCondReader.cxx:11
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
Generated on
for ATLAS Offline Software by
1.17.0