Message: Setting a User Limit and G4EmCalculator Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Setting a User Limit and G4EmCalculator 

Forum: Run Management
Date: 04 Sep, 2012
From: David <David>

I would like to set a maximum track length for a specific volume that is energy, material, and particle dependent.

Currently, I have the following in DetectorConstruction:

  G4double maxTrackLength = 0.001*cm;
  fMaxTrack = new G4UserLimits(0,maxTrackLength);

This works fine, but I would like to use GetCSDArange from G4EmCalculator to determine maxTrackLength. However, when I pass:

  G4double range1 = emCal.GetCSDARange(1*MeV,G4Electron::Electron(),Al);
  G4double range2 = emCal->GetCSDARange(energy*pow(2e0,-1e0/8e0),G4Electron::Electron(),Al);
  G4double maxTrackLength = range1-range2;
  maxTrackLength = maxTrackLength/numberOfSubSteps;

the values range1 and range2 are zero. My questions are:

1 - Is this a good approach to applying the max track length user limit? 2 - If so, why is getCSDARange returning zeros?

I took a look at G4EmCalculator and GetCSDARange does the following:

G4double G4EmCalculator::GetCSDARange(G4double kinEnergy, 
				      const G4ParticleDefinition* p,
				      const G4Material* mat, 
				      const G4Region* region)
  G4double res = 0.0;
  const G4MaterialCutsCouple* couple = FindCouple(mat,region);
  if(couple && UpdateParticle(p, kinEnergy)) {
    res = manager->GetCSDARange(p, kinEnergy, couple);
    if(verbose>0) {
      G4cout << "G4EmCalculator::GetRange: E(MeV)= " << kinEnergy/MeV
	     << " range(mm)= " << res/mm
	     << "  " <<  p->GetParticleName()
	     << " in " <<  mat->GetName()
	     << G4endl;
  return res;

I am not certain that I am passing the if statement...



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

1 None: Re: Setting a User Limit and G4EmCalculator   (David - 04 Sep, 2012)
2 Idea: Re: Setting a User Limit and G4EmCalculator   (Vladimir Ivanchenko - 06 Sep, 2012)
 Add Message Add Message
to: "Setting a User Limit and G4EmCalculator"

 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 ]