Size of Vector of TLorentzVector

Can anyone suggest me where i did mistake. I have defined

std::vector<TLorentzVector> *Muons1 , *Electrons1 ;
t1->SetBranchAddress("Muons",&Muons1);
  t1->SetBranchAddress("Electrons",&Electrons1);

in my code. and trying to get size of Vector Muons and Electrons.

std::cout<<"Muonsize .....    "<<Muons1->size()<<std::endl;
std::cout<<"Electron ...."<<Electrons1->size()<<std::endl;

and i am getting error message like this

Please generate the dictionary for this collection (vector<TLorentzVector>) to avoid to write corrupted data.

Can anyone suggest me how to get size of Vector of TLorentzVector. Is there any other way to define it and get size (unlike Vector of Double data).
Please do reply
Thanks in advance.

Is TLorentzVector is not defined in ROOT??

Pointers must be initialized:

std::vector<TLorentzVector> *Muons1 = 0, *Electrons1 = 0;

and when the are not used (by your “t1” tree) any more, deleted:

delete Muons1;
delete Electrons1;

I guess with ROOT 5, you need to generate the dictionary using, for example, something like this:

gInterpreter->GenerateDictionary("std::vector<TLorentzVector>", "TLorentzVector.h;vector")

But,I am using ROOT 6

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