Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 // 20141208 M. Kelsey -- Split function to do pair-wise "hard" tuning
49 
50 #ifndef G4COLLISION_OUTPUT_HH
51 #define G4COLLISION_OUTPUT_HH
52 
53 #include "G4Fragment.hh"
55 #include "G4InuclNuclei.hh"
56 #include "G4LorentzRotation.hh"
58 #include "G4ios.hh"
59 #include <iosfwd>
60 #include <algorithm>
61 #include <vector>
62 
63 class G4CascadParticle;
64 class G4LorentzConvertor;
65 
66 
68 public:
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 
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);
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 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 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 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!
157  G4int getTotalBaryonNumber() const;
158  G4int getTotalStrangeness() const;
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);
172 
173  double getRemainingExitationEnergy() const { return eex_rest; };
174  G4bool acceptable() const { return on_shell; };
175 
176 private:
177  G4int verboseLevel;
178 
179  std::vector<G4InuclElementaryParticle> outgoingParticles;
180  std::vector<G4InuclNuclei> outgoingNuclei;
181  std::vector<G4Fragment> recoilFragments;
182  static const G4Fragment emptyFragment; // To return if list empty
183 
184  std::pair<std::pair<G4int,G4int>, G4int> selectPairToTune(G4double de) const;
185  G4bool tuneSelectedPair(G4LorentzVector& mom1, G4LorentzVector& mom2,
186  G4int mom_index) const;
187 
188  G4double eex_rest; // Used by setOnShell() for kinematics
189  G4LorentzVector mom_non_cons;
190  G4bool on_shell;
191 };
192 
193 #endif // G4COLLISION_OUTPUT_HH
194 
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()
const XML_Char * target
Definition: expat.h:268
void removeOutgoingParticle(const G4InuclElementaryParticle *particle)
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)
void rotateEvent(const G4LorentzRotation &rotate)
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
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)