# How to stack multiple ComponentAnalyticField?

**URL:** <https://root-forum.cern.ch/t/how-to-stack-multiple-componentanalyticfield/55280>\
**Category:** Garfield++\
**Created:** [June 13, 2023, 1:59pm UTC](https://root-forum.cern.ch/t/how-to-stack-multiple-componentanalyticfield/55280 "2023-06-13T13:59:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastian\_Regener](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/sebastian_regener/32/33427_2.png) [@Sebastian\_Regener](https://root-forum.cern.ch/u/Sebastian_Regener)\
**Post date:** [June 13, 2023, 1:59pm UTC](https://root-forum.cern.ch/t/how-to-stack-multiple-componentanalyticfield/55280/1 "2023-06-13T13:59:10Z")

</div>

Hi all,

I am working on creating multiple planes each a different potential on them and plotting the weighted field. I am currently planning on doing this by stacking multiple ComponentAnalyticFields that I created.  
I am unsure on to do the stacking, if someone could help me out it would much appreciated.

I have some code below of what I am doing for the weighted field. I have two ComponentAnalyticFields created that I would like to stack(wField1 & wField2).

```auto
  // Plot the weighting potential if requested.
  constexpr bool plotWeightingField = true;
  if (plotWeightingField) {
    ViewField* wfieldView = new ViewField(); 
    //wfieldView->SetComponent(&wField1); 
    wfieldView->SetComponent(&wField2); 
    wfieldView->SetArea(-0.005, 0, 0.005, 0.01);
    wfieldView->PlotContourWeightingField("strip", "v");
  }

```

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [June 14, 2023, 7:18am UTC](https://root-forum.cern.ch/t/how-to-stack-multiple-componentanalyticfield/55280/2 "2023-06-14T07:18:03Z")

</div>

I think @hschindl can help

---

<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:** [June 16, 2023, 5:19am UTC](https://root-forum.cern.ch/t/how-to-stack-multiple-componentanalyticfield/55280/3 "2023-06-16T05:19:48Z")

</div>

Apologies for the delay. Maybe you could use this example as a starting point:

> **[Examples/Asacusa/example.cpp · master · garfield / garfieldpp · GitLab](https://gitlab.cern.ch/garfield/garfieldpp/-/blob/master/Examples/Asacusa/example.cpp)**
>
> http://garfieldpp.web.cern.ch/garfieldpp/

---

<div class="post-metadata">

**Author:** ![Sebastian\_Regener](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/sebastian_regener/32/33427_2.png) [@Sebastian\_Regener](https://root-forum.cern.ch/u/Sebastian_Regener)\
**Post date:** [June 16, 2023, 12:59pm UTC](https://root-forum.cern.ch/t/how-to-stack-multiple-componentanalyticfield/55280/4 "2023-06-16T12:59:30Z")

</div>

Thanks for the help.

My understanding from this example is that were just stacking strips on already existing planes. Are we able to define the potential for each of these strips as well as set the distance apart from each strip?

Best,  
Sebastian Regener

---

<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:** [June 16, 2023, 1:12pm UTC](https://root-forum.cern.ch/t/how-to-stack-multiple-componentanalyticfield/55280/5 "2023-06-16T13:12:06Z")

</div>

Hi,  
the strips are used only for computing the weighting field, they have no impact on the “real” electric field in the chamber. In other words, the strips are at the same potential as the corresponding plane.

---

<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:** [June 30, 2023, 1:12pm UTC](https://root-forum.cern.ch/t/how-to-stack-multiple-componentanalyticfield/55280/6 "2023-06-30T13:12:51Z")

</div>

Closed on June 30, 2023, 1:12pm UTC

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