Message: Re: gps command not work in brachythearpy example when using interactive mode Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Warning Re: gps command not work in brachythearpy example when using interactive mode  

Forum: Medical Applications
Re: Question gps command not work in brachythearpy example when using interactive mode (ehab)
Date: 10 Jan, 2011
From: Oscar García <Oscar García>

Hi dear ehab, Dr Sussane and Michel:

I'm working on the brachythrapy example too and when I try to set the GeneralParticleSource in this example I get the same trouble, no generate gamma particle but geantino particles are generated. I'm so confused with that.

I only replace in the PrimaryGeneratorActionIr class the GunParticle for GeneralParticleSource like it is usually but no gamma particle neither random direction are generate, the momentum direction it's fixed in (0, -1, 0)...

The verbose shows the following:

=====================================
  G4EventManager::ProcessOneEvent()  
=====================================
1 vertices passed from G4Event.
G4PrimaryTransformer::PrimaryVertex (0(mm),0(mm),0(mm),0(nsec))
Primary particle (geantino) --- Transfered with momentum (0,0,-1)
A new track 0x33c3b50 (trackID 1, parentID 0) is passed to G4StackManager.
1 primaries are passed from G4EventTransformer.
!!!!!!! Now start processing an event !!!!!!!
### pop requested out of 1 stacked tracks.
Track 0x33c3b50 (trackID 1, parentID 0) is passed to G4TrackingManager.

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

Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolume ProcName
    0        0        0        0         1        0        0         0 CapsulePhys initStep
    1        0        0   -0.225         1        0    0.225     0.225 IridiumCorePhys Transportation
    2        0        0    -3.73         1        0      3.5      3.73 CapsulePhys Transportation
    3        0        0     -5.7         1        0     1.98       5.7 PhantomPhys Transportation
    4        0        0     -150         1        0      144       150   WorldPhys Transportation
amsmlkj 0
    5        0        0   -4e+03         1        0 3.85e+03     4e+03  OutOfWorld Transportation
Track (trackID 1, parentID 0) is processed with stopping code 2
### pop requested out of 0 stacked tracks.
### 0 waiting tracks are re-classified to
     0 urgent tracks and 0 waiting tracks.
NULL returned from G4StackManager.
Terminate current event processing.

GEANTINO PARTCLES ARE GENERATED!!.. I don't know why this happens. I appreciate your help with this.

My PrimaryGeneratorActionIr is following:

########################################## >> PrimaryGeneratorActionIr.hh
#ifndef BrachyPrimaryGeneratorActionIr_h
#define BrachyPrimaryGeneratorActionIr_h 1

#include "globals.hh"
#include <vector>
#include "G4VUserPrimaryGeneratorAction.hh"
#include "BrachyPrimaryGeneratorAction.hh"

class G4ParticleGun; class G4Run; class G4Event; class BrachyAnalysisManager; class BrachyPrimaryGeneratorAction; class G4GeneralParticleSource;

class BrachyPrimaryGeneratorActionIr: public G4VUserPrimaryGeneratorAction { public:

  BrachyPrimaryGeneratorActionIr();
  ~BrachyPrimaryGeneratorActionIr();
  void GeneratePrimaries(G4Event* anEvent);
  G4double GetEnergy(){return primaryParticleEnergy;};

private:
  //G4ParticleGun* particleGun;
  G4double primaryParticleEnergy;
  G4GeneralParticleSource* gps;
};

#endif

########################################## >> PrimaryGeneratorActionIr.cc

#include "BrachyPrimaryGeneratorActionIr.hh"

#ifdef G4ANALYSIS_USE
#include "BrachyAnalysisManager.hh"
#endif

#include "globals.hh"
#include "G4ParticleTable.hh"
#include "Randomize.hh"  
#include "G4Event.hh"
#include "G4ParticleGun.hh"
//#include "G4IonTable.hh"
#include "G4UImanager.hh"
#include "G4RunManager.hh"

#include "G4GeneralParticleSource.hh"

BrachyPrimaryGeneratorActionIr::BrachyPrimaryGeneratorActionIr()
{
  // G4int NumParticles = 1;
  //particleGun = new G4ParticleGun(NumParticles); 
  gps = new G4GeneralParticleSource();
}

BrachyPrimaryGeneratorActionIr::~BrachyPrimaryGeneratorActionIr()
{
  //if(particleGun)
  //delete particleGun;
  delete gps;
}

void BrachyPrimaryGeneratorActionIr::GeneratePrimaries(G4Event* anEvent) {

  gps->GeneratePrimaryVertex(anEvent);

  /*
#ifdef G4ANALYSIS_USE
  BrachyAnalysisManager* analysis = BrachyAnalysisManager::getInstance();
#endif

  // Define primary particle type
  G4ParticleTable* pParticleTable = G4ParticleTable::GetParticleTable();
  G4String ParticleName = "gamma";
  G4ParticleDefinition* pParticle = pParticleTable -> FindParticle(ParticleName);
  particleGun -> SetParticleDefinition(pParticle);

  //  Random generation of gamma source point inside the Iridium core
  G4double x,y,z;
  G4double radius = 0.30*mm;
  do{
    x = (G4UniformRand()-0.5)*(radius)/0.5;
    y = (G4UniformRand()-0.5)*(radius)/0.5;
  }while(x*x+y*y > radius*radius);

  z = (G4UniformRand()-0.5)*1.75*mm/0.5 -1.975*mm  ;

  G4ThreeVector position(x,y,z);
  particleGun -> SetParticlePosition(position);

  // Random generation of the impulse direction
  G4double a,b,c;
  G4double n;
  do{
    a = (G4UniformRand()-0.5)/0.5;
    b = (G4UniformRand()-0.5)/0.5; 
    c = (G4UniformRand()-0.5)/0.5;
    n = a*a+b*b+c*c;
  }while(n > 1 || n == 0.0);
  n = std::sqrt(n);
  a /= n;
  b /= n;
  c /= n;

  G4ThreeVector direction(a,b,c);
  particleGun->SetParticleMomentumDirection(direction);

  // Primary particle energy
  primaryParticleEnergy = 356.*keV;
  particleGun->SetParticleEnergy(primaryParticleEnergy);

  //1D Histogram of primary particle energy ...
#ifdef G4ANALYSIS_USE
  analysis -> PrimaryParticleEnergySpectrum(primaryParticleEnergy);
#endif   

  // Generate a primary particle
  particleGun -> GeneratePrimaryVertex(anEvent);
  */

}

My GPS macro file is:

/control/verbose 2

/tracking/verbose 2

/event/verbose 2

/gps/verbose 2

/gps/particle gamma

/gps/pos/type Point

/gps/pos/centre 0. 0. 0. cm

/gps/ang/type iso

/gps/energy 0.340 MeV

/vis/scene/create

/vis/open OGLIX

/vis/viewer/flush

/vis/viewer/set/viewpointThetaPhi 90 180 deg

/vis/viewer/zoom 1.4

/tracking/storeTrajectory 1

/vis/scene/endOfEventAction accumulate

/vis/viewer/update

/vis/viewer/zoom 20

/run/beamOn 10000

Regards, Oscar.

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

1 None: RE: gps command not work in brachythearpy example when using interactive mode   (Susanna Guatelli - 10 Jan, 2011)
 Add Message Add Message
to: "Re: gps command not work in brachythearpy example when using interactive mode "

 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 ]