Message: Re: Splitting of Compton and Rayleigh Scatter Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Splitting of Compton and Rayleigh Scatter 

Forum: Event and Track Management
Re: Question Splitting of Compton and Rayleigh Scatter (Ioannis Sechopoulos)
Re: None Re: Splitting of Compton and Rayleigh Scatter (Jane Tinslay)
Re: Question Re: Splitting of Compton and Rayleigh Scatter (Ioannis Sechopoulos)
Date: 23 May, 2006
From: Jane Tinslay <Jane Tinslay>

Hello Ioannis,

>
> Thanks Jane,
>
> but if I understand your code correctly, it will make G4 follow the
> duplicate track as it was before the scatter takes place, so the extra
> particles will continue on the original path, right? is there a way to
> create many tracks, submit each to PostStepDoIt, and then have the
> scattered tracks be followed?
>
> Thanks!
>

I think you could modify the properties of the duplicate according to the
result of calling PostStepDoIt on the original G4Track. So something like:

***
Whatever::PostStepDoIt(const G4Track& track, const G4Step& step) {

  G4int nSplit = 2;

  G4double weight = track.GetWeight()/nSplit;

  // Secondary store
  std::vector<G4Track*> secondaries;

  G4ParticleChange* particleChange(0);

  // Will use initial G4Track as well, so loop for nSplit-1
  G4int i(0);
  for(i=0; i<nSplit-1; i++) {

    // PostStepDoIt
    particleChange = dynamic_cast<G4ParticleChange*>(pRegProcess->PostStepDoIt(track, step));

    assert (0 != particleChange);
    particleChange->SetVerboseLevel(0);

    // Create a duplicate track
    G4Track* duplicate = new G4Track(track);

    // Modify duplicate according to particleChange - do what is
    // appropriate for your process here
    duplicate->SetTrackStatus(particleChange->GetTrackStatus());
    duplicate->SetKineticEnergy(particleChange->GetEnergy());
    duplicate->SetMomentumDirection(*(particleChange->GetMomentumDirection()));

    // Save secondaries
    G4int j(0);

    for (j=0; j<particleChange->GetNumberOfSecondaries(); j++) {
      secondaries.push_back(new G4Track(*(particleChange->GetSecondary(j))));
    }

    // Add duplicate to secondary store as well
    secondaries.push_back(duplicate);
  }

  // Use initial G4Track as well
  particleChange = dynamic_cast<G4ParticleChange*>(pRegProcess->PostStepDoIt(track, step));
  assert (0 != particleChange);

  // Set weight
  particleChange->ProposeWeight(weight);

  // Save secondaries
  G4int j(0);

  for (j=0; j<particleChange->GetNumberOfSecondaries(); j++) {
    G4Track* secondary = new G4Track(*(particleChange->GetSecondary(j)));
    secondaries.push_back(secondary);
  }

  // Continue as in BremSplittingProcess - set weight for secondaries
  ...
***

Or something like that - if you use any of this, best to check for
yourself that it does the right thing, since it's not tested all that well.

Cheers,

Jane

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

1 Ok: Re: Splitting of Compton and Rayleigh Scatter   (Ioannis Sechopoulos - 24 May, 2006)
(_ None: Re: Splitting of Compton and Rayleigh Scatter   (Jane Tinslay - 24 May, 2006)
(_ Ok: Re: Splitting of Compton and Rayleigh Scatter   (Ioannis Sechopoulos - 24 May, 2006)
 Add Message Add Message
to: "Re: Splitting of Compton and Rayleigh Scatter"

 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 ]