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 | // |
---|
27 | // $Id: G4FinalStateProduct.cc,v 1.7 2009/06/10 13:32:36 mantero Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-04-ref-00 $ |
---|
29 | // |
---|
30 | // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) |
---|
31 | // |
---|
32 | // Reference: TNS Geant4-DNA paper |
---|
33 | // Reference for implementation model: NIM. 155, pp. 145-156, 1978 |
---|
34 | |
---|
35 | // History: |
---|
36 | // ----------- |
---|
37 | // Date Name Modification |
---|
38 | // 28 Apr 2007 M.G. Pia Created in compliance with design described in TNS paper |
---|
39 | // |
---|
40 | // ------------------------------------------------------------------- |
---|
41 | |
---|
42 | // Class description: |
---|
43 | // Geant4-DNA dummy final state for test purpose |
---|
44 | // Further documentation available from http://www.ge.infn.it/geant4/dna |
---|
45 | |
---|
46 | // ------------------------------------------------------------------- |
---|
47 | |
---|
48 | #include "G4FinalStateProduct.hh" |
---|
49 | #include "G4Track.hh" |
---|
50 | #include "G4DynamicParticle.hh" |
---|
51 | #include "G4ParticleDefinition.hh" |
---|
52 | #include "G4Track.hh" |
---|
53 | #include "G4ThreeVector.hh" |
---|
54 | |
---|
55 | G4FinalStateProduct::G4FinalStateProduct() : killStatus(false), doNotDepositStatus(false), isModified(false), localEnergyDeposit(0.), modifiedEnergy(0) |
---|
56 | { |
---|
57 | // empty |
---|
58 | } |
---|
59 | |
---|
60 | G4FinalStateProduct::~G4FinalStateProduct() |
---|
61 | { |
---|
62 | // Ownership of DynamicParticle secondaries produced is transferred |
---|
63 | // to ParticleChange in process |
---|
64 | } |
---|
65 | |
---|
66 | void G4FinalStateProduct::Clear() |
---|
67 | { |
---|
68 | // Reset object status |
---|
69 | killStatus = false; |
---|
70 | doNotDepositStatus = false; |
---|
71 | isModified = false; |
---|
72 | localEnergyDeposit = 0.; |
---|
73 | modifiedEnergy = 0.; |
---|
74 | secondaries.clear(); |
---|
75 | modifiedDirection.setX(0.); |
---|
76 | modifiedDirection.setY(0.); |
---|
77 | modifiedDirection.setZ(0.); |
---|
78 | } |
---|
79 | |
---|
80 | void G4FinalStateProduct::AddSecondary(G4DynamicParticle* particle) |
---|
81 | { |
---|
82 | secondaries.push_back(particle); |
---|
83 | } |
---|
84 | |
---|
85 | void G4FinalStateProduct::AddEnergyDeposit(G4double energy) |
---|
86 | { |
---|
87 | localEnergyDeposit += energy; |
---|
88 | } |
---|
89 | |
---|
90 | G4int G4FinalStateProduct::NumberOfSecondaries() const |
---|
91 | { |
---|
92 | size_t n = secondaries.size(); |
---|
93 | return n; |
---|
94 | } |
---|
95 | |
---|
96 | const std::vector<G4DynamicParticle*>& G4FinalStateProduct::GetSecondaries() const |
---|
97 | { |
---|
98 | return secondaries; |
---|
99 | } |
---|
100 | |
---|
101 | void G4FinalStateProduct::DoNotDepositEnergy() |
---|
102 | { |
---|
103 | doNotDepositStatus = true; |
---|
104 | } |
---|
105 | |
---|
106 | void G4FinalStateProduct::KillPrimaryParticle() |
---|
107 | { |
---|
108 | |
---|
109 | // ---- MGP ---- To be added: Handle local energy deposit here |
---|
110 | killStatus = true; |
---|
111 | } |
---|
112 | |
---|
113 | void G4FinalStateProduct::ModifyPrimaryParticle(G4double dirX, G4double dirY, G4double dirZ, G4double energy) |
---|
114 | { |
---|
115 | isModified = true; |
---|
116 | modifiedEnergy = energy; |
---|
117 | modifiedDirection.set(dirX,dirY,dirZ); |
---|
118 | modifiedDirection = modifiedDirection.unit(); |
---|
119 | } |
---|
120 | |
---|
121 | void G4FinalStateProduct::ModifyPrimaryParticle(const G4ThreeVector& direction, G4double energy) |
---|
122 | { |
---|
123 | isModified = true; |
---|
124 | modifiedEnergy = energy; |
---|
125 | modifiedDirection = direction.unit(); |
---|
126 | } |
---|