Geant4-11
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
65
67public:
70
71 void setVerboseLevel(G4int verbose) { verboseLevel = verbose; };
72
73 // ===== Accumulate contents of lists =====
74
75 void reset(); // Empties lists for new event
76
77 void add(const G4CollisionOutput& right); // Merge complete objects
78
80 outgoingParticles.push_back(particle);
81 }
82
83 void addOutgoingParticles(const std::vector<G4InuclElementaryParticle>& particles);
84
86 outgoingNuclei.push_back(nuclei);
87 };
88
89 void addOutgoingNuclei(const std::vector<G4InuclNuclei>& nuclea);
90
91 // These are primarily for G4IntraNucleiCascader internal checks
92 void addOutgoingParticle(const G4CascadParticle& cparticle);
93 void addOutgoingParticles(const std::vector<G4CascadParticle>& cparticles);
94
95 void addOutgoingParticles(const G4ReactionProductVector* rproducts);
96
97 // Special buffer for initial, possible unstable fragments from cascade
98 void addRecoilFragment(const G4Fragment* aFragment) {
99 if (aFragment) addRecoilFragment(*aFragment);
100 }
101
102 void addRecoilFragment(const G4Fragment& aFragment) {
103 recoilFragments.push_back(aFragment);
104 }
105
106 // ===== Remove contents of lists, by index, reference or value =====
107
108 void removeOutgoingParticle(G4int index);
111 if (particle) removeOutgoingParticle(*particle);
112 }
113
114 void removeOutgoingNucleus(G4int index);
118 }
119
120 void removeRecoilFragment(G4int index=-1); // No argument removes all
121
122 // ===== Access contents of lists =====
123
125
126 const std::vector<G4InuclElementaryParticle>& getOutgoingParticles() const {
127 return outgoingParticles;
128 };
129
130 std::vector<G4InuclElementaryParticle>& getOutgoingParticles() {
131 return outgoingParticles;
132 };
133
134 G4int numberOfOutgoingNuclei() const { return outgoingNuclei.size(); };
135
136 const std::vector<G4InuclNuclei>& getOutgoingNuclei() const {
137 return outgoingNuclei;
138 };
139
140 std::vector<G4InuclNuclei>& getOutgoingNuclei() { return outgoingNuclei; };
141
142 G4int numberOfFragments() const { return recoilFragments.size(); }
143
144 const G4Fragment& getRecoilFragment(G4int index=0) const;
145
146 const std::vector<G4Fragment>& getRecoilFragments() const {
147 return recoilFragments;
148 };
149
150 std::vector<G4Fragment>& getRecoilFragments() { return recoilFragments; };
151
152 // ===== Get event totals for conservation checking, recoil, etc. ======
153
155 G4int getTotalCharge() const; // NOTE: No fractional charges!
158
159 void printCollisionOutput(std::ostream& os=G4cout) const;
160
161 // ===== Manipulate final-state particles for kinematics =====
162
163 void boostToLabFrame(const G4LorentzConvertor& convertor);
164 G4LorentzVector boostToLabFrame(G4LorentzVector mom, // Note pass by value!
165 const G4LorentzConvertor& convertor) const;
166
167 void rotateEvent(const G4LorentzRotation& rotate);
168 void trivialise(G4InuclParticle* bullet, G4InuclParticle* target);
169 void setOnShell(G4InuclParticle* bullet, G4InuclParticle* target);
171
172 double getRemainingExitationEnergy() const { return eex_rest; };
173 G4bool acceptable() const { return on_shell; };
174
175private:
177
178 std::vector<G4InuclElementaryParticle> outgoingParticles;
179 std::vector<G4InuclNuclei> outgoingNuclei;
180 std::vector<G4Fragment> recoilFragments;
181 static const G4Fragment emptyFragment; // To return if list empty
182
183 std::pair<std::pair<G4int,G4int>, G4int> selectPairToTune(G4double de) const;
185 G4int mom_index) const;
186
187 G4double eex_rest; // Used by setOnShell() for kinematics
190};
191
192#endif // G4COLLISION_OUTPUT_HH
193
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)
G4LorentzVector mom_non_cons
G4int getTotalStrangeness() const
std::vector< G4InuclElementaryParticle > outgoingParticles
G4LorentzVector getTotalOutputMomentum() const
std::vector< G4InuclNuclei > outgoingNuclei
G4CollisionOutput & operator=(const G4CollisionOutput &right)
G4int getTotalBaryonNumber() const
std::pair< std::pair< G4int, G4int >, G4int > selectPairToTune(G4double de) 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)
double getRemainingExitationEnergy() const
void removeOutgoingNucleus(const G4InuclNuclei *nuclei)
void addRecoilFragment(const G4Fragment &aFragment)
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()
G4bool tuneSelectedPair(G4LorentzVector &mom1, G4LorentzVector &mom2, G4int mom_index) const
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()
static const G4Fragment emptyFragment
std::vector< G4Fragment > recoilFragments