Not getting beta continuum in energy deposited

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.
vrs

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

Test your code as advised by @John_McFee and keep your physics case alive.

VRS

Dear @John_McFee and Dear @drvijayraj thanks for your suggestions. Can you please share your inputs ?

I modifed the example B1 to include the radioactive decays, gps and geometry and its material.

Case1 : Using a 662 keV gamma

/gps/particle gamma
/gps/energy 662 keV

/gps/ang/type iso
/gps/pos/centre 0 0 0 cm
### Run 5 starts.
Enrgy in this Step:0
Enrgy in this Step:0
Enrgy in this Step:0.00034452
Enrgy in this Step:1.018e-05
Enrgy in this Step:5.984e-05
Enrgy in this Step:6.291e-05
Enrgy in this Step:6.291e-05
Enrgy in this Step:1.292e-05
Enrgy in this Step:1.018e-05
Enrgy in this Step:6.76e-05
Enrgy in this Step:0.00061669
Enrgy in this Step:6.258e-05
Enrgy in this Step:6.191e-05
Enrgy in this Step:2.646e-05
Enrgy in this Step:0.00015859
Enrgy in this Step:0.00052645
Enrgy in this Step:0.00011394
Enrgy in this Step:0.00370482
Enrgy in this Step:7.1e-05
Enrgy in this Step:4.324e-05
Enrgy in this Step:4.382e-05
Enrgy in this Step:2.674e-05
Enrgy in this Step:0.00013343
Enrgy in this Step:5.984e-05
Enrgy in this Step:6.291e-05
Enrgy in this Step:6.772e-05
Enrgy in this Step:0.00054106
Enrgy in this Step:0.00022856
Enrgy in this Step:1.292e-05
Enrgy in this Step:1.292e-05
Enrgy in this Step:5.984e-05
Enrgy in this Step:2.646e-05
Enrgy in this Step:6.291e-05
Enrgy in this Step:6.498e-05
Enrgy in this Step:0.00061669
Enrgy in this Step:8.283e-05
Enrgy in this Step:6.835e-05
Enrgy in this Step:0.00011394
Enrgy in this Step:0.00368714
Enrgy in this Step:0.0073477
Enrgy in this Step:0.0196055
Enrgy in this Step:0.131472
Enrgy in this Step:0.314251
Enrgy in this Step:0.177334
Energy in this event0.662
 Run terminated.
Run Summary
  Number of events processed : 1
  User=0.010000s Real=0.032361s Sys=0.010000s

Case 2a: Using a G4 ion (inside the volume)

/gps/particle ion
/gps/ion 55 137
/gps/ang/type iso
/gps/pos/centre 0 0 0 cm

The output for edep in step and event

