ATLAS Offline Software
Loading...
Searching...
No Matches
G4MagFieldSvcBase.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "G4MagFieldSvcBase.h"
6
7#include <memory>
8
9// Geant4 includes
10#include "G4MagneticField.hh"
11
12//-----------------------------------------------------------------------------
13// Implementation file for class : G4MagFieldSvcBase
14//
15// 2015-11-17: Andrea Dell'Acqua
16//-----------------------------------------------------------------------------
17
18
19//=============================================================================
20// Standard constructor, initializes variables
21//=============================================================================
23 ISvcLocator* pSvcLocator)
24 : base_class(name, pSvcLocator)
25{
26}
27
28//=============================================================================
29// Retrieve a G4 mag field object
30//=============================================================================
32{
33 ATH_MSG_DEBUG("G4MagFieldSvcBase::getField");
34
35 // create a thread-local magnetic field instance
36 static thread_local std::unique_ptr<G4MagneticField> field{makeField()};
37
38 return field.get();
39}
#define ATH_MSG_DEBUG(x)
G4MagFieldSvcBase(const std::string &name, ISvcLocator *pSvcLocator)
Standard constructor.
G4MagneticField * getField() override final
Retrieve a G4 magnetic field object.
virtual G4MagneticField * makeField()=0
This method must be overridden by concrete tools to create a new field.