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 | #include "G4AdjointAlongStepWeightCorrection.hh" |
---|
27 | #include "G4Step.hh" |
---|
28 | #include "G4ParticleDefinition.hh" |
---|
29 | #include "G4VParticleChange.hh" |
---|
30 | #include "G4AdjointCSManager.hh" |
---|
31 | |
---|
32 | |
---|
33 | /////////////////////////////////////////////////////// |
---|
34 | // |
---|
35 | |
---|
36 | G4AdjointAlongStepWeightCorrection::G4AdjointAlongStepWeightCorrection(const G4String& name, |
---|
37 | G4ProcessType type): G4VContinuousProcess(name, type) |
---|
38 | {fParticleChange = new G4ParticleChange(); |
---|
39 | } |
---|
40 | |
---|
41 | /////////////////////////////////////////////////////// |
---|
42 | // |
---|
43 | |
---|
44 | G4AdjointAlongStepWeightCorrection::~G4AdjointAlongStepWeightCorrection() |
---|
45 | {; |
---|
46 | } |
---|
47 | |
---|
48 | |
---|
49 | /////////////////////////////////////////////////////// |
---|
50 | // |
---|
51 | |
---|
52 | void G4AdjointAlongStepWeightCorrection::PreparePhysicsTable( |
---|
53 | const G4ParticleDefinition& ) |
---|
54 | { |
---|
55 | ; |
---|
56 | |
---|
57 | } |
---|
58 | |
---|
59 | /////////////////////////////////////////////////////// |
---|
60 | // |
---|
61 | |
---|
62 | void G4AdjointAlongStepWeightCorrection::BuildPhysicsTable(const G4ParticleDefinition& ) |
---|
63 | {; |
---|
64 | } |
---|
65 | |
---|
66 | |
---|
67 | |
---|
68 | |
---|
69 | /////////////////////////////////////////////////////// |
---|
70 | // |
---|
71 | G4VParticleChange* G4AdjointAlongStepWeightCorrection::AlongStepDoIt(const G4Track& track, |
---|
72 | const G4Step& step) |
---|
73 | { |
---|
74 | |
---|
75 | fParticleChange->Initialize(track); |
---|
76 | |
---|
77 | // Get the actual (true) Step length |
---|
78 | //---------------------------------- |
---|
79 | G4double length = step.GetStepLength(); |
---|
80 | |
---|
81 | |
---|
82 | G4double Tkin = step.GetPostStepPoint()->GetKineticEnergy(); |
---|
83 | G4ParticleDefinition* thePartDef= const_cast<G4ParticleDefinition*> (track.GetDynamicParticle()->GetDefinition()); |
---|
84 | G4double weight_correction=G4AdjointCSManager::GetAdjointCSManager()->GetContinuousWeightCorrection(thePartDef, |
---|
85 | preStepKinEnergy,Tkin, currentCouple,length); |
---|
86 | |
---|
87 | |
---|
88 | |
---|
89 | G4double new_weight=weight_correction*track.GetWeight(); |
---|
90 | fParticleChange->SetParentWeightByProcess(false); |
---|
91 | fParticleChange->SetSecondaryWeightByProcess(false); |
---|
92 | fParticleChange->ProposeParentWeight(new_weight); |
---|
93 | |
---|
94 | |
---|
95 | return fParticleChange; |
---|
96 | |
---|
97 | } |
---|