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

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:

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.

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.

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.

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:

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

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?

I think you can do

git pull
git fetch origin wfields
git checkout wfields

and then re-run CMake and make.


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?

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

and then import this field map in your program.


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.

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

To import the map, you can do something like this

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

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


1 Like


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?

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.

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?

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 (1009.1 KB)

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

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);

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

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