Geant4  10.00.p01
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 // $Id: G4CollisionOutput.hh 71954 2013-06-29 04:40:40Z mkelsey $
27 //
28 // 20100114 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
29 // 20100407 M. Kelsey -- Replace ::resize(0) with ::clear()
30 // 20100409 M. Kelsey -- Move function code to .cc files, not inlinable
31 // 20100418 M. Kelsey -- Add function to boost output lists to lab frame
32 // 20100520 M. Kelsey -- Add function to rotate Z axis, from G4Casc.Interface
33 // 20100620 M. Kelsey -- Add setVerboseLevel() function
34 // 20100715 M. Kelsey -- Add total charge and baryon number functions, and a
35 // combined "add()" function to put two of these together.
36 // 20100716 M. Kelsey -- Add interface to handle G4CascadParticles
37 // 20100924 M. Kelsey -- Use "OutgoingNuclei" name consistently, replacing
38 // old "TargetFragment". Add new (reusable) G4Fragment buffer
39 // and access functions for initial post-cascade processing.
40 // Move implementation of add() to .cc file.
41 // 20100925 M. Kelsey -- Add function to process G4ReactionProduct list
42 // 20110225 M. Kelsey -- Add interface to remove entries from lists
43 // 20110311 M. Kelsey -- Add function to boost individual four-vector
44 // 20110323 M. Kelsey -- Add non-const access to lists (for G4NucleiModel)
45 // 20110922 M. Kelsey -- Add optional stream argument to printCollisionOutput
46 // 20121002 M. Kelsey -- Add strangeness calculation
47 // 20130628 M. Kelsey -- Support multiple recoil fragments (for G4Fissioner)
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 
62 class G4CascadParticle;
63 class G4LorentzConvertor;
64 
65 
67 public:
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);
117  if (nuclei) removeOutgoingNucleus(*nuclei);
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!
156  G4int getTotalBaryonNumber() const;
157  G4int getTotalStrangeness() const;
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 
175 private:
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  G4double eex_rest; // Used by setOnShell() for kinematics
184 
185  std::pair<std::pair<G4int,G4int>, G4int> selectPairToTune(G4double de) const;
186 
188 };
189 
190 #endif // G4COLLISION_OUTPUT_HH
191 
void trivialise(G4InuclParticle *bullet, G4InuclParticle *target)
const std::vector< G4Fragment > & getRecoilFragments() const
void setVerboseLevel(G4int verbose)
G4CollisionOutput & operator=(const G4CollisionOutput &right)
void addOutgoingNuclei(const std::vector< G4InuclNuclei > &nuclea)
std::vector< G4InuclNuclei > & getOutgoingNuclei()
std::vector< G4Fragment > recoilFragments
void removeOutgoingParticle(const G4InuclElementaryParticle *particle)
CLHEP::HepLorentzRotation G4LorentzRotation
void removeRecoilFragment(G4int index=-1)
void printCollisionOutput(std::ostream &os=G4cout) const
double getRemainingExitationEnergy() const
std::vector< G4Fragment > & getRecoilFragments()
void addOutgoingParticle(const G4InuclElementaryParticle &particle)
int G4int
Definition: G4Types.hh:78
G4LorentzVector getTotalOutputMomentum() const
G4bool acceptable() const
std::vector< G4ReactionProduct * > G4ReactionProductVector
void add(const G4CollisionOutput &right)
G4GLOB_DLL std::ostream G4cout
std::vector< G4InuclElementaryParticle > & getOutgoingParticles()
bool G4bool
Definition: G4Types.hh:79
G4int getTotalStrangeness() const
G4int numberOfOutgoingParticles() const
void boostToLabFrame(const G4LorentzConvertor &convertor)
void removeOutgoingParticle(G4int index)
std::pair< std::pair< G4int, G4int >, G4int > selectPairToTune(G4double de) const
void rotateEvent(const G4LorentzRotation &rotate)
std::vector< G4InuclElementaryParticle > outgoingParticles
G4int numberOfOutgoingNuclei() const
void addOutgoingParticles(const std::vector< G4InuclElementaryParticle > &particles)
G4int getTotalBaryonNumber() const
const std::vector< G4InuclNuclei > & getOutgoingNuclei() const
const std::vector< G4InuclElementaryParticle > & getOutgoingParticles() const
static const G4Fragment emptyFragment
G4int getTotalCharge() const
void addOutgoingNucleus(const G4InuclNuclei &nuclei)
G4int numberOfFragments() const
void addRecoilFragment(const G4Fragment &aFragment)
void addRecoilFragment(const G4Fragment *aFragment)
void removeOutgoingNucleus(G4int index)
const G4Fragment & getRecoilFragment(G4int index=0) const
double G4double
Definition: G4Types.hh:76
void removeOutgoingNucleus(const G4InuclNuclei *nuclei)
void setOnShell(G4InuclParticle *bullet, G4InuclParticle *target)
std::vector< G4InuclNuclei > outgoingNuclei
CLHEP::HepLorentzVector G4LorentzVector