Message: Please help me to write Track ID and KE to a file Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Please help me to write Track ID and KE to a file 

Keywords: Write KE,TrackID to a file
Forum: Event and Track Management
Date: 06 Dec, 2006
From: <pwijesinghe1@student.gsu.edu>

I have attached my Steppingction here with.
Please help me to write "TrackID" and "Kinetic Energy" of created particles into a file.
(Currently I write other parameters out. as an example energy deposit, particlename and positions as follows)
as
 G4double edep=aStep->GetTotalEnergyDeposit();

      G4String particleName = aStep->GetTrack()->GetDefinition()->GetParticleName();
      G4ThreeVector position = aStep->GetPreStepPoint()->GetPosition();
fileOut->fout << std::setw(15) << X <<std::setw(15)<< Y <<std::setw(15)<< Z <<std::setw(15)<< edep <<std::setw(15)<< (copyID) <<std::setw(15)<<  particleName << G4endl;
)

Also please tell me where I can fine such examples in geant4 or instructions in user manuel.

Thank you very much.

Here is my steppingAction.cc

//DNASteppingAction.cc //2004/05/26 //

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

#include "DNASteppingAction.hh"
#include "G4StepPoint.hh"
#include "G4Material.hh"
#include "G4SteppingControl.hh"
#include "G4StepStatus.hh"           // Include from 'track'
#include "G4TouchableHandle.hh"      // Include from 'geometry'
#include "G4LogicalVolume.hh"
#include "G4Step.hh"
#include "G4Track.hh"
#include "G4ParticleDefinition.hh"
#include "G4ThreeVector.hh"
#include "G4VSolid.hh"
#include "G4Box.hh"
#include "G4TouchableHistory.hh"
#include "G4VTouchable.hh"

#include <iomanip>

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

DNASteppingAction::DNASteppingAction() {

  fileOut = fileIOSingleton::instance();
  G4cout << " I am here " << G4endl;

} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

DNASteppingAction::~DNASteppingAction() { } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void DNASteppingAction::UserSteppingAction(const G4Step* aStep)
{
               G4double edep=aStG4String particleName = aStep->GetTrack()->GetDefinition()->GetParticleName();
      G4ThreeVector position = aStep->GetPreStepPoint()->GetPosition();

 G4TouchableHistory* theTouchable = (G4TouchableHistory*)aStep->GetPostStepPoint()->GetTouchable();

G4int copyID = theTouchable->GetReplicaNumber(0);
      G4double X = position.getX();
      G4double Y = position.getY();
      G4double Z = position.getZ();

       //if(Z>-50.0 && Z<50.0)
     //if(Z == 850.0 && particleName == "mu-")
          //if(Z >= 50)

         fileOut->fout << std::setw(15) << X <<std::setw(15)<< Y <<std::setw(15)<< Z <<std::setw(15)<< edep <<std::setw(15)<< (copyID) <<std::setw(15)<<  particleName << G4endl;

//fileOut->fout << std::setw(15) << X <<std::setw(15) << edep << G4endl; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo... (END)

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Please help me to write Track ID and KE to a file   (Makoto Asai - 06 Dec, 2006)
3 None: Re: Please help me to write Track ID and KE to a file   (Anton Korneev - 10 Dec, 2006)
 Add Message Add Message
to: "Please help me to write Track ID and KE to a file"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]