# Gem example does not open vis interface

**URL:** <https://root-forum.cern.ch/t/gem-example-does-not-open-vis-interface/62148>\
**Category:** Garfield++\
**Created:** [November 5, 2024, 6:58pm UTC](https://root-forum.cern.ch/t/gem-example-does-not-open-vis-interface/62148 "2024-11-05T18:58:12Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mattia\_Martelli](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mattia_martelli/32/24509_2.png) [@Mattia\_Martelli](https://root-forum.cern.ch/u/Mattia_Martelli)\
**Post date:** [November 5, 2024, 6:58pm UTC](https://root-forum.cern.ch/t/gem-example-does-not-open-vis-interface/62148/1 "2024-11-05T18:58:12Z")

</div>

Hi everyone!  
This is my first post in the ROOT community and I want to thank you all for the help I get by reading the forum for years.  
Now I success installing Garfieldpp on Archlinux from source, then when I run the example gem.c the simulation starts, it opens the ROOT visual interface too, but just after some seconds I got this strange C++ error:

```auto
/usr/include/c++/14.2.1/bits/stl_vector.h:1130: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = double; _Alloc = std::allocator<double>; reference = double&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
[1] 335004 IOT instruction (core dumped) ./gem

```

The previous lines contains - I think - the correct output of gem.c.  
I tried searching online but I didn’t find anything helpful.  
Do you know how I can solve this? Thank you!

---

<div class="post-metadata">

**Author:** ![silverweed](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/silverweed/32/36670_2.png) [@silverweed](https://root-forum.cern.ch/u/silverweed)\
**Post date:** [November 6, 2024, 8:25am UTC](https://root-forum.cern.ch/t/gem-example-does-not-open-vis-interface/62148/2 "2024-11-06T08:25:43Z")

</div>

Hello Mattia, probably @hschindl can help you with this.

Meanwhile, if you can provide a full stack trace that may help with debugging the issue.

---

<div class="post-metadata">

**Author:** ![Mattia\_Martelli](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mattia_martelli/32/24509_2.png) [@Mattia\_Martelli](https://root-forum.cern.ch/u/Mattia_Martelli)\
**Post date:** [November 6, 2024, 8:52am UTC](https://root-forum.cern.ch/t/gem-example-does-not-open-vis-interface/62148/3 "2024-11-06T08:52:09Z")

</div>

Thank you @silverweed! The following are the output line of gem.c:

```auto
~/Documents/MC/Garfield Examples/Gem/build]$ ./gem                                                                                                                        
MediumMagboltz::SetComposition: Ar/CO2 (80/20)
MediumMagboltz::Mixer:
    4000 linear energy steps between 0 and 40 eV.
    ARGON ANISOTROPIC 2014
      mass: 39.948 amu
      ionisation threshold: 15.7596 eV
      44 inelastic terms (44 excitations, 0 superelastic, 0 other)
    CO2 2018 ANISOTROPIC    
      mass: 44.0095 amu
      ionisation threshold: 13.776 eV
      144 inelastic terms (0 excitations, 35 superelastic, 109 other)
MediumMagboltz::Mixer:
    Lowest ionisation threshold in the mixture: 13.776 eV (CO2)
MediumMagboltz::Mixer:
    Energy [eV] Collision Rate [ns-1]
          2.50 1068.85
          7.50 2892.41
         12.50 5363.62
         17.50 8777.02
         22.50 11300.56
         27.50 12660.82
         32.50 12521.53
         37.50 12101.91
MediumMagboltz::ComputePhotonCollisionTable:
    Energy [eV] Mean free path [um]
          1.00 ------------
          3.00 ------------
          5.00 ------------
          7.00 288302.9619
          9.00 3279.0615
         11.00 23.1076
         13.00 31.4118
         15.00 145.1898
         17.00 13.2429
         19.00 11.1775
MediumMagboltz::EnablePenningTransfer:
    Warning: present gas table has no ionisation rates.
    Ignore this message if you are using microscopic tracking only.
MediumMagboltz::EnablePenningTransfer:
    Penning transfer probability for 44 Ar excitation levels set to r = 0.51
MediumMagboltz::LoadMobility:
    Read 36 values from file /home/okabe/garfield/install/share/Garfield/Data/IonMobility_Ar+_Ar.txt
ComponentAnsys123::Initialise:
    Read properties of 3 materials from file MPLIST.lis.
    Read 8758 elements from file ELIST.lis.
    Highest node number: 14066
    Background elements skipped: 0
    Read 14066 nodes from file NLIST.lis.
    Read 14066 potentials from file PRNSOL.lis.
ComponentAnsys123::Prepare:
    Caching the bounding boxes of all elements... done.
    Initialized tetrahedral tree.
ComponentAnsys123::PrintRange:
        Dimensions of the elementary block
                          0 < x < 0.007 cm,
                          0 < y < 0.0121244 cm,
                       -0.1 < z < 0.1 cm,
                       -200 < V < 350 V.
        Periodicities
            x: mirror with length 0.007 cm
            y: mirror with length 0.0121244 cm
            z: none
ComponentAnsys123::SetGas: Associating material 1 with Ar/CO2.
ComponentAnsys123::PrintMaterials:
    Currently 3 materials are defined.
      Index Permittivity Resistivity Notes
          0 1e+10 0
          1 1 -1 Ar/CO2, drift medium, ionisable (drift medium)
          2 4 -1
/usr/include/c++/14.2.1/bits/stl_vector.h:1130: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = double; _Alloc = std::allocator<double>; reference = double&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
[1] 468606 IOT instruction (core dumped) ./gem

```

I am using ArchLinux with KDE Plasma (Wayland, not X11 if ti has something to do with it) on a Dell laptop.  
CPU: 11th Gen Intel(R) Core™ i7-11800H  
GPU: NVIDIA RTX 3050Ti Laptop

I’ve used ROOT and Geant4 for months without any problem. Geant4 and Garifled are source installed, while ROOT by the AUR package (maybe I will change it to a source installation too).  
The only one problem I have with ROOT is with the X11 (–web=off option) visualization that does not let me change the font format, so that I read nothing of the menu…  
For Garfield I’ve just specified the installation folder to be:

```auto
-DCMAKE_INSTALL_PREFIX=$GARFIELD_HOME/install

```

I sourced the .sh file too.

Thank you for the help again!

EDIT: I forgot to say that I found the same C++ library problem on another software’s forum, I understand that - perhaps - there is a default CXXFLAGS option in conflict with Garfield.

---

<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:** [November 6, 2024, 3:11pm UTC](https://root-forum.cern.ch/t/gem-example-does-not-open-vis-interface/62148/4 "2024-11-06T15:11:29Z")

</div>

Hi,  
thanks for reporting this! The message seems to suggest that there is a bug somewhere in the code (trying to access an element greater than the size of the vector). Could you try to run gdb to see where this happens?

---

<div class="post-metadata">

**Author:** ![Mattia\_Martelli](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mattia_martelli/32/24509_2.png) [@Mattia\_Martelli](https://root-forum.cern.ch/u/Mattia_Martelli)\
**Post date:** [November 6, 2024, 5:48pm UTC](https://root-forum.cern.ch/t/gem-example-does-not-open-vis-interface/62148/5 "2024-11-06T17:48:00Z")

</div>

Hi,  
if I did it correctly this is the only error:

```auto
/usr/include/c++/14.2.1/bits/stl_vector.h:1130: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = double; _Alloc = std::allocator<double>; reference = double&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.

Program received signal SIGABRT, Aborted.
Downloading 4.06 K source file /usr/src/debug/glibc/glibc/nptl/pthread_kill.c
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6,               
    no_tid=no_tid@entry=0) at pthread_kill.c:44
44 return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;

```

---

<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:** [November 10, 2024, 9:44pm UTC](https://root-forum.cern.ch/t/gem-example-does-not-open-vis-interface/62148/6 "2024-11-10T21:44:31Z")

</div>

Hi,  
thanks a lot and sorry for my late reply! Could you rebuild the project in DEBUG mode and try again?

---

<div class="post-metadata">

**Author:** ![Mattia\_Martelli](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mattia_martelli/32/24509_2.png) [@Mattia\_Martelli](https://root-forum.cern.ch/u/Mattia_Martelli)\
**Post date:** [November 11, 2024, 9:23am UTC](https://root-forum.cern.ch/t/gem-example-does-not-open-vis-interface/62148/7 "2024-11-11T09:23:35Z")

</div>

Hi,  
I really appreciate your help. I’m quite a newbie about debugging. Do you mean running cmake in debug mode? How can I do it?

---

<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:** [November 11, 2024, 9:40am UTC](https://root-forum.cern.ch/t/gem-example-does-not-open-vis-interface/62148/8 "2024-11-11T09:40:11Z")

</div>

Hi,  
yes, exactly; I meant add `-DCMAKE_BUILD_TYPE=Debug` or `-DCMAKE_BUILD_TYPE= RelWithDebInfo` when you run `cmake` to build Garfield++.

---

<div class="post-metadata">

**Author:** ![Mattia\_Martelli](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mattia_martelli/32/24509_2.png) [@Mattia\_Martelli](https://root-forum.cern.ch/u/Mattia_Martelli)\
**Post date:** [November 11, 2024, 10:48am UTC](https://root-forum.cern.ch/t/gem-example-does-not-open-vis-interface/62148/9 "2024-11-11T10:48:18Z")

</div>

okay then I ran `cmake -DCMAKE_BUILD_TYPE=Debug ..`, ran `make` and when I execute with gdb I get the exact same message I sent before:

```auto
/usr/include/c++/14.2.1/bits/stl_vector.h:1130: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = double; _Alloc = std::allocator<double>; reference = double&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.

Program received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
44 return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;

```

However, I noticed that if I set to false this boolean (that originally is true) around line 70 of the gem example:

```auto
meshView.SetFillMesh(false);

```

it works fine. The only difference is on the electric potential plot, since the gray trapezoids are not filled while they should be:

 ![cf](https://root-forum.cern.ch/uploads/default/original/3X/1/f/1f1ba48bab599766160c562734c981f829c646db.png)

---

<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:** [November 11, 2024, 12:59pm UTC](https://root-forum.cern.ch/t/gem-example-does-not-open-vis-interface/62148/10 "2024-11-11T12:59:28Z")

</div>

Thanks a lot! That’s already very helpful; I will take a look if I see something suspicious in this class…

---

<div class="post-metadata">

**Author:** ![Mattia\_Martelli](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mattia_martelli/32/24509_2.png) [@Mattia\_Martelli](https://root-forum.cern.ch/u/Mattia_Martelli)\
**Post date:** [November 12, 2024, 9:20am UTC](https://root-forum.cern.ch/t/gem-example-does-not-open-vis-interface/62148/11 "2024-11-12T09:20:02Z")

</div>

Oh furthermore, my colleague has a Rocky Linux virtual machine with C++ version 11 (mine is 14.2.1), I help him installing garfield and it works perfectly fine! 🥲  
It could be a specific problem of my gcc version… I’ll try to install the v11 too to test this theory.

---

<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:** [November 26, 2024, 9:20am UTC](https://root-forum.cern.ch/t/gem-example-does-not-open-vis-interface/62148/12 "2024-11-26T09:20:27Z")

</div>

Closed on November 26, 2024, 9:20am UTC

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