Back to home page

EIC code displayed by LXR

 
 

    


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

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 // 20100909  Add function to reset values to zero
0028 // 20100924  Migrate to integer A and Z
0029 // 20110225  M. Kelsey -- Add equality operator (NOT sorting!)
0030 // 20110922  M. Kelsey -- Replace print() with stream operator<<(), put
0031 //      implementation into new .cc file.
0032 // 20121009  M. Kelsey -- Add empty() test for no excitons, fix constness
0033 // 20130622  M. Kelsey -- Add interface to copy data from G4Fragment
0034 
0035 #ifndef G4EXITON_CONFIGURATION_HH
0036 #define G4EXITON_CONFIGURATION_HH
0037 
0038 #include "globals.hh"
0039 #include <iosfwd>
0040 
0041 class G4Fragment;
0042 
0043 class G4ExitonConfiguration {
0044 public:
0045   G4ExitonConfiguration() 
0046     : protonQuasiParticles(0), neutronQuasiParticles(0),
0047       protonHoles(0), neutronHoles(0) {}
0048 
0049   G4ExitonConfiguration(G4int qpp, G4int qnp, G4int qph, G4int qnh) 
0050     : protonQuasiParticles(qpp), neutronQuasiParticles(qnp), 
0051       protonHoles(qph), neutronHoles(qnh) {}
0052 
0053   explicit G4ExitonConfiguration(const G4Fragment& frag)
0054     : protonQuasiParticles(0), neutronQuasiParticles(0),
0055       protonHoles(0), neutronHoles(0) { fill(frag); }
0056 
0057 
0058   void clear() {
0059     protonQuasiParticles = neutronQuasiParticles = 0;
0060     protonHoles = neutronHoles = 0;
0061   }
0062 
0063   bool empty() const {
0064     return (protonQuasiParticles==0 && neutronQuasiParticles==0 &&
0065         protonHoles==0 && neutronHoles==0);
0066   }
0067 
0068   void fill(const G4Fragment& frag);    // Initialize from G4Fragment data
0069 
0070   G4bool operator==(const G4ExitonConfiguration& right) const {
0071     return ( (&right == this) ||
0072          (protonQuasiParticles == right.protonQuasiParticles &&
0073           neutronQuasiParticles == right.neutronQuasiParticles &&
0074           protonHoles == right.protonHoles &&
0075           neutronHoles == right.neutronHoles) );
0076   }
0077 
0078   G4bool operator!=(const G4ExitonConfiguration& right) const {
0079     return !operator==(right);
0080   }
0081 
0082 
0083   // Modify configuration
0084 
0085   void incrementQP(G4int ip) {
0086     if (ip == 1) protonQuasiParticles++;
0087     else if (ip == 2) neutronQuasiParticles++;
0088   }
0089 
0090   void incrementHoles(G4int ip) {
0091     if (ip == 1) protonHoles++;
0092     else if (ip == 2) neutronHoles++;
0093   }
0094 
0095   G4int protonQuasiParticles;
0096   G4int neutronQuasiParticles;
0097   G4int protonHoles;
0098   G4int neutronHoles;
0099 };        
0100 
0101 // Dump information to output
0102 
0103 std::ostream& operator<<(std::ostream& os, const G4ExitonConfiguration& ex);
0104 
0105 #endif // G4EXITON_CONFIGURATION_HH