### Run 4 starts.
----------New Event Starts------------
Particle Name:Cs137
Energy in this Step:1
Particle Name:Cs137
Energy in this Step:0
Particle Name:e-
Energy in this Step:0.196502
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:Ba137[661.659]
Energy in this Step:2.54718e-06
Particle Name:Ba137[661.659]
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0
Particle Name:Ba137
Energy in this Step:1.71685e-06
Particle Name:Ba137
Energy in this Step:0
Energy in this event1.19651
----------New Event Starts------------
Particle Name:Cs137
Energy in this Step:1
Particle Name:Cs137
Energy in this Step:0
Particle Name:e-
Energy in this Step:0.14485
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:Ba137[661.659]
Energy in this Step:1.85624e-06
Particle Name:Ba137[661.659]
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0.00018954
Particle Name:e-
Energy in this Step:1.335e-05
Particle Name:e-
Energy in this Step:1.059e-05
Particle Name:e-
Energy in this Step:8.234e-05
Particle Name:e-
Energy in this Step:4.71e-05
Particle Name:e-
Energy in this Step:6.309e-05
Particle Name:e-
Energy in this Step:5.045e-05
Particle Name:e-
Energy in this Step:0.00066126
Particle Name:e-
Energy in this Step:0.00067391
Particle Name:e-
Energy in this Step:0.00392117
Particle Name:gamma
Energy in this Step:0.00038059
Particle Name:e-
Energy in this Step:6.017e-05
Particle Name:e-
Energy in this Step:1.292e-05
Particle Name:e-
Energy in this Step:1.018e-05
Particle Name:e-
Energy in this Step:1.018e-05
Particle Name:e-
Energy in this Step:6.465e-05
Particle Name:e-
Energy in this Step:4.452e-05
Particle Name:e-
Energy in this Step:6.784e-05
Particle Name:e-
Energy in this Step:8.566e-05
Particle Name:e-
Energy in this Step:5.984e-05
Particle Name:e-
Energy in this Step:2.841e-05
Particle Name:e-
Energy in this Step:8.817e-05
Particle Name:e-
Energy in this Step:6.465e-05
Particle Name:e-
Energy in this Step:6.465e-05
Particle Name:e-
Energy in this Step:0.00045439
Particle Name:e-
Energy in this Step:0.00070856
Particle Name:e-
Energy in this Step:6.835e-05
Particle Name:e-
Energy in this Step:0.00019937
Particle Name:e-
Energy in this Step:0.0030107
Particle Name:e-
Energy in this Step:0.0292594
Particle Name:e-
Energy in this Step:0.215346
Particle Name:e-
Energy in this Step:0.405855
Particle Name:Ba137
Energy in this Step:1.71685e-06
Particle Name:Ba137
Energy in this Step:0
Energy in this event1.80651
----------New Event Starts------------
Particle Name:Cs137
Energy in this Step:1
Particle Name:Cs137
Energy in this Step:0
Particle Name:e-
Energy in this Step:0.0185666
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:Ba137[661.659]
Energy in this Step:1.42021e-06
Particle Name:Ba137[661.659]
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0.00011878
Particle Name:e-
Energy in this Step:4.324e-05
Particle Name:e-
Energy in this Step:4.438e-05
Particle Name:e-
Energy in this Step:3.009e-05
Particle Name:e-
Energy in this Step:3.378e-05
Particle Name:e-
Energy in this Step:0.00133183
Particle Name:gamma
Energy in this Step:0.00021287
Particle Name:e-
Energy in this Step:1.018e-05
Particle Name:e-
Energy in this Step:1.018e-05
Particle Name:e-
Energy in this Step:1.292e-05
Particle Name:e-
Energy in this Step:6.477e-05
Particle Name:e-
Energy in this Step:4.485e-05
Particle Name:e-
Energy in this Step:1.292e-05
Particle Name:e-
Energy in this Step:4.485e-05
Particle Name:e-
Energy in this Step:6.425e-05
Particle Name:e-
Energy in this Step:2.607e-05
Particle Name:e-
Energy in this Step:0.00084654
Particle Name:e-
Energy in this Step:0.0104825
Particle Name:e-
Energy in this Step:0.138432
Particle Name:e-
Energy in this Step:0.135889
Particle Name:e-
Energy in this Step:0.373902
Particle Name:Ba137
Energy in this Step:1.71685e-06
Particle Name:Ba137
Energy in this Step:0
Energy in this event1.68023
----------New Event Starts------------
Particle Name:Cs137
Energy in this Step:1
Particle Name:Cs137
Energy in this Step:0
Particle Name:e-
Energy in this Step:0.290562
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:Ba137[661.659]
Energy in this Step:2.58886e-06
Particle Name:Ba137[661.659]
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0.0001051
Particle Name:e-
Energy in this Step:6.258e-05
Particle Name:e-
Energy in this Step:5.984e-05
Particle Name:e-
Energy in this Step:0.00525628
Particle Name:gamma
Energy in this Step:0.00015297
Particle Name:e-
Energy in this Step:1.335e-05
Particle Name:e-
Energy in this Step:1.335e-05
Particle Name:e-
Energy in this Step:1.335e-05
Particle Name:e-
Energy in this Step:1.059e-05
Particle Name:e-
Energy in this Step:6.418e-05
Particle Name:e-
Energy in this Step:2.894e-05
Particle Name:e-
Energy in this Step:8.234e-05
Particle Name:e-
Energy in this Step:7.439e-05
Particle Name:e-
Energy in this Step:0.00066126
Particle Name:e-
Energy in this Step:0.00505058
Particle Name:e-
Energy in this Step:0.0272939
Particle Name:e-
Energy in this Step:0.0775155
Particle Name:e-
Energy in this Step:0.0539887
Particle Name:e-
Energy in this Step:0.328208
Particle Name:e-
Energy in this Step:0.163002
Particle Name:Ba137
Energy in this Step:1.71685e-06
Particle Name:Ba137
Energy in this Step:0
Energy in this event1.95222
----------New Event Starts------------
Particle Name:Cs137
Energy in this Step:1
Particle Name:Cs137
Energy in this Step:0
Particle Name:e-
Energy in this Step:0.049482
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:Ba137
Energy in this Step:5.91693e-06
Particle Name:Ba137
Energy in this Step:0
Energy in this event1.04949

