# vector\<TVector3\> Seg Fault

**URL:** <https://root-forum.cern.ch/t/vector-tvector3-seg-fault/55904>\
**Category:** Newbie\
**Tags:** root\
**Created:** [August 3, 2023, 12:56pm UTC](https://root-forum.cern.ch/t/vector-tvector3-seg-fault/55904 "2023-08-03T12:56:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![srikanta](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/e480ec/32.png) [@srikanta](https://root-forum.cern.ch/u/srikanta)\
**Post date:** [August 3, 2023, 12:56pm UTC](https://root-forum.cern.ch/t/vector-tvector3-seg-fault/55904/1 "2023-08-03T12:56:31Z")

</div>

Adding vector TLorentzVector someName and vector TVector3 someName in headerfile crashing code (adding angle bracket to TLorentzVector make the word invisible here); even if I don’t use them in my .C file [header file includes #include, #include “TVector3.h”, #include “TLorentzVector.h”]

following line appears below of large crash report:  
#5 0x00007fb9c3ac793c in free () from /lib64/libc.so.6

however, vector float someName (or vector double someName) works fine

_ROOT Version:_ 5.34/38  
\_Platform: x86\_64 GNU/Linux  
\_Compiler:gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)

any suggestions? thank you.

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [August 7, 2023, 1:43pm UTC](https://root-forum.cern.ch/t/vector-tvector3-seg-fault/55904/2 "2023-08-07T13:43:52Z")

</div>

Hi,

Please post your macro showing the problem. It is not clear from the text. Also I see you are using a very old ROOT version, please consider upgrading to a newer one (e.g. 6.28)

Lorenzo

---

<div class="post-metadata">

**Author:** ![srikanta](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/e480ec/32.png) [@srikanta](https://root-forum.cern.ch/u/srikanta)\
**Post date:** [August 11, 2023, 10:00am UTC](https://root-forum.cern.ch/t/vector-tvector3-seg-fault/55904/3 "2023-08-11T10:00:14Z")

</div>

Sorry for delay, somehow this response did not make an email notification.  
Here are minimal working example:  
the code is made from MakeClass method.  
In header file,  
TVector3 vMom;  
vector \< TVector3 \> PionPlus;  
[header files are already added #include\< vector\> and #include “TVector3.h”]

In main file, Loop(), inside track loop  
vMom.SetXYZ(Px[iTracks], Py[iTracks], Pz[iTracks]);  
if (charge \> 0) PionPlus.push\_back(vMom);

After track loop finish,  
PionPlus.clear();

Please let me know if some additional information is needed.

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [August 17, 2023, 10:51am UTC](https://root-forum.cern.ch/t/vector-tvector3-seg-fault/55904/4 "2023-08-17T10:51:07Z")

</div>

Hi,  
Please attach the full code, it is not clear what the error is from what you are writing. You are also reading a ROOT file, I think, so we would need also the ROOT file to reproduce the crash

Lorenzo
