Message: Change some process in G4OpAbsorption Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Change some process in G4OpAbsorption 

Forum: Processes Involving Optical Photons
Date: 28 Aug, 2014
From: <cyuchiash>

Hi, everyone!

I am trying to change the code in the G4OpAbsorption.cc so that I can add a secondary once the optical photon is absorbed in the certain material.

Here's how I edit the code.

G4VParticleChange*
G4OpAbsorption::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
{
        aParticleChange.Initialize(aTrack);

        G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();
        Material = pPostStepPoint -> GetMaterial();
        G4MaterialPropertyVector* Rindex;

        Rindex = Material ->GetMaterialPropertiesTable()->GetProperty("IMAGINARYRINDEX");

            if (Rindex) {
                if (verboseLevel>0) {
	           G4cout << "\n** Photoelectric! **" << G4endl;
                }
                aParticleChange.SetNumberOfSecondaries(1);

                G4ThreeVector ElectDirection = G4RandomDirection();
                G4double ElectKineEnergy = aStep.GetTrack()->GetKineticEnergy(); 

                G4DynamicParticle* aParticle1= new G4DynamicParticle(G4Electron::Electron(), ElectDirection, ElectKineEnergy);
                 aParticleChange.AddSecondary(aParticle1);
                 aParticleChange.ProposeTrackStatus(fStopAndKill);
                 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
       } else {
            aParticleChange.ProposeTrackStatus(fStopAndKill);

           if (verboseLevel>0) {
	     G4cout << "\n** Photon absorbed! **" << G4endl;
           }
           return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
       }
}

However, after I recompile Geant4 and the application, I found no changes. What's the problem! How can I get the expected result?

 Add Message Add Message
to: "Change some process in G4OpAbsorption"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews