Back to home page

EIC code displayed by LXR

 
 

    


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

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 //
0028 #ifndef G4Nucleon_h
0029 #define G4Nucleon_h 1
0030 
0031 // ------------------------------------------------------------
0032 //      GEANT 4 class header file
0033 //
0034 //      ---------------- G4Nucleon ----------------
0035 //             by Gunter Folger, May 1998.
0036 //       class for a nucleon (inside a 3D Nucleus)
0037 // ------------------------------------------------------------
0038 
0039 #include "G4ThreeVector.hh"
0040 #include "G4LorentzVector.hh"
0041 #include "globals.hh"
0042 #include "G4ParticleDefinition.hh"
0043 #include "G4Proton.hh"
0044 #include "G4Neutron.hh"
0045 #include "G4Lambda.hh"
0046 #include "G4AntiProton.hh"
0047 #include "G4AntiNeutron.hh"
0048 #include "G4AntiLambda.hh"
0049 #include "G4VKineticNucleon.hh"
0050 
0051 //#include "G4VSplitableHadron.hh"
0052 class G4VSplitableHadron;
0053 
0054 class G4Nucleon : public G4VKineticNucleon
0055 {
0056 
0057   public:
0058       G4Nucleon();
0059       ~G4Nucleon();
0060 
0061       inline G4bool operator==(const G4Nucleon &right) const;
0062       inline G4bool operator!=(const G4Nucleon &right) const;
0063       G4Nucleon& operator=(const G4Nucleon& right);
0064 
0065   public:
0066 
0067     void SetPosition(const G4ThreeVector aPosition);
0068     const G4ThreeVector& GetPosition() const;
0069 
0070     inline void SetMomentum(G4LorentzVector & aMomentum) {theMomentum = aMomentum;}
0071     inline const G4LorentzVector& GetMomentum()  const {return theMomentum;}
0072     virtual inline const G4LorentzVector & Get4Momentum()  const {return theMomentum;}
0073 
0074     inline void SetBindingEnergy(G4double anEnergy) {theBindingE = anEnergy;}
0075     inline G4double GetBindingEnergy()  const {return theBindingE;}
0076 
0077     inline void SetParticleType(G4Proton*  aProton) {theParticleType = aProton;}
0078     inline void SetParticleType(G4Neutron* aNeutron){theParticleType = aNeutron;}
0079     inline void SetParticleType(G4Lambda*  aLambda) {theParticleType = aLambda;}
0080 
0081     inline void SetParticleType(G4AntiProton*  aAntiProton) {theParticleType = aAntiProton;}
0082     inline void SetParticleType(G4AntiNeutron* aAntiNeutron){theParticleType = aAntiNeutron;}
0083     inline void SetParticleType(G4AntiLambda*  aAntiLambda) {theParticleType = aAntiLambda;}
0084 
0085     inline  const G4ParticleDefinition* GetParticleType() const {return theParticleType;}
0086     virtual const G4ParticleDefinition* GetDefinition() const {return theParticleType;}
0087     
0088     inline void Boost(const G4ThreeVector & beta){ theMomentum.boost(beta); } 
0089            void Boost(const G4LorentzVector & aMomentum);
0090 
0091     inline void Hit(G4VSplitableHadron *aHit) { theSplitableHadron=aHit;}
0092 //    inline void Hit(G4int ) { isHit=true;}    
0093     inline void Hit(G4int ) 
0094     { 
0095       theSplitableHadron=reinterpret_cast<G4VSplitableHadron *>(1111); 
0096     }
0097     inline G4VSplitableHadron * GetSplitableHadron() const { return theSplitableHadron;}
0098     inline G4bool AreYouHit() const {  return theSplitableHadron!=0;}
0099 
0100   private:
0101 
0102     G4ThreeVector thePosition;
0103     G4LorentzVector theMomentum;
0104     G4double theBindingE;
0105     const G4ParticleDefinition * theParticleType;
0106     G4VSplitableHadron * theSplitableHadron;
0107 
0108 
0109 };
0110 
0111 std::ostream & operator << (std::ostream &, const G4Nucleon&);
0112 
0113 inline G4bool G4Nucleon::operator==(const G4Nucleon &right) const
0114 {
0115     return this==&right;
0116 }
0117 inline G4bool G4Nucleon::operator!=(const G4Nucleon &right) const
0118 {
0119     return this!=&right;
0120 }
0121 
0122 inline G4Nucleon& G4Nucleon::operator=(const G4Nucleon& right)
0123 {
0124    if (this != &right)
0125    {
0126       thePosition=right.GetPosition();
0127       theMomentum=right.Get4Momentum();
0128       theBindingE=right.GetBindingEnergy();
0129       theParticleType=right.GetDefinition();
0130       theSplitableHadron=right.GetSplitableHadron();
0131    }
0132     return *this;
0133 }
0134 
0135 inline void G4Nucleon::SetPosition(const G4ThreeVector aPosition)
0136 {
0137   thePosition = aPosition;
0138 }
0139 
0140 inline const G4ThreeVector& G4Nucleon::GetPosition() const
0141 {
0142   return thePosition;
0143 }
0144 
0145 #endif
0146