BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSFieldManager.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#include "BDSDebug.hh"
19#include "BDSFieldManager.hh"
20#include "BDSIntegratorMag.hh"
21#ifdef BDSDEBUG
22#include "BDSUtilities.hh"
23#endif
24
25#include "G4Track.hh"
26
27BDSFieldManager::BDSFieldManager(G4Field* field,
28 G4ChordFinder* chordFinder,
29 G4bool fieldChangesEnergy):
30 G4FieldManager(field, chordFinder, fieldChangesEnergy),
31 currentTrackIsPrimary(false)
32{;}
33
34BDSFieldManager::BDSFieldManager(G4MagneticField* field):
35 G4FieldManager(field),
36 currentTrackIsPrimary(false)
37{;}
38
39void BDSFieldManager::ConfigureForTrack(const G4Track* track)
40{
41 currentTrackIsPrimary = track->GetParentID() == 0;
43#ifdef BDSDEBUG
44 G4cout << __METHOD_NAME__ << "Primary? " << BDS::BoolToString(currentTrackIsPrimary) << G4endl;
45#endif
46}
virtual void ConfigureForTrack(const G4Track *track)
G4bool currentTrackIsPrimary
Whether current track is a primary.
static G4bool currentTrackIsPrimary