I see that at the first step of each event a energy of 1 MeV is being deposited. I also changed the cuts to 0.0001 mm (very small value) but output seems to show no change.
The ogl window.

Case 2b: G4Ion (just outside voulume)

----------New Event Starts------------
Particle Name:Cs137
Energy in this Step:0.411497
Particle Name:Cs137
Energy in this Step:0.290582
Particle Name:Cs137
Energy in this Step:0.180322
Particle Name:Cs137
Energy in this Step:0.0446844
Particle Name:Cs137
Energy in this Step:0.0625936
Particle Name:Cs137
Energy in this Step:1.78546e-09
Particle Name:Cs137
Energy in this Step:9.3608e-05
Particle Name:Cs137
Energy in this Step:1.23964e-05
Particle Name:Cs137
Energy in this Step:1.90713e-22
Particle Name:Cs137
Energy in this Step:0.00050372
Particle Name:Cs137
Energy in this Step:0.00097081
Particle Name:Cs137
Energy in this Step:1.9229e-16
Particle Name:Cs137
Energy in this Step:2.47885e-17
Particle Name:Cs137
Energy in this Step:6.12106e-48
Particle Name:Cs137
Energy in this Step:8.37454e-11
Particle Name:Cs137
Energy in this Step:0.00874006
Particle Name:Cs137
Energy in this Step:0
Particle Name:e-
Energy in this Step:0.0100085
Particle Name:e-
Energy in this Step:0.0137675
Particle Name:e-
Energy in this Step:0.0031113
Particle Name:e-
Energy in this Step:0.0035661
Particle Name:e-
Energy in this Step:0
Particle Name:e-
Energy in this Step:0.00131794
Particle Name:e-
Energy in this Step:0.000661681
Particle Name:e-
Energy in this Step:0.00492473
Particle Name:e-
Energy in this Step:0.0053944
Particle Name:e-
Energy in this Step:0.00090398
Particle Name:e-
Energy in this Step:0.00453456
Particle Name:e-
Energy in this Step:0.00289644
Particle Name:e-
Energy in this Step:0.00425091
Particle Name:e-
Energy in this Step:0.00754137
Particle Name:e-
Energy in this Step:0.00131477
Particle Name:e-
Energy in this Step:0.00110202
Particle Name:e-
Energy in this Step:0.00541811
Particle Name:e-
Energy in this Step:0.00666931
Particle Name:e-
Energy in this Step:0.00140354
Particle Name:e-
Energy in this Step:0.00434556
Particle Name:e-
Energy in this Step:0.00104232
Particle Name:e-
Energy in this Step:0.00501888
Particle Name:e-
Energy in this Step:0.00733175
Particle Name:e-
Energy in this Step:0.00131169
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:Ba137[661.659]
Energy in this Step:3.30299e-07
Particle Name:Ba137[661.659]
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0
Particle Name:Ba137
Energy in this Step:1.71685e-06
Particle Name:Ba137
Energy in this Step:0
Energy in this event0
----------New Event Starts------------
Particle Name:Cs137
Energy in this Step:0.418992
Particle Name:Cs137
Energy in this Step:0.304952
Particle Name:Cs137
Energy in this Step:0.187455
Particle Name:Cs137
Energy in this Step:0.0276531
Particle Name:Cs137
Energy in this Step:0.0482199
Particle Name:Cs137
Energy in this Step:0.0127272
Particle Name:Cs137
Energy in this Step:0
Particle Name:e-
Energy in this Step:0.000235883
Particle Name:e-
Energy in this Step:0.0013906
Particle Name:e-
Energy in this Step:0.0126491
Particle Name:e-
Energy in this Step:0.00373895
Particle Name:e-
Energy in this Step:0.00360324
Particle Name:e-
Energy in this Step:0.00497669
Particle Name:e-
Energy in this Step:0.00438635
Particle Name:e-
Energy in this Step:0.00422447
Particle Name:e-
Energy in this Step:0.00582802
Particle Name:e-
Energy in this Step:0.00474384
Particle Name:e-
Energy in this Step:0.00457031
Particle Name:e-
Energy in this Step:0.00557276
Particle Name:e-
Energy in this Step:0.0137917
Particle Name:e-
Energy in this Step:0.0119379
Particle Name:e-
Energy in this Step:0.10852
Particle Name:e-
Energy in this Step:0.0578068
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:Ba137[661.659]
Energy in this Step:7.59741e-07
Particle Name:Ba137[661.659]
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0
Particle Name:Ba137
Energy in this Step:1.71685e-06
Particle Name:Ba137
Energy in this Step:0
Energy in this event0.24774
----------New Event Starts------------
Particle Name:Cs137
Energy in this Step:0.442851
Particle Name:Cs137
Energy in this Step:0.266898
Particle Name:Cs137
Energy in this Step:0.195743
Particle Name:Cs137
Energy in this Step:0.0778293
Particle Name:Cs137
Energy in this Step:0.000690244
Particle Name:Cs137
Energy in this Step:0.00682306
Particle Name:Cs137
Energy in this Step:4.48172e-06
Particle Name:Cs137
Energy in this Step:4.40245e-10
Particle Name:Cs137
Energy in this Step:4.97936e-07
Particle Name:Cs137
Energy in this Step:0.0091613
Particle Name:Cs137
Energy in this Step:0
Particle Name:e-
Energy in this Step:0.01637
Particle Name:e-
Energy in this Step:0.00703672
Particle Name:e-
Energy in this Step:0.00303091
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:Ba137
Energy in this Step:3.93046e-06
Particle Name:Ba137
Energy in this Step:0
Energy in this event0
----------New Event Starts------------
Particle Name:Cs137
Energy in this Step:0.409682
Particle Name:Cs137
Energy in this Step:0.306667
Particle Name:Cs137
Energy in this Step:0.149823
Particle Name:Cs137
Energy in this Step:0.048341
Particle Name:Cs137
Energy in this Step:0.0266287
Particle Name:Cs137
Energy in this Step:0.040458
Particle Name:Cs137
Energy in this Step:2.36192e-05
Particle Name:Cs137
Energy in this Step:0.00221477
Particle Name:Cs137
Energy in this Step:0.00951057
Particle Name:Cs137
Energy in this Step:0.00665065
Particle Name:Cs137
Energy in this Step:0
Particle Name:e-
Energy in this Step:0.00795048
Particle Name:e-
Energy in this Step:0.0246871
Particle Name:e-
Energy in this Step:0.00113936
Particle Name:e-
Energy in this Step:0.0115772
Particle Name:e-
Energy in this Step:0.0085038
Particle Name:e-
Energy in this Step:0.00285581
Particle Name:e-
Energy in this Step:0.00295425
Particle Name:e-
Energy in this Step:0.00444473
Particle Name:e-
Energy in this Step:0.00656059
Particle Name:e-
Energy in this Step:0.00133845
Particle Name:e-
Energy in this Step:0.00332507
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:Ba137[661.659]
Energy in this Step:2.49162e-06
Particle Name:Ba137[661.659]
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0.00010619
Particle Name:e-
Energy in this Step:3.009e-05
Particle Name:e-
Energy in this Step:5.583e-05
Particle Name:e-
Energy in this Step:4.438e-05
Particle Name:gamma
Energy in this Step:0.00018878
Particle Name:e-
Energy in this Step:6.291e-05
Particle Name:e-
Energy in this Step:1.292e-05
Particle Name:e-
Energy in this Step:6.465e-05
Particle Name:e-
Energy in this Step:5.984e-05
Particle Name:e-
Energy in this Step:2.841e-05
Particle Name:e-
Energy in this Step:0.00070519
Particle Name:e-
Energy in this Step:0.00035245
Particle Name:e-
Energy in this Step:0.00144406
Particle Name:e-
Energy in this Step:0.0102793
Particle Name:e-
Energy in this Step:0.353906
Particle Name:e-
Energy in this Step:0.294317
Particle Name:Ba137
Energy in this Step:1.71685e-06
Particle Name:Ba137
Energy in this Step:0
Energy in this event0.661657
----------New Event Starts------------
Particle Name:Cs137
Energy in this Step:0.475768
Particle Name:Cs137
Energy in this Step:0.259176
Particle Name:Cs137
Energy in this Step:0.200588
Particle Name:Cs137
Energy in this Step:0.0159597
Particle Name:Cs137
Energy in this Step:0.012943
Particle Name:Cs137
Energy in this Step:0.0215332
Particle Name:Cs137
Energy in this Step:1.40828e-10
Particle Name:Cs137
Energy in this Step:0.00519668
Particle Name:Cs137
Energy in this Step:9.05843e-07
Particle Name:Cs137
Energy in this Step:0.00546319
Particle Name:Cs137
Energy in this Step:0.00337117
Particle Name:Cs137
Energy in this Step:0
Particle Name:e-
Energy in this Step:0
Particle Name:e-
Energy in this Step:0.00813939
Particle Name:e-
Energy in this Step:0.00438535
Particle Name:e-
Energy in this Step:0.00754751
Particle Name:e-
Energy in this Step:0.0115339
Particle Name:e-
Energy in this Step:0.0159896
Particle Name:e-
Energy in this Step:0.0163697
Particle Name:e-
Energy in this Step:0.0220412
Particle Name:e-
Energy in this Step:0.0345581
Particle Name:e-
Energy in this Step:0.0228061
Particle Name:e-
Energy in this Step:0.0189388
Particle Name:e-
Energy in this Step:0.102448
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:anti_nu_e
Energy in this Step:0
Particle Name:Ba137[661.659]
Energy in this Step:9.66393e-07
Particle Name:Ba137[661.659]
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0
Particle Name:gamma
Energy in this Step:0
Particle Name:e-
Energy in this Step:0.0509167
Particle Name:e-
Energy in this Step:0.0124099
Particle Name:e-
Energy in this Step:0.00249485
Particle Name:Ba137
Energy in this Step:1.71685e-06
Particle Name:Ba137
Energy in this Step:0
Energy in this event0.330579
 Run terminated.
