Back to home page

EIC code displayed by LXR

 
 

    


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

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 // 20100409  M. Kelsey -- Drop unused string argument from ctors.
0029 // 20100429  M. Kelsey -- Change "photon()" to "isPhoton()", use enum names
0030 // 20100914  M. Kelsey -- Move printout to .cc file
0031 // 20100915  M. Kelsey -- Add hyperon() identification function, ctor for
0032 //      G4DynamicParticle
0033 // 20110117  M. Kelsey -- Add antinucleon() and antibaryon() flag
0034 // 20110127  M. Kelsey -- Drop generation.
0035 // 20110214  M. Kelsey -- Replace integer "model" with enum
0036 // 20110321  M. Kelsey -- Fix getStrangeness() to return int
0037 // 20110721  M. Kelsey -- Add constructors to take G4ParticleDefinition as
0038 //      input instead of type code, to allow pass-through of unusable
0039 //      particles during rescattering.  Modify ctors to pass model to
0040 //      base ctor.
0041 // 20110801  M. Kelsey -- Add fill() functions to replicate ctors, allowing
0042 //      reuse of objects as buffers; c.f. G4InuclNuclei.
0043 // 20110922  M. Kelsey -- Add stream argument to printParticle() => print()
0044 // 20120608  M. Kelsey -- Fix variable-name "shadowing" compiler warnings.
0045 // 20130702  M. Kelsey -- Use static type classifiers in G4InuclParticleNames
0046 // 20140310  M. Kelsey -- Fix constness in G4PD* passing
0047 
0048 #ifndef G4INUCL_ELEMENTARY_PARTICLE_HH
0049 #define G4INUCL_ELEMENTARY_PARTICLE_HH
0050 
0051 #include "G4InuclParticle.hh"
0052 #include "G4InuclParticleNames.hh"
0053 #include "globals.hh"
0054 
0055 class G4ParticleDefinition;
0056 
0057 
0058 class G4InuclElementaryParticle : public G4InuclParticle {
0059 public:
0060   G4InuclElementaryParticle() 
0061     : G4InuclParticle() {}
0062 
0063   G4InuclElementaryParticle(G4int ityp, Model model=DefaultModel) 
0064     : G4InuclParticle(makeDefinition(ityp), model) {}
0065 
0066   G4InuclElementaryParticle(const G4DynamicParticle& dynPart,
0067                 Model model=DefaultModel)
0068     : G4InuclParticle(dynPart, model) {}
0069 
0070   G4InuclElementaryParticle(const G4LorentzVector& mom,
0071                 G4int ityp, Model model=DefaultModel)
0072     : G4InuclParticle(makeDefinition(ityp), mom, model) {}
0073 
0074   G4InuclElementaryParticle(G4double ekin, G4int ityp,
0075                 Model model=DefaultModel) 
0076     : G4InuclParticle(makeDefinition(ityp), ekin, model) {}
0077 
0078   // WARNING:  This may create a particle without a valid type code!
0079   G4InuclElementaryParticle(const G4LorentzVector& mom,
0080                 const G4ParticleDefinition* pd,
0081                 Model model=DefaultModel)
0082     : G4InuclParticle(pd, mom, model) {}
0083 
0084   // Copy and assignment constructors for use with std::vector<>
0085   G4InuclElementaryParticle(const G4InuclElementaryParticle& right)
0086     : G4InuclParticle(right) {}
0087 
0088   G4InuclElementaryParticle& operator=(const G4InuclElementaryParticle& right);
0089 
0090   // Overwrite data structure (avoids creating/copying temporaries)
0091   void fill(G4int ityp, Model model=DefaultModel) { fill(0., ityp, model); }
0092 
0093   void fill(const G4LorentzVector& mom, G4int ityp, Model model=DefaultModel);
0094 
0095   void fill(G4double ekin, G4int ityp, Model model=DefaultModel);
0096 
0097   // WARNING:  This may create a particle without a valid type code!
0098   void fill(const G4LorentzVector& mom, const G4ParticleDefinition* pd,
0099         Model model=DefaultModel);
0100 
0101   // Assignment and accessor functions
0102   void setType(G4int ityp);
0103   G4int type() const { return type(getDefinition()); }
0104 
0105   static G4int type(const G4ParticleDefinition* pd);
0106 
0107   // Ensure that type code refers to a known particle
0108   inline static G4bool valid(G4int ityp) { return ityp!=0; }
0109   G4bool valid() const { return valid(type()); }
0110 
0111   G4bool isPhoton() const { return G4InuclParticleNames::isPhoton(type()); }
0112   G4bool isMuon() const { return G4InuclParticleNames::isMuon(type()); }
0113   G4bool isElectron() const { return G4InuclParticleNames::isElectron(type()); }
0114   G4bool isNeutrino() const { return G4InuclParticleNames::isNeutrino(type()); }
0115   G4bool pion() const { return G4InuclParticleNames::pion(type()); }
0116   G4bool nucleon() const { return G4InuclParticleNames::nucleon(type()); }
0117   G4bool antinucleon() const { return G4InuclParticleNames::antinucleon(type()); }
0118 
0119   G4int baryon() const {        // Can use as a bool (!=0 ==> true)
0120     return getDefinition()->GetBaryonNumber();
0121   }
0122 
0123   G4bool antibaryon() const { return baryon() < 0; }
0124 
0125   G4bool hyperon() const { return (baryon() && getStrangeness()); }
0126 
0127   G4bool quasi_deutron() const {
0128     return G4InuclParticleNames::quasi_deutron(type());
0129   }
0130 
0131   G4int getStrangeness() const { return getStrangeness(type()); }
0132 
0133   virtual void print(std::ostream& os) const;
0134 
0135   static G4int getStrangeness(G4int type);
0136   static G4double getParticleMass(G4int type);
0137 
0138 protected:
0139   // Convert internal type code to standard GEANT4 pointer
0140   static const G4ParticleDefinition* makeDefinition(G4int ityp);
0141 };        
0142 
0143 #endif // G4INUCL_ELEMENTARY_PARTICLE_HH