Back to home page

EIC code displayed by LXR

 
 

    


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

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 // 20100112  M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
0028 // 20100126  M. Kelsey -- Replace vector<G4Double> position with G4ThreeVector,
0029 //      move ::print() to .cc file, fix uninitialized data members
0030 // 20100915  M. Kelsey -- Make getGeneration() const
0031 // 20110729  M. Kelsey -- Add initializer for _all_ data members (path, gen),
0032 //      re-organize declarations, with set/get pairs together
0033 // 20110806  M. Kelsey -- Add fill() function to replicate ctor/op=() action
0034 // 20110922  M. Kelsey -- Add stream argument to print(), add operator<<().
0035 // 20120306  M. Kelsey -- Add access for cumulative path through nucleus.
0036 // 20130221  M. Kelsey -- Move constructor to .cc file for parameter access.
0037 // 20130304  M. Kelsey -- Add index data member, for use with G4CascadeHistory,
0038 //      and explicit copy operations and destructor.
0039 
0040 #ifndef G4CASCAD_PARTICLE_HH
0041 #define G4CASCAD_PARTICLE_HH
0042 
0043 #include "G4InuclElementaryParticle.hh"
0044 #include "G4LorentzVector.hh"
0045 #include "G4ThreeVector.hh"
0046 #include <iosfwd>
0047 
0048 
0049 class G4CascadParticle {
0050 
0051 public:
0052   // NOTE:  Default constructor does not make a functional object!
0053   G4CascadParticle();
0054 
0055   G4CascadParticle(const G4InuclElementaryParticle& particle, 
0056            const G4ThreeVector& pos, G4int izone, G4double cpath,
0057                    G4int gen);
0058 
0059   ~G4CascadParticle() {;}           // No subclasses allowed
0060 
0061   // Allow copying of object data (for use with history and elsewhere)
0062   // NOTE: history index IS copied (to avoid double counting)
0063   G4CascadParticle(const G4CascadParticle& cpart) { *this = cpart; }
0064   G4CascadParticle& operator=(const G4CascadParticle& cpart);
0065 
0066   // Analogue to operator=() to support filling vectors w/o temporaries
0067   // NOTE: history index IS NOT copied (new particle is being made)
0068   void fill(const G4InuclElementaryParticle& particle, 
0069         const G4ThreeVector& pos, G4int izone, G4double cpath,
0070         G4int gen);
0071 
0072   // Data accessors
0073   const G4InuclElementaryParticle& getParticle() const { return theParticle; }
0074   G4InuclElementaryParticle& getParticle() { return theParticle; }
0075 
0076   G4int getGeneration() const { return generation; }
0077   void setGeneration(G4int gen) { generation = gen; }
0078 
0079   G4int getHistoryId() const { return historyId; }
0080   void setHistoryId(G4int id) { historyId = id; }
0081 
0082   G4LorentzVector getMomentum() const {     // Can't return ref; temporary
0083     return theParticle.getMomentum(); 
0084   }
0085 
0086   void updateParticleMomentum(const G4LorentzVector& mom) {
0087     theParticle.setMomentum(mom);
0088   }
0089 
0090   const G4ThreeVector& getPosition() const { return position; }
0091   void updatePosition(const G4ThreeVector& pos) { position = pos; }
0092 
0093   void incrementReflectionCounter() {
0094     reflectionCounter++; 
0095     reflected = true; 
0096   }
0097   G4int getNumberOfReflections() const { return reflectionCounter; }
0098 
0099   void resetReflection() { reflected = false; }
0100   G4bool reflectedNow() const { return reflected; }
0101 
0102   void initializePath(G4double npath) { current_path = npath; }
0103   void incrementCurrentPath(G4double npath) { current_path += npath; }
0104   G4double getCurrentPath() const { return current_path; }
0105 
0106   void updateZone(G4int izone) { current_zone = izone; }
0107   G4int getCurrentZone() const { return current_zone; }
0108 
0109   void setMovingInsideNuclei(G4bool isMovingIn=true) { movingIn = isMovingIn; }
0110   G4bool movingInsideNuclei() const { return movingIn; }
0111 
0112   G4double getPathToTheNextZone(G4double rz_in, G4double rz_out);
0113   void propagateAlongThePath(G4double path);
0114 
0115   G4bool young(G4double young_path_cut, G4double cpath) const { 
0116     return ((current_path < 1000.) && (cpath < young_path_cut));
0117   }
0118 
0119   void print(std::ostream& os) const;
0120 
0121 private: 
0122   G4int verboseLevel;
0123   G4InuclElementaryParticle theParticle;
0124   G4ThreeVector position;
0125   G4int current_zone;
0126   G4double current_path;
0127   G4bool movingIn;
0128   G4int reflectionCounter;   
0129   G4bool reflected;
0130   G4int generation;
0131   G4int historyId;
0132 };        
0133 
0134 // Proper stream output (just calls print())
0135 
0136 std::ostream& operator<<(std::ostream& os, const G4CascadParticle& part);
0137 
0138 #endif // G4CASCAD_PARTICLE_HH