ATLAS Offline Software
Loading...
Searching...
No Matches
TightMuonElseNoFieldManager.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
7#include "G4Track.hh"
8#include "G4MuonPlus.hh"
9#include "G4MuonMinus.hh"
10
12TightMuonElseNoFieldManager::TightMuonElseNoFieldManager(G4Field *detectorField, G4ChordFinder *pChordFinder, G4bool b)
13 : G4FieldManager(detectorField,pChordFinder,b)
14 , m_globalField(nullptr)
15{}
16
18TightMuonElseNoFieldManager::TightMuonElseNoFieldManager(G4MagneticField *detectorMagneticField)
19 : G4FieldManager(detectorMagneticField)
20 , m_globalField(nullptr)
21{}
22
25{
26 // If they have not been set yet, get the settings for the global field manager
27 if (nullptr==m_globalField){
28 // Ok, we're just holding it and giving it back to the base class,
29 // and this method is not const.
30 // But the G4 base class interface makes this impossible to avoid
31 // (We could avoid it if G4FieldManager also had a non-const
32 // GetDetectorField.)
33 G4Field* field_nc ATLAS_THREAD_SAFE = const_cast<G4Field*>(GetDetectorField());
34 m_globalField = field_nc;
35 }
36
37 // If this is a muon, move it in the magnetic field; otherwise turn off the stepping
38 if (track->GetDefinition()==G4MuonPlus::Definition() ||
39 track->GetDefinition()==G4MuonMinus::Definition() ){
40 SetDetectorField(m_globalField);
41 } else {
42 SetDetectorField(nullptr);
43 }
44
45}
Define macros for attributes used to control the static checker.
#define ATLAS_THREAD_SAFE
G4Field * m_globalField
Parameters of the stepper.
virtual void ConfigureForTrack(const G4Track *) override final
The one interesting method.
TightMuonElseNoFieldManager(G4Field *detectorField=0, G4ChordFinder *pChordFinder=0, G4bool b=true)
Constructor.