I want to simulate a material that follows a very specific scintillation yield, depended on external parameters and the energy deposit over the track length (dE/dx).
If I understand the Developer’s manual correctly,
sets the scintillation yield (in this case for alphas) as a function of the deposited energy in a given step (dE).
As I said, I have a parametrisation of the scintillation yield as a function of dE/dx, and not dE.
I looked through the developer’s manual but did not find any mention on something like this.
Is there a way to set the scintillation yield as a function of the step size in for example the stepping action?
to call your code. You could either write the code there, call a new method in G4Scintillation, or follow the EmSaturation method and have a new class.
In any case, I suggest copying G4Scintillation and G4OpticalPhysics to your local code, and rename them (and changing class names inside files). Then, update the new OpticalPhysics to use your new Scintillation, and in your main change the AddPhysics to add your new optical physics.
Just to summarize if I get it right,
I would copy the header and source files for G4Scintillation and G4OpticalPhysics, rename them to MyScintillation.xx.
In G4Scintillation I implement the LArQL code instead of the emSaturation/Birks law and rename my classes to lets say MyScintillation and MyOpticalPhysics.
In MyOpticalPhysics.xx, I call this new scintillation class instead of the currenlty used G4Scinitllation.
In the main I then basically run MyOpticalPhysics optical_physics = new MyOpticalPhysics();
and register it in my physics list physics_list->RegisterPhysics(optical_physics);
It worked, but I get an error message which states that states
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : TRACK101
issued by : G4VParticleChange::AddSecondary()
Secondary buffer is full. The track is deleted!
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
I guess that this is due to a wrong understanding of what MeanNumberOfPhotons means. I currently interpret the things written in the Toolkit and Application Manuals of Geant4 such that the PostStepDoIt function that I altered should create the Number of photons equivalent to the energy deposit of a single hit in the simulation.
So when I have an energy deposit of 0.5MeV in one step of the width of 3cm, I use my parametrisation which tells me that I have ~20.000 photons produced in this single step.
These 20k photons are then pushed to the G4VParticleChange class, which creates the particles and keeps track of them. This is where I get the error from, right?
Is my interpretation of what PostStepDoIt should do wrong? And if no, how can I increase the secondary buffer?
Never mind - this seemed to be an issue with wrongly set yield1, yield2 and yield3.
I just replaced the NumberOfPhotons without resetting the yield parameters, which ended up in an infinite loop.