Storing vector<TLorentzVector>

dear all

I did not find this exact problem discussed so am posting it here.

My ntuple class has (among other stuff) this public data member in the header:

 vector<TLorentzVector> vtlv;

There is a LinkDef.h file with these lines:

 #include "TLorentzVector.h"
 #pragma link C++ class vector<TLorentzVector>+;

In the constructor I branch like this:

 m_tree->Branch("vtlv",        "vector<TLorentzVector>", &vtlv, 32000, 0);

I reset my variables at the beginning of each event, like this:

 vtlv.clear();

and fill normally.

All this works well in local tests (e.g lxplus), vtlv is stored and has correct structure and contents;
but the vtlv.clear() statement crashes grid jobs.

I am running root 5.28. Lxlplus is 64 bits, grid machines are 32 bits - this is the only difference I can see.

Does anyone have an idea? Is there anything non standard in the above?
I generally see people use vector* rather than vector for branch variables. Is this a better choice?

thanks for your help,
Maarten

Hi

an answer from myself, for the record

so for a priori unknown objects such as this one, the address used by tree->Branch() should be the address of a pointer to the object. For known objects, the address of an object works.

to using vector* vtlv, and branching with &vtlv, works well

Still a mystery to me why my wrong implementation worked well in local tests.

Maarten

[quote] the address used by tree->Branch() should be the address of a pointer to the object. For known objects, the address of an object works.[/quote]The two should equally work, however what do you mean by:[quote]so for a priori unknown objects such as this one[/quote]? My first thought is that in the broken case, there dictionary for the vector is missing.

Cheers,
Philippe.