Simulate alpha particle incidence to induce and output electrical signals, but with "No valid medium at initial position."

Hi! I am trying to simulate the current signal caused by the alpha particle incident on a gas medium sensor, and I have generated gas files for 85% Ar and 15% CO2 through the generate.c.
The TrackSrim file I imported is Alpha_in-Ar.txt, and I encountered the issue shown in the above picture.

I can think of two explanations off-hand:

  • Did you perhaps forget to associate the gas medium to the ComponentAnalyticField object?
  • Or is the starting point of your track outside the active area?

Thank you for your answer. I will check if it is caused by one of these two reasons.

Thanks for your reply! I have changed the starting point to:

The output is:

But I still cant see any current signal output. ![1713788082361|477x499](upload://g51eSkqLL4mgkHorYTcQ6pZvtqj.png) New users cant post links so I put the screenshot of my code here.

I finally change the drift part into:

But I got this error here:

GetElectron is not really meaningful for TrackTrim (all electrons in a cluster are supposed to be at the same location, xc, yc, zc).
You can change the inner for loop to

for (int k = 0; k < nc; ++k) {
  drift.DriftElectron(xc, yc, zc, tc);

By the way, the format of the GetCluster function that you are using is still supported, but I would like to phase it out. Instead of the while loop you can do:

for (const auto& cluster : track.GetClusters()) {
  for (int k = 0; k < cluster.n; ++k) {
    drift.DriftElectron(cluster.x, cluster.y, cluster.z, cluster.t);

Finally, with DriftLineRKF you will always get the same drift line for a given starting point (there are no fluctuations in the drift path).
So, an even more efficient way would be something like this:

for (const auto& cluster : track.GetClusters()) {
  drift.DriftElectron(cluster.x, cluster.y, cluster.z, cluster.t);

See also this example:

Thanks a lot.

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