Message: Re: Setting track weight on transportation steps. Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

More Re: Setting track weight on transportation steps. 

Keywords: transportation track weight bias
Forum: Event and Track Management
Re: Question Setting track weight on transportation steps. (Richard Thompson)
Re: None Re: Setting track weight on transportation steps. (Makoto Asai)
Re: More Re: Setting track weight on transportation steps. (Richard Thompson)
Date: 24 Apr, 2006
From: Richard Thompson <Richard Thompson>

Makoto,

I've upgraded to 4.8.0.p01 and see the same behaviour.

First let me describe in a little better detail what I want to do:
I want to weight tracks based upon information determined at AlongStepDoit.  I want any secondaries produced by physics processes to have this weight, so it seemed sensible to calculate it and apply it during the AlongStepDoit.

And what I observe:
After applying the track weight in AlongStepDoit through G4ParticleChange.ProposeParentWeight, I check the track weight in PostStepDoit via aTrack->GetWeight() and it is always 1, not what I set it to in my AlongStepDoit.

Here's an example of the code:
//--------------------------------------------------------------------------------------------------
G4VParticleChange* VictorRaySplittingProcess::AlongStepDoIt(const G4Track& aTrack,
						  const G4Step& aStep) {

  this->pParticleChange->Initialize(aTrack);
  
  this->pParticleChange->SetParentWeightByProcess(true);
  this->pParticleChange->ProposeParentWeight(0.5);
  cerr << "%%%%%%%%%%%% AlongStep %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << G4endl
       << aTrack.GetDefinition()->GetParticleName() << G4endl
       << aStep.GetPostStepPoint()->GetPosition() << G4endl
       << aTrack.GetMomentum() << G4endl
       << aTrack.GetKineticEnergy() << G4endl
       << aStep.GetStepLength() << G4endl
       << aStep.GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName() << G4endl
       << aStep.GetPostStepPoint()->GetPhysicalVolume()->GetName() << G4endl
       << aTrack.GetWeight() << G4endl
       << pParticleChange->GetParentWeight() << G4endl
       << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << G4endl;

  return G4VProcess::pParticleChange;
}
//--------------------------------------------------------------------------------------------------
G4VParticleChange* VictorRaySplittingProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
{

  this->pParticleChange->Initialize(aTrack);

  G4cerr << "%%%%%%%%%%%% PostStep %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << G4endl
	 << aTrack.GetDefinition()->GetParticleName() << G4endl
	 << aStep.GetPostStepPoint()->GetPosition() << G4endl
	 << aTrack.GetMomentum() << G4endl
	 << aTrack.GetKineticEnergy() << G4endl
	 << aStep.GetStepLength() << G4endl
	 << aStep.GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName() << G4endl
	 << aStep.GetPostStepPoint()->GetPhysicalVolume()->GetName() << G4endl
	 << aTrack.GetWeight() << G4endl
	 << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << G4endl
    ;
  return G4VProcess::pParticleChange;
}
  
//--------------------------------------------------------------------------------------------------


And an example of the output:
%%%%%%%%%%%% AlongStep %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
gamma
(-34.5299,70,-56.9144)
(0,-0.1,0)
0.1
30
Transportation
WorldBoxphys
1
0.5
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% PostStep %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
gamma
(-34.5299,70,-56.9144)
(0,-0.1,0)
0.1
30
Transportation
detector
1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

As you can see, even though the track weight was set to 0.5 in the AlongStepDoit, it was back to 1 by the time PostStepDoit got called.

Here's how I set things up in my physics list:
//--------------------------------------------------------------------------------------------------
void VictorPhysicsMonteCarlo::ConstructProcess()
{
  // The rayplitting process must be first in the process vector.

  AddTransportation();
  ConstructEM();
  if(ModelRaySplitting){
    this->RaySplitting = (G4VProcess*) (new VictorRaySplittingProcess());
    theParticleIterator->reset();
    while( (*theParticleIterator)() ) {
      if(theParticleIterator->value()->GetProcessManager()->AddProcess(this->RaySplitting, ordInActive, ordLast, 1) < 0){
	V0cerr << "VictorPhysicsMonteCarlo::ConstructProcess could not add RaySplitting" << V0endl;
	exit(1);
      }
      // ordLast
    }
  }
}
//--------------------------------------------------------------------------------------------------


Thanks in advance for the advice,

Richard

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

 Add Message Add Message
to: "Re: Setting track weight on transportation steps."

 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 ]