next-exp / nexus

Geant4 simulation framework of the NEXT Collaboration
5 stars 55 forks source link

Use total drift length of EL gap to generate EL photons #205

Closed paolafer closed 1 year ago

paolafer commented 1 year ago

Due to a change in Geant4-11.1, the step length returned by the ionization electron crossing the EL gap is 0 instead of the gap length. An effect of this is that the number of EL photons is 0, as well. This PR modifies the way we calculate the number of EL photons, using the actual length of the gap instead of the step length, to overcome this problem.

paolafer commented 1 year ago

Thanks, Krishan! I think you're right and the small difference of calculated step length in the old version is due to diffusion. On the other hand, I noticed that the step length of the drift part is miscalculated (1 is given, in your example), although that value is not used anywhere in the simulation, therefore we never realized or tried to fix it. All considered, I think that returning the actual value of the gap is more correct. The small differences due to diffusion should not introduce a significant error in the EL yield; however, we should compare the two distributions of the yield as it is calculated in the Electroluminescence class, using the old method and the new one, to quantify this.

kvjmistry commented 1 year ago

Just one note: I am debugging the yields and one thing that isn't quite clear in the code is the unit of the yield value that comes out from field->LightYield(). It appears to be in photons/mm rather than photons/cm. You can see this as we multiply the number by 9.8 to get the mean yield and 9.8 is units of mm. The XenonELLightYield function in XenonProperties.cc indicates in the comment that the yield is in photons/cm.

Just mentioning this as I think this should be updated. Maybe return as yield/cm and fix the units in the calculation of the mean yield? or update some of the comments?

paolafer commented 1 year ago

Just one note: I am debugging the yields and one thing that isn't quite clear in the code is the unit of the yield value that comes out from field->LightYield(). It appears to be in photons/mm rather than photons/cm. You can see this as we multiply the number by 9.8 to get the mean yield and 9.8 is units of mm. The XenonELLightYield function in XenonProperties.cc indicates in the comment that the yield is in photons/cm.

Just mentioning this as I think this should be updated. Maybe return as yield/cm and fix the units in the calculation of the mean yield? or update some of the comments?

Nexus uses the Geant4 internal units, which are mm in the case of length, so I think that we can update the comment, removing the mention to cm.

kvjmistry commented 1 year ago

Here is my comparison using the same Kr macro, 300 events:

image

I fit the distributions, both the new implementations regardless of g4 versions I deem are the same. Compared with the old method, there is a difference in the overall yield distribution due to the difference in how the gap length is calculated.

Mean OLD:  1311386
Sigma OLD:  1.1%

Mean NEW:  1297357
Sigma NEW:  0.9%

The percent difference in mean of new and old methods is 1.1%

paolafer commented 1 year ago

Here is my comparison using the same Kr macro, 300 events:

  • v11.0.2 "old" is using the old method of getting the step length step.GetStepLength();
  • v11.0.2 "new" is using the new method of the step length field->GetTotalDriftLength()
  • v11.1.0 "new" is using the new g4 version and the new method of the step length field->GetTotalDriftLength()

image

I fit the distributions, both the new implementations regardless of g4 versions I deem are the same. Compared with the old method, there is a difference in the overall yield distribution due to the difference in how the gap length is calculated.

Mean OLD:  1311386
Sigma OLD:  1.1%

Mean NEW:  1297357
Sigma NEW:  0.9%

The percent difference in mean of new and old methods is 1.1%

Thanks, Krishan! I'd say that this difference won't impact on our total energy resolution, taking into account the different contributions, as explained, for instance, here, but we should bring the issue up at the next meeting to take a decision.