Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4ErrorTrackLengthTarget.cc
이 파일의 문서화 페이지로 가기
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4ErrorTrackLengthTarget.cc 91809 2015-08-06 13:00:09Z gcosmo $
27 //
28 // ------------------------------------------------------------
29 // GEANT 4 class implementation file
30 // ------------------------------------------------------------
31 //
32 
34 
35 #include "G4ParticleTable.hh"
36 #include "G4ParticleDefinition.hh"
37 #include "G4VProcess.hh"
38 #include "G4ProcessVector.hh"
39 #include "G4ProcessManager.hh"
40 
41 #ifdef G4VERBOSE
42 #include "G4ErrorPropagatorData.hh" //for verbosity checking
43 #endif
44 
45 //----------------------------------------------------------------------------
47 G4ErrorTrackLengthTarget(const G4double maxTrkLength )
48  : G4VDiscreteProcess ("G4ErrorTrackLengthTarget"),
49  theMaximumTrackLength( maxTrkLength )
50 {
52 
55 
56  // loop over all particles in G4ParticleTable
57 
58  theParticleIterator->reset();
59  while( (*theParticleIterator)() ) // Loop checking, 06.08.2015, G.Cosmo
60  {
61  G4ParticleDefinition* particle = theParticleIterator->value();
62  G4ProcessManager* pmanager = particle->GetProcessManager();
63  if (!particle->IsShortLived())
64  {
65  // Add transportation process for all particles other than "shortlived"
66  if ( pmanager == 0)
67  {
68  // Error !! no process manager
69  G4String particleName = particle->GetParticleName();
70  G4Exception("G4ErrorTrackLengthTarget::G4ErrorTrackLengthTarget",
71  "No process manager", RunMustBeAborted, particleName );
72  }
73  else
74  {
75  G4ProcessVector* procvec = pmanager->GetProcessList();
76  size_t isiz = procvec->size();
77 
78  for( size_t ii=0; ii < isiz; ii++ )
79  {
80  if( ((*procvec)[ii])->GetProcessName() == "G4ErrorTrackLengthTarget")
81  {
82  pmanager->RemoveProcess( (*procvec)[ii] );
83  }
84  }
85  pmanager ->AddDiscreteProcess(this,4);
86  isiz = procvec->size();
87  }
88  }
89  else
90  {
91  // shortlived particle case
92  }
93  }
94 }
95 
96 
97 //-----------------------------------------------------------------------
101 {
102  *condition = NotForced;
103  return GetMeanFreePath( track, 0., condition );
104 }
105 
106 
107 //-----------------------------------------------------------------------
110 {
111 #ifdef G4VERBOSE
113  {
114  G4cout << " G4ErrorTrackLengthTarget::GetMeanFreePath "
116  }
117 #endif
118 
119  return theMaximumTrackLength - track.GetTrackLength();
120 }
121 
122 
124 PostStepDoIt(const G4Track& aTrack, const G4Step& )
125 {
127  return &theParticleChange;
128 }
129 
130 
131 //-----------------------------------------------------------------------
132 void G4ErrorTrackLengthTarget::Dump( const G4String& msg ) const
133 {
134  G4cout << msg << "G4ErrorTrackLengthTarget: max track length = "
136 }
G4ErrorTrackLengthTarget(const G4double maxTrkLength)
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
static G4ParticleTable * GetParticleTable()
#define theParticleIterator
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
#define G4endl
Definition: G4ios.hh:61
const G4String & GetParticleName() const
G4double condition(const G4ErrorSymMatrix &m)
G4ProcessVector * GetProcessList() const
G4PTblDicIterator * GetIterator() const
void reset(G4bool ifSkipIon=true)
virtual void Initialize(const G4Track &)
G4double GetTrackLength() const
double G4double
Definition: G4Types.hh:76
G4ErrorTargetType theType
const G4String & GetProcessName() const
Definition: G4VProcess.hh:411
Definition: G4Step.hh:76
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
G4ProcessManager * GetProcessManager() const
G4ForceCondition
G4VProcess * RemoveProcess(G4VProcess *aProcess)
G4int size() const
G4GLOB_DLL std::ostream G4cout
virtual void Dump(const G4String &msg) const
virtual G4double GetMeanFreePath(const class G4Track &track, G4double, G4ForceCondition *)