Hi,
I have the following two branches in a ROOT tree:
cloneGenParticle = new TClonesArray("GenParticle");
tree->Branch("GenParticle", &cloneGenParticle, 32000, 2);
tree->Branch("nGenParticle", &fnGenParticle, "fnGenParticle/I");
where GenParticle is declared as:
[code]class GenParticle: public TObject {
public:
GenParticle();
~GenParticle() {}
double eta;
double phi;
double p;
double px;
double py;
double pz;
double pt;
double energy;
int pdgId;
double vx;
double vy;
double vz;
int status;
int numDaught;
int numMother;
int motherIndex;
std::vector motherIndices;
std::vector daughtIndices;
ClassDef(GenParticle,3)
};[/code]
Afterwards when I use TTree::MakeClass to create the code skeleton, I cannot correctly access the two vectors in the above class. TTree::MakeClass generates the following code for the two vectors:
…
vector<int> GenParticle_motherIndices[kMaxGenParticle];
vector<int> GenParticle_daughtIndices[kMaxGenParticle];
…
TBranch *b_GenParticle_motherIndices; //!
TBranch *b_GenParticle_daughtIndices; //!
and
fChain->SetBranchAddress("GenParticle.motherIndices", GenParticle_motherIndices, &b_GenParticle_motherIndices);
fChain->SetBranchAddress("GenParticle.daughtIndices", GenParticle_daughtIndices, &b_GenParticle_daughtIndices);
So I suppose the above is not the right way to do the job. Where am I going wrong here?
Thanks,
- Subir