Run Summary
  Number of events processed : 5
  User=0.080000s Real=0.115709s Sys=0.030000s

If it can make things clearer, the above output is being generated as below

void B1SteppingAction::UserSteppingAction(const G4Step* step)
{
  if (!fScoringVolume) { 
    const B1DetectorConstruction* detectorConstruction
      = static_cast<const B1DetectorConstruction*>
        (G4RunManager::GetRunManager()->GetUserDetectorConstruction());
    fScoringVolume = detectorConstruction->GetScoringVolume();   
  }

  // get volume of the current step
  G4LogicalVolume* volume 
    = step->GetPreStepPoint()->GetTouchableHandle()
      ->GetVolume()->GetLogicalVolume();
      
  G4Track* track  = step->GetTrack();
    const G4DynamicParticle* theParticle = track->GetDynamicParticle();
    const G4ParticleDefinition* particleDef =
    theParticle->GetParticleDefinition();
    G4String name   = particleDef->GetParticleName();
    G4double ke = theParticle->GetTotalEnergy();
    G4cout <<"Particle Name:" << name  <<G4endl ;
    
   G4double edepStep = step->GetTotalEnergyDeposit();
     
   G4cout << "Energy in this Step:" << edepStep <<G4endl;
      
  // check if we are in scoring volume
  if (volume != fScoringVolume) return;

  // collect energy deposited in this step
  //G4double edepStep = step->GetTotalEnergyDeposit();
  //if (volume == fScoringVolume)
  
  fEventAction->AddEdep(edepStep);  
}

