Hi,
I have a problem with the detector gain simulation code, I have different values for the gain values while running the code on different devices. I made sure that the simulation code, Ansys files and gas file are all the same but the results are distinctively different and there is a huge gap between them.
what could be the reason and which one should be trusted?
I see in your code that you simulate only 1 event. Avalanche simulations have large spread, so on a single event basis it is not strange to see largely different results. Can you simulate with n_events = 1000 and save your total amount of electrons for a single electron coming from the track in a histogram?
Going through your code, a few comments / remarks:
you use AvalancheMicroscopic, this class does not need a gasfile, as it reads directly the cross-sections. Contrary AvalancheMC and DriftLineRKF instead use transport coefficients that are function of the E and B-field and are read from a gasfile. So you can just define your gasmixture in this way:
the weighting field should be a different solution of the Electric field in your detector where you set the electrod you want to read out to 1V and all other electrodes to 0V. Instead the PRNSOL.lis you load in the initialize function should be the solution of the electric field of your detector with “operational” voltages on your electrodes, that are typically in the 100V - 1000V range.
I do not fully understand this lines: you seem just to sum zero to an integer
int ne = 0, ni = 0, nf = 0;
int np = aval->GetNumberOfElectronEndpoints();
np += ne;
maybe this is a remnant from some code where you asked aval.GetAvalancheSize(ne, ni);