Project
Loading...
Searching...
No Matches
G4FieldCache.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
13
14#include <G4Field.hh>
15#include <G4FieldManager.hh>
16#include <G4FieldManagerStore.hh>
17
18namespace o2::simsetup
19{
20
22{
23 // the field caches reuse their value only near the last point, so one query far away invalidates them
24 constexpr G4double farAway[4] = {1.e12, 1.e12, 1.e12, 0.};
25 G4double value[6];
26 // the field manager store holds the field managers of the calling thread
27 for (auto manager : *G4FieldManagerStore::GetInstance()) {
28 if (auto field = manager->GetDetectorField()) {
29 field->GetFieldValue(farAway, value);
30 }
31 }
32}
33
34} // namespace o2::simsetup
GLsizei const GLfloat * value
Definition glcorearb.h:819
void invalidateFieldCache()
Makes the cached magnetic fields of the calling Geant4 thread forget their last value.