# Typo in Garfield++ ViewField.cc?

**URL:** <https://root-forum.cern.ch/t/typo-in-garfield-viewfield-cc/50264>\
**Category:** Garfield++\
**Created:** [June 4, 2022, 12:10pm UTC](https://root-forum.cern.ch/t/typo-in-garfield-viewfield-cc/50264 "2022-06-04T12:10:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [June 4, 2022, 12:10pm UTC](https://root-forum.cern.ch/t/typo-in-garfield-viewfield-cc/50264/1 "2022-06-04T12:10:18Z")

</div>

I was looking into source code of Garfield++ and found there is some comparison in the function **ViewField::PlotFieldLines()**, which is:

```auto
void ViewField::PlotFieldLines(const std::vector<double>& x0,
                               const std::vector<double>& y0,
                               const std::vector<double>& z0,
                               const bool electron, const bool axis,
                               const short col) {

  if (x0.empty() || y0.empty() || z0.empty()) return;
  const size_t nLines = x0.size();
  if (y0.size() != nLines || x0.size() != nLines) {
    std::cerr << m_className << "::PlotLines:\n"
              << " Mismatch in number of x/y/z coordinates.\n";
    return;
  }

```

in the if loop there is **“x0.size() != nLines”**, shouldn’t it be z0 instead of x0?  
Sorry if I misunderstood the algorithm…

---

<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 4, 2022, 1:18pm UTC](https://root-forum.cern.ch/t/typo-in-garfield-viewfield-cc/50264/2 "2022-06-04T13:18:21Z")

</div>

Yes, it’s definitely a bug! Thanks a lot for spotting it! I’ll fix it asap…

---

<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 18, 2022, 1:19pm UTC](https://root-forum.cern.ch/t/typo-in-garfield-viewfield-cc/50264/3 "2022-06-18T13:19:20Z")

</div>

Closed on June 18, 2022, 1:19pm UTC

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