Please let me know for further clarifications, Thanks in advance !

What is the initial energy that you define for the Cs137 ion? I do not see a /gps/energy statement for it. Could the default be 1 MeV? In which case, the first step could be it slowing to 0 MeV via ionization.

@John_McFee ,
Hi John in case when defining the radioactive source it is not good idea to define the energy.
For excited level one can define /gps/particle ion
as /gps/ion Z A Q E where,
atomic number Z, atomic mass A, ionic charge Q, excitation energy E in keV.

@kitu.utkarsh calculations/code do have some problem. And I assume it is coming from concrete classes @kitu.utkarsh defined in event and/or in G4run.

I do not have any further suggestions to @kitu.utkarsh unless the code is share for analysis or I need to write a code for justification. The latter I will believe I am not interested at the moment.

:slight_smile:
Good weekend.
VRS

Right, the kinetic energy(\gps\energy E) was 1Mev default.
Quoting, book for app. developers,

/gps/energy: Sets the energy [default 1 MeV] for mono-energetic sources. The units can be eV, keV, MeV, GeV, TeV or PeV. (NB: it is recommended to use /gps/ene/mono instead.)

I did not set the energy as I thought it was already taken care by \gps\ion Z A Q E, here E(excitation energy) is 0 by default.

It seems to have accounted for the + 1 MeV shfit,
I tested it with the output and the original example.
The La 138 spectra for source inside the volume.

