Skip to content
Snippets Groups Projects
Commit 40b0935a authored by Yessica Dominguez's avatar Yessica Dominguez
Browse files

Upload New File

parent cd7daa4e
No related branches found
No related tags found
No related merge requests found
#include "stepping.hh"
//#include "G4UserSteppingAction.hh"
#include "G4ThreeVector.hh"
#include "G4Step.hh"
#include "G4ParticleDefinition.hh"
#include "G4Track.hh"
#include "G4SystemOfUnits.hh"
#include <fstream>
MySteppingAction::MySteppingAction()
{}
MySteppingAction::~MySteppingAction()
{}
void MySteppingAction :: UserSteppingAction(const G4Step* step)
{
G4ThreeVector position = step->GetPreStepPoint()->GetPosition();
G4double distanceThreshold = 1200.*m;
// Verifica si la distancia recorrida supera el umbral
if (position.z() == distanceThreshold)
{
const G4Track* track = step->GetTrack();
G4ThreeVector momentum = track->GetMomentum();
G4String particleName = track->GetDynamicParticle()->GetDefinition()->GetParticleName();
std::ofstream outfile;
outfile.open("datos.dat", std::ios_base::app);
// Escribir la información en el archivo
outfile << particleName << " " << position.x() << " " << position.y() << " " << position.z() << " " << momentum.x() << " " << momentum.y() << " " << momentum.z() << std::endl;
// Cerrar el archivo
outfile.close();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment