Problem in writing a branch for Vector of TLorentzVector

Dear rooters,
I am trying to write a branch in a root tree following how a vector is to be written.
The snippet of the code I use is like this.
std::vector *Photon4Momentum;


edm::Service fs;
TFileDirectory spikeStudyDir = fs->mkdir(“SpikeStudy”);
myEvent = spikeStudyDir.make(“myEvent”,“a tree with histograms”);
Photon4Momentum = new std::vector();
myEvent->Branch(“Photon4Momentum”,“vector”, &Photon4Momentum);


But the rootfile doesn’t have this branch written in the tree. Though other branches with vectors of int are easily written. Could somebody please help me with this? I tried to look up a bit for this. Could not find someone doing it this way but saw people using TClonesArray for this but I am not really sure then why can’t one define a simple array of TLorentzVector? How are these 2 different? I am a bit confused.
Thanks for any help.

Regards
Sandhya

Hi Sandhya,

You probably did not generate, compile and link the dictionary for vector. TClonesArray is more efficient that std::vector has it allowed skipping the allocation and construction of the elements in most cases (and you don’t need to provide a dictionary for it). See the User’s Guide for mode details.

Cheers,
Philippe.