Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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$
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 
48 #ifndef G4COLLISION_OUTPUT_HH
49 #define G4COLLISION_OUTPUT_HH
50 
51 #include "G4Fragment.hh"
53 #include "G4InuclNuclei.hh"
54 #include "G4LorentzRotation.hh"
56 #include "G4ios.hh"
57 #include <iosfwd>
58 #include <algorithm>
59 #include <vector>
60 
61 class G4CascadParticle;
62 class G4LorentzConvertor;
63 
64 
66 public:
69 
70  void setVerboseLevel(G4int verbose) { verboseLevel = verbose; };
71 
72  // ===== Accumulate contents of lists =====
73 
74  void reset(); // Empties lists for new event
75 
76  void add(const G4CollisionOutput& right); // Merge complete objects
77 
79  outgoingParticles.push_back(particle);
80  }
81 
82  void addOutgoingParticles(const std::vector<G4InuclElementaryParticle>& particles);
83 
85  outgoingNuclei.push_back(nuclei);
86  };
87 
88  void addOutgoingNuclei(const std::vector<G4InuclNuclei>& nuclea);
89 
90  // These are primarily for G4IntraNucleiCascader internal checks
91  void addOutgoingParticle(const G4CascadParticle& cparticle);
92  void addOutgoingParticles(const std::vector<G4CascadParticle>& cparticles);
93 
94  void addOutgoingParticles(const G4ReactionProductVector* rproducts);
95 
96  // Special buffer for initial, possible unstable fragment from cascade
97  void addRecoilFragment(const G4Fragment* aFragment) {
98  if (aFragment) addRecoilFragment(*aFragment);
99  }
100 
101  void addRecoilFragment(const G4Fragment& aFragment) {
102  theRecoilFragment = aFragment;
103  }
104 
105  // ===== Remove contents of lists, by index, reference or value =====
106 
110  if (particle) removeOutgoingParticle(*particle);
111  }
112 
116  if (nuclei) removeOutgoingNucleus(*nuclei);
117  }
118 
119  void removeRecoilFragment(); // There is only one fragment
120 
121  // ===== Access contents of lists =====
122 
123  G4int numberOfOutgoingParticles() const { return outgoingParticles.size(); }
124 
125  const std::vector<G4InuclElementaryParticle>& getOutgoingParticles() const {
126  return outgoingParticles;
127  };
128 
129  std::vector<G4InuclElementaryParticle>& getOutgoingParticles() {
130  return outgoingParticles;
131  };
132 
133  G4int numberOfOutgoingNuclei() const { return outgoingNuclei.size(); };
134 
135  const std::vector<G4InuclNuclei>& getOutgoingNuclei() const {
136  return outgoingNuclei;
137  };
138 
139  std::vector<G4InuclNuclei>& getOutgoingNuclei() { return outgoingNuclei; };
140 
141  const G4Fragment& getRecoilFragment() const { return theRecoilFragment; }
142 
143  G4Fragment& getRecoilFragment() { return theRecoilFragment; }
144 
145  // ===== Get event totals for conservation checking, recoil, etc. ======
146 
148  G4int getTotalCharge() const; // NOTE: No fractional charges!
149  G4int getTotalBaryonNumber() const;
150  G4int getTotalStrangeness() const;
151 
152  void printCollisionOutput(std::ostream& os=G4cout) const;
153 
154  // ===== Manipulate final-state particles for kinematics =====
155 
156  void boostToLabFrame(const G4LorentzConvertor& convertor);
157  G4LorentzVector boostToLabFrame(G4LorentzVector mom, // Note pass by value!
158  const G4LorentzConvertor& convertor) const;
159 
160  void rotateEvent(const G4LorentzRotation& rotate);
164 
165  double getRemainingExitationEnergy() const { return eex_rest; };
166  G4bool acceptable() const { return on_shell; };
167 
168 private:
169  G4int verboseLevel;
170 
171  std::vector<G4InuclElementaryParticle> outgoingParticles;
172  std::vector<G4InuclNuclei> outgoingNuclei;
173  G4Fragment theRecoilFragment;
174 
175  G4double eex_rest; // Used by setOnShell() for kinematics
176 
177  std::pair<std::pair<G4int,G4int>, G4int> selectPairToTune(G4double de) const;
178 
179  G4bool on_shell;
180 };
181 
182 #endif // G4COLLISION_OUTPUT_HH
183