# Generate the dictionary for this collection (vector\<TLorentzVector\>) in TMVA

**URL:** <https://root-forum.cern.ch/t/generate-the-dictionary-for-this-collection-vector-tlorentzvector-in-tmva/45751>\
**Category:** TMVA\
**Created:** [July 8, 2021, 12:01pm UTC](https://root-forum.cern.ch/t/generate-the-dictionary-for-this-collection-vector-tlorentzvector-in-tmva/45751 "2021-07-08T12:01:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![setesami](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/setesami/32/26795_2.png) [@setesami](https://root-forum.cern.ch/u/setesami)\
**Post date:** [July 8, 2021, 12:01pm UTC](https://root-forum.cern.ch/t/generate-the-dictionary-for-this-collection-vector-tlorentzvector-in-tmva/45751/1 "2021-07-08T12:01:48Z")

</div>

I am using TMVA from ROOT 6.20/04 and try to read a vector of TLorentzVector.  
I know that I should generate the dictionary but non of the ways I found are working  
here is the part of the code I use

```auto
#ifdef __CINT__
 #pragma link C++ class std::vector<TLorentzVector>+;
 #endif
  std::vector <TLorentzVector> *JETS=NULL;
  theTree->SetBranchAddress( "JETS", &JETS);

```

This is perfectly works when I am writing in normal Root code but inside the TMVA iI get this error

```auto
Error in <TTree::SetBranchAddress>: The class requested (vector<TLorentzVector>) for the branch "JETS" is an instance of an stl collection and does not have a compiled CollectionProxy. Please generate the dictionary for this collection (vector<TLorentzVector>) to avoid to write corrupted data.

```

Any help is appreciated as this is very urgent for my work.

Thank you very much for your help  
Mohsen

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [July 8, 2021, 12:15pm UTC](https://root-forum.cern.ch/t/generate-the-dictionary-for-this-collection-vector-tlorentzvector-in-tmva/45751/2 "2021-07-08T12:15:10Z")

</div>

I guess @moneta and/or @pcanal may help 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:** [July 8, 2021, 1:27pm UTC](https://root-forum.cern.ch/t/generate-the-dictionary-for-this-collection-vector-tlorentzvector-in-tmva/45751/3 "2021-07-08T13:27:14Z")

</div>

Hi,  
You would probably need to add the dictionary library when linking your program.  
But who is reading the file and calling SetBranchAddress ? The TMVA library or your macro reading the file and doing a TMVA classification or regression ?

---

<div class="post-metadata">

**Author:** ![setesami](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/setesami/32/26795_2.png) [@setesami](https://root-forum.cern.ch/u/setesami)\
**Post date:** [July 8, 2021, 2:45pm UTC](https://root-forum.cern.ch/t/generate-the-dictionary-for-this-collection-vector-tlorentzvector-in-tmva/45751/4 "2021-07-08T14:45:09Z")

</div>

The reading and SetBranchAddress are done based on the “TMVAClassificationApplication” which is adopted for my usage.  
But how can l link the dictionary library?

---

<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:** [July 8, 2021, 3:24pm UTC](https://root-forum.cern.ch/t/generate-the-dictionary-for-this-collection-vector-tlorentzvector-in-tmva/45751/5 "2021-07-08T15:24:25Z")

</div>

Hi,  
Then if you are using in a macro, it should work by just calling `.L TMVAClassificationApplication.C`, you might need to add a `+` at the end to use ACLIC.  
Otherwise if you use `ROOT::Math::XYZTVector` that is recommended, this is already in the dictionary provided by ROOT See [ROOT: tutorials/math/mathcoreVectorCollection.C File Reference](https://root.cern/doc/master/mathcoreVectorCollection_8C.html)

Lorenzo

---

<div class="post-metadata">

**Author:** ![setesami](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/setesami/32/26795_2.png) [@setesami](https://root-forum.cern.ch/u/setesami)\
**Post date:** [July 8, 2021, 3:48pm UTC](https://root-forum.cern.ch/t/generate-the-dictionary-for-this-collection-vector-tlorentzvector-in-tmva/45751/6 "2021-07-08T15:48:47Z")

</div>

Thank you very much the .L is worked.
