Pass a TClonesArray to a function

Hi,

How would I pass a TClonesArray pointer to a function? I have something like this:

void main()
{

TClonesArray *electronArr = new TClonesArray(“ElectronClassName”);
chain->SetBranchAddress(“Electron”, &electronArr);

}

Float_t f(…)
{

}

I am trying to figure out what f(…) should be. The function f will not modify the TClonesArray, so there should be a const somewhere but I am not really sure where. I do not want the elements of the TClonesArray to be destroyed when the function f finishes. Intuitively, I would guess that it should be f(const TClonesArray * ELECTRONARR), but I don’t really understand how the TClonesArray works, so I thought I should be careful and ask.

Thanks.

Andrew

f(const TClonesArray * ELECTRONARR),will work as you expect :slight_smile:

Cheers,
Philippe.