Particle track angle for the DepositionReader module

I am curious to know if there is any way to include the track direction for the DepositionReader module where the tracks are coming from an external GEANT4 simulation. At present, I give the particle x,y,z to the DepositionReader in the global coordinates. But is there a way that I can include the particle px, py and pz (or the vertex position)? In the present setup where the track orientation is not given, does AllPix2 assume that a particle (charge deposition) passes through the detector perpendicularly?


Hi @asantra

there is no assumption taken on a particle direction whatsoever. What the DepositionReader does is to read individual energy deposits, converting them to electron-hole pairs in silicon. In addition, it keeps track of the particle IDs related to these deposits and generates a MCParticle object from them. Here, it uses the earliest appearance of a particle ID as the start point and the latest appearance as the end point. Therefore, any high-energy particle crossing your sensor at an angle should be mapped properly if it leaves energy in more than one spot.

Best regards,

Hi @simonspa,
Thank you for the answer. I have several questions/confusions.

1 . What do you mean by the earliest appearance and the last appearance of a particle ID? If I have only one layer of a detector, then there will be only one appearance of the particle ID, no? Is there any way I can feed the incoming and outgoing particle positions in the DepositionReader?

  1. Pardon my naivety, but if a particle crosses a detector layer at an angle other than 90 degrees, won’t it face more detector material and hence more energy loss (and more electron-hole pairs)? Or does AllPix2 assume that the particle losses energy only at the face of the detector layer creating electron-hole pairs (and not in the detector “meat”)?

Thank you once again,

Dear @asantra

I am not entirely sure we are on the same page, so let me try to shed some light on the details here. You are using the DepositionReader module which allows you to read in energy depositions in your sensor material, simulated already in a different software tool. This means, what has been done already is the simulation of

  • the initial primary particle creation
  • the tracking of this particle through your entire setup
  • ionization processes
  • the possible creation of secondary particles
  • multiple Coulomb scattering processes

and the output of this has been written to a file which we now process with the DepositionReader. Allpix Squared does not take any assumption an where charge carriers are created, but it simply reads in energy deposits from another simulation and transforms them to electron-hole pairs. If this is not the case for you (as you might have indicated in your previous post) then this module is not the one you should be using, but probably rather DepositionGeant4 or the like.

This module is not meant for reading the total charge of a particle passing through the detector, but the result of a more fine-grained simulation also telling us where in the detector the energy was deposited.

Since this is all happening in the upstream simulation tool, your question 2 has to be answered there. :slight_smile:

Now, what we read in with this module could look like this (CSV file version):

# pid, time(ns), Edep(keV), Px(mm), Py(mm), Pz(mm), volume, trackid, parentid
Event: 1
211, 3.528537e+01, 4.412099e+02, 1.171342e+01, 6.526809e+00, -2.497500e-01, detector2, 0, 0
211, 3.528575e+01, 5.422071e+02, 1.171451e+01, 6.527448e+00, -2.487423e-01, detector2, 0,0 

Event: 2
211, 3.234674e+01, 1.091620e-02, -2.515335e+00, 4.427924e+00, -2.497500e-01, detector1, 0, 0
11, 3.234697e+01, 1.797317e+01, -2.530000e+00, 4.453741e+00, -1.914370e-01, detector1, 1, 0
11, 3.234698e+01, 2.138917e-01, -2.530711e+00, 4.455000e+00, -1.885962e-01, detector1, 2, 0
11, 3.234747e+01, 3.317139e+01, -2.561796e+00, 4.510000e+00, -6.449268e-02, detector1, 2, 0

In both events with energy deposits, we have initial pions (PDG 211) and in Event 2, there are more energy deposits by particles with PDG 11 (electrons) which link to the primary particle.

Now what I mean with “first” and “last” appearance is that the first energy deposit entry where a new track ID appears marks the start point of the respective particle, and the last one in the event in which it appears is taken as the end point. Please mind that this doesn’t have to be entry and exit points sicne the particles might well have been generated inside the detector (as happened in the case above, sicne they all link to the primary pion with their “parent ID”.

Does this clarify things for you?