However, just one more question why does it give the “correct” spectra when the source is outside the volume, it is understandable that it will have lost some kinetic energy but still the total energy should have appear to be more ? Even for 1 mm outside the source the spectra started from 0 enrgy.

Thanks a lot @John_McFee and @drvijayraj for all the replies and help !

You not need to define this when defining the radioactive source.

Dear @drvijayraj Sir,

Can you please check the code and suggest potential issues
https://drive.google.com/drive/folders/1N2pxb_8wdJWJJrho8I2bm7wwjQDsxhxQ?usp=sharing

Some of the suggestions,

  1. Is the shape of the crystal in your studies is trapezoidal ? In our laboratory we have cylindrical.
  2. Confine gps source with the logical volume,
  3. provide the shape of the source.
  4. score in the PhysicalVolume using G4VPhysicalVolume. [feasible/ Or logical is Okay]
  5. The GetTotalEnergyDeposit will provide information on the continuous energy loss along the track.
  6. EventAction provides you DE of the particles.
  7. La138 spectra can be checked by introducing TrackingAction class.

Hope it is understandable.

VRS

1 Like

To be clear, “/gps/energy Ekin” sets the kinetic energy (I am talking in a nonrelativistic sense) of the particle to Ekin MeV (default 1 MeV), whether the particle is a fundamental particle or an ion. The E in “/gps/ion Z A Q E” is an excitation level in keV (default 0). It can be any value, regardless of the ion’s kinetic energy. Often the ion’s kinetic energy is 0, but it does not have to be.

For your application with the ion inside the scintillator, you should have:
/gps/particle ion
/gps/ion 55 137
/gps/energy/mono
/gps/ene/mono 0 MeV

The Cs ion is a heavy ion and will stop in a very short distance. Positioned inside the scintillator, all the kinetic energy of the 1MeV Cs will be deposited in the scintillator. If it is put outside and 3.5mm away from the scintillator, and the surrounding material is anything other than vacuum, it will stop in a very short distance (e.g., ~0.7mm in dry air), depositing none of its kinetic energy in the scintillator. It will still decay after stopping and the emitted gamma will strike the face of the crystal if its trajectory takes it in that direction. The beta energy is attenuated by any material in the 3.5mm gap between scintillator and source. Air will not significantly stop a 1MeV beta over 3.5mm, but even a 2mm Al cover around the scintillator will.

1 Like

Thanks a lot Sir for the explanation.

Thanks a lot Sir, I’ll try to implement the changes and share how does it go.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.