Not getting beta continuum in energy deposited

Hi all,

I have been trying to get the spectra (total energy deposited) of La 138.
I am not able to see the peak broadening at around 789 keV due to the 789 keV gamma of cerium and the beta decay continuum. I just get a sharp peak at 789 keV. Part from that I am able to see the 32 keV K alpha line and also the 1463 keV gamma.

Simulation details: 2.5cm x 2.5cm LaBr(Ce) crystal. La 138 ion is positioned at 3.5 mm from the crystal face.

The simulated preliminary spectra is attached below,

However, I am trying to get something like this with the beta minus continuum.

Can someone please help me to pin what is going wrong here ?

Thanks a lot !

1 Like


Can you change Y-scale to linear, to compare with what you gave ref.
Also the X scale is on MeV not as keV.


The reference spectrum you show is, if I recall correctly, for 138La distributed inside the LaBr3:Ce crystal and decaying inside it. Thus there is a gamma+beta sum continuum and a beta continuum. In your simulation, your source is 3.5mm from the face of crystal. The probability of both a beta and its corresponding gamma entering the crystal in a single event is much reduced compared to the nearly 100 probability when the 138La is inside the crystal.

Dear Sir,
Thanks for your reply; please find the spectra in linear scale.

Please let me know for any further queries.

Dear Sir,

Thanks a lot for your reply and lucid explanation. Yes, indeed, I tried to simulate by keeping the La 138 source at the center of the LaBr3 crystal. However, I am probably still getting the wrong spectra. I think that the energies are being “added up” somehow.
Here is the spectra

Can you please suggest what can be the issue.
Please also see the scoring part in stepping action file

  if (volume != fScoringVolume) 
    // get edep of each step
    G4double edep= step->GetTotalEnergyDeposit();
    // integrate all edep of each event
     if (edep<0*MeV) return ;

PS: In the above spectrum, the gaussian broadening has been removed for simplicity; I think the beta continuum should still be visible.

Thanks a lot!

The spectra [new] presented does not make sense on gammas from 138La source. There is something wrong you might be doing. On one hand I thought the spectra is from source ‘Na’ on LaBr(Ce).

Nevertheless, the gamma spectra of 138La will show only two peaks.

And the particle spectra (e-/e+) will be

Nb of generated particles generated during a run on the decay of 138La: 

            Ba138: 5904236  Emean =   8.03 eV 	( 8.026 eV  --> 13.73 eV )	stable
  Ba138[1435.816]: 5904236  Emean = 0.3601 eV 	( 0.3601 eV  --> 0.3601 eV )	mean life = 0.2914 ps 
            Ce138: 3095764  Emean =  2.432 eV 	( 2.422 eV  --> 5.557 eV )	mean life = 1.299e+14 y  
   Ce138[788.744]: 3095764  Emean = 0.5473 eV 	( 0.0001019 eV  --> 1.285 eV )	mean life = 2.972 ps 
            La138: 9000000  Emean =      0 eV 	( 0 eV  --> 0 eV )	mean life = 1.473e+11 y  
        anti_nu_e: 3095764  Emean =  162.1 keV	( 250.7 eV  --> 258.1 keV)	stable
               e-: 3111538  Emean =  100.3 keV	( 0.07023 eV  --> 1.436 MeV)	stable
            gamma: 8984226  Emean =  1.214 MeV	( 788.7 keV --> 1.436 MeV)	stable
             nu_e: 5904236  Emean =  304.1 keV	( 304.1 keV --> 304.1 keV)	stable

The concept you asked the energy deposition, then you perhaps are defining the resolution. Why not you add resolution in your calculations.


It looks like the general shape of the spectrum is correct (it would be easier to tell on a linear plot). The energy scale is not correct so there is likely something wrong in your energy summation for each event. Perhaps you are occasionally not zeroing the energy sum variable after some events? There is not enough code shown to be able to tell.

Dear Sir,
Thanks a lot for your reply.
Here is the spectra in linear.

I missed that the general profile of spectra looks like that from la138 initially. It seems to me that the whole x axis is shifted by roughly 1MeV. However, I am not able to resolve this or point the issue with my code.

Here are some relevant parts of code, please let me know if any further clarifications are required

Stepping action

#include "stepping.hh"
#include "G4RunManager.hh"

