# Is it possible to add two lines of strips on the same plane?

**URL:** <https://root-forum.cern.ch/t/is-it-possible-to-add-two-lines-of-strips-on-the-same-plane/41016>\
**Category:** Garfield++\
**Created:** [August 17, 2020, 10:01am UTC](https://root-forum.cern.ch/t/is-it-possible-to-add-two-lines-of-strips-on-the-same-plane/41016 "2020-08-17T10:01:36Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Khang\_Pham](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/khang_pham/32/19369_2.png) [@Khang\_Pham](https://root-forum.cern.ch/u/Khang_Pham)\
**Post date:** [August 17, 2020, 10:01am UTC](https://root-forum.cern.ch/t/is-it-possible-to-add-two-lines-of-strips-on-the-same-plane/41016/1 "2020-08-17T10:01:36Z")

</div>

I need some help with adding some strips onto a cathode plane. At the moment, I have a plane at y=0, simulated by AddPlaneY(0.,v,“cathode\_plane”). Next, I want to add in two lines of strips onto two different locations of the plane at ~45 degrees, like below:

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/d/5/d59d63ee07b2cba5b377dcf45202d802665eb044.png)

Can this specific case be done with either AddStripOnPlaneY or AddPixelOnPlaneY?

With AddStripOnPlaneY, it seems like the function will add strips that will have the same length as the plane itself since you can only control the width of the strip. If this is the case, can I somehow adjust the length of the AddPlaneY function?

With AddPixelOnPlaneY, I seem to have control over both the x and z direction, so I think this option is a little better suited for my example. However, do the strip create by this function only stays parallel to the y-direction? Or is there a way for me to adjust the angle as well?

Thank you.

---

<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:** [August 17, 2020, 12:41pm UTC](https://root-forum.cern.ch/t/is-it-possible-to-add-two-lines-of-strips-on-the-same-plane/41016/2 "2020-08-17T12:41:39Z")

</div>

You are right, using `AddStripOnPlaneY` you can add infinitely long strips on the plane, either along `x` or along `z`, while `AddPixelOnPlaneY` allows you to add a “pad” with finite dimensions in both `x` and `z`.  
At the moment, you cannot change the angle, but that shouldn’t be too complicated to implement. I’ll put it on my to do list…

Note that both strips and pixels are only used for calculating weighting potentials and fields, but have no influence on the “drift” electric field in the chamber.

---

<div class="post-metadata">

**Author:** ![Khang\_Pham](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/khang_pham/32/19369_2.png) [@Khang\_Pham](https://root-forum.cern.ch/u/Khang_Pham)\
**Post date:** [August 17, 2020, 9:51pm UTC](https://root-forum.cern.ch/t/is-it-possible-to-add-two-lines-of-strips-on-the-same-plane/41016/3 "2020-08-17T21:51:00Z")

</div>

Thank you for your reply. I’m trying to calculate signals induced on these pads, so it’s perfect that the pads have no influence on the electric field.

---

<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:** [August 24, 2020, 7:14am UTC](https://root-forum.cern.ch/t/is-it-possible-to-add-two-lines-of-strips-on-the-same-plane/41016/4 "2020-08-24T07:14:57Z")

</div>

Hi,  
I made a little change to `ComponentAnalyticField` such that you can specify the in-plane rotation angle of a pixel. You can find the modified version of the code in the branch `wfields`:

> **[Commits · wfields · garfield / garfieldpp](https://gitlab.cern.ch/garfield/garfieldpp/-/commits/wfields)**
>
> http://garfieldpp.web.cern.ch/garfieldpp/

  
I’ve not yet really tested it though. Could you give it a try?

---

<div class="post-metadata">

**Author:** ![Khang\_Pham](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/khang_pham/32/19369_2.png) [@Khang\_Pham](https://root-forum.cern.ch/u/Khang_Pham)\
**Post date:** [August 24, 2020, 7:39am UTC](https://root-forum.cern.ch/t/is-it-possible-to-add-two-lines-of-strips-on-the-same-plane/41016/5 "2020-08-24T07:39:37Z")

</div>

I will definitely try it. How do I download this change in ComponentAnalyticField? Do I need to re-install garfield? or is there a more efficient way?

---

<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:** [August 24, 2020, 8:25am UTC](https://root-forum.cern.ch/t/is-it-possible-to-add-two-lines-of-strips-on-the-same-plane/41016/6 "2020-08-24T08:25:11Z")

</div>

I think you can do

```auto
git pull
git fetch origin wfields
git checkout wfields

```

and then re-run CMake and make.

---

<div class="post-metadata">

**Author:** ![Khang\_Pham](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/khang_pham/32/19369_2.png) [@Khang\_Pham](https://root-forum.cern.ch/u/Khang_Pham)\
**Post date:** [August 26, 2020, 7:14am UTC](https://root-forum.cern.ch/t/is-it-possible-to-add-two-lines-of-strips-on-the-same-plane/41016/7 "2020-08-26T07:14:11Z")

</div>

Hi,

I have another question regarding the adding pixel function. Whenever I call AddPixelOnPlaneY, how many pads are added onto the given plane? Like does the function only define 1 pad with width x and length z?

If you look at the picture that I attached in the original question, I want to have as many pads as it takes to cover the width of the plane, so how should I do that? Do I have to call the AddPixelOnPlaneY many times until the whole width is covered?

---

<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:** [August 26, 2020, 12:43pm UTC](https://root-forum.cern.ch/t/is-it-possible-to-add-two-lines-of-strips-on-the-same-plane/41016/8 "2020-08-26T12:43:34Z")

</div>

Hi,  
calling AddPixelOnPlaneY adds one pad at the position you specify, so to add an array of pixels/pads you would indeed need to call the function multiple times.

I’m wondering though if you really need to cover the entire width of the plane.  
How many pads/pixels are typically hit (i. e. see a signal) simultaneously when a particle crosses the detector?

Another thing I should have mentioned is that the evaluation of the pixel weighting field and weighting potential is rather slow. In some cases it’s therefore more efficient to export a map of the weighting field/potential as, for instance, in this example

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

  
and then import this field map in your program.

---

<div class="post-metadata">

**Author:** ![Khang\_Pham](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/khang_pham/32/19369_2.png) [@Khang\_Pham](https://root-forum.cern.ch/u/Khang_Pham)\
**Post date:** [August 28, 2020, 8:19am UTC](https://root-forum.cern.ch/t/is-it-possible-to-add-two-lines-of-strips-on-the-same-plane/41016/9 "2020-08-28T08:19:05Z")

</div>

Hi,

After posting my question, I realized that I probably do not need to cover the entire width as about only 3-5 pads see the signal. Also, I am interested in learning how to export a map of the weighting field/potential. Is this something that is written in the user guide? I am not sure how to do it and what to do after the field map is exported.

---

<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:** [August 28, 2020, 9:43am UTC](https://root-forum.cern.ch/t/is-it-possible-to-add-two-lines-of-strips-on-the-same-plane/41016/10 "2020-08-28T09:43:07Z")

</div>

Hi,  
for exporting the weighting field, have a look at this example:

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

To import the map, you can do something like this

```auto
ComponentGrid wfield;
wfield.LoadWeightingField("wfield.txt", "XY", true);

Sensor sensor;
const std::string label = "pixel";
sensor.AddElectrode(&wfield, label);

```

Cheers,  
H.

---

<div class="post-metadata">

**Author:** ![Khang\_Pham](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/khang_pham/32/19369_2.png) [@Khang\_Pham](https://root-forum.cern.ch/u/Khang_Pham)\
**Post date:** [September 2, 2020, 8:05am UTC](https://root-forum.cern.ch/t/is-it-possible-to-add-two-lines-of-strips-on-the-same-plane/41016/11 "2020-09-02T08:05:42Z")

</div>

Hi,

Sorry to bother you with this again. I recently needed to reinstall Garfield++ on my machine, and afterward, I tried to use the rotation of angle of a pixel again by first doing:

git pull  
git fetch origin wfields  
git checkout wfields

but I keep getting a fatal error saying: “fatal: couldn’t find remote ref wfields” when I type in the git fetch origin wfields.

Can you let me know if there’s a different way to download this commit?

---

<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:** [September 2, 2020, 8:33am UTC](https://root-forum.cern.ch/t/is-it-possible-to-add-two-lines-of-strips-on-the-same-plane/41016/12 "2020-09-02T08:33:26Z")

</div>

Oh, sorry for that! The `wfields` branch was deleted when I merged it into the master branch. You can just use the default/master branch.

---

<div class="post-metadata">

**Author:** ![Khang\_Pham](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/khang_pham/32/19369_2.png) [@Khang\_Pham](https://root-forum.cern.ch/u/Khang_Pham)\
**Post date:** [September 2, 2020, 10:14am UTC](https://root-forum.cern.ch/t/is-it-possible-to-add-two-lines-of-strips-on-the-same-plane/41016/13 "2020-09-02T10:14:32Z")

</div>

Hi @hschindl,

Thank you. I got it to work again. So far, I have just been able to test this for the case where rot = 0. This produces the same result as previous version. However, I am having difficult using it with nonzero angles.

First, if I was to call AddPixelOnPlaneY(…,rot=45\*pi/180), then with respect to which (positive or negative) axis am I rotating 45 degrees to?

---

<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:** [September 3, 2020, 8:40pm UTC](https://root-forum.cern.ch/t/is-it-possible-to-add-two-lines-of-strips-on-the-same-plane/41016/14 "2020-09-03T20:40:59Z")

</div>

Hi,  
good question… It depends on the plane. I’ve attached a set of plots showing the weighting potential contours of a pixel rotated by +45 degrees, for each of the four planes that you can have in a cell.  
[PixelWeightingField.pdf](https://root-forum.cern.ch/uploads/short-url/vSFGNMK9HISY439OHJfMSunzrYH.pdf) (1009.1 KB)

To reproduce the plots, you can do something like this:

```auto
constexpr double gap = 0.5;
constexpr double pitch = 0.5;
ComponentAnalyticField wField;
wField.AddPlaneX(0., -1., "back");
wField.AddPlaneX(gap, 0., "front");
const double rot = 0.25 * Pi;
wField.AddPixelOnPlaneX(gap, -0.5 * pitch, +0.5 * pitch,
                             -1.0 * pitch, +1.0 * pitch, "pixel", -1., rot);
wField.AddReadout("pixel");

ViewField fieldView;
fieldView.SetComponent(&wField);
fieldView.SetPlane(-1, 0, 0, 0.5 * gap, 0, 0);
fieldView.PlotContourWeightingField("pixel", "v");

```

---

<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:** [September 17, 2020, 8:45pm UTC](https://root-forum.cern.ch/t/is-it-possible-to-add-two-lines-of-strips-on-the-same-plane/41016/15 "2020-09-17T20:45:07Z")

</div>

Closed on September 17, 2020, 8:45pm UTC

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