G4InuclParticle.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 // 20100112  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
00029 // 20100409  M. Kelsey -- Drop unused string argument from ctors.
00030 // 20100519  M. Kelsey -- Add public access to G4DynamicParticle content
00031 // 20100715  M. Kelsey -- Add setKineticEnergy() function
00032 // 20100915  M. Kelsey -- Add constructor to copy G4DynamicParticle input
00033 // 20110214  M. Kelsey -- Replace integer "model" with enum
00034 // 20110225  M. Kelsey -- Add equality operator (NOT sorting!)
00035 // 20110721  M. Kelsey -- Add model ID as optional ctor argument (so subclasses
00036 //              don't have to call SetModel()).
00037 // 20110917  M. Kelsey -- Add coalesence to model ID list
00038 // 20110919  M. Kelsey -- Move setDefinition code to .cc to allow null argument
00039 // 20110922  M. Kelsey -- Add stream argument to printParticle() => print(),
00040 //              add operator<<().
00041 
00042 #ifndef G4INUCL_PARTICLE_HH
00043 #define G4INUCL_PARTICLE_HH
00044 
00045 #include <iosfwd>
00046 #include <CLHEP/Units/SystemOfUnits.h>
00047 
00048 #include "globals.hh"
00049 #include "G4LorentzVector.hh"
00050 #include "G4DynamicParticle.hh"
00051 
00052 class G4InuclParticle {
00053 public:
00054   // used to indicate model that created instance of G4InuclParticle
00055   // 0 default
00056   // 1 bullet
00057   // 2 target
00058   // 3 G4ElementaryParticleCollider
00059   // 4 G4IntraNucleiCascader
00060   // 5 G4NonEquilibriumEvaporator
00061   // 6 G4EquilibriumEvaporator
00062   // 7 G4Fissioner
00063   // 8 G4BigBanger
00064   // 9 G4PreCompound
00065   // 10 G4CascadeCoalescence
00066   enum Model { DefaultModel, bullet, target, EPCollider, INCascader,
00067                NonEquilib, Equilib, Fissioner, BigBanger, PreCompound,
00068                Coalescence };
00069 
00070 public:
00071   G4InuclParticle() : modelId(DefaultModel) {}
00072 
00073   G4InuclParticle(const G4DynamicParticle& dynPart, Model model=DefaultModel)
00074     : pDP(dynPart), modelId(model) {}
00075 
00076   G4InuclParticle(const G4LorentzVector& mom, Model model=DefaultModel)
00077     : modelId(model) { pDP.Set4Momentum(mom*CLHEP::GeV/CLHEP::MeV); }   // Bertini to G4 units
00078 
00079   virtual ~G4InuclParticle() {}
00080 
00081   // Copy and assignment constructors for use with std::vector<>
00082   G4InuclParticle(const G4InuclParticle& right)
00083     : pDP(right.pDP), modelId(right.modelId) {}
00084 
00085   G4InuclParticle& operator=(const G4InuclParticle& right);
00086 
00087   // Equality (comparison) operator -- NOT SORTING
00088   bool operator==(const G4InuclParticle& right) {
00089     return ( (&right == this) || (pDP == right.pDP) );  // Ignore model code
00090   }
00091 
00092   bool operator!=(const G4InuclParticle& right) {
00093     return !operator==(right);
00094   }
00095 
00096   // This is no longer required, as setMomentum() handles mass adjustment
00097   void setEnergy() { ; }
00098 
00099   // These are call-throughs to G4DynamicParticle
00100   void setMomentum(const G4LorentzVector& mom);
00101 
00102   void setKineticEnergy(G4double ekin) { pDP.SetKineticEnergy(ekin*CLHEP::GeV/CLHEP::MeV); }
00103 
00104   void setMass(G4double mass) { pDP.SetMass(mass*CLHEP::GeV/CLHEP::MeV); }
00105 
00106   G4double getMass() const {
00107     return pDP.GetMass()*CLHEP::MeV/CLHEP::GeV; // From G4 to Bertini units
00108   }
00109 
00110   G4double getCharge() const {
00111     return pDP.GetCharge();
00112   }
00113 
00114   G4double getKineticEnergy() const {
00115     return pDP.GetKineticEnergy()*CLHEP::MeV/CLHEP::GeV; // From G4 to Bertini units
00116   }
00117 
00118   G4double getEnergy() const {
00119     return pDP.GetTotalEnergy()*CLHEP::MeV/CLHEP::GeV; // From G4 to Bertini units
00120   }
00121 
00122   G4double getMomModule() const {
00123     return pDP.GetTotalMomentum()*CLHEP::MeV/CLHEP::GeV; // From G4 to Bertini units
00124   }
00125 
00126   G4LorentzVector getMomentum() const {
00127     return pDP.Get4Momentum()*CLHEP::MeV/CLHEP::GeV; // From G4 to Bertini units
00128   }
00129 
00130   virtual void print(std::ostream& os) const;
00131 
00132   G4ParticleDefinition* getDefinition() const {
00133     return pDP.GetDefinition();
00134   }
00135 
00136   const G4DynamicParticle& getDynamicParticle() const {
00137     return pDP;
00138   }
00139 
00140 public:
00141   void setModel(Model model) { modelId = model; }
00142   Model getModel() const { return modelId; }
00143 
00144 protected: 
00145   //  Special constructors for subclasses to set particle type correctly
00146   explicit G4InuclParticle(G4ParticleDefinition* pd, Model model=DefaultModel)
00147     : modelId(model) { setDefinition(pd); }
00148 
00149   // FIXME: Bertini code doesn't pass valid 4-vectors, so force mass value
00150   //        from supplied PartDefn, with required unit conversions
00151   G4InuclParticle(G4ParticleDefinition* pd, const G4LorentzVector& mom,
00152                   Model model=DefaultModel);
00153 
00154   // NOTE:  Momentum forced along Z direction
00155   G4InuclParticle(G4ParticleDefinition* pd, G4double ekin,
00156                   Model model=DefaultModel)
00157     : pDP(pd,G4ThreeVector(0.,0.,1.),ekin*CLHEP::GeV/CLHEP::MeV), modelId(model) {}
00158 
00159   void setDefinition(G4ParticleDefinition* pd);
00160 
00161 private:
00162   G4DynamicParticle pDP;                // Carries all the kinematics and info
00163   Model modelId;
00164 };        
00165 
00166 // Proper stream output (just calls print())
00167 
00168 std::ostream& operator<<(std::ostream& os, const G4InuclParticle& part);
00169 
00170 #endif // G4INUCL_PARTICLE_HH 

Generated on Mon May 27 17:48:38 2013 for Geant4 by  doxygen 1.4.7