# Copy std::vector from one TTree to another

**URL:** <https://root-forum.cern.ch/t/copy-std-vector-from-one-ttree-to-another/15255>\
**Category:** ROOT\
**Created:** [November 16, 2012, 8:23pm UTC](https://root-forum.cern.ch/t/copy-std-vector-from-one-ttree-to-another/15255 "2012-11-16T20:23:34Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![jfcaron](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/7c8e57/32.png) [@jfcaron](https://root-forum.cern.ch/u/jfcaron)\
**Post date:** [November 23, 2012, 6:53pm UTC](https://root-forum.cern.ch/t/copy-std-vector-from-one-ttree-to-another/15255/9 "2012-11-23T18:53:14Z")

</div>

My code for this is entirely in PyROOT, so I don’t know what part I am supposed to compile. I have seen other posts where people talk about a Loader.C file with some preprocessor directives, for using vector\<vector\> for example. Is such a file necessary for std::copy or vector::assign? I’m still not sure what I need to write in that file…my attempts at guessing are not working.

Example of a post with a Loader.C file:

> [@Error in filling Tree branch with vector of a Class](https://root-forum.cern.ch/t/error-in-filling-tree-branch-with-vector-of-a-class/13095/1):
>
> I am having trouble in filling a vector of Class in TTree. Following is my code and error. ////////////bar.hxx #include \<vector\> #include "EventLoopFunction.h" #include "TTree.h" struct bar{ int id, type, charge;}; class qHit{ public: int id; std::vector\<bar\> qclsthit; virtual ~qHit(){qclsthit.clear();}; void Print(){return;}; ClassDef(qHit,1) }; class ReconCluster:public EventLoopFunction{ private: TTree \*fTree; vector\<bar\> hit; vector\<qHit\> qclst; public: ReconCluster…

Jean-François

---

_[View the full topic](https://root-forum.cern.ch/t/copy-std-vector-from-one-ttree-to-another/15255)._
