I am trying to create a TVector from an std::vector. I have found the following older post:
but I find that this does not work. Rather, it works when I do .x mymacro.C in root, but not when I do .x mymacro.C+ (compiling). When compiling I get a segmentation fault (but no useful error messages).
My context is that I have a file with a tree with a single branch. The branch holds std::vectors, and I wish to perform some mathematical operations that are much easier with a TVector. Here is the code I am trying to use (based on the RootTalk post linked above):
TTree* C1 = (TTree*)gDirectory->Get(“C1”);
vector C1_vect = *C1_ampl;
As mentioned, it works when I just .x mymacro.C, but not with .x mymacro.C+. This indicates that it should be possible to add an #include line, or fix a -> vs . problem, but it is not obvious at all, since the only error message is a segmentation violation.
Thank you for any help,