# How to extract the points used by garfield at this plot?

**URL:** <https://root-forum.cern.ch/t/how-to-extract-the-points-used-by-garfield-at-this-plot/49945>\
**Category:** Garfield++\
**Tags:** root\
**Created:** [May 11, 2022, 7:00pm UTC](https://root-forum.cern.ch/t/how-to-extract-the-points-used-by-garfield-at-this-plot/49945 "2022-05-11T19:00:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucas\_Santos\_Sousa](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/lucas_santos_sousa/32/28320_2.png) [@Lucas\_Santos\_Sousa](https://root-forum.cern.ch/u/Lucas_Santos_Sousa)\
**Post date:** [May 11, 2022, 7:00pm UTC](https://root-forum.cern.ch/t/how-to-extract-the-points-used-by-garfield-at-this-plot/49945/1 "2022-05-11T19:00:49Z")

</div>

I am using the following code at Garfield++ to plot the electric field setup:

```auto
  fieldView.SetComponent(&cmp);
  fieldView.SetNumberOfSamples1d(1000);
  fieldView.SetElectricFieldRange(0,3000);
  fieldView.PlotProfile(0,0,0,raiointal,0,0,"e",false); //if you want to graph the electric field
  fieldView.GetCanvas();

```

The plot is fine, and tecnically there is no problem. I would like to know, actually, how to get the points that the program uses to plot it? That is, i would like to have a file.txt that gives me the points (x,y) that the program is using to plot it.

Is there a way to extract it?

---

<div class="post-metadata">

**Author:** ![jalopezg](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jalopezg/32/25844_2.png) [@jalopezg](https://root-forum.cern.ch/u/jalopezg)\
**Post date:** [May 11, 2022, 8:17pm UTC](https://root-forum.cern.ch/t/how-to-extract-the-points-used-by-garfield-at-this-plot/49945/2 "2022-05-11T20:17:52Z")

</div>

Hi @Lucas_Santos_Sousa,

@hschindl should be able to help you with your question.

Cheers,  
J.

---

<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 12, 2022, 3:38am UTC](https://root-forum.cern.ch/t/how-to-extract-the-points-used-by-garfield-at-this-plot/49945/3 "2022-05-12T03:38:53Z")

</div>

Hi,  
you can retrieve the electric field and potential at a point (x, y, z) like this

```auto
Medium* medium = nullptr;
double ex = 0., ey = 0., ez = 0., v = 0.;
int status = 0;
cmp.ElectricField(x, y, z, ex, ey, ez, v, medium, status);

```

---

<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 26, 2022, 3:41am UTC](https://root-forum.cern.ch/t/how-to-extract-the-points-used-by-garfield-at-this-plot/49945/4 "2022-05-26T03:41:51Z")

</div>

Closed on May 26, 2022, 3:41am UTC

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