Problems with tracking scintillation photons

Hello, I am trying to simulate scintillation photons in liquid argon in my geant4 simulation, but I seem to be having some problems. I don’t seem to get the expected amount of scintillation photons based on the parameters I set.

I defined my LAr material as follows:

as I understand it, scintillation yield is defined as the expected number of scintillation photons created by a given energy deposit by an electron in a material.

In my simulation I fire a 1 MeV electron directly in the center of my LAr detector(so that it deposits all of its energy there ,I checked and it does indeed do that), and as I set the SCINTILLATIONYIELD to 51000, I expect to see 51000 scintillation photons per event (because I set RESOLUTIONSCALE = 0 and birks constant = 0).

However, I still get a varying number of scintillation photons per event, mostly less than 51000.

I am calculating the amount of scintillation photons per event in two ways, which disagree with each other. The first is using some code I saw online:

In my stepping action -

auto proc_man =
aStep->GetTrack()->GetDynamicParticle()->GetParticleDefinition()->GetProcessManager();
G4ProcessVector* proc_vec = proc_man->GetPostStepProcessVector(typeDoIt);
G4int n_proc = proc_vec->entries();

 G4int n_scint = 0;
 G4int n_cer   = 0;
for(G4int i = 0; i < n_proc; ++i)
 {
      G4String proc_name = (*proc_vec)[i]->GetProcessName();
       if(proc_name.compare("Cerenkov") == 0)
       {
           auto cer = (G4Cerenkov*) (*proc_vec)[i];
           n_cer    = cer->GetNumPhotons();
       }
       else if(proc_name.compare("Scintillation") == 0)
       {
           auto scint = (G4Scintillation*) (*proc_vec)[i];
           n_scint    = scint->GetNumPhotons();
       }
   }
   if(n_cer > 0 || n_scint > 0){
       fEventAction->nScint += n_scint;
       fEventAction->nCher += n_cer;
   }

the second method is tracking each photon individually, again in my stepping action-

static G4ParticleDefinition* opticalphoton = G4OpticalPhoton::OpticalPhotonDefinition();

const G4ParticleDefinition* particleDef =
aStep->GetTrack()->GetDynamicParticle()->GetParticleDefinition();

if(particleDef == opticalphoton){
G4Track* track = aStep->GetTrack();
if(track->GetCreatorProcess()->GetProcessName() == “Scintillation”){

          if (aStep->GetTrack()->GetCurrentStepNumber() == 1){
               fEventAction->numPhotons+=1;
               ....
          }

}

I also tried to change my material from G4_lAr to something else, but then for some reason i get 0 scintillation photons.

I would appreciate your help with these issues.
Aviv

Please, try example/extended/optical/OpNovice2 with macro electron.mac and see if you can understand the number of scintillation photons.