Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4CollisionOutput.hh
Go to the documentation of this file.
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// 20100114 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
28// 20100407 M. Kelsey -- Replace ::resize(0) with ::clear()
29// 20100409 M. Kelsey -- Move function code to .cc files, not inlinable
30// 20100418 M. Kelsey -- Add function to boost output lists to lab frame
31// 20100520 M. Kelsey -- Add function to rotate Z axis, from G4Casc.Interface
32// 20100620 M. Kelsey -- Add setVerboseLevel() function
33// 20100715 M. Kelsey -- Add total charge and baryon number functions, and a
34// combined "add()" function to put two of these together.
35// 20100716 M. Kelsey -- Add interface to handle G4CascadParticles
36// 20100924 M. Kelsey -- Use "OutgoingNuclei" name consistently, replacing
37// old "TargetFragment". Add new (reusable) G4Fragment buffer
38// and access functions for initial post-cascade processing.
39// Move implementation of add() to .cc file.
40// 20100925 M. Kelsey -- Add function to process G4ReactionProduct list
41// 20110225 M. Kelsey -- Add interface to remove entries from lists
42// 20110311 M. Kelsey -- Add function to boost individual four-vector
43// 20110323 M. Kelsey -- Add non-const access to lists (for G4NucleiModel)
44// 20110922 M. Kelsey -- Add optional stream argument to printCollisionOutput
45// 20121002 M. Kelsey -- Add strangeness calculation
46// 20130628 M. Kelsey -- Support multiple recoil fragments (for G4Fissioner)
47// 20141208 M. Kelsey -- Split function to do pair-wise "hard" tuning
48
49#ifndef G4COLLISION_OUTPUT_HH
50#define G4COLLISION_OUTPUT_HH
51
52#include "G4Fragment.hh"
54#include "G4InuclNuclei.hh"
55#include "G4LorentzRotation.hh"
57#include "G4ios.hh"
58#include <iosfwd>
59#include <algorithm>
60#include <vector>
61
64
66{
67 public:
68
71
72 void setVerboseLevel(G4int verbose) { verboseLevel = verbose; };
73
74 // ===== Accumulate contents of lists =====
75
76 void reset(); // Empties lists for new event
77
78 void add(const G4CollisionOutput& right); // Merge complete objects
79
81 outgoingParticles.push_back(particle);
82 }
83
84 void addOutgoingParticles(const std::vector<G4InuclElementaryParticle>& particles);
85
86 void addOutgoingNucleus(const G4InuclNuclei& nuclei) {
87 outgoingNuclei.push_back(nuclei);
88 };
89
90 void addOutgoingNuclei(const std::vector<G4InuclNuclei>& nuclea);
91
92 // These are primarily for G4IntraNucleiCascader internal checks
93 void addOutgoingParticle(const G4CascadParticle& cparticle);
94 void addOutgoingParticles(const std::vector<G4CascadParticle>& cparticles);
95
96 void addOutgoingParticles(const G4ReactionProductVector* rproducts);
97
98 // Special buffer for initial, possible unstable fragments from cascade
99 void addRecoilFragment(const G4Fragment* aFragment) {
100 if (aFragment) addRecoilFragment(*aFragment);
101 }
102
103 void addRecoilFragment(const G4Fragment& aFragment) {
104 recoilFragments.push_back(aFragment);
105 }
106
107 // ===== Remove contents of lists, by index, reference or value =====
108
109 void removeOutgoingParticle(G4int index);
112 if (particle) removeOutgoingParticle(*particle);
113 }
114
115 void removeOutgoingNucleus(G4int index);
116 void removeOutgoingNucleus(const G4InuclNuclei& nuclei);
118 if (nuclei) removeOutgoingNucleus(*nuclei);
119 }
120
121 void removeRecoilFragment(G4int index=-1); // No argument removes all
122
123 // ===== Access contents of lists =====
124
125 G4int numberOfOutgoingParticles() const { return (G4int)outgoingParticles.size(); }
126
127 const std::vector<G4InuclElementaryParticle>& getOutgoingParticles() const {
128 return outgoingParticles;
129 };
130
131 std::vector<G4InuclElementaryParticle>& getOutgoingParticles() {
132 return outgoingParticles;
133 };
134
135 G4int numberOfOutgoingNuclei() const { return (G4int)outgoingNuclei.size(); };
136
137 const std::vector<G4InuclNuclei>& getOutgoingNuclei() const {
138 return outgoingNuclei;
139 };
140
141 std::vector<G4InuclNuclei>& getOutgoingNuclei() { return outgoingNuclei; };
142
143 G4int numberOfFragments() const { return (G4int)recoilFragments.size(); }
144
145 const G4Fragment& getRecoilFragment(G4int index=0) const;
146
147 const std::vector<G4Fragment>& getRecoilFragments() const {
148 return recoilFragments;
149 };
150
151 std::vector<G4Fragment>& getRecoilFragments() { return recoilFragments; };
152
153 // ===== Get event totals for conservation checking, recoil, etc. ======
154
156 G4int getTotalCharge() const; // NOTE: No fractional charges!
159
160 void printCollisionOutput(std::ostream& os=G4cout) const;
161
162 // ===== Manipulate final-state particles for kinematics =====
163
164 void boostToLabFrame(const G4LorentzConvertor& convertor);
165 G4LorentzVector boostToLabFrame(G4LorentzVector mom, // Note pass by value!
166 const G4LorentzConvertor& convertor) const;
167
168 void rotateEvent(const G4LorentzRotation& rotate);
169 void trivialise(G4InuclParticle* bullet, G4InuclParticle* target);
170 void setOnShell(G4InuclParticle* bullet, G4InuclParticle* target);
172
173 G4double getRemainingExitationEnergy() const { return eex_rest; };
174 G4bool acceptable() const { return on_shell; };
175
176 private:
177
178 G4int verboseLevel;
179
180 std::vector<G4InuclElementaryParticle> outgoingParticles;
181 std::vector<G4InuclNuclei> outgoingNuclei;
182 std::vector<G4Fragment> recoilFragments;
183 static const G4Fragment emptyFragment; // To return if list empty
184
185 std::pair<std::pair<G4int,G4int>, G4int> selectPairToTune(G4double de) const;
186 G4bool tuneSelectedPair(G4LorentzVector& mom1, G4LorentzVector& mom2,
187 G4int mom_index) const;
188
189 G4double eex_rest; // Used by setOnShell() for kinematics
190 G4LorentzVector mom_non_cons;
191 G4bool on_shell;
192};
193
194#endif // G4COLLISION_OUTPUT_HH
195
std::vector< G4ReactionProduct * > G4ReactionProductVector
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4GLOB_DLL std::ostream G4cout
G4int numberOfOutgoingParticles() const
void addRecoilFragment(const G4Fragment *aFragment)
G4int getTotalStrangeness() const
G4LorentzVector getTotalOutputMomentum() const
G4CollisionOutput & operator=(const G4CollisionOutput &right)
G4int getTotalBaryonNumber() const
void removeRecoilFragment(G4int index=-1)
const std::vector< G4InuclNuclei > & getOutgoingNuclei() const
void boostToLabFrame(const G4LorentzConvertor &convertor)
void rotateEvent(const G4LorentzRotation &rotate)
void removeOutgoingNucleus(G4int index)
void printCollisionOutput(std::ostream &os=G4cout) const
std::vector< G4InuclNuclei > & getOutgoingNuclei()
void addOutgoingParticle(const G4InuclElementaryParticle &particle)
G4int getTotalCharge() const
const std::vector< G4InuclElementaryParticle > & getOutgoingParticles() const
const G4Fragment & getRecoilFragment(G4int index=0) const
void setOnShell(G4InuclParticle *bullet, G4InuclParticle *target)
void removeOutgoingNucleus(const G4InuclNuclei *nuclei)
void addRecoilFragment(const G4Fragment &aFragment)
G4double getRemainingExitationEnergy() const
void setVerboseLevel(G4int verbose)
const std::vector< G4Fragment > & getRecoilFragments() const
G4int numberOfOutgoingNuclei() const
G4bool acceptable() const
void add(const G4CollisionOutput &right)
std::vector< G4Fragment > & getRecoilFragments()
void trivialise(G4InuclParticle *bullet, G4InuclParticle *target)
void removeOutgoingParticle(const G4InuclElementaryParticle *particle)
void addOutgoingNucleus(const G4InuclNuclei &nuclei)
void addOutgoingNuclei(const std::vector< G4InuclNuclei > &nuclea)
G4int numberOfFragments() const
void removeOutgoingParticle(G4int index)
void addOutgoingParticles(const std::vector< G4InuclElementaryParticle > &particles)
std::vector< G4InuclElementaryParticle > & getOutgoingParticles()