G4ErrorTrajState.cc

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: G4ErrorTrajState.cc 69766 2013-05-14 14:33:55Z gcosmo $
00027 //
00028 // ------------------------------------------------------------
00029 //      GEANT 4 class implementation file 
00030 // ------------------------------------------------------------
00031 //
00032 
00033 #include "G4ErrorTrajState.hh"
00034 #include "G4ParticleTable.hh"
00035 #include "G4ParticleDefinition.hh"
00036 #include "G4ErrorPropagatorData.hh"
00037 
00038 #include <iomanip>
00039 
00040 //--------------------------------------------------------------------------
00041 G4ErrorTrajState::G4ErrorTrajState( const G4String& partType,
00042                                     const G4Point3D& pos,
00043                                     const G4Vector3D& mom,
00044                                     const G4ErrorTrajErr& errmat)
00045   : fParticleType(partType), fPosition(pos), fMomentum(mom), fCharge(0.),
00046     fError(errmat), theTSType(G4eTS_FREE), theG4Track(0)
00047 {
00048   iverbose = G4ErrorPropagatorData::verbose();
00049 }
00050 
00051 
00052 //--------------------------------------------------------------------------
00053 G4int G4ErrorTrajState::PropagateError( const G4Track* )
00054 { 
00055   G4cerr << "ERROR - G4ErrorTrajState::PropagateError()" << G4endl
00056          << "        Called for trajectory state type "
00057          << G4int(GetTSType()) << G4endl;
00058   G4Exception("G4ErrorTrajState::PropagateError", "GEANT4e-Error",
00059               FatalException, "Wrong trajectory state type");
00060    return -1; 
00061 }
00062 
00063 
00064 //--------------------------------------------------------------------------
00065 void G4ErrorTrajState::UpdatePosMom( const G4Point3D& pos,
00066                                      const G4Vector3D& mom )
00067 {
00068   fPosition = pos;
00069   fMomentum = mom;
00070 }
00071 
00072 
00073 //--------------------------------------------------------------------------
00074 void G4ErrorTrajState::SetData( const G4String& partType,
00075                                 const G4Point3D& pos, const G4Vector3D& mom )
00076 {
00077   fParticleType = partType;
00078   BuildCharge();
00079   fPosition = pos;
00080   fMomentum = mom;
00081 }
00082 
00083 
00084 //--------------------------------------------------------------------------
00085 void G4ErrorTrajState::BuildCharge()
00086 {
00087   G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
00088   G4ParticleDefinition* particle = particleTable->FindParticle(fParticleType); 
00089   if( particle == 0)
00090   {
00091     G4cerr << "ERROR - G4ErrorTrajState::BuildCharge()" << G4endl
00092            << "        Particle type not defined: " << fParticleType << G4endl;
00093     G4Exception( "G4ErrorTrajState::BuildCharge()", "GEANT4e-error",
00094                   FatalException, "Particle type not defined!");
00095   }
00096   else
00097   {
00098     fCharge = particle->GetPDGCharge();
00099   }
00100 }
00101 
00102 
00103 //------------------------------------------------------------------------
00104 void G4ErrorTrajState::DumpPosMomError( std::ostream& out ) const
00105 {
00106   out << *this;
00107 }
00108 
00109 
00110 //--------------------------------------------------------------------------
00111 std::ostream& operator<<(std::ostream& out, const G4ErrorTrajState& ts)
00112 {
00113   //  long mode = out.setf(std::ios::fixed,std::ios::floatfield);
00114   out  
00115     << " G4ErrorTrajState of type " << ts.theTSType << " : partycle: "
00116     << ts.fParticleType << "  position: " << std::setw(6) << ts.fPosition
00117     << "              momentum: " << ts.fMomentum
00118     << "   error matrix ";
00119   G4cout << ts.fError << G4endl;
00120 
00121   return out;
00122 }
00123 

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