# Can I use Garfield++ to simulate the signal produced in a detector by low energy photons (eg X-rays at 5.9keV)?

**URL:** <https://root-forum.cern.ch/t/can-i-use-garfield-to-simulate-the-signal-produced-in-a-detector-by-low-energy-photons-eg-x-rays-at-5-9kev/49790>\
**Category:** Garfield++\
**Created:** [April 29, 2022, 3:35am UTC](https://root-forum.cern.ch/t/can-i-use-garfield-to-simulate-the-signal-produced-in-a-detector-by-low-energy-photons-eg-x-rays-at-5-9kev/49790 "2022-04-29T03:35:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hezhoubo](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/ba8739/32.png) [@hezhoubo](https://root-forum.cern.ch/u/hezhoubo)\
**Post date:** [April 29, 2022, 3:35am UTC](https://root-forum.cern.ch/t/can-i-use-garfield-to-simulate-the-signal-produced-in-a-detector-by-low-energy-photons-eg-x-rays-at-5-9kev/49790/1 "2022-04-29T03:35:47Z")

</div>

I saw in the manual a function for photon transport：void TransportPhoton(const double x0, const double y0, const double z0,  
const double t0, const double e0,  
const double dx0, const double dy0, const double dz0,int& nel);。  
Can I use Garfield++ to simulate the signal produced in a detector by low energy photons (eg X-rays at 5.9keV)?  
Thank you for your answer.

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [April 29, 2022, 8:49am UTC](https://root-forum.cern.ch/t/can-i-use-garfield-to-simulate-the-signal-produced-in-a-detector-by-low-energy-photons-eg-x-rays-at-5-9kev/49790/2 "2022-04-29T08:49:11Z")

</div>

Hi,  
yes, you can. You can find an example in `Examples/Heed/`:

> **[Examples/Heed/fe55.C · master · garfield / garfieldpp](https://gitlab.cern.ch/garfield/garfieldpp/blob/master/Examples/Heed/fe55.C)**
>
> http://garfieldpp.web.cern.ch/garfieldpp/

---

<div class="post-metadata">

**Author:** ![hezhoubo](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/ba8739/32.png) [@hezhoubo](https://root-forum.cern.ch/u/hezhoubo)\
**Post date:** [April 30, 2022, 11:06am UTC](https://root-forum.cern.ch/t/can-i-use-garfield-to-simulate-the-signal-produced-in-a-detector-by-low-energy-photons-eg-x-rays-at-5-9kev/49790/3 "2022-04-30T11:06:10Z")

</div>

Ok，Thank you.  
How to continue to simulate the drift of photoelectrons and Auger-electrons produced in the photon conversion after using TransportPhoton?  
Is it possible to continue cycling the electrons in all the clusters?  
Use this code from the manual?  
// Loop over the clusters along the track.

double xc = 0., yc = 0., zc = 0., tc = 0., ec = 0., extra = 0.;

int nc = 0;

while (track.GetCluster(xc, yc, zc, tc, nc, ec, extra)) {

// Loop over the electrons in the cluster.

for (int k = 0; k \< nc; ++k) {

double xe = 0., ye = 0., ze = 0., te = 0., ee = 0.;

double dx = 0., dy = 0., dz = 0.;

track.GetElectron(k, xe, ye, ze, te, ee, dx, dy, dz);

drift.DriftElectron(xe, ye, ze, te);

}

}

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [May 1, 2022, 2:27pm UTC](https://root-forum.cern.ch/t/can-i-use-garfield-to-simulate-the-signal-produced-in-a-detector-by-low-energy-photons-eg-x-rays-at-5-9kev/49790/4 "2022-05-01T14:27:01Z")

</div>

You can loop over the electrons produced by the photon like this:

```auto
track.TransportPhoton(x0, y0, z0, t0, egamma, 0., 0., 1., ne);
for (int k = 0; k < ne; ++k) {
  double xe = 0., ye = 0., ze = 0., te = 0., ee = 0.;
  double dx = 0., dy = 0., dz = 0.;
  track.GetElectron(k, xe, ye, ze, te, ee, dx, dy, dz);
  // ...
}

```

---

<div class="post-metadata">

**Author:** ![hezhoubo](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/ba8739/32.png) [@hezhoubo](https://root-forum.cern.ch/u/hezhoubo)\
**Post date:** [May 2, 2022, 1:07pm UTC](https://root-forum.cern.ch/t/can-i-use-garfield-to-simulate-the-signal-produced-in-a-detector-by-low-energy-photons-eg-x-rays-at-5-9kev/49790/5 "2022-05-02T13:07:32Z")

</div>

Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [May 16, 2022, 1:07pm UTC](https://root-forum.cern.ch/t/can-i-use-garfield-to-simulate-the-signal-produced-in-a-detector-by-low-energy-photons-eg-x-rays-at-5-9kev/49790/6 "2022-05-16T13:07:38Z")

</div>

Closed on May 16, 2022, 1:07pm UTC

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