steppingaction::steppingaction(eventaction* eventAction){


void steppingaction::UserSteppingAction (const G4Step* step){
    const detectorconstruction* detectorConstruction = static_cast<const detectorconstruction*>
    G4LogicalVolume* fScoringVolume = detectorConstruction->GetScoringVolume();
    G4LogicalVolume *volume = step->GetPreStepPoint()->GetTouchableHandle()
    if (volume != fScoringVolume) 
    // get edep of each step
    G4double edep= step->GetTotalEnergyDeposit();
    // integrate all edep of each event
    if (edep<0*MeV) return ;

Event Action (the value of edep is reset to 0 at start of each event)

#include "event.hh"

// initialize constructor
    // create variable 
// initialize destructor

// functions

void eventaction::BeginOfEventAction(const G4Event*){


void eventaction::EndOfEventAction(const G4Event*){
    G4AnalysisManager* man= G4AnalysisManager::Instance();
    if (fEdep<=0.0*MeV) return;


Run Action

#include "runaction.hh"

// define the constructor
// define the destructor

void runaction::BeginOfRunAction(const G4Run* run){
    // initializate the run manager to store the hits
    G4AnalysisManager*man = G4AnalysisManager::Instance();
    // create a file for each run
    G4int RunID = run->GetRunID();
    std::stringstream strRunID;
    // create the root file
void runaction::EndOfRunAction(const G4Run*){
    G4AnalysisManager*man = G4AnalysisManager::Instance();

Detector Construction

G4ThreeVector positionLaBr3 = G4ThreeVector(0, 0, LaBr3_PosZ);
   G4Tubs* solidLaBr3 = new G4Tubs("solidLaBr3", 0., 0.5 * LaBr3Face, 0.5 * LaBr3Thickness, 0. * deg, 360. * deg);
   G4LogicalVolume* logicLaBr3 = new G4LogicalVolume(solidLaBr3, LaBr3_Ce, "logicLaBr3", 0, 0, 0);
   fScoringVolume=logicLaBr3; //setting up scoring volume
   new G4PVPlacement(0, positionLaBr3, logicLaBr3, "physLaBr3", logicWorld, false, 0, checkOverlaps);

Thanking You

Dear @drvijayraj Sir,

Thanks a lot for sharing the detailed spectra and explaining the issue. I will try rechecking if I am defining something wrong or there are issues.

You need to check the return value of GetTotalEnergyDeposit() in the end of an event.


Dear SIr,

Thanks for the assistance, I am trying to get the return GetTotalEnergyDeposit() values, however, what I observe is as soon as the source is inside the LaBr3 detector it seems there is an additional 1MeV energy that is added for every event.

I repeated the same thing for Co60 and again the x axis seems to be shifted by 1 MeV. This strange behavior is similar for other radioactive ions(/gps/particle ion) as well. Please find the attached spectra. Interestingly when I just use a /gps/particle gamma the energy is not shifted.

I am not sure, but I think some extra 1MeV energy is being added whenever I keep the source inside the volume. Any suggestions as to what can this behavior be attributed to.

Thanks a lot

Look the spectra in this head, it initialize from zero keV scale.

And please check the return values. Else subtract 1 from the DE while filling values in tuple, however this will not be a good practice.


Just a hunch. Try /gps/particle ion with a pure gamma emitter inside the scintillator and show us the spectrum.

yes @John_McFee, this is a good point to note.

1 Like

Try /gps/particle ion with a pure gamma emitter inside the scintillator and show us the spectrum.

On reflection, you may have trouble finding such an emitter. Perhaps an isomer like Tc99m if you suppress the Tc99 beta decay.

You could also try a pure beta emitter, such as Sr89 or P32.

Dear John,
Thanks a lot for the valuable input,
Yeah, it is a bit tricky to get pure gamma emitter.
I tried with the macro below.

/gun/particle ion
/gun/ion 28 60 0 2505.5 
/run/printProgress 10000
/run/beamOn 5

I tested it with /rdecay01 and got the following output.

======================== run summary ======================
 The run was 50 Ni60[2505.500] of 0 eV 

 Nb of generated particles: 

             Ni60:      50  Emean =  15.91 eV 	( 15.91 eV  --> 15.91 eV )	stable
   Ni60[1332.514]:      50  Emean =  12.33 eV 	( 12.33 eV  --> 12.33 eV )	mean life = 1.06 ps 
   Ni60[2505.500]:      50  Emean =      0 eV 	( 0 eV  --> 0 eV )
            gamma:     100  Emean =  1.253 MeV	( 1.173 MeV --> 1.332 MeV)	stable

   Ekin Total (Q single decay): mean =  1.253 MeV	( 1.173 MeV --> 1.333 MeV)

   Momentum balance (excluding gamma desexcitation): mean =  1.453 MeV	( 369.5 keV --> 2.503 MeV)

   Total time of life (full chain): mean = 0.6765 ps   half-life = 0.4689 ps    ( 0.02083 ps  --> 3.376 ps )

   Total visible energy (full chain) : mean =  2.506 MeV   ( 2.506 MeV --> 2.506 MeV)

   Activity of Ni60[2505.500] =      0 Bq/g   (0 Ci/g) 

The idea was to just start with an excited state on NIckel 60 (after it has been populated by beta decay).

However, when I try the original example, it produces some “blue” tracks along with the two gammas as well. I am trying to identify that particle. Otherwise, I think I should switch to a pure beta emitter and share the spectra soon.

Thanks a lot.

Dear John,

The spectra for Sr89. It seems it still has the 1 MeV shifted when the source is inside the detector volume as compared to outside.
Please find the spectra for both the cases

There is no gaussian brodeening used here. Please let me know incase of any additional information/clarifications.
Thank You

It looks like two things are happening. Your energies are shifted by +1MeV and there is a cutoff below 1MeV. It seems likely that this is a programming problem, not a physics problem. I suggest that you recompile in DEBUG mode and step through with a good debugger like gdb.

Hi @John_McFee,
Thanks for pointing this out.
Can you please point to some resources for this or shed some more light on how to achieve the debugging, I am a beginner so it will be very helpful.

I found something on an old post on forum,

Thanks a lot

Michael has described very well what you have to do to recompile your code to enable you to use a debugger to step through your code.

if you have never used a debugger, you’ll have to talk to one of the programming “wizards” at your institute. It is not something that we can teach in this forum. Or if you know which debugger you are going to use, you can search on line for tutorials or cheat sheets on how to use the debugger. (I suggested gdb, but that is for Linux. Windows and Macs have their own.)

An alternative, although not the best way to do this, is to not use a debugger and instead put strategic print statements throughout your code (e.g., near where you sum the deposited energy, etc.) and examine the printouts to find the bug. That assumes you know your code well and are proficient at C++ programming.

1 Like