Message: problems with energy deposit Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question problems with energy deposit 

Forum: Event and Track Management
Date: 11 Dec, 2004
From: Hayk Gabrielyan <Hayk Gabrielyan>

Hi all!

I'm beginner in Geant4. I have such a problem. I must gather from every initial particle energy deposit in my detector. I do it, as it shown below


#include "TrackingAction.hh"
#include "G4TrackingManager.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4UnitsTable.hh"
#include "G4String.hh"

TrackingAction::TrackingAction() {}

void TrackingAction::PreUserTrackingAction(const G4Track* aTrack)

    G4double energy,edep;
    G4String name,volume;

    name = aTrack->GetDefinition()->GetParticleName();

    energy = aTrack->GetKineticEnergy();

    volume = aTrack->GetVolume()->GetName();

    edep =aTrack->GetStep()->GetTotalEnergyDeposit();

    if ((name=="gamma") && (energy == 1.17*MeV)) 
	{ PutIntoSpectr(E_total);

    if((volume=="csi_1") || (volume=="csi_2") || (volume=="csi_3") || (volume=="csi_4"))

void TrackingAction::PutIntoSpectr(G4double energy)


    FILE *f;

    f=fopen("spectr.txt", "w");

    fprintf(f,"\n", energy);




But it doesn't works, and it didn't make the file spectr.txt, and when it is making the standard output file, it shows information only for the first initial particle:


* G4Track Information:   Particle = gamma,   Track ID = 1,   Parent ID = 0

Step#      X         Y         Z        KineE    dEStep   StepLeng  TrakLeng    Volume     Process
    0      0         0       400      1.17         0         0         0  expHall_phys    initStep


and at the end it writes "Segmentation fault".

where is my mistake.

THANKS in Advance hayk gabrielyan

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

1 Feedback: Re: problems with energy deposit   (Peter Gumplinger - 11 Dec, 2004)
 Add Message Add Message
to: "problems with energy deposit"

 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 ]