Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:03

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // 20100114  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
0028 // 20100407  M. Kelsey -- Replace ::resize(0) with ::clear()
0029 // 20100409  M. Kelsey -- Move function code to .cc files, not inlinable
0030 // 20100418  M. Kelsey -- Add function to boost output lists to lab frame
0031 // 20100520  M. Kelsey -- Add function to rotate Z axis, from G4Casc.Interface
0032 // 20100620  M. Kelsey -- Add setVerboseLevel() function
0033 // 20100715  M. Kelsey -- Add total charge and baryon number functions, and a
0034 //      combined "add()" function to put two of these together.
0035 // 20100716  M. Kelsey -- Add interface to handle G4CascadParticles
0036 // 20100924  M. Kelsey -- Use "OutgoingNuclei" name consistently, replacing
0037 //      old "TargetFragment".  Add new (reusable) G4Fragment buffer 
0038 //      and access functions for initial post-cascade processing.
0039 //      Move implementation of add() to .cc file.
0040 // 20100925  M. Kelsey -- Add function to process G4ReactionProduct list
0041 // 20110225  M. Kelsey -- Add interface to remove entries from lists
0042 // 20110311  M. Kelsey -- Add function to boost individual four-vector
0043 // 20110323  M. Kelsey -- Add non-const access to lists (for G4NucleiModel)
0044 // 20110922  M. Kelsey -- Add optional stream argument to printCollisionOutput
0045 // 20121002  M. Kelsey -- Add strangeness calculation
0046 // 20130628  M. Kelsey -- Support multiple recoil fragments (for G4Fissioner)
0047 // 20141208  M. Kelsey -- Split function to do pair-wise "hard" tuning
0048 
0049 #ifndef G4COLLISION_OUTPUT_HH
0050 #define G4COLLISION_OUTPUT_HH
0051 
0052 #include "G4Fragment.hh"
0053 #include "G4InuclElementaryParticle.hh"
0054 #include "G4InuclNuclei.hh"
0055 #include "G4LorentzRotation.hh"
0056 #include "G4ReactionProductVector.hh"
0057 #include "G4ios.hh"
0058 #include <iosfwd>
0059 #include <algorithm>
0060 #include <vector>
0061 
0062 class G4CascadParticle;
0063 class G4LorentzConvertor;
0064 
0065 class G4CollisionOutput
0066 {
0067  public:
0068 
0069   G4CollisionOutput();
0070   G4CollisionOutput& operator=(const G4CollisionOutput& right);
0071 
0072   void setVerboseLevel(G4int verbose) { verboseLevel = verbose; };
0073 
0074   // ===== Accumulate contents of lists =====
0075 
0076   void reset();     // Empties lists for new event
0077 
0078   void add(const G4CollisionOutput& right); // Merge complete objects
0079 
0080   void addOutgoingParticle(const G4InuclElementaryParticle& particle) {
0081     outgoingParticles.push_back(particle);
0082   }
0083 
0084   void addOutgoingParticles(const std::vector<G4InuclElementaryParticle>& particles);
0085 
0086   void addOutgoingNucleus(const G4InuclNuclei& nuclei) {
0087     outgoingNuclei.push_back(nuclei);
0088   };
0089 
0090   void addOutgoingNuclei(const std::vector<G4InuclNuclei>& nuclea);
0091 
0092   // These are primarily for G4IntraNucleiCascader internal checks
0093   void addOutgoingParticle(const G4CascadParticle& cparticle);
0094   void addOutgoingParticles(const std::vector<G4CascadParticle>& cparticles);
0095 
0096   void addOutgoingParticles(const G4ReactionProductVector* rproducts);
0097 
0098   // Special buffer for initial, possible unstable fragments from cascade
0099   void addRecoilFragment(const G4Fragment* aFragment) {
0100     if (aFragment) addRecoilFragment(*aFragment);
0101   }
0102 
0103   void addRecoilFragment(const G4Fragment& aFragment) {
0104     recoilFragments.push_back(aFragment);
0105   }
0106   
0107   // ===== Remove contents of lists, by index, reference or value  =====
0108 
0109   void removeOutgoingParticle(G4int index);
0110   void removeOutgoingParticle(const G4InuclElementaryParticle& particle);
0111   void removeOutgoingParticle(const G4InuclElementaryParticle* particle) {
0112     if (particle) removeOutgoingParticle(*particle);
0113   }
0114 
0115   void removeOutgoingNucleus(G4int index);
0116   void removeOutgoingNucleus(const G4InuclNuclei& nuclei);
0117   void removeOutgoingNucleus(const G4InuclNuclei* nuclei) {
0118     if (nuclei) removeOutgoingNucleus(*nuclei);
0119   }
0120 
0121   void removeRecoilFragment(G4int index=-1);    // No argument removes all
0122 
0123   // ===== Access contents of lists =====
0124 
0125   G4int numberOfOutgoingParticles() const { return (G4int)outgoingParticles.size(); }
0126     
0127   const std::vector<G4InuclElementaryParticle>& getOutgoingParticles() const {
0128     return outgoingParticles;
0129   };
0130 
0131   std::vector<G4InuclElementaryParticle>& getOutgoingParticles() {
0132     return outgoingParticles;
0133   };
0134 
0135   G4int numberOfOutgoingNuclei() const { return (G4int)outgoingNuclei.size(); };
0136  
0137   const std::vector<G4InuclNuclei>& getOutgoingNuclei() const {
0138     return outgoingNuclei;
0139   };
0140 
0141   std::vector<G4InuclNuclei>& getOutgoingNuclei() { return outgoingNuclei; };
0142 
0143   G4int numberOfFragments() const { return (G4int)recoilFragments.size(); }
0144 
0145   const G4Fragment& getRecoilFragment(G4int index=0) const;
0146 
0147   const std::vector<G4Fragment>& getRecoilFragments() const {
0148     return recoilFragments;
0149   };
0150 
0151   std::vector<G4Fragment>& getRecoilFragments() { return recoilFragments; };
0152 
0153   // ===== Get event totals for conservation checking, recoil, etc. ======
0154 
0155   G4LorentzVector getTotalOutputMomentum() const;
0156   G4int getTotalCharge() const;         // NOTE:  No fractional charges!
0157   G4int getTotalBaryonNumber() const;
0158   G4int getTotalStrangeness() const;
0159 
0160   void printCollisionOutput(std::ostream& os=G4cout) const;
0161 
0162   // ===== Manipulate final-state particles for kinematics =====
0163 
0164   void boostToLabFrame(const G4LorentzConvertor& convertor);
0165   G4LorentzVector boostToLabFrame(G4LorentzVector mom,  // Note pass by value!
0166                   const G4LorentzConvertor& convertor) const;
0167 
0168   void rotateEvent(const G4LorentzRotation& rotate);
0169   void trivialise(G4InuclParticle* bullet, G4InuclParticle* target);
0170   void setOnShell(G4InuclParticle* bullet, G4InuclParticle* target);
0171   void setRemainingExitationEnergy();
0172 
0173   G4double getRemainingExitationEnergy() const { return eex_rest; };
0174   G4bool acceptable() const { return on_shell; };
0175 
0176  private: 
0177 
0178   G4int verboseLevel;
0179 
0180   std::vector<G4InuclElementaryParticle> outgoingParticles;
0181   std::vector<G4InuclNuclei> outgoingNuclei;
0182   std::vector<G4Fragment> recoilFragments;
0183   static const G4Fragment emptyFragment;    // To return if list empty
0184 
0185   std::pair<std::pair<G4int,G4int>, G4int> selectPairToTune(G4double de) const; 
0186   G4bool tuneSelectedPair(G4LorentzVector& mom1, G4LorentzVector& mom2,
0187               G4int mom_index) const;
0188 
0189   G4double eex_rest;        // Used by setOnShell() for kinematics
0190   G4LorentzVector mom_non_cons;
0191   G4bool on_shell;
0192 };        
0193 
0194 #endif // G4COLLISION_OUTPUT_HH 
0195