ATLAS Offline Software
Loading...
Searching...
No Matches
ActsTrk::JSONDeviceMagFieldProviderSvc Class Reference

Service providing magnetic field description from JSON files. More...

#include <JSONDeviceMagFieldProviderSvc.h>

Inheritance diagram for ActsTrk::JSONDeviceMagFieldProviderSvc:
Collaboration diagram for ActsTrk::JSONDeviceMagFieldProviderSvc:

Public Member Functions

virtual StatusCode initialize () override
 Function initializing and executing the file loading.
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Private Attributes

ServiceHandle< StoreGateSvcm_detStore {this, "DetectorStore", "StoreGateSvc/DetectorStore"}
ToolHandle< ActsTrk::IDeviceMagFieldProviderToolm_deviceFieldProviderTool
 The device magnetic field provider tool.
The input JSON file names, path resolved with PathResolver
Gaudi::Property< std::string > m_magFieldFile
The output object names
Gaudi::Property< std::string > m_hostMagFieldObjectName
Gaudi::Property< std::string > m_deviceMagFieldObjectName

Detailed Description

Service providing magnetic field description from JSON files.

This service loads magnetic field data from JSON files, which are needed for executing track parameter estimation and track reconstruction on GPU.

All objects are recorded to detector store as pointers to device objects. Note that the different implementations require different tools to make the device copy.

Author
Neža Ribarič neza..nosp@m.riba.nosp@m.ric@c.nosp@m.ern..nosp@m.ch

Definition at line 29 of file JSONDeviceMagFieldProviderSvc.h.

Member Function Documentation

◆ initialize()

StatusCode ActsTrk::JSONDeviceMagFieldProviderSvc::initialize ( )
overridevirtual

Function initializing and executing the file loading.

Definition at line 15 of file JSONDeviceMagFieldProviderSvc.cxx.

16{
17 ATH_MSG_DEBUG("Initializing device magnetic field provider service ");
18
20 ATH_CHECK(m_detStore.retrieve());
21
22 traccc::magnetic_field hostMagField;
23
24 if (m_magFieldFile.value().empty()) {
25 ATH_MSG_FATAL("MagFieldFile is empty!");
26 return StatusCode::FAILURE;
27 }
28
29 ATH_MSG_INFO("Reading mag field from file: " << PathResolverFindCalibFile(m_magFieldFile.value()));
30
31 // Construct host magnetic field
32 ATH_MSG_INFO("Loading traccc magnetic field");
33 traccc::io::read_magnetic_field(
34 hostMagField,
36
37 ATH_MSG_INFO("Magnetic field built from file");
38
39 // Construct device field
40 traccc::magnetic_field deviceMagField = m_deviceFieldProviderTool->getDeviceMagneticField(hostMagField);
41
42 // Record host and device objects
43 constexpr bool allowMods = false;
44 ATH_CHECK(m_detStore->record(
45 std::make_unique<traccc::magnetic_field>(std::move(hostMagField)),
46 m_hostMagFieldObjectName.value(), allowMods));
47
48 ATH_CHECK(m_detStore->record(
49 std::make_unique<traccc::magnetic_field>(std::move(deviceMagField)),
50 m_deviceMagFieldObjectName.value(), allowMods));
51
52
53 ATH_MSG_DEBUG("Successfully initialized");
54 return StatusCode::SUCCESS;
55}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
ToolHandle< ActsTrk::IDeviceMagFieldProviderTool > m_deviceFieldProviderTool
The device magnetic field provider tool.
Gaudi::Property< std::string > m_hostMagFieldObjectName
Gaudi::Property< std::string > m_deviceMagFieldObjectName

◆ msg()

MsgStream & AthCommonMsg< Service >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Service >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

Member Data Documentation

◆ m_detStore

ServiceHandle<StoreGateSvc> ActsTrk::JSONDeviceMagFieldProviderSvc::m_detStore {this, "DetectorStore", "StoreGateSvc/DetectorStore"}
private

Definition at line 41 of file JSONDeviceMagFieldProviderSvc.h.

41{this, "DetectorStore", "StoreGateSvc/DetectorStore"};

◆ m_deviceFieldProviderTool

ToolHandle<ActsTrk::IDeviceMagFieldProviderTool> ActsTrk::JSONDeviceMagFieldProviderSvc::m_deviceFieldProviderTool
private
Initial value:
{
this, "DeviceMagFieldProviderTool", "",
"The device magnetic field provider tool"}

The device magnetic field provider tool.

Definition at line 44 of file JSONDeviceMagFieldProviderSvc.h.

44 {
45 this, "DeviceMagFieldProviderTool", "",
46 "The device magnetic field provider tool"};

◆ m_deviceMagFieldObjectName

Gaudi::Property<std::string> ActsTrk::JSONDeviceMagFieldProviderSvc::m_deviceMagFieldObjectName
private
Initial value:
{
this, "DeviceMagFieldObjectName", "",
"Traccc device magnetic field object"}

Definition at line 60 of file JSONDeviceMagFieldProviderSvc.h.

60 {
61 this, "DeviceMagFieldObjectName", "",
62 "Traccc device magnetic field object"};

◆ m_hostMagFieldObjectName

Gaudi::Property<std::string> ActsTrk::JSONDeviceMagFieldProviderSvc::m_hostMagFieldObjectName
private
Initial value:
{
this, "HostMagFieldObjectName", "",
"Traccc host magnetic field object"}

Definition at line 57 of file JSONDeviceMagFieldProviderSvc.h.

57 {
58 this, "HostMagFieldObjectName", "",
59 "Traccc host magnetic field object"};

◆ m_magFieldFile

Gaudi::Property<std::string> ActsTrk::JSONDeviceMagFieldProviderSvc::m_magFieldFile
private
Initial value:
{
this, "MagFieldFile", "",
"Magnetic field JSON file"}

Definition at line 50 of file JSONDeviceMagFieldProviderSvc.h.

50 {
51 this, "MagFieldFile", "",
52 "Magnetic field JSON file"};

The documentation for this class was generated from the following files: