Electron Track not terminating

I’m trying to record the coordinates of all the secondary electrons produced due to a primary electron (E_kin=25keV) for 1000 different tracks in a gas mixture using TrackHeed in Garfield++. My source code is as follows:

#include <iostream>

#include <TCanvas.h>
#include <TROOT.h>
#include <TApplication.h>
#include <TH1F.h>

#include "Garfield/MediumMagboltz.hh"
#include "Garfield/ComponentConstant.hh"
#include "Garfield/Sensor.hh"
#include "Garfield/TrackHeed.hh"
#include "Garfield/Plotting.hh"
#include "Garfield/Random.hh"
#include "Garfield/SolidBox.hh"
#include "Garfield/GeometrySimple.hh"

using namespace Garfield;
using namespace std;

int main(int argc, char *argv[])
  MediumMagboltz gas("Ar", 60., "DMe", 40.);
  gas.EnablePenningTransfer(0.5, 0.);

  SolidBox box(0, 0, 0, 5, 2., 2.);
  GeometrySimple geo;
  geo.AddSolid(&box, &gas);

  ComponentConstant cmp;
  cmp.SetElectricField(0, 0., 0.);

  Sensor sensor;

  TrackHeed heed;

  // heed.DisableDeltaElectronTransport();


  int track_no = 0;
  while (track_no < 1000)

    double x0 = 0., y0 = 0., z0 = 0., t0 = 0.;
    double dx0 = 1., dy0 = 0., dz0 = 0.;
    double xc = 0., yc = 0., zc = 0., tc = 0.;
    int nc = 0;
    double ec = 0.;
    double extra = 0.;
    double esum = 0.;
    int nsum = 0;
    heed.NewTrack(x0, y0, z0, t0, dx0, dy0, dz0);
    while (heed.GetCluster(xc, yc, zc, tc, nc, ec, extra))
      for (int i = 0; i < nc; ++i)
        double xe, ye, ze, te;
        double ee, dxe, dye, dze;
        heed.GetElectron(i, xe, ye, ze, te, ee, dxe, dye, dze);
        ofstream f1("data.txt", std::ios::app);
        f1 << track_no+1 << "\t" << i << "\t" << xe << "\t" << ye << "\t" << ze<< "\t" << ee<< "\n";
      esum += ec;
      nsum += nc;
    cout << "track_no= " << track_no+1 << " nsum= " << nsum << " esum= " << esum << endl;
    track_no += 1;

I’m writing out the coordinates of the secondary electrons in a text file. On analysis of the data, it would appear that the electron track doesn’t terminate even after the first few centimeters. In fact, it doesn’t matter what value of x half-length I give for the SolidBox, the track shows clusters throughout the length.

I expect that the track will terminate after a small distance and there will be more density of electrons at the end of the track following a Bragg curve. But I don’t see this behavior.

I expect that the sum of the energy of the clusters should be lesser than or equal to the primary electron’s kinetic energy and that the ratio of this kinetic energy to the total number of secondary electrons produced to be equal to the W value for the gas mixture. But I see that both these numbers derived from esum and nsum variables are not what is expected. For example, this is an output I see for track:

track_no= 1000 nsum= 5525 esum= 141481

I also end up with an error when I set the Kinetic energy of the primary electrons as 1 keV (or lower energies in general).

    1020 negative values in the differential cross-section table.
    The particle speed might be too low.
    Problems occured when calculating the differential cross-section table.
    Results will be inaccurate.
    Cluster density:             8605.37 cm-1
    Stopping power (restricted): 349.688 keV/cm
    Stopping power (incl. tail): 349.688 keV/cm
    W value:                     26.92 eV
    Fano factor:                 0.216
    Min. ionization potential:   10 eV
    Track starts at (0, 0, 0) at time 0
    Direction: (1, 0, 0)
void theta_two_part(...): ERROR:

d1<= 0
FunNameStack: s_init=1 qname=3
  0  virtual void gparticle::fly() 
  1  void HeedParticle::physics() 
  2  void theta_two_part(...) 
File is /home/kiranmj/garfieldpp/Heed/wcpplib/math/kinem.cpp , line number is 36
spexit_action: the streams will be now flushed
spexit_action: the abort function is called
Aborted (core dumped)

I’m new to Garfield++ and I need some help. Am I doing something wrong in the source code? Is my interpretation of the output, wrong? Why can I not set the electron energy to be less? Why doesn’t the electron track terminate?

It’s also appreciated if you can suggest what the code should look like in order to generate the results I want.

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

Welcome to the ROOT forum

I guess @hschindl can help.