Back to home page

EIC code displayed by LXR

 
 

    


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

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 //
0028 //
0029 // Class Description:
0030 //
0031 // Base class for the trajectory state
0032 
0033 // History:
0034 // - Created:   P. Arce
0035 // --------------------------------------------------------------------
0036 
0037 #ifndef G4ErrorTrajState_hh
0038 #define G4ErrorTrajState_hh
0039 
0040 #include "globals.hh"
0041 #include "G4Track.hh"
0042 #include "G4Point3D.hh"
0043 #include "G4Vector3D.hh"
0044 #include "G4ErrorTrajErr.hh"
0045 
0046 enum G4eTSType
0047 {
0048   G4eTS_FREE,
0049   G4eTS_OS
0050 };
0051 
0052 class G4ErrorTrajState
0053 {
0054  public:  // with description
0055   G4ErrorTrajState()
0056     : fCharge(0.)
0057     , theG4Track(0)
0058     , iverbose(0)
0059   {}
0060 
0061   G4ErrorTrajState(const G4String& partType, const G4Point3D& pos,
0062                    const G4Vector3D& mom,
0063                    const G4ErrorTrajErr& errmat = G4ErrorTrajErr(5, 0));
0064   // Constructor by providing particle, position and momentum
0065 
0066   G4ErrorTrajState(const G4ErrorTrajState&);
0067   G4ErrorTrajState(G4ErrorTrajState&&);
0068   // The copy and move constructors
0069 
0070   virtual ~G4ErrorTrajState() {}
0071 
0072   G4ErrorTrajState& operator=(const G4ErrorTrajState&);
0073   G4ErrorTrajState& operator=(G4ErrorTrajState&&);
0074   // The copy and move assignment operators
0075 
0076   void SetData(const G4String& partType, const G4Point3D& pos,
0077                const G4Vector3D& mom);
0078   // Set particle, position and momentum
0079 
0080   void BuildCharge();
0081   // Build charge based on particle type
0082 
0083   friend std::ostream& operator<<(std::ostream&, const G4ErrorTrajState& ts);
0084 
0085   virtual G4int PropagateError(const G4Track*);
0086   // Propagate the error along the step
0087 
0088   virtual G4int Update(const G4Track*) { return -1; }
0089   // Update parameters from G4Track
0090 
0091   void UpdatePosMom(const G4Point3D& pos, const G4Vector3D& mom);
0092   // Update position and momentum
0093 
0094   void DumpPosMomError(std::ostream& out = G4cout) const;
0095   // Dump position, momentum and error
0096 
0097   virtual void Dump(std::ostream& out = G4cout) const = 0;
0098   // Abstract method to dump all TrajState parameters
0099 
0100   // Set and Get methods
0101 
0102   const G4String& GetParticleType() const { return fParticleType; }
0103   void SetParticleType(const G4String& partType) { fParticleType = partType; }
0104 
0105   G4Point3D GetPosition() const { return fPosition; }
0106   virtual void SetPosition(const G4Point3D pos) { fPosition = pos; }
0107 
0108   G4Vector3D GetMomentum() const { return fMomentum; }
0109   virtual void SetMomentum(const G4Vector3D& mom) { fMomentum = mom; }
0110 
0111   G4ErrorTrajErr GetError() const { return fError; }
0112   virtual void SetError(G4ErrorTrajErr em) { fError = em; }
0113 
0114   G4Track* GetG4Track() const { return theG4Track; }
0115   void SetG4Track(G4Track* trk) { theG4Track = trk; }
0116 
0117   G4double GetCharge() const { return fCharge; }
0118   void SetCharge(G4double ch) { fCharge = ch; }
0119 
0120   virtual G4eTSType GetTSType() const { return theTSType; }
0121 
0122  protected:
0123   G4String fParticleType;
0124   G4Point3D fPosition;
0125   G4Vector3D fMomentum;
0126   G4double fCharge = 0.;
0127   G4ErrorTrajErr fError;
0128 
0129   G4eTSType theTSType;
0130 
0131   G4Track* theG4Track = nullptr;
0132 
0133   G4int iverbose = 0;
0134 };
0135 
0136 #endif