G4CollisionOutput.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id$
00027 //
00028 // 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
00029 // 20100407  M. Kelsey -- Replace ::resize(0) with ::clear()
00030 // 20100409  M. Kelsey -- Move function code to .cc files, not inlinable
00031 // 20100418  M. Kelsey -- Add function to boost output lists to lab frame
00032 // 20100520  M. Kelsey -- Add function to rotate Z axis, from G4Casc.Interface
00033 // 20100620  M. Kelsey -- Add setVerboseLevel() function
00034 // 20100715  M. Kelsey -- Add total charge and baryon number functions, and a
00035 //              combined "add()" function to put two of these together.
00036 // 20100716  M. Kelsey -- Add interface to handle G4CascadParticles
00037 // 20100924  M. Kelsey -- Use "OutgoingNuclei" name consistently, replacing
00038 //              old "TargetFragment".  Add new (reusable) G4Fragment buffer 
00039 //              and access functions for initial post-cascade processing.
00040 //              Move implementation of add() to .cc file.
00041 // 20100925  M. Kelsey -- Add function to process G4ReactionProduct list
00042 // 20110225  M. Kelsey -- Add interface to remove entries from lists
00043 // 20110311  M. Kelsey -- Add function to boost individual four-vector
00044 // 20110323  M. Kelsey -- Add non-const access to lists (for G4NucleiModel)
00045 // 20110922  M. Kelsey -- Add optional stream argument to printCollisionOutput
00046 // 20121002  M. Kelsey -- Add strangeness calculation
00047 
00048 #ifndef G4COLLISION_OUTPUT_HH
00049 #define G4COLLISION_OUTPUT_HH
00050 
00051 #include "G4Fragment.hh"
00052 #include "G4InuclElementaryParticle.hh"
00053 #include "G4InuclNuclei.hh"
00054 #include "G4LorentzRotation.hh"
00055 #include "G4ReactionProductVector.hh"
00056 #include "G4ios.hh"
00057 #include <iosfwd>
00058 #include <algorithm>
00059 #include <vector>
00060 
00061 class G4CascadParticle;
00062 class G4LorentzConvertor;
00063 
00064 
00065 class G4CollisionOutput {
00066 public:
00067   G4CollisionOutput();
00068   G4CollisionOutput& operator=(const G4CollisionOutput& right);
00069 
00070   void setVerboseLevel(G4int verbose) { verboseLevel = verbose; };
00071 
00072   // ===== Accumulate contents of lists =====
00073 
00074   void reset();         // Empties lists for new event
00075 
00076   void add(const G4CollisionOutput& right);     // Merge complete objects
00077 
00078   void addOutgoingParticle(const G4InuclElementaryParticle& particle) {
00079     outgoingParticles.push_back(particle);
00080   }
00081 
00082   void addOutgoingParticles(const std::vector<G4InuclElementaryParticle>& particles);
00083 
00084   void addOutgoingNucleus(const G4InuclNuclei& nuclei) {
00085     outgoingNuclei.push_back(nuclei);
00086   };
00087 
00088   void addOutgoingNuclei(const std::vector<G4InuclNuclei>& nuclea);
00089 
00090   // These are primarily for G4IntraNucleiCascader internal checks
00091   void addOutgoingParticle(const G4CascadParticle& cparticle);
00092   void addOutgoingParticles(const std::vector<G4CascadParticle>& cparticles);
00093 
00094   void addOutgoingParticles(const G4ReactionProductVector* rproducts);
00095 
00096   // Special buffer for initial, possible unstable fragment from cascade
00097   void addRecoilFragment(const G4Fragment* aFragment) {
00098     if (aFragment) addRecoilFragment(*aFragment);
00099   }
00100 
00101   void addRecoilFragment(const G4Fragment& aFragment) {
00102     theRecoilFragment = aFragment;
00103   }
00104 
00105   // ===== Remove contents of lists, by index, reference or value  =====
00106 
00107   void removeOutgoingParticle(G4int index);
00108   void removeOutgoingParticle(const G4InuclElementaryParticle& particle);
00109   void removeOutgoingParticle(const G4InuclElementaryParticle* particle) {
00110     if (particle) removeOutgoingParticle(*particle);
00111   }
00112 
00113   void removeOutgoingNucleus(G4int index);
00114   void removeOutgoingNucleus(const G4InuclNuclei& nuclei);
00115   void removeOutgoingNucleus(const G4InuclNuclei* nuclei) {
00116     if (nuclei) removeOutgoingNucleus(*nuclei);
00117   }
00118 
00119   void removeRecoilFragment();          // There is only one fragment
00120 
00121   // ===== Access contents of lists =====
00122 
00123   G4int numberOfOutgoingParticles() const { return outgoingParticles.size(); }
00124     
00125   const std::vector<G4InuclElementaryParticle>& getOutgoingParticles() const {
00126     return outgoingParticles;
00127   };
00128 
00129   std::vector<G4InuclElementaryParticle>& getOutgoingParticles() {
00130     return outgoingParticles;
00131   };
00132 
00133   G4int numberOfOutgoingNuclei() const { return outgoingNuclei.size(); };
00134  
00135   const std::vector<G4InuclNuclei>& getOutgoingNuclei() const {
00136     return outgoingNuclei;
00137   };
00138 
00139   std::vector<G4InuclNuclei>& getOutgoingNuclei() { return outgoingNuclei; };
00140 
00141   const G4Fragment& getRecoilFragment() const { return theRecoilFragment; }
00142 
00143   G4Fragment& getRecoilFragment() { return theRecoilFragment; }
00144 
00145   // ===== Get event totals for conservation checking, recoil, etc. ======
00146 
00147   G4LorentzVector getTotalOutputMomentum() const;
00148   G4int getTotalCharge() const;                 // NOTE:  No fractional charges!
00149   G4int getTotalBaryonNumber() const;
00150   G4int getTotalStrangeness() const;
00151 
00152   void printCollisionOutput(std::ostream& os=G4cout) const;
00153 
00154   // ===== Manipulate final-state particles for kinematics =====
00155 
00156   void boostToLabFrame(const G4LorentzConvertor& convertor);
00157   G4LorentzVector boostToLabFrame(G4LorentzVector mom,  // Note pass by value!
00158                                   const G4LorentzConvertor& convertor) const;
00159 
00160   void rotateEvent(const G4LorentzRotation& rotate);
00161   void trivialise(G4InuclParticle* bullet, G4InuclParticle* target);
00162   void setOnShell(G4InuclParticle* bullet, G4InuclParticle* target);
00163   void setRemainingExitationEnergy();
00164 
00165   double getRemainingExitationEnergy() const { return eex_rest; };
00166   G4bool acceptable() const { return on_shell; };
00167 
00168 private: 
00169   G4int verboseLevel;
00170 
00171   std::vector<G4InuclElementaryParticle> outgoingParticles;
00172   std::vector<G4InuclNuclei> outgoingNuclei;
00173   G4Fragment theRecoilFragment;
00174 
00175   G4double eex_rest;            // Used by setOnShell() for kinematics
00176 
00177   std::pair<std::pair<G4int,G4int>, G4int> selectPairToTune(G4double de) const; 
00178 
00179   G4bool on_shell;
00180 };        
00181 
00182 #endif // G4COLLISION_OUTPUT_HH 
00183 

Generated on Mon May 27 17:47:55 2013 for Geant4 by  doxygen 1.4.7