Hello–
First of all, thanks for developing Garfield++, it’s really well designed and actually fun to use! On to my question.
I’m simulating a Xenon gas chamber that has multiple cells. The cells are separated by cathode wires and have a central anode wire.
At the moment I’m mostly interested in electrons deposited near the boundaries between cells, and which anode the track eventually ends up in. I don’t need to simulate the full avalanche, but I do want to simulate the microscopic physics that may cause an electron to diffuse from one geometric cell to another before drifting to the anode wire. The effective cell boundaries are a bit fuzzy because of this.
As such, I just want to push a bunch of electrons through their initial drift until they definitively reach one cell or another. I don’t need to waste compute cycles on the subsequent drift or avalanche. How can I stop/kill the track when it reaches a certain user-defined volume?
Things I tried:
- Set a time window using SetTimeWindow(). This mostly works, but some tracks spend a fair amount of time diffusing near the boundary and I would need to set an impractically large time window for all tracks. This ends up not being much of a compute time savings.
- Add a second ComponentConstant with SolidTube volume of my chosing, superposed on the existing Component. I set gas.EnableDrift(false) hoping that the electron would enter a non-driftable region and terminate. However, the electron kept happily drifting without stopping.
- I hoped SetUserHandleStep() would let my user function return a not-OK status when the track enters my specified volume, but it does not.
So I think my best hope is to modify the SetUserHandleStep() code to return a status code. But I wanted to make sure I wasn’t missing something.
Thanks,
Craig M
Basic code outline below
// Gas mixture.
MediumMagboltz gas("xe", 90.0, "ch4", 10.0);
gas.SetPressure(cellpr);
gas.SetTemperature(celltemp);
gas.LoadGasFile("xech4.gas");
gas.PrintGas();
// ------------------------------- Set up geometry
// Define the cell layout.
ComponentAnalyticField cmp;
cmp.SetMedium(&gas); // Gas in cell
cmp.SetPeriodicityX(cellx); // Periodicity in X
// ... add all wires and planes here ...
Sensor sensor;
sensor.AddComponent(&cmp);
sensor.SetArea(-1.5*cellx, 0.0, -50.0,
+1.5*cellx, lxy, +50.0);
// Create an avalanche object
AvalancheMicroscopic aval;
aval.SetSensor(&sensor);
aval.SetCollisionSteps(200); // for plotting, every N steps
aval.SetTimeWindow(0,100.0);
// Perform microscopic avalanche drift
avstatus = aval.DriftElectron(x0, y0, z0, t0, ee0, vx0, vy0, vz0);