# How to understand the Garfield++ code

**URL:** <https://root-forum.cern.ch/t/how-to-understand-the-garfield-code/48103>\
**Category:** Garfield++\
**Created:** [December 18, 2021, 9:40am UTC](https://root-forum.cern.ch/t/how-to-understand-the-garfield-code/48103 "2021-12-18T09:40:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [December 18, 2021, 9:40am UTC](https://root-forum.cern.ch/t/how-to-understand-the-garfield-code/48103/1 "2021-12-18T09:40:13Z")

</div>

How to understand the three codes in the below

```auto
cout<<"electron position:"<< xe <<"\t"<< ye <<"\t"<< ze <<endl;
cout<<"clusters number: "<<counts<<endl;
std::vector<double> xf;

```

---

<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:** [December 18, 2021, 11:51am UTC](https://root-forum.cern.ch/t/how-to-understand-the-garfield-code/48103/2 "2021-12-18T11:51:48Z")

</div>

The first line prints out three variables `xe`, `ye`, `ze`, the second line prints out a variable `counts`, the third line creates an `std::vector`.

Note that these lines are just plain C++ and not specific to Garfield++.  
If you struggle with understanding what these lines do, I recommend starting with a tutorial to familiarise yourself with the basics of C++.

---

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [December 18, 2021, 12:05pm UTC](https://root-forum.cern.ch/t/how-to-understand-the-garfield-code/48103/3 "2021-12-18T12:05:25Z")

</div>

Hi,  
Thanks a lot for your reply.  
I have seen a example about the proton track using Garfield++, there are these codes in the example, so I just want to confirm what it means to get a better understanding.  
Thanks again for your help

---

<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:** [January 1, 2022, 12:05pm UTC](https://root-forum.cern.ch/t/how-to-understand-the-garfield-code/48103/4 "2022-01-01T12:05:56Z")

</div>

Closed on January 1, 2022, 12:05pm UTC

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