How to TChain trees outside the constructor?

in my C+±File, I want to use a multidimensional array of TChains to sort my files. Is there a way to set the TTree cointained in the chain not in the constructor? maybe I just didn’t see the right method.

This is the code I wanted to use, chain allocation doesn’t work this way:

TChain** chain=new TChain*[possibilities];
string** chain_names=new string *[possibilities];

for (int i=0;i<possibilities;i++) //this part works
chain_names[i]=new string[2];
// chain[i]=new TChain[2]; //would work, but how do I set the Tree?
for (int spin=0;spin<2;spin++)

for (int i=0;i<possibilities;i++)
for (int spin=0;spin<2;spin++)
chain[i][spin]=new TChain( chain_names[i][spin].c_str());
} //*see compiler error below

  • MainEvent.cpp: In function int main(int, char**)': MainEvent.cpp:92: error: no match forTChain& = TChain*&’ operator
    /home/perkeo/root/include/TChain.h:36: error: candidates are: TChain&
    TChain::operator=(const TChain&)

Thanks in advance!

Ok, I saw it, TChain::SetName()