G4CascadParticle.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 // 20100126  M. Kelsey -- Replace vector<G4Double> position with G4ThreeVector,
00030 //              move ::print() to .cc file, fix uninitialized data members
00031 // 20100915  M. Kelsey -- Make getGeneration() const
00032 // 20110729  M. Kelsey -- Add initializer for _all_ data members (path, gen),
00033 //              re-organize declarations, with set/get pairs together
00034 // 20110806  M. Kelsey -- Add fill() function to replicate ctor/op=() action
00035 // 20110922  M. Kelsey -- Add stream argument to print(), add operator<<().
00036 // 20120306  M. Kelsey -- Add access for cumulative path through nucleus.
00037 
00038 #ifndef G4CASCAD_PARTICLE_HH
00039 #define G4CASCAD_PARTICLE_HH
00040 
00041 #include "G4InuclElementaryParticle.hh"
00042 #include "G4LorentzVector.hh"
00043 #include "G4ThreeVector.hh"
00044 #include <iosfwd>
00045 
00046 
00047 class G4CascadParticle {
00048 
00049 public:
00050   // NOTE:  Default constructor does not make a functional object!
00051   G4CascadParticle();
00052 
00053   G4CascadParticle(const G4InuclElementaryParticle& particle, 
00054                    const G4ThreeVector& pos, G4int izone, G4double cpath,
00055                    G4int gen) 
00056     : verboseLevel(0), theParticle(particle), position(pos), 
00057       current_zone(izone), current_path(cpath), movingIn(true),
00058       reflectionCounter(0), reflected(false), generation(gen) {}
00059 
00060   // Analogue to operator=() to support filling vectors w/o temporaries
00061   void fill(const G4InuclElementaryParticle& particle, 
00062             const G4ThreeVector& pos, G4int izone, G4double cpath,
00063             G4int gen);
00064 
00065   const G4InuclElementaryParticle& getParticle() const { return theParticle; }
00066   G4InuclElementaryParticle& getParticle() { return theParticle; }
00067 
00068   G4int getGeneration() const { return generation; }
00069   void setGeneration(G4int gen) { generation = gen; }
00070 
00071   G4LorentzVector getMomentum() const {         // Can't return ref; temporary
00072     return theParticle.getMomentum(); 
00073   }
00074 
00075   void updateParticleMomentum(const G4LorentzVector& mom) {
00076     theParticle.setMomentum(mom);
00077   }
00078 
00079   const G4ThreeVector& getPosition() const { return position; }
00080   void updatePosition(const G4ThreeVector& pos) { position = pos; }
00081 
00082   void incrementReflectionCounter() {
00083     reflectionCounter++; 
00084     reflected = true; 
00085   }
00086   G4int getNumberOfReflections() const { return reflectionCounter; }
00087 
00088   void resetReflection() { reflected = false; }
00089   G4bool reflectedNow() const { return reflected; }
00090 
00091   void initializePath(G4double npath) { current_path = npath; }
00092   void incrementCurrentPath(G4double npath) { current_path += npath; }
00093   G4double getCurrentPath() const { return current_path; }
00094 
00095   void updateZone(G4int izone) { current_zone = izone; }
00096   G4int getCurrentZone() const { return current_zone; }
00097 
00098   void setMovingInsideNuclei(G4bool isMovingIn=true) { movingIn = isMovingIn; }
00099   G4bool movingInsideNuclei() const { return movingIn; }
00100 
00101   G4double getPathToTheNextZone(G4double rz_in, G4double rz_out);
00102   void propagateAlongThePath(G4double path);
00103 
00104   G4bool young(G4double young_path_cut, G4double cpath) const { 
00105     return ((current_path < 1000.) && (cpath < young_path_cut));
00106   }
00107 
00108   void print(std::ostream& os) const;
00109 
00110 private: 
00111   G4int verboseLevel;
00112   G4InuclElementaryParticle theParticle;
00113   G4ThreeVector position;
00114   G4int current_zone;
00115   G4double current_path;
00116   G4bool movingIn;
00117   G4int reflectionCounter;   
00118   G4bool reflected;
00119   G4int generation;
00120 };        
00121 
00122 // Proper stream output (just calls print())
00123 
00124 std::ostream& operator<<(std::ostream& os, const G4CascadParticle& part);
00125 
00126 #endif // G4CASCAD_PARTICLE_HH

Generated on Mon May 27 17:47:51 2013 for Geant4 by  doxygen 1.4.7