Back to home page

EIC code displayed by LXR

 
 

    


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

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 #ifndef G4HadFinalState_hh
0027 #define G4HadFinalState_hh
0028 
0029 // Modifications:
0030 // 20110810  M. Kelsey -- Store secondaries by value, not by pointer.
0031 //      Improve constness of argument passing.  Drop stale flag.
0032 // 20110907  M. Kelsey -- Improve constness of functions, discard add pointer,
0033 //      add function to concatenate vectors
0034 
0035 #include "globals.hh"
0036 #include "G4DynamicParticle.hh"
0037 #include "G4HadSecondary.hh"
0038 #include "G4LorentzRotation.hh"
0039 #include "G4ThreeVector.hh"
0040 #include <vector>
0041 
0042 enum G4HadFinalStateStatus{isAlive, stopAndKill, suspend};
0043 
0044 
0045 class G4HadFinalState
0046 {
0047 public:
0048   G4HadFinalState();
0049 
0050   inline
0051   std::size_t GetNumberOfSecondaries() const           { return theSecs.size(); }
0052   void SetEnergyChange(G4double anEnergy);
0053   inline
0054   G4double GetEnergyChange() const               { return theEnergy; }
0055   inline
0056   void SetMomentumChange(const G4ThreeVector& aV){ theDirection=aV; }
0057   void SetMomentumChange(G4double x, G4double y, G4double z);
0058   inline
0059   const G4ThreeVector& GetMomentumChange() const { return theDirection; }
0060   inline
0061   void AddSecondary(G4DynamicParticle* aP, G4int mod=-1) {
0062     theSecs.push_back(G4HadSecondary(aP, theW, mod));
0063   };
0064   inline
0065   void AddSecondary(const G4HadSecondary& aHS)   { theSecs.push_back(aHS); }
0066   inline
0067   void SetStatusChange(G4HadFinalStateStatus aS) { theStat=aS; }
0068   inline
0069   G4HadFinalStateStatus GetStatusChange() const  { return theStat; }
0070   void Clear();
0071   inline
0072   const G4LorentzRotation& GetTrafoToLab() const { return theT; }
0073   inline
0074   void SetTrafoToLab(const G4LorentzRotation & aT) { theT = aT; }
0075   inline
0076   void SetWeightChange(G4double aW)              { theW=aW; }
0077   inline
0078   G4double GetWeightChange() const               { return theW; }
0079   G4HadSecondary* GetSecondary(size_t i);
0080   const G4HadSecondary* GetSecondary(size_t i) const;
0081   inline
0082   void SetLocalEnergyDeposit(G4double aE)        { theEDep=aE; }
0083   inline
0084   G4double GetLocalEnergyDeposit() const         { return theEDep;}
0085   //  void SecondariesAreStale();    // Deprecated; not needed for values
0086   inline
0087   void ClearSecondaries()                        { theSecs.clear(); }
0088 
0089   // Concatenate lists efficiently
0090   void AddSecondaries(const std::vector<G4HadSecondary>& addSecs);
0091   inline
0092   void AddSecondaries(const G4HadFinalState& addHFS) {
0093     AddSecondaries(addHFS.theSecs);
0094   }
0095   inline
0096   void AddSecondaries(const G4HadFinalState* addHFS) {
0097     if (addHFS) AddSecondaries(addHFS->theSecs);
0098   }
0099 
0100 private:
0101   G4ThreeVector theDirection;
0102   G4double theEnergy;
0103   std::vector<G4HadSecondary> theSecs;
0104   G4HadFinalStateStatus theStat;
0105   G4LorentzRotation theT;
0106   G4double theW;
0107   G4double theEDep;
0108 };
0109 
